[nautilus] sidebarrow: Add eject-tooltip property



commit bc70f91a2b0c288e7d8197f14513cc72f6edd462
Author: Corey Berla <corey berla me>
Date:   Wed Apr 27 15:54:58 2022 -0700

    sidebarrow: Add eject-tooltip property
    
    The eject button tooltip is hardcoded as "Unmount" regardless of
    whether the action is to unmount or eject.  Create a property
    eject-tooltip allow for setting an accurate tooltip. Remove hardcoded
    value in nautilusgtksidebarrow.ui.

 src/gtk/nautilusgtksidebarrow.c  | 24 ++++++++++++++++++++++++
 src/gtk/nautilusgtksidebarrow.ui |  1 -
 2 files changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/src/gtk/nautilusgtksidebarrow.c b/src/gtk/nautilusgtksidebarrow.c
index 0b0d6103f..f5d502995 100644
--- a/src/gtk/nautilusgtksidebarrow.c
+++ b/src/gtk/nautilusgtksidebarrow.c
@@ -38,6 +38,7 @@ struct _NautilusGtkSidebarRow
   GtkWidget *end_icon_widget;
   char *label;
   char *tooltip;
+  char *eject_tooltip;
   GtkWidget *label_widget;
   gboolean ejectable;
   GtkWidget *eject_button;
@@ -64,6 +65,7 @@ enum
   PROP_END_ICON,
   PROP_LABEL,
   PROP_TOOLTIP,
+  PROP_EJECT_TOOLTIP,
   PROP_EJECTABLE,
   PROP_SIDEBAR,
   PROP_ORDER_INDEX,
@@ -155,6 +157,10 @@ nautilus_gtk_sidebar_row_get_property (GObject    *object,
       g_value_set_string (value, self->tooltip);
       break;
 
+    case PROP_EJECT_TOOLTIP:
+      g_value_set_string (value, self->eject_tooltip);
+      break;
+
     case PROP_EJECTABLE:
       g_value_set_boolean (value, self->ejectable);
       break;
@@ -260,6 +266,12 @@ nautilus_gtk_sidebar_row_set_property (GObject      *object,
       gtk_widget_set_tooltip_text (GTK_WIDGET (self), self->tooltip);
       break;
 
+    case PROP_EJECT_TOOLTIP:
+      g_free (self->eject_tooltip);
+      self->eject_tooltip = g_strdup (g_value_get_string (value));
+      gtk_widget_set_tooltip_text (GTK_WIDGET (self->eject_button), self->eject_tooltip);
+      break;
+
     case PROP_EJECTABLE:
       self->ejectable = g_value_get_boolean (value);
       if (self->ejectable)
@@ -332,6 +344,7 @@ nautilus_gtk_sidebar_row_set_property (GObject      *object,
             self->label = NULL;
             g_free (self->tooltip);
             self->tooltip = NULL;
+            self->eject_tooltip = NULL;
             gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
             self->ejectable = FALSE;
             self->section_type = NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS;
@@ -438,6 +451,8 @@ nautilus_gtk_sidebar_row_finalize (GObject *object)
   self->label = NULL;
   g_free (self->tooltip);
   self->tooltip = NULL;
+  g_free (self->eject_tooltip);
+  self->eject_tooltip = NULL;
   g_free (self->uri);
   self->uri = NULL;
   g_clear_object (&self->drive);
@@ -511,6 +526,14 @@ nautilus_gtk_sidebar_row_class_init (NautilusGtkSidebarRowClass *klass)
                          (G_PARAM_READWRITE |
                           G_PARAM_STATIC_STRINGS));
 
+  properties [PROP_EJECT_TOOLTIP] =
+    g_param_spec_string ("eject-tooltip",
+                         "Eject Tooltip",
+                         "Eject Tooltip",
+                         NULL,
+                         (G_PARAM_READWRITE |
+                          G_PARAM_STATIC_STRINGS));
+
   properties [PROP_EJECTABLE] =
     g_param_spec_boolean ("ejectable",
                           "Ejectable",
@@ -625,6 +648,7 @@ nautilus_gtk_sidebar_row_clone (NautilusGtkSidebarRow *self)
                       "end-icon", self->end_icon,
                       "label", self->label,
                       "tooltip", self->tooltip,
+                      "eject-tooltip", self->eject_tooltip,
                       "ejectable", self->ejectable,
                       "order-index", self->order_index,
                       "section-type", self->section_type,
diff --git a/src/gtk/nautilusgtksidebarrow.ui b/src/gtk/nautilusgtksidebarrow.ui
index 956ea63cb..95d91f900 100644
--- a/src/gtk/nautilusgtksidebarrow.ui
+++ b/src/gtk/nautilusgtksidebarrow.ui
@@ -47,7 +47,6 @@
                 <property name="valign">3</property>
                 <property name="margin-start">4px</property>
                 <property name="icon-name">media-eject-symbolic</property>
-                <property name="tooltip-text" translatable="1">Unmount</property>
                 <style>
                   <class name="sidebar-button"/>
                 </style>


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