[gtk+] mount operation: Use headerbar



commit dc749c5a27663bb2618090b055d30a0630afa175
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 15 06:23:38 2014 -0500

    mount operation: Use headerbar
    
    Make GtkMountOperation use a headerbar for its dialog
    when desired.

 gtk/gtkmountoperation.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index 850ac82..6016a1b 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -48,6 +48,7 @@
 #include "gtkicontheme.h"
 #include "gtkmenuitem.h"
 #include "gtkmain.h"
+#include "gtksettings.h"
 
 #include <glib/gprintf.h>
 
@@ -503,10 +504,16 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
   gchar *primary;
   const gchar *secondary;
   PangoAttrList *attrs;
+  gboolean use_header;
 
   priv = operation->priv;
 
-  widget = gtk_dialog_new ();
+  g_object_get (gtk_settings_get_default (),
+                "gtk-dialogs-use-header", &use_header,
+                NULL);
+  widget = g_object_new (GTK_TYPE_DIALOG,
+                         "use-header-bar", use_header,
+                         NULL);
   dialog = GTK_DIALOG (widget);
   window = GTK_WINDOW (widget);
 
@@ -532,6 +539,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
                           _("Co_nnect"), GTK_RESPONSE_OK,
                           NULL);
   gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
+
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   gtk_dialog_set_alternative_button_order (dialog,
                                            GTK_RESPONSE_OK,
@@ -1395,6 +1403,7 @@ create_show_processes_dialog (GtkMountOperation *op,
   GtkCellRenderer *renderer;
   GtkListStore *list_store;
   gchar *s;
+  gboolean use_header;
 
   priv = op->priv;
 
@@ -1405,7 +1414,12 @@ create_show_processes_dialog (GtkMountOperation *op,
       primary = g_strndup (message, primary - message);
     }
 
-  dialog = gtk_dialog_new ();
+  g_object_get (gtk_settings_get_default (),
+                "gtk-dialogs-use-header", &use_header,
+                NULL);
+  dialog = g_object_new (GTK_TYPE_DIALOG,
+                         "use-header-bar", use_header,
+                         NULL);
 
   if (priv->parent_window != NULL)
     gtk_window_set_transient_for (GTK_WINDOW (dialog), priv->parent_window);


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