Mercurial > pidgin.yaz
changeset 5106:7b218dde1d73
[gaim-migrate @ 5469]
This is some IM image dialog fixes from Ka-Hing Cheung. It makes
"Conversation->Insert Image..." work if you have not used the button
on the toolbar yet. It makes clicking the button on the toolbar twice
close the select image dialog, and it makes closing the image dialog
toggle the insert image button back to an unpressed state.
Thanks javabsp, youdaman.
Also, my ICQ icon for unauthorized buddies is probably getting committed.
I'll commit the code that uses it later sometime.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 11 Apr 2003 07:01:54 +0000 |
parents | 4cfc49e31c2e |
children | b99910bfedd2 |
files | pixmaps/status/default/notauthorized.png src/gtkconv.c src/gtkconv.h |
diffstat | 3 files changed, 25 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Fri Apr 11 04:23:55 2003 +0000 +++ b/src/gtkconv.c Fri Apr 11 07:01:54 2003 +0000 @@ -142,7 +142,7 @@ struct stat st; int id; - conv = g_object_get_data(obj, "user_data"); + conv = g_object_get_data(G_OBJECT(wid), "user_data"); gtkconv = GAIM_GTK_CONVERSATION(conv); im = GAIM_IM(conv); name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); @@ -196,6 +196,16 @@ } static void +cancel_insert_image_cb(GtkWidget *unused, struct gaim_gtk_conversation *gtkconv) +{ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), FALSE); + + if (gtkconv->dialogs.image) + gtk_widget_destroy(gtkconv->dialogs.image); + gtkconv->dialogs.image = NULL; +} + +static void insert_image_cb(GtkWidget *save, struct gaim_conversation *conv) { struct gaim_gtk_conversation *gtkconv; @@ -209,17 +219,19 @@ g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), - "user_data", conv); + g_object_set_data(G_OBJECT(window), "user_data", conv); g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked", G_CALLBACK(do_insert_image_cb), window); - g_signal_connect_swapped( - G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), - "clicked", G_CALLBACK(gtk_widget_destroy), window); + g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), + "clicked", G_CALLBACK(cancel_insert_image_cb), gtkconv); gtk_widget_show(window); + gtkconv->dialogs.image = window; } else { gtk_widget_grab_focus(gtkconv->entry); + if(gtkconv->dialogs.image) + gtk_widget_destroy(gtkconv->dialogs.image); + gtkconv->dialogs.image = NULL; } } @@ -290,8 +302,12 @@ menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) { struct gaim_window *win = (struct gaim_window *)data; - - insert_image_cb(NULL, gaim_window_get_active_conversation(win)); + struct gaim_gtk_conversation *gtkconv; + + gtkconv = GAIM_GTK_CONVERSATION(gaim_window_get_active_conversation(win)); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), + !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); } static void