~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to gnome-panel/panel-session.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-14 22:20:05 UTC
  • mto: (2.1.6 squeeze) (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 171.
  • Revision ID: james.westby@ubuntu.com-20100114222005-rll7tw9fojl3ac6z
Tags: upstream-2.29.5.1
ImportĀ upstreamĀ versionĀ 2.29.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include <config.h>
26
26
 
27
 
#include <libgnomeui/gnome-client.h>
28
 
 
29
27
#include <stdlib.h>
30
28
 
 
29
#include <gdk/gdk.h>
 
30
 
 
31
#include <libegg/eggsmclient.h>
 
32
 
31
33
#include "panel-shell.h"
32
34
 
33
35
#include "panel-session.h"
34
36
 
 
37
static gboolean do_not_restart = FALSE;
 
38
 
35
39
static void
36
 
panel_session_handle_die_request (GnomeClient *client)
 
40
panel_session_handle_quit (EggSMClient *client,
 
41
                           gpointer     data)
37
42
{
38
 
        g_return_if_fail (GNOME_IS_CLIENT (client));
39
 
 
40
43
        panel_shell_quit ();
41
44
}
42
45
 
43
46
void
44
47
panel_session_do_not_restart (void)
45
48
{
46
 
        GnomeClient *client;
47
 
 
48
 
        client = gnome_master_client ();
49
 
 
50
 
        gnome_client_set_restart_style (client, GNOME_RESTART_IF_RUNNING);
 
49
        do_not_restart = TRUE;
 
50
 
 
51
        if (egg_sm_client_get_mode () != EGG_SM_CLIENT_MODE_DISABLED)
 
52
                egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_NO_RESTART);
51
53
}
52
54
 
53
55
void
54
56
panel_session_init (void)
55
57
{
56
 
        GnomeClient *client;
57
 
 
58
 
        client = gnome_master_client ();
 
58
        EggSMClientMode  mode;
 
59
        EggSMClient     *client;
59
60
 
60
61
        /* Explicitly tell the session manager we're ready -- we don't do it
61
 
         * before.
62
 
         * TODO: when migrating away from libgnomeui, we need to keep this
63
 
         * late connection. In its current state, I don't think eggsmclient
64
 
         * supports this (because it connects to the session manager in a
65
 
         * post-options-parsing hook). */
66
 
        gnome_client_connect (client);
 
62
         * before. Note: this depends on setting the mode to DISABLED early
 
63
         * during startup. */
 
64
 
 
65
        if (do_not_restart || getenv ("GNOME_PANEL_DEBUG"))
 
66
                mode = EGG_SM_CLIENT_MODE_NO_RESTART;
 
67
        else
 
68
                mode = EGG_SM_CLIENT_MODE_NORMAL;
 
69
 
 
70
        egg_sm_client_set_mode (mode);
 
71
 
 
72
        client = egg_sm_client_get ();
 
73
 
 
74
        g_signal_connect (client, "quit",
 
75
                          G_CALLBACK (panel_session_handle_quit), NULL);
67
76
 
68
77
        /* We don't want the WM to try and save/restore our
69
78
         * window position */
70
79
        gdk_set_sm_client_id (NULL);
71
 
 
72
 
        if (!getenv ("GNOME_PANEL_DEBUG"))
73
 
                gnome_client_set_restart_style (client, GNOME_RESTART_IMMEDIATELY);
74
 
 
75
 
        gnome_client_set_priority (client, 40);
76
 
 
77
 
        g_signal_connect (client, "die",
78
 
                          G_CALLBACK (panel_session_handle_die_request), NULL);
79
80
}