[Timur]add an action button in subscription_request_window ti start a chat directly from there.

This commit is contained in:
Yann Leboulanger 2006-10-01 17:52:57 +00:00
parent bc4d4bc7e2
commit 6f48b3bcb8
3 changed files with 151 additions and 76 deletions

View File

@ -0,0 +1,39 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkMenu" id="subscription_request_popup_menu">
<child>
<widget class="GtkImageMenuItem" id="start_chat_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Start Chat</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_start_chat_activate" last_modification_time="Sun, 01 Oct 2006 16:49:43 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="information_menuitem">
<property name="visible">True</property>
<property name="label">gtk-info</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_contact_info_activate" last_modification_time="Sun, 01 Oct 2006 16:49:43 GMT"/>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -2,6 +2,7 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="subscription_request_window">
<property name="border_width">12</property>
<property name="title" translatable="yes">Subscription Request</property>
@ -16,6 +17,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="vbox10">
@ -181,81 +183,6 @@
</widget>
</child>
<child>
<widget class="GtkButton" id="contact_info_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_contact_info_button_clicked" last_modification_time="Mon, 16 May 2005 13:51:48 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment67">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2961">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image585">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">4</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="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label255">
<property name="visible">True</property>
<property name="label" translatable="yes">Contact _Info</property>
<property name="use_underline">True</property>
<property name="use_markup">False</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>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="authorize_button">
<property name="visible">True</property>
@ -332,6 +259,84 @@
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="actions_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_actions_button_clicked" last_modification_time="Sun, 01 Oct 2006 17:53:28 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment101">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox3009">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1338">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">4</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="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label372">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Make sure the character after &quot;_&quot; is not M/m (conflicts with Alt+M that is supposed to show the Emoticon Selector)">_Actions</property>
<property name="use_underline">True</property>
<property name="use_markup">False</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>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkArrow" id="arrow4">
<property name="visible">True</property>
<property name="arrow_type">GTK_ARROW_DOWN</property>
<property name="shadow_type">GTK_SHADOW_OUT</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="padding">0</property>
@ -342,4 +347,18 @@
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1019,6 +1019,12 @@ class SubscriptionRequestWindow:
xml.signal_autoconnect(self)
self.window.show_all()
def prepare_popup_menu(self):
xml = gtkgui_helpers.get_glade('subscription_request_popup_menu.glade')
menu = xml.get_widget('subscription_request_popup_menu')
xml.signal_autoconnect(self)
return menu
def on_close_button_clicked(self, widget):
self.window.destroy()
@ -1029,7 +1035,7 @@ class SubscriptionRequestWindow:
if self.jid not in gajim.contacts.get_jid_list(self.account):
AddNewContactWindow(self.account, self.jid, self.user_nick)
def on_contact_info_button_clicked(self, widget):
def on_contact_info_activate(self, widget):
'''ask vcard'''
if gajim.interface.instances[self.account]['infos'].has_key(self.jid):
gajim.interface.instances[self.account]['infos'][self.jid].window.present()
@ -1043,11 +1049,22 @@ class SubscriptionRequestWindow:
gajim.interface.instances[self.account]['infos'][self.jid].xml.\
get_widget('information_notebook').remove_page(0)
def on_start_chat_activate(self, widget):
'''open chat'''
gajim.interface.roster.new_chat_from_jid(self.account, self.jid)
def on_deny_button_clicked(self, widget):
'''refuse the request'''
gajim.connections[self.account].refuse_authorization(self.jid)
self.window.destroy()
def on_actions_button_clicked(self, widget):
'''popup action menu'''
menu = self.prepare_popup_menu()
menu.show_all()
gtkgui_helpers.popup_emoticons_under_button(menu, widget, self.window.window)
class JoinGroupchatWindow:
def __init__(self, account, server = '', room = '', nick = '',
automatic = False):