Created
January 4, 2018 23:10
-
-
Save aplaice/5b2b75c410ee32ad57335466713b75e8 to your computer and use it in GitHub Desktop.
Patch to hide evince toolbar (and menubar) in Ubuntu 16.04 (evince 3.18)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- a/shell/ev-application.c 2018-01-02 23:00:00.502095551 +0100 | |
| +++ b/shell/ev-application.c 2018-01-03 23:15:00.713553169 +0100 | |
| @@ -1059,9 +1059,24 @@ | |
| } | |
| static void | |
| +app_toggle_toolbar_cb (GSimpleAction *action, | |
| + GVariant *parameter, | |
| + gpointer user_data) | |
| +{ | |
| + EvApplication *application = user_data; | |
| + EvWindow *window = EV_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (application))); | |
| + GActionMap *action_map = G_ACTION_MAP (window); | |
| + GAction *gaction = g_action_map_lookup_action (action_map, "toggle-toolbar"); | |
| + | |
| + g_action_activate (gaction, NULL); | |
| +} | |
| + | |
| + | |
| +static void | |
| ev_application_startup (GApplication *gapplication) | |
| { | |
| const GActionEntry app_menu_actions[] = { | |
| + { "toggle-toolbar", app_toggle_toolbar_cb, NULL, NULL, NULL }, | |
| { "new", app_new_cb, NULL, NULL, NULL }, | |
| { "help", app_help_cb, NULL, NULL, NULL }, | |
| { "about", app_about_cb, NULL, NULL, NULL } | |
| @@ -1095,6 +1110,7 @@ | |
| "win.caret-navigation", "F7", NULL, | |
| "win.zoom-in", "plus", "<Ctrl>plus", "KP_Add", "<Ctrl>KP_Add", "equal", "<Ctrl>equal", NULL, | |
| "win.zoom-out", "minus", "<Ctrl>minus", "KP_Subtract", "<Ctrl>KP_Subtract", NULL, | |
| + "win.toggle-toolbar", "<Ctrl>H", NULL, | |
| "win.show-side-pane", "F9", NULL, | |
| "win.fullscreen", "F11", NULL, | |
| "win.presentation", "F5", NULL, | |
| --- a/shell/ev-window.c 2018-01-02 23:00:00.502095551 +0100 | |
| +++ b/shell/ev-window.c 2018-01-02 23:14:36.995706943 +0100 | |
| @@ -4907,6 +4907,27 @@ | |
| } | |
| static void | |
| +ev_window_view_cmd_toggle_toolbar (GSimpleAction *action, | |
| + GVariant *state, | |
| + gpointer user_data) | |
| +{ | |
| + EvWindow *ev_window = user_data; | |
| + EvWindowPrivate *priv = ev_window->priv; | |
| + | |
| + gboolean toolbar; | |
| + gboolean presentation; | |
| + | |
| + presentation = EV_WINDOW_IS_PRESENTATION (ev_window); | |
| + | |
| + toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 || | |
| + (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && !presentation; | |
| + | |
| + update_chrome_flag (ev_window, EV_CHROME_TOOLBAR, !toolbar); | |
| + | |
| + set_widget_visibility (priv->toolbar, !toolbar); | |
| +} | |
| + | |
| +static void | |
| ev_window_view_cmd_toggle_sidebar (GSimpleAction *action, | |
| GVariant *state, | |
| gpointer user_data) | |
| @@ -5697,6 +5718,7 @@ | |
| { "continuous", NULL, NULL, "true", ev_window_cmd_continuous }, | |
| { "dual-page", NULL, NULL, "false", ev_window_cmd_dual }, | |
| { "dual-odd-left", NULL, NULL, "false", ev_window_cmd_dual_odd_pages_left }, | |
| + { "toggle-toolbar", NULL, NULL, "true", ev_window_view_cmd_toggle_toolbar }, | |
| { "show-side-pane", NULL, NULL, "false", ev_window_view_cmd_toggle_sidebar }, | |
| { "inverted-colors", NULL, NULL, "false", ev_window_cmd_view_inverted_colors }, | |
| { "fullscreen", NULL, NULL, "false", ev_window_cmd_view_fullscreen }, | |
| --- a/shell/evince-menus.ui 2018-01-02 23:00:00.502095551 +0100 | |
| +++ b/shell/evince-menus.ui 2018-01-03 23:16:02.969635772 +0100 | |
| @@ -21,6 +21,12 @@ | |
| <menu id="appmenu"> | |
| <section> | |
| <item> | |
| + <attribute name="label" translatable="yes">_Toggle toolbar</attribute> | |
| + <attribute name="action">app.toggle-toolbar</attribute> | |
| + <attribute name="accel"><Primary>H</attribute> | |
| + </item> | |
| + </section> <section> | |
| + <item> | |
| <attribute name="label" translatable="yes">_New Window</attribute> | |
| <attribute name="action">app.new</attribute> | |
| </item> | |
| @@ -41,6 +47,10 @@ | |
| <menu id="view-menu"> | |
| <section> | |
| <item> | |
| + <attribute name="label" translatable="yes">_Toolbar</attribute> | |
| + <attribute name="action">win.toggle-toolbar</attribute> | |
| + </item> | |
| + <item> | |
| <attribute name="label" translatable="yes">_Continuous</attribute> | |
| <attribute name="action">win.continuous</attribute> | |
| </item> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment