~ubuntu-branches/ubuntu/raring/gnome-session/raring

« back to all changes in this revision

Viewing changes to gnome-session/gsm-system.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-05-07 11:22:35 UTC
  • mfrom: (1.1.75) (2.2.14 sid)
  • Revision ID: package-import@ubuntu.com-20120507112235-z9pe25ur5d8zt4c6
Tags: 3.4.1-1ubuntu1
* Merge with Debian. Remaining changes:
 - debian/control.in:
   + gnome-session
     - Recommend nautilus and either unity, unity-2d or gnome-shell
     - Only suggest gnome-session-fallback (we don't want it to be installed
       by default)
     - Drop the Recommends on gnome-power-manager, the code gnome-session uses
       has moved to gnome-settings-daemon
   + gnome-session-fallback
     - Recommend cups-pk-helper for gnome-session-fallback so that
       System Settings>Printers works
 - debian/gnome-session-bin.postinst, debian/gnome-session-bin.prerm:
    Moved registering gnome-session binary as a session manager to 
    gnome-session-bin package
 - debian/postinst, postrm:
    set the default lightdm session as ubuntu if none already set
 - don't install defaults.list (installed by desktop-file-utils in ubuntu):
    debian/gnome-session-common.dirs and gnome-session-common.install
 - add debian/gnome-session-common.gsettings-override:
   set ubuntu as the default session if nothing is provided
 - debian/55gnome-session_gnomerc:
    Use POSIX string substitutions (shell internal) instead of external
    basename and cut for startup speed.
 - debian/patches/20_hide_nodisplay.patch:
    Don't show applications in the Sessions properties dialog that have
    NoDisplay=true.
 - debian/patches/21_up_start_on_demand.patch:
    Don't call dkp_client_new() until actually needed. This blocks
    for some time whilst DK-Power is started, if it wasn't running already
    (which is the case during auto-login). This can delay the whole
    session from starting.
 - debian/patches/22_support_autostart_delay.patch:
    Bugzilla patch to support adding a delay to autostart apps, using
    a "X-GNOME-Autostart-Delay" key in the desktop file
 - debian/patches/50_ubuntu_sessions.patch:
    + Add Ubuntu & Ubuntu 2D sessions
    + Add GNOME Classic (Without Effects session). Use notify-osd for
      notifications, but don't add it to RequiredComponents since notify-osd
      doesn't have an autostart .desktop file
    + gnome-shell.desktop adds --session=gnome now that the "ubuntu" session
      is the default. Use TryExec to test if gnome-shell is installed.
 - debian/patches/51_remove_session_saving_from_gui.patch:
    add GNOME_SESSION_SAVE environment variable for people wanting to
    use the save session still, knowing that it can break your system
    if used unwisely (LP: #771896)
 - debian/patches/52_xdg_current_desktop.patch:
    Set XDG_CURRENT_DESKTOP inside gnome-session based on a
    new key 'DesktopName' in gnome-session .desktop files.
 - debian/patches/80_new_upstream_session_dialog.patch:
    Bugzilla patch to change the session dialog. (Deactivated, see bug 807503)
 - debian/patches/95_dbus_request_shutdown.patch:
    Add "RequestShutdown" and "RequestReboot" DBus methods to allow other
    applications to shutdown or reboot the machine via the session manager.
 - debian/patches/96_no_catch_sigsegv.patch:
    Don't register a handler for SIGSEGV. We want Apport to catch these
    crashes so that users can submit useful crash reports.
 - debian/patches/101_screen_lock_on_suspend.patch:
    Use the same logic as gnome-power-manager for deciding the "screen
    lock on suspend" policy. This restores the Jaunty behaviour rather
    than just using the screensaver settings, which is surprising for
    users.
    This patch is deactivated for now, we'll see with the new screensaver and
    screen locking experience what to do (not rebased on gsettings as well)
  - debian/patches/103_kill_the_fail_whale.patch:
    seems that the fail whale try to come back and resist from his removal
    refreshed the patch to ensure it's killed and won't come back ever ever
    again.
  - 104_dont_show_fallback_warning.patch:
    Disable GNOME Fallback warning. It doesn't really explain anything
    and assumes that there aren't people that want to run Fallback.
  - debian/patches/105_hide_session_startup_help.patch:
    Hide Help button on Startup Applications dialog, as it is broken
    and the help documentation hasn't been written for 3.x yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
2
 *
 
3
 * Copyright (C) 2012 Red Hat, Inc.
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2, or (at your option)
 
8
 * any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
18
 * 02111-1307, USA.
 
19
 */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
#include <glib-object.h>
 
24
#include <glib/gi18n.h>
 
25
 
 
26
#include "gsm-system.h"
 
27
#include "gsm-consolekit.h"
 
28
#include "gsm-systemd.h"
 
29
 
 
30
enum {
 
31
        REQUEST_COMPLETED = 0,
 
32
        LAST_SIGNAL
 
33
};
 
34
 
 
35
static guint signals[LAST_SIGNAL] = { 0 };
 
36
 
 
37
G_DEFINE_INTERFACE (GsmSystem, gsm_system, G_TYPE_OBJECT)
 
38
 
 
39
static void
 
40
gsm_system_default_init (GsmSystemInterface *iface)
 
41
{
 
42
        signals [REQUEST_COMPLETED] =
 
43
                g_signal_new ("request-completed",
 
44
                              GSM_TYPE_SYSTEM,
 
45
                              G_SIGNAL_RUN_LAST,
 
46
                              G_STRUCT_OFFSET (GsmSystemInterface, request_completed),
 
47
                              NULL,
 
48
                              NULL,
 
49
                              g_cclosure_marshal_VOID__POINTER,
 
50
                              G_TYPE_NONE,
 
51
                              1, G_TYPE_POINTER);
 
52
}
 
53
 
 
54
GQuark
 
55
gsm_system_error_quark (void)
 
56
{
 
57
        static GQuark error_quark = 0;
 
58
 
 
59
        if (error_quark == 0) {
 
60
                error_quark = g_quark_from_static_string ("gsm-system-error");
 
61
        }
 
62
 
 
63
        return error_quark;
 
64
}
 
65
 
 
66
gboolean
 
67
gsm_system_can_switch_user (GsmSystem *system)
 
68
{
 
69
        return GSM_SYSTEM_GET_IFACE (system)->can_switch_user (system);
 
70
}
 
71
 
 
72
gboolean
 
73
gsm_system_can_stop (GsmSystem *system)
 
74
{
 
75
        return GSM_SYSTEM_GET_IFACE (system)->can_stop (system);
 
76
}
 
77
 
 
78
gboolean
 
79
gsm_system_can_restart (GsmSystem *system)
 
80
{
 
81
        return GSM_SYSTEM_GET_IFACE (system)->can_restart (system);
 
82
}
 
83
 
 
84
void
 
85
gsm_system_attempt_stop (GsmSystem *system)
 
86
{
 
87
        GSM_SYSTEM_GET_IFACE (system)->attempt_stop (system);
 
88
}
 
89
 
 
90
void
 
91
gsm_system_attempt_restart (GsmSystem *system)
 
92
{
 
93
        GSM_SYSTEM_GET_IFACE (system)->attempt_restart (system);
 
94
}
 
95
 
 
96
void
 
97
gsm_system_set_session_idle (GsmSystem *system,
 
98
                             gboolean   is_idle)
 
99
{
 
100
        GSM_SYSTEM_GET_IFACE (system)->set_session_idle (system, is_idle);
 
101
}
 
102
 
 
103
gboolean
 
104
gsm_system_is_login_session (GsmSystem *system)
 
105
{
 
106
        return GSM_SYSTEM_GET_IFACE (system)->is_login_session (system);
 
107
}
 
108
 
 
109
GsmSystem *
 
110
gsm_get_system (void)
 
111
{
 
112
        static GsmSystem *system = NULL;
 
113
 
 
114
        if (system == NULL) {
 
115
                system = GSM_SYSTEM (gsm_systemd_new ());
 
116
                if (system != NULL) {
 
117
                        g_debug ("Using systemd for session tracking");
 
118
                }
 
119
        }
 
120
        if (system == NULL) {
 
121
                system = GSM_SYSTEM (gsm_consolekit_new ());
 
122
                if (system != NULL) {
 
123
                        g_debug ("Using ConsoleKit for session tracking");
 
124
                }
 
125
        }
 
126
 
 
127
        return g_object_ref (system);
 
128
}