[Goodies-commits] r7156 - in xfce4-power-manager/trunk: . src
Ali Abdallah
aliov at xfce.org
Fri Apr 10 16:15:09 CEST 2009
Author: aliov
Date: 2009-04-10 14:15:09 +0000 (Fri, 10 Apr 2009)
New Revision: 7156
Modified:
xfce4-power-manager/trunk/ChangeLog
xfce4-power-manager/trunk/src/xfpm-main.c
Log:
Fix the session restart command in the previous revision
Modified: xfce4-power-manager/trunk/ChangeLog
===================================================================
--- xfce4-power-manager/trunk/ChangeLog 2009-04-10 14:00:29 UTC (rev 7155)
+++ xfce4-power-manager/trunk/ChangeLog 2009-04-10 14:15:09 UTC (rev 7156)
@@ -1,4 +1,7 @@
+2009-04-10 16:15 Ali aliov at xfce.org
+ * : Fix the session restart command in the previous revision
+
2009-04-10 16:00 Ali aliov at xfce.org
* : Connect to the session using libxfcegui4 and properly shutdown when the session dies
Modified: xfce4-power-manager/trunk/src/xfpm-main.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-main.c 2009-04-10 14:00:29 UTC (rev 7155)
+++ xfce4-power-manager/trunk/src/xfpm-main.c 2009-04-10 14:15:09 UTC (rev 7156)
@@ -43,6 +43,9 @@
#include "xfpm-manager.h"
#include "xfpm-session.h"
+static gchar *client_id = NULL;
+static gboolean no_daemon = FALSE;
+
static void
show_version()
{
@@ -53,6 +56,29 @@
"Licensed under the GNU GPL.\n\n"), VERSION);
}
+static void
+xfpm_start (DBusGConnection *bus)
+{
+ TRACE("Starting the power manager\n");
+ XfpmSession *session;
+ session = xfpm_session_new ();
+
+ if ( client_id != NULL )
+ xfpm_session_set_client_id (session, client_id);
+
+ if ( no_daemon == FALSE && daemon(0,0) )
+ {
+ g_critical ("Could not daemonize");
+ }
+
+ XfpmManager *manager;
+ manager = xfpm_manager_new(bus);
+ xfpm_manager_start(manager);
+ gtk_main();
+
+ g_object_unref (session);
+}
+
int main(int argc, char **argv)
{
DBusGConnection *bus;
@@ -63,9 +89,7 @@
gboolean quit = FALSE;
gboolean config = FALSE;
gboolean version = FALSE;
- gboolean no_daemon = FALSE;
gboolean reload = FALSE;
- gchar *client_id = NULL;
xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
@@ -184,14 +208,11 @@
if ( reload )
{
- if (!xfpm_dbus_name_has_owner(dbus_g_connection_get_connection (bus),
- "org.xfce.PowerManager") )
+ if (!xfpm_dbus_name_has_owner(dbus_g_connection_get_connection (bus), "org.xfce.PowerManager") &&
+ !xfpm_dbus_name_has_owner (dbus_g_connection_get_connection(bus), "org.freedesktop.PowerManagement"))
{
- xfpm_info (_("Xfce Power Manager"),
- _("Xfce power manager is not running"));
-
-
- return EXIT_FAILURE;
+ g_print ("Xfce power manager is not running\n");
+ xfpm_start (bus);
}
proxy = dbus_g_proxy_new_for_name(bus,
"org.xfce.PowerManager",
@@ -229,24 +250,7 @@
}
else
{
- TRACE("Starting the power manager\n");
- XfpmSession *session;
- session = xfpm_session_new ();
-
- if ( client_id != NULL )
- xfpm_session_set_client_id (session, client_id);
-
- if ( no_daemon == FALSE && daemon(0,0) )
- {
- g_critical ("Could not daemonize");
- }
-
- XfpmManager *manager;
- manager = xfpm_manager_new(bus);
- xfpm_manager_start(manager);
- gtk_main();
-
- g_object_unref (session);
+ xfpm_start (bus);
}
return EXIT_SUCCESS;
More information about the Goodies-commits
mailing list