diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-05 19:57:30 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-05 19:57:30 +0800 |
commit | 4ec46cc05fcb94d181fb9c2412984a1446647c85 (patch) | |
tree | d16ce30e77dd539c03509237dd4c723d46aea97a /e-util/e-alert-dialog.c | |
parent | 5ea7e23aef0c239af2600c95419ba0bda0f08b3c (diff) | |
parent | 19163c2b71e6128fc9b32287b99b1f4422324c2d (diff) | |
download | gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.gz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.bz2 gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.lz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.xz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.zst gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.zip |
Merge from master
Diffstat (limited to 'e-util/e-alert-dialog.c')
-rw-r--r-- | e-util/e-alert-dialog.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c index 8696588ab2..70e53432f3 100644 --- a/e-util/e-alert-dialog.c +++ b/e-util/e-alert-dialog.c @@ -120,6 +120,7 @@ alert_dialog_constructed (GObject *object) PangoAttrList *list; GList *actions; const gchar *primary, *secondary; + gint default_response; gint min_width = -1, prefer_width = -1; gint height; @@ -129,6 +130,8 @@ alert_dialog_constructed (GObject *object) dialog = E_ALERT_DIALOG (object); alert = e_alert_dialog_get_alert (dialog); + default_response = e_alert_get_default_response (alert); + gtk_window_set_title (GTK_WINDOW (dialog), " "); action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); @@ -149,15 +152,19 @@ alert_dialog_constructed (GObject *object) actions = e_alert_peek_actions (alert); while (actions != NULL) { GtkWidget *button; + gpointer data; /* These actions are already wired to trigger an * EAlert::response signal when activated, which * will in turn call to gtk_dialog_response(), * so we can add buttons directly to the action - * area without knowing their response IDs. */ + * area without knowing their response IDs. + * (XXX Well, kind of. See below.) */ button = gtk_button_new (); + gtk_widget_set_can_default (button, TRUE); + gtk_activatable_set_related_action ( GTK_ACTIVATABLE (button), GTK_ACTION (actions->data)); @@ -166,14 +173,23 @@ alert_dialog_constructed (GObject *object) GTK_BOX (action_area), button, FALSE, FALSE, 0); + /* This is set in e_alert_add_action(). */ + data = g_object_get_data ( + actions->data, "e-alert-response-id"); + + /* Normally GtkDialog sets the initial focus widget to + * the button corresponding to the default response, but + * because the buttons are not directly tied to response + * IDs, we have set both the default widget and the + * initial focus widget ourselves. */ + if (GPOINTER_TO_INT (data) == default_response) { + gtk_widget_grab_default (button); + gtk_widget_grab_focus (button); + } + actions = g_list_next (actions); } - if (e_alert_get_default_response (alert)) - gtk_dialog_set_default_response ( - GTK_DIALOG (dialog), - e_alert_get_default_response (alert)); - widget = gtk_hbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (widget), 12); gtk_box_pack_start (GTK_BOX (content_area), widget, FALSE, FALSE, 0); |