Mercurial > pidgin
changeset 21913:2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
out to be a pretty important thing to do. Not returning FALSE from a delete_event
callback would, for example, only hide a widget, instead of destroying it, which
can cause leaks.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 21 Dec 2007 14:19:29 +0000 |
parents | 6765b2b65d30 |
children | 44abd56f3298 |
files | pidgin/gtkaccount.c pidgin/gtkcertmgr.c pidgin/gtkconv.c pidgin/gtkdocklet-x11.c pidgin/gtkimhtmltoolbar.c pidgin/gtknotify.c pidgin/gtkrequest.c pidgin/gtkscrollbook.c pidgin/gtkstatusbox.c |
diffstat | 9 files changed, 32 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkaccount.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkaccount.c Fri Dec 21 14:19:29 2007 +0000 @@ -1108,7 +1108,7 @@ G_CALLBACK(proxy_type_changed_cb), dialog); } -static void +static gboolean account_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountPrefsDialog *dialog) { @@ -1129,6 +1129,7 @@ purple_signals_disconnect_by_handle(dialog); g_free(dialog); + return FALSE; } static void
--- a/pidgin/gtkcertmgr.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkcertmgr.c Fri Dec 21 14:19:29 2007 +0000 @@ -545,12 +545,13 @@ So if it is set, don't open another one! */ CertMgrDialog *certmgr_dialog = NULL; -static void +static gboolean certmgr_close_cb(GtkWidget *w, CertMgrDialog *dlg) { /* TODO: Ignoring the arguments to this function may not be ideal, but there *should* only be "one dialog to rule them all" at a time*/ pidgin_certmgr_hide(); + return FALSE; } void
--- a/pidgin/gtkconv.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkconv.c Fri Dec 21 14:19:29 2007 +0000 @@ -4579,11 +4579,12 @@ return FALSE; } -static void +static gboolean pidgin_conv_leave_cb (GtkWidget *w, GdkEventCrossing *e, PidginConversation *gtkconv) { pidgin_blist_tooltip_destroy(); reset_tooltip(); + return FALSE; } static gboolean
--- a/pidgin/gtkdocklet-x11.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkdocklet-x11.c Fri Dec 21 14:19:29 2007 +0000 @@ -79,13 +79,14 @@ g_idle_add(docklet_x11_recreate_cb, NULL); } -static void +static gboolean docklet_x11_clicked_cb(GtkWidget *button, GdkEventButton *event, void *data) { if (event->type != GDK_BUTTON_RELEASE) - return; + return FALSE; pidgin_docklet_clicked(event->button); + return TRUE; } static void
--- a/pidgin/gtkimhtmltoolbar.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Fri Dec 21 14:19:29 2007 +0000 @@ -99,7 +99,7 @@ gtk_widget_grab_focus(toolbar->imhtml); } -static void +static gboolean destroy_toolbar_font(GtkWidget *widget, GdkEvent *event, GtkIMHtmlToolbar *toolbar) { @@ -111,6 +111,7 @@ gtk_widget_destroy(toolbar->font_dialog); toolbar->font_dialog = NULL; } + return FALSE; } static void @@ -191,7 +192,7 @@ gtk_widget_grab_focus(toolbar->imhtml); } -static void +static gboolean destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event, GtkIMHtmlToolbar *toolbar) { @@ -203,6 +204,7 @@ gtk_widget_destroy(toolbar->fgcolor_dialog); toolbar->fgcolor_dialog = NULL; } + return FALSE; } static void cancel_toolbar_fgcolor(GtkWidget *widget, @@ -263,7 +265,7 @@ gtk_widget_grab_focus(toolbar->imhtml); } -static void +static gboolean destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, GtkIMHtmlToolbar *toolbar) { @@ -279,6 +281,7 @@ gtk_widget_destroy(toolbar->bgcolor_dialog); toolbar->bgcolor_dialog = NULL; } + return FALSE; } static void @@ -575,11 +578,12 @@ } } -static void +static gboolean close_smiley_dialog(GtkWidget *widget, GdkEvent *event, GtkIMHtmlToolbar *toolbar) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE); + return FALSE; }
--- a/pidgin/gtknotify.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtknotify.c Fri Dec 21 14:19:29 2007 +0000 @@ -166,16 +166,18 @@ mail_dialog = NULL; } -static void +static gboolean formatted_close_cb(GtkWidget *win, GdkEvent *event, void *user_data) { purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); + return FALSE; } -static void +static gboolean searchresults_close_cb(PidginNotifySearchResultsData *data, GdkEvent *event, gpointer user_data) { purple_notify_close(PURPLE_NOTIFY_SEARCHRESULTS, data); + return FALSE; } static void
--- a/pidgin/gtkrequest.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkrequest.c Fri Dec 21 14:19:29 2007 +0000 @@ -251,11 +251,12 @@ purple_request_close(PURPLE_REQUEST_FIELDS, data); } -static void +static gboolean destroy_multifield_cb(GtkWidget *dialog, GdkEvent *event, PidginRequestData *data) { multifield_cancel_cb(NULL, data); + return FALSE; } @@ -1505,7 +1506,7 @@ } #if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ -static void +static gboolean file_cancel_cb(PidginRequestData *data) { generic_response_start(data); @@ -1514,6 +1515,7 @@ ((PurpleRequestFileCb)data->cbs[0])(data->user_data, NULL); purple_request_close(data->type, data); + return FALSE; } #endif /* FILECHOOSER */
--- a/pidgin/gtkscrollbook.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkscrollbook.c Fri Dec 21 14:19:29 2007 +0000 @@ -64,7 +64,7 @@ return scroll_book_type; } -static void +static gboolean scroll_left_cb(PidginScrollBook *scroll_book) { int index; @@ -72,9 +72,10 @@ if (index > 0) gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index - 1); + return TRUE; } -static void +static gboolean scroll_right_cb(PidginScrollBook *scroll_book) { int index, count; @@ -87,6 +88,7 @@ if (index + 1 < count) gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index + 1); + return TRUE; } static void @@ -136,10 +138,11 @@ refresh_scroll_box(scroll_book, index, count); } -static void +static gboolean scroll_close_cb(PidginScrollBook *scroll_book) { gtk_widget_destroy(gtk_notebook_get_nth_page(GTK_NOTEBOOK(scroll_book->notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)))); + return FALSE; } static void
--- a/pidgin/gtkstatusbox.c Fri Dec 21 12:17:10 2007 +0000 +++ b/pidgin/gtkstatusbox.c Fri Dec 21 14:19:29 2007 +0000 @@ -1100,7 +1100,7 @@ return TRUE; } -static int imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) +static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) { if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab) {