nicer chat2muc window. see #2095

This commit is contained in:
Yann Leboulanger 2007-08-22 11:10:54 +00:00
parent a6f1703011
commit 9af8207148
2 changed files with 184 additions and 297 deletions

View File

@ -1,275 +1,182 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface> <glade-interface>
<widget class="GtkWindow" id="chat_to_muc_window">
<widget class="GtkWindow" id="chat_to_muc_window"> <property name="visible">True</property>
<property name="border_width">5</property> <property name="border_width">5</property>
<property name="visible">True</property> <property name="title" translatable="yes">Invite Friends !</property>
<property name="title" translatable="yes">Invite Friends !</property> <signal name="key_press_event" handler="on_chat_to_muc_window_key_press_event"/>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <child>
<property name="window_position">GTK_WIN_POS_NONE</property> <widget class="GtkVBox" id="general_vbox">
<property name="modal">False</property> <property name="visible">True</property>
<property name="resizable">True</property> <child>
<property name="destroy_with_parent">False</property> <widget class="GtkLabel" id="label3">
<property name="decorated">True</property> <property name="visible">True</property>
<property name="skip_taskbar_hint">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="skip_pager_hint">False</property> <property name="label" translatable="yes">You are going to begin a Multi-User Chat.
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> Select the contacts you want to invite</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="focus_on_map">True</property> </widget>
<property name="urgency_hint">False</property> <packing>
<property name="expand">False</property>
<child> <property name="fill">False</property>
<widget class="GtkVBox" id="general_vbox"> <property name="padding">4</property>
<property name="visible">True</property> </packing>
<property name="homogeneous">False</property> </child>
<property name="spacing">0</property> <child>
<widget class="GtkScrolledWindow" id="guests_scrolledwindow">
<child> <property name="visible">True</property>
<widget class="GtkLabel" id="server_select_label"> <property name="can_focus">True</property>
<property name="visible">True</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="label" translatable="yes">You are going to begin a Multi-User Chat. <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
First please select a MUC server.</property> <property name="shadow_type">GTK_SHADOW_IN</property>
<property name="use_underline">False</property> <child>
<property name="use_markup">False</property> <widget class="GtkTreeView" id="guests_treeview">
<property name="justify">GTK_JUSTIFY_CENTER</property> <property name="visible">True</property>
<property name="wrap">True</property> <property name="can_focus">True</property>
<property name="selectable">False</property> <property name="headers_visible">False</property>
<property name="xalign">0.5</property> <signal name="drag_data_get" handler="on_guests_treeview_drag_data_get"/>
<property name="yalign">0.5</property> <signal name="drag_data_received" handler="on_guests_treeview_drag_data_received"/>
<property name="xpad">0</property> <signal name="drag_end" handler="on_guests_treeview_drag_end"/>
<property name="ypad">0</property> </widget>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> </child>
<property name="width_chars">-1</property> </widget>
<property name="single_line_mode">False</property> <packing>
<property name="angle">0</property> <property name="padding">4</property>
</widget> <property name="position">1</property>
<packing> </packing>
<property name="padding">4</property> </child>
<property name="expand">False</property> <child>
<property name="fill">False</property> <widget class="GtkExpander" id="expander1">
</packing> <property name="visible">True</property>
</child> <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child> <child>
<widget class="GtkComboBoxEntry" id="server_list_comboboxentry"> <widget class="GtkVBox" id="vbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="add_tearoffs">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="has_frame">True</property> <child>
<property name="focus_on_click">True</property> <widget class="GtkLabel" id="server_select_label">
</widget> <property name="visible">True</property>
<packing> <property name="label" translatable="yes">Please select a MUC server.</property>
<property name="padding">0</property> <property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="expand">False</property> <property name="wrap">True</property>
<property name="fill">True</property> </widget>
</packing> <packing>
</child> <property name="expand">False</property>
<property name="fill">False</property>
<child> <property name="padding">4</property>
<widget class="GtkHSeparator" id="server_and_guests_hseparator"> </packing>
<property name="visible">True</property> </child>
</widget> <child>
<packing> <widget class="GtkComboBoxEntry" id="server_list_comboboxentry">
<property name="padding">4</property> <property name="visible">True</property>
<property name="expand">False</property> <child internal-child="entry">
<property name="fill">True</property> <widget class="GtkEntry" id="comboboxentry-entry1">
</packing> </widget>
</child> </child>
</widget>
<child> <packing>
<widget class="GtkLabel" id="info_label"> <property name="expand">False</property>
<property name="visible">True</property> <property name="position">1</property>
<property name="label" translatable="yes">Select the friends you want to invite.</property> </packing>
<property name="use_underline">False</property> </child>
<property name="use_markup">False</property> </widget>
<property name="justify">GTK_JUSTIFY_CENTER</property> </child>
<property name="wrap">True</property> <child>
<property name="selectable">False</property> <widget class="GtkLabel" id="label2">
<property name="xalign">0.5</property> <property name="visible">True</property>
<property name="yalign">0.5</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xpad">0</property> <property name="label" translatable="yes">MUC server</property>
<property name="ypad">0</property> </widget>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <packing>
<property name="width_chars">-1</property> <property name="type">label_item</property>
<property name="single_line_mode">False</property> </packing>
<property name="angle">0</property> </child>
</widget> </widget>
<packing> <packing>
<property name="padding">4</property> <property name="expand">False</property>
<property name="expand">False</property> <property name="position">2</property>
<property name="fill">False</property> </packing>
</packing> </child>
</child> <child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<child> <property name="visible">True</property>
<widget class="GtkScrolledWindow" id="guests_scrolledwindow"> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visible">True</property> <property name="spacing">6</property>
<property name="can_focus">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <child>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <widget class="GtkButton" id="cancel_button">
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="visible">True</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property> <property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<child> <property name="use_stock">True</property>
<widget class="GtkTreeView" id="guests_treeview"> <property name="response_id">0</property>
<property name="visible">True</property> <signal name="clicked" handler="on_cancel_button_clicked"/>
<property name="can_focus">True</property> </widget>
<property name="headers_visible">False</property> <packing>
<property name="rules_hint">False</property> <property name="expand">False</property>
<property name="reorderable">False</property> <property name="fill">False</property>
<property name="enable_search">True</property> <property name="padding">3</property>
<property name="fixed_height_mode">False</property> </packing>
<property name="hover_selection">False</property> </child>
<property name="hover_expand">False</property> <child>
<signal name="drag_data_received" handler="on_guests_treeview_drag_data_received" last_modification_time="Mon, 16 Jul 2007 13:49:16 GMT"/> <widget class="GtkButton" id="invite_button">
<signal name="drag_end" handler="on_guests_treeview_drag_end" last_modification_time="Mon, 16 Jul 2007 14:02:56 GMT"/> <property name="visible">True</property>
<signal name="drag_data_get" handler="on_guests_treeview_drag_data_get" last_modification_time="Mon, 16 Jul 2007 14:04:27 GMT"/> <property name="can_focus">True</property>
</widget> <property name="response_id">0</property>
</child> <signal name="clicked" handler="on_invite_button_clicked"/>
</widget> <child>
<packing> <widget class="GtkAlignment" id="alignment1">
<property name="padding">4</property> <property name="visible">True</property>
<property name="expand">True</property> <property name="xscale">0</property>
<property name="fill">True</property> <property name="yscale">0</property>
</packing> <child>
</child> <widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<child> <property name="spacing">2</property>
<widget class="GtkHBox" id="invite_cancel_hbox"> <child>
<property name="visible">True</property> <widget class="GtkImage" id="image1">
<property name="homogeneous">False</property> <property name="visible">True</property>
<property name="spacing">0</property> <property name="stock">gtk-jump-to</property>
</widget>
<child> <packing>
<widget class="GtkLabel" id="empty_label"> <property name="expand">False</property>
<property name="visible">True</property> <property name="fill">False</property>
<property name="label" translatable="yes"></property> </packing>
<property name="use_underline">False</property> </child>
<property name="use_markup">False</property> <child>
<property name="justify">GTK_JUSTIFY_LEFT</property> <widget class="GtkLabel" id="label1">
<property name="wrap">False</property> <property name="visible">True</property>
<property name="selectable">False</property> <property name="label" translatable="yes">In_vite</property>
<property name="xalign">0.5</property> <property name="use_underline">True</property>
<property name="yalign">0.5</property> </widget>
<property name="xpad">0</property> <packing>
<property name="ypad">0</property> <property name="expand">False</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="fill">False</property>
<property name="width_chars">-1</property> <property name="position">1</property>
<property name="single_line_mode">False</property> </packing>
<property name="angle">0</property> </child>
</widget> </widget>
<packing> </child>
<property name="padding">0</property> </widget>
<property name="expand">True</property> </child>
<property name="fill">True</property> </widget>
</packing> <packing>
</child> <property name="expand">False</property>
<property name="fill">False</property>
<child> <property name="padding">3</property>
<widget class="GtkButton" id="cancel_button"> <property name="position">1</property>
<property name="visible">True</property> </packing>
<property name="can_focus">True</property> </child>
<property name="label">gtk-cancel</property> </widget>
<property name="use_stock">True</property> <packing>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="expand">False</property>
<property name="focus_on_click">True</property> <property name="position">3</property>
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Sun, 15 Jul 2007 08:42:47 GMT"/> </packing>
</widget> </child>
<packing> </widget>
<property name="padding">3</property> </child>
<property name="expand">False</property> </widget>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="invite_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_invite_button_clicked" last_modification_time="Sun, 15 Jul 2007 08:42:41 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment1">
<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="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</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="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">In_vite</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>
<packing>
<property name="padding">3</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>

