[gtk+/wip/csoriano/pathbar-prototype: 3/3] separators management and style fixed
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/csoriano/pathbar-prototype: 3/3] separators management and style fixed
- Date: Sun, 22 Nov 2015 01:40:42 +0000 (UTC)
commit edbda0e23dc9df8bd2c4de157433c32491a17120
Author: Carlos Soriano <csoriano gnome org>
Date: Sun Nov 22 02:39:34 2015 +0100
separators management and style fixed
gtk/gtkpathbar.c | 58 ++++++++++++++----------------
gtk/theme/Adwaita/_common.scss | 9 ++++-
gtk/theme/Adwaita/gtk-contained-dark.css | 17 +++++++--
gtk/theme/Adwaita/gtk-contained.css | 17 +++++++--
4 files changed, 62 insertions(+), 39 deletions(-)
---
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 4c5b065..5284bb0 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -239,9 +239,9 @@ create_path_chunk (GtkPathBar *self,
const gchar *path,
const gchar *label,
GIcon *icon,
- gboolean add_separator)
+ gboolean add_separator,
+ gboolean separator_after_button)
{
- GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
GtkWidget *button;
GtkWidget *separator;
GtkWidget *path_chunk;
@@ -249,9 +249,6 @@ create_path_chunk (GtkPathBar *self,
GtkWidget *image;
GtkStyleContext *style;
PathChunkData *path_chunk_data;
- GtkTextDirection direction;
-
- direction = gtk_widget_get_direction (GTK_WIDGET (self));
path_chunk = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
button = gtk_toggle_button_new ();
@@ -281,27 +278,19 @@ create_path_chunk (GtkPathBar *self,
g_signal_connect_swapped (button, "button-release-event",
G_CALLBACK (on_path_chunk_button_release_event), path_chunk);
- if (add_separator)
+
+ if (add_separator && !separator_after_button)
{
+ separator = gtk_label_new ("/");
+ gtk_widget_set_sensitive (separator, FALSE);
+ gtk_container_add (GTK_CONTAINER (path_chunk), separator);
}
-
- if (direction == GTK_TEXT_DIR_LTR || (direction == GTK_TEXT_DIR_RTL && priv->inverted))
+ gtk_container_add (GTK_CONTAINER (path_chunk), button);
+ if (add_separator && separator_after_button)
{
- gtk_container_add (GTK_CONTAINER (path_chunk), button);
- if (add_separator)
- {
- separator = gtk_label_new ("/");
- gtk_widget_set_sensitive (separator, FALSE);
- gtk_container_add (GTK_CONTAINER (path_chunk), separator);
- }
- } else {
- if (add_separator)
- {
- separator = gtk_label_new ("/");
- gtk_widget_set_sensitive (separator, FALSE);
- gtk_container_add (GTK_CONTAINER (path_chunk), separator);
- }
- gtk_container_add (GTK_CONTAINER (path_chunk), button);
+ separator = gtk_label_new ("/");
+ gtk_widget_set_sensitive (separator, FALSE);
+ gtk_container_add (GTK_CONTAINER (path_chunk), separator);
}
path_chunk_data = g_slice_new (PathChunkData);
@@ -450,7 +439,9 @@ update_path_bar (GtkPathBar *self)
GtkWidget *root_chunk;
gchar *unprefixed_path;
gchar *label;
+ GtkTextDirection direction;
+ direction = gtk_widget_get_direction (GTK_WIDGET (self));
get_path_bar_widgets (GTK_PATH_BAR (self), &path_bar, &overflow_button, &path_box, FALSE);
/* Make sure we dismiss all popovers */
@@ -463,7 +454,7 @@ update_path_bar (GtkPathBar *self)
{
label = get_display_name (self, priv->root_path);
root_chunk = create_path_chunk (self, priv->root_path, label,
- priv->root_icon, TRUE);
+ priv->root_icon, TRUE, TRUE);
g_free (label);
gtk_container_add (GTK_CONTAINER (path_box), root_chunk);
@@ -488,6 +479,7 @@ update_path_bar (GtkPathBar *self)
GString *current_path = NULL;
gchar **splitted_path;
gboolean add_separator;
+ gboolean separator_after_button;
gint length;
gint i;
@@ -501,12 +493,15 @@ update_path_bar (GtkPathBar *self)
/* We add a separator for all items except the last one, which will result
* in a pathbar in the form of "Home/Documents/Example".
- * However,if only one item is present, add a separator at the end since
+ * However, if only one item is present, add a separator at the end since
* is visually more pleasant. The result will be in the form of "Home/" */
- add_separator = length == 1 || i != length - 1;
+ add_separator = length == 1 || (i != length - 1 && priv->inverted) ||
+ (i != 0 && !priv->inverted);
+ separator_after_button = length == 1 || priv->inverted;
+
label = get_display_name (self, current_path->str);
path_chunk = create_path_chunk (self, current_path->str, splitted_path[i],
- NULL, add_separator);
+ NULL, add_separator, separator_after_button);
g_free (label);
gtk_container_add (GTK_CONTAINER (path_box), path_chunk);
}
@@ -517,7 +512,7 @@ update_path_bar (GtkPathBar *self)
}
else
{
- path_chunk = create_path_chunk (self, "/", "/", NULL, FALSE);
+ path_chunk = create_path_chunk (self, "/", "/", NULL, FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (path_box), path_chunk);
}
@@ -589,7 +584,7 @@ populate_overflow_popover (GtkPathBar *self)
for (l = overflow_children; l != NULL; l = l->next)
{
data = g_object_get_data (l->data, "data");
- path_chunk = create_path_chunk (self, data->path, data->label, data->icon, FALSE);
+ path_chunk = create_path_chunk (self, data->path, data->label, data->icon, FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (overflow_container), path_chunk);
}
@@ -934,7 +929,7 @@ gtk_path_bar_get_inverted (GtkPathBar *self)
priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
- return gtk_hiding_box_get_inverted (GTK_HIDING_BOX (priv->path_box_1));
+ return priv->inverted;
}
/**
@@ -957,8 +952,9 @@ gtk_path_bar_set_inverted (GtkPathBar *self,
priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
- if (gtk_hiding_box_get_inverted (GTK_HIDING_BOX (priv->path_box_1)) != inverted)
+ if (priv->inverted != inverted)
{
+ priv->inverted = inverted;
gtk_hiding_box_set_inverted (GTK_HIDING_BOX (priv->path_box_1), inverted);
gtk_hiding_box_set_inverted (GTK_HIDING_BOX (priv->path_box_2), inverted);
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index cece524..af49070 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -1250,7 +1250,7 @@ headerbar {
path-bar button.flat, .path-bar-overflow-popover button.flat {
background-image: none;
border-radius: 0px;
- border-top-color: transparent;
+ border-color: transparent;
border-width: 2px 0px 2px 0px;
box-shadow: 0px 0px 0px;
margin: 0px;
@@ -1259,12 +1259,17 @@ path-bar button.flat, .path-bar-overflow-popover button.flat {
&:checked {
opacity: 1;
- border-bottom-color: transparent;
}
&:hover {
border-bottom-color: mix($selected_bg_color, $selected_fg_color, 75%);
}
+
+ &:backdrop, &:backdrop:checked {
+ background-color: transparent;
+ border-color: transparent;
+ background-image: none;
+ }
}
/**************
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 8887145..9c1cc5f 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -1869,7 +1869,7 @@ path-bar .titlebar button.titlebutton,
.titlebar .path-bar-overflow-popover button.titlebutton {
background-image: none;
border-radius: 0px;
- border-top-color: transparent;
+ border-color: transparent;
border-width: 2px 0px 2px 0px;
box-shadow: 0px 0px 0px;
margin: 0px;
@@ -1880,14 +1880,25 @@ path-bar .titlebar button.titlebutton,
.titlebar path-bar button.titlebutton:checked, .path-bar-overflow-popover button.flat:checked,
.path-bar-overflow-popover button.sidebar-button:checked, .path-bar-overflow-popover headerbar
button.titlebutton:checked, headerbar .path-bar-overflow-popover button.titlebutton:checked,
.path-bar-overflow-popover .titlebar button.titlebutton:checked,
.titlebar .path-bar-overflow-popover button.titlebutton:checked {
- opacity: 1;
- border-bottom-color: transparent; }
+ opacity: 1; }
path-bar button.flat:hover, path-bar button.sidebar-button:hover, path-bar headerbar
button.titlebutton:hover, headerbar path-bar button.titlebutton:hover,
path-bar .titlebar button.titlebutton:hover,
.titlebar path-bar button.titlebutton:hover, .path-bar-overflow-popover button.flat:hover,
.path-bar-overflow-popover button.sidebar-button:hover, .path-bar-overflow-popover headerbar
button.titlebutton:hover, headerbar .path-bar-overflow-popover button.titlebutton:hover,
.path-bar-overflow-popover .titlebar button.titlebutton:hover,
.titlebar .path-bar-overflow-popover button.titlebutton:hover {
border-bottom-color: #5986b5; }
+ path-bar button.flat:backdrop, path-bar button.sidebar-button:backdrop, path-bar headerbar
button.titlebutton:backdrop, headerbar path-bar button.titlebutton:backdrop,
+ path-bar .titlebar button.titlebutton:backdrop,
+ .titlebar path-bar button.titlebutton:backdrop, path-bar button.flat:backdrop:checked, path-bar
button.sidebar-button:backdrop:checked, path-bar headerbar button.titlebutton:backdrop:checked, headerbar
path-bar button.titlebutton:backdrop:checked,
+ path-bar .titlebar button.titlebutton:backdrop:checked,
+ .titlebar path-bar button.titlebutton:backdrop:checked, .path-bar-overflow-popover button.flat:backdrop,
.path-bar-overflow-popover button.sidebar-button:backdrop, .path-bar-overflow-popover headerbar
button.titlebutton:backdrop, headerbar .path-bar-overflow-popover button.titlebutton:backdrop,
+ .path-bar-overflow-popover .titlebar button.titlebutton:backdrop,
+ .titlebar .path-bar-overflow-popover button.titlebutton:backdrop, .path-bar-overflow-popover
button.flat:backdrop:checked, .path-bar-overflow-popover button.sidebar-button:backdrop:checked,
.path-bar-overflow-popover headerbar button.titlebutton:backdrop:checked, headerbar
.path-bar-overflow-popover button.titlebutton:backdrop:checked,
+ .path-bar-overflow-popover .titlebar button.titlebutton:backdrop:checked,
+ .titlebar .path-bar-overflow-popover button.titlebutton:backdrop:checked {
+ background-color: transparent;
+ border-color: transparent;
+ background-image: none; }
/**************
* Tree Views *
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index 16a5062..13c3322 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -1869,7 +1869,7 @@ path-bar .titlebar button.titlebutton,
.titlebar .path-bar-overflow-popover button.titlebutton {
background-image: none;
border-radius: 0px;
- border-top-color: transparent;
+ border-color: transparent;
border-width: 2px 0px 2px 0px;
box-shadow: 0px 0px 0px;
margin: 0px;
@@ -1880,14 +1880,25 @@ path-bar .titlebar button.titlebutton,
.titlebar path-bar button.titlebutton:checked, .path-bar-overflow-popover button.flat:checked,
.path-bar-overflow-popover button.sidebar-button:checked, .path-bar-overflow-popover headerbar
button.titlebutton:checked, headerbar .path-bar-overflow-popover button.titlebutton:checked,
.path-bar-overflow-popover .titlebar button.titlebutton:checked,
.titlebar .path-bar-overflow-popover button.titlebutton:checked {
- opacity: 1;
- border-bottom-color: transparent; }
+ opacity: 1; }
path-bar button.flat:hover, path-bar button.sidebar-button:hover, path-bar headerbar
button.titlebutton:hover, headerbar path-bar button.titlebutton:hover,
path-bar .titlebar button.titlebutton:hover,
.titlebar path-bar button.titlebutton:hover, .path-bar-overflow-popover button.flat:hover,
.path-bar-overflow-popover button.sidebar-button:hover, .path-bar-overflow-popover headerbar
button.titlebutton:hover, headerbar .path-bar-overflow-popover button.titlebutton:hover,
.path-bar-overflow-popover .titlebar button.titlebutton:hover,
.titlebar .path-bar-overflow-popover button.titlebutton:hover {
border-bottom-color: #77ace3; }
+ path-bar button.flat:backdrop, path-bar button.sidebar-button:backdrop, path-bar headerbar
button.titlebutton:backdrop, headerbar path-bar button.titlebutton:backdrop,
+ path-bar .titlebar button.titlebutton:backdrop,
+ .titlebar path-bar button.titlebutton:backdrop, path-bar button.flat:backdrop:checked, path-bar
button.sidebar-button:backdrop:checked, path-bar headerbar button.titlebutton:backdrop:checked, headerbar
path-bar button.titlebutton:backdrop:checked,
+ path-bar .titlebar button.titlebutton:backdrop:checked,
+ .titlebar path-bar button.titlebutton:backdrop:checked, .path-bar-overflow-popover button.flat:backdrop,
.path-bar-overflow-popover button.sidebar-button:backdrop, .path-bar-overflow-popover headerbar
button.titlebutton:backdrop, headerbar .path-bar-overflow-popover button.titlebutton:backdrop,
+ .path-bar-overflow-popover .titlebar button.titlebutton:backdrop,
+ .titlebar .path-bar-overflow-popover button.titlebutton:backdrop, .path-bar-overflow-popover
button.flat:backdrop:checked, .path-bar-overflow-popover button.sidebar-button:backdrop:checked,
.path-bar-overflow-popover headerbar button.titlebutton:backdrop:checked, headerbar
.path-bar-overflow-popover button.titlebutton:backdrop:checked,
+ .path-bar-overflow-popover .titlebar button.titlebutton:backdrop:checked,
+ .titlebar .path-bar-overflow-popover button.titlebutton:backdrop:checked {
+ background-color: transparent;
+ border-color: transparent;
+ background-image: none; }
/**************
* Tree Views *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]