gnome-power-manager r2729 - in branches/gnome-2-22: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2729 - in branches/gnome-2-22: . src
- Date: Wed, 12 Mar 2008 21:09:13 +0000 (GMT)
Author: rhughes
Date: Wed Mar 12 21:09:13 2008
New Revision: 2729
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2729&view=rev
Log:
2008-03-12 Richard Hughes <richard hughsie com>
* src/gpm-main.c: (gpm_exit), (main):
This is was removed from gpm-main.c, but GpmManager breaks,
What the users sees is that GPM can no longer cause a session kill.
Found by Ted Gould, many thanks. (#521686)
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/src/gpm-main.c
Modified: branches/gnome-2-22/src/gpm-main.c
==============================================================================
--- branches/gnome-2-22/src/gpm-main.c (original)
+++ branches/gnome-2-22/src/gpm-main.c Wed Mar 12 21:09:13 2008
@@ -31,7 +31,7 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
#include <glade/glade.h>
#include <gst/gst.h>
@@ -42,6 +42,8 @@
#include "gpm-manager.h"
#include "dbus/xdg-power-management-core.h"
+static void gpm_exit (GpmManager *manager);
+
/**
* gpm_object_register:
* @connection: What we want to register to
@@ -98,6 +100,17 @@
}
/**
+ * gpm_exit:
+ * @manager: This manager class instance
+ **/
+static void
+gpm_exit (GpmManager *manager)
+{
+ gpm_debug_shutdown ();
+ exit (0);
+}
+
+/**
* timed_exit_cb:
* @loop: The main loop
*
@@ -119,6 +132,8 @@
main (int argc, char *argv[])
{
GMainLoop *loop;
+ GnomeClient *master;
+ GnomeClientFlags flags;
DBusGConnection *system_connection;
DBusGConnection *session_connection;
gboolean verbose = FALSE;
@@ -129,6 +144,7 @@
GpmManager *manager = NULL;
GError *error = NULL;
GOptionContext *context;
+ GnomeProgram *program;
char **debugoptions = NULL;
int i;
@@ -156,19 +172,31 @@
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
- g_option_context_add_group (context, gtk_get_option_group (FALSE));
- g_option_context_parse (context, &argc, &argv, NULL);
-
- /* manually poke gtk, it seems gtk_get_option_group isn't good enough */
- gtk_init (&argc, &argv);
+ program = gnome_program_init (argv[0], VERSION,
+ LIBGNOMEUI_MODULE, argc, argv,
+ GNOME_PROGRAM_STANDARD_PROPERTIES,
+ GNOME_PARAM_GOPTION_CONTEXT, context,
+ GNOME_PARAM_HUMAN_READABLE_NAME, GPM_NAME,
+ NULL);
g_set_application_name (GPM_NAME);
+ master = gnome_master_client ();
+ flags = gnome_client_get_flags (master);
+
if (version == TRUE) {
g_print ("Version %s\n", VERSION);
- return 0;
+ goto unref_program;
}
+ if (flags & GNOME_CLIENT_IS_CONNECTED) {
+ /* We'll disable this as users are getting constant crashes */
+ /* gnome_client_set_restart_style (master, GNOME_RESTART_IMMEDIATELY);*/
+ gnome_client_flush (master);
+ }
+
+ g_signal_connect (GTK_OBJECT (master), "die", G_CALLBACK (gpm_exit), manager);
+
if (!g_thread_supported ())
g_thread_init (NULL);
dbus_g_thread_init ();
@@ -245,6 +273,11 @@
/* rip down gstreamer */
gst_deinit ();
g_object_unref (manager);
+unref_program:
+ g_object_unref (program);
+/*
+ g_option_context_free (context);
+*/
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]