[f-spot] Convert version_name_dialog to GtkBuilder.



commit 0a52950ae79d02bd9b06c304b93bc1c4f59dca63
Author: Ruben Vermeersch <ruben savanne be>
Date:   Mon Jun 7 17:14:50 2010 +0200

    Convert version_name_dialog to GtkBuilder.

 src/Makefile.am               |    1 +
 src/PhotoVersionCommands.cs   |   24 ++++----
 src/f-spot.glade              |   97 ----------------------------------
 src/ui/version_name_dialog.ui |  115 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 128 insertions(+), 109 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 8d28799..56ca8d3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -216,6 +216,7 @@ RESOURCES = \
 	dces.rdf \
 	f-spot.glade \
 	ui/main_window.ui \
+	ui/version_name_dialog.ui \
 	ui/import.ui \
 	UI.Dialog/ui/AdjustTimeDialog.ui \
 	UI.Dialog/ui/DateRangeDialog.ui \
diff --git a/src/PhotoVersionCommands.cs b/src/PhotoVersionCommands.cs
index b52ccbc..6e5114c 100644
--- a/src/PhotoVersionCommands.cs
+++ b/src/PhotoVersionCommands.cs
@@ -8,13 +8,13 @@ using FSpot.UI.Dialog;
 
 public class PhotoVersionCommands
 {
-	private class VersionNameRequest : GladeDialog {
+	private class VersionNameRequest : BuilderDialog {
 		private Photo photo;
 
-		[Glade.Widget] private Button ok_button;
-		[Glade.Widget] private Entry version_name_entry;
-		[Glade.Widget] private Label prompt_label;
-		[Glade.Widget] private Label already_in_use_label;
+		[GtkBeans.Builder.Object] private Button ok_button;
+		[GtkBeans.Builder.Object] private Entry version_name_entry;
+		[GtkBeans.Builder.Object] private Label prompt_label;
+		[GtkBeans.Builder.Object] private Label already_in_use_label;
 
 		public enum RequestType {
 			Create,
@@ -48,19 +48,19 @@ public class PhotoVersionCommands
 			Update ();
 		}
 
-		public VersionNameRequest (RequestType request_type, Photo photo, Gtk.Window parent_window) : base ("version_name_dialog")
+		public VersionNameRequest (RequestType request_type, Photo photo, Gtk.Window parent_window) : base ("version_name_dialog.ui", "version_name_dialog")
 		{
 			this.request_type = request_type;
 			this.photo = photo;
 
 			switch (request_type) {
 			case RequestType.Create:
-				this.Dialog.Title = Catalog.GetString ("Create New Version");
+				this.Title = Catalog.GetString ("Create New Version");
 				prompt_label.Text = Catalog.GetString ("Name:");
 				break;
 
 			case RequestType.Rename:
-				this.Dialog.Title = Catalog.GetString ("Rename Version");
+				this.Title = Catalog.GetString ("Rename Version");
 				prompt_label.Text = Catalog.GetString ("New name:");
 				version_name_entry.Text = photo.GetVersion (photo.DefaultVersionId).Name;
 				version_name_entry.SelectRegion (0, -1);
@@ -69,21 +69,21 @@ public class PhotoVersionCommands
 
 			version_name_entry.ActivatesDefault = true;
 
-			this.Dialog.TransientFor = parent_window;
-			this.Dialog.DefaultResponse = ResponseType.Ok;
+			this.TransientFor = parent_window;
+			this.DefaultResponse = ResponseType.Ok;
 
 			Update ();
 		}
 
 		public ResponseType Run (out string name)
 		{
-			ResponseType response = (ResponseType) this.Dialog.Run ();
+			ResponseType response = (ResponseType) this.Run ();
 
 			name = version_name_entry.Text;
 			if (request_type == RequestType.Rename && name == photo.GetVersion (photo.DefaultVersionId).Name)
 				response = ResponseType.Cancel;
 
-			this.Dialog.Destroy ();
+			this.Destroy ();
 
 			return response;
 		}
diff --git a/src/f-spot.glade b/src/f-spot.glade
index 38d5784..55b59af 100644
--- a/src/f-spot.glade
+++ b/src/f-spot.glade
@@ -4,103 +4,6 @@
 <glade-interface>
   <requires lib="canvas"/>
   <requires lib="gnome"/>
-  <widget class="GtkDialog" id="version_name_dialog">
-    <property name="border_width">6</property>
-    <property name="modal">True</property>
-    <property name="destroy_with_parent">True</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="dialog-vbox1">
-        <property name="visible">True</property>
-        <property name="spacing">2</property>
-        <child>
-          <widget class="GtkHBox" id="hbox1">
-            <property name="visible">True</property>
-            <property name="spacing">6</property>
-            <child>
-              <widget class="GtkLabel" id="prompt_label">
-                <property name="visible">True</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkEntry" id="version_name_entry">
-                <property name="width_request">200</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="invisible_char">*</property>
-                <signal name="changed" handler="HandleVersionNameEntryChanged"/>
-              </widget>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="padding">6</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkAlignment" id="alignment1">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="xscale">0</property>
-            <child>
-              <widget class="GtkLabel" id="already_in_use_label">
-                <property name="visible">True</property>
-                <property name="label">&lt;small&gt; &lt;/small&gt;</property>
-                <property name="use_markup">True</property>
-              </widget>
-            </child>
-          </widget>
-          <packing>
-            <property name="fill">False</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area1">
-            <property name="visible">True</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
-            <child>
-              <widget class="GtkButton" id="cancel_button">
-                <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="ok_button">
-                <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="padding">2</property>
-            <property name="pack_type">GTK_PACK_END</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
   <widget class="GtkDialog" id="create_tag_dialog">
     <property name="border_width">6</property>
     <property name="modal">True</property>
diff --git a/src/ui/version_name_dialog.ui b/src/ui/version_name_dialog.ui
new file mode 100644
index 0000000..71a3972
--- /dev/null
+++ b/src/ui/version_name_dialog.ui
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkDialog" id="version_name_dialog">
+    <property name="border_width">6</property>
+    <property name="modal">True</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="prompt_label">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="version_name_entry">
+                <property name="width_request">200</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <signal name="changed" handler="HandleVersionNameEntryChanged"/>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">6</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkAlignment" id="alignment1">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xscale">0</property>
+            <child>
+              <object class="GtkLabel" id="already_in_use_label">
+                <property name="visible">True</property>
+                <property name="label">&lt;small&gt; &lt;/small&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">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>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </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="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">2</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</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>



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