Mercurial > pidgin.yaz
comparison pidgin/gtkwhiteboard.c @ 28204:58c8d6fc3aaf
Close the colour selection dialog when the whiteboard window is closed.
Fixes #9867.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 09 Aug 2009 05:17:11 +0000 |
parents | a3f7ade9e45b |
children | f1437342cc0e 2dcff225172e |
comparison
equal
deleted
inserted
replaced
28203:da22b6d0151e | 28204:58c8d6fc3aaf |
---|---|
271 } | 271 } |
272 | 272 |
273 static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) | 273 static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) |
274 { | 274 { |
275 PidginWhiteboard *gtkwb; | 275 PidginWhiteboard *gtkwb; |
276 GtkWidget *colour_dialog; | |
276 | 277 |
277 g_return_if_fail(wb != NULL); | 278 g_return_if_fail(wb != NULL); |
278 gtkwb = wb->ui_data; | 279 gtkwb = wb->ui_data; |
279 g_return_if_fail(gtkwb != NULL); | 280 g_return_if_fail(gtkwb != NULL); |
280 | 281 |
283 /* Clear graphical memory */ | 284 /* Clear graphical memory */ |
284 if(gtkwb->pixmap) | 285 if(gtkwb->pixmap) |
285 { | 286 { |
286 g_object_unref(gtkwb->pixmap); | 287 g_object_unref(gtkwb->pixmap); |
287 gtkwb->pixmap = NULL; | 288 gtkwb->pixmap = NULL; |
289 } | |
290 | |
291 colour_dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); | |
292 if (colour_dialog) { | |
293 gtk_widget_destroy(colour_dialog); | |
294 g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL); | |
288 } | 295 } |
289 | 296 |
290 if(gtkwb->window) | 297 if(gtkwb->window) |
291 { | 298 { |
292 gtk_widget_destroy(gtkwb->window); | 299 gtk_widget_destroy(gtkwb->window); |
802 } | 809 } |
803 else if(result == GTK_RESPONSE_CANCEL) | 810 else if(result == GTK_RESPONSE_CANCEL) |
804 { | 811 { |
805 gtk_widget_destroy(dialog); | 812 gtk_widget_destroy(dialog); |
806 | 813 |
807 purple_debug_info("gtkwhiteboard", "File not Saved... Canceled\n"); | 814 purple_debug_info("gtkwhiteboard", "File not Saved... Cancelled\n"); |
808 } | 815 } |
809 } | 816 } |
810 | 817 |
811 static void pidgin_whiteboard_set_canvas_as_icon(PidginWhiteboard *gtkwb) | 818 static void pidgin_whiteboard_set_canvas_as_icon(PidginWhiteboard *gtkwb) |
812 { | 819 { |
846 | 853 |
847 purple_whiteboard_get_brush(wb, &old_size, &old_color); | 854 purple_whiteboard_get_brush(wb, &old_size, &old_color); |
848 purple_whiteboard_send_brush(wb, old_size, new_color); | 855 purple_whiteboard_send_brush(wb, old_size, new_color); |
849 } | 856 } |
850 | 857 |
851 static void color_selection_dialog_destroy(GtkWidget *w, GtkWidget *destroy) | 858 static void color_selection_dialog_destroy(GtkWidget *w, PidginWhiteboard *gtkwb) |
852 { | 859 { |
853 gtk_widget_destroy(destroy); | 860 GtkWidget *dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); |
861 gtk_widget_destroy(dialog); | |
862 g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL); | |
854 } | 863 } |
855 | 864 |
856 static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) | 865 static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) |
857 { | 866 { |
858 GdkColor color; | 867 GdkColor color; |
859 GtkColorSelectionDialog *dialog; | 868 GtkColorSelectionDialog *dialog; |
860 | 869 |
861 dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color")); | 870 dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color")); |
871 g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", dialog); | |
862 | 872 |
863 g_signal_connect(G_OBJECT(dialog->colorsel), "color-changed", | 873 g_signal_connect(G_OBJECT(dialog->colorsel), "color-changed", |
864 G_CALLBACK(change_color_cb), gtkwb); | 874 G_CALLBACK(change_color_cb), gtkwb); |
865 | 875 |
866 gtk_widget_destroy(dialog->cancel_button); | 876 gtk_widget_destroy(dialog->cancel_button); |
867 gtk_widget_destroy(dialog->help_button); | 877 gtk_widget_destroy(dialog->help_button); |
868 | 878 |
869 g_signal_connect(G_OBJECT(dialog->ok_button), "clicked", | 879 g_signal_connect(G_OBJECT(dialog->ok_button), "clicked", |
870 G_CALLBACK(color_selection_dialog_destroy), dialog); | 880 G_CALLBACK(color_selection_dialog_destroy), gtkwb); |
871 | 881 |
872 gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(dialog->colorsel), TRUE); | 882 gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(dialog->colorsel), TRUE); |
873 | 883 |
874 pidgin_whiteboard_rgb24_to_rgb48(gtkwb->brush_color, &color); | 884 pidgin_whiteboard_rgb24_to_rgb48(gtkwb->brush_color, &color); |
875 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(dialog->colorsel), &color); | 885 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(dialog->colorsel), &color); |