gnome-session r5167 - in trunk: . compat data doc/dbus egg splash



Author: vuntz
Date: Wed Dec 10 14:09:28 2008
New Revision: 5167
URL: http://svn.gnome.org/viewvc/gnome-session?rev=5167&view=rev

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

	Kill libgnomeui dependency.

	* configure.in: remove libgnomeui dep for splash, remove check for
	libgnomeui for eggsmclient
	* egg/Makefile.am: remove eggsmclient-libgnomeui.* stuff
	* egg/eggsmclient-libgnomeui.[ch]: killed
	* splash/Makefile.am: updated
	* splash/gnome-session-splash.c: (load_pixbuf): changed to a helper
	function
	(load_pixbuf_relative_path): use g_get_system_data_dirs() instead of
	gnome_program_locate_file()
	(load_splash_pixbuf): updated
	(setup_splash_window): don't unref the pixbuf if we didn't have a
	pixbuf
	(main): setup gettext, use GOption + gtk_init() instead of
	gnome_program_init()


Removed:
   trunk/egg/eggsmclient-libgnomeui.c
   trunk/egg/eggsmclient-libgnomeui.h
Modified:
   trunk/ChangeLog
   trunk/compat/   (props changed)
   trunk/configure.in
   trunk/data/   (props changed)
   trunk/doc/dbus/   (props changed)
   trunk/egg/Makefile.am
   trunk/splash/   (props changed)
   trunk/splash/Makefile.am
   trunk/splash/gnome-session-splash.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Dec 10 14:09:28 2008
@@ -70,9 +70,11 @@
 )
 
 PKG_CHECK_MODULES(SPLASH,
+        glib-2.0 >= $GLIB_REQUIRED
+        gtk+-2.0 >= $GTK_REQUIRED
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED
         libstartup-notification-1.0
-        libgnomeui-2.0)
+        gconf-2.0)
 
 PKG_CHECK_MODULES(COMPAT,
         gtk+-2.0 >= $GTK_REQUIRED
@@ -82,7 +84,6 @@
 PKG_CHECK_MODULES(GCONF, gconf-2.0)
 
 PKG_CHECK_MODULES(EGG_SMCLIENT, gtk+-2.0)
-PKG_CHECK_MODULES(EGG_LIBGNOMEUI, libgnomeui-2.0)
 
 PKG_CHECK_MODULES(POLKIT_GNOME, polkit-gnome >= $POLKIT_GNOME_REQUIRED, have_polkit=yes, have_polkit=no)
 

Modified: trunk/egg/Makefile.am
==============================================================================
--- trunk/egg/Makefile.am	(original)
+++ trunk/egg/Makefile.am	Wed Dec 10 14:09:28 2008
@@ -9,7 +9,6 @@
 	-DG_LOG_DOMAIN=\""EggSMClient"\" \
 	$(platform_defines)              \
 	$(EGG_SMCLIENT_CFLAGS)           \
-	$(EGG_LIBGNOMEUI_CFLAGS)	 \
 	$(WARN_CFLAGS)			 \
 	$(DISABLE_DEPRECATED_CFLAGS)
 
@@ -28,14 +27,11 @@
 	$(platform_sources)
 
 libeggsmclient_gnome_la_LIBADD =         \
-	$(EGG_LIBGNOMEUI_LIBS)           \
 	$(libeggsmclient_la_LIBADD)
 
 libeggsmclient_gnome_la_SOURCES =        \
 	eggsmclient.c                    \
 	eggsmclient.h                    \
-	eggsmclient-libgnomeui.c         \
-	eggsmclient-libgnomeui.h         \
 	eggsmclient-private.h            \
 	$(platform_sources)
 

Modified: trunk/splash/Makefile.am
==============================================================================
--- trunk/splash/Makefile.am	(original)
+++ trunk/splash/Makefile.am	Wed Dec 10 14:09:28 2008
@@ -2,14 +2,13 @@
 
 INCLUDES =					\
 	-I$(top_srcdir)/egg			\
+	-DLOCALE_DIR=\""$(datadir)/locale"\"	\
 	$(WARN_CFLAGS)				\
 	$(DISABLE_DEPRECATED_CFLAGS)		\
-	$(GCONF_CFLAGS)				\
 	$(SPLASH_CFLAGS)
 
 LDADD =						\
 	$(top_builddir)/egg/libeggsmclient-gnome.la \
-	$(GCONF_LIBS)				\
 	$(SPLASH_LIBS)
 
 helperdir = $(pkglibdir)/helpers

Modified: trunk/splash/gnome-session-splash.c
==============================================================================
--- trunk/splash/gnome-session-splash.c	(original)
+++ trunk/splash/gnome-session-splash.c	Wed Dec 10 14:09:28 2008
@@ -30,12 +30,9 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-#include <libgnome/gnome-program.h>
-#include <libgnomeui/gnome-ui-init.h>
-
 #include <glib/gi18n.h>
 
-#include "eggsmclient-libgnomeui.h"
+#include "eggsmclient.h"
 
 #define SN_API_NOT_YET_FROZEN
 #include <libsn/sn-monitor.h>
@@ -183,23 +180,10 @@
 }
 
 static GdkPixbuf *
-load_pixbuf (const char *filename)
+load_pixbuf (const char *path)
 {
         GdkPixbuf *pixbuf;
         GError    *error = NULL;
-        char      *path;
-
-        if (filename == NULL) {
-                return NULL;
-        }
-
-        path = gnome_program_locate_file (NULL,
-                                          GNOME_FILE_DOMAIN_PIXMAP,
-                                          filename, TRUE,
-                                          NULL);
-        if (path == NULL) {
-                return NULL;
-        }
 
         pixbuf = gdk_pixbuf_new_from_file (path, &error);
         if (pixbuf == NULL) {
@@ -208,12 +192,48 @@
                 g_error_free (error);
         }
 
-        g_free (path);
-
         return pixbuf;
 }
 
 static GdkPixbuf *
+load_pixbuf_relative_path (const char *filename)
+{
+        const char * const *xdg_data_dirs;
+        int                 i;
+
+        if (filename == NULL) {
+                return NULL;
+        }
+
+        if (g_path_is_absolute (filename)) {
+                return load_pixbuf (filename);
+        }
+
+        xdg_data_dirs = g_get_system_data_dirs ();
+
+        for (i = 0; xdg_data_dirs[i] != NULL; i++) {
+                GdkPixbuf *pixbuf;
+                char      *path;
+
+                path = g_build_filename (xdg_data_dirs[i], "pixmaps",
+                                         filename, NULL);
+
+                if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+                        g_free (path);
+                        continue;
+                }
+
+                pixbuf = load_pixbuf (path);
+                g_free (path);
+
+                if (pixbuf)
+                        return pixbuf;
+        }
+
+        return NULL;
+}
+
+static GdkPixbuf *
 load_splash_pixbuf (void)
 {
         GConfClient *gconf;
@@ -226,14 +246,14 @@
                                             NULL);
 
         if (filename != NULL) {
-                pixbuf = load_pixbuf (filename);
+                pixbuf = load_pixbuf_relative_path (filename);
                 g_free (filename);
         } else {
                 pixbuf = NULL;
         }
 
         if (pixbuf == NULL) {
-                pixbuf = load_pixbuf ("splash/gnome-splash.png");
+                pixbuf = load_pixbuf_relative_path ("splash/gnome-splash.png");
         }
 
         return pixbuf;
@@ -254,7 +274,8 @@
         background = load_splash_pixbuf ();
         splash_widget = gsm_splash_window_new (background);
         splash = (GsmSplashWindow *)splash_widget;
-        g_object_unref (background);
+        if (background)
+                g_object_unref (background);
 
         /* Set up startup notification monitoring */
         display = gdk_display_get_default ();
@@ -285,16 +306,30 @@
 main (int argc, char *argv[])
 {
         GOptionContext *context;
+        GError         *error;
 
-        g_type_init ();
+        bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+        textdomain (GETTEXT_PACKAGE);
+
+        context = g_option_context_new (N_("- GNOME Splash Screen"));
+        g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+        g_option_context_add_group (context,
+                                    egg_sm_client_get_option_group ());
+        g_option_context_add_group (context, gtk_get_option_group (TRUE));
 
-        context = g_option_context_new (_("- GNOME Splash Screen"));
+        gtk_init (&argc, &argv);
+
+        error = NULL;
+        if (!g_option_context_parse (context, &argc, &argv, &error)) {
+                g_printerr ("Cannot parse arguments: %s\n", error->message);
+                g_error_free (error);
+                g_option_context_free (context);
+
+                return 1;
+        }
 
-        gnome_program_init ("gnome-session-splash", VERSION,
-                            EGG_SM_CLIENT_LIBGNOMEUI_MODULE,
-                            argc, argv,
-                            GNOME_PARAM_GOPTION_CONTEXT, context,
-                            NULL);
+        g_option_context_free (context);
 
         g_signal_connect (egg_sm_client_get (),
                           "quit",



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