Mercurial > pidgin.yaz
comparison pidgin/gtkimhtml.c @ 27906:6ecfc6b9667c
propagate from branch 'im.pidgin.pidgin' (head ca4b6e987b967927b0f8bd001bc33440a6885000)
to branch 'im.pidgin.pidgin.yaz' (head 7a92169e2ac82026d2b2918ed9662c7fd42e3280)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 17 Nov 2008 06:15:33 +0000 |
parents | 45ce87f9a07f 9ea84135db24 |
children | a959b17ffc57 |
comparison
equal
deleted
inserted
replaced
27905:45ce87f9a07f | 27906:6ecfc6b9667c |
---|---|
2067 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) user_data; | 2067 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) user_data; |
2068 gtk_smiley_tree_remove(tree, smiley); | 2068 gtk_smiley_tree_remove(tree, smiley); |
2069 } | 2069 } |
2070 | 2070 |
2071 static void | 2071 static void |
2072 gtk_imhtml_disconnect_smiley(GtkIMHtml *imhtml, GtkIMHtmlSmiley *smiley) | |
2073 { | |
2074 smiley->imhtml = NULL; | |
2075 g_signal_handlers_disconnect_matched(imhtml, G_SIGNAL_MATCH_DATA, 0, 0, | |
2076 NULL, NULL, smiley); | |
2077 } | |
2078 | |
2079 static void | |
2072 gtk_imhtml_disassociate_smiley(GtkIMHtmlSmiley *smiley) | 2080 gtk_imhtml_disassociate_smiley(GtkIMHtmlSmiley *smiley) |
2073 { | 2081 { |
2074 if (smiley->imhtml) { | 2082 if (smiley->imhtml) { |
2075 gtk_smiley_tree_remove(smiley->imhtml->default_smilies, smiley); | 2083 gtk_smiley_tree_remove(smiley->imhtml->default_smilies, smiley); |
2076 g_hash_table_foreach(smiley->imhtml->smiley_data, | 2084 g_hash_table_foreach(smiley->imhtml->smiley_data, |
2077 gtk_imhtml_disassociate_smiley_foreach, smiley); | 2085 gtk_imhtml_disassociate_smiley_foreach, smiley); |
2086 g_signal_handlers_disconnect_matched(smiley->imhtml, G_SIGNAL_MATCH_DATA, | |
2087 0, 0, NULL, NULL, smiley); | |
2088 smiley->imhtml = NULL; | |
2078 } | 2089 } |
2079 } | 2090 } |
2080 | 2091 |
2081 void | 2092 void |
2082 gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | 2093 gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, |
2092 else if (!(tree = g_hash_table_lookup(imhtml->smiley_data, sml))) { | 2103 else if (!(tree = g_hash_table_lookup(imhtml->smiley_data, sml))) { |
2093 tree = gtk_smiley_tree_new(); | 2104 tree = gtk_smiley_tree_new(); |
2094 g_hash_table_insert(imhtml->smiley_data, g_strdup(sml), tree); | 2105 g_hash_table_insert(imhtml->smiley_data, g_strdup(sml), tree); |
2095 } | 2106 } |
2096 | 2107 |
2108 /* need to disconnect old imhtml, if there is one */ | |
2109 if (smiley->imhtml) { | |
2110 g_signal_handlers_disconnect_matched(smiley->imhtml, G_SIGNAL_MATCH_DATA, | |
2111 0, 0, NULL, NULL, smiley); | |
2112 } | |
2113 | |
2097 smiley->imhtml = imhtml; | 2114 smiley->imhtml = imhtml; |
2098 | 2115 |
2099 gtk_smiley_tree_insert (tree, smiley); | 2116 gtk_smiley_tree_insert (tree, smiley); |
2117 | |
2118 /* connect destroy signal for the imhtml */ | |
2119 g_signal_connect(imhtml, "destroy", G_CALLBACK(gtk_imhtml_disconnect_smiley), | |
2120 smiley); | |
2100 } | 2121 } |
2101 | 2122 |
2102 static gboolean | 2123 static gboolean |
2103 gtk_imhtml_is_smiley (GtkIMHtml *imhtml, | 2124 gtk_imhtml_is_smiley (GtkIMHtml *imhtml, |
2104 GSList *fonts, | 2125 GSList *fonts, |