[cheese] Optionally use a header bar in the preferences



commit e87e0b792eaf0a7d4abae9ff9e9925f87b8a4102
Author: David King <amigadave amigadave com>
Date:   Thu Aug 7 14:24:01 2014 +0100

    Optionally use a header bar in the preferences
    
    Make the preferences dialog pay attention to the gtk-dialogs-use-header
    GtkSetting.

 data/cheese-prefs.ui        |   65 ++++++++++++------------------------------
 src/cheese-preferences.vala |    3 ++
 2 files changed, 22 insertions(+), 46 deletions(-)
---
diff --git a/data/cheese-prefs.ui b/data/cheese-prefs.ui
index d74d523..44bddf9 100644
--- a/data/cheese-prefs.ui
+++ b/data/cheese-prefs.ui
@@ -8,6 +8,23 @@
     <property name="window_position">center-on-parent</property>
     <property name="type_hint">dialog</property>
     <signal name="delete-event" handler="on_delete" swapped="no"/>
+    <child type="action">
+        <object class="GtkButton" id="help">
+            <property name="label" translatable="yes">_Help</property>
+            <property name="use-underline">True</property>
+            <property name="visible">True</property>
+            <signal name="clicked" handler="on_dialog_help" swapped="no"/>
+        </object>
+    </child>
+    <child type="action">
+        <object class="GtkButton" id="close">
+            <property name="can-default">True</property>
+            <property name="label" translatable="yes">_Close</property>
+            <property name="use-underline">True</property>
+            <property name="visible">True</property>
+            <signal name="clicked" handler="on_dialog_close" swapped="no"/>
+        </object>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -480,55 +497,11 @@
             <property name="position">0</property>
           </packing>
         </child>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="help">
-                <property name="label" translatable="yes">_Help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use-underline">True</property>
-                <signal name="clicked" handler="on_dialog_help" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-                <property name="secondary">True</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="close">
-                <property name="label" translatable="yes">_Close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="use-underline">True</property>
-                <signal name="clicked" handler="on_dialog_close" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-11">help</action-widget>
-      <action-widget response="-7">close</action-widget>
+      <action-widget response="help">help</action-widget>
+      <action-widget response="close" default="true">close</action-widget>
     </action-widgets>
     </template>
   <object class="GtkAdjustment" id="brightness_adjustment">
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index 679e21e..835f9aa 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -60,6 +60,9 @@ public class Cheese.PreferencesDialog : Gtk.Dialog
 
 public PreferencesDialog (Cheese.Camera camera)
 {
+    var gtk_settings = Gtk.Settings.get_default ();
+    Object (use_header_bar: gtk_settings.gtk_dialogs_use_header ? 1 : 0);
+
     this.camera = camera;
 
     settings = new GLib.Settings ("org.gnome.Cheese");


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