Use GkBuilder instead libglade and remove remaining gnome_vfs code



Hello,

I've filled a couple of patches to:
 - Remove some unneded gnome_vfs code in tinymail examples [1] (this
patch is needed to compile tinymail without gnome_vfs libraries
installed)
 - Replace libglade by GtkBuilder in python example code [2]

For your convenience, I've attached here the two little patches

Best Regards,

[1] https://bugzilla.gnome.org/show_bug.cgi?id=598861
[2] https://bugzilla.gnome.org/show_bug.cgi?id=598864
-- 
Javier Jardón Cabezas
From a3dd16c26e33387865673a96c4830ee60be7f7c1 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Javier=20Jard=C3=B3n?= <jjardon gnome org>
Date: Sun, 18 Oct 2009 21:38:47 +0200
Subject: [PATCH] Use GtkBuilder instead deprecated libglade

https://bugzilla.gnome.org/show_bug.cgi?id=598864
---
 ChangeLog                                          |   11 ++
 .../camel-lite/libedataserver/Makefile.am          |    2 +-
 .../camel-lite/libedataserver/e-data-server-util.c |    6 +-
 .../libedataserver/libedataserver-private.h        |    6 +-
 tests/python-demo/tinymail-python-test.glade       |  139 --------------------
 tests/python-demo/tinymail-python-test.py          |   16 +-
 tests/python-demo/tinymail-python-test.ui          |   93 +++++++++++++
 7 files changed, 119 insertions(+), 154 deletions(-)
 delete mode 100644 tests/python-demo/tinymail-python-test.glade
 create mode 100644 tests/python-demo/tinymail-python-test.ui

diff --git a/ChangeLog b/ChangeLog
index dfd1c82..9c0f659 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2009-10-18  Javier Jardón Cabezas <jjardon gnome org>
 
+	Use GtkBuilder instead libglade
+
+	* tests/python-demo/tinymail-python-test.glade: deleted
+	* tests/python-demo/tinymail-python-test.ui: new file
+	* libtinymail-camel/camel-lite/libedataserver/Makefile.am
+	* libtinymail-camel/camel-lite/libedataserver/e-data-server-util.c
+	* libtinymail-camel/camel-lite/libedataserver/libedataserver-private.h
+	* tests/python-demo/tinymail-python-test.py
+
+2009-10-18  Javier Jardón Cabezas <jjardon gnome org>
+
 	* tests/c-demo/tny-main.c: Remove gnome_vfs code
 
 2009-10-16  Carl Simonson <simonsonc gmail com>
diff --git a/libtinymail-camel/camel-lite/libedataserver/Makefile.am b/libtinymail-camel/camel-lite/libedataserver/Makefile.am
index c800870..50d99eb 100644
--- a/libtinymail-camel/camel-lite/libedataserver/Makefile.am
+++ b/libtinymail-camel/camel-lite/libedataserver/Makefile.am
@@ -6,7 +6,7 @@ INCLUDES =								\
 	-DLOCALEDIR=\""$(localedir)"\"					\
 	-DE_DATA_SERVER_EXTENSIONDIR=\"$(extensiondir)\"		\
 	-DE_DATA_SERVER_IMAGESDIR=\"$(imagesdir)\"			\
-	-DE_DATA_SERVER_UI_GLADEDIR=\""$(gladedir)"\"			\
+	-DE_DATA_SERVER_UIDIR=\""$(uidir)"\"				\
 	$(E_DATA_SERVER_CFLAGS)
 
 noinst_LTLIBRARIES = libedataserver-1.2.la
diff --git a/libtinymail-camel/camel-lite/libedataserver/e-data-server-util.c b/libtinymail-camel/camel-lite/libedataserver/e-data-server-util.c
index 4ea7da1..122fb8f 100644
--- a/libtinymail-camel/camel-lite/libedataserver/e-data-server-util.c
+++ b/libtinymail-camel/camel-lite/libedataserver/e-data-server-util.c
@@ -623,7 +623,7 @@ static const char *cp_prefix;
 static const char *localedir;
 static const char *extensiondir;
 static const char *imagesdir;
-static const char *ui_gladedir;
+static const char *ui_uidir;
 
 static HMODULE hmodule;
 G_LOCK_DEFINE_STATIC (mutex);
@@ -702,7 +702,7 @@ setup (void)
 	localedir = replace_prefix (cp_prefix, LOCALEDIR);
 	extensiondir = replace_prefix (prefix, E_DATA_SERVER_EXTENSIONDIR);
 	imagesdir = replace_prefix (prefix, E_DATA_SERVER_IMAGESDIR);
-	ui_gladedir = replace_prefix (prefix, E_DATA_SERVER_UI_GLADEDIR);
+	ui_uidir = replace_prefix (prefix, E_DATA_SERVER_UIDIR);
 
 	G_UNLOCK (mutex);
 }
@@ -727,7 +727,7 @@ e_util_get_##varbl (void)			\
 
 PRIVATE_GETTER(extensiondir)
 PRIVATE_GETTER(imagesdir)
