[gtk+] bloatpad: add 'win.fullscreen' action
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] bloatpad: add 'win.fullscreen' action
- Date: Mon, 19 Dec 2011 17:57:09 +0000 (UTC)
commit 3076ba9c624c9c72ed719d59c1157cb4bdc1a528
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Nov 30 13:39:38 2011 -0500
bloatpad: add 'win.fullscreen' action
examples/bloatpad.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/examples/bloatpad.c b/examples/bloatpad.c
index 4ba807f..cdc4024 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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]