when we right click on a tab, we switch to it, so popup menu item are correct :)

This commit is contained in:
Yann Leboulanger 2005-08-04 09:42:34 +00:00
parent d56ba58149
commit 6b26a5d332
3 changed files with 140 additions and 111 deletions

View File

@ -127,10 +127,11 @@ class Chat:
start = '* '
child = self.childs[jid]
hb = self.notebook.get_tab_label(child).get_children()[0]
if self.widget_name == 'tabbed_chat_window':
nickname = self.notebook.get_tab_label(child).get_children()[1]
nickname = hb.get_children()[1]
elif self.widget_name == 'groupchat_window':
nickname = self.notebook.get_tab_label(child).get_children()[0]
nickname = hb.get_children()[0]
#FIXME: when gtk2.4 is OOOOLD do it via glade2.10+
if gtk.pygtk_version >= (2, 6, 0) and gtk.gtk_version >= (2, 6, 0):
@ -413,7 +414,12 @@ class Chat:
message_scrolledwindow.set_property('height-request', -1)
self.bring_scroll_to_end(conversation_textview, diff_y - 18)
return True
def on_tab_eventbox_button_press_event(self, widget, event, child):
if event.button == 3:
n = self.notebook.page_num(child)
self.notebook.set_current_page(n)
def new_tab(self, jid):
#FIXME: text formating buttons will be hidden in 0.8 release
for w in ['bold_togglebutton', 'italic_togglebutton', 'underline_togglebutton']:
@ -495,16 +501,19 @@ class Chat:
self.notebook.set_show_tabs(True)
if self.widget_name == 'tabbed_chat_window':
xm = gtk.glade.XML(GTKGUI_GLADE, 'chat_tab_hbox', APP)
tab_hbox = xm.get_widget('chat_tab_hbox')
xm = gtk.glade.XML(GTKGUI_GLADE, 'chats_eventbox', APP)
tab_hbox = xm.get_widget('chats_eventbox')
elif self.widget_name == 'groupchat_window':
xm = gtk.glade.XML(GTKGUI_GLADE, 'groupchat_tab_hbox', APP)
tab_hbox = xm.get_widget('groupchat_tab_hbox')
xm.signal_connect('on_close_button_clicked',
self.on_close_button_clicked, jid)
xm = gtk.glade.XML(GTKGUI_GLADE, 'gc_eventbox', APP)
tab_hbox = xm.get_widget('gc_eventbox')
child = self.childs[jid]
xm.signal_connect('on_close_button_clicked',
self.on_close_button_clicked, jid)
xm.signal_connect('on_tab_eventbox_button_press_event',
self.on_tab_eventbox_button_press_event, child)
self.notebook.append_page(child, tab_hbox)
message_textview = self.xmls[jid].get_widget('message_textview')
message_textview.connect('size-request', self.size_request,

View File

@ -9106,60 +9106,69 @@ Custom</property>
</child>
<child>
<widget class="GtkHBox" id="groupchat_tab_hbox">
<property name="border_width">2</property>
<widget class="GtkEventBox" id="gc_eventbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">4</property>
<property name="visible_window">False</property>
<property name="above_child">False</property>
<signal name="button_press_event" handler="on_tab_eventbox_button_press_event" last_modification_time="Thu, 04 Aug 2005 09:38:03 GMT"/>
<child>
<widget class="GtkLabel" id="label250">
<widget class="GtkHBox" id="groupchat_tab_hbox">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</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>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_button">
<property name="width_request">20</property>
<property name="height_request">20</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Sat, 12 Mar 2005 00:12:43 GMT"/>
<property name="homogeneous">False</property>
<property name="spacing">4</property>
<child>
<widget class="GtkImage" id="image504">
<widget class="GtkLabel" id="label250">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</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">6</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="GtkButton" id="close_button">
<property name="width_request">20</property>
<property name="height_request">20</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Sat, 12 Mar 2005 00:12:43 GMT"/>
<child>
<widget class="GtkImage" id="image504">
<property name="visible">True</property>
<property name="stock">gtk-close</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">6</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
@ -9971,14 +9980,15 @@ Custom</property>
<signal name="focus_in_event" handler="on_tabbed_chat_window_focus_in_event" last_modification_time="Wed, 02 Mar 2005 17:57:33 GMT"/>
<signal name="delete_event" handler="on_tabbed_chat_window_delete_event" last_modification_time="Mon, 07 Mar 2005 11:06:00 GMT"/>
<signal name="destroy" handler="on_tabbed_chat_window_destroy" last_modification_time="Mon, 07 Mar 2005 16:35:25 GMT"/>
<signal name="button_press_event" handler="on_tabbed_chat_window_button_press_event" last_modification_time="Fri, 24 Jun 2005 23:54:20 GMT"/>
<signal name="button_press_event" handler="on_tabbed_chat_window_button_press_event" last_modification_time="Thu, 04 Aug 2005 08:33:10 GMT"/>
<signal name="focus_out_event" handler="on_tabbed_chat_window_focus_out_event" last_modification_time="Mon, 18 Jul 2005 22:07:30 GMT"/>
<signal name="motion_notify_event" handler="on_tabbed_chat_window_motion_notify_event" last_modification_time="Thu, 21 Jul 2005 22:24:26 GMT"/>
<child>
<widget class="GtkNotebook" id="chat_notebook">
<property name="visible">True</property>
<property name="show_tabs">False</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">True</property>
@ -10631,76 +10641,85 @@ Status message</property>
</child>
<child>
<widget class="GtkHBox" id="chat_tab_hbox">
<widget class="GtkEventBox" id="chats_eventbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">4</property>
<property name="visible_window">False</property>
<property name="above_child">False</property>
<signal name="button_press_event" handler="on_tab_eventbox_button_press_event" last_modification_time="Thu, 04 Aug 2005 09:38:11 GMT"/>
<child>
<widget class="GtkImage" id="status_image">
<widget class="GtkHBox" id="chat_tab_hbox">
<property name="visible">True</property>
<property name="stock">gtk-no</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="label221">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</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>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_button">
<property name="width_request">20</property>
<property name="height_request">20</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Sat, 12 Mar 2005 00:12:43 GMT"/>
<property name="homogeneous">False</property>
<property name="spacing">4</property>
<child>
<widget class="GtkImage" id="image456">
<widget class="GtkImage" id="status_image">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
<property name="stock">gtk-no</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">6</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="label221">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</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>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_button">
<property name="width_request">20</property>
<property name="height_request">20</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Sat, 12 Mar 2005 00:12:43 GMT"/>
<child>
<widget class="GtkImage" id="image456">
<property name="visible">True</property>
<property name="stock">gtk-close</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">6</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>

View File

@ -212,7 +212,8 @@ class TabbedChatWindow(chat.Chat):
show = u.show
keyID = u.keyID
child = self.childs[jid]
status_image = self.notebook.get_tab_label(child).get_children()[0]
hb = self.notebook.get_tab_label(child).get_children()[0]
status_image = hb.get_children()[0]
state_images = self.plugin.roster.get_appropriate_state_images(jid)
image = state_images[show]
banner_status_image = self.xmls[jid].get_widget('banner_status_image')