add a checkbutton in join groupchat dialog to decide if we want to bookmark the room. Fixes #5245

This commit is contained in:
Yann Leboulanger 2009-10-05 15:29:37 +02:00
parent 4723194bca
commit a6a9a647b2
2 changed files with 45 additions and 21 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Mon Oct 5 15:18:48 2009 -->
<glade-interface> <glade-interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkWindow" id="join_groupchat_window"> <widget class="GtkWindow" id="join_groupchat_window">
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes">Join Group Chat</property> <property name="title" translatable="yes">Join Group Chat</property>
<signal name="destroy" handler="on_join_groupchat_window_destroy"/>
<signal name="key_press_event" handler="on_join_groupchat_window_key_press_event"/> <signal name="key_press_event" handler="on_join_groupchat_window_key_press_event"/>
<signal name="destroy" handler="on_join_groupchat_window_destroy"/>
<child> <child>
<widget class="GtkVBox" id="vbox28"> <widget class="GtkVBox" id="vbox28">
<property name="visible">True</property> <property name="visible">True</property>
@ -14,7 +14,7 @@
<child> <child>
<widget class="GtkTable" id="table15"> <widget class="GtkTable" id="table15">
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">6</property> <property name="n_rows">7</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -132,17 +132,18 @@
</child> </child>
<child> <child>
<widget class="GtkCheckButton" id="auto_join_checkbutton"> <widget class="GtkCheckButton" id="auto_join_checkbutton">
<property name="label" translatable="yes">Join this room automatically when I connect</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="label" translatable="yes">Join this room automatically when I connect</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">5</property> <property name="top_attach">6</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -170,30 +171,43 @@
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkCheckButton" id="bookmark_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Bookmark this room</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_bookmark_checkbutton_toggled"/>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
</widget> </widget>
<packing>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkHButtonBox" id="hbuttonbox12"> <widget class="GtkHButtonBox" id="hbuttonbox12">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<property name="layout_style">end</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
<child> <child>
<widget class="GtkButton" id="cancel_button"> <widget class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</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="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">False</property> <property name="label">gtk-cancel</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_cancel_button_clicked"/> <signal name="clicked" handler="on_cancel_button_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -202,7 +216,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="has_default">True</property> <property name="has_default">True</property>
<property name="receives_default">False</property> <property name="response_id">0</property>
<signal name="clicked" handler="on_join_button_clicked"/> <signal name="clicked" handler="on_join_button_clicked"/>
<child> <child>
<widget class="GtkAlignment" id="alignment25"> <widget class="GtkAlignment" id="alignment25">
@ -221,7 +235,6 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>

View File

@ -1975,7 +1975,7 @@ class JoinGroupchatWindow:
self.xml.get_widget('join_button').set_sensitive(False) self.xml.get_widget('join_button').set_sensitive(False)
if account and not gajim.connections[account].private_storage_supported: if account and not gajim.connections[account].private_storage_supported:
self.xml.get_widget('auto_join_checkbutton').set_sensitive(False) self.xml.get_widget('bookmark_checkbutton').set_sensitive(False)
self.window.show_all() self.window.show_all()
@ -2015,6 +2015,13 @@ class JoinGroupchatWindow:
'''When Cancel button is clicked''' '''When Cancel button is clicked'''
self.window.destroy() self.window.destroy()
def on_bookmark_checkbutton_toggled(self, widget):
auto_join_checkbutton = self.xml.get_widget('auto_join_checkbutton')
if widget.get_active():
auto_join_checkbutton.set_sensitive(True)
else:
auto_join_checkbutton.set_sensitive(False)
def on_join_button_clicked(self, widget): def on_join_button_clicked(self, widget):
'''When Join button is clicked''' '''When Join button is clicked'''
if not self.account: if not self.account:
@ -2058,10 +2065,14 @@ class JoinGroupchatWindow:
gajim.config.set('recently_groupchat', gajim.config.set('recently_groupchat',
' '.join(self.recently_groupchat)) ' '.join(self.recently_groupchat))
if self.xml.get_widget('auto_join_checkbutton').get_active(): if self.xml.get_widget('bookmark_checkbutton').get_active():
if self.xml.get_widget('auto_join_checkbutton').get_active():
autojoin = '1'
else:
autojoin = '0'
# Add as bookmark, with autojoin and not minimized # Add as bookmark, with autojoin and not minimized
name = gajim.get_nick_from_jid(room_jid) name = gajim.get_nick_from_jid(room_jid)
gajim.interface.add_gc_bookmark(self.account, name, room_jid, '1', \ gajim.interface.add_gc_bookmark(self.account, name, room_jid, autojoin,
'0', password, nickname) '0', password, nickname)
if self.automatic: if self.automatic: