Skip to content

Commit

Permalink
Added option to use folder ID as box title
Browse files Browse the repository at this point in the history
  • Loading branch information
kozec committed Jan 27, 2015
1 parent 26b58ae commit 4ba8eb6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
5 changes: 3 additions & 2 deletions syncthing_gtk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions syncthing_gtk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
10 changes: 8 additions & 2 deletions syncthing_gtk/uisettingsdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down
40 changes: 28 additions & 12 deletions ui-settings.glade
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
<property name="top_attach">9</property>
<property name="width">3</property>
</packing>
</child>
Expand All @@ -107,7 +107,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">9</property>
<property name="top_attach">10</property>
<property name="width">2</property>
</packing>
</child>
Expand All @@ -124,7 +124,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">10</property>
<property name="top_attach">11</property>
</packing>
</child>
<child>
Expand All @@ -140,7 +140,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">11</property>
<property name="top_attach">12</property>
</packing>
</child>
<child>
Expand All @@ -153,7 +153,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">12</property>
<property name="top_attach">13</property>
<property name="width">3</property>
</packing>
</child>
Expand All @@ -170,7 +170,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">13</property>
<property name="top_attach">14</property>
</packing>
</child>
<child>
Expand All @@ -186,7 +186,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">14</property>
<property name="top_attach">15</property>
</packing>
</child>
<child>
Expand All @@ -202,7 +202,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">15</property>
<property name="top_attach">16</property>
</packing>
</child>
<child>
Expand Down Expand Up @@ -232,7 +232,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="top_attach">5</property>
<property name="width">3</property>
</packing>
</child>
Expand All @@ -248,7 +248,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
Expand All @@ -263,7 +263,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
Expand All @@ -278,7 +278,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
Expand Down Expand Up @@ -329,6 +329,22 @@
<property name="width">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="vfolder_as_path">
<property name="label" translatable="yes">Use paths as titles for directory boxes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
Expand Down

0 comments on commit 4ba8eb6

Please sign in to comment.