[baobab] Hide Scan Remote if needed
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Hide Scan Remote if needed
- Date: Sat, 4 Aug 2012 10:49:29 +0000 (UTC)
commit 33dd963ec88a581b1a222eafe76c4f7496116dfa
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Aug 4 12:45:41 2012 +0200
Hide Scan Remote if needed
Hide the "scan remote" button if nautilus-connect-server is not
available
src/baobab-connect-server.vala | 6 +++++-
src/baobab-window.vala | 4 ++++
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/baobab-connect-server.vala b/src/baobab-connect-server.vala
index e69c3b3..aea5e6d 100644
--- a/src/baobab-connect-server.vala
+++ b/src/baobab-connect-server.vala
@@ -21,7 +21,7 @@
namespace Baobab {
class ConnectServer : Object {
- string[] argv = {
+ const string[] argv = {
"nautilus-connect-server",
"--print-uri"
};
@@ -78,5 +78,9 @@ namespace Baobab {
ChildWatch.add (pid, on_child_watch);
}
+
+ public static bool available () {
+ return (GLib.Environment.find_program_in_path (argv[0]) != null);
+ }
}
}
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 6a4538f..cc06946 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -26,6 +26,7 @@ namespace Baobab {
Settings ui_settings;
Gtk.Notebook main_notebook;
Gtk.Toolbar toolbar;
+ Gtk.Button scan_remote;
Gtk.ToolItem toolbar_home_toolitem;
Gtk.ToolButton toolbar_show_home_page;
Gtk.Label toolbar_label;
@@ -117,6 +118,7 @@ namespace Baobab {
// Cache some objects from the builder.
main_notebook = builder.get_object ("main-notebook") as Gtk.Notebook;
toolbar = builder.get_object ("toolbar") as Gtk.Toolbar;
+ scan_remote = builder.get_object ("scan-remote-button") as Gtk.Button;
toolbar_home_toolitem = builder.get_object ("home-page-toolitem") as Gtk.ToolItem;
toolbar_show_home_page = builder.get_object ("show-home-page-button") as Gtk.ToolButton;
toolbar_label = builder.get_object ("toolbar-label") as Gtk.Label;
@@ -136,6 +138,8 @@ namespace Baobab {
location_list.set_action (on_scan_location_activate);
location_list.update ();
+ scan_remote.visible = ConnectServer.available ();
+
setup_treeview (builder);
var infobar_close_button = builder.get_object ("infobar-close-button") as Gtk.Button;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]