diff options
-rw-r--r-- | src/gtk-dialog/ck-pk-helper.c | 10 | ||||
-rw-r--r-- | src/gtk-dialog/ck-pk-helper.h | 2 | ||||
-rw-r--r-- | src/gtk-dialog/dialog.h | 2 | ||||
-rw-r--r-- | src/gtk-dialog/gtk-logout-helper.c | 22 |
4 files changed, 19 insertions, 17 deletions
diff --git a/src/gtk-dialog/ck-pk-helper.c b/src/gtk-dialog/ck-pk-helper.c index dc7d900..6879517 100644 --- a/src/gtk-dialog/ck-pk-helper.c +++ b/src/gtk-dialog/ck-pk-helper.c @@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <dbus/dbus-glib.h> #include <polkit/polkit.h> -#include "logout-dialog.h" +#include "dialog.h" #include "ck-pk-helper.h" static gboolean @@ -150,20 +150,20 @@ ck_multiple_users (void) } gboolean -pk_require_auth (LogoutDialogAction action) { - if (action == LOGOUT_DIALOG_LOGOUT) { +pk_require_auth (LogoutDialogType action) { + if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) { return FALSE; } gchar * pk_action; if (ck_multiple_users()) { - if (action == LOGOUT_DIALOG_RESTART) { + if (action == LOGOUT_DIALOG_TYPE_RESTART) { pk_action = "org.freedesktop.consolekit.system.restart-multiple-users"; } else { pk_action = "org.freedesktop.consolekit.system.stop-multiple-users"; } } else { - if (action == LOGOUT_DIALOG_RESTART) { + if (action == LOGOUT_DIALOG_TYPE_RESTART) { pk_action = "org.freedesktop.consolekit.system.restart"; } else { pk_action = "org.freedesktop.consolekit.system.stop"; diff --git a/src/gtk-dialog/ck-pk-helper.h b/src/gtk-dialog/ck-pk-helper.h index 501a8c8..dfbb432 100644 --- a/src/gtk-dialog/ck-pk-helper.h +++ b/src/gtk-dialog/ck-pk-helper.h @@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <polkit/polkit.h> -gboolean pk_require_auth (LogoutDialogAction action); +gboolean pk_require_auth (LogoutDialogType action); gboolean pk_can_do_action (const gchar *action_id, PolkitAuthorizationResult ** pol_result); #endif /* __CK_PK_HELPER__ */ diff --git a/src/gtk-dialog/dialog.h b/src/gtk-dialog/dialog.h index 79c8a05..bd6abd2 100644 --- a/src/gtk-dialog/dialog.h +++ b/src/gtk-dialog/dialog.h @@ -4,6 +4,8 @@ #include <glib.h> #include <glib-object.h> +#include <gtk/gtk.h> + G_BEGIN_DECLS #define LOGOUT_DIALOG_TYPE (logout_dialog_get_type ()) diff --git a/src/gtk-dialog/gtk-logout-helper.c b/src/gtk-dialog/gtk-logout-helper.c index d8aea6b..09e6e86 100644 --- a/src/gtk-dialog/gtk-logout-helper.c +++ b/src/gtk-dialog/gtk-logout-helper.c @@ -25,12 +25,12 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <glib.h> #include <gtk/gtk.h> #include <dbus/dbus-glib.h> -#include "logout-dialog.h" +#include "dialog.h" #include "ck-pk-helper.h" #include "gconf-helper.h" static void -session_action (LogoutDialogAction action) +session_action (LogoutDialogType action) { DBusGConnection * sbus; DBusGProxy * sm_proxy; @@ -55,13 +55,13 @@ session_action (LogoutDialogAction action) g_clear_error (&error); - if (action == LOGOUT_DIALOG_LOGOUT) { + if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) { res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error, G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID); - } else if (action == LOGOUT_DIALOG_SHUTDOWN) { + } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) { res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); - } else if (action == LOGOUT_DIALOG_RESTART) { + } else if (action == LOGOUT_DIALOG_TYPE_RESTART) { res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); } else { @@ -85,26 +85,26 @@ session_action (LogoutDialogAction action) return; } -static LogoutDialogAction type = LOGOUT_DIALOG_LOGOUT; +static LogoutDialogType type = LOGOUT_DIALOG_TYPE_LOG_OUT; static gboolean option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error) { - type = LOGOUT_DIALOG_LOGOUT; + type = LOGOUT_DIALOG_TYPE_LOG_OUT; return TRUE; } static gboolean option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error) { - type = LOGOUT_DIALOG_SHUTDOWN; + type = LOGOUT_DIALOG_TYPE_SHUTDOWN; return TRUE; } static gboolean option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error) { - type = LOGOUT_DIALOG_RESTART; + type = LOGOUT_DIALOG_TYPE_RESTART; return TRUE; } @@ -150,7 +150,7 @@ main (int argc, char * argv[]) not getting a dialog at all. */ /* if (!pk_require_auth(type) && !supress_confirmations()) { */ if (!supress_confirmations()) { - dialog = logout_dialog_new(type); + dialog = GTK_WIDGET(logout_dialog_new(type)); } if (dialog != NULL) { @@ -158,7 +158,7 @@ main (int argc, char * argv[]) gtk_widget_hide(dialog); if (response == GTK_RESPONSE_HELP) { - type = LOGOUT_DIALOG_RESTART; + type = LOGOUT_DIALOG_TYPE_RESTART; response = GTK_RESPONSE_OK; } |