summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-11-30 13:39:38 -0500
committerRyan Lortie <desrt@desrt.ca>2011-12-19 12:51:08 -0500
commit3076ba9c624c9c72ed719d59c1157cb4bdc1a528 (patch)
tree28f1f26115533d4fcfc2c1ae9e920860de9d6f64 /examples
parent906475860f36129f3a67f2287f7add2ea18d054b (diff)
downloadgtk+-3076ba9c624c9c72ed719d59c1157cb4bdc1a528.tar.gz
bloatpad: add 'win.fullscreen' action
Diffstat (limited to 'examples')
-rw-r--r--examples/bloatpad.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/examples/bloatpad.c b/examples/bloatpad.c
index 4ba807f437..cdc4024afa 100644
--- a/examples/bloatpad.c
+++ b/examples/bloatpad.c
@@ -21,8 +21,34 @@ show_about (GSimpleAction *action,
NULL);
}
+static void
+activate_toggle (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GVariant *state;
+
+ state = g_action_get_state (G_ACTION (action));
+ g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
+ g_object_unref (state);
+}
+
+static void
+change_fullscreen_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ if (g_variant_get_boolean (state))
+ gtk_window_fullscreen (user_data);
+ else
+ gtk_window_unfullscreen (user_data);
+
+ g_simple_action_set_state (action, state);
+}
+
static GActionEntry win_entries[] = {
- { "about", show_about }
+ { "about", show_about },
+ { "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state }
};
static void
@@ -191,6 +217,7 @@ get_menu (void)
menu = g_menu_new ();
g_menu_append (menu, "Help", "app.help");
g_menu_append (menu, "About Bloatpad", "win.about");
+ g_menu_append (menu, "Fullscreen", "win.fullscreen");
g_menu_append (menu, "Quit", "app.quit");
g_menu_append (menu, "Add", "app.add");