diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-02-20 21:47:29 +0100 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-02-21 01:23:01 +0100 |
commit | 659c7130f00e7de643561253325272620e12c40d (patch) | |
tree | 518df98048dfb4124b7d2979a198a9e0e9f643f4 /gtk/gtkapplication.c | |
parent | 914053a2a3d21b87c81527ed25fc36776d976488 (diff) | |
download | gtk+-659c7130f00e7de643561253325272620e12c40d.tar.gz |
GtkApplication: remove end session API
This seems a bit "too powerful" and unlikely to be used by most
applications. Remove it from now, until someone comes up with a strong
desire for it.
https://bugzilla.gnome.org/show_bug.cgi?id=670485
Diffstat (limited to 'gtk/gtkapplication.c')
-rw-r--r-- | gtk/gtkapplication.c | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index d5bdd73037..241122601d 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -113,9 +113,6 @@ * An application can be informed when the session is about to end * by connecting to the #GtkApplication::quit signal. * - * An application can request the session to be ended by calling - * gtk_application_end_session(). - * * An application can block various ways to end the session with * the gtk_application_inhibit() function. Typical use cases for * this kind of inhibiting are long-running, uninterruptible operations, @@ -1499,67 +1496,6 @@ gtk_application_is_inhibited (GtkApplication *application, return inhibited; } -/** - * GtkApplicationEndSessionStyle: - * @GTK_APPLICATION_LOGOUT: End the session by logging out - * @GTK_APPLICATION_REBOOT: Restart the computer - * @GTK_APPLICATION_SHUTDOWN: Shut the computer down - * - * Different ways to end a user session, for use with - * gtk_application_end_session(). - */ - -/** - * gtk_application_end_session: - * @application: the #GtkApplication - * @style: the desired kind of session end - * @request_confirmation: whether or not the user should get a chance - * to confirm the action - * - * Requests that the session manager end the current session. - * @style indicates how the session should be ended, and - * @request_confirmation indicates whether or not the user should be - * given a chance to confirm the action. Both of these parameters are - * merely hints though; the session manager may choose to ignore them. - * - * Return value: %TRUE if the request was sent; %FALSE if it could not - * be sent (eg, because it could not connect to the session manager) - * - * Since: 3.4 - */ -gboolean -gtk_application_end_session (GtkApplication *application, - GtkApplicationEndSessionStyle style, - gboolean request_confirmation) -{ - g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE); - g_return_val_if_fail (!g_application_get_is_remote (G_APPLICATION (application)), FALSE); - g_return_val_if_fail (application->priv->sm_proxy != NULL, FALSE); - - switch (style) - { - case GTK_APPLICATION_LOGOUT: - g_dbus_proxy_call (application->priv->sm_proxy, - "Logout", - g_variant_new ("(u)", request_confirmation ? 0 : 1), - G_DBUS_CALL_FLAGS_NONE, - G_MAXINT, - NULL, NULL, NULL); - break; - case GTK_APPLICATION_REBOOT: - case GTK_APPLICATION_SHUTDOWN: - g_dbus_proxy_call (application->priv->sm_proxy, - "Shutdown", - NULL, - G_DBUS_CALL_FLAGS_NONE, - G_MAXINT, - NULL, NULL, NULL); - break; - } - - return TRUE; -} - #elif defined(GDK_WINDOWING_QUARTZ) /* OS X implementation copied from EggSMClient, but simplified since @@ -1683,58 +1619,6 @@ gtk_application_is_inhibited (GtkApplication *application, return FALSE; } -gboolean -gtk_application_end_session (GtkApplication *application, - GtkApplicationEndSessionStyle style, - gboolean request_confirmation) -{ - static const ProcessSerialNumber loginwindow_psn = { 0, kSystemProcess }; - AppleEvent event = { typeNull, NULL }; - AppleEvent reply = { typeNull, NULL }; - AEAddressDesc target; - AEEventID id; - OSErr err; - - switch (style) - { - case GTK_APPLICATION_LOGOUT: - id = request_confirmation ? kAELogOut : kAEReallyLogOut; - break; - case GTK_APPLICATION_REBOOT: - id = request_confirmation ? kAEShowRestartDialog : kAERestart; - break; - case GTK_APPLICATION_SHUTDOWN: - id = request_confirmation ? kAEShowShutdownDialog : kAEShutDown; - break; - } - - err = AECreateDesc (typeProcessSerialNumber, &loginwindow_psn, - sizeof (loginwindow_psn), &target); - if (err != noErr) - { - g_warning ("Could not create descriptor for loginwindow: %d", err); - return FALSE; - } - - err = AECreateAppleEvent (kCoreEventClass, id, &target, - kAutoGenerateReturnID, kAnyTransactionID, - &event); - AEDisposeDesc (&target); - if (err != noErr) - { - g_warning ("Could not create logout AppleEvent: %d", err); - return FALSE; - } - - err = AESend (&event, &reply, kAENoReply, kAENormalPriority, - kAEDefaultTimeout, NULL, NULL); - AEDisposeDesc (&event); - if (err == noErr) - AEDisposeDesc (&reply); - - return err == noErr; -} - #else /* Trivial implementation. @@ -1765,12 +1649,4 @@ gtk_application_is_inhibited (GtkApplication *application, return FALSE; } -gboolean -gtk_application_end_session (GtkApplication *application, - GtkApplicationEndSessionStyle style, - gboolean request_confirmation) -{ - return FALSE; -} - #endif |