Commit 2268fbe3 authored by segfault's avatar segfault
Browse files

Remove unused time zone related code and UI elements from Greeter (refs: #17058)

parent 7be09db0
......@@ -218,12 +218,6 @@ class FormatsSetting(RegionSetting):
greeter.localisationsettings.formats)
class TimezoneSetting(RegionSetting):
def __init__(self, greeter, builder):
super().__init__("tz", greeter, builder,
greeter.localisationsettings.timezone)
class AdditionalSetting(GreeterSetting):
def __init__(self, setting_id, greeter, builder):
super().__init__(setting_id)
......@@ -552,7 +546,6 @@ class GreeterSettingsCollection(object):
self.text = TextSetting(greeter, builder)
self.keyboard = KeyboardSetting(greeter, builder)
self.formats = FormatsSetting(greeter, builder)
self.timezone = TimezoneSetting(greeter, builder)
# Additional settings views
self.admin = AdminSetting(greeter, builder)
......@@ -794,7 +787,6 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
'listboxrow_macspoof',
'listboxrow_network',
'listboxrow_text',
'listboxrow_tz',
'toolbutton_settings_add',
])
......
......@@ -718,56 +718,6 @@ class LayoutSetting(RegionSetting):
settings.set_value('sources', GLib.Variant('a(ss)', [('xkb', layout)]))
class TimezoneSetting(RegionSetting):
def get_tree(self):
timezones = self.get_all()
treestore = Gtk.TreeStore(GObject.TYPE_STRING, # id
GObject.TYPE_STRING) # name
areas = self._timezone_split_area(timezones)
for area in sorted(areas.keys()):
locations = sorted(
areas[area],
key=lambda x: self._timezone_name(x).lower())
treeiter_area = treestore.append(parent=None)
# we fill the title with the 1st layout of the group
treestore.set(treeiter_area, 0, locations[0])
treestore.set(treeiter_area, 1, area)
if len(locations) > 1:
for location in locations:
treeiter_location = treestore.append(parent=treeiter_area)
treestore.set(treeiter_location, 0, location)
treestore.set(treeiter_location, 1,
self._timezone_name(location))
return treestore
def get_name(self):
return self._timezone_name(self.get_value())
def get_all(self):
"""Return a list of all timezones
"""
return pytz.common_timezones
def _timezone_name(self, timezone):
if '/' in timezone:
area, s, location = timezone.partition('/')
return location
else:
return timezone
def _timezone_split_area(self, timezones):
timezone_areas = {}
for timezone in timezones:
area, s, v = timezone.partition('/')
if area not in timezone_areas:
timezone_areas[area] = set([timezone])
else:
timezone_areas[area].add(timezone)
return timezone_areas
class LocalisationSettings(object):
"""Controller for localisation settings
......@@ -792,7 +742,6 @@ class LocalisationSettings(object):
self.text = TextSetting(self)
self.formats = FormatSetting(self)
self.layout = LayoutSetting(self)
self.timezone = TimezoneSetting(self)
def __del__(self):
if self.__actusermanager_loadedid:
......
......@@ -734,63 +734,6 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_tz">
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box_tz">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="image_tz">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">tails-timezone</property>
<property name="icon_size">3</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_tz_caption">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Time Zone</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">listboxrow_tz</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_tz_value">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">UTC</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
......@@ -1802,63 +1745,4 @@
</packing>
</child>
</object>
<object class="GtkListStore" id="liststore_tz">
<columns>
<!-- column-name id -->
<column type="gchararray"/>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkBox" id="box_tz_popover">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkSearchEntry" id="searchentry_tz">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow_tz">
<property name="width_request">400</property>
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview_tz">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">liststore_tz</property>
<property name="headers_visible">False</property>
<property name="activate_on_single_click">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection6"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment