gnome-user-share r221 - in trunk: . data po src



Author: jhaitsma
Date: Sat Mar  8 16:49:42 2008
New Revision: 221
URL: http://svn.gnome.org/viewvc/gnome-user-share?rev=221&view=rev

Log:
2008-03-08  Jaap Haitsma  <jaap haitsma org>

	* configure.in:
	* data/Makefile.am:
	* src/file-share-properties.c: (flush_password), (update_ui),
	(main):
	Move from libglade to gtkbuilder. Fixes bug #519634



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/data/Makefile.am
   trunk/po/ChangeLog
   trunk/po/POTFILES.skip
   trunk/src/file-share-properties.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sat Mar  8 16:49:42 2008
@@ -20,6 +20,11 @@
 AM_PROG_LIBTOOL
 AC_PATH_XTRA
 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+AC_PATH_PROG(GTK_BUILDER_CONVERT, gtk-builder-convert, no)
+
+if test "x$GTK_BUILDER_CONVERT" = "xno"; then
+  AC_MSG_ERROR([gtk-builder-convert not found])
+fi
 
 AC_TYPE_PID_T
 AC_TYPE_SIGNAL
@@ -76,7 +81,7 @@
 AC_SUBST(USER_SHARE_CFLAGS)
 AC_SUBST(USER_SHARE_LIBS)
 
-PKG_CHECK_MODULES(USER_SHARE_CONFIG, glib-2.0 >= 2.15.2 gtk+-2.0 >= 2.4.0 libglade-2.0 gconf-2.0)
+PKG_CHECK_MODULES(USER_SHARE_CONFIG, glib-2.0 >= 2.15.2 gtk+-2.0 >= 2.12.0 gconf-2.0)
 AC_SUBST(USER_SHARE_CONFIG_CFLAGS)
 AC_SUBST(USER_SHARE_CONFIG_LIBS)
 	

Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am	(original)
+++ trunk/data/Makefile.am	Sat Mar  8 16:49:42 2008
@@ -14,8 +14,11 @@
 autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
 autostart_in_files = gnome-user-share.desktop.in
 
+file-share-properties.ui : file-share-properties.glade
+	$(GTK_BUILDER_CONVERT) file-share-properties.glade file-share-properties.ui
+
 appdir = $(datadir)/gnome-user-share
-app_DATA=dav_user_2.0.conf dav_user_2.2.conf dav_groupfile file-share-properties.glade
+app_DATA=dav_user_2.0.conf dav_user_2.2.conf dav_groupfile file-share-properties.ui
 
 install-data-local:
 if GCONF_SCHEMAS_INSTALL
@@ -33,8 +36,9 @@
 EXTRA_DIST = $(schema_in_files) \
 	$(app_DATA)		\
 	$(desktop_in_files)	\
-	gnome-user-share.desktop.in.in
+	gnome-user-share.desktop.in.in \
+	file-share-properties.glade
 
-CLEANFILES = $(desktop_DATA) $(autostart_DATA)
+CLEANFILES = $(desktop_DATA) $(autostart_DATA) file-share-properties.ui
 
 DISTCLEANFILES = $(schema_DATA) 

Modified: trunk/po/POTFILES.skip
==============================================================================
--- trunk/po/POTFILES.skip	(original)
+++ trunk/po/POTFILES.skip	Sat Mar  8 16:49:42 2008
@@ -1,3 +1,4 @@
 # List of source files that should NOT be translated.
 # Please keep this file sorted alphabetically.
+data/file-share-properties.ui
 data/gnome-user-share.desktop.in

Modified: trunk/src/file-share-properties.c
==============================================================================
--- trunk/src/file-share-properties.c	(original)
+++ trunk/src/file-share-properties.c	Sat Mar  8 16:49:42 2008
@@ -28,7 +28,6 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <glade/glade.h>
 #include <gconf/gconf-client.h>
 
 #include "user_share-private.h"
@@ -36,7 +35,8 @@
 #define REALM "Please log in as the user guest"
 #define USER "guest"
 
-static GladeXML *ui;
+static GtkBuilder* builder;
+
 
 static void
 write_out_password (const char *password)
@@ -72,7 +72,7 @@
     GtkWidget *password_entry;
     const char *password;
 
-    password_entry = glade_xml_get_widget (ui, "password_entry");
+    password_entry = GTK_WIDGET (gtk_builder_get_object (builder, "password_entry"));
 
     if (g_object_get_data (G_OBJECT( password_entry), "user_edited")) {
 	password = gtk_entry_get_text (GTK_ENTRY (password_entry));
@@ -130,15 +130,15 @@
     accept_setting = accept_setting_from_string (str);
     g_free (str);
 
-    check = glade_xml_get_widget (ui, "enable_check");
-    password_combo = glade_xml_get_widget (ui, "password_combo");
-    password_entry = glade_xml_get_widget (ui, "password_entry");
-    bluetooth_check = glade_xml_get_widget (ui, "enable_bluetooth_check");
-    allow_write_bluetooth_check = glade_xml_get_widget (ui, "allow_write_bluetooth_check");
-    require_pairing_check = glade_xml_get_widget (ui, "require_pairing_check");
-    enable_obexpush_check = glade_xml_get_widget (ui, "enable_obexpush_check");
-    accept_obexpush_combo = glade_xml_get_widget (ui, "accept_obexpush_combo");
-    notify_received_obexpush_check = glade_xml_get_widget (ui, "notify_received_obexpush_check");
+    check = GTK_WIDGET (gtk_builder_get_object (builder, "enable_check"));
+    password_combo = GTK_WIDGET (gtk_builder_get_object (builder, "password_combo"));
+    password_entry = GTK_WIDGET (gtk_builder_get_object (builder, "password_entry"));
+    bluetooth_check = GTK_WIDGET (gtk_builder_get_object (builder, "enable_bluetooth_check"));
+    allow_write_bluetooth_check = GTK_WIDGET (gtk_builder_get_object (builder, "allow_write_bluetooth_check"));
+    require_pairing_check = GTK_WIDGET (gtk_builder_get_object (builder, "require_pairing_check"));
+    enable_obexpush_check = GTK_WIDGET (gtk_builder_get_object (builder, "enable_obexpush_check"));
+    accept_obexpush_combo = GTK_WIDGET (gtk_builder_get_object (builder, "accept_obexpush_combo"));
+    notify_received_obexpush_check = GTK_WIDGET (gtk_builder_get_object (builder, "notify_received_obexpush_check"));
 
     /* Network */
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), enabled);
@@ -428,6 +428,7 @@
 int
 main (int argc, char *argv[])
 {
+    GError *error = NULL;
     GConfClient *client;
     GtkWidget *check;
     GtkWidget *password_combo;
@@ -449,11 +450,15 @@
     
     gtk_init (&argc, &argv);
 
-    ui = glade_xml_new (DATADIR"file-share-properties.glade",
-			NULL,
-			PACKAGE);
+    builder = gtk_builder_new ();
+    gtk_builder_add_from_file (builder, DATADIR"file-share-properties.ui", &error);
+
+    if (error) {
+      g_error ("building ui from %s failed: %s", DATADIR"file-share-properties.ui", error->message);
+      g_clear_error (&error);
+    }
 
-    window = glade_xml_get_widget (ui, "user_share_dialog");
+    window = GTK_WIDGET (gtk_builder_get_object (builder, "user_share_dialog"));
     g_signal_connect (G_OBJECT (window), "delete_event",
 		      G_CALLBACK (gtk_main_quit), NULL);
 
@@ -463,15 +468,15 @@
 			  GCONF_CLIENT_PRELOAD_RECURSIVE,
 			  NULL);
 
-    check = glade_xml_get_widget (ui, "enable_check");
-    password_combo = glade_xml_get_widget (ui, "password_combo");
-    password_entry = glade_xml_get_widget (ui, "password_entry");
-    bluetooth_check = glade_xml_get_widget (ui, "enable_bluetooth_check");
-    bluetooth_allow_write_check = glade_xml_get_widget (ui, "allow_write_bluetooth_check");
-    require_pairing_check = glade_xml_get_widget (ui, "require_pairing_check");
-    enable_obexpush_check = glade_xml_get_widget (ui, "enable_obexpush_check");
-    accept_obexpush_combo = glade_xml_get_widget (ui, "accept_obexpush_combo");
-    notify_received_obexpush_check = glade_xml_get_widget (ui, "notify_received_obexpush_check");
+    check = GTK_WIDGET (gtk_builder_get_object (builder, "enable_check"));
+    password_combo = GTK_WIDGET (gtk_builder_get_object (builder, "password_combo"));
+    password_entry = GTK_WIDGET (gtk_builder_get_object (builder, "password_entry"));
+    bluetooth_check = GTK_WIDGET (gtk_builder_get_object (builder, "enable_bluetooth_check"));
+    bluetooth_allow_write_check = GTK_WIDGET (gtk_builder_get_object (builder, "allow_write_bluetooth_check"));
+    require_pairing_check = GTK_WIDGET (gtk_builder_get_object (builder, "require_pairing_check"));
+    enable_obexpush_check = GTK_WIDGET (gtk_builder_get_object (builder, "enable_obexpush_check"));
+    accept_obexpush_combo = GTK_WIDGET (gtk_builder_get_object (builder, "accept_obexpush_combo"));
+    notify_received_obexpush_check = GTK_WIDGET (gtk_builder_get_object (builder, "notify_received_obexpush_check"));
 
     //FIXME implement notifications
     gtk_widget_hide (notify_received_obexpush_check);
@@ -551,7 +556,7 @@
     g_signal_connect (notify_received_obexpush_check,
     		      "toggled", G_CALLBACK (notify_received_obexpush_check_toggled), NULL);
 
-    g_signal_connect (glade_xml_get_widget (ui, "close_button"),
+    g_signal_connect (GTK_WIDGET (gtk_builder_get_object (builder, "close_button")),
 		      "clicked", G_CALLBACK (gtk_main_quit), NULL);
 
     gconf_client_notify_add (client,
@@ -605,7 +610,7 @@
 
     g_object_unref (client);
 
-    gtk_widget_show (glade_xml_get_widget (ui, "user_share_dialog"));
+    gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (builder, "user_share_dialog")));
     
     gtk_main ();
 



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