/dev/tomkiewicz/new-smileys: bb2c91c3e2db: Drop PidginWebViewSmiley
Tomasz Wasilczyk
twasilczyk at pidgin.im
Tue Apr 1 12:24:27 EDT 2014
Changeset: bb2c91c3e2dbb86a78b007dd31ff40c6dffe11f1
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-04-01 18:23 +0200
Branch: default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/bb2c91c3e2db
Description:
Drop PidginWebViewSmiley
diffstat:
pidgin/gtkconv.c | 10 +-
pidgin/gtksmiley.c | 138 +----------
pidgin/gtkwebview.c | 569 ---------------------------------------------
pidgin/gtkwebview.h | 128 ----------
pidgin/gtkwebviewtoolbar.c | 5 +-
5 files changed, 7 insertions(+), 843 deletions(-)
diffs (truncated from 986 to 300 lines):
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -2370,13 +2370,13 @@ pidgin_conv_switch_active_conversation(P
pidgin_webview_switch_active_conversation(
PIDGIN_WEBVIEW(gtkconv->entry), conv);
+ pidgin_webview_switch_active_conversation(
+ PIDGIN_WEBVIEW(gtkconv->webview), conv);
purple_conversation_set_logging(conv,
gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(gtkconv->win->menu->logging)));
entry = PIDGIN_WEBVIEW(gtkconv->entry);
protocol_name = purple_account_get_protocol_name(purple_conversation_get_account(conv));
- pidgin_webview_set_protocol_name(entry, protocol_name);
- pidgin_webview_set_protocol_name(PIDGIN_WEBVIEW(gtkconv->webview), protocol_name);
features = purple_conversation_get_features(conv);
if (!(features & PURPLE_CONNECTION_FLAG_HTML))
@@ -5714,8 +5714,6 @@ setup_common_pane(PidginConversation *gt
_pidgin_widget_set_accessible_name(frame, "Message Input");
gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry");
- pidgin_webview_set_protocol_name(PIDGIN_WEBVIEW(gtkconv->entry),
- purple_account_get_protocol_name(purple_conversation_get_account(conv)));
g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
G_CALLBACK(entry_popup_menu_cb), gtkconv);
@@ -6090,6 +6088,8 @@ private_gtkconv_new(PurpleConversation *
pidgin_webview_hide_toolbar(PIDGIN_WEBVIEW(gtkconv->entry));
pidgin_webview_switch_active_conversation(
PIDGIN_WEBVIEW(gtkconv->entry), conv);
+ pidgin_webview_switch_active_conversation(
+ PIDGIN_WEBVIEW(gtkconv->webview), conv);
if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
gtk_widget_show(gtkconv->infopane_hbox);
@@ -7501,8 +7501,6 @@ gray_stuff_out(PidginConversation *gtkco
buttons &= ~PIDGIN_WEBVIEW_CUSTOM_SMILEY;
pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(gtkconv->entry), buttons);
- if (account != NULL)
- pidgin_webview_set_protocol_name(PIDGIN_WEBVIEW(gtkconv->entry), purple_account_get_protocol_id(account));
/* Deal with menu items */
gtk_action_set_sensitive(win->menu->view_log, TRUE);
diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c
--- a/pidgin/gtksmiley.c
+++ b/pidgin/gtksmiley.c
@@ -68,7 +68,6 @@ enum
};
static SmileyManager *smiley_manager = NULL;
-static GSList *gtk_smileys = NULL;
static void
pidgin_smiley_destroy(PidginSmiley *smiley)
@@ -85,153 +84,18 @@ pidgin_smiley_destroy(PidginSmiley *smil
/******************************************************************************
* PidginWebViewSmileys stuff
*****************************************************************************/
-/* Perhaps these should be in gtkwebview.c instead. -- sadrul */
-static void add_gtkwebview_to_list(PidginWebViewSmiley *gtksmiley)
-{
- gtk_smileys = g_slist_prepend(gtk_smileys, gtksmiley);
-
- purple_debug_info("gtksmiley", "adding %s to gtk_smileys",
- pidgin_webview_smiley_get_smile(gtksmiley));
-}
-
-static void
-shortcut_changed_cb(PurpleSmiley *smiley, gpointer dontcare,
- PidginWebViewSmiley *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,
- PidginWebViewSmiley *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);
- pidgin_webview_smiley_reload(gtksmiley);
-#else
- purple_debug_fatal("gtksmiley", "image_changed_cb not implemented");
-#endif
-}
-
-#if 0
-static PidginWebViewSmiley *smiley_purple_to_gtkwebview(PurpleSmiley *smiley)
-{
- PidginWebViewSmiley *gtksmiley;
- gchar *filename;
- const gchar *file;
-
- file = purple_imgstore_get_filename(purple_smiley_get_stored_image(smiley));
-
- filename = g_build_filename(purple_smileys_get_storing_dir(), file, NULL);
-
- gtksmiley = pidgin_webview_smiley_create(filename,
- purple_smiley_get_shortcut(smiley), FALSE,
- PIDGIN_WEBVIEW_SMILEY_CUSTOM);
- g_free(filename);
-
- /* Make sure the shortcut for the PidginWebViewSmiley is updated with
- * the PurpleSmiley */
- g_signal_connect(G_OBJECT(smiley), "notify::shortcut",
- G_CALLBACK(shortcut_changed_cb), gtksmiley);
-
- /* And update the pixbuf too when the image is changed */
- g_signal_connect(G_OBJECT(smiley), "notify::image",
- G_CALLBACK(image_changed_cb), gtksmiley);
-
- return gtksmiley;
-}
-#endif
-
-void pidgin_smiley_del_from_list(PurpleSmiley *smiley)
-{
- GSList *list = NULL;
- PidginWebViewSmiley *gtksmiley;
-
- if (gtk_smileys == NULL)
- return;
-
- list = gtk_smileys;
-
- for (; list; list = list->next) {
- gtksmiley = (PidginWebViewSmiley*)list->data;
-
- if (strcmp(pidgin_webview_smiley_get_smile(gtksmiley),
- purple_smiley_get_shortcut(smiley)))
- {
- continue;
- }
-
- pidgin_webview_smiley_destroy(gtksmiley);
- g_signal_handlers_disconnect_matched(G_OBJECT(smiley), G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gtksmiley);
- break;
- }
-
- if (list)
- gtk_smileys = g_slist_delete_link(gtk_smileys, list);
-}
-
-#if 0
-void pidgin_smiley_add_to_list(PurpleSmiley *smiley)
-{
- PidginWebViewSmiley *gtksmiley;
-
- gtksmiley = smiley_purple_to_gtkwebview(smiley);
- add_gtkwebview_to_list(gtksmiley);
- g_signal_connect(G_OBJECT(smiley), "destroy", G_CALLBACK(pidgin_smiley_del_from_list), NULL);
-}
-#endif
void pidgin_smileys_init(void)
{
-#if 0
- GList *smileys;
- PurpleSmiley *smiley;
-
- if (gtk_smileys != NULL)
- return;
-
- smileys = purple_smileys_get_all();
-
- for (; smileys; smileys = g_list_delete_link(smileys, smileys)) {
- smiley = (PurpleSmiley*)smileys->data;
-
- pidgin_smiley_add_to_list(smiley);
- }
-#endif
}
void pidgin_smileys_uninit(void)
{
- GSList *list;
- PidginWebViewSmiley *gtksmiley;
-
- list = gtk_smileys;
-
- if (list == NULL)
- return;
-
- for (; list; list = g_slist_delete_link(list, list)) {
- gtksmiley = (PidginWebViewSmiley*)list->data;
- pidgin_webview_smiley_destroy(gtksmiley);
- }
-
- gtk_smileys = NULL;
}
GSList *pidgin_smileys_get_all(void)
{
- return gtk_smileys;
+ return NULL;
}
/******************************************************************************
diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -85,26 +85,6 @@ typedef struct {
gboolean (*context_menu)(PidginWebView *webview, WebKitDOMHTMLAnchorElement *link, GtkWidget *menu);
} PidginWebViewProtocol;
-struct _PidginWebViewSmiley {
- gchar *smile;
- gchar *file;
- GdkPixbufAnimation *icon;
- gboolean hidden;
- GdkPixbufLoader *loader;
- GSList *anchors;
- PidginWebViewSmileyFlags flags;
- PidginWebView *webview;
- gpointer data;
- gsize datasize;
-};
-
-typedef struct _GtkSmileyTree GtkSmileyTree;
-struct _GtkSmileyTree {
- GString *values;
- GtkSmileyTree **children;
- PidginWebViewSmiley *image;
-};
-
typedef struct _PidginWebViewPriv {
/* Processing queues */
gboolean is_loading;
@@ -125,11 +105,6 @@ typedef struct _PidginWebViewPriv {
gboolean block_changed:1;
} edit;
- /* Smileys */
- char *protocol_name;
- GHashTable *smiley_data;
- GtkSmileyTree *default_smilies;
-
/* WebKit inspector */
WebKitWebView *inspector_view;
GtkWindow *inspector_win;
@@ -141,542 +116,6 @@ typedef struct _PidginWebViewPriv {
static WebKitWebViewClass *parent_class = NULL;
-/******************************************************************************
- * Smileys
- *****************************************************************************/
-
-const char *
-pidgin_webview_get_protocol_name(PidginWebView *webview)
-{
- PidginWebViewPriv *priv;
-
- g_return_val_if_fail(webview != NULL, NULL);
-
- priv = PIDGIN_WEBVIEW_GET_PRIVATE(webview);
- return priv->protocol_name;
-}
-
-void
-pidgin_webview_set_protocol_name(PidginWebView *webview, const char *protocol_name)
-{
- PidginWebViewPriv *priv;
-
- g_return_if_fail(webview != NULL);
-
- priv = PIDGIN_WEBVIEW_GET_PRIVATE(webview);
- priv->protocol_name = g_strdup(protocol_name);
-}
-
-static GtkSmileyTree *
-gtk_smiley_tree_new(void)
-{
- return g_new0(GtkSmileyTree, 1);
-}
-
-static void
-gtk_smiley_tree_insert(GtkSmileyTree *tree, PidginWebViewSmiley *smiley)
-{
- GtkSmileyTree *t = tree;
- const char *x = smiley->smile;
-
- if (!(*x))
- return;
-
- do {
More information about the Commits
mailing list