From c43673f17f532a6c60ab2bfdfbda716d990d23f0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 23 Mar 2005 14:03:43 +0000 Subject: [PATCH] Some cleanups to the GtkDialog code: (#170746, Morten Welinder) Simplify, 2005-03-23 Matthias Clasen Some cleanups to the GtkDialog code: (#170746, Morten Welinder) * gtk/gtkdialog.c (action_widget_activated): Simplify, use _gtk_dialog_get_response_for_widget. (gtk_dialog_add_action_widget): Use the correct signal id for non-buttons. (gtk_dialog_set_response_sensitive): (gtk_dialog_set_default_response): Use get_response_data. (gtk_dialog_run): Don't disconnect the signals if the dialog was destroyed while running. --- ChangeLog | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ ChangeLog.pre-2-8 | 13 +++++++++++++ gtk/gtkdialog.c | 24 ++++++------------------ 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6a5ac24aa..6cef0c8f10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-03-23 Matthias Clasen + + Some cleanups to the GtkDialog code: (#170746, + Morten Welinder) + * gtk/gtkdialog.c (action_widget_activated): Simplify, + use _gtk_dialog_get_response_for_widget. + (gtk_dialog_add_action_widget): Use the correct signal + id for non-buttons. + (gtk_dialog_set_response_sensitive): + (gtk_dialog_set_default_response): Use get_response_data. + (gtk_dialog_run): Don't disconnect the signals if the + dialog was destroyed while running. + Tue Mar 22 14:16:31 2005 Manish Singh * gtk/gtkfilesystem.c (gtk_file_system_set_bookmark_label): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a6a5ac24aa..6cef0c8f10 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2005-03-23 Matthias Clasen + + Some cleanups to the GtkDialog code: (#170746, + Morten Welinder) + * gtk/gtkdialog.c (action_widget_activated): Simplify, + use _gtk_dialog_get_response_for_widget. + (gtk_dialog_add_action_widget): Use the correct signal + id for non-buttons. + (gtk_dialog_set_response_sensitive): + (gtk_dialog_set_default_response): Use get_response_data. + (gtk_dialog_run): Don't disconnect the signals if the + dialog was destroyed while running. + Tue Mar 22 14:16:31 2005 Manish Singh * gtk/gtkfilesystem.c (gtk_file_system_set_bookmark_label): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a6a5ac24aa..6cef0c8f10 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +2005-03-23 Matthias Clasen + + Some cleanups to the GtkDialog code: (#170746, + Morten Welinder) + * gtk/gtkdialog.c (action_widget_activated): Simplify, + use _gtk_dialog_get_response_for_widget. + (gtk_dialog_add_action_widget): Use the correct signal + id for non-buttons. + (gtk_dialog_set_response_sensitive): + (gtk_dialog_set_default_response): Use get_response_data. + (gtk_dialog_run): Don't disconnect the signals if the + dialog was destroyed while running. + Tue Mar 22 14:16:31 2005 Manish Singh * gtk/gtkfilesystem.c (gtk_file_system_set_bookmark_label): diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 77b207d8a6..bd80552acb 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -553,18 +553,9 @@ get_response_data (GtkWidget *widget, static void action_widget_activated (GtkWidget *widget, GtkDialog *dialog) { - ResponseData *ad; gint response_id; - g_return_if_fail (GTK_IS_DIALOG (dialog)); - - response_id = GTK_RESPONSE_NONE; - - ad = get_response_data (widget, TRUE); - - g_assert (ad != NULL); - - response_id = ad->response_id; + response_id = _gtk_dialog_get_response_for_widget (dialog, widget); gtk_dialog_response (dialog, response_id); } @@ -588,7 +579,7 @@ gtk_dialog_add_action_widget (GtkDialog *dialog, gint response_id) { ResponseData *ad; - gint signal_id = 0; + guint signal_id; g_return_if_fail (GTK_IS_DIALOG (dialog)); g_return_if_fail (GTK_IS_WIDGET (child)); @@ -600,7 +591,7 @@ gtk_dialog_add_action_widget (GtkDialog *dialog, if (GTK_IS_BUTTON (child)) signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON); else - signal_id = GTK_WIDGET_GET_CLASS (child)->activate_signal != 0; + signal_id = GTK_WIDGET_GET_CLASS (child)->activate_signal; if (signal_id) { @@ -742,8 +733,7 @@ gtk_dialog_set_response_sensitive (GtkDialog *dialog, while (tmp_list != NULL) { GtkWidget *widget = tmp_list->data; - ResponseData *rd = g_object_get_data (G_OBJECT (widget), - "gtk-dialog-response-data"); + ResponseData *rd = get_response_data (widget, FALSE); if (rd && rd->response_id == response_id) gtk_widget_set_sensitive (widget, setting); @@ -778,8 +768,7 @@ gtk_dialog_set_default_response (GtkDialog *dialog, while (tmp_list != NULL) { GtkWidget *widget = tmp_list->data; - ResponseData *rd = g_object_get_data (G_OBJECT (widget), - "gtk-dialog-response-data"); + ResponseData *rd = get_response_data (widget, FALSE); if (rd && rd->response_id == response_id) gtk_widget_grab_default (widget); @@ -985,7 +974,7 @@ run_destroy_handler (GtkDialog *dialog, gpointer data) gint gtk_dialog_run (GtkDialog *dialog) { - RunInfo ri = { NULL, GTK_RESPONSE_NONE, NULL }; + RunInfo ri = { NULL, GTK_RESPONSE_NONE, NULL, FALSE }; gboolean was_modal; gulong response_handler; gulong unmap_handler; @@ -1036,7 +1025,6 @@ gtk_dialog_run (GtkDialog *dialog) g_main_loop_unref (ri.loop); ri.loop = NULL; - ri.destroyed = FALSE; if (!ri.destroyed) {