Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 11799:a3c28707ef4d
[gaim-migrate @ 14090]
Stop passing around GaimConversations and then pretending they're GaimGtkConversations -- fixes buddy icon animation and two related crashes. --Kevin Stange
committer: Tailor Script <tailor@pidgin.im>
author | Gary Kramlich <grim@reaperworld.com> |
---|---|
date | Mon, 24 Oct 2005 20:33:06 +0000 |
parents | c9188d3eb9d3 |
children | 615c2fd3d72e |
comparison
equal
deleted
inserted
replaced
11798:01c3eec6ea3c | 11799:a3c28707ef4d |
---|---|
2095 GdkPixmap *pm; | 2095 GdkPixmap *pm; |
2096 GdkBitmap *bm; | 2096 GdkBitmap *bm; |
2097 gint delay; | 2097 gint delay; |
2098 int scale_width, scale_height; | 2098 int scale_width, scale_height; |
2099 | 2099 |
2100 if (!g_list_find(gaim_get_ims(), conv)) { | |
2101 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2102 "Conversation not found in redraw_icon. I think this " | |
2103 "is a bug.\n"); | |
2104 return FALSE; | |
2105 } | |
2106 | |
2107 gtkconv = GAIM_GTK_CONVERSATION(conv); | 2100 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2108 account = gaim_conversation_get_account(conv); | 2101 account = gaim_conversation_get_account(conv); |
2109 if(account && account->gc) | 2102 if(account && account->gc) |
2110 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | 2103 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); |
2111 | 2104 |
2135 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | 2128 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2136 | 2129 |
2137 if (delay < 100) | 2130 if (delay < 100) |
2138 delay = 100; | 2131 delay = 100; |
2139 | 2132 |
2140 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | 2133 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv); |
2141 | 2134 |
2142 return FALSE; | 2135 return FALSE; |
2143 } | 2136 } |
2144 | 2137 |
2145 static void | 2138 static void |
2146 start_anim(GtkObject *obj, GaimGtkConversation *gtkconv) | 2139 start_anim(GtkObject *obj, GaimGtkConversation *gtkconv) |
2147 { | 2140 { |
2148 GaimConversation *conv = gtkconv->active_conv; | |
2149 int delay; | 2141 int delay; |
2150 | 2142 |
2151 if (gtkconv->u.im->anim == NULL) | 2143 if (gtkconv->u.im->anim == NULL) |
2152 return; | 2144 return; |
2153 | 2145 |
2160 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | 2152 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2161 | 2153 |
2162 if (delay < 100) | 2154 if (delay < 100) |
2163 delay = 100; | 2155 delay = 100; |
2164 | 2156 |
2165 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | 2157 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv); |
2166 } | 2158 } |
2167 | 2159 |
2168 static void | 2160 static void |
2169 remove_icon(GaimGtkConversation *gtkconv) | 2161 remove_icon(GaimGtkConversation *gtkconv) |
2170 { | 2162 { |
2237 ext = "icon"; | 2229 ext = "icon"; |
2238 | 2230 |
2239 buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext); | 2231 buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext); |
2240 | 2232 |
2241 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | 2233 gaim_request_file(conv, _("Save Icon"), buf, TRUE, |
2242 G_CALLBACK(saveicon_writefile_cb), NULL, conv); | 2234 G_CALLBACK(saveicon_writefile_cb), NULL, gtkconv); |
2243 | 2235 |
2244 g_free(buf); | 2236 g_free(buf); |
2245 } | 2237 } |
2246 | 2238 |
2247 static void | 2239 static void |
2267 } | 2259 } |
2268 | 2260 |
2269 static gboolean | 2261 static gboolean |
2270 icon_menu(GtkObject *obj, GdkEventButton *e, GaimGtkConversation *gtkconv) | 2262 icon_menu(GtkObject *obj, GdkEventButton *e, GaimGtkConversation *gtkconv) |
2271 { | 2263 { |
2272 GaimConversation *conv = gtkconv->active_conv; | |
2273 static GtkWidget *menu = NULL; | 2264 static GtkWidget *menu = NULL; |
2274 GtkWidget *button; | 2265 GtkWidget *button; |
2275 | 2266 |
2276 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | 2267 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) |
2277 return FALSE; | 2268 return FALSE; |
2287 | 2278 |
2288 if (gtkconv->u.im->anim && | 2279 if (gtkconv->u.im->anim && |
2289 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | 2280 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) |
2290 { | 2281 { |
2291 gaim_new_check_item(menu, _("Animate"), | 2282 gaim_new_check_item(menu, _("Animate"), |
2292 G_CALLBACK(toggle_icon_animate_cb), conv, | 2283 G_CALLBACK(toggle_icon_animate_cb), gtkconv, |
2293 gtkconv->u.im->icon_timer); | 2284 gtkconv->u.im->icon_timer); |
2294 } | 2285 } |
2295 | 2286 |
2296 button = gtk_menu_item_new_with_label(_("Hide Icon")); | 2287 button = gtk_menu_item_new_with_label(_("Hide Icon")); |
2297 g_signal_connect_swapped(G_OBJECT(button), "activate", | 2288 g_signal_connect_swapped(G_OBJECT(button), "activate", |