Commit 9391b36d authored by Daniel Brötzmann's avatar Daniel Brötzmann

Add Org field

parent 96bb94cc
Pipeline #6789 failed with stages
in 3 minutes and 34 seconds
......@@ -83,7 +83,7 @@
'email': {'value': ''},
'impp': {'value': ''},
'tel': {'value': '', 'value_type': 'text'},
'org': {'value': ''},
'org': {'values': ['']},
'title': {'value': ''},
'role': {'value': ''},
'url': {'value': ''},
......@@ -165,7 +165,7 @@ def add_new_property(self, name):
kwargs = DEFAULT_KWARGS[name]
prop = self._vcard.add_property(name, **kwargs)
self.add_property(prop, editable=True)
GLib.idle_add(scroll_to_end, self.get_parent())
#GLib.idle_add(scroll_to_end, self.get_parent())
def add_property(self, prop, editable=False):
prop_class = self._callbacks.get(prop.name)
......@@ -205,7 +205,10 @@ def __init__(self, prop, account):
self.set_halign(Gtk.Align.START)
self.connect('activate-link', self._on_activate_link)
self.set_value(prop.value)
if prop.name == 'org':
self.set_value(prop.values[0])
else:
self.set_value(prop.value)
def set_value(self, value):
if self._prop.name == 'email':
......@@ -236,14 +239,17 @@ class ValueEntry(Gtk.Entry):
def __init__(self, prop):
Gtk.Entry.__init__(self)
self.set_max_width_chars(50)
self.set_text(prop.value)
if prop.name == 'org':
self.set_text(prop.values[0])
else:
self.set_text(prop.value)
class TypeComboBox(Gtk.ComboBoxText):
def __init__(self, parameters):
Gtk.ComboBoxText.__init__(self)
self._parameters = parameters
self.append('none', _('None'))
self.append('none', '-')
self.append('home', _('Home'))
self.append('work', _('Work'))
......@@ -371,7 +377,10 @@ def _get_icon_name(type_):
def _on_text_changed(self, entry, _param):
text = entry.get_text()
self._prop.value = text
if self._prop.name == 'org':
self._prop.values[0] = text
else:
self._prop.value = text
self._value_label.set_value(text)
def _on_type_changed(self, _combobox, _param):
......
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