[rygel] ui: More like a GNOME preferences dialog



commit da8609af18c97fbaf9900ed8c749b4436fd735b6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jun 3 19:01:39 2009 +0300

    ui: More like a GNOME preferences dialog
    
    - One "Close" button rather than "Apply", "OK" and "Cancel".
    - Just run the dialog, no need for mainloops and signal connections.
---
 data/rygel-preferences.ui            |   35 ++-------------------------------
 src/ui/rygel-preferences-dialog.vala |   30 +---------------------------
 2 files changed, 5 insertions(+), 60 deletions(-)

diff --git a/data/rygel-preferences.ui b/data/rygel-preferences.ui
index 042cd68..177db5c 100644
--- a/data/rygel-preferences.ui
+++ b/data/rygel-preferences.ui
@@ -492,38 +492,11 @@
             <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>
@@ -532,7 +505,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">0</property>
               </packing>
             </child>
           </object>
@@ -545,8 +518,6 @@
       </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>
diff --git a/src/ui/rygel-preferences-dialog.vala b/src/ui/rygel-preferences-dialog.vala
index a96b939..fc52df5 100644
--- a/src/ui/rygel-preferences-dialog.vala
+++ b/src/ui/rygel-preferences-dialog.vala
@@ -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);
 



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