From b3725674054db165db58860cbf1276577e842d95 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Wed, 27 Apr 2005 15:16:40 +0000 Subject: [PATCH] redoing my cleanup. the print are now ALL commented. they were left just in case Vincent wanted to test easier. Gajim would run after my cleanup, and even advanced config would run. As yann has said in the past, svn is a place of DEVELOPMENT. Please Vincent just because of 3 prints that were not commented out IN ORDER TO HELP YOU if you went to hack, you should NOT revert all the fixes. Yann said this is strong I would say sth worse. -- edited by tab. this is not the place for laundry. --- src/advanced.py | 60 ++++++++++++++++++++++++++++-------------------- src/gtkgui.glade | 29 +++++++++++------------ 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/advanced.py b/src/advanced.py index 1d297b104..db9f8cf45 100644 --- a/src/advanced.py +++ b/src/advanced.py @@ -3,6 +3,7 @@ ## Gajim Team: ## - Yann Le Boulanger ## - Vincent Hanquez +## - Nikos Kouremenos ## ## Copyright (C) 2003-2005 Gajim Team ## @@ -34,18 +35,11 @@ class Advanced_window: return modelrow[1] = text - def on_close(self): - window = self.xml.get_widget('advanced_window') - window.destroy() - - def on_advanced_window_delete_event(self, widget, data = None): - self.on_close() + def on_advanced_window_destroy(self, widget): + del self.plugin.windows['advanced_config'] - 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 on_advanced_close_button_clicked(self, widget): + self.window.destroy() def find_iter(self, parent_iter, name): if not parent_iter: @@ -67,25 +61,32 @@ class Advanced_window: iter = iter2 if not val: - self.model.append(iter, [name, "", ""]) + self.model.append(iter, [name, '', '']) return self.model.append(iter, [name, val[OPT_VAL], val[OPT_TYPE][0]]) def visible_func(self, model, iter, str): + if str is None or str == '': + return True #show all name = model.get_value(iter, 0) - if str == None or str == "": - return 1 - if name.find(str) == -1: - return 1 - return 0 + if name.find(str) != -1: #was found + #print 'show', name + return True + return False - def filter(self, filterstr): - modelfilter = self.model.filter_new() - modelfilter.set_visible_func(self.visible_func, filterstr) - modelfilter.refilter() + def on_advanced_entry_changed(self, widget): + #print 'refilter starts' + #FIXME: maybe some gobject timeout is better + 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.window = self.xml.get_widget('advanced_window') self.xml.signal_autoconnect(self) treeview = self.xml.get_widget('advanced_treeview') @@ -93,7 +94,6 @@ class Advanced_window: gobject.TYPE_STRING, gobject.TYPE_STRING) self.model.set_sort_column_id(0, gtk.SORT_ASCENDING) - treeview.set_model(self.model) renderer_text = gtk.CellRendererText() treeview.insert_column_with_attributes(-1, 'Preference Name', @@ -102,8 +102,11 @@ class Advanced_window: renderer_text = gtk.CellRendererText() renderer_text.set_property('editable', 1) 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) + + #col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) + col.set_max_width(250) renderer_text = gtk.CellRendererText() treeview.insert_column_with_attributes(-1, 'Type', @@ -111,4 +114,11 @@ class Advanced_window: # add data to model 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() diff --git a/src/gtkgui.glade b/src/gtkgui.glade index 77959b870..42d6b5327 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -809,7 +809,7 @@ True * - False + True 1 @@ -900,7 +900,7 @@ True * - False + True 1 @@ -2714,7 +2714,7 @@ 4 470 - 415 + 420 Preferences GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE @@ -5518,7 +5518,7 @@ Custom 0 False - True + False @@ -5612,8 +5612,8 @@ Custom 0 - True - True + False + False @@ -5629,18 +5629,18 @@ Custom True 0.5 0.5 - 0.230000004172 + 1 0 0 0 12 - 0 + 335 True True - Open + Open... True GTK_RELIEF_NORMAL True @@ -5671,8 +5671,8 @@ Custom 0 - True - True + False + False @@ -10497,7 +10497,6 @@ send a chat message to 4 600 480 - True Advanced Configuration Editor GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE @@ -10509,8 +10508,7 @@ send a chat message to False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST - - + @@ -10563,6 +10561,7 @@ send a chat message to True * False + 1 @@ -10587,7 +10586,7 @@ send a chat message to True True True - False + True False True