[epiphany] Hide new tab button and page menu button in application mode



commit b24bca1abe6500d966b5aa04a8ce881b3d9a9cdd
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Mon Jun 27 19:51:56 2016 +0300

    Hide new tab button and page menu button in application mode

 src/ephy-toolbar.c         |   12 ++++++++++++
 src/ephy-toolbar.h         |    4 ++--
 src/ephy-window.c          |   18 ++++++------------
 src/resources/gtk/menus.ui |    6 ------
 4 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 559087a..7eb1b4c 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -769,3 +769,15 @@ ephy_toolbar_get_page_menu (EphyToolbar *toolbar)
 {
   return toolbar->page_menu;
 }
+
+GtkWidget *
+ephy_toolbar_get_page_menu_button (EphyToolbar *toolbar)
+{
+  return toolbar->page_menu_button;
+}
+
+GtkWidget *
+ephy_toolbar_get_new_tab_button (EphyToolbar *toolbar)
+{
+  return toolbar->new_tab_button;
+}
diff --git a/src/ephy-toolbar.h b/src/ephy-toolbar.h
index bde62d6..6f3a235 100644
--- a/src/ephy-toolbar.h
+++ b/src/ephy-toolbar.h
@@ -33,10 +33,10 @@ G_DECLARE_FINAL_TYPE (EphyToolbar, ephy_toolbar, EPHY, TOOLBAR, GtkHeaderBar)
 GtkWidget *ephy_toolbar_new      (EphyWindow *window);
 
 GtkWidget *ephy_toolbar_get_location_entry (EphyToolbar *toolbar);
-
 EphyTitleBox *ephy_toolbar_get_title_box (EphyToolbar *toolbar);
-
 GMenu *ephy_toolbar_get_page_menu (EphyToolbar *toolbar);
+GtkWidget * ephy_toolbar_get_page_menu_button (EphyToolbar *toolbar);
+GtkWidget * ephy_toolbar_get_new_tab_button (EphyToolbar *toolbar);
 
 G_END_DECLS
 
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 0f0e270..5123362 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2914,8 +2914,6 @@ ephy_window_state_event (GtkWidget           *widget,
 static void
 ephy_window_finalize (GObject *object)
 {
-  EphyWindow *window = EPHY_WINDOW (object);
-
   G_OBJECT_CLASS (ephy_window_parent_class)->finalize (object);
 
   LOG ("EphyWindow finalised %p", object);
@@ -3088,6 +3086,7 @@ ephy_window_constructor (GType                  type,
 {
   GObject *object;
   EphyWindow *window;
+  EphyToolbar *toolbar;
   GtkSettings *settings;
   GtkAction *action;
   GAction *new_action;
@@ -3229,22 +3228,17 @@ ephy_window_constructor (GType                  type,
   if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION) {
     g_object_set (window->location_controller, "editable", FALSE, NULL);
 
-    /* We don't need to show the page menu in web application mode. */
-    action = gtk_action_group_get_action (toolbar_action_group, "PageMenu");
-    ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
-    gtk_action_set_visible (action, FALSE);
-
-    action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab");
-    ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
-                                          TRUE);
-    gtk_action_set_visible (action, FALSE);
+    /* We don't need to show the page menu and the new tab button in web
+     * application mode.
+     */
+    gtk_widget_set_visible (ephy_toolbar_get_page_menu_button (EPHY_TOOLBAR (window->toolbar)), FALSE);
+    gtk_widget_set_visible (ephy_toolbar_get_new_tab_button (EPHY_TOOLBAR (window->toolbar)), FALSE);
 
     action = gtk_action_group_get_action (window->popups_action_group, "ContextBookmarkPage");
     ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
     gtk_action_set_visible (action, FALSE);
 
     for (i = 0; i < G_N_ELEMENTS (disabled_actions_for_app_mode); i++) {
-      printf("Disabled\n");
       action = gtk_action_group_get_action (window->action_group,
                                             disabled_actions_for_app_mode[i]);
       ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
diff --git a/src/resources/gtk/menus.ui b/src/resources/gtk/menus.ui
index 559f88b..ac594c6 100644
--- a/src/resources/gtk/menus.ui
+++ b/src/resources/gtk/menus.ui
@@ -48,12 +48,6 @@
     </section>
     <section>
       <item>
-        <attribute name="label" translatable="yes">Select _All</attribute>
-        <attribute name="action">win.select-all</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
         <attribute name="label" translatable="yes">Zoom _In</attribute>
         <attribute name="action">win.zoom-in</attribute>
       </item>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]