advanced config allow opening only once, cleanup in filter [still does not work], cleanup in glade for advanced config window
This commit is contained in:
parent
af256c0abd
commit
44d8b641b1
|
@ -3,6 +3,7 @@
|
||||||
## Gajim Team:
|
## Gajim Team:
|
||||||
## - Yann Le Boulanger <asterix@lagaule.org>
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
||||||
## - Vincent Hanquez <tab@snarc.org>
|
## - Vincent Hanquez <tab@snarc.org>
|
||||||
|
## - Nikos Kouremenos <kourem@gmail.com>
|
||||||
##
|
##
|
||||||
## Copyright (C) 2003-2005 Gajim Team
|
## Copyright (C) 2003-2005 Gajim Team
|
||||||
##
|
##
|
||||||
|
@ -34,18 +35,11 @@ class Advanced_window:
|
||||||
return
|
return
|
||||||
modelrow[1] = text
|
modelrow[1] = text
|
||||||
|
|
||||||
def on_close(self):
|
def on_advanced_window_destroy(self, widget):
|
||||||
window = self.xml.get_widget('advanced_window')
|
del self.plugin.windows['advanced_config']
|
||||||
window.destroy()
|
|
||||||
|
|
||||||
def on_advanced_window_delete_event(self, widget, data = None):
|
def on_advanced_close_button_clicked(self, widget):
|
||||||
self.on_close()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_advanced_window_destroy_event(self, widget, data = None):
|
|
||||||
self.on_close()
|
|
||||||
|
|
||||||
def on_advanced_close_button_clicked(self, widget, data = None):
|
|
||||||
self.on_close()
|
|
||||||
|
|
||||||
def find_iter(self, parent_iter, name):
|
def find_iter(self, parent_iter, name):
|
||||||
if not parent_iter:
|
if not parent_iter:
|
||||||
|
@ -67,25 +61,32 @@ class Advanced_window:
|
||||||
iter = iter2
|
iter = iter2
|
||||||
|
|
||||||
if not val:
|
if not val:
|
||||||
self.model.append(iter, [name, "", ""])
|
self.model.append(iter, [name, '', ''])
|
||||||
return
|
return
|
||||||
self.model.append(iter, [name, val[OPT_VAL], val[OPT_TYPE][0]])
|
self.model.append(iter, [name, val[OPT_VAL], val[OPT_TYPE][0]])
|
||||||
|
|
||||||
def visible_func(self, model, iter, str):
|
def visible_func(self, model, iter, str):
|
||||||
|
if str is None or str == '':
|
||||||
|
return True #show all
|
||||||
name = model.get_value(iter, 0)
|
name = model.get_value(iter, 0)
|
||||||
if str == None or str == "":
|
if name.find(str) != -1: #was found
|
||||||
return 1
|
print 'show', name
|
||||||
if name.find(str) == -1:
|
return True
|
||||||
return 1
|
return False
|
||||||
return 0
|
|
||||||
|
|
||||||
def filter(self, filterstr):
|
def on_advanced_entry_changed(self, widget):
|
||||||
modelfilter = self.model.filter_new()
|
print 'refilter starts'
|
||||||
modelfilter.set_visible_func(self.visible_func, filterstr)
|
#FIXME: maybe some gobject timeout is better
|
||||||
modelfilter.refilter()
|
text = widget.get_text()
|
||||||
|
self.filterstr = text
|
||||||
|
print self.filterstr
|
||||||
|
self.modelfilter.refilter() #FIXME: does not work!
|
||||||
|
|
||||||
|
def __init__(self, plugin):
|
||||||
|
self.plugin = plugin
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'advanced_window', None)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'advanced_window', None)
|
||||||
|
self.window = self.xml.get_widget('advanced_window')
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
|
|
||||||
treeview = self.xml.get_widget('advanced_treeview')
|
treeview = self.xml.get_widget('advanced_treeview')
|
||||||
|
@ -93,7 +94,6 @@ class Advanced_window:
|
||||||
gobject.TYPE_STRING,
|
gobject.TYPE_STRING,
|
||||||
gobject.TYPE_STRING)
|
gobject.TYPE_STRING)
|
||||||
self.model.set_sort_column_id(0, gtk.SORT_ASCENDING)
|
self.model.set_sort_column_id(0, gtk.SORT_ASCENDING)
|
||||||
treeview.set_model(self.model)
|
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = gtk.CellRendererText()
|
||||||
treeview.insert_column_with_attributes(-1, 'Preference Name',
|
treeview.insert_column_with_attributes(-1, 'Preference Name',
|
||||||
|
@ -102,9 +102,12 @@ class Advanced_window:
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = gtk.CellRendererText()
|
||||||
renderer_text.set_property('editable', 1)
|
renderer_text.set_property('editable', 1)
|
||||||
renderer_text.connect('edited', self.on_config_edited)
|
renderer_text.connect('edited', self.on_config_edited)
|
||||||
treeview.insert_column_with_attributes(-1, 'Value',
|
col = treeview.insert_column_with_attributes(-1, 'Value',
|
||||||
renderer_text, text = 1)
|
renderer_text, text = 1)
|
||||||
|
|
||||||
|
#col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
||||||
|
col.set_max_width(250)
|
||||||
|
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = gtk.CellRendererText()
|
||||||
treeview.insert_column_with_attributes(-1, 'Type',
|
treeview.insert_column_with_attributes(-1, 'Type',
|
||||||
renderer_text, text = 2)
|
renderer_text, text = 2)
|
||||||
|
@ -112,3 +115,10 @@ class Advanced_window:
|
||||||
# add data to model
|
# add data to model
|
||||||
gajim.config.foreach(self.fill, None)
|
gajim.config.foreach(self.fill, None)
|
||||||
|
|
||||||
|
self.modelfilter = self.model.filter_new()
|
||||||
|
self.filterstr = 'account'
|
||||||
|
self.modelfilter.set_visible_func(self.visible_func, self.filterstr)
|
||||||
|
treeview.set_model(self.modelfilter)
|
||||||
|
|
||||||
|
self.plugin.windows['advanced_config'] = self
|
||||||
|
self.window.show_all()
|
||||||
|
|
|
@ -512,7 +512,11 @@ class Preferences_window:
|
||||||
model.set_value(iter, 1, 1)
|
model.set_value(iter, 1, 1)
|
||||||
|
|
||||||
def on_open_advanced_editor_button_clicked(self, widget, data = None):
|
def on_open_advanced_editor_button_clicked(self, widget, data = None):
|
||||||
dialogs.Advanced_window()
|
if self.plugin.windows.has_key('advanced_config'):
|
||||||
|
self.plugin.windows['advanced_config'].window.present()
|
||||||
|
else:
|
||||||
|
self.plugin.windows['advanced_config'] = dialogs.Advanced_window(
|
||||||
|
self.plugin)
|
||||||
|
|
||||||
def __init__(self, plugin):
|
def __init__(self, plugin):
|
||||||
'''Initialize Preferences window'''
|
'''Initialize Preferences window'''
|
||||||
|
|
|
@ -809,7 +809,7 @@
|
||||||
<property name="text" translatable="yes"></property>
|
<property name="text" translatable="yes"></property>
|
||||||
<property name="has_frame">True</property>
|
<property name="has_frame">True</property>
|
||||||
<property name="invisible_char">*</property>
|
<property name="invisible_char">*</property>
|
||||||
<property name="activates_default">False</property>
|
<property name="activates_default">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
@ -900,7 +900,7 @@
|
||||||
<property name="text" translatable="yes"></property>
|
<property name="text" translatable="yes"></property>
|
||||||
<property name="has_frame">True</property>
|
<property name="has_frame">True</property>
|
||||||
<property name="invisible_char">*</property>
|
<property name="invisible_char">*</property>
|
||||||
<property name="activates_default">False</property>
|
<property name="activates_default">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
@ -2714,7 +2714,7 @@
|
||||||
<widget class="GtkWindow" id="preferences_window">
|
<widget class="GtkWindow" id="preferences_window">
|
||||||
<property name="border_width">4</property>
|
<property name="border_width">4</property>
|
||||||
<property name="width_request">470</property>
|
<property name="width_request">470</property>
|
||||||
<property name="height_request">415</property>
|
<property name="height_request">420</property>
|
||||||
<property name="title" translatable="yes">Preferences</property>
|
<property name="title" translatable="yes">Preferences</property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
|
@ -5518,7 +5518,7 @@ Custom</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
@ -5612,8 +5612,8 @@ Custom</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">True</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
@ -5629,18 +5629,18 @@ Custom</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="yalign">0.5</property>
|
||||||
<property name="xscale">0.230000004172</property>
|
<property name="xscale">1</property>
|
||||||
<property name="yscale">0</property>
|
<property name="yscale">0</property>
|
||||||
<property name="top_padding">0</property>
|
<property name="top_padding">0</property>
|
||||||
<property name="bottom_padding">0</property>
|
<property name="bottom_padding">0</property>
|
||||||
<property name="left_padding">12</property>
|
<property name="left_padding">12</property>
|
||||||
<property name="right_padding">0</property>
|
<property name="right_padding">335</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="open_advanced_editor_button">
|
<widget class="GtkButton" id="open_advanced_editor_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label" translatable="yes">Open</property>
|
<property name="label" translatable="yes">Open...</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
|
@ -5671,8 +5671,8 @@ Custom</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">True</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -10497,7 +10497,6 @@ send a chat message to</property>
|
||||||
<property name="border_width">4</property>
|
<property name="border_width">4</property>
|
||||||
<property name="width_request">600</property>
|
<property name="width_request">600</property>
|
||||||
<property name="height_request">480</property>
|
<property name="height_request">480</property>
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="title" translatable="yes">Advanced Configuration Editor</property>
|
<property name="title" translatable="yes">Advanced Configuration Editor</property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
|
@ -10509,8 +10508,7 @@ send a chat message to</property>
|
||||||
<property name="skip_pager_hint">False</property>
|
<property name="skip_pager_hint">False</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<signal name="delete_event" handler="on_advanced_window_delete_event" last_modification_time="Sat, 23 Apr 2005 23:46:31 GMT"/>
|
<signal name="destroy" handler="on_advanced_window_destroy" last_modification_time="Wed, 27 Apr 2005 11:52:39 GMT"/>
|
||||||
<signal name="destroy_event" handler="on_advanced_window_destroy_event" last_modification_time="Sat, 23 Apr 2005 23:46:44 GMT"/>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox70">
|
<widget class="GtkVBox" id="vbox70">
|
||||||
|
@ -10563,6 +10561,7 @@ send a chat message to</property>
|
||||||
<property name="has_frame">True</property>
|
<property name="has_frame">True</property>
|
||||||
<property name="invisible_char">*</property>
|
<property name="invisible_char">*</property>
|
||||||
<property name="activates_default">False</property>
|
<property name="activates_default">False</property>
|
||||||
|
<signal name="changed" handler="on_advanced_entry_changed" last_modification_time="Wed, 27 Apr 2005 11:58:56 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
@ -10587,7 +10586,7 @@ send a chat message to</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="headers_visible">True</property>
|
<property name="headers_visible">True</property>
|
||||||
<property name="rules_hint">False</property>
|
<property name="rules_hint">True</property>
|
||||||
<property name="reorderable">False</property>
|
<property name="reorderable">False</property>
|
||||||
<property name="enable_search">True</property>
|
<property name="enable_search">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Reference in New Issue