remember the size and position of roster window if user want so

This commit is contained in:
Yann Leboulanger 2004-10-13 21:46:10 +00:00
parent 1b7a501518
commit 15efcf97da
3 changed files with 550 additions and 463 deletions

View file

@ -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
@ -307,6 +313,10 @@ class preference_Window:
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']
self.chk_autopp.set_active(st)

View file

@ -19,6 +19,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="gtk_main_quit" last_modification_time="Wed, 24 Sep 2003 20:54:02 GMT"/>
<signal name="unrealize" handler="on_Gajim_unrealize" last_modification_time="Wed, 13 Oct 2004 21:42:08 GMT"/>
<child>
<widget class="GtkVBox" id="vbox1">
@ -3460,10 +3461,8 @@ on the server.</property>
<child>
<widget class="GtkButton" id="lookfeel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_lookfeel_button_clicked" last_modification_time="Sun, 15 Feb 2004 15:49:12 GMT"/>
<child>
@ -3517,10 +3516,8 @@ on the server.</property>
<child>
<widget class="GtkButton" id="events_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_events_button_clicked" last_modification_time="Sun, 15 Feb 2004 15:49:19 GMT"/>
<child>
@ -3574,10 +3571,8 @@ on the server.</property>
<child>
<widget class="GtkButton" id="presence_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_presence_button_clicked" last_modification_time="Sun, 15 Feb 2004 15:49:26 GMT"/>
<child>
@ -3650,8 +3645,7 @@ on the server.</property>
<widget class="GtkNotebook" id="preferences_notebook">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
@ -3661,154 +3655,15 @@ on the server.</property>
<widget class="GtkFixed" id="fixed3">
<property name="visible">True</property>
<child>
<widget class="GtkFrame" id="frame7">
<property name="width_request">142</property>
<property name="height_request">64</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkCombo" id="combo_iconstyle">
<property name="visible">True</property>
<property name="value_in_list">True</property>
<property name="allow_empty">False</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="entry2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="list2">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label69">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Icon Style&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="x">210</property>
<property name="y">0</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame13">
<property name="width_request">144</property>
<property name="height_request">88</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkVBox" id="vbox26">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="chk_trayicon">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Icon in systray</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label138">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Systray&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="x">208</property>
<property name="y">72</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame16">
<property name="width_request">352</property>
<property name="height_request">171</property>
<property name="height_request">185</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment28">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkTable" id="table16">
<property name="visible">True</property>
@ -3824,10 +3679,10 @@ on the server.</property>
<property name="label" translatable="yes">Text color</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
@ -3920,10 +3775,10 @@ on the server.</property>
<property name="label" translatable="yes">Text font</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
@ -3940,14 +3795,15 @@ on the server.</property>
<child>
<widget class="GtkLabel" id="label157">
<property name="width_request">101</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Background color</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
@ -3962,6 +3818,57 @@ on the server.</property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_account_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_group_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_user_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFontButton" id="fontbutton_account_text">
<property name="visible">True</property>
@ -3977,58 +3884,7 @@ on the server.</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_account_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_group_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_user_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
@ -4048,7 +3904,7 @@ on the server.</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
@ -4068,7 +3924,7 @@ on the server.</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
@ -4085,24 +3941,7 @@ on the server.</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_group_bg">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
@ -4119,11 +3958,26 @@ on the server.</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkColorButton" id="colorbutton_group_bg">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
</widget>
</child>
@ -4155,8 +4009,8 @@ on the server.</property>
<child>
<widget class="GtkFrame" id="frame8">
<property name="width_request">192</property>
<property name="height_request">160</property>
<property name="width_request">180</property>
<property name="height_request">165</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
@ -4249,7 +4103,10 @@ on the server.</property>
<child>
<widget class="GtkColorButton" id="colorbutton_in">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="use_alpha">False</property>
<property name="focus_on_click">True</property>
</widget>
@ -4323,6 +4180,182 @@ on the server.</property>
<property name="y">0</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame7">
<property name="width_request">145</property>
<property name="height_request">55</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkCombo" id="combo_iconstyle">
<property name="visible">True</property>
<property name="value_in_list">True</property>
<property name="allow_empty">False</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="entry2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="list2">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label69">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Icon Style&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="x">195</property>
<property name="y">0</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame13">
<property name="width_request">145</property>
<property name="height_request">45</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkVBox" id="vbox26">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="chk_trayicon">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Icon in systray</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label138">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Systray&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="x">195</property>
<property name="y">56</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame17">
<property name="width_request">145</property>
<property name="height_request">62</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkCheckButton" id="save_position_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Save Roster
position</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label162">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Position&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="x">195</property>
<property name="y">103</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
@ -8690,4 +8723,23 @@ when NOT online</property>
</child>
</widget>
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<placeholder/>
</child>
</widget>
</glade-interface>

View file

@ -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')