[Xfce4-commits] <thunar:master> Drop the separators in the toolbar.

Nick Schermer noreply at xfce.org
Wed Oct 24 21:40:01 CEST 2012


Updating branch refs/heads/master
         to 4247b3eb79d089bf601eeef7e088677b0aa2e58b (commit)
       from 08f9334a817f2e7eda16e434f76286ef0622b8b9 (commit)

commit 4247b3eb79d089bf601eeef7e088677b0aa2e58b
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Oct 24 21:37:43 2012 +0200

    Drop the separators in the toolbar.
    
    We go for compact here, people know what to click.
    
    Also support updating the history menu item for toolbar changes.

 thunar/thunar-history-action.c |   39 +++++++++++++++++++++++++++++++++------
 thunar/thunar-window-ui.xml    |    1 -
 thunar/thunar-window.c         |    7 +------
 3 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/thunar/thunar-history-action.c b/thunar/thunar-history-action.c
index 148b918..ae8faa7 100644
--- a/thunar/thunar-history-action.c
+++ b/thunar/thunar-history-action.c
@@ -217,6 +217,25 @@ thunar_history_action_activate (GtkWidget           *toggle_button,
 
 
 
+static void
+thunar_history_action_toolbar_configured (GtkWidget *tool_item,
+                                          GtkWidget *toggle_button)
+{
+  GtkWidget *icon;
+  GtkAction *action;
+
+  gtk_button_set_relief (GTK_BUTTON (toggle_button),
+      gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (tool_item)));
+
+  icon = gtk_bin_get_child (GTK_BIN (toggle_button));
+  action = g_object_get_data (G_OBJECT (toggle_button), I_("thunar-history-action"));
+  gtk_image_set_from_stock (GTK_IMAGE (icon),
+                            gtk_action_get_stock_id (action),
+                            gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (tool_item)));
+}
+
+
+
 static GtkWidget*
 thunar_history_action_create_tool_item (GtkAction *action)
 {
@@ -232,20 +251,28 @@ thunar_history_action_create_tool_item (GtkAction *action)
 
   button = gtk_toggle_button_new ();
   gtk_container_add (GTK_CONTAINER (tool_item), button);
-  gtk_button_set_relief (GTK_BUTTON (button), gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (tool_item)));
+  gtk_button_set_relief (GTK_BUTTON (button),
+      gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (tool_item)));
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_widget_show (button);
 
-  icon = gtk_image_new_from_stock (gtk_action_get_stock_id (action), gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (tool_item)));
+  icon = gtk_image_new_from_stock (gtk_action_get_stock_id (action),
+      gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (tool_item)));
   gtk_container_add (GTK_CONTAINER (button), icon);
   gtk_widget_show (icon);
 
   g_object_set_data (G_OBJECT (button), I_("thunar-history-action"), action);
 
-  g_signal_connect (G_OBJECT (button), "button-press-event", G_CALLBACK (thunar_history_action_button_press_event), tool_item);
-  g_signal_connect (G_OBJECT (button), "button-release-event", G_CALLBACK (thunar_history_action_button_release_event), tool_item);
-  g_signal_connect (G_OBJECT (button), "leave-notify-event", G_CALLBACK (thunar_history_action_leave_notify_event), action);
-  g_signal_connect (G_OBJECT (button), "activate", G_CALLBACK (thunar_history_action_activate), action);
+  g_signal_connect (G_OBJECT (tool_item), "toolbar-reconfigured",
+      G_CALLBACK (thunar_history_action_toolbar_configured), button);
+  g_signal_connect (G_OBJECT (button), "button-press-event",
+      G_CALLBACK (thunar_history_action_button_press_event), tool_item);
+  g_signal_connect (G_OBJECT (button), "button-release-event",
+      G_CALLBACK (thunar_history_action_button_release_event), tool_item);
+  g_signal_connect (G_OBJECT (button), "leave-notify-event",
+      G_CALLBACK (thunar_history_action_leave_notify_event), action);
+  g_signal_connect (G_OBJECT (button), "activate",
+      G_CALLBACK (thunar_history_action_activate), action);
 
   return tool_item;
 }
diff --git a/thunar/thunar-window-ui.xml b/thunar/thunar-window-ui.xml
index e37b493..46e7a04 100644
--- a/thunar/thunar-window-ui.xml
+++ b/thunar/thunar-window-ui.xml
@@ -114,7 +114,6 @@
     <toolitem action="back" />
     <toolitem action="forward" />
     <toolitem action="open-parent" />
-    <separator />
     <toolitem action="open-home" />
   </toolbar>
 </ui>
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 3e87a7f..e39ef7b 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1402,15 +1402,10 @@ thunar_window_install_location_bar (ThunarWindow *window,
         {
           /* setup the toolbar for the location bar */
           window->location_toolbar = gtk_ui_manager_get_widget (window->ui_manager, "/location-toolbar");
+          /*gtk_toolbar_set_icon_size (GTK_TOOLBAR (window->location_toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR);*/
           gtk_table_attach (GTK_TABLE (window->table), window->location_toolbar, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
           gtk_widget_show (window->location_toolbar);
 
-          /* add a separator before the location bar (destroyed with the location bar) */
-          item = gtk_separator_tool_item_new ();
-          g_signal_connect_object (G_OBJECT (window->location_bar), "destroy", G_CALLBACK (gtk_widget_destroy), item, G_CONNECT_SWAPPED);
-          gtk_toolbar_insert (GTK_TOOLBAR (window->location_toolbar), item, -1);
-          gtk_widget_show (GTK_WIDGET (item));
-
           /* add the location bar tool item (destroyed with the location bar) */
           item = gtk_tool_item_new ();
           gtk_tool_item_set_expand (item, TRUE);


More information about the Xfce4-commits mailing list