2004-10-14 John (J5) Palmieri <johnp@redhat.com>
* info-daemon/NetworkManagerInfo.c - (main): Added session management git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@229 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:

committed by
John Palmieri

parent
11af9b0d9c
commit
cc37a0ca1c
@@ -1,3 +1,8 @@
|
|||||||
|
2004-10-14 John (J5) Palmieri <johnp@redhat.com>
|
||||||
|
|
||||||
|
* info-daemon/NetworkManagerInfo.c
|
||||||
|
- (main): Added session management
|
||||||
|
|
||||||
2004-10-14 Dan Williams <dcbw@redhat.com>
|
2004-10-14 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* panel-applet/NMWirelessAppletDbus.[ch]
|
* panel-applet/NMWirelessAppletDbus.[ch]
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
* (C) Copyright 2004 Red Hat, Inc.
|
* (C) Copyright 2004 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <libgnomeui/gnome-client.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <dbus/dbus.h>
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
#include <dbus/dbus-glib-lowlevel.h>
|
||||||
@@ -106,7 +107,7 @@ nmi_spawn_notification_icon (NMIAppInfo *info)
|
|||||||
if (info->notification_icon_pid > 0)
|
if (info->notification_icon_pid > 0)
|
||||||
g_spawn_close_pid (info->notification_icon_pid);
|
g_spawn_close_pid (info->notification_icon_pid);
|
||||||
|
|
||||||
if (info->notification_icon_watch != NULL)
|
if (info->notification_icon_watch != 0)
|
||||||
g_source_remove (info->notification_icon_watch);
|
g_source_remove (info->notification_icon_watch);
|
||||||
|
|
||||||
if (info->notification_icon_respawn_timer == NULL)
|
if (info->notification_icon_respawn_timer == NULL)
|
||||||
@@ -152,6 +153,17 @@ nmi_spawn_notification_icon (NMIAppInfo *info)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void session_die (GnomeClient *client, gpointer client_data)
|
||||||
|
{
|
||||||
|
gtk_main_quit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean session_save (GnomeClient *client, gpointer client_data)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* main
|
||||||
*
|
*
|
||||||
@@ -159,6 +171,8 @@ nmi_spawn_notification_icon (NMIAppInfo *info)
|
|||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
GnomeProgram *program;
|
GnomeProgram *program;
|
||||||
|
GnomeClient *client;
|
||||||
|
GPtrArray *restart_argv;
|
||||||
gboolean no_daemon;
|
gboolean no_daemon;
|
||||||
DBusError dbus_error;
|
DBusError dbus_error;
|
||||||
DBusConnection *dbus_connection;
|
DBusConnection *dbus_connection;
|
||||||
@@ -184,6 +198,8 @@ int main( int argc, char *argv[] )
|
|||||||
GNOME_PARAM_HUMAN_READABLE_NAME, "Network Manager User Info Service",
|
GNOME_PARAM_HUMAN_READABLE_NAME, "Network Manager User Info Service",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
client = gnome_master_client ();
|
||||||
|
|
||||||
openlog("NetworkManagerInfo", (no_daemon) ? LOG_CONS | LOG_PERROR : LOG_CONS, (no_daemon) ? LOG_USER : LOG_DAEMON);
|
openlog("NetworkManagerInfo", (no_daemon) ? LOG_CONS | LOG_PERROR : LOG_CONS, (no_daemon) ? LOG_USER : LOG_DAEMON);
|
||||||
|
|
||||||
if (!no_daemon)
|
if (!no_daemon)
|
||||||
@@ -262,14 +278,37 @@ int main( int argc, char *argv[] )
|
|||||||
nmi_spawn_notification_icon (app_info);
|
nmi_spawn_notification_icon (app_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
restart_argv = g_ptr_array_new ();
|
||||||
|
g_ptr_array_add (restart_argv, g_get_prgname ());
|
||||||
|
gnome_client_set_restart_command (client, restart_argv->len, (char**) restart_argv->pdata);
|
||||||
|
g_ptr_array_free (restart_argv, TRUE);
|
||||||
|
gnome_client_set_restart_style (client, GNOME_RESTART_IMMEDIATELY);
|
||||||
|
|
||||||
if (nmi_passphrase_dialog_init (app_info) != 0)
|
if (nmi_passphrase_dialog_init (app_info) != 0)
|
||||||
|
{
|
||||||
|
gnome_client_set_restart_style (client, GNOME_RESTART_ANYWAY);
|
||||||
exit (1);
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_signal_connect (client,
|
||||||
|
"save_yourself",
|
||||||
|
G_CALLBACK (session_save),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_signal_connect (client,
|
||||||
|
"die",
|
||||||
|
G_CALLBACK (session_die),
|
||||||
|
NULL);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
|
|
||||||
if (app_info->notification_icon_pid > 0)
|
if (app_info->notification_icon_pid > 0)
|
||||||
kill (app_info->notification_icon_pid, SIGTERM);
|
kill (app_info->notification_icon_pid, SIGTERM);
|
||||||
|
|
||||||
|
|
||||||
|
gnome_client_set_restart_style (client, GNOME_RESTART_ANYWAY);
|
||||||
|
|
||||||
gconf_client_notify_remove (app_info->gconf_client, notify_id);
|
gconf_client_notify_remove (app_info->gconf_client, notify_id);
|
||||||
g_object_unref (G_OBJECT (app_info->gconf_client));
|
g_object_unref (G_OBJECT (app_info->gconf_client));
|
||||||
/*g_object_unref (app_info->notification_icon);*/
|
/*g_object_unref (app_info->notification_icon);*/
|
||||||
|
Reference in New Issue
Block a user