[baobab/wip/vala: 28/46] First cut at action sensitivity.
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/wip/vala: 28/46] First cut at action sensitivity.
- Date: Sun, 11 Mar 2012 17:33:00 +0000 (UTC)
commit b9f59c2d997e20f76451c677377bf0562cc71a7c
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Jan 17 00:49:24 2012 +0100
First cut at action sensitivity.
data/baobab-main-window.ui | 6 +++---
src/baobab-window.vala | 26 +++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/data/baobab-main-window.ui b/data/baobab-main-window.ui
index a259707..681ee76 100644
--- a/data/baobab-main-window.ui
+++ b/data/baobab-main-window.ui
@@ -126,11 +126,11 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
- <property name="tooltip_markup" translatable="yes">Refresh</property>
- <property name="tooltip_text" translatable="yes">Refresh</property>
+ <property name="tooltip_markup" translatable="yes">Reload</property>
+ <property name="tooltip_text" translatable="yes">Reload</property>
<property name="use_action_appearance">False</property>
<property name="stock_id">gtk-refresh</property>
- <property name="action_name">win.refresh</property>
+ <property name="action_name">win.reload</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index b93a256..88fecc7 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -22,6 +22,23 @@ namespace Baobab {
{ "collapse-all", on_collapse_all }
};
+ protected struct ActionState {
+ string name;
+ bool enable;
+ }
+
+ private const ActionState[] actions_while_scanning = {
+ { "scan-home", false },
+ { "scan-filesystem", false },
+ { "scan-folder", false },
+ { "scan-remote", false },
+ { "stop", true },
+ { "reload", false },
+ { "show-allocated", false },
+ { "expand-all", false },
+ { "collapse-all", false }
+ };
+
private enum DndTargets {
URI_LIST
}
@@ -66,10 +83,12 @@ namespace Baobab {
drag_data_received.connect(on_drag_data_received);
enable_drop ();
- // Go live.
add (builder.get_object ("window-contents") as Gtk.Widget);
title = _("Disk Usage Analyzer");
set_default_size (800, 500);
+
+ set_busy (false);
+
show ();
}
@@ -194,6 +213,11 @@ namespace Baobab {
if (window != null) {
window.set_cursor (cursor);
}
+
+ foreach (ActionState action_state in actions_while_scanning) {
+ var action = lookup_action (action_state.name) as SimpleAction;
+ action.set_enabled (busy == action_state.enable);
+ }
}
public bool check_dir (File directory) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]