From 15efcf97da54052d38d4d00f057022bf1722e4f5 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 13 Oct 2004 21:46:10 +0000 Subject: [PATCH] remember the size and position of roster window if user want so --- plugins/gtkgui/config.py | 10 + plugins/gtkgui/gtkgui.glade | 976 +++++++++++++++++++----------------- plugins/gtkgui/gtkgui.py | 27 +- 3 files changed, 550 insertions(+), 463 deletions(-) diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py index 122b701e7..6a44871d9 100644 --- a/plugins/gtkgui/config.py +++ b/plugins/gtkgui/config.py @@ -205,6 +205,12 @@ class preference_Window: ist = self.combo_iconstyle.entry.get_text() self.plugin.config['iconstyle'] = ist self.plugin.roster.mkpixbufs() + #save position + chk = self.xml.get_widget('save_position_checkbutton') + if chk.get_active(): + self.plugin.config['saveposition'] = 1 + else: + self.plugin.config['saveposition'] = 0 #autopopup if self.chk_autopp.get_active(): self.plugin.config['autopopup'] = 1 @@ -306,6 +312,10 @@ class preference_Window: self.combo_iconstyle.set_popdown_strings(l) if self.plugin.config['iconstyle'] in l: self.combo_iconstyle.entry.set_text(self.plugin.config['iconstyle']) + + #Save position + st = self.plugin.config['saveposition'] + self.xml.get_widget('save_position_checkbutton').set_active(st) #Autopopup st = self.plugin.config['autopopup'] diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 4e397e807..58d437d86 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -19,6 +19,7 @@ GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + @@ -3460,10 +3461,8 @@ on the server. True - True - True GTK_RELIEF_NONE - True + False @@ -3517,10 +3516,8 @@ on the server. True - True - True GTK_RELIEF_NONE - True + False @@ -3574,10 +3571,8 @@ on the server. True - True - True GTK_RELIEF_NONE - True + False @@ -3650,8 +3645,7 @@ on the server. 10 True - True - True + False False GTK_POS_TOP False @@ -3661,469 +3655,329 @@ on the server. True - - - 142 - 64 - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - True - True - False - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - - - - True - <b>Icon Style</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - label_item - - - - - 210 - 0 - - - - - - 144 - 88 - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - True - False - 0 - - - - True - True - Icon in systray - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - - - True - <b>Systray</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - label_item - - - - - 208 - 72 - - - 352 - 171 + 185 True 0 0.5 GTK_SHADOW_ETCHED_IN - + True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 + 4 + 4 + False + 5 + 5 - + True - 4 - 4 - False - 5 - 5 - - - - True - Text color - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 1 - 2 - 0 - 1 - fill - - - - - - - True - Account - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - Group - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - User - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - Text font - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 2 - 3 - 0 - 1 - fill - - - - - - - True - Background color - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - - - 3 - 4 - 0 - 1 - fill - - - - - - - True - True - True - True - False - False - True - - - 2 - 3 - 1 - 2 - fill - - - - - - - True - True - False - True - - - 1 - 2 - 1 - 2 - fill - - - - - - - True - True - False - True - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - True - False - True - - - 1 - 2 - 3 - 4 - fill - - - - - - - True - True - True - True - False - False - True - - - 2 - 3 - 2 - 3 - fill - - - - - - - True - True - True - True - False - False - True - - - 2 - 3 - 3 - 4 - fill - - - - - - - True - True - False - True - - - 3 - 4 - 1 - 2 - fill - - - - - - - True - True - False - True - - - 3 - 4 - 2 - 3 - fill - - - - - - - True - True - False - True - - - 3 - 4 - 3 - 4 - fill - - - + Text color + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + fill + + + + + + + True + Account + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Group + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + User + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + Text font + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 2 + 3 + 0 + 1 + fill + + + + + + + 101 + True + Background color + False + False + GTK_JUSTIFY_CENTER + True + False + 0.5 + 0.5 + 0 + 0 + + + 3 + 4 + 0 + 1 + fill + + + + + + + True + True + False + True + + + 1 + 2 + 1 + 2 + + + + + + + + True + True + False + True + + + 1 + 2 + 2 + 3 + + + + + + + + True + True + False + True + + + 1 + 2 + 3 + 4 + + + + + + + + True + True + True + True + False + False + True + + + 2 + 3 + 1 + 2 + + + + + + + + True + True + True + True + False + False + True + + + 2 + 3 + 2 + 3 + + + + + + + + True + True + True + True + False + False + True + + + 2 + 3 + 3 + 4 + + + + + + + + True + True + False + True + + + 3 + 4 + 1 + 2 + + + + + + + + True + True + False + True + + + 3 + 4 + 3 + 4 + + + + + + + + True + True + False + True + + + 3 + 4 + 2 + 3 + + + @@ -4155,8 +4009,8 @@ on the server. - 192 - 160 + 180 + 165 True 0 0.5 @@ -4249,7 +4103,10 @@ on the server. True + True + True True + True False True @@ -4323,6 +4180,182 @@ on the server. 0 + + + + 145 + 55 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + True + False + False + True + False + + + + True + True + True + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + + + + + True + <b>Icon Style</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 195 + 0 + + + + + + 145 + 45 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + False + 0 + + + + True + True + Icon in systray + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + + + True + <b>Systray</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 195 + 56 + + + + + + 145 + 62 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + True + Save Roster +position + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + + True + <b>Position</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 195 + 103 + + False @@ -8690,4 +8723,23 @@ when NOT online + + True + window1 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + + + + + + diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 91647ae5b..63053ba53 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -1776,11 +1776,30 @@ class roster_Window: context.finish(True, True, etime) return + def on_unrealize(self, widget, data=None): + if self.plugin.config.has_key('saveposition'): + if self.plugin.config['saveposition']: + self.plugin.config['x-position'], self.plugin.config['y-position']=\ + widget.get_position() + self.plugin.config['width'], self.plugin.config['height'] = \ + widget.get_size() + def __init__(self, plugin): # FIXME : handle no file ... self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Gajim', APP) self.tree = self.xml.get_widget('treeview') self.plugin = plugin + window = self.xml.get_widget('Gajim') + if self.plugin.config.has_key('saveposition'): + if self.plugin.config['saveposition']: + if self.plugin.config.has_key('x-position') and \ + self.plugin.config.has_key('y-position'): + window.move(self.plugin.config['x-position'], \ + self.plugin.config['y-position']) + if self.plugin.config.has_key('width') and \ + self.plugin.config.has_key('height'): + window.resize(self.plugin.config['width'], \ + self.plugin.config['height']) self.groups = {} self.contacts = {} for a in self.plugin.accounts.keys(): @@ -1830,6 +1849,7 @@ class roster_Window: self.tree.connect("drag_data_get", self.drag_data_get_data) self.tree.connect("drag_data_received", self.drag_data_received_data) self.xml.signal_connect('gtk_main_quit', self.on_quit) + self.xml.signal_connect('on_Gajim_unrealize', self.on_unrealize) self.xml.signal_connect('on_preferences_activate', self.on_prefs) self.xml.signal_connect('on_accounts_activate', self.on_accounts) self.xml.signal_connect('on_show_offline_activate', self.on_show_off) @@ -2380,7 +2400,12 @@ class plugin: 'groupfont': 'Sans Italic 10',\ 'usertextcolor': '#000000',\ 'userbgcolor': '#ffffff',\ - 'userfont': 'Sans 10'})) + 'userfont': 'Sans 10',\ + 'saveposition': 0,\ + 'x-position': 0,\ + 'y-position': 0,\ + 'width': 150,\ + 'height': 400})) self.config = self.wait('CONFIG') self.send('ASK_CONFIG', None, ('GtkGui', 'accounts')) self.accounts = self.wait('CONFIG')