[file-roller] dlg-add: Respect the DialogsUseHeader gtksetting



commit 4ac348f2602f583d3956b70c0d35fadeeeebc600
Author: Iain Lane <iain orangesquash org uk>
Date:   Tue Dec 23 20:58:03 2014 +0000

    dlg-add: Respect the DialogsUseHeader gtksetting
    
    Put the 'Options' button in the action area if we're not using the
    headerbar.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741925

 src/dlg-add.c                 |   16 ++++++++++++++--
 src/fr-file-selector-dialog.c |    7 ++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/dlg-add.c b/src/dlg-add.c
index d93a09a..a4cbf2e 100644
--- a/src/dlg-add.c
+++ b/src/dlg-add.c
@@ -173,6 +173,7 @@ dlg_add (FrWindow *window)
        GtkWidget  *options_button;
        GtkWidget  *options_menu;
        GtkWidget  *menu_item;
+       gboolean   use_header;
 
        data = g_new0 (DialogData, 1);
        data->settings = g_settings_new (FILE_ROLLER_SCHEMA_ADD);
@@ -180,6 +181,8 @@ dlg_add (FrWindow *window)
        data->dialog = fr_file_selector_dialog_new (_("Add Files"), GTK_WINDOW (data->window));
        gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK);
 
+       g_object_get (data->dialog, "use-header-bar", &use_header, NULL);
+
        data->builder = _gtk_builder_new_from_resource ("add-dialog-options.ui");
        if (data->builder == NULL)
                return;
@@ -219,14 +222,23 @@ dlg_add (FrWindow *window)
 
        /* add the buttons */
 
+       if (!use_header)
+               gtk_box_pack_start (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (data->dialog))),
+                                    options_button,
+                                    FALSE,
+                                    FALSE,
+                                    0);
+
        gtk_dialog_add_button (GTK_DIALOG (data->dialog),
                               _GTK_LABEL_CANCEL,
                               GTK_RESPONSE_CANCEL);
        gtk_dialog_add_button (GTK_DIALOG (data->dialog),
                               _GTK_LABEL_ADD,
                               GTK_RESPONSE_OK);
-       gtk_header_bar_pack_end (GTK_HEADER_BAR (gtk_dialog_get_header_bar (GTK_DIALOG (data->dialog))),
-                                options_button);
+
+       if (use_header)
+               gtk_header_bar_pack_end (GTK_HEADER_BAR (gtk_dialog_get_header_bar (
+                                               GTK_DIALOG (data->dialog))), options_button);
 
        /* set data */
 
diff --git a/src/fr-file-selector-dialog.c b/src/fr-file-selector-dialog.c
index 8238e65..fab17b9 100644
--- a/src/fr-file-selector-dialog.c
+++ b/src/fr-file-selector-dialog.c
@@ -712,10 +712,15 @@ GtkWidget *
 fr_file_selector_dialog_new (const char *title,
                             GtkWindow  *parent)
 {
+       gboolean use_header;
+       g_object_get (gtk_settings_get_default (),
+                                 "gtk-dialogs-use-header", &use_header,
+                                 NULL);
+
        return (GtkWidget *) g_object_new (FR_TYPE_FILE_SELECTOR_DIALOG,
                                           "title", title,
                                           "transient-for", parent,
-                                          "use-header-bar", TRUE,
+                                          "use-header-bar", use_header,
                                           NULL);
 }
 


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