pidgin/pidgin

Migrate gtksmiley.[ch] to GtkWebViewSmiley (it was just a coincidence, that it didn't crashed before)
--- a/pidgin/gtksmiley.c Sun Feb 02 00:51:25 2014 +0100
+++ b/pidgin/gtksmiley.c Sun Feb 02 01:36:26 2014 +0100
@@ -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 @@
}
/******************************************************************************
- * 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 @@
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 @@
void pidgin_smiley_del_from_list(PurpleSmiley *smiley)
{
GSList *list = NULL;
- GtkIMHtmlSmiley *gtksmiley;
+ GtkWebViewSmiley *gtksmiley;
if (gtk_smileys == NULL)
return;
@@ -153,12 +166,15 @@
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_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_uninit(void)
{
GSList *list;
- GtkIMHtmlSmiley *gtksmiley;
+ GtkWebViewSmiley *gtksmiley;
list = gtk_smileys;
@@ -205,8 +221,8 @@
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;
--- a/pidgin/gtksmiley.h Sun Feb 02 00:51:25 2014 +0100
+++ b/pidgin/gtksmiley.h Sun Feb 02 01:36:26 2014 +0100
@@ -34,7 +34,7 @@
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 @@
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
*/