-PRIVATE_GETTER(ui_gladedir)
+PRIVATE_GETTER(uidir)
 
 PUBLIC_GETTER(prefix)
 PUBLIC_GETTER(cp_prefix)
diff --git a/libtinymail-camel/camel-lite/libedataserver/libedataserver-private.h b/libtinymail-camel/camel-lite/libedataserver/libedataserver-private.h
index f14f8c7..0594d63 100644
--- a/libtinymail-camel/camel-lite/libedataserver/libedataserver-private.h
+++ b/libtinymail-camel/camel-lite/libedataserver/libedataserver-private.h
@@ -28,7 +28,7 @@
 
 const char *_libedataserver_get_extensiondir (void) G_GNUC_CONST;
 const char *_libedataserver_get_imagesdir (void) G_GNUC_CONST;
-const char *_libedataserver_get_ui_gladedir (void) G_GNUC_CONST;
+const char *_libedataserver_get_uidir (void) G_GNUC_CONST;
 
 #undef E_DATA_SERVER_EXTENSIONDIR
 #define E_DATA_SERVER_EXTENSIONDIR _libedataserver_get_extensiondir ()
@@ -36,8 +36,8 @@ const char *_libedataserver_get_ui_gladedir (void) G_GNUC_CONST;
 #undef E_DATA_SERVER_IMAGESDIR
 #define E_DATA_SERVER_IMAGESDIR _libedataserver_get_imagesdir ()
 
-#undef E_DATA_SERVER_UI_GLADEDIR
-#define E_DATA_SERVER_UI_GLADEDIR _libedataserver_get_ui_gladedir ()
+#undef E_DATA_SERVER_UIDIR
+#define E_DATA_SERVER_UIDIR _libedataserver_get_uidir ()
 
 #endif	/* G_OS_WIN32 */
 
diff --git a/tests/python-demo/tinymail-python-test.glade b/tests/python-demo/tinymail-python-test.glade
deleted file mode 100644
index 1223d82..0000000
--- a/tests/python-demo/tinymail-python-test.glade
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
-<glade-interface>
-
-<widget class="GtkWindow" id="window">
-  <property name="width_request">640</property>
-  <property name="height_request">400</property>
-  <property name="visible">True</property>
-  <property name="title" translatable="yes">Tinymail python test</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-  <signal name="delete_event" handler="on_window_delete_event" last_modification_time="Sat, 29 Jul 2006 14:38:47 GMT"/>
-
-  <child>
-    <widget class="GtkHPaned" id="hpaned">
-      <property name="visible">True</property>
-      <property name="can_focus">True</property>
-
-      <child>
-	<widget class="GtkScrolledWindow" id="scrolledwindow2">
-	  <property name="visible">True</property>
-	  <property name="can_focus">True</property>
-	  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-	  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-	  <property name="shadow_type">GTK_SHADOW_NONE</property>
-	  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-	  <child>
-	    <widget class="GtkTreeView" id="folderstree">
-	      <property name="width_request">108</property>
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="headers_visible">True</property>
-	      <property name="rules_hint">False</property>
-	      <property name="reorderable">False</property>
-	      <property name="enable_search">True</property>
-	      <property name="fixed_height_mode">True</property>
-	      <property name="hover_selection">False</property>
-	      <property name="hover_expand">False</property>
-	      <signal name="row_activated" handler="on_folderstree_row_activated" last_modification_time="Sat, 29 Jul 2006 14:37:43 GMT"/>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="shrink">True</property>
-	  <property name="resize">True</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkVPaned" id="vpaned">
-	  <property name="visible">True</property>
-	  <property name="can_focus">True</property>
-
-	  <child>
-	    <widget class="GtkVBox" id="vbox1">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
-
-	      <child>
-		<widget class="GtkScrolledWindow" id="scrolledwindow1">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-		  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-		  <property name="shadow_type">GTK_SHADOW_NONE</property>
-		  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-		  <child>
-		    <widget class="GtkTreeView" id="headerstree">
-		      <property name="width_request">300</property>
-		      <property name="height_request">200</property>
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="headers_visible">True</property>
-		      <property name="rules_hint">False</property>
-		      <property name="reorderable">False</property>
-		      <property name="enable_search">True</property>
-		      <property name="fixed_height_mode">True</property>
-		      <property name="hover_selection">False</property>
-		      <property name="hover_expand">False</property>
-		      <signal name="row_activated" handler="on_headerstree_row_activated" last_modification_time="Sat, 29 Jul 2006 14:37:49 GMT"/>
-		    </widget>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkProgressBar" id="progressbar">
-		  <property name="visible">True</property>
-		  <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
-		  <property name="fraction">0</property>
-		  <property name="pulse_step">0.10000000149</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="shrink">True</property>
-	      <property name="resize">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <placeholder/>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="shrink">True</property>
-	  <property name="resize">True</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
-</glade-interface>
diff --git a/tests/python-demo/tinymail-python-test.py b/tests/python-demo/tinymail-python-test.py
index ba159c4..b91aaec 100644
--- a/tests/python-demo/tinymail-python-test.py
+++ b/tests/python-demo/tinymail-python-test.py
@@ -1,5 +1,4 @@
 import gtk
