[nautilus/path-bar-discoverability: 13/13] toolbar: Trying to improve path bar discoverability
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/path-bar-discoverability: 13/13] toolbar: Trying to improve path bar discoverability
- Date: Fri, 18 Jan 2019 11:10:59 +0000 (UTC)
commit dcea6561899bd6d8da183b0b6fbc7a893b2aa8ce
Author: Carlos Soriano <csoriano redhat com>
Date: Mon Jan 14 17:45:00 2019 +0100
toolbar: Trying to improve path bar discoverability
Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/734
src/nautilus-pathbar.c | 47 ++++-----
src/resources/css/Adwaita.css | 15 +--
src/resources/ui/nautilus-toolbar.ui | 198 +++++++++++++++++++++++++----------
3 files changed, 172 insertions(+), 88 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 2723ab62c..ef1ceebb9 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -110,7 +110,8 @@ struct _NautilusPathBar
G_DEFINE_TYPE (NautilusPathBar, nautilus_path_bar, GTK_TYPE_CONTAINER);
static void nautilus_path_bar_check_icon_theme (NautilusPathBar *self);
-static void nautilus_path_bar_update_button_appearance (ButtonData *button_data);
+static void nautilus_path_bar_update_button_appearance (ButtonData *button_data,
+ gboolean current_dir);
static void nautilus_path_bar_update_button_state (ButtonData *button_data,
gboolean current_dir);
static void nautilus_path_bar_update_path (NautilusPathBar *self,
@@ -994,7 +995,8 @@ reload_icons (NautilusPathBar *self)
button_data = BUTTON_DATA (list->data);
if (button_data->type != NORMAL_BUTTON || button_data->is_root)
{
- nautilus_path_bar_update_button_appearance (button_data);
+ nautilus_path_bar_update_button_appearance (button_data,
+ list->next == NULL);
}
}
}
@@ -1295,7 +1297,8 @@ get_gicon (ButtonData *button_data)
}
static void
-nautilus_path_bar_update_button_appearance (ButtonData *button_data)
+nautilus_path_bar_update_button_appearance (ButtonData *button_data,
+ gboolean current_dir)
{
const gchar *dir_name = get_dir_name (button_data);
GIcon *icon;
@@ -1331,8 +1334,11 @@ nautilus_path_bar_update_button_appearance (ButtonData *button_data)
else
{
gtk_widget_hide (GTK_WIDGET (button_data->image));
- gtk_style_context_remove_class (gtk_widget_get_style_context (button_data->button),
- "image-button");
+ if (!current_dir)
+ {
+ gtk_style_context_remove_class (gtk_widget_get_style_context (button_data->button),
+ "image-button");
+ }
}
}
@@ -1347,14 +1353,7 @@ nautilus_path_bar_update_button_state (ButtonData *button_data,
gtk_label_set_use_markup (GTK_LABEL (button_data->label), current_dir);
}
- nautilus_path_bar_update_button_appearance (button_data);
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button)) != current_dir)
- {
- button_data->ignore_changes = TRUE;
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_data->button), current_dir);
- button_data->ignore_changes = FALSE;
- }
+ nautilus_path_bar_update_button_appearance (button_data, current_dir);
}
static void
@@ -1425,6 +1424,7 @@ button_data_file_changed (NautilusFile *file,
NautilusPathBar *self;
gboolean renamed;
gboolean child;
+ gboolean current_dir;
ancestor = gtk_widget_get_ancestor (button_data->button, NAUTILUS_TYPE_PATH_BAR);
if (ancestor == NULL)
@@ -1542,7 +1542,8 @@ button_data_file_changed (NautilusFile *file,
g_free (display_name);
}
- nautilus_path_bar_update_button_appearance (button_data);
+ current_dir = g_file_equal (self->current_path, button_data->path);
+ nautilus_path_bar_update_button_appearance (button_data, current_dir);
}
static ButtonData *
@@ -1562,12 +1563,11 @@ make_button_data (NautilusPathBar *self,
button_data = g_new0 (ButtonData, 1);
setup_button_type (button_data, self, path);
- button_data->button = gtk_toggle_button_new ();
+ button_data->button = gtk_button_new ();
gtk_widget_set_focus_on_click (button_data->button, FALSE);
style_context = gtk_widget_get_style_context (button_data->button);
gtk_style_context_add_class (style_context, "text-button");
- gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_FLAT);
/* TODO update button type when xdg directories change */
button_data->image = gtk_image_new ();
@@ -1585,8 +1585,9 @@ make_button_data (NautilusPathBar *self,
{
button_data->label = gtk_label_new (NULL);
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- button_data->disclosure_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",
+ button_data->disclosure_arrow = gtk_image_new_from_icon_name ("view-more-symbolic",
GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_start (button_data->disclosure_arrow, 0);
button_data->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (button_data->container), button_data->button, FALSE, FALSE, 0);
@@ -1600,16 +1601,12 @@ make_button_data (NautilusPathBar *self,
/* Fall through */
default:
{
- GtkWidget *separator_label;
-
- separator_label = gtk_label_new (G_DIR_SEPARATOR_S);
- gtk_style_context_add_class (gtk_widget_get_style_context (separator_label), "dim-label");
button_data->label = gtk_label_new (NULL);
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- button_data->disclosure_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",
+ button_data->disclosure_arrow = gtk_image_new_from_icon_name ("view-more-symbolic",
GTK_ICON_SIZE_MENU);
- button_data->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (button_data->container), separator_label, FALSE, FALSE, 0);
+ gtk_widget_set_margin_start (button_data->disclosure_arrow, 0);
+ button_data->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (button_data->container), button_data->button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
@@ -1623,6 +1620,8 @@ make_button_data (NautilusPathBar *self,
{
gtk_widget_show (button_data->disclosure_arrow);
gtk_popover_set_relative_to (self->current_view_menu_popover, button_data->button);
+ gtk_style_context_add_class (gtk_widget_get_style_context (button_data->button),
+ "image-button");
}
if (button_data->label != NULL)
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index 1dc10768b..de9c81d11 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -45,29 +45,22 @@
/* Path bar */
.nautilus-path-bar button { /* undecorate the buttons */
- background-image: none;
border-radius: 0;
- border-width: 0px;
+ border-width: 0px 1px 0px 0px;
margin: 0px;
}
.nautilus-path-bar button:not(:checked) image { opacity: 0.8; } /* dim the icon when not checked */
-.nautilus-path-bar button:not(:backdrop):hover { box-shadow: inset 0 -3px @borders; }
-
-.nautilus-path-bar button:drop(active) { box-shadow: inset 0 -3px; }
-
.path-bar-box {
- transition: border 200ms;
- transition: background-color 200ms;
+ border: 1px @borders solid;
+ border-radius: 3px;
+ background-color: @theme_bg_color;
}
.path-bar-box.width-maximized {
border: 1px @borders solid;
border-radius: 3px;
}
-.path-bar-box.width-maximized:not(:backdrop) {
- background-color: @theme_bg_color;
-}
/* Make the tags fit into the box */
entry.search > * {
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index e5b8b4771..97c7e4376 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkPopoverMenu" id="app_menu">
@@ -13,6 +13,95 @@
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">6</property>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="action_name">view.new-folder</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">folder-new-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="action_name">view.paste</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-paste-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="action_name">win.bookmark-current-location</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">bookmark-new-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
@@ -24,7 +113,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -38,7 +127,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -49,7 +138,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -63,7 +152,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -74,7 +163,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -88,7 +177,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">7</property>
</packing>
</child>
<child>
@@ -102,7 +191,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">6</property>
+ <property name="position">8</property>
</packing>
</child>
<child>
@@ -116,7 +205,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">7</property>
+ <property name="position">9</property>
</packing>
</child>
<child>
@@ -130,9 +219,12 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">8</property>
+ <property name="position">10</property>
</packing>
</child>
+ <style>
+ <class name="linked"/>
+ </style>
</object>
<packing>
<property name="submenu">main</property>
@@ -276,28 +368,20 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
- <child>
- <object class="GtkBox" id="navigation_box">
+ <child type="title">
+ <object class="GtkBox" id="header_toolbar">
+ <property name="width_request">270</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkButton" id="back_button">
+ <object class="GtkBox" id="toolbar_switcher_container">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Go back</property>
- <property name="action_name">win.back</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkImage" id="back_icon">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">go-previous-symbolic</property>
- <property name="icon_size">1</property>
- </object>
+ <placeholder/>
</child>
- <style>
- <class name="image-button"/>
- </style>
</object>
<packing>
<property name="expand">False</property>
@@ -306,17 +390,17 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="forward_button">
+ <object class="GtkToggleButton" id="search_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Go forward</property>
- <property name="action_name">win.forward</property>
+ <property name="tooltip_text" translatable="yes">Search</property>
+ <property name="action_name">slot.search-visible</property>
<child>
- <object class="GtkImage" id="forward_icon">
+ <object class="GtkImage" id="search_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">go-next-symbolic</property>
+ <property name="icon_name">edit-find-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
@@ -327,29 +411,36 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
- <style>
- <class name="linked"/>
- <class name="raised"/>
- </style>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
</child>
- <child type="title">
- <object class="GtkBox" id="header_toolbar">
- <property name="width_request">270</property>
+ <child>
+ <object class="GtkBox" id="navigation_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkBox" id="toolbar_switcher_container">
+ <object class="GtkButton" id="back_button">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Go back</property>
+ <property name="action_name">win.back</property>
<child>
- <placeholder/>
+ <object class="GtkImage" id="back_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">go-previous-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
</child>
+ <style>
+ <class name="image-button"/>
+ </style>
</object>
<packing>
<property name="expand">False</property>
@@ -358,17 +449,17 @@
</packing>
</child>
<child>
- <object class="GtkToggleButton" id="search_button">
+ <object class="GtkButton" id="forward_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Search</property>
- <property name="action_name">slot.search-visible</property>
+ <property name="tooltip_text" translatable="yes">Go forward</property>
+ <property name="action_name">win.forward</property>
<child>
- <object class="GtkImage" id="search_icon">
+ <object class="GtkImage" id="forward_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">edit-find-symbolic</property>
+ <property name="icon_name">go-next-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
@@ -379,13 +470,14 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
+ <style>
+ <class name="linked"/>
+ <class name="raised"/>
+ </style>
</object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
</child>
<child>
<object class="GtkBox">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]