aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-07-23 10:19:20 -0500
committerTed Gould <ted@canonical.com>2009-07-23 10:19:20 -0500
commitbf936e17c6ac25344055de4eab06afc8b3893cb2 (patch)
tree216599478e66984d74ba46610a74eaddaa735f9f /src
parent74da0353e9344e80e01464c74a75d0ce0a4ca0dd (diff)
downloadayatana-indicator-session-bf936e17c6ac25344055de4eab06afc8b3893cb2.tar.gz
ayatana-indicator-session-bf936e17c6ac25344055de4eab06afc8b3893cb2.tar.bz2
ayatana-indicator-session-bf936e17c6ac25344055de4eab06afc8b3893cb2.zip
Getting all the parameters working so that we can set the dialog type
Diffstat (limited to 'src')
-rw-r--r--src/gtk-dialog/gtk-logout-helper.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/gtk-dialog/gtk-logout-helper.c b/src/gtk-dialog/gtk-logout-helper.c
index 1564404..505ea16 100644
--- a/src/gtk-dialog/gtk-logout-helper.c
+++ b/src/gtk-dialog/gtk-logout-helper.c
@@ -6,16 +6,30 @@
static LogoutDialogAction type = LOGOUT_DIALOG_LOGOUT;
static gboolean
-option_cb (const gchar * arg, const gchar * value, gpointer data, GError * error)
+option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error)
{
- type = GPOINTER_TO_INT(data);
+ type = LOGOUT_DIALOG_LOGOUT;
+ return TRUE;
+}
+
+static gboolean
+option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error)
+{
+ type = LOGOUT_DIALOG_SHUTDOWN;
+ return TRUE;
+}
+
+static gboolean
+option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error)
+{
+ type = LOGOUT_DIALOG_RESTART;
return TRUE;
}
static GOptionEntry options[] = {
- {"logout", 'l', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_cb, "Log out of the current session", GINT_TO_POINTER(LOGOUT_DIALOG_LOGOUT)},
- {"shutdown", 's', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_cb, "Shutdown the entire system", GINT_TO_POINTER(LOGOUT_DIALOG_RESTART)},
- {"restart", 'r', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_cb, "Restart the system", GINT_TO_POINTER(LOGOUT_DIALOG_SHUTDOWN)},
+ {"logout", 'l', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_logout, "Log out of the current session", NULL},
+ {"shutdown", 's', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_shutdown, "Shutdown the entire system", NULL},
+ {"restart", 'r', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_restart, "Restart the system", NULL},
{NULL}
};
@@ -37,7 +51,7 @@ main (int argc, char * argv[])
return 1;
}
- GtkWidget * dialog = logout_dialog_new(LOGOUT_DIALOG_LOGOUT);
+ GtkWidget * dialog = logout_dialog_new(type);
gtk_dialog_run(GTK_DIALOG(dialog));
return 0;