Skip to content

Commit

Permalink
Added UI for language settings. Fixes #301
Browse files Browse the repository at this point in the history
  • Loading branch information
kozec committed Aug 23, 2016
1 parent b96b248 commit 735804d
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scripts/syncthing-gtk-exe.py
Expand Up @@ -42,7 +42,7 @@
# Force dark theme if reqested
if config["force_dark_theme"]:
os.environ["GTK_THEME"] = "Adwaita:dark"
if config["language"]:
if config["language"] not in ("", "None", None):
os.environ["LANGUAGE"] = config["language"]


Expand Down
2 changes: 1 addition & 1 deletion syncthing-gtk.py
Expand Up @@ -19,7 +19,7 @@ def sigint(*a):
config = Configuration()
if config["force_dark_theme"]:
os.environ["GTK_THEME"] = "Adwaita:dark"
if config["language"]:
if config["language"] not in ("", "None", None):
os.environ["LANGUAGE"] = config["language"]

if IS_WINDOWS:
Expand Down
7 changes: 5 additions & 2 deletions syncthing_gtk/uisettingsdialog.py
Expand Up @@ -20,7 +20,7 @@
"vforce_dark_theme", "vdaemon_priority", "vfolder_as_path",
"vnotification_for_update", "vnotification_for_folder",
"vnotification_for_error", "vst_autoupdate", "vsyncthing_binary",
"vsyncthing_arguments", "vmax_cpus", "vicon_theme"
"vsyncthing_arguments", "vmax_cpus", "vicon_theme", "vlanguage"
]

# Values for filemanager integration. Key is ID of checkbox widget
Expand Down Expand Up @@ -50,7 +50,8 @@

class UISettingsDialog(EditorDialog):
SETTING_NEEDS_RESTART = [
"vuse_old_header", "vforce_dark_theme", "vicons_in_menu"
"vuse_old_header", "vforce_dark_theme", "vicons_in_menu",
"vicon_theme", "vlanguage"
]

def __init__(self, app):
Expand Down Expand Up @@ -92,6 +93,8 @@ def load_data(self):
self["rbOnExitAsk"].set_sensitive(False)
self["rbOnExitTerminate"].set_active(True)
self["vforce_dark_theme"].set_visible(True)
self["lbl_vlanguage"].set_visible(True)
self["vlanguage"].set_visible(True)
# Check for filemanager python bindings current state of plugins
status = []
for widget_id in FM_DATA:
Expand Down
91 changes: 86 additions & 5 deletions ui-settings.glade
Expand Up @@ -14,7 +14,7 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkListStore" id="lstIcon_theme">
<object class="GtkListStore" id="lst_vicon_theme">
<columns>
<!-- column-name key -->
<column type="gchararray"/>
Expand All @@ -36,6 +36,60 @@
</row>
</data>
</object>
<object class="GtkListStore" id="lst_vlanguage">
<columns>
<!-- column-name key -->
<column type="gchararray"/>
<!-- column-name text -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0"/>
<col id="1" translatable="yes">Default</col>
</row>
<row>
<col id="0">cs</col>
<col id="1">Česky</col>
</row>
<row>
<col id="0">de</col>
<col id="1">Deutsch</col>
</row>
<row>
<col id="0">en</col>
<col id="1">English</col>
</row>
<row>
<col id="0">es</col>
<col id="1">Español</col>
</row>
<row>
<col id="0">fr</col>
<col id="1">Français</col>
</row>
<row>
<col id="0">lt</col>
<col id="1">Latviešu</col>
</row>
<row>
<col id="0">ru</col>
<col id="1">Русский</col>
</row>
<row>
<col id="0">sk</col>
<col id="1">Slovenský</col>
</row>
<row>
<col id="0">vi</col>
<col id="1">tiếng việt</col>
</row>
<row>
<col id="0">zh</col>
<col id="1">中文</col>
</row>
</data>
</object>
<object class="GtkListStore" id="lststrPriority">
<columns>
<!-- column-name key -->
Expand Down Expand Up @@ -460,7 +514,7 @@
<property name="margin_left">20</property>
<property name="margin_top">10</property>
<property name="hexpand">True</property>
<property name="model">lstIcon_theme</property>
<property name="model">lst_vicon_theme</property>
<child>
<object class="GtkCellRendererText" id="crIconTheme"/>
<attributes>
Expand All @@ -478,7 +532,6 @@
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_top">10</property>
<property name="label" translatable="yes">Tray icon style</property>
<property name="xalign">0</property>
Expand All @@ -489,10 +542,38 @@
</packing>
</child>
<child>
<placeholder/>
<object class="GtkLabel" id="lbl_vlanguage">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="margin_top">5</property>
<property name="label" translatable="yes">Language</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">19</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkComboBox" id="vlanguage">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="margin_left">20</property>
<property name="margin_top">5</property>
<property name="hexpand">True</property>
<property name="model">lst_vlanguage</property>
<child>
<object class="GtkCellRendererText" id="crIconTheme1"/>
<attributes>
<attribute name="single-paragraph-mode">0</attribute>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">19</property>
</packing>
</child>
</object>
<packing>
Expand Down

0 comments on commit 735804d

Please sign in to comment.