/pidgin/main: 3fc5097c876d: Migrate gtksmiley.[ch] to GtkWebView...

Tomasz Wasilczyk twasilczyk at pidgin.im
Sat Feb 1 19:36:36 EST 2014


Changeset: 3fc5097c876d2010386602b6e786cc7a0ad25ca8
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-02-02 01:36 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/3fc5097c876d

Description:

Migrate gtksmiley.[ch] to GtkWebViewSmiley (it was just a coincidence, that it didn't crashed before)

diffstat:

 pidgin/gtksmiley.c |  56 ++++++++++++++++++++++++++++++++++-------------------
 pidgin/gtksmiley.h |  10 ++++----
 2 files changed, 41 insertions(+), 25 deletions(-)

diffs (187 lines):

diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c
--- a/pidgin/gtksmiley.c
+++ b/pidgin/gtksmiley.c
@@ -33,9 +33,9 @@
 #include "notify.h"
 #include "smiley.h"
 
-#include "gtkimhtml.h"
 #include "gtksmiley.h"
 #include "gtkutils.h"
+#include "gtkwebview.h"
 #include "pidginstock.h"
 
 #include "gtk3compat.h"
@@ -88,38 +88,49 @@ pidgin_smiley_destroy(PidginSmiley *smil
 }
 
 /******************************************************************************
- * GtkIMHtmlSmileys stuff
+ * GtkWebViewSmileys stuff
  *****************************************************************************/
 /* Perhaps these should be in gtkimhtml.c instead. -- sadrul */
-static void add_gtkimhtml_to_list(GtkIMHtmlSmiley *gtksmiley)
+static void add_gtkimhtml_to_list(GtkWebViewSmiley *gtksmiley)
 {
 	gtk_smileys = g_slist_prepend(gtk_smileys, gtksmiley);
 
-	purple_debug_info("gtksmiley", "adding %s to gtk_smileys\n", gtksmiley->smile);
+	purple_debug_info("gtksmiley", "adding %s to gtk_smileys",
+		gtk_webview_smiley_get_smile(gtksmiley));
 }
 
 static void
-shortcut_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley)
+shortcut_changed_cb(PurpleSmiley *smiley, gpointer dontcare,
+	GtkWebViewSmiley *gtksmiley)
 {
+#if 0
 	g_free(gtksmiley->smile);
 	gtksmiley->smile = g_strdup(purple_smiley_get_shortcut(smiley));
+#else
+	purple_debug_fatal("gtksmiley", "shortcut_changed_cb not implemented");
+#endif
 }
 
 static void
-image_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley)
+image_changed_cb(PurpleSmiley *smiley, gpointer dontcare,
+	GtkWebViewSmiley *gtksmiley)
 {
+#if 0
 	const char *file;
 
 	g_free(gtksmiley->file);
 
 	file = purple_imgstore_get_filename(purple_smiley_get_stored_image(smiley));
 	gtksmiley->file = g_build_filename(purple_smileys_get_storing_dir(), file, NULL);
-	gtk_imhtml_smiley_reload(gtksmiley);
+	gtk_webview_smiley_reload(gtksmiley);
+#else
+	purple_debug_fatal("gtksmiley", "image_changed_cb not implemented");
+#endif
 }
 
-static GtkIMHtmlSmiley *smiley_purple_to_gtkimhtml(PurpleSmiley *smiley)
+static GtkWebViewSmiley *smiley_purple_to_gtkimhtml(PurpleSmiley *smiley)
 {
-	GtkIMHtmlSmiley *gtksmiley;
+	GtkWebViewSmiley *gtksmiley;
 	gchar *filename;
 	const gchar *file;
 
@@ -127,11 +138,13 @@ static GtkIMHtmlSmiley *smiley_purple_to
 
 	filename = g_build_filename(purple_smileys_get_storing_dir(), file, NULL);
 
-	gtksmiley = gtk_imhtml_smiley_create(filename, purple_smiley_get_shortcut(smiley),
-			FALSE, GTK_IMHTML_SMILEY_CUSTOM);
+	gtksmiley = gtk_webview_smiley_create(filename,
+		purple_smiley_get_shortcut(smiley), FALSE,
+		GTK_WEBVIEW_SMILEY_CUSTOM);
 	g_free(filename);
 
-	/* Make sure the shortcut for the GtkIMHtmlSmiley is updated with the PurpleSmiley */
+	/* Make sure the shortcut for the GtkWebViewSmiley is updated with
+	 * the PurpleSmiley */
 	g_signal_connect(G_OBJECT(smiley), "notify::shortcut",
 			G_CALLBACK(shortcut_changed_cb), gtksmiley);
 
@@ -145,7 +158,7 @@ static GtkIMHtmlSmiley *smiley_purple_to
 void pidgin_smiley_del_from_list(PurpleSmiley *smiley)
 {
 	GSList *list = NULL;
-	GtkIMHtmlSmiley *gtksmiley;
+	GtkWebViewSmiley *gtksmiley;
 
 	if (gtk_smileys == NULL)
 		return;
@@ -153,12 +166,15 @@ void pidgin_smiley_del_from_list(PurpleS
 	list = gtk_smileys;
 
 	for (; list; list = list->next) {
-		gtksmiley = (GtkIMHtmlSmiley*)list->data;
+		gtksmiley = (GtkWebViewSmiley*)list->data;
 
-		if (strcmp(gtksmiley->smile, purple_smiley_get_shortcut(smiley)))
+		if (strcmp(gtk_webview_smiley_get_smile(gtksmiley),
+			purple_smiley_get_shortcut(smiley)))
+		{
 			continue;
+		}
 
-		gtk_imhtml_smiley_destroy(gtksmiley);
+		gtk_webview_smiley_destroy(gtksmiley);
 		g_signal_handlers_disconnect_matched(G_OBJECT(smiley), G_SIGNAL_MATCH_DATA,
 				0, 0, NULL, NULL, gtksmiley);
 		break;
@@ -170,7 +186,7 @@ void pidgin_smiley_del_from_list(PurpleS
 
 void pidgin_smiley_add_to_list(PurpleSmiley *smiley)
 {
-	GtkIMHtmlSmiley *gtksmiley;
+	GtkWebViewSmiley *gtksmiley;
 
 	gtksmiley = smiley_purple_to_gtkimhtml(smiley);
 	add_gtkimhtml_to_list(gtksmiley);
@@ -197,7 +213,7 @@ void pidgin_smileys_init(void)
 void pidgin_smileys_uninit(void)
 {
 	GSList *list;
-	GtkIMHtmlSmiley *gtksmiley;
+	GtkWebViewSmiley *gtksmiley;
 
 	list = gtk_smileys;
 
@@ -205,8 +221,8 @@ void pidgin_smileys_uninit(void)
 		return;
 
 	for (; list; list = g_slist_delete_link(list, list)) {
-		gtksmiley = (GtkIMHtmlSmiley*)list->data;
-		gtk_imhtml_smiley_destroy(gtksmiley);
+		gtksmiley = (GtkWebViewSmiley*)list->data;
+		gtk_webview_smiley_destroy(gtksmiley);
 	}
 
 	gtk_smileys = NULL;
diff --git a/pidgin/gtksmiley.h b/pidgin/gtksmiley.h
--- a/pidgin/gtksmiley.h
+++ b/pidgin/gtksmiley.h
@@ -34,7 +34,7 @@ typedef struct _PidginSmiley PidginSmile
 G_BEGIN_DECLS
 
 /**
- * Add a PurpleSmiley to the GtkIMHtmlSmiley's list to be able to use it
+ * Add a PurpleSmiley to the GtkWebViewSmiley's list to be able to use it
  * in pidgin
  *
  * @param smiley	The smiley to be added.
@@ -42,24 +42,24 @@ G_BEGIN_DECLS
 void pidgin_smiley_add_to_list(PurpleSmiley *smiley);
 
 /**
- * Delete a PurpleSmiley from the GtkIMHtmlSmiley's list
+ * Delete a PurpleSmiley from the GtkWebViewSmiley's list
  *
  * @param smiley	The smiley to be deleted.
  */
 void pidgin_smiley_del_from_list(PurpleSmiley *smiley);
 
 /**
- * Load the GtkIMHtml list
+ * Load the GtkWebViewSmiley list
  */
 void pidgin_smileys_init(void);
 
 /**
- * Uninit the GtkIMHtml list
+ * Uninit the GtkWebViewSmiley list
  */
 void pidgin_smileys_uninit(void);
 
 /**
- * Returns a GSList with the GtkIMHtmlSmiley of each custom smiley
+ * Returns a GSList with the GtkWebViewSmiley of each custom smiley
  *
  * @constreturn A GtkIMHmlSmiley list
  */



More information about the Commits mailing list