merge tabbed_chat_window and chat_window

no need to restart gajim to take into account the use_tabbed_window option (already opened windows are not concerned for the moment)
This commit is contained in:
Yann Leboulanger 2005-03-02 22:34:16 +00:00
parent d3590b1921
commit a4cd6f37b9
2 changed files with 518 additions and 782 deletions

View File

@ -313,359 +313,6 @@
</child> </child>
</widget> </widget>
<widget class="GtkWindow" id="chat_window">
<property name="visible">True</property>
<property name="title" translatable="yes">Chat</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">400</property>
<property name="default_height">300</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Sun, 12 Oct 2003 18:17:05 GMT"/>
<signal name="focus_in_event" handler="on_focus" last_modification_time="Fri, 11 Jun 2004 03:14:21 GMT"/>
<signal name="key_press_event" handler="on_chat_key_press_event" last_modification_time="Thu, 06 Jan 2005 12:53:45 GMT"/>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkButton" id="history_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_history_clicked" last_modification_time="Sun, 04 Apr 2004 05:30:58 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment4">
<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="hbox8">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image14">
<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="label14">
<property name="visible">True</property>
<property name="label" translatable="yes">History</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>
</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">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="clear_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_clear_clicked" last_modification_time="Thu, 18 Mar 2004 19:12:00 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment5">
<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="hbox9">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image15">
<property name="visible">True</property>
<property name="stock">gtk-clear</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="label15">
<property name="visible">True</property>
<property name="label" translatable="yes">Clear</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>
</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">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="status_image">
<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="GtkToggleButton" id="gpg_toggle_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<child>
<widget class="GtkImage" id="image169">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</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>
<child>
<widget class="GtkFixed" id="fixed1">
<property name="width_request">20</property>
<property name="visible">True</property>
<child>
<widget class="GtkButton" id="contact_button">
<property name="width_request">0</property>
<property name="height_request">0</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click to see contact's information</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Anonymous &lt;id@server/res&gt;</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button_contact_clicked" last_modification_time="Sun, 15 Feb 2004 14:26:53 GMT"/>
</widget>
<packing>
<property name="x">0</property>
<property name="y">0</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVPaned" id="vpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">170</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="conversation_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">False</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">True</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="message_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
<signal name="key_press_event" handler="on_msg_key_press_event" last_modification_time="Mon, 13 Oct 2003 17:48:48 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="configure_accounts_window"> <widget class="GtkWindow" id="configure_accounts_window">
<property name="visible">True</property> <property name="visible">True</property>
<property name="title" translatable="yes">Accounts</property> <property name="title" translatable="yes">Accounts</property>
@ -8155,7 +7802,7 @@ Custom</property>
</child> </child>
</widget> </widget>
<widget class="GtkWindow" id="tabbed_chat"> <widget class="GtkWindow" id="tabbed_chat_window">
<property name="visible">True</property> <property name="visible">True</property>
<property name="title" translatable="yes">Chat</property> <property name="title" translatable="yes">Chat</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
@ -8164,39 +7811,383 @@ Custom</property>
<property name="default_width">400</property> <property name="default_width">400</property>
<property name="default_height">320</property> <property name="default_height">320</property>
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">True</property>
<property name="decorated">True</property> <property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property> <property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property> <property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Thu, 27 Jan 2005 08:30:06 GMT"/> <signal name="destroy" handler="on_tabbed_chat_window_destroy" last_modification_time="Wed, 02 Mar 2005 17:56:08 GMT"/>
<signal name="focus_in_event" handler="on_focus" last_modification_time="Thu, 27 Jan 2005 08:30:54 GMT"/> <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="key_press_event" handler="on_chat_key_press_event" last_modification_time="Thu, 27 Jan 2005 08:31:21 GMT"/> <signal name="key_press_event" handler="on_tabbed_chat_window_key_press_event" last_modification_time="Wed, 02 Mar 2005 17:59:50 GMT"/>
<child> <child>
<widget class="GtkNotebook" id="notebook"> <widget class="GtkNotebook" id="chat_notebook">
<property name="visible">True</property> <property name="visible">True</property>
<property name="show_tabs">False</property> <property name="show_tabs">False</property>
<property name="show_border">True</property> <property name="show_border">True</property>
<property name="tab_pos">GTK_POS_TOP</property> <property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property> <property name="scrollable">False</property>
<property name="enable_popup">False</property> <property name="enable_popup">False</property>
<signal name="switch_page" handler="on_notebook_switch_page" last_modification_time="Thu, 27 Jan 2005 23:16:57 GMT"/> <signal name="switch_page" handler="on_chat_notebook_switch_page" last_modification_time="Wed, 02 Mar 2005 18:00:21 GMT"/>
<child> <child>
<widget class="GtkLabel" id="label191"> <widget class="GtkVBox" id="chat_vbox">
<property name="border_width">5</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes"></property> <property name="homogeneous">False</property>
<property name="use_underline">False</property> <property name="spacing">0</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <child>
<property name="wrap">False</property> <widget class="GtkHBox" id="hbox2921">
<property name="selectable">False</property> <property name="border_width">5</property>
<property name="xalign">0.5</property> <property name="visible">True</property>
<property name="yalign">0.5</property> <property name="homogeneous">False</property>
<property name="xpad">0</property> <property name="spacing">5</property>
<property name="ypad">0</property>
<child>
<widget class="GtkButton" id="history_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_history_button_clicked" last_modification_time="Wed, 02 Mar 2005 17:03:17 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment45">
<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="hbox2922">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image406">
<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="label203">
<property name="visible">True</property>
<property name="label" translatable="yes">History</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>
</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">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="clear_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_clear_button_clicked" last_modification_time="Wed, 02 Mar 2005 17:03:09 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment46">
<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="hbox2923">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image407">
<property name="visible">True</property>
<property name="stock">gtk-clear</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="label204">
<property name="visible">True</property>
<property name="label" translatable="yes">Clear</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>
</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">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="status_image">
<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="GtkToggleButton" id="gpg_togglebutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<child>
<widget class="GtkImage" id="image409">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</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>
<child>
<widget class="GtkFixed" id="fixed2">
<property name="width_request">20</property>
<property name="visible">True</property>
<child>
<widget class="GtkButton" id="contact_button">
<property name="width_request">0</property>
<property name="height_request">0</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click to see contact's information</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Anonymous &lt;id@server/res&gt;</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_contact_button_clicked" last_modification_time="Wed, 02 Mar 2005 21:04:43 GMT"/>
</widget>
<packing>
<property name="x">0</property>
<property name="y">0</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_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_close_button_clicked" last_modification_time="Wed, 02 Mar 2005 21:05:12 GMT"/>
<child>
<widget class="GtkImage" id="image410">
<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>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVPaned" id="vpaned3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">170</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow30">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="conversation_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">False</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">True</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow31">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="message_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
<signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Wed, 02 Mar 2005 21:05:35 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="tab_expand">False</property> <property name="tab_expand">False</property>
@ -8207,7 +8198,7 @@ Custom</property>
<child> <child>
<widget class="GtkLabel" id="label184"> <widget class="GtkLabel" id="label184">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">jid</property> <property name="label" translatable="yes"></property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>

