Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Fomin <fominde@gmail.com>2010-09-30 15:34:04 +0400
committerDenis Fomin <fominde@gmail.com>2010-09-30 15:34:04 +0400
commit884bc28407a0addb8a841d433488858ec5fccb8a (patch)
tree7c0677c22560ce15700290c1b154078c6f0fde34 /set_location
parent0e010f9b7d7d7ba7d4e1f611b6f79a90d98e68d1 (diff)
set_location. delete preset button added
Diffstat (limited to 'set_location')
-rw-r--r--set_location/config_dialog.ui37
-rw-r--r--set_location/set_location.py18
2 files changed, 52 insertions, 3 deletions
diff --git a/set_location/config_dialog.ui b/set_location/config_dialog.ui
index 08d364e..fe08138 100644
--- a/set_location/config_dialog.ui
+++ b/set_location/config_dialog.ui
@@ -74,6 +74,43 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="del_preset">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_del_preset_clicked"/>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-delete</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Delete preset</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/set_location/set_location.py b/set_location/set_location.py
index 8adec88..baeea49 100644
--- a/set_location/set_location.py
+++ b/set_location/set_location.py
@@ -207,12 +207,12 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
continue
widget = self.xml.get_object(name)
preset[name] = widget.get_text()
- if preset_name not in self.plugin.config['presets'].keys():
- iter_ = self.preset_liststore.append((preset_name,))
- self.preset_combo.set_active_iter(iter_)
preset = {preset_name: preset}
presets = dict(self.plugin.config['presets'].items() + \
preset.items())
+ if preset_name not in self.plugin.config['presets'].keys():
+ iter_ = self.preset_liststore.append((preset_name,))
+ #self.preset_combo.set_active_iter(iter_)
self.plugin.config['presets'] = presets
self.set_modal(False)
InputDialog(_('Save as Preset'), _('Please type a name for this preset'),
@@ -222,8 +222,20 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
model = widget.get_model()
active = widget.get_active()
if active < 0:
+ self.xml.get_object('del_preset').set_sensitive(False)
return
pres_name = model[active][0].decode('utf-8')
for name in self.plugin.config['presets'][pres_name].keys():
widget = self.xml.get_object(name)
widget.set_text(str(self.plugin.config['presets'][pres_name][name]))
+
+ self.xml.get_object('del_preset').set_sensitive(True)
+
+ def on_del_preset_clicked(self, widget):
+ active = self.preset_combo.get_active()
+ active_iter = self.preset_combo.get_active_iter()
+ name = self.preset_liststore[active][0].decode('utf-8')
+ presets = self.plugin.config['presets']
+ del presets[name]
+ self.plugin.config['presets'] = presets
+ self.preset_liststore.remove(active_iter)