[epiphany] ephy-toolbar: use normal GtkButtons for the toolbar



commit b12f9670bc776806b8325dc33b53b33e845816b4
Author: Xan Lopez <xan igalia com>
Date:   Mon Jan 16 18:11:51 2012 +0100

    ephy-toolbar: use normal GtkButtons for the toolbar
    
    It's harder to get the theming right with GtkToolButtons :/

 src/ephy-page-menu-action.c |    6 +++---
 src/ephy-toolbar.c          |   39 ++++++++++++++++++++++-----------------
 2 files changed, 25 insertions(+), 20 deletions(-)
---
diff --git a/src/ephy-page-menu-action.c b/src/ephy-page-menu-action.c
index 0a7c83d..2342512 100644
--- a/src/ephy-page-menu-action.c
+++ b/src/ephy-page-menu-action.c
@@ -28,7 +28,7 @@ menu_position_func (GtkMenu           *menu,
                     int               *x,
                     int               *y,
                     gboolean          *push_in,
-                    GtkToolButton     *button)
+                    GtkButton         *button)
 {
   GtkAllocation allocation;
   GtkWidget *widget = GTK_WIDGET (button);
@@ -71,10 +71,10 @@ ephy_page_menu_action_activate (GtkAction *action)
     menu = gtk_ui_manager_get_widget (manager, "/ui/PagePopup");
 
     list = gtk_action_get_proxies (action);
-    if (GTK_IS_TOOL_BUTTON (list->data))
+    if (GTK_IS_BUTTON (list->data))
         button = GTK_WIDGET (list->data);
 
-    g_return_if_fail (GTK_IS_TOOL_BUTTON (button));
+    g_return_if_fail (GTK_IS_BUTTON (button));
 
     event = gtk_get_current_event ();
     if (event && event->type == GDK_BUTTON_PRESS) {
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index d3d8c3f..bb707c1 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -72,20 +72,14 @@ ephy_toolbar_get_property (GObject *object,
   }
 }
 
-static gboolean
-create_menu_proxy_cb (GtkToolItem *item, gpointer user_data)
-{
-  return TRUE;
-}
-
 static void
 ephy_toolbar_constructed (GObject *object)
 {
   EphyToolbarPrivate *priv = EPHY_TOOLBAR (object)->priv;
   GtkActionGroup *action_group;
   GtkAction *action;
-  GtkToolItem *tool_button, *back_forward, *location_stop_reload;
-  GtkWidget *box, *location, *toolbar;
+  GtkToolItem *back_forward, *location_stop_reload, *tool_item;
+  GtkWidget *tool_button, *box, *location, *toolbar;
 
   G_OBJECT_CLASS (ephy_toolbar_parent_class)->constructed (object);
 
@@ -96,7 +90,10 @@ ephy_toolbar_constructed (GObject *object)
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
   /* Back */
-  tool_button = gtk_tool_button_new (NULL, NULL);
+  tool_button = gtk_button_new ();
+  /* FIXME: apparently we need an image inside the button for the action
+   * icon to appear. */
+  gtk_button_set_image (GTK_BUTTON (tool_button), gtk_image_new ());
   action_group = ephy_window_get_toolbar_action_group (priv->window);
   action = gtk_action_group_get_action (action_group, "NavigationBack");
   gtk_activatable_set_related_action (GTK_ACTIVATABLE (tool_button),
@@ -104,7 +101,10 @@ ephy_toolbar_constructed (GObject *object)
   gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (tool_button));
 
   /* Forward */
-  tool_button = gtk_tool_button_new (NULL, NULL);
+  tool_button = gtk_button_new ();
+  /* FIXME: apparently we need an image inside the button for the action
+   * icon to appear. */
+  gtk_button_set_image (GTK_BUTTON (tool_button), gtk_image_new ());
   action = gtk_action_group_get_action (action_group, "NavigationForward");
   gtk_activatable_set_related_action (GTK_ACTIVATABLE (tool_button),
                                       action);
@@ -131,7 +131,10 @@ ephy_toolbar_constructed (GObject *object)
                       TRUE, TRUE, 0);
 
   /* Reload/Stop */
-  tool_button = gtk_tool_button_new (NULL, NULL);
+  tool_button = gtk_button_new ();
+  /* FIXME: apparently we need an image inside the button for the action
+   * icon to appear. */
+  gtk_button_set_image (GTK_BUTTON (tool_button), gtk_image_new ());
   action = gtk_action_group_get_action (action_group, "ViewCombinedStopReload");
   gtk_activatable_set_related_action (GTK_ACTIVATABLE (tool_button),
                                       action);
@@ -148,15 +151,17 @@ ephy_toolbar_constructed (GObject *object)
   gtk_widget_show_all (GTK_WIDGET (location_stop_reload));
 
   /* Page Menu */
-  tool_button = gtk_tool_button_new (NULL, NULL);
+  tool_item = gtk_tool_item_new ();
+  tool_button = gtk_button_new ();
+  /* FIXME: apparently we need an image inside the button for the action
+   * icon to appear. */
+  gtk_button_set_image (GTK_BUTTON (tool_button), gtk_image_new ());
   action = gtk_action_group_get_action (action_group, "PageMenu");
   gtk_activatable_set_related_action (GTK_ACTIVATABLE (tool_button),
                                       action);
-  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_button));
-  /* FIXME: why is this needed?! GTK+ wants to create an overflow menu
-   * for this, no idea why. Connect to the signal to cancel it. */
-  g_signal_connect (tool_button, "create-menu-proxy",
-                    G_CALLBACK (create_menu_proxy_cb), NULL);
+  gtk_container_add (GTK_CONTAINER (tool_item), tool_button);
+  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
+  gtk_widget_show_all (GTK_WIDGET (tool_item));
 }
 
 static void



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