From 4ba8eb6b088359ebb3df5d8fd0e6f4620346f4f1 Mon Sep 17 00:00:00 2001 From: kozec Date: Tue, 27 Jan 2015 21:50:31 +0100 Subject: [PATCH] Added option to use folder ID as box title --- syncthing_gtk/app.py | 5 ++-- syncthing_gtk/configuration.py | 1 + syncthing_gtk/uisettingsdialog.py | 10 ++++++-- ui-settings.glade | 40 +++++++++++++++++++++---------- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/syncthing_gtk/app.py b/syncthing_gtk/app.py index 17bca36d..6fcdccee 100644 --- a/syncthing_gtk/app.py +++ b/syncthing_gtk/app.py @@ -1142,13 +1142,14 @@ def show_folder(self, id, name, path, is_master, ignore_perms, rescan_interval, if IS_WINDOWS: if display_path.lower().replace("\\", "/").startswith(os.path.expanduser("~").lower()): display_path = "~%s" % display_path[len(os.path.expanduser("~")):] + title = display_path if self.config["folder_as_path"] else id if id in self.folders: # Reuse existing box box = self.folders[id] - box.set_title(display_path) + box.set_title(title) else: # Create new box - box = InfoBox(self, display_path, Gtk.Image.new_from_icon_name("drive-harddisk", Gtk.IconSize.LARGE_TOOLBAR)) + box = InfoBox(self, title, Gtk.Image.new_from_icon_name("drive-harddisk", Gtk.IconSize.LARGE_TOOLBAR)) # Add visible lines box.add_value("id", "version.png", _("Folder ID")) box.add_value("path", "folder.png", _("Path")) diff --git a/syncthing_gtk/configuration.py b/syncthing_gtk/configuration.py index 9e7ffbf3..65815a37 100644 --- a/syncthing_gtk/configuration.py +++ b/syncthing_gtk/configuration.py @@ -30,6 +30,7 @@ class _Configuration(object): "autokill_daemon" : (int, 2), # 0 - never kill, 1 - always kill, 2 - ask "syncthing_binary" : (str, "/usr/bin/syncthing"), "minimize_on_start" : (bool, False), + "folder_as_path" : (bool, True), "use_inotify" : (list, []), "use_old_header" : (bool, False), "icons_in_menu" : (bool, True), diff --git a/syncthing_gtk/uisettingsdialog.py b/syncthing_gtk/uisettingsdialog.py index d992caca..6f4659bc 100644 --- a/syncthing_gtk/uisettingsdialog.py +++ b/syncthing_gtk/uisettingsdialog.py @@ -17,8 +17,9 @@ VALUES = [ "vautostart_daemon", "vautokill_daemon", "vminimize_on_start", "vautostart", "vuse_old_header", "vicons_in_menu", - "vnotification_for_update", "vnotification_for_folder", - "vnotification_for_error", "vst_autoupdate", "vsyncthing_binary", + "vfolder_as_path", "vnotification_for_update", + "vnotification_for_folder", "vnotification_for_error", + "vst_autoupdate", "vsyncthing_binary", ] # Values for filemanager integration. Key is ID of checkbox widget @@ -211,6 +212,11 @@ def on_saved(self): self.app.notifications = Notifications(self.app, self.app.daemon) # Restart or cancel updatecheck self.app.check_for_upgrade() + # Update directory boxes to reflect change in 'folder_as_path' + for rid in self.app.folders: + box = self.app.folders[rid] + title = box["path"] if self.app.config["folder_as_path"] else rid + box.set_title(title) def library_exists(name): """ diff --git a/ui-settings.glade b/ui-settings.glade index b2f9d0a6..9ea64aba 100644 --- a/ui-settings.glade +++ b/ui-settings.glade @@ -90,7 +90,7 @@ 0 - 8 + 9 3 @@ -107,7 +107,7 @@ 1 - 9 + 10 2 @@ -124,7 +124,7 @@ 1 - 10 + 11 @@ -140,7 +140,7 @@ 1 - 11 + 12 @@ -153,7 +153,7 @@ 0 - 12 + 13 3 @@ -170,7 +170,7 @@ 1 - 13 + 14 @@ -186,7 +186,7 @@ 1 - 14 + 15 @@ -202,7 +202,7 @@ 1 - 15 + 16 @@ -232,7 +232,7 @@ 0 - 4 + 5 3 @@ -248,7 +248,7 @@ 1 - 5 + 6 @@ -263,7 +263,7 @@ 1 - 7 + 8 @@ -278,7 +278,7 @@ 1 - 6 + 7 @@ -329,6 +329,22 @@ 3 + + + Use paths as titles for directory boxes + True + True + False + True + 0 + True + + + 0 + 4 + 3 + +