[devhelp] add F9 and gear menu action to toggle side pane
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] add F9 and gear menu action to toggle side pane
- Date: Tue, 8 Jul 2014 14:36:21 +0000 (UTC)
commit 2ecfb8525243bfbd38649dc4bfa4049b6c209ade
Author: chrysn <chrysn fsfe org>
Date: Sun May 4 17:23:08 2014 +0200
add F9 and gear menu action to toggle side pane
https://bugzilla.gnome.org/show_bug.cgi?id=729512
src/dh-app.c | 1 +
src/dh-window.c | 15 +++++++++++++++
src/dh-window.ui | 5 +++++
3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-app.c b/src/dh-app.c
index 411a59d..7418dda 100644
--- a/src/dh-app.c
+++ b/src/dh-app.c
@@ -325,6 +325,7 @@ setup_accelerators (DhApp *self)
gtk_application_add_accelerator (GTK_APPLICATION (self), "<Primary>c", "win.copy",
NULL);
gtk_application_add_accelerator (GTK_APPLICATION (self), "<Primary>p", "win.print",
NULL);
gtk_application_add_accelerator (GTK_APPLICATION (self), "<Primary>t", "win.new-tab",
NULL);
+ gtk_application_add_accelerator (GTK_APPLICATION (self), "F9", "win.show-sidebar",
NULL);
gtk_application_add_accelerator (GTK_APPLICATION (self), "<Primary>w", "win.close",
NULL);
gtk_application_add_accelerator (GTK_APPLICATION (self), "F10", "win.gear-menu",
NULL);
gtk_application_add_accelerator (GTK_APPLICATION (self), "<Alt>Right", "win.go-forward",
NULL);
diff --git a/src/dh-window.c b/src/dh-window.c
index e1b075e..8bf9afe 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -315,6 +315,20 @@ window_update_zoom_actions_state (DhWindow *window)
}
static void
+show_sidebar_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ DhWindow *window = user_data;
+ DhWindowPrivate *priv = dh_window_get_instance_private (window);
+
+ gboolean visible = !gtk_widget_get_visible (priv->grid_sidebar);
+
+ g_simple_action_set_state (action, g_variant_new_boolean(visible));
+ gtk_widget_set_visible (priv->grid_sidebar, visible);
+}
+
+static void
zoom_in_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -453,6 +467,7 @@ static GActionEntry win_entries[] = {
{ "find-next", find_next_cb, NULL, NULL, NULL },
{ "find-previous", find_previous_cb, NULL, NULL, NULL },
/* view */
+ { "show-sidebar", NULL, NULL, "false", show_sidebar_cb },
{ "zoom-in", zoom_in_cb, NULL, NULL, NULL },
{ "zoom-out", zoom_out_cb, NULL, NULL, NULL },
{ "zoom-default", zoom_default_cb, NULL, NULL, NULL },
diff --git a/src/dh-window.ui b/src/dh-window.ui
index acd927a..74df827 100644
--- a/src/dh-window.ui
+++ b/src/dh-window.ui
@@ -85,6 +85,11 @@
</section>
<section>
<item>
+ <attribute name="label" translatable="yes">_Side pane</attribute>
+ <attribute name="action">win.show-sidebar</attribute>
+ <attribute name="stateful">true</attribute>
+ </item>
+ <item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]