close button in tabs

This commit is contained in:
Yann Leboulanger 2005-03-12 00:42:57 +00:00
parent fc696dc4d0
commit dfecd6578a
2 changed files with 66 additions and 43 deletions

View File

@ -8258,32 +8258,6 @@ Custom</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_button">
<property name="visible">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Wed, 02 Mar 2005 21:05:12 GMT"/>
<child>
<widget class="GtkImage" id="image434">
<property name="visible">True</property>
<property name="stock">gtk-close</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>
</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>
@ -8383,18 +8357,60 @@ Custom</property>
</child>
<child>
<widget class="GtkLabel" id="label184">
<widget class="GtkHBox" id="tab_hbox">
<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>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<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="type">tab</property>

View File

@ -128,7 +128,8 @@ class tabbed_chat_window:
elif self.nb_unread[jid] == 1:
start = "* "
child = self.xmls[jid].get_widget('chat_vbox')
self.chat_notebook.set_tab_label_text(child, start + self.users[jid].name)
tab_label = self.chat_notebook.get_tab_label(child).get_children()[0]
tab_label.set_text(start + self.users[jid].name)
def set_image(self, image, jid):
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
@ -175,10 +176,9 @@ class tabbed_chat_window:
start, end = conversation_buffer.get_bounds()
conversation_buffer.delete(start, end)
def on_close_button_clicked(self, button):
def on_close_button_clicked(self, button, jid):
"""When close button is pressed :
close a tab"""
jid = self.get_active_jid()
self.remove_tab(jid)
def on_tabbed_chat_window_focus_in_event(self, widget, event):
@ -243,8 +243,9 @@ class tabbed_chat_window:
if self.print_time_timeout_id.has_key(jid):
gobject.source_remove(self.print_time_timeout_id[jid])
del self.print_time_timeout_id[jid]
child = self.xmls[jid].get_widget('chat_vbox')
self.chat_notebook.remove_page(\
self.chat_notebook.get_current_page())
self.chat_notebook.page_num(child))
del self.plugin.windows[self.account]['chats'][jid]
del self.users[jid]
del self.nb_unread[jid]
@ -308,11 +309,17 @@ class tabbed_chat_window:
conversation_scrolledwindow.get_vadjustment().connect('value-changed', \
self.on_conversation_vadjustment_value_changed)
self.chat_notebook.append_page(self.xmls[user.jid].\
get_widget('chat_vbox'))
child = self.xmls[user.jid].get_widget('chat_vbox')
self.chat_notebook.append_page(child)
if len(self.xmls) > 1:
self.chat_notebook.set_show_tabs(True)
xm = gtk.glade.XML(GTKGUI_GLADE, 'tab_hbox', APP)
tab_hbox = xm.get_widget('tab_hbox')
xm.signal_connect('on_close_button_clicked', \
self.on_close_button_clicked, user.jid)
self.chat_notebook.set_tab_label(child, tab_hbox)
self.redraw_tab(user.jid)
self.draw_widgets(user)
self.show_title()