[f-spot] Rating Filter Dialog: move to GtkBuilder



commit 702abaad89c2f7dbc23729d5770a63378a7724b1
Author: Lorenzo Milesi <maxxer yetopen it>
Date:   Mon Aug 3 19:01:22 2009 +0200

    Rating Filter Dialog: move to GtkBuilder
    
    And default focus on OK. Fix bgo#590422.

 src/MainWindow.cs                                  |    3 +-
 src/Makefile.am                                    |    3 +-
 .../RatingFilterDialog.cs}                         |   36 +++----
 src/UI.Dialog/ui/RatingFilterDialog.ui             |  122 ++++++++++++++++++++
 src/f-spot.glade                                   |  120 -------------------
 5 files changed, 139 insertions(+), 145 deletions(-)
---
diff --git a/src/MainWindow.cs b/src/MainWindow.cs
index ac5dd98..91033c0 100644
--- a/src/MainWindow.cs
+++ b/src/MainWindow.cs
@@ -2437,8 +2437,7 @@ public class MainWindow {
 	}
 
 	void HandleSetRatingFilter (object sender, EventArgs args) {
-		RatingFilter.Set set_command = new RatingFilter.Set (query, main_window);
-		set_command.Execute ();
+		new RatingFilterDialog (query, main_window);
 	}
 
 	public void HandleClearRatingFilter (object sender, EventArgs args) {
diff --git a/src/Makefile.am b/src/Makefile.am
index 4215cf9..7f9de6a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -230,7 +230,6 @@ F_SPOT_CSDISTFILES =				\
 	$(srcdir)/Preferences.cs 		\
 	$(srcdir)/PrintOperation.cs		\
 	$(srcdir)/ProgressItem.cs		\
-	$(srcdir)/RatingFilter.cs		\
 	$(srcdir)/QueuedSqliteDatabase.cs	\
 	$(srcdir)/RotateCommand.cs		\
 	$(srcdir)/RollStore.cs			\
@@ -266,6 +265,7 @@ F_SPOT_CSDISTFILES =				\
 	$(srcdir)/UI.Dialog/LastRollDialog.cs		\
 	$(srcdir)/UI.Dialog/PreferenceDialog.cs		\
 	$(srcdir)/UI.Dialog/ProgressDialog.cs		\
+	$(srcdir)/UI.Dialog/RatingFilterDialog.cs	\
 	$(srcdir)/UI.Dialog/RepairDbDialog.cs		\
 	$(srcdir)/UI.Dialog/SelectionRatioDialog.cs	\
 	$(srcdir)/UI.Dialog/TagSelectionDialog.cs	\
@@ -414,6 +414,7 @@ F_SPOT_DISTRESOURCES =					\
 	$(srcdir)/UI.Dialog/ui/EditTagDialog.ui		\
 	$(srcdir)/UI.Dialog/ui/EditTagIconDialog.ui		\
 	$(srcdir)/UI.Dialog/ui/PreferenceDialog.ui	\
+	$(srcdir)/UI.Dialog/ui/RatingFilterDialog.ui	\
 	$(srcdir)/FSpot.addin.xml
 
 F_SPOT_RESOURCES =					\
diff --git a/src/RatingFilter.cs b/src/UI.Dialog/RatingFilterDialog.cs
similarity index 62%
rename from src/RatingFilter.cs
rename to src/UI.Dialog/RatingFilterDialog.cs
index 61ff49d..4604a76 100644
--- a/src/RatingFilter.cs
+++ b/src/UI.Dialog/RatingFilterDialog.cs
@@ -1,7 +1,7 @@
 /*
- * Rating.cs
+ * FSpot.UI.Dialog.RatingFilterDialog.cs
  *
- * Author[s]
+ * Author(s):
  * 	Bengt Thuree <bengt thuree com>
  *	Stephane Delcroix <stephane delcroix org>
  *
@@ -14,29 +14,28 @@ using FSpot.Query;
 using FSpot.Widgets;
 using FSpot.UI.Dialog;
 
-public class RatingFilter {
-	public class Set : GladeDialog {
+namespace FSpot.UI.Dialog
+{
+	public class RatingFilterDialog : BuilderDialog {
 		FSpot.PhotoQuery query;
 		Gtk.Window parent_window;
 
-		[Glade.Widget] private Button ok_button;
-		[Glade.Widget] private HBox minrating_hbox;
-		[Glade.Widget] private HBox maxrating_hbox;
+		[GtkBeans.Builder.Object] Button ok_button;
+		[GtkBeans.Builder.Object] HBox minrating_hbox;
+		[GtkBeans.Builder.Object] HBox maxrating_hbox;
 		
 		private int minrating_value = 4;
 		private int maxrating_value = 5;
 		private Rating minrating;
 		private Rating maxrating;
 
-		public Set (FSpot.PhotoQuery query, Gtk.Window parent_window)
+		public RatingFilterDialog (FSpot.PhotoQuery query, Gtk.Window parent_window) : base ("RatingFilterDialog.ui", "rating_filter_dialog")
 		{
 			this.query = query;
 			this.parent_window = parent_window;
-		}
-
-		public bool Execute ()
-		{
-			this.CreateDialog ("rating_filter_dialog");
+			TransientFor = parent_window;
+			DefaultResponse = ResponseType.Ok;
+			ok_button.GrabFocus ();
 			
 			if (query.RatingRange != null) {
 				minrating_value = (int) query.RatingRange.MinRating;
@@ -47,20 +46,13 @@ public class RatingFilter {
 			minrating_hbox.PackStart (minrating, false, false, 0);
 			maxrating_hbox.PackStart (maxrating, false, false, 0);
 
-			Dialog.TransientFor = parent_window;
-			Dialog.DefaultResponse = ResponseType.Ok;
-
-			ResponseType response = (ResponseType) this.Dialog.Run ();
-
-			bool success = false;
+			ResponseType response = (ResponseType) Run ();
 
 			if (response == ResponseType.Ok) {
 				query.RatingRange = new RatingRange ((uint) minrating.Value, (uint) maxrating.Value);
-				success = true;
 			}
 			
-			this.Dialog.Destroy ();
-			return success;
+			Destroy ();
 		}
 	}
 }
diff --git a/src/UI.Dialog/ui/RatingFilterDialog.ui b/src/UI.Dialog/ui/RatingFilterDialog.ui
new file mode 100644
index 0000000..a478571
--- /dev/null
+++ b/src/UI.Dialog/ui/RatingFilterDialog.ui
@@ -0,0 +1,122 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+  <object class="GtkDialog" id="rating_filter_dialog">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Set Rating Filter</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="vbox84">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkHBox" id="hbox87">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkFrame" id="frame48">
+                <property name="visible">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">GTK_SHADOW_NONE</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment64">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkHBox" id="minrating_hbox">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label214">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Min Rating&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame49">
+                <property name="visible">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">GTK_SHADOW_NONE</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment65">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkHBox" id="maxrating_hbox">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label215">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Max Rating&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="hbuttonbox13">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <object class="GtkButton" id="cancel_button">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok_button">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancel_button</action-widget>
+      <action-widget response="-5">ok_button</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/src/f-spot.glade b/src/f-spot.glade
index 2d91648..cc2e99e 100644
--- a/src/f-spot.glade
+++ b/src/f-spot.glade
@@ -3967,126 +3967,6 @@ between</property>
       </widget>
     </child>
   </widget>
-  <widget class="GtkDialog" id="rating_filter_dialog">
-    <property name="visible">True</property>
-    <property name="title" translatable="yes">Set Rating Filter</property>
-    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-    <property name="has_separator">False</property>
-    <child internal-child="vbox">
-      <widget class="GtkVBox" id="vbox84">
-        <property name="visible">True</property>
-        <child>
-          <widget class="GtkHBox" id="hbox87">
-            <property name="visible">True</property>
-            <child>
-              <widget class="GtkFrame" id="frame48">
-                <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">GTK_SHADOW_NONE</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment64">
-                    <property name="visible">True</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkHBox" id="minrating_hbox">
-                        <property name="visible">True</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label214">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Min Rating&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkFrame" id="frame49">
-                <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">GTK_SHADOW_NONE</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment65">
-                    <property name="visible">True</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkHBox" id="maxrating_hbox">
-                        <property name="visible">True</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label215">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Max Rating&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="hbuttonbox13">
-            <property name="visible">True</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
-            <child>
-              <widget class="GtkButton" id="button28">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-cancel</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">-6</property>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkButton" id="button29">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-ok</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">-5</property>
-              </widget>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">GTK_PACK_END</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
   <widget class="GtkDialog" id="repair_dialog">
     <property name="visible">True</property>
     <property name="title" translatable="yes">Repair</property>



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