-import gtk.glade
 import gnome
 import tinymail
 import tinymail.ui
@@ -43,13 +42,14 @@ def on_folderstree_selected (treeselection, headerstree) :
 
 props = { gnome.PARAM_APP_DATADIR : "/usr/share" }
 pr = gnome.program_init ("E-Mail", "1.0", properties=props)
-xml = gtk.glade.XML ("tinymail-python-test.glade", domain="email")
-widget = xml.get_widget ("window")
-progressbar = xml.get_widget ("progressbar")
+builder = gtk.Builder()
+builder.add_from_file("tinymail-python-test.ui")
+widget = builder.get_object("window")
+progressbar = builder.get_object ("progressbar")
 progressbar.hide ()
-folderstree = xml.get_widget ("folderstree")
-headerstree = xml.get_widget ("headerstree")
-vpaned = xml.get_widget ("vpaned")
+folderstree = builder.get_object ("folderstree")
+headerstree = builder.get_object ("headerstree")
+vpaned = builder.get_object ("vpaned")
 renderer = gtk.CellRendererText ();
 column = gtk.TreeViewColumn ("Folder", renderer, text=0)
 column.set_fixed_width (100)
@@ -84,5 +84,5 @@ account_store.get_accounts (accounts, tinymail.ACCOUNT_STORE_STORE_ACCOUNTS)
 folderstree.set_model (accounts)
 folderstree.get_selection().connect("changed", on_folderstree_selected, headerstree)
 headerstree.get_selection().connect("changed", on_headerstree_selected, msgview)
-xml.signal_connect("on_window_delete_event", gtk.main_quit)
+builder.connect_signals(self)
 gtk.main()
diff --git a/tests/python-demo/tinymail-python-test.ui b/tests/python-demo/tinymail-python-test.ui
new file mode 100644
index 0000000..46e8dd9
--- /dev/null
+++ b/tests/python-demo/tinymail-python-test.ui
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.6 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkWindow" id="window">
+    <property name="width_request">640</property>
+    <property name="height_request">400</property>
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Tinymail python test</property>
+    <signal name="delete_event" handler="on_window_delete_event"/>
+    <child>
+      <object class="GtkHPaned" id="hpaned">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow2">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <child>
+              <object class="GtkTreeView" id="folderstree">
+                <property name="width_request">108</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="fixed_height_mode">True</property>
+                <signal name="row_activated" handler="on_folderstree_row_activated"/>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="resize">True</property>
+            <property name="shrink">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVPaned" id="vpaned">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <child>
+              <object class="GtkVBox" id="vbox1">
+                <property name="visible">True</property>
+                <child>
+                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">automatic</property>
+                    <property name="vscrollbar_policy">automatic</property>
+                    <child>
+                      <object class="GtkTreeView" id="headerstree">
+                        <property name="width_request">300</property>
+                        <property name="height_request">200</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="fixed_height_mode">True</property>
+                        <signal name="row_activated" handler="on_headerstree_row_activated"/>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkProgressBar" id="progressbar">
+                    <property name="visible">True</property>
+                    <property name="pulse_step">0.10000000149</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="resize">False</property>
+                <property name="shrink">True</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="resize">True</property>
+            <property name="shrink">True</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
-- 
1.6.3.3

From a1bda7d7e552711f3be8f23ac6de87f865d63e1e Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Javier=20Jard=C3=B3n?= <jjardon gnome org>
Date: Sun, 18 Oct 2009 20:59:32 +0200
Subject: [PATCH] Remove gnome_vfs code from tinymail example code

---
 ChangeLog               |    4 ++++
 tests/c-demo/tny-main.c |    9 ---------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 574c66b..dfd1c82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-10-18  Javier Jardón Cabezas <jjardon gnome org>
+
+	* tests/c-demo/tny-main.c: Remove gnome_vfs code
+
 2009-10-16  Carl Simonson <simonsonc gmail com>
 
 	* libtinymail/tny-stream-cache.c: Fix TnyStreamCache class name
diff --git a/tests/c-demo/tny-main.c b/tests/c-demo/tny-main.c
index d0e6dcd..20d38f1 100644
--- a/tests/c-demo/tny-main.c
+++ b/tests/c-demo/tny-main.c
@@ -42,11 +42,6 @@
 
 #include <tny-demoui-summary-view.h>
 
-#ifdef GNOME
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#endif
-
 /**
  * main:
  * @argc: Amount of arguments
@@ -84,10 +79,6 @@ main (int argc, char **argv)
 
 	gtk_init (&argc, &argv);
 
-#ifdef GNOME
-	gnome_vfs_init ();
-#endif
-
 	bindtextdomain(GETTEXT_PACKAGE, TNY_LOCALE_DIR);
 
 #if PLATFORM==1
-- 
1.6.3.3



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