[gnome-online-accounts] imap-smtp: Adjust the UI so that we can use a header bar in the dialog



commit fc8aaf8904e3eb8049b1d2559c16d02d6ae24465
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed May 21 12:56:58 2014 +0200

    imap-smtp: Adjust the UI so that we can use a header bar in the dialog
    
    Using a header bar means that the dialog can emit both
    GTK_RESPONSE_CANCEL (from the cancel button) and
    GTK_RESPONSE_DELETE_EVENT (from the Esc key), so we should account for
    that. This is also a good opportunity to stop using the action area.
    
    Fixes: https://bugzilla.gnome.org/729638

 src/goabackend/goaimapsmtpprovider.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/goabackend/goaimapsmtpprovider.c b/src/goabackend/goaimapsmtpprovider.c
index 4a6a025..c111551 100644
--- a/src/goabackend/goaimapsmtpprovider.c
+++ b/src/goabackend/goaimapsmtpprovider.c
@@ -668,7 +668,6 @@ create_account_details_ui (GoaProvider    *provider,
                            gboolean        new_account,
                            AddAccountData *data)
 {
-  GtkWidget *action_area;
   GtkWidget *grid0;
   GtkWidget *grid1;
   GtkWidget *label;
@@ -765,19 +764,16 @@ create_account_details_ui (GoaProvider    *provider,
 
   /* -- */
 
+  gtk_dialog_add_button (data->dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
   data->forward_button = gtk_dialog_add_button (data->dialog, _("_Forward"), GTK_RESPONSE_OK);
   gtk_dialog_set_default_response (data->dialog, GTK_RESPONSE_OK);
   gtk_dialog_set_response_sensitive (data->dialog, GTK_RESPONSE_OK, FALSE);
 
-  action_area = gtk_dialog_get_action_area (data->dialog);
-
   data->progress_grid = gtk_grid_new ();
   gtk_widget_set_no_show_all (data->progress_grid, TRUE);
   gtk_orientable_set_orientation (GTK_ORIENTABLE (data->progress_grid), GTK_ORIENTATION_HORIZONTAL);
   gtk_grid_set_column_spacing (GTK_GRID (data->progress_grid), 3);
-  gtk_box_pack_end (GTK_BOX (action_area), data->progress_grid, FALSE, FALSE, 0);
-  gtk_box_reorder_child (GTK_BOX (action_area), data->progress_grid, 0);
-  gtk_button_box_set_child_non_homogeneous (GTK_BUTTON_BOX (action_area), data->progress_grid, TRUE);
+  gtk_container_add (GTK_CONTAINER (grid0), data->progress_grid);
 
   spinner = gtk_spinner_new ();
   gtk_widget_set_size_request (spinner, 20, 20);
@@ -865,7 +861,7 @@ dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data)
 {
   AddAccountData *data = user_data;
 
-  if (response_id == GTK_RESPONSE_CANCEL)
+  if (response_id == GTK_RESPONSE_CANCEL || response_id == GTK_RESPONSE_DELETE_EVENT)
     g_cancellable_cancel (data->cancellable);
 }
 
@@ -1269,8 +1265,10 @@ refresh_account (GoaProvider    *provider,
 
   dialog = gtk_dialog_new_with_buttons (NULL,
                                         parent,
-                                        GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT
+                                        | GTK_DIALOG_USE_HEADER_BAR,
+                                        NULL,
                                         NULL);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]