View File

@ -3208,13 +3208,11 @@ class TransformChatToMUC:
self.xml = gtkgui_helpers.get_glade('chat_to_muc_window.glade') self.xml = gtkgui_helpers.get_glade('chat_to_muc_window.glade')
self.window = self.xml.get_widget('chat_to_muc_window') self.window = self.xml.get_widget('chat_to_muc_window')
self.window.connect('key_press_event', self._on_keypress_event)
for widget_to_add in ('invite_button', 'cancel_button', for widget_to_add in ('invite_button', 'cancel_button',
'server_list_comboboxentry', 'guests_treeview', 'server_list_comboboxentry', 'guests_treeview',
'server_and_guests_hseparator', 'server_select_label'): 'server_and_guests_hseparator', 'server_select_label'):
self.__dict__[widget_to_add] = self.xml.get_widget(widget_to_add) self.__dict__[widget_to_add] = self.xml.get_widget(widget_to_add)
self.window.connect('key_press_event', self._on_keypress_event)
# set comboboxentry # set comboboxentry
renderer_servers = gtk.CellRendererText() renderer_servers = gtk.CellRendererText()
@ -3269,32 +3267,14 @@ class TransformChatToMUC:
name = jid.split('@')[0] name = jid.split('@')[0]
self.store.append([name, jid]) self.store.append([name, jid])
# show all but... # show all
self.window.show_all() self.window.show_all()
# ...hide this
self.server_selection_visible = True
self.toggle_server_selection_visible()
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
def toggle_server_selection_visible(self): def on_chat_to_muc_window_key_press_event(self, widget, event):
if self.server_selection_visible: if event.keyval == gtk.keysyms.Escape: # ESCAPE
self.server_selection_visible = False self.window.destroy()
self.server_and_guests_hseparator.hide()
self.server_list_comboboxentry.hide()
self.server_select_label.hide()
else:
self.server_selection_visible = True
self.server_and_guests_hseparator.show()
self.server_list_comboboxentry.show()
self.server_select_label.show()
def _on_keypress_event(self, widget, event):
if (event.state & gtk.gdk.MOD1_MASK) and (event.keyval == gtk.keysyms.c \
or event.keyval == gtk.keysyms.C):
self.toggle_server_selection_visible()
return True
def on_invite_button_clicked(self, widget): def on_invite_button_clicked(self, widget):
server = self.server_list_comboboxentry.get_active_text() server = self.server_list_comboboxentry.get_active_text()