[gitg] Add selectable mode button tooltip



commit 78b3d44c4929b2df5cb7fde46c1d94a6de9a4b94
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Jun 5 11:08:57 2016 +0200

    Add selectable mode button tooltip
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765537

 gitg/gitg-dash-view.vala             |    5 +++++
 gitg/gitg-window.vala                |   13 ++++++++++++-
 libgitg-ext/gitg-ext-selectable.vala |    1 +
 3 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-dash-view.vala b/gitg/gitg-dash-view.vala
index a928958..cd60bc4 100644
--- a/gitg/gitg-dash-view.vala
+++ b/gitg/gitg-dash-view.vala
@@ -82,6 +82,11 @@ class DashView : Gtk.Grid, GitgExt.UIElement, GitgExt.Activity, GitgExt.Selectab
                }
        }
 
+       public string selectable_mode_tooltip
+       {
+               owned get { return _("Select and manage projects"); }
+       }
+
        public bool has_repositories
        {
                get { return d_repository_list_box.get_children().length() != 0; }
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 2165dae..67468be 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -701,13 +701,23 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
                }
 
                var selectable = (current as GitgExt.Selectable);
-               d_select_button.visible = (selectable != null);
 
                d_selectable_mode_binding = null;
                d_selectable_available_binding = null;
 
                if (selectable != null)
                {
+                       d_select_button.visible = true;
+
+                       var tooltip = selectable.selectable_mode_tooltip;
+
+                       if (tooltip == null)
+                       {
+                               tooltip = _("Select items");
+                       }
+
+                       d_select_button.tooltip_text = tooltip;
+
                        d_selectable_mode_binding = selectable.bind_property("selectable-mode",
                                                                             this,
                                                                             "selectable-mode",
@@ -721,6 +731,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
                }
                else
                {
+                       d_select_button.visible = false;
                        d_select_button.active = false;
                        d_select_button.sensitive = false;
                }
diff --git a/libgitg-ext/gitg-ext-selectable.vala b/libgitg-ext/gitg-ext-selectable.vala
index 14044e8..901de07 100644
--- a/libgitg-ext/gitg-ext-selectable.vala
+++ b/libgitg-ext/gitg-ext-selectable.vala
@@ -36,6 +36,7 @@ public interface Selectable : Object, Activity
 {
        public abstract SelectionMode selectable_mode { get; set; }
        public abstract bool selectable_available { get; }
+       public abstract string selectable_mode_tooltip { owned get; }
 
        public abstract Gtk.Widget? action_widget { owned get; }
 


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