[gitg] Add selectable enabled property
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Add selectable enabled property
- Date: Fri, 7 Aug 2015 07:04:16 +0000 (UTC)
commit 52f39454eedff84d4aee9f473b82c78f0f8b2876
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Fri Aug 7 09:02:51 2015 +0200
Add selectable enabled property
gitg/gitg-dash-view.vala | 10 ++++++++++
gitg/gitg-window.vala | 8 ++++++++
gitg/history/gitg-history.vala | 5 +++++
libgitg-ext/gitg-ext-selectable.vala | 1 +
4 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gitg/gitg-dash-view.vala b/gitg/gitg-dash-view.vala
index 9ac3073..982bd0b 100644
--- a/gitg/gitg-dash-view.vala
+++ b/gitg/gitg-dash-view.vala
@@ -76,6 +76,16 @@ class DashView : Gtk.Grid, GitgExt.UIElement, GitgExt.Activity, GitgExt.Selectab
}
}
+ public bool has_repositories
+ {
+ get { return d_repository_list_box.get_children().length() != 0; }
+ }
+
+ public bool selectable_enabled
+ {
+ get { return has_repositories; }
+ }
+
public string display_name
{
owned get { return "Dash"; }
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 4e72758..3e098de 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -34,6 +34,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
private Gtk.Widget? d_select_actions;
private Binding? d_selectable_mode_binding;
+ private Binding? d_selectable_enabled_binding;
private GitgExt.SelectionMode d_selectable_mode;
private UIElements<GitgExt.Activity> d_activities;
@@ -538,6 +539,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
d_select_button.visible = (selectable != null);
d_selectable_mode_binding = null;
+ d_selectable_enabled_binding = null;
if (selectable != null)
{
@@ -545,6 +547,12 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
this,
"selectable-mode",
BindingFlags.DEFAULT);
+
+ d_selectable_enabled_binding = selectable.bind_property("selectable-enabled",
+ d_select_button,
+ "sensitive",
+ BindingFlags.DEFAULT |
+ BindingFlags.SYNC_CREATE);
}
else
{
diff --git a/gitg/history/gitg-history.vala b/gitg/history/gitg-history.vala
index a1141f3..5325951 100644
--- a/gitg/history/gitg-history.vala
+++ b/gitg/history/gitg-history.vala
@@ -802,6 +802,11 @@ namespace GitgHistory
get; set;
}
+ public bool selectable_enabled
+ {
+ get { return true; }
+ }
+
private void add_commit_action(Gee.LinkedList<GitgExt.CommitAction> actions,
GitgExt.CommitAction? action)
{
diff --git a/libgitg-ext/gitg-ext-selectable.vala b/libgitg-ext/gitg-ext-selectable.vala
index 54ed159..ad01206 100644
--- a/libgitg-ext/gitg-ext-selectable.vala
+++ b/libgitg-ext/gitg-ext-selectable.vala
@@ -35,6 +35,7 @@ public enum SelectionMode
public interface Selectable : Object, Activity
{
public abstract SelectionMode selectable_mode { get; set; }
+ public abstract bool selectable_enabled { get; }
public abstract Gtk.Widget? action_widget { owned get; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]