View File

@ -75,8 +75,6 @@ from config import *
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade' GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
USE_TABBED_CHAT = 0
class ImageCellRenderer(gtk.GenericCellRenderer): class ImageCellRenderer(gtk.GenericCellRenderer):
__gproperties__ = { __gproperties__ = {
@ -98,7 +96,8 @@ class ImageCellRenderer(gtk.GenericCellRenderer):
if model.get_value(iter, 0) == image: if model.get_value(iter, 0) == image:
self.redraw = 1 self.redraw = 1
cell_area = tree.get_cell_area(path, tree.get_column(0)) cell_area = tree.get_cell_area(path, tree.get_column(0))
tree.queue_draw_area(cell_area.x, cell_area.y, cell_area.width, cell_area.height) tree.queue_draw_area(cell_area.x, cell_area.y, cell_area.width, \
cell_area.height)
def animation_timeout(self, tree, image): def animation_timeout(self, tree, image):
if image.get_storage_type() == gtk.IMAGE_ANIMATION: if image.get_storage_type() == gtk.IMAGE_ANIMATION:
@ -107,14 +106,16 @@ class ImageCellRenderer(gtk.GenericCellRenderer):
model = tree.get_model() model = tree.get_model()
model.foreach(self.func, (image, tree)) model.foreach(self.func, (image, tree))
if self.redraw: if self.redraw:
gobject.timeout_add(image.get_data('iter').get_delay_time(), self.animation_timeout, tree, image) gobject.timeout_add(image.get_data('iter').get_delay_time(), \
self.animation_timeout, tree, image)
else: else:
image.set_data('iter', None) image.set_data('iter', None)
def on_render(self, window, widget, background_area,cell_area, \ def on_render(self, window, widget, background_area,cell_area, \
expose_area, flags): expose_area, flags):
pix_rect = gtk.gdk.Rectangle() pix_rect = gtk.gdk.Rectangle()
pix_rect.x, pix_rect.y, pix_rect.width, pix_rect.height = self.on_get_size(widget, cell_area) pix_rect.x, pix_rect.y, pix_rect.width, pix_rect.height = \
self.on_get_size(widget, cell_area)
pix_rect.x += cell_area.x pix_rect.x += cell_area.x
pix_rect.y += cell_area.y pix_rect.y += cell_area.y
@ -128,7 +129,8 @@ class ImageCellRenderer(gtk.GenericCellRenderer):
if not self.image.get_data('iter'): if not self.image.get_data('iter'):
animation = self.image.get_animation() animation = self.image.get_animation()
self.image.set_data('iter', animation.get_iter()) self.image.set_data('iter', animation.get_iter())
gobject.timeout_add(self.image.get_data('iter').get_delay_time(), self.animation_timeout, widget, self.image) gobject.timeout_add(self.image.get_data('iter').get_delay_time(), \
self.animation_timeout, widget, self.image)
pix = self.image.get_data('iter').get_pixbuf() pix = self.image.get_data('iter').get_pixbuf()
elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF: elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
@ -155,8 +157,10 @@ class ImageCellRenderer(gtk.GenericCellRenderer):
x_offset = 0 x_offset = 0
y_offset = 0 y_offset = 0
if cell_area and pixbuf_width > 0 and pixbuf_height > 0: if cell_area and pixbuf_width > 0 and pixbuf_height > 0:
x_offset = self.get_property("xalign") * (cell_area.width - calc_width - self.get_property("xpad")) x_offset = self.get_property("xalign") * (cell_area.width - \
y_offset = self.get_property("yalign") * (cell_area.height - calc_height - self.get_property("ypad")) calc_width - self.get_property("xpad"))
y_offset = self.get_property("yalign") * (cell_area.height - \
calc_height - self.get_property("ypad"))
return x_offset, y_offset, calc_width, calc_height return x_offset, y_offset, calc_width, calc_height
gobject.type_register(ImageCellRenderer) gobject.type_register(ImageCellRenderer)
@ -192,25 +196,31 @@ class User:
class tabbed_chat_window: class tabbed_chat_window:
"""Class for tabbed chat window""" """Class for tabbed chat window"""
def __init__(self, user, plugin, account): def __init__(self, user, plugin, account):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'tabbed_chat', APP) self.xml = gtk.glade.XML(GTKGUI_GLADE, 'tabbed_chat_window', APP)
self.xml.get_widget('notebook').remove_page(0) self.chat_notebook = self.xml.get_widget('chat_notebook')
self.chat_notebook.remove_page(0)
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account
self.widgets = {} self.xmls = {}
self.tagIn = {} self.tagIn = {}
self.tagOut = {} self.tagOut = {}
self.tagStatus = {} self.tagStatus = {}
self.users = {user.jid: user} self.users = {}
self.nb_unread = {user.jid: 0} self.nb_unread = {}
self.window = self.xml.get_widget('tabbed_chat') self.window = self.xml.get_widget('tabbed_chat_window')
self.new_user(user) self.new_user(user)
self.show_title() self.show_title()
self.xml.signal_connect('gtk_widget_destroy', self.delete_event) self.xml.signal_connect('on_tabbed_chat_window_destroy', \
self.xml.signal_connect('on_focus', self.on_focus) self.on_tabbed_chat_window_destroy)
self.xml.signal_connect('on_chat_key_press_event', \ self.xml.signal_connect('on_tabbed_chat_window_focus_in_event', \
self.on_chat_key_press_event) self.on_tabbed_chat_window_focus_in_event)
self.xml.signal_connect('on_notebook_switch_page', \ self.xml.signal_connect('on_tabbed_chat_window_key_press_event', \
self.on_notebook_switch_page) self.on_tabbed_chat_window_key_press_event)
self.xml.signal_connect('on_chat_notebook_switch_page', \
self.on_chat_notebook_switch_page)
#TODO
# if use_tab:
# plugin.windows[account]['chats']['tabbed'] = self
def update_tags(self): def update_tags(self):
for jid in self.tagIn: for jid in self.tagIn:
@ -222,6 +232,7 @@ class tabbed_chat_window:
self.plugin.config['statusmsgcolor']) self.plugin.config['statusmsgcolor'])
def show_title(self): def show_title(self):
"""redraw the window's title"""
unread = 0 unread = 0
for jid in self.nb_unread: for jid in self.nb_unread:
unread += self.nb_unread[jid] unread += self.nb_unread[jid]
@ -233,68 +244,73 @@ class tabbed_chat_window:
self.window.set_title(start + "Chat (" + self.account + ")") self.window.set_title(start + "Chat (" + self.account + ")")
def draw_widgets(self, user): def draw_widgets(self, user):
widget_img = self.widgets[user.jid]['image_status'] """draw the widgets in a tab (status_image, contact_button ...)
according to the the information in the user variable"""
jid = user.jid
status_image = self.xmls[jid].get_widget('status_image')
image = self.plugin.roster.pixbufs[user.show] image = self.plugin.roster.pixbufs[user.show]
if image.get_storage_type() == gtk.IMAGE_ANIMATION: if image.get_storage_type() == gtk.IMAGE_ANIMATION:
widget_img.set_from_animation(image.get_animation()) status_image.set_from_animation(image.get_animation())
elif image.get_storage_type() == gtk.IMAGE_PIXBUF: elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
widget_img.set_from_pixbuf(image.get_pixbuf()) status_image.set_from_pixbuf(image.get_pixbuf())
self.widgets[user.jid]['button_contact'].set_label(\ contact_button = self.xmls[jid].get_widget('contact_button')
user.name + ' <' + user.jid + '>') contact_button.set_label(user.name + ' <' + jid + '>')
if not user.keyID: if not user.keyID:
self.widgets[user.jid]['toggle_gpg'].set_sensitive(False) self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(False)
def redraw_tab(self, jid): def redraw_tab(self, jid):
"""redraw the label of the tab"""
start = '' start = ''
if self.nb_unread[jid] > 1: if self.nb_unread[jid] > 1:
start = "[" + str(self.nb_unread[jid]) + "] " start = "[" + str(self.nb_unread[jid]) + "] "
elif self.nb_unread[jid] == 1: elif self.nb_unread[jid] == 1:
start = "* " start = "* "
nb = self.xml.get_widget("notebook") child = self.xmls[jid].get_widget('chat_vbox')
child = self.widgets[jid]['vbox_tab'] self.chat_notebook.set_tab_label_text(child, start + self.users[jid].name)
nb.set_tab_label_text(child, start + self.users[jid].name)
def set_image(self, image, jid): def set_image(self, image, jid):
if image.get_storage_type() == gtk.IMAGE_ANIMATION: if image.get_storage_type() == gtk.IMAGE_ANIMATION:
self.widgets[jid]['image_status'].\ self.xmls[jid].get_widget('status_image').\
set_from_animation(image.get_animation()) set_from_animation(image.get_animation())
elif image.get_storage_type() == gtk.IMAGE_PIXBUF: elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
self.widgets[jid]['image_status'].\ self.xmls[jid].get_widget('status_image').\
set_from_pixbuf(image.get_pixbuf()) set_from_pixbuf(image.get_pixbuf())
def delete_event(self, widget): def on_tabbed_chat_window_destroy(self, widget):
"""close window""" """close window"""
#clean self.plugin.windows[self.account]['chats'] #clean self.plugin.windows[self.account]['chats']
for jid in self.users: for jid in self.users:
del self.plugin.windows[self.account]['chats'][jid] del self.plugin.windows[self.account]['chats'][jid]
del self.plugin.windows[self.account]['chats']['tabbed'] if self.plugin.windows[self.account]['chats'].has_key('tabbed'):
del self.plugin.windows[self.account]['chats']['tabbed']
def get_active_jid(self): def get_active_jid(self):
nb = self.xml.get_widget("notebook") active_child = self.chat_notebook.get_nth_page(\
child = nb.get_nth_page(nb.get_current_page()) self.chat_notebook.get_current_page())
jid = '' active_jid = ''
for j in self.widgets: for jid in self.xmls:
c = self.widgets[j]['vbox_tab'] child = self.xmls[jid].get_widget('chat_vbox')
if c == child: if child == active_child:
jid = j active_jid = jid
break break
return jid return active_jid
def on_clear(self, widget): def on_clear_button_clicked(self, widget):
"""When clear button is pressed : """When clear button is pressed :
clear the conversation""" clear the conversation"""
jid = self.get_active_jid() jid = self.get_active_jid()
buffer = self.widgets[jid]['conversation'].get_buffer() conversation_buffer = self.xmls[jid].get_widget('conversation_textview').\
deb, end = buffer.get_bounds() get_buffer()
buffer.delete(deb, end) deb, end = conversation_buffer.get_bounds()
conversation_buffer.delete(deb, end)
def on_close_clicked(self, button): def on_close_button_clicked(self, button):
"""When close button is pressed : """When close button is pressed :
close a tab""" close a tab"""
jid = self.get_active_jid() jid = self.get_active_jid()
self.remove_tab(jid) self.remove_tab(jid)
def on_focus(self, widget, event): def on_tabbed_chat_window_focus_in_event(self, widget, event):
"""When window get focus""" """When window get focus"""
jid = self.get_active_jid() jid = self.get_active_jid()
if self.nb_unread[jid] > 0: if self.nb_unread[jid] > 0:
@ -303,140 +319,74 @@ class tabbed_chat_window:
self.show_title() self.show_title()
self.plugin.systray.remove_jid(jid, self.account) self.plugin.systray.remove_jid(jid, self.account)
def on_history(self, widget): def on_history_button_clicked(self, widget):
"""When history button is pressed : call log window""" """When history button is pressed : call history window"""
jid = self.get_active_jid() jid = self.get_active_jid()
if not self.plugin.windows['logs'].has_key(jid): if not self.plugin.windows['logs'].has_key(jid):
self.plugin.windows['logs'][jid] = history_window(self.plugin, jid) self.plugin.windows['logs'][jid] = history_window(self.plugin, jid)
def on_notebook_switch_page(self, nb, page, page_num): def on_chat_notebook_switch_page(self, notebook, page, page_num):
child = nb.get_nth_page(page_num) new_child = notebook.get_nth_page(page_num)
jid = '' new_jid = ''
for j in self.widgets: for jid in self.xmls:
c = self.widgets[j]['vbox_tab'] child = self.xmls[jid].get_widget('chat_vbox')
if c == child: if child == new_child:
jid = j new_jid = jid
break break
if self.nb_unread[jid] > 0: if self.nb_unread[new_jid] > 0:
self.nb_unread[jid] = 0 self.nb_unread[new_jid] = 0
self.redraw_tab(jid) self.redraw_tab(new_jid)
self.show_title() self.show_title()
self.plugin.systray.remove_jid(jid, self.account) self.plugin.systray.remove_jid(new_jid, self.account)
def active_tab(self, jid): def active_tab(self, jid):
child = self.widgets[jid]['vbox_tab'] child = self.xmls[jid].get_widget('chat_vbox')
nb = self.xml.get_widget("notebook") self.chat_notebook.set_current_page(\
nb.set_current_page(nb.page_num(child)) self.chat_notebook.page_num(child))
self.widgets[jid]['message'].grab_focus() self.xmls[jid].get_widget('message_textview').grab_focus()
def remove_tab(self, jid): def remove_tab(self, jid):
if len(self.widgets) == 1: if len(self.xmls) == 1:
self.window.destroy() self.window.destroy()
else: else:
nb = self.xml.get_widget('notebook') self.chat_notebook.remove_page(\
nb.remove_page(nb.get_current_page()) self.chat_notebook.get_current_page())
del self.plugin.windows[self.account]['chats'][jid] del self.plugin.windows[self.account]['chats'][jid]
del self.users[jid] del self.users[jid]
del self.nb_unread[jid] del self.nb_unread[jid]
del self.widgets[jid] del self.xmls[jid]
del self.tagIn[jid] del self.tagIn[jid]
del self.tagOut[jid] del self.tagOut[jid]
del self.tagStatus[jid] del self.tagStatus[jid]
if len(self.widgets) == 1: if len(self.xmls) == 1:
nb.set_show_tabs(False) self.chat_notebook.set_show_tabs(False)
def new_user(self, user): def new_user(self, user):
self.nb_unread[user.jid] = 0 self.nb_unread[user.jid] = 0
self.users[user.jid] = user self.users[user.jid] = user
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chat_vbox', APP)
self.widgets[user.jid] = {}
vb = gtk.VBox()
vb.set_border_width(5)
self.widgets[user.jid]['vbox_tab'] = vb
hb = gtk.HBox(spacing=5)
hb.set_border_width(5)
vb.pack_start(hb, expand=False)
button = gtk.Button(stock=gtk.STOCK_JUSTIFY_FILL) conversation_textview = \
button.get_children()[0].get_children()[0].get_children()[1].set_text("History") self.xmls[user.jid].get_widget('conversation_textview')
button.connect("clicked", self.on_history) conversation_buffer = conversation_textview.get_buffer()
hb.pack_start(button, expand=False, fill=False) end_iter = conversation_buffer.get_end_iter()
conversation_buffer.create_mark('end', end_iter, 0)
button = gtk.Button(stock=gtk.STOCK_CLEAR) self.tagIn[user.jid] = conversation_buffer.create_tag('incoming')
button.connect("clicked", self.on_clear)
hb.pack_start(button, expand=False, fill=False)
img = gtk.Image()
hb.pack_start(img, expand=False, fill=False)
self.widgets[user.jid]['image_status'] = img
img = gtk.Image()
img.set_from_stock(gtk.STOCK_DIALOG_AUTHENTICATION, gtk.ICON_SIZE_BUTTON)
button = gtk.ToggleButton()
button.add(img)
button.set_relief(gtk.RELIEF_NONE)
hb.pack_start(button, expand=False, fill=False)
self.widgets[user.jid]['toggle_gpg'] = button
fixed = gtk.Fixed()
fixed.set_size_request(20, -1)
hb.pack_start(fixed)
button = gtk.Button("Anonymous")
button.set_relief(gtk.RELIEF_NONE)
button.connect("clicked", self.on_button_contact_clicked)
button.set_use_underline(False)
fixed.put(button, 0, 0)
self.widgets[user.jid]['button_contact'] = button
img = gtk.Image()
img.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_BUTTON)
button = gtk.Button()
button.add(img)
button.connect("clicked", self.on_close_clicked)
hb.pack_start(button, expand=False, fill=False)
vp = gtk.VPaned()
vb.pack_start(vp)
vp.set_position(170)
sw = gtk.ScrolledWindow()
sw.set_shadow_type(gtk.SHADOW_IN)
vp.add1(sw)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
tv = gtk.TextView()
tv.set_wrap_mode(gtk.WRAP_WORD)
tv.set_editable(False)
tv.set_cursor_visible(False)
sw.add(tv)
self.widgets[user.jid]['conversation'] = tv
buffer = tv.get_buffer()
end_iter = buffer.get_end_iter()
buffer.create_mark('end', end_iter, 0)
self.tagIn[user.jid] = buffer.create_tag("incoming")
color = self.plugin.config['inmsgcolor'] color = self.plugin.config['inmsgcolor']
self.tagIn[user.jid].set_property("foreground", color) self.tagIn[user.jid].set_property('foreground', color)
self.tagOut[user.jid] = buffer.create_tag("outgoing") self.tagOut[user.jid] = conversation_buffer.create_tag('outgoing')
color = self.plugin.config['outmsgcolor'] color = self.plugin.config['outmsgcolor']
self.tagOut[user.jid].set_property("foreground", color) self.tagOut[user.jid].set_property('foreground', color)
self.tagStatus[user.jid] = buffer.create_tag("status") self.tagStatus[user.jid] = conversation_buffer.create_tag('status')
color = self.plugin.config['statusmsgcolor'] color = self.plugin.config['statusmsgcolor']
self.tagStatus[user.jid].set_property("foreground", color) self.tagStatus[user.jid].set_property('foreground', color)
sw = gtk.ScrolledWindow() self.xmls[user.jid].signal_autoconnect(self)
sw.set_shadow_type(gtk.SHADOW_IN)
vp.add2(sw) self.chat_notebook.append_page(self.xmls[user.jid].\
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) get_widget('chat_vbox'))
tv = gtk.TextView() if len(self.xmls) > 1:
tv.set_wrap_mode(gtk.WRAP_WORD) self.chat_notebook.set_show_tabs(True)
sw.add(tv)
self.widgets[user.jid]['message'] = tv
tv.connect('key_press_event', self.on_msg_key_press_event)
vb.show_all()
nb = self.xml.get_widget("notebook")
nb.append_page(vb)
if len(self.widgets) > 1:
nb.set_show_tabs(True)
self.redraw_tab(user.jid) self.redraw_tab(user.jid)
self.draw_widgets(user) self.draw_widgets(user)
@ -448,53 +398,53 @@ class tabbed_chat_window:
self.print_conversation(_("%s is now %s (%s)") % (user.name, \ self.print_conversation(_("%s is now %s (%s)") % (user.name, \
user.show, user.status), user.jid, 'status') user.show, user.status), user.jid, 'status')
def on_msg_key_press_event(self, widget, event): def on_message_textview_key_press_event(self, widget, event):
"""When a key is pressed : """When a key is pressed :
if enter is pressed without the shit key, message (if not empty) is sent if enter is pressed without the shit key, message (if not empty) is sent
and printed in the conversation""" and printed in the conversation"""
if event.keyval == gtk.keysyms.Return: if event.keyval == gtk.keysyms.Return:
if (event.state & gtk.gdk.SHIFT_MASK): if (event.state & gtk.gdk.SHIFT_MASK):
return 0 return 0
txt_buffer = widget.get_buffer() message_buffer = widget.get_buffer()
start_iter = txt_buffer.get_start_iter() start_iter = message_buffer.get_start_iter()
end_iter = txt_buffer.get_end_iter() end_iter = message_buffer.get_end_iter()
txt = txt_buffer.get_text(start_iter, end_iter, 0) message = message_buffer.get_text(start_iter, end_iter, 0)
if txt != '': if message != '':
keyID = '' keyID = ''
jid = self.get_active_jid() jid = self.get_active_jid()
if self.widgets[jid]['toggle_gpg'].get_active(): if self.xmls[jid].get_widget('gpg_togglebutton').get_active():
keyID = self.users[jid].keyID keyID = self.users[jid].keyID
self.plugin.send('MSG', self.account, (jid, txt, keyID)) self.plugin.send('MSG', self.account, (jid, message, keyID))
txt_buffer.set_text('', -1) message_buffer.set_text('', -1)
self.print_conversation(txt, jid, jid) self.print_conversation(message, jid, jid)
return 1 return 1
return 0 return 0
def on_chat_key_press_event(self, widget, event): def on_tabbed_chat_window_key_press_event(self, widget, event):
nb = self.xml.get_widget("notebook")
st = "1234567890" st = "1234567890"
if event.keyval == gtk.keysyms.Escape: if event.keyval == gtk.keysyms.Escape:
jid = self.get_active_jid() jid = self.get_active_jid()
self.remove_tab(jid) self.remove_tab(jid)
elif event.string and event.string in st \ elif event.string and event.string in st \
and (event.state & gtk.gdk.MOD1_MASK): and (event.state & gtk.gdk.MOD1_MASK):
nb.set_current_page(st.index(event.string)) self.chat_notebook.set_current_page(st.index(event.string))
elif event.keyval == gtk.keysyms.Page_Down and \ elif event.keyval == gtk.keysyms.Page_Down and \
(event.state & gtk.gdk.CONTROL_MASK): (event.state & gtk.gdk.CONTROL_MASK):
current = nb.get_current_page() current = self.chat_notebook.get_current_page()
if current > 0: if current > 0:
nb.set_current_page(current-1) self.chat_notebook.set_current_page(current-1)
else: else:
nb.set_current_page(nb.get_n_pages()-1) self.chat_notebook.set_current_page(\
self.chat_notebook.get_n_pages()-1)
elif event.keyval == gtk.keysyms.Page_Up and \ elif event.keyval == gtk.keysyms.Page_Up and \
(event.state & gtk.gdk.CONTROL_MASK): (event.state & gtk.gdk.CONTROL_MASK):
current = nb.get_current_page() current = self.chat_notebook.get_current_page()
if current < (nb.get_n_pages()-1): if current < (self.chat_notebook.get_n_pages()-1):
nb.set_current_page(current+1) self.chat_notebook.set_current_page(current+1)
else: else:
nb.set_current_page(0) self.chat_notebook.set_current_page(0)
def on_button_contact_clicked(self, widget): def on_contact_button_clicked(self, widget):
"""When button contact is clicked""" """When button contact is clicked"""
jid = self.get_active_jid() jid = self.get_active_jid()
user = self.users[jid] user = self.users[jid]
@ -505,8 +455,8 @@ class tabbed_chat_window:
jid = self.get_active_jid() jid = self.get_active_jid()
user = self.users[jid] user = self.users[jid]
while not q.empty(): while not q.empty():
evt = q.get() event = q.get()
self.print_conversation(evt[0], jid, tim = evt[1]) self.print_conversation(event[0], jid, tim = event[1])
self.plugin.roster.nb_unread -= 1 self.plugin.roster.nb_unread -= 1
self.plugin.roster.show_title() self.plugin.roster.show_title()
del self.plugin.queues[self.account][jid] del self.plugin.queues[self.account][jid]
@ -518,27 +468,27 @@ class tabbed_chat_window:
if len(self.plugin.roster.contacts[self.account][jid]) == 1: if len(self.plugin.roster.contacts[self.account][jid]) == 1:
self.plugin.roster.remove_user(user, self.account) self.plugin.roster.remove_user(user, self.account)
def print_conversation(self, txt, jid, contact = None, tim = None): def print_conversation(self, text, jid, contact = None, tim = None):
"""Print a line in the conversation : """Print a line in the conversation :
if contact is set to status : it's a status message if contact is set to status : it's a status message
if contact is set to another value : it's an outgoing message if contact is set to another value : it's an outgoing message
if contact is not set : it's an incomming message""" if contact is not set : it's an incomming message"""
user = self.users[jid] user = self.users[jid]
conversation = self.widgets[jid]['conversation'] conversation_textview = self.xmls[jid].get_widget('conversation_textview')
buffer = conversation.get_buffer() conversation_buffer = conversation_textview.get_buffer()
if not txt: if not text:
txt = "" text = ""
end_iter = buffer.get_end_iter() end_iter = conversation_buffer.get_end_iter()
if not tim: if not tim:
tim = time.localtime() tim = time.localtime()
tims = time.strftime("[%H:%M:%S]", tim) tims = time.strftime("[%H:%M:%S]", tim)
buffer.insert(end_iter, tims + ' ') conversation_buffer.insert(end_iter, tims + ' ')
otxt = '' otext = ''
ttxt = '' ttext = ''
if contact == 'status': if contact == 'status':
tag = 'status' tag = 'status'
ttxt = txt + '\n' ttext = text + '\n'
else: else:
if contact: if contact:
tag = 'outgoing' tag = 'outgoing'
@ -547,241 +497,39 @@ class tabbed_chat_window:
tag = 'incoming' tag = 'incoming'
name = user.name name = user.name
if string.find(txt, '/me ') == 0: if string.find(text, '/me ') == 0:
ttxt = name + ' ' + txt[4:] + '\n' ttext = name + ' ' + text[4:] + '\n'
else: else:
ttxt = '<' + name + '> ' ttext = '<' + name + '> '
otxt = txt + '\n' otext = text + '\n'
buffer.insert_with_tags_by_name(end_iter, ttxt, tag) conversation_buffer.insert_with_tags_by_name(end_iter, ttext, tag)
if len(otxt) > 0: if len(otext) > 0:
beg = 0 beg = 0
if self.plugin.config['useemoticons']: if self.plugin.config['useemoticons']:
index = 0 index = 0
while index < len(otxt): while index < len(otext):
if otxt[index] in self.plugin.roster.begin_emot: if otext[index] in self.plugin.roster.begin_emot:
for s in self.plugin.roster.emoticons: for s in self.plugin.roster.emoticons:
l = len(s) l = len(s)
if s == otxt[index:index+l]: if s == otext[index:index+l]:
buffer.insert(end_iter, otxt[beg:index]) conversation_buffer.insert(end_iter, otext[beg:index])
buffer.insert_pixbuf(end_iter, \ conversation_buffer.insert_pixbuf(end_iter, \
self.plugin.roster.emoticons[s]) self.plugin.roster.emoticons[s])
index+=l index+=l
beg = index beg = index
index+=1 index+=1
buffer.insert(end_iter, otxt[beg:]) conversation_buffer.insert(end_iter, otext[beg:])
#scroll to the end of the textview #scroll to the end of the textview
conversation.scroll_to_mark(buffer.get_mark('end'), 0.1, 0, 0, 0) conversation_textview.scroll_to_mark(conversation_buffer.get_mark('end'),\
0.1, 0, 0, 0)
if (jid != self.get_active_jid() or not self.window.is_active()) and \ if (jid != self.get_active_jid() or not self.window.is_active()) and \
contact != 'status': contact != 'status':
self.nb_unread[jid] += 1 self.nb_unread[jid] += 1
self.redraw_tab(jid) self.redraw_tab(jid)
self.show_title() self.show_title()
class chat_window:
"""Class for chat window"""
def delete_event(self, widget):
"""close window"""
del self.plugin.windows[self.account]['chats'][self.user.jid]
def print_conversation(self, txt, jid, contact = None, tim = None):
"""Print a line in the conversation :
if contact is set to status : it's a status message
if contact is set to another value : it's an outgoing message
if contact is not set : it's an incomming message"""
conversation_textview = self.xml.get_widget('conversation_textview')
conversation_buffer = conversation_textview.get_buffer()
if not txt:
txt = ""
end_iter = conversation_buffer.get_end_iter()
if not tim:
tim = time.localtime()
tims = time.strftime("[%H:%M:%S]", tim)
conversation_buffer.insert(end_iter, tims + ' ')
otxt = ''
ttxt = ''
if contact and contact == 'status':
tag = 'status'
ttxt = txt + '\n'
else:
if contact:
tag = 'outgoing'
name = self.plugin.nicks[self.account]
else:
tag = 'incoming'
name = self.user.name
if string.find(txt, '/me ') == 0:
ttxt = name + ' ' + txt[4:] + '\n'
else:
ttxt = '<' + name + '> '
otxt = txt + '\n'
conversation_buffer.insert_with_tags_by_name(end_iter, ttxt, tag)
if len(otxt) > 0:
beg = 0
if self.plugin.config['useemoticons']:
index = 0
while index < len(otxt):
if otxt[index] in self.plugin.roster.begin_emot:
for s in self.plugin.roster.emoticons:
l = len(s)
if s == otxt[index:index+l]:
conversation_buffer.insert(end_iter, otxt[beg:index])
conversation_buffer.insert_pixbuf(end_iter, self.plugin.roster.emoticons[s])
index+=l
beg = index
index+=1
conversation_buffer.insert(end_iter, otxt[beg:])
#scroll to the end of the textview
conversation_textview.scroll_to_mark(conversation_buffer.get_mark('end'),\
0.1, 0, 0, 0)
if not self.window.is_active() and contact != 'status':
self.nb_unread += 1
self.show_title()
def show_title(self):
start = ""
if self.nb_unread > 1:
start = "[" + str(self.nb_unread) + "] "
elif self.nb_unread == 1:
start = "* "
self.window.set_title(start + self.user.name + " (" + self.account + ")")
def update_tags(self):
self.tagIn.set_property("foreground", self.plugin.config['inmsgcolor'])
self.tagOut.set_property("foreground", self.plugin.config['outmsgcolor'])
self.tagStatus.set_property("foreground", \
self.plugin.config['statusmsgcolor'])
def set_image(self, image, jid):
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
self.status_image.set_from_animation(image.get_animation())
elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
self.status_image.set_from_pixbuf(image.get_pixbuf())
def read_queue(self, q):
"""read queue and print messages containted in it"""
while not q.empty():
evt = q.get()
self.print_conversation(evt[0], self.user.jid, tim = evt[1])
self.plugin.roster.nb_unread -= 1
self.plugin.roster.show_title()
del self.plugin.queues[self.account][self.user.jid]
self.plugin.roster.redraw_jid(self.user.jid, self.account)
self.plugin.systray.remove_jid(self.user.jid, self.account)
showOffline = self.plugin.config['showoffline']
if (self.user.show == 'offline' or self.user.show == 'error') and \
not showOffline:
if len(self.plugin.roster.contacts[self.account][self.user.jid]) == 1:
self.plugin.roster.remove_user(self.user, self.account)
def on_chat_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape:
widget.get_toplevel().destroy()
def on_msg_key_press_event(self, widget, event):
"""When a key is pressed :
if enter is pressed without the shit key, message (if not empty) is sent
and printed in the conversation"""
if event.keyval == gtk.keysyms.Return:
if (event.state & gtk.gdk.SHIFT_MASK):
return 0
message_buffer = widget.get_buffer()
start_iter = message_buffer.get_start_iter()
end_iter = message_buffer.get_end_iter()
txt = message_buffer.get_text(start_iter, end_iter, 0)
if txt != '':
keyID = ''
if self.xml.get_widget('gpg_toggle_button').get_active():
keyID = self.keyID
self.plugin.send('MSG', self.account, (self.user.jid, txt, keyID))
message_buffer.set_text('', -1)
self.print_conversation(txt, self.user.jid, self.user.jid)
widget.grab_focus()
return 1
return 0
def on_clear(self, widget):
"""When clear button is pressed :
clear the conversation"""
conversation_buffer = self.xml.get_widget('conversation_textview').\
get_buffer()
deb, end = conversation_buffer.get_bounds()
conversation_buffer.delete(deb, end)
def on_history(self, widget):
"""When history button is pressed : call log window"""
if not self.plugin.windows['logs'].has_key(self.user.jid):
self.plugin.windows['logs'][self.user.jid] = history_window(self.plugin, self.user.jid)
def on_focus(self, widget, event):
"""When window get focus"""
self.plugin.systray.remove_jid(self.user.jid, self.account)
if self.nb_unread > 0:
self.nb_unread = 0
self.show_title()
def on_button_contact_clicked(self, widget):
"""When button contact is clicked"""
self.plugin.roster.on_info(widget, self.user, self.account)
def __init__(self, user, plugin, account):
self.user = user
self.plugin = plugin
self.account = account
self.keyID = self.user.keyID
self.nb_unread = 0
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Chat', APP)
self.window = self.xml.get_widget('Chat')
self.show_title()
self.status_image = self.xml.get_widget('status_image')
image = self.plugin.roster.pixbufs[user.show]
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
self.status_image.set_from_animation(image.get_animation())
elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
self.status_image.set_from_pixbuf(image.get_pixbuf())
contact_button = self.xml.get_widget('contact_button')
contact_button.set_label(user.name + ' <' + user.jid + '>')
if not self.keyID:
self.xml.get_widget('gpg_toggle_button').set_sensitive(False)
message_textview = self.xml.get_widget('message_textview')
message_textview.grab_focus()
conversation_textview = self.xml.get_widget('conversation_textview')
conversation_buffer = conversation_textview.get_buffer()
end_iter = conversation_buffer.get_end_iter()
conversation_buffer.create_mark('end', end_iter, 0)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
self.xml.signal_connect('on_clear_clicked', self.on_clear)
self.xml.signal_connect('on_button_contact_clicked', \
self.on_button_contact_clicked)
self.xml.get_widget('button_contact').set_use_underline(False)
self.xml.signal_connect('on_focus', self.on_focus)
self.xml.signal_connect('on_history_clicked', self.on_history)
self.xml.signal_connect('on_msg_key_press_event', \
self.on_msg_key_press_event)
self.xml.signal_connect('on_chat_key_press_event', \
self.on_chat_key_press_event)
self.tagIn = conversation_buffer.create_tag("incoming")
color = self.plugin.config['inmsgcolor']
self.tagIn.set_property("foreground", color)
self.tagOut = conversation_buffer.create_tag("outgoing")
color = self.plugin.config['outmsgcolor']
self.tagOut.set_property("foreground", color)
self.tagStatus = conversation_buffer.create_tag("status")
color = self.plugin.config['statusmsgcolor']
self.tagStatus.set_property("foreground", color)
#print queued messages
if plugin.queues[account].has_key(user.jid):
self.read_queue(plugin.queues[account][user.jid])
if self.user.show != 'online':
self.print_conversation(_("%s is now %s (%s)") % (user.name, \
user.show, user.status), user.jid, 'status')
class gc: class gc:
def delete_event(self, widget): def delete_event(self, widget):
"""close window""" """close window"""
@ -1952,7 +1700,7 @@ class roster_window:
self.set_cb() self.set_cb()
def new_chat(self, user, account): def new_chat(self, user, account):
if USE_TABBED_CHAT: if self.plugin.config['usetabbedchat']:
if not self.plugin.windows[account]['chats'].has_key('tabbed'): if not self.plugin.windows[account]['chats'].has_key('tabbed'):
self.plugin.windows[account]['chats']['tabbed'] = \ self.plugin.windows[account]['chats']['tabbed'] = \
tabbed_chat_window(user, self.plugin, account) tabbed_chat_window(user, self.plugin, account)
@ -1963,7 +1711,7 @@ class roster_window:
self.plugin.windows[account]['chats']['tabbed'].window.present() self.plugin.windows[account]['chats']['tabbed'].window.present()
else: else:
self.plugin.windows[account]['chats'][user.jid] = \ self.plugin.windows[account]['chats'][user.jid] = \
chat_window(user, self.plugin, account) tabbed_chat_window(user, self.plugin, account)
def on_message(self, jid, msg, tim, account): def on_message(self, jid, msg, tim, account):
"""when we receive a message""" """when we receive a message"""
@ -2098,12 +1846,12 @@ class roster_window:
self.tree.expand_row(path, False) self.tree.expand_row(path, False)
else: else:
if self.plugin.windows[account]['chats'].has_key(jid): if self.plugin.windows[account]['chats'].has_key(jid):
if USE_TABBED_CHAT: if self.plugin.config['usetabbedchat']:
self.plugin.windows[account]['chats'][jid].active_tab(jid) self.plugin.windows[account]['chats'][jid].active_tab(jid)
self.plugin.windows[account]['chats'][jid].window.present() self.plugin.windows[account]['chats'][jid].window.present()
elif self.contacts[account].has_key(jid): elif self.contacts[account].has_key(jid):
self.new_chat(self.contacts[account][jid][0], account) self.new_chat(self.contacts[account][jid][0], account)
self.plugin.windows[account]['chats']['tabbed'].active_tab(jid) self.plugin.windows[account]['chats'][jid].active_tab(jid)
def on_roster_treeview_row_expanded(self, widget, iter, path): def on_roster_treeview_row_expanded(self, widget, iter, path):
"""When a row is expanded : """When a row is expanded :
@ -3149,9 +2897,6 @@ class plugin:
break break
if pix: if pix:
gtk.window_set_default_icon(pix) gtk.window_set_default_icon(pix)
if self.config['usetabbedchat']:
global USE_TABBED_CHAT
USE_TABBED_CHAT = 1
self.roster = roster_window(self) self.roster = roster_window(self)
gtk.timeout_add(100, self.read_queue) gtk.timeout_add(100, self.read_queue)
gtk.timeout_add(100, self.read_sleepy) gtk.timeout_add(100, self.read_sleepy)