gnome-power-manager r3247 - in trunk: . data src



Author: rhughes
Date: Tue Feb 10 11:57:12 2009
New Revision: 3247
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3247&view=rev

Log:
2009-02-10  Richard Hughes  <richard hughsie com>

* data/gnome-power-manager.desktop.in.in:
* src/gpm-main.c: (main):
* src/gpm-session.c: (gpm_session_register_client):
* src/gpm-session.h:
Start in the GNOME Panel phase, not the GNOME Applications phase.


Modified:
   trunk/ChangeLog
   trunk/data/gnome-power-manager.desktop.in.in
   trunk/src/gpm-main.c
   trunk/src/gpm-session.c
   trunk/src/gpm-session.h

Modified: trunk/data/gnome-power-manager.desktop.in.in
==============================================================================
--- trunk/data/gnome-power-manager.desktop.in.in	(original)
+++ trunk/data/gnome-power-manager.desktop.in.in	Tue Feb 10 11:57:12 2009
@@ -13,3 +13,6 @@
 X-GNOME-Bugzilla-Component=gnome-power-manager
 X-GNOME-Bugzilla-Version= VERSION@
 X-GNOME-Bugzilla-ExtraInfoScript=gnome-power-bugreport.sh
+X-GNOME-Autostart-Phase=Panel
+X-GNOME-AutoRestart=true
+

Modified: trunk/src/gpm-main.c
==============================================================================
--- trunk/src/gpm-main.c	(original)
+++ trunk/src/gpm-main.c	Tue Feb 10 11:57:12 2009
@@ -39,11 +39,13 @@
 
 #include "gpm-stock-icons.h"
 #include "gpm-common.h"
-#include "egg-debug.h"
-
 #include "gpm-manager.h"
+#include "gpm-session.h"
+
 #include "org.freedesktop.PowerManagement.h"
 
+#include "egg-debug.h"
+
 /**
  * gpm_object_register:
  * @connection: What we want to register to
@@ -127,6 +129,7 @@
 	gboolean version = FALSE;
 	gboolean timed_exit = FALSE;
 	gboolean immediate_exit = FALSE;
+	GpmSession *session = NULL;
 	GpmManager *manager = NULL;
 	GError *error = NULL;
 	GOptionContext *context;
@@ -200,6 +203,10 @@
 	gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
                                            GPM_DATA G_DIR_SEPARATOR_S "icons");
 
+	/* we have to register with the session as we are starting up with the panel */
+	session = gpm_session_new ();
+	gpm_session_register_client (session, "gnome-power-manager", getenv ("DESKTOP_AUTOSTART_ID"));
+
 	/* create a new gui object */
 	manager = gpm_manager_new ();
 
@@ -222,6 +229,7 @@
 
 	g_main_loop_unref (loop);
 
+	g_object_unref (session);
 	g_object_unref (manager);
 unref_program:
 	g_option_context_free (context);

Modified: trunk/src/gpm-session.c
==============================================================================
--- trunk/src/gpm-session.c	(original)
+++ trunk/src/gpm-session.c	Tue Feb 10 11:57:12 2009
@@ -180,6 +180,34 @@
 }
 
 /**
+ * gpm_session_register_client:
+ **/
+gboolean
+gpm_session_register_client (GpmSession *session, const gchar *app_id, const gchar *client_startup_id)
+{
+	gboolean ret;
+	gchar *client_id = NULL;
+	GError *error = NULL;
+
+	g_return_val_if_fail (GPM_IS_SESSION (session), FALSE);
+
+	/* find out if this change altered the inhibited state */
+	ret = dbus_g_proxy_call (session->priv->proxy, "RegisterClient", &error,
+				 G_TYPE_STRING, app_id,
+				 G_TYPE_STRING, client_startup_id,
+				 G_TYPE_INVALID,
+				 DBUS_TYPE_G_OBJECT_PATH, &client_id,
+				 G_TYPE_INVALID);
+	if (!ret) {
+		egg_warning ("failed to register client '%s': %s", client_startup_id, error->message);
+		g_error_free (error);
+	}
+	egg_debug ("registered startup '%s' to client id '%s'", client_startup_id, client_id);
+	g_free (client_id);
+	return ret;
+}
+
+/**
  * gpm_session_inhibit_changed_cb:
  **/
 static void

Modified: trunk/src/gpm-session.h
==============================================================================
--- trunk/src/gpm-session.h	(original)
+++ trunk/src/gpm-session.h	Tue Feb 10 11:57:12 2009
@@ -56,6 +56,9 @@
 gboolean	 gpm_session_logout			(GpmSession	*session);
 gboolean	 gpm_session_get_idle			(GpmSession	*session);
 gboolean	 gpm_session_get_inhibited		(GpmSession	*session);
+gboolean	 gpm_session_register_client		(GpmSession	*session,
+							 const gchar	*app_id,
+							 const gchar	*client_startup_id);
 
 G_END_DECLS
 



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