gnome-panel r11398 - in trunk: . libpanel-applet



Author: vuntz
Date: Tue Dec  9 14:36:43 2008
New Revision: 11398
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11398&view=rev

Log:
2008-12-09  Vincent Untz  <vuntz gnome org>

	Get rid of libgnome(ui) usage. We still indirectly depend on libgnome
	because of libbonoboui, but we shouldn't depend on libgnomeui anymore.

	* libpanelapplet-2.0-uninstalled.pc.in:
	* libpanelapplet-2.0.pc.in: remove libgnomeui-2.0 from Requires
	* panel-applet.h: use gtk_init() and bonobo_init() instead of
	gnome_program_init(). And sanitize the macros a bit.
	* panel-test-applets.c: (main): use gtk_init_with_args() and
	bonobo_init() instead of gnome_program_init()

2008-12-09  Vincent Untz  <vuntz gnome org>

	* configure.in: libpanel-applet doesn't need gdk-pixbuf, and doesn't
	need libgnomeui anymore; wncklet applets don't need gdk-pixbuf


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libpanel-applet/ChangeLog
   trunk/libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in
   trunk/libpanel-applet/libpanelapplet-2.0.pc.in
   trunk/libpanel-applet/panel-applet.h
   trunk/libpanel-applet/panel-test-applets.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Dec  9 14:36:43 2008
@@ -74,11 +74,11 @@
 AC_SUBST(PANEL_CFLAGS)
 AC_SUBST(PANEL_LIBS)
 
-PKG_CHECK_MODULES(LIBPANEL_APPLET, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
+PKG_CHECK_MODULES(LIBPANEL_APPLET, ORBit-2.0 >= $ORBIT_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
 AC_SUBST(LIBPANEL_APPLET_CFLAGS)
 AC_SUBST(LIBPANEL_APPLET_LIBS)
 
-PKG_CHECK_MODULES(WNCKLET, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED)
+PKG_CHECK_MODULES(WNCKLET, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED)
 AC_SUBST(WNCKLET_CFLAGS)
 AC_SUBST(WNCKLET_LIBS)
 

Modified: trunk/libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in
==============================================================================
--- trunk/libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in	(original)
+++ trunk/libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in	Tue Dec  9 14:36:43 2008
@@ -5,7 +5,7 @@
 
 Name: libpanel-applet-2
 Description: libpanel-applet-2
-Requires: gconf-2.0 gtk+-2.0 libgnomeui-2.0 libbonoboui-2.0
+Requires: gconf-2.0 gtk+-2.0 libbonoboui-2.0
 Version: @VERSION@
 Libs: ${pc_top_builddir}/${pcfiledir}/libpanel-applet-2.la
 Cflags: -I${pc_top_builddir}/${pcfiledir}

Modified: trunk/libpanel-applet/libpanelapplet-2.0.pc.in
==============================================================================
--- trunk/libpanel-applet/libpanelapplet-2.0.pc.in	(original)
+++ trunk/libpanel-applet/libpanelapplet-2.0.pc.in	Tue Dec  9 14:36:43 2008
@@ -5,7 +5,7 @@
 
 Name: libpanel-applet-2
 Description: libpanel-applet-2
-Requires: gconf-2.0 gtk+-2.0 libgnomeui-2.0 libbonoboui-2.0
+Requires: gconf-2.0 gtk+-2.0 libbonoboui-2.0
 Version: @VERSION@
 Libs: -L${libdir} -lpanel-applet-2
 Cflags: -I${includedir}/panel-2.0

Modified: trunk/libpanel-applet/panel-applet.h
==============================================================================
--- trunk/libpanel-applet/panel-applet.h	(original)
+++ trunk/libpanel-applet/panel-applet.h	Tue Dec  9 14:36:43 2008
@@ -27,9 +27,8 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
-#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomeui/gnome-client.h>
 #include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-main.h>
 #include <bonobo/bonobo-ui-component.h>
 #include <bonobo/bonobo-generic-factory.h>
 
@@ -179,94 +178,59 @@
  * Things to define for these:
  *	+ required if Native Language Support is enabled (ENABLE_NLS):
  *                   GETTEXT_PACKAGE and GNOMELOCALEDIR 
- *      + optional : PREFIX, SYSCONFDIR, DATADIR and LIBDIR.
  */
 
 #if !defined(ENABLE_NLS)
-#if defined(PREFIX) && defined(SYSCONFDIR) && defined(DATADIR) && defined(LIBDIR)
-#define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data)	\
-int main (int argc, char *argv [])						\
-{										\
-	GnomeProgram   *program;							\
-	GOptionContext *context;						\
-	int             retval;							\
-	context = g_option_context_new ("");					\
-	program = gnome_program_init (name, version,				\
-				      LIBGNOMEUI_MODULE,			\
-				      argc, argv,				\
-				      GNOME_PARAM_GOPTION_CONTEXT, context,	\
-				      GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,	\
-				      GNOME_PROGRAM_STANDARD_PROPERTIES,	\
-				      NULL);					\
-        retval = panel_applet_factory_main (iid, type, callback, data);		\
-	g_object_unref (program);						\
-	return retval;								\
-}
-#else /* !defined(PREFIX) ... */
-#define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data)	\
-int main (int argc, char *argv [])						\
-{										\
-	GnomeProgram *program;							\
-	int           retval;							\
-	program = gnome_program_init (name, version,				\
-				      LIBGNOMEUI_MODULE,			\
-				      argc, argv,				\
-				      GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,	\
-				      GNOME_PARAM_NONE);			\
-        retval = panel_applet_factory_main (iid, type, callback, data);		\
-	g_object_unref (program);						\
-	return retval;								\
-}
-#endif /* defined(PREFIX) ... */
+#define _PANEL_APPLET_SETUP_GETTEXT(call_textdomain)				\
+	do { } while (0)
 #else /* defined(ENABLE_NLS) */
 #include <libintl.h>
-#if defined(PREFIX) && defined(SYSCONFDIR) && defined(DATADIR) && defined(LIBDIR)
-#define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data)	\
-int main (int argc, char *argv [])						\
-{										\
-	GnomeProgram *program;							\
-	GOptionContext *context;						\
-	int           retval;							\
-	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);			\
-	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");			\
-	textdomain (GETTEXT_PACKAGE);						\
-	context = g_option_context_new ("");					\
-	program = gnome_program_init (name, version,				\
-				      LIBGNOMEUI_MODULE,			\
-				      argc, argv,				\
-				      GNOME_PARAM_GOPTION_CONTEXT, context,	\
-				      GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,	\
-				      GNOME_PROGRAM_STANDARD_PROPERTIES,	\
-				      NULL);					\
-        retval = panel_applet_factory_main (iid, type, callback, data);		\
-	g_object_unref (program);						\
-	return retval;								\
-}
-#else /* !defined(PREFIX) ... */
+#define _PANEL_APPLET_SETUP_GETTEXT(call_textdomain)				\
+	do {									\
+		bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);		\
+		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");		\
+		if (call_textdomain)						\
+			textdomain (GETTEXT_PACKAGE);				\
+	} while (0)
+#endif /* !defined(ENABLE_NLS) */
+
 #define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data)	\
 int main (int argc, char *argv [])						\
 {										\
-	GnomeProgram *program;							\
 	GOptionContext *context;						\
-	int           retval;							\
-	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);			\
-	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");			\
-	textdomain (GETTEXT_PACKAGE);						\
+	GError         *error;							\
+	int             retval;							\
+										\
+	_PANEL_APPLET_SETUP_GETTEXT (TRUE);					\
+										\
 	context = g_option_context_new ("");					\
-	program = gnome_program_init (name, version,				\
-				      LIBGNOMEUI_MODULE,			\
-				      argc, argv,				\
-				      GNOME_PARAM_GOPTION_CONTEXT, context,	\
-				      GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,	\
-				      GNOME_PARAM_NONE);			\
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));	\
+	g_option_context_add_group (context,					\
+				    bonobo_activation_get_goption_group ());	\
+										\
+	error = NULL;								\
+	if (!g_option_context_parse (context, &argc, &argv, &error)) {		\
+		if (error) {							\
+			g_printerr ("Cannot parse arguments: %s.\n",		\
+				    error->message);				\
+			g_error_free (error);					\
+		} else								\
+			g_printerr ("Cannot parse arguments.\n");		\
+		return 1;							\
+	}									\
+										\
+	gtk_init (&argc, &argv);						\
+	if (!bonobo_init (&argc, argv)) {					\
+		g_printerr ("Cannot initialize bonobo.\n");			\
+		return 1;							\
+	}									\
+										\
         retval = panel_applet_factory_main (iid, type, callback, data);		\
-	g_object_unref (program);						\
+	g_option_context_free (context);					\
+										\
 	return retval;								\
 }
-#endif /* defined(PREFIX) ... */
-#endif /* !defined(ENABLE_NLS) */
 
-#if !defined(ENABLE_NLS)
 #define PANEL_APPLET_BONOBO_SHLIB_FACTORY(iid, type, descr, callback, data)	\
 static Bonobo_Unknown								\
 __panel_applet_shlib_factory (PortableServer_POA  poa,				\
@@ -274,6 +238,7 @@
 			      gpointer            impl_ptr,			\
 			      CORBA_Environment  *ev)				\
 {										\
+	_PANEL_APPLET_SETUP_GETTEXT (FALSE);					\
         return panel_applet_shlib_factory ((iid), (type), poa, impl_ptr,	\
 					   (callback), (data), ev);		\
 }										\
@@ -282,26 +247,6 @@
 	{ NULL }								\
 };										\
 const  BonoboActivationPlugin Bonobo_Plugin_info = { plugin_list, (descr) };
-#else /* defined(ENABLE_NLS) */
-#include <libintl.h>
-#define PANEL_APPLET_BONOBO_SHLIB_FACTORY(iid, type, descr, callback, data)	\
-static Bonobo_Unknown								\
-__panel_applet_shlib_factory (PortableServer_POA  poa,				\
-			      const char         *oafiid,			\
-			      gpointer            impl_ptr,			\
-			      CORBA_Environment  *ev)				\
-{										\
-	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);			\
-	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");			\
-        return panel_applet_shlib_factory ((iid), (type), poa, impl_ptr,	\
-					   (callback), (data), ev);		\
-}										\
-static BonoboActivationPluginObject plugin_list[] = {				\
-	{ (iid), __panel_applet_shlib_factory },				\
-	{ NULL }								\
-};										\
-const  BonoboActivationPlugin Bonobo_Plugin_info = { plugin_list, (descr) };
-#endif /* !defined(ENABLE_NLS) */
 
 G_END_DECLS
 

Modified: trunk/libpanel-applet/panel-test-applets.c
==============================================================================
--- trunk/libpanel-applet/panel-test-applets.c	(original)
+++ trunk/libpanel-applet/panel-test-applets.c	Tue Dec  9 14:36:43 2008
@@ -12,6 +12,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-main.h>
 #include <bonobo/bonobo-widget.h>
 #include <gconf/gconf.h>
 
@@ -281,24 +282,31 @@
 int
 main (int argc, char **argv)
 {
-	GOptionContext *context;
-	GladeXML       *gui;
-	char           *gladefile;
+	GladeXML *gui;
+	char     *gladefile;
+	GError   *error;
 
 	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	context = g_option_context_new ("");
+	error = NULL;
+	if (!gtk_init_with_args (&argc, &argv,
+				 "", (GOptionEntry *) options, GETTEXT_PACKAGE,
+				 &error)) {
+		if (error) {
+			g_printerr ("%s\n", error->message);
+			g_error_free (error);
+		} else
+			g_printerr ("Cannot initiliaze GTK+.\n");
 
-	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
-
-	gnome_program_init (argv [0], "0.0.0.0", LIBGNOMEUI_MODULE,
-			    argc, argv,
-			    GNOME_PARAM_GOPTION_CONTEXT, context,
-			    GNOME_PARAM_NONE);
+		return 1;
+	}
 
-	g_option_context_free (context);
+	if (!bonobo_init (&argc, argv)) {
+		g_printerr ("Cannot initialize bonobo.\n");
+		return 1;
+	}
 
 	if (cli_iid) {
 		load_applet_from_command_line ();



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