ui: More like a GNOME preferences dialog
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Wed, 3 Jun 2009 16:01:39 +0000 (19:01 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Wed, 3 Jun 2009 16:01:39 +0000 (19:01 +0300)
- One "Close" button rather than "Apply", "OK" and "Cancel".
- Just run the dialog, no need for mainloops and signal connections.

data/rygel-preferences.ui
src/ui/rygel-preferences-dialog.vala

index 042cd68..177db5c 100644 (file)
             <property name="visible">True</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button2">
-                <property name="label" translatable="yes">gtk-apply</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button1">
-                <property name="label" translatable="yes">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkButton" id="button3">
-                <property name="label" translatable="yes">gtk-ok</property>
+                <property name="label" translatable="yes">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="has_default">True</property>
                 <property name="receives_default">True</property>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">0</property>
               </packing>
             </child>
           </object>
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-10">button2</action-widget>
-      <action-widget response="-6">button1</action-widget>
       <action-widget response="-5">button3</action-widget>
     </action-widgets>
   </object>
index a96b939..fc52df5 100644 (file)
@@ -52,42 +52,16 @@ public class Rygel.PreferencesDialog : GLib.Object {
                                                   "DVB"));
         this.sections.add (new FolderPrefSection (this.builder,
                                                   config));
-
-        this.dialog.response += this.on_response;
-        this.dialog.delete_event += (dialog, event) => {
-                                Gtk.main_quit ();
-                                return false;
-        };
-
-        this.dialog.show_all ();
-
     }
 
-    private void on_response (Dialog dialog, int response_id) {
-        switch (response_id) {
-            case ResponseType.CANCEL:
-                Gtk.main_quit ();
-                break;
-            case ResponseType.OK:
-                apply_settings ();
-                Gtk.main_quit ();
-                break;
-            case ResponseType.APPLY:
-                apply_settings ();
-                break;
-        }
-    }
+    public void run () {
+        this.dialog.run ();
 
-    private void apply_settings () {
         foreach (var section in this.sections) {
             section.save ();
         }
     }
 
-    public new void run () {
-        Gtk.main ();
-    }
-
     public static int main (string[] args) {
         Gtk.init (ref args);