[nautilus/wip/antoniof/new-pathbar: 5/5] remove arrow




commit ef80087dad2c9e94356e1e099c71eedd70fbc887
Author: António Fernandes <antoniof gnome org>
Date:   Fri Nov 26 14:24:24 2021 +0000

    remove arrow

 src/nautilus-pathbar.c        | 45 +++++++++++++++----------------------------
 src/resources/css/Adwaita.css |  9 +++++++--
 2 files changed, 23 insertions(+), 31 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index ef2576845..249337825 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -72,7 +72,6 @@ typedef struct
     GtkWidget *image;
     GtkWidget *label;
     GtkWidget *separator;
-    GtkWidget *disclosure_arrow;
     GtkWidget *container;
 
     NautilusPathBar *path_bar;
@@ -217,6 +216,7 @@ static void
 nautilus_path_bar_init (NautilusPathBar *self)
 {
     GtkAdjustment *adjustment;
+    GtkWidget *menu_button;
     GtkBuilder *builder;
     g_autoptr (GError) error = NULL;
 
@@ -235,6 +235,12 @@ nautilus_path_bar_init (NautilusPathBar *self)
     gtk_widget_set_margin_end (self->buttons_box, 6);
     gtk_container_add (GTK_CONTAINER (self->scrolled), self->buttons_box);
 
+    menu_button = gtk_menu_button_new ();
+    gtk_container_add (GTK_CONTAINER (menu_button),
+                       gtk_image_new_from_icon_name ("view-more-symbolic",
+                                                     GTK_ICON_SIZE_MENU));
+    gtk_container_add (GTK_CONTAINER (self), menu_button);
+
     builder = gtk_builder_new ();
 
     /* Add context menu for pathbar buttons */
@@ -264,8 +270,13 @@ nautilus_path_bar_init (NautilusPathBar *self)
 
     g_object_unref (builder);
 
-    gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
+    gtk_menu_button_set_popover (GTK_MENU_BUTTON (menu_button),
+                                 GTK_WIDGET (self->current_view_menu_popover));
+
+    gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self->buttons_box)),
                                  "nautilus-path-bar");
+    gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
+                                 GTK_STYLE_CLASS_LINKED);
 
     /* Action group */
     self->action_group = G_ACTION_GROUP (g_simple_action_group_new ());
@@ -697,24 +708,9 @@ on_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
 
         case GDK_BUTTON_SECONDARY:
         {
-            if (g_file_equal (button_data->path, self->current_path))
-            {
-                /* Workaround to avoid leaking duplicated GtkStack pages each time the
-                 * templates menu is set. Unbinding the model is the only way to clear
-                 * all children. For that reason, we need to rebind the popover before
-                 * it is shown again.
-                 * See https://gitlab.gnome.org/GNOME/nautilus/-/issues/1705 */
-                gtk_popover_bind_model (self->current_view_menu_popover,
-                                        G_MENU_MODEL (self->current_view_menu),
-                                        NULL);
-                gtk_popover_popup (self->current_view_menu_popover);
-            }
-            else
-            {
-                gtk_popover_set_relative_to (self->button_menu_popover,
-                                             button_data->button);
-                pop_up_pathbar_context_menu (self, button_data->file);
-            }
+            gtk_popover_set_relative_to (self->button_menu_popover,
+                                         button_data->button);
+            pop_up_pathbar_context_menu (self, button_data->file);
         }
         break;
 
@@ -1084,15 +1080,12 @@ make_button_data (NautilusPathBar *self,
         case OTHER_LOCATIONS_BUTTON:
         {
             button_data->label = gtk_label_new (NULL);
-            button_data->disclosure_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",
-                                                                          GTK_ICON_SIZE_MENU);
             child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
             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->image, FALSE, FALSE, 0);
             gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
-            gtk_box_pack_start (GTK_BOX (child), button_data->disclosure_arrow, FALSE, FALSE, 0);
         }
         break;
 
@@ -1106,23 +1099,17 @@ make_button_data (NautilusPathBar *self,
             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",
-                                                                          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_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);
-            gtk_box_pack_start (GTK_BOX (child), button_data->disclosure_arrow, FALSE, FALSE, 0);
         }
         break;
     }
 
-    gtk_widget_set_no_show_all (button_data->disclosure_arrow, TRUE);
     if (current_dir)
     {
-        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), "current-dir");
     }
 
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index a81a0ea84..823a6c2ce 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -49,12 +49,17 @@
 
 /* Path bar */
 
-.path-bar-box {
-  border-radius: 5px;
+.path-bar-box scrolledwindow {
+  border-radius: 5px 0px 0px 5px;
   border: 1px @borders solid;
+  border-right-width: 0px;
   background-color: @theme_bg_color;
 }
 
+.path-bar-box button {
+  margin: 0px;
+}
+
 .nautilus-path-bar button { /* undecorate the buttons */
   background-image: none;
   box-shadow: none;


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