~ubuntu-branches/ubuntu/precise/indicator-session/precise

« back to all changes in this revision

Viewing changes to src/lock-helper.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-01-28 16:56:41 UTC
  • Revision ID: package-import@ubuntu.com-20120128165641-045olyystq887flg
Tags: 0.3.7.1-1ubuntu2
debian/patches/01-remove-dead-gss-handling.patch: Remove dead GSS
throttling code. Let gnome-settings-daemon handle locking the screen
when UPower requests it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
static DBusGProxy * gss_proxy = NULL;
31
31
static GMainLoop * gss_mainloop = NULL;
32
 
static guint cookie = 0;
33
 
static DBusGProxyCall * cookie_call = NULL;
34
32
 
35
33
static gboolean is_guest = FALSE;
36
34
 
38
36
 
39
37
void build_gss_proxy (void);
40
38
 
41
 
/* Checks to see if there is an error and reports
42
 
   it.  Not much else we can do. */
43
 
static void
44
 
unthrottle_return (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data)
45
 
{
46
 
        GError * error = NULL;
47
 
        dbus_g_proxy_end_call(proxy, call, &error,
48
 
                              G_TYPE_INVALID);
49
 
 
50
 
        if (error != NULL) {
51
 
                g_warning("Unable to unthrottle: %s", error->message);
52
 
        }
53
 
        return;
54
 
}
55
 
 
56
 
/* Sends an unthrottle if we're throttled. */
57
 
void
58
 
screensaver_unthrottle (void)
59
 
{
60
 
        g_return_if_fail(cookie != 0);
61
 
 
62
 
        build_gss_proxy();
63
 
        g_return_if_fail(gss_proxy != NULL);
64
 
 
65
 
        dbus_g_proxy_begin_call(gss_proxy, "UnThrottle",
66
 
                                unthrottle_return, NULL,
67
 
                                NULL,
68
 
                                G_TYPE_UINT, cookie,
69
 
                                G_TYPE_INVALID);
70
 
 
71
 
        cookie = 0;
72
 
        return;
73
 
}
74
 
 
75
 
/* Gets there return cookie from the throttle command
76
 
   and sets things valid */
77
 
static void
78
 
throttle_return (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data)
79
 
{
80
 
        GError * error = NULL;
81
 
        cookie_call = NULL;
82
 
 
83
 
        dbus_g_proxy_end_call(proxy, call, &error,
84
 
                              G_TYPE_UINT, &cookie,
85
 
                              G_TYPE_INVALID);
86
 
 
87
 
        if (error != NULL) {
88
 
                g_warning("Unable to throttle the screensaver: %s", error->message);
89
 
                return;
90
 
        }
91
 
 
92
 
 
93
 
        if (cookie == 0) {
94
 
                g_warning("We didn't get a throttle cookie!");
95
 
        }
96
 
 
97
 
        return;
98
 
}
99
 
 
100
 
/* Throttling the screensaver by using the screen saver
101
 
   command. */
102
 
void
103
 
screensaver_throttle (gchar * reason)
104
 
{
105
 
        g_return_if_fail(cookie_call == NULL);
106
 
        g_return_if_fail(will_lock_screen());
107
 
 
108
 
        if (cookie != 0) {
109
 
                screensaver_unthrottle();
110
 
        }
111
 
 
112
 
        build_gss_proxy();
113
 
        g_return_if_fail(gss_proxy != NULL);
114
 
 
115
 
        cookie_call = dbus_g_proxy_begin_call(gss_proxy, "Throttle",
116
 
                                              throttle_return, NULL,
117
 
                                              NULL,
118
 
                                              G_TYPE_STRING, "Session Menu",
119
 
                                              G_TYPE_STRING, reason,
120
 
                                              G_TYPE_INVALID);
121
 
 
122
 
        return;
123
 
}
124
 
 
125
39
/* This is our logic on whether the screen should be locked
126
40
   or not.  It effects everything else. */
127
41
gboolean