gnome-panel r11446 - in trunk/gnome-panel: . libpanel-util
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11446 - in trunk/gnome-panel: . libpanel-util
- Date: Thu, 15 Jan 2009 15:39:12 +0000 (UTC)
Author: vuntz
Date: Thu Jan 15 15:39:12 2009
New Revision: 11446
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11446&view=rev
Log:
2009-01-15 Vincent Untz <vuntz gnome org>
Fix gnome-panel part of bug #536915.
Based on patch by Ray Strode <rstrode redhat com>
* libpanel-util/panel-session-manager.[ch]:
(panel_session_manager_is_shutdown_available): new, to tell if shutdown
is available from the session manager
* panel-action-button.c:
(panel_action_shutdown_reboot_is_disabled): use the new method for the
action buttons
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/libpanel-util/panel-session-manager.c
trunk/gnome-panel/libpanel-util/panel-session-manager.h
trunk/gnome-panel/panel-action-button.c
Modified: trunk/gnome-panel/libpanel-util/panel-session-manager.c
==============================================================================
--- trunk/gnome-panel/libpanel-util/panel-session-manager.c (original)
+++ trunk/gnome-panel/libpanel-util/panel-session-manager.c Thu Jan 15 15:39:12 2009
@@ -141,6 +141,42 @@
}
}
+gboolean
+panel_session_manager_is_shutdown_available (PanelSessionManager *manager)
+{
+ GError *error;
+ DBusGProxy *proxy;
+ gboolean is_shutdown_available;
+
+ g_return_val_if_fail (PANEL_IS_SESSION_MANAGER (manager), FALSE);
+
+ error = NULL;
+
+ if (!panel_dbus_service_ensure_connection (PANEL_DBUS_SERVICE (manager),
+ &error)) {
+ g_warning ("Could not connect to session manager: %s",
+ error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ proxy = panel_dbus_service_get_proxy (PANEL_DBUS_SERVICE (manager));
+
+ if (!dbus_g_proxy_call (proxy, "CanShutdown", &error,
+ G_TYPE_INVALID, G_TYPE_BOOLEAN,
+ &is_shutdown_available, G_TYPE_INVALID) &&
+ error != NULL) {
+ g_warning ("Could not ask session manager if shut down is available: %s",
+ error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ return is_shutdown_available;
+}
+
PanelSessionManager *
panel_session_manager_get (void)
{
Modified: trunk/gnome-panel/libpanel-util/panel-session-manager.h
==============================================================================
--- trunk/gnome-panel/libpanel-util/panel-session-manager.h (original)
+++ trunk/gnome-panel/libpanel-util/panel-session-manager.h Thu Jan 15 15:39:12 2009
@@ -64,6 +64,8 @@
PanelSessionManagerLogoutType mode);
void panel_session_manager_request_shutdown (PanelSessionManager *session);
+gboolean panel_session_manager_is_shutdown_available (PanelSessionManager *session);
+
G_END_DECLS
#endif /* PANEL_SESSION_MANAGER_H */
Modified: trunk/gnome-panel/panel-action-button.c
==============================================================================
--- trunk/gnome-panel/panel-action-button.c (original)
+++ trunk/gnome-panel/panel-action-button.c Thu Jan 15 15:39:12 2009
@@ -192,15 +192,14 @@
static gboolean
panel_action_shutdown_reboot_is_disabled (void)
{
- return panel_lockdown_get_disable_log_out();
-#if 0
- /* FIXME: waiting for a gnome-session dbus api to know if
- * shutdown/reboot is possible:
- * http://bugzilla.gnome.org/show_bug.cgi?id=536915 */
- return (panel_lockdown_get_disable_log_out() ||
- (!gdm_supports_logout_action (GDM_LOGOUT_ACTION_SHUTDOWN) &&
- !gdm_supports_logout_action (GDM_LOGOUT_ACTION_REBOOT)));
-#endif
+ PanelSessionManager *manager;
+
+ if (panel_lockdown_get_disable_log_out())
+ return TRUE;
+
+ manager = panel_session_manager_get ();
+
+ return (!panel_session_manager_is_shutdown_available (manager));
}
/* Run Application
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]