~ted/indicator-session/lock-screen-sanity

« back to all changes in this revision

Viewing changes to src/lock-helper.c

  • Committer: Ted Gould
  • Date: 2010-08-06 15:57:11 UTC
  • Revision ID: ted@gould.cx-20100806155711-h248ah9cujsf9swd
Making it so that lock_screen always locks the screen

Show diffs side-by-side

added added

removed removed

Lines of Context:
176
176
static gboolean
177
177
activate_timeout (gpointer data)
178
178
{
 
179
        /* Clear the ID for the timeout */
179
180
        guint * address = (guint *)data;
180
181
        *address = 0;
181
182
 
 
183
        /* Quit the mainloop */
182
184
        if (gss_mainloop != NULL) {
183
185
                g_main_loop_quit(gss_mainloop);
184
186
        }
186
188
        return FALSE;
187
189
}
188
190
 
189
 
/* Handle errors from activating the screensaver */
190
 
static void
191
 
active_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer user_data)
192
 
{
193
 
        GError * error = NULL;
194
 
 
195
 
        dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID);
196
 
 
197
 
        if (error != NULL) {
198
 
                g_warning("Unable to activate screensaver: %s", error->message);
199
 
                g_error_free(error);
200
 
        }
201
 
 
202
 
        return;
203
 
}
204
 
 
205
191
/* A fun little function to actually lock the screen.  If,
206
192
   that's what you want, let's do it! */
207
193
void
212
198
        build_gss_proxy();
213
199
        g_return_if_fail(gss_proxy != NULL);
214
200
 
215
 
        if (will_lock_screen()) {
216
 
                dbus_g_proxy_call_no_reply(gss_proxy,
217
 
                                           "Lock",
218
 
                                           G_TYPE_INVALID,
219
 
                                           G_TYPE_INVALID);
220
 
        } else {
221
 
                dbus_g_proxy_begin_call(gss_proxy,
222
 
                                        "SetActive",
223
 
                                        active_cb, NULL,
224
 
                                        NULL,
225
 
                                        G_TYPE_BOOLEAN, TRUE,
226
 
                                        G_TYPE_INVALID);
227
 
        }
 
201
        dbus_g_proxy_call_no_reply(gss_proxy,
 
202
                                   "Lock",
 
203
                                   G_TYPE_INVALID,
 
204
                                   G_TYPE_INVALID);
228
205
 
229
206
        if (gss_mainloop == NULL) {
230
207
                gss_mainloop = g_main_loop_new(NULL, FALSE);