empathy r839 - in trunk: libempathy-gtk src
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r839 - in trunk: libempathy-gtk src
- Date: Wed, 2 Apr 2008 10:41:46 +0100 (BST)
Author: xclaesse
Date: Wed Apr 2 10:41:46 2008
New Revision: 839
URL: http://svn.gnome.org/viewvc/empathy?rev=839&view=rev
Log:
Move window's glade to empathy-chat-window.glade. Reorder empathy-chat-window.c
Added:
trunk/src/empathy-chat-window.glade
- copied, changed from r838, /trunk/libempathy-gtk/empathy-chat.glade
Modified:
trunk/libempathy-gtk/empathy-chat.glade
trunk/src/empathy-chat-window.c
Modified: trunk/libempathy-gtk/empathy-chat.glade
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.glade (original)
+++ trunk/libempathy-gtk/empathy-chat.glade Wed Apr 2 10:41:46 2008
@@ -118,477 +118,4 @@
</widget>
</child>
</widget>
- <widget class="GtkWindow" id="chat_window">
- <property name="title" translatable="yes">Chat</property>
- <property name="default_width">350</property>
- <property name="default_height">250</property>
- <child>
- <widget class="GtkVBox" id="chat_vbox">
- <property name="visible">True</property>
- <child>
- <widget class="GtkMenuBar" id="chats_menubar">
- <property name="visible">True</property>
- <child>
- <widget class="GtkMenuItem" id="menu_conv">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Conversation</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu_conv_menu">
- <child>
- <widget class="GtkImageMenuItem" id="menu_conv_clear">
- <property name="visible">True</property>
- <property name="label" translatable="yes">C_lear</property>
- <property name="use_underline">True</property>
- <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- <child internal-child="image">
- <widget class="GtkImage" id="image262">
- <property name="visible">True</property>
- <property name="stock">gtk-clear</property>
- <property name="icon_size">1</property>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_conv_insert_smiley">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Insert _Smiley</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separator13">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_conv_call">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Ca_ll</property>
- <property name="use_underline">True</property>
- <child internal-child="image">
- <widget class="GtkImage" id="menu_conv_call_image">
- <property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">gnome-stock-mic</property>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="menu_conv_call_separator">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_conv_log">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_View Previous Conversations</property>
- <property name="use_underline">True</property>
- <accelerator key="F3" modifiers="" signal="activate"/>
- <child internal-child="image">
- <widget class="GtkImage" id="image263">
- <property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">document-open-recent</property>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="menu_conv_separator">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_conv_add_contact">
- <property name="label" translatable="yes">_Add Contact...</property>
- <property name="use_underline">True</property>
- <child internal-child="image">
- <widget class="GtkImage" id="image264">
- <property name="visible">True</property>
- <property name="stock">gtk-add</property>
- <property name="icon_size">1</property>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_conv_info">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Contact Infor_mation</property>
- <property name="use_underline">True</property>
- <child internal-child="image">
- <widget class="GtkImage" id="image265">
- <property name="visible">True</property>
- <property name="stock">gtk-info</property>
- <property name="icon_size">1</property>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separator7">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_conv_close">
- <property name="visible">True</property>
- <property name="label" translatable="yes">gtk-close</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <accelerator key="W" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_room">
- <property name="label" translatable="yes">_Room</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu_room_menu">
- <child>
- <widget class="GtkMenuItem" id="menu_room_set_topic">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Change _Topic...</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separator12">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_room_join_new">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Join _New...</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_room_invite">
- <property name="visible">True</property>
- <property name="label" translatable="yes">In_vite...</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separator7">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_room_add">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Add To Favorites</property>
- <property name="use_underline">True</property>
- <child internal-child="image">
- <widget class="GtkImage" id="image268">
- <property name="visible">True</property>
- <property name="stock">gtk-add</property>
- <property name="icon_size">1</property>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separator10">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkCheckMenuItem" id="menu_room_show_contacts">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Show Contacts</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <accelerator key="F11" modifiers="" signal="activate"/>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_edit">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Edit</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu_edit_menu">
- <child>
- <widget class="GtkImageMenuItem" id="menu_edit_cut">
- <property name="visible">True</property>
- <property name="label" translatable="yes">gtk-cut</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <accelerator key="X" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_edit_copy">
- <property name="visible">True</property>
- <property name="label" translatable="yes">gtk-copy</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_edit_paste">
- <property name="visible">True</property>
- <property name="label" translatable="yes">gtk-paste</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <accelerator key="V" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_tabs">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Tabs</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu_tabs_menu">
- <child>
- <widget class="GtkMenuItem" id="menu_tabs_prev">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Previous Tab</property>
- <property name="use_underline">True</property>
- <accelerator key="Page_Up" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_tabs_next">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Next Tab</property>
- <property name="use_underline">True</property>
- <accelerator key="Page_Down" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separator4">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_tabs_left">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Move Tab _Left</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_tabs_right">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Move Tab _Right</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_tabs_detach">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Detach Tab</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menu_help">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Help</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu_help_menu">
- <child>
- <widget class="GtkImageMenuItem" id="menu_help_contents">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Contents</property>
- <property name="use_underline">True</property>
- <accelerator key="F1" modifiers="" signal="activate"/>
- <child internal-child="image">
- <widget class="GtkImage" id="image289">
- <property name="visible">True</property>
- <property name="stock">gtk-help</property>
- <property name="icon_size">1</property>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="menu_help_about">
- <property name="visible">True</property>
- <property name="label">gtk-about</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- <widget class="GtkDialog" id="chat_invite_dialog">
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Invite</property>
- <property name="modal">True</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="default_width">275</property>
- <property name="default_height">225</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="has_separator">False</property>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="vbox6">
- <property name="visible">True</property>
- <child>
- <widget class="GtkVBox" id="vbox7">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <property name="spacing">18</property>
- <child>
- <widget class="GtkVBox" id="vbox7">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkLabel" id="label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Select who would you like to invite:</property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <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>
- <child>
- <widget class="GtkTreeView" id="treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox8">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Invitation _message:</property>
- <property name="use_markup">True</property>
- <property name="use_underline">True</property>
- <property name="wrap">True</property>
- <property name="mnemonic_widget">entry</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkEntry" id="entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">True</property>
- <property name="width_chars">40</property>
- <property name="text" translatable="yes">You have been invited to join a chat conference.</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <child>
- <widget class="GtkButton" id="button_cancel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
- <child>
- <widget class="GtkButton" id="button_invite">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="label">In_vite</property>
- <property name="use_underline">True</property>
- <property name="response_id">-5</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
</glade-interface>
Modified: trunk/src/empathy-chat-window.c
==============================================================================
--- trunk/src/empathy-chat-window.c (original)
+++ trunk/src/empathy-chat-window.c Wed Apr 2 10:41:46 2008
@@ -46,8 +46,6 @@
#include <libempathy-gtk/empathy-images.h>
#include <libempathy-gtk/empathy-conf.h>
-#include <libempathy-gtk/empathy-private-chat.h>
-#include <libempathy-gtk/empathy-group-chat.h>
#include <libempathy-gtk/empathy-contact-dialogs.h>
#include <libempathy-gtk/empathy-log-window.h>
#include <libempathy-gtk/empathy-ui-utils.h>
@@ -63,17 +61,15 @@
struct _EmpathyChatWindowPriv {
EmpathyChatroomManager *chatroom_manager;
- GList *chats;
- GList *chats_new_msg;
- GList *chats_composing;
-
+ GList *chats;
+ GList *chats_new_msg;
+ GList *chats_composing;
EmpathyChat *current_chat;
-
- gboolean page_added;
- gboolean dnd_same_window;
-
- GtkWidget *dialog;
- GtkWidget *notebook;
+ gboolean page_added;
+ gboolean dnd_same_window;
+ guint save_geometry_id;
+ GtkWidget *dialog;
+ GtkWidget *notebook;
/* Menu items. */
GtkWidget *menu_conv_clear;
@@ -105,127 +101,11 @@
GtkWidget *menu_help_contents;
GtkWidget *menu_help_about;
-
- guint save_geometry_id;
};
-static void empathy_chat_window_class_init (EmpathyChatWindowClass *klass);
-static void empathy_chat_window_init (EmpathyChatWindow *window);
-static void empathy_chat_window_finalize (GObject *object);
-static void chat_window_accel_cb (GtkAccelGroup *accelgroup,
- GObject *object,
- guint key,
- GdkModifierType mod,
- EmpathyChatWindow *window);
-static void chat_window_close_clicked_cb (GtkWidget *button,
- EmpathyChat *chat);
-static GtkWidget *chat_window_create_label (EmpathyChatWindow *window,
- EmpathyChat *chat);
-static void chat_window_update_status (EmpathyChatWindow *window,
- EmpathyChat *chat);
-static void chat_window_update_title (EmpathyChatWindow *window,
- EmpathyChat *chat);
-static void chat_window_update_menu (EmpathyChatWindow *window);
-static gboolean chat_window_save_geometry_timeout_cb (EmpathyChatWindow *window);
-static gboolean chat_window_configure_event_cb (GtkWidget *widget,
- GdkEventConfigure *event,
- EmpathyChatWindow *window);
-static void chat_window_conv_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_clear_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_info_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_add_contact_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_call_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_log_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_show_contacts_toggled_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_edit_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_insert_smiley_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_close_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_room_set_topic_activate_cb(GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_room_join_new_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_room_invite_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_room_add_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_cut_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_copy_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_paste_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_tabs_left_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_tabs_right_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_detach_activate_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_help_contents_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static void chat_window_help_about_cb (GtkWidget *menuitem,
- EmpathyChatWindow *window);
-static gboolean chat_window_delete_event_cb (GtkWidget *dialog,
- GdkEvent *event,
- EmpathyChatWindow *window);
-static void chat_window_status_changed_cb (EmpathyChat *chat,
- EmpathyChatWindow *window);
-static void chat_window_update_tooltip (EmpathyChatWindow *window,
- EmpathyChat *chat);
-static void chat_window_name_changed_cb (EmpathyChat *chat,
- const gchar *name,
- EmpathyChatWindow *window);
-static void chat_window_composing_cb (EmpathyChat *chat,
- gboolean is_composing,
- EmpathyChatWindow *window);
-static void chat_window_new_message_cb (EmpathyChat *chat,
- EmpathyMessage *message,
- gboolean is_backlog,
- EmpathyChatWindow *window);
-static GtkNotebook* chat_window_detach_hook (GtkNotebook *source,
- GtkWidget *page,
- gint x,
- gint y,
- gpointer user_data);
-static void chat_window_page_switched_cb (GtkNotebook *notebook,
- GtkNotebookPage *page,
- gint page_num,
- EmpathyChatWindow *window);
-static void chat_window_page_reordered_cb (GtkNotebook *notebook,
- GtkWidget *widget,
- guint page_num,
- EmpathyChatWindow *window);
-static void chat_window_page_added_cb (GtkNotebook *notebook,
- GtkWidget *child,
- guint page_num,
- EmpathyChatWindow *window);
-static void chat_window_page_removed_cb (GtkNotebook *notebook,
- GtkWidget *child,
- guint page_num,
- EmpathyChatWindow *window);
-static gboolean chat_window_focus_in_event_cb (GtkWidget *widget,
- GdkEvent *event,
- EmpathyChatWindow *window);
-static void chat_window_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- GtkSelectionData *selection,
- guint info,
- guint time,
- EmpathyChatWindow *window);
-static void chat_window_set_urgency_hint (EmpathyChatWindow *window,
- gboolean urgent);
-
+static void empathy_chat_window_class_init (EmpathyChatWindowClass *klass);
+static void empathy_chat_window_init (EmpathyChatWindow *window);
+static void chat_window_finalize (GObject *object);
static GList *chat_windows = NULL;
@@ -247,374 +127,127 @@
G_DEFINE_TYPE (EmpathyChatWindow, empathy_chat_window, G_TYPE_OBJECT);
static void
-empathy_chat_window_class_init (EmpathyChatWindowClass *klass)
+chat_window_accel_cb (GtkAccelGroup *accelgroup,
+ GObject *object,
+ guint key,
+ GdkModifierType mod,
+ EmpathyChatWindow *window)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EmpathyChatWindowPriv *priv;
+ gint num = -1;
+ gint i;
- object_class->finalize = empathy_chat_window_finalize;
+ priv = GET_PRIV (window);
- g_type_class_add_private (object_class, sizeof (EmpathyChatWindowPriv));
+ for (i = 0; i < G_N_ELEMENTS (tab_accel_keys); i++) {
+ if (tab_accel_keys[i] == key) {
+ num = i;
+ break;
+ }
+ }
- /* Set up a style for the close button with no focus padding. */
- gtk_rc_parse_string (
- "style \"empathy-close-button-style\"\n"
- "{\n"
- " GtkWidget::focus-padding = 0\n"
- " xthickness = 0\n"
- " ythickness = 0\n"
- "}\n"
- "widget \"*.empathy-close-button\" style \"empathy-close-button-style\"");
+ if (num != -1) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), num);
+ }
+}
- gtk_notebook_set_window_creation_hook (chat_window_detach_hook, NULL, NULL);
+static EmpathyChatWindow *
+chat_window_find_chat (EmpathyChat *chat)
+{
+ EmpathyChatWindowPriv *priv;
+ GList *l, *ll;
+
+ for (l = chat_windows; l; l = l->next) {
+ priv = GET_PRIV (l->data);
+ ll = g_list_find (priv->chats, chat);
+ if (ll) {
+ return l->data;
+ }
+ }
+
+ return NULL;
}
static void
-empathy_chat_window_init (EmpathyChatWindow *window)
+chat_window_close_clicked_cb (GtkWidget *button,
+ EmpathyChat *chat)
{
- EmpathyChatWindowPriv *priv;
- GladeXML *glade;
- GtkAccelGroup *accel_group;
- GtkWidget *image;
- GClosure *closure;
- GtkWidget *menu_conv;
- GtkWidget *menu;
- gint i;
- GtkWidget *chat_vbox;
- gchar *filename;
+ EmpathyChatWindow *window;
- priv = GET_PRIV (window);
+ window = chat_window_find_chat (chat);
+ empathy_chat_window_remove_chat (window, chat);
+}
- filename = empathy_file_lookup ("empathy-chat.glade", "libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "chat_window",
- NULL,
- "chat_window", &priv->dialog,
- "chat_vbox", &chat_vbox,
- "menu_conv", &menu_conv,
- "menu_conv_clear", &priv->menu_conv_clear,
- "menu_conv_insert_smiley", &priv->menu_conv_insert_smiley,
- "menu_conv_call", &priv->menu_conv_call,
- "menu_conv_call_separator", &priv->menu_conv_call_separator,
- "menu_conv_log", &priv->menu_conv_log,
- "menu_conv_separator", &priv->menu_conv_separator,
- "menu_conv_add_contact", &priv->menu_conv_add_contact,
- "menu_conv_info", &priv->menu_conv_info,
- "menu_conv_close", &priv->menu_conv_close,
- "menu_room", &priv->menu_room,
- "menu_room_set_topic", &priv->menu_room_set_topic,
- "menu_room_join_new", &priv->menu_room_join_new,
- "menu_room_invite", &priv->menu_room_invite,
- "menu_room_add", &priv->menu_room_add,
- "menu_room_show_contacts", &priv->menu_room_show_contacts,
- "menu_edit_cut", &priv->menu_edit_cut,
- "menu_edit_copy", &priv->menu_edit_copy,
- "menu_edit_paste", &priv->menu_edit_paste,
- "menu_tabs_next", &priv->menu_tabs_next,
- "menu_tabs_prev", &priv->menu_tabs_prev,
- "menu_tabs_left", &priv->menu_tabs_left,
- "menu_tabs_right", &priv->menu_tabs_right,
- "menu_tabs_detach", &priv->menu_tabs_detach,
- "menu_help_contents", &priv->menu_help_contents,
- "menu_help_about", &priv->menu_help_about,
- NULL);
- g_free (filename);
+static void
+chat_window_close_button_style_set_cb (GtkWidget *button,
+ GtkStyle *previous_style,
+ gpointer user_data)
+{
+ gint h, w;
- empathy_glade_connect (glade,
- window,
- "chat_window", "configure-event", chat_window_configure_event_cb,
- "menu_conv", "activate", chat_window_conv_activate_cb,
- "menu_conv_clear", "activate", chat_window_clear_activate_cb,
- "menu_conv_call", "activate", chat_window_call_activate_cb,
- "menu_conv_log", "activate", chat_window_log_activate_cb,
- "menu_conv_add_contact", "activate", chat_window_add_contact_activate_cb,
- "menu_conv_info", "activate", chat_window_info_activate_cb,
- "menu_conv_close", "activate", chat_window_close_activate_cb,
- "menu_room_set_topic", "activate", chat_window_room_set_topic_activate_cb,
- "menu_room_join_new", "activate", chat_window_room_join_new_activate_cb,
- "menu_room_invite", "activate", chat_window_room_invite_activate_cb,
- "menu_room_add", "activate", chat_window_room_add_activate_cb,
- "menu_edit", "activate", chat_window_edit_activate_cb,
- "menu_edit_cut", "activate", chat_window_cut_activate_cb,
- "menu_edit_copy", "activate", chat_window_copy_activate_cb,
- "menu_edit_paste", "activate", chat_window_paste_activate_cb,
- "menu_tabs_left", "activate", chat_window_tabs_left_activate_cb,
- "menu_tabs_right", "activate", chat_window_tabs_right_activate_cb,
- "menu_tabs_detach", "activate", chat_window_detach_activate_cb,
- "menu_help_contents", "activate", chat_window_help_contents_cb,
- "menu_help_about", "activate", chat_window_help_about_cb,
- NULL);
+ gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
+ GTK_ICON_SIZE_MENU, &w, &h);
- g_object_unref (glade);
+ gtk_widget_set_size_request (button, w, h);
+}
- /* Set up chatroom manager */
- priv->chatroom_manager = empathy_chatroom_manager_new ();
- g_signal_connect_swapped (priv->chatroom_manager, "chatroom-added",
- G_CALLBACK (chat_window_update_menu),
- window);
- g_signal_connect_swapped (priv->chatroom_manager, "chatroom-removed",
- G_CALLBACK (chat_window_update_menu),
- window);
+static void
+chat_window_update_tooltip (EmpathyChatWindow *window,
+ EmpathyChat *chat)
+{
+ EmpathyChatWindowPriv *priv;
+ GtkWidget *widget;
+ const gchar *tooltip;
+ gchar *str = NULL;
- priv->notebook = gtk_notebook_new ();
- gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), "EmpathyChatWindow");
- gtk_box_pack_start (GTK_BOX (chat_vbox), priv->notebook, TRUE, TRUE, 0);
- gtk_widget_show (priv->notebook);
+ priv = GET_PRIV (window);
- /* Set up accels */
- accel_group = gtk_accel_group_new ();
- gtk_window_add_accel_group (GTK_WINDOW (priv->dialog), accel_group);
+ tooltip = empathy_chat_get_tooltip (chat);
- for (i = 0; i < G_N_ELEMENTS (tab_accel_keys); i++) {
- closure = g_cclosure_new (G_CALLBACK (chat_window_accel_cb),
- window,
- NULL);
- gtk_accel_group_connect (accel_group,
- tab_accel_keys[i],
- GDK_MOD1_MASK,
- 0,
- closure);
+ if (g_list_find (priv->chats_composing, chat)) {
+ str = g_strconcat (tooltip, "\n", _("Typing a message."), NULL);
+ tooltip = str;
}
- g_object_unref (accel_group);
+ widget = g_object_get_data (G_OBJECT (chat), "chat-window-tab-tooltip-widget");
+ gtk_widget_set_tooltip_text (widget, tooltip);
- /* Set the contact information menu item image to the Empathy
- * stock image
- */
- image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (priv->menu_conv_info));
- gtk_image_set_from_icon_name (GTK_IMAGE (image),
- EMPATHY_IMAGE_CONTACT_INFORMATION,
- GTK_ICON_SIZE_MENU);
+ g_free (str);
+}
- /* Set up smiley menu */
- menu = empathy_chat_view_get_smiley_menu (
- G_CALLBACK (chat_window_insert_smiley_activate_cb),
- window);
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (priv->menu_conv_insert_smiley), menu);
+static GtkWidget *
+chat_window_create_label (EmpathyChatWindow *window,
+ EmpathyChat *chat)
+{
+ EmpathyChatWindowPriv *priv;
+ GtkWidget *hbox;
+ GtkWidget *name_label;
+ GtkWidget *status_image;
+ GtkWidget *close_button;
+ GtkWidget *close_image;
+ GtkWidget *event_box;
+ GtkWidget *event_box_hbox;
+ PangoAttrList *attr_list;
+ PangoAttribute *attr;
- /* Set up signals we can't do with glade since we may need to
- * block/unblock them at some later stage.
- */
+ priv = GET_PRIV (window);
- g_signal_connect (priv->dialog,
- "delete_event",
- G_CALLBACK (chat_window_delete_event_cb),
- window);
+ /* The spacing between the button and the label. */
+ hbox = gtk_hbox_new (FALSE, 0);
- g_signal_connect (priv->menu_room_show_contacts,
- "toggled",
- G_CALLBACK (chat_window_show_contacts_toggled_cb),
- window);
+ event_box = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
- g_signal_connect_swapped (priv->menu_tabs_prev,
- "activate",
- G_CALLBACK (gtk_notebook_prev_page),
- priv->notebook);
- g_signal_connect_swapped (priv->menu_tabs_next,
- "activate",
- G_CALLBACK (gtk_notebook_next_page),
- priv->notebook);
+ name_label = gtk_label_new (empathy_chat_get_name (chat));
+ gtk_label_set_ellipsize (GTK_LABEL (name_label), PANGO_ELLIPSIZE_END);
- g_signal_connect (priv->dialog,
- "focus_in_event",
- G_CALLBACK (chat_window_focus_in_event_cb),
- window);
- g_signal_connect_after (priv->notebook,
- "switch_page",
- G_CALLBACK (chat_window_page_switched_cb),
- window);
- g_signal_connect (priv->notebook,
- "page_reordered",
- G_CALLBACK (chat_window_page_reordered_cb),
- window);
- g_signal_connect (priv->notebook,
- "page_added",
- G_CALLBACK (chat_window_page_added_cb),
- window);
- g_signal_connect (priv->notebook,
- "page_removed",
- G_CALLBACK (chat_window_page_removed_cb),
- window);
-
- /* Set up drag and drop */
- gtk_drag_dest_set (GTK_WIDGET (priv->notebook),
- GTK_DEST_DEFAULT_ALL,
- drag_types_dest,
- G_N_ELEMENTS (drag_types_dest),
- GDK_ACTION_MOVE);
-
- g_signal_connect (priv->notebook,
- "drag-data-received",
- G_CALLBACK (chat_window_drag_data_received),
- window);
-
- chat_windows = g_list_prepend (chat_windows, window);
-
- /* Set up private details */
- priv->chats = NULL;
- priv->chats_new_msg = NULL;
- priv->chats_composing = NULL;
- priv->current_chat = NULL;
-}
-
-/* Returns the window to open a new tab in if there is only one window
- * visble, otherwise, returns NULL indicating that a new window should
- * be added.
- */
-EmpathyChatWindow *
-empathy_chat_window_get_default (void)
-{
- GList *l;
- gboolean separate_windows = TRUE;
-
- empathy_conf_get_bool (empathy_conf_get (),
- EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
- &separate_windows);
-
- if (separate_windows) {
- /* Always create a new window */
- return NULL;
- }
-
- for (l = chat_windows; l; l = l->next) {
- EmpathyChatWindow *chat_window;
- GtkWidget *dialog;
-
- chat_window = l->data;
-
- dialog = empathy_chat_window_get_dialog (chat_window);
- if (empathy_window_get_is_visible (GTK_WINDOW (GTK_WINDOW (dialog)))) {
- /* Found a visible window on this desktop */
- return chat_window;
- }
- }
-
- return NULL;
-}
-
-static void
-empathy_chat_window_finalize (GObject *object)
-{
- EmpathyChatWindow *window;
- EmpathyChatWindowPriv *priv;
-
- window = EMPATHY_CHAT_WINDOW (object);
- priv = GET_PRIV (window);
-
- empathy_debug (DEBUG_DOMAIN, "Finalized: %p", object);
-
- if (priv->save_geometry_id != 0) {
- g_source_remove (priv->save_geometry_id);
- }
-
- chat_windows = g_list_remove (chat_windows, window);
- gtk_widget_destroy (priv->dialog);
-
- g_signal_handlers_disconnect_by_func (priv->chatroom_manager,
- chat_window_update_menu,
- window);
- g_object_unref (priv->chatroom_manager);
-
- G_OBJECT_CLASS (empathy_chat_window_parent_class)->finalize (object);
-}
-
-static void
-chat_window_accel_cb (GtkAccelGroup *accelgroup,
- GObject *object,
- guint key,
- GdkModifierType mod,
- EmpathyChatWindow *window)
-{
- EmpathyChatWindowPriv *priv;
- gint num = -1;
- gint i;
-
- priv = GET_PRIV (window);
-
- for (i = 0; i < G_N_ELEMENTS (tab_accel_keys); i++) {
- if (tab_accel_keys[i] == key) {
- num = i;
- break;
- }
- }
-
- if (num != -1) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), num);
- }
-}
-
-static EmpathyChatWindow *
-chat_window_find_chat (EmpathyChat *chat)
-{
- EmpathyChatWindowPriv *priv;
- GList *l, *ll;
-
- for (l = chat_windows; l; l = l->next) {
- priv = GET_PRIV (l->data);
- ll = g_list_find (priv->chats, chat);
- if (ll) {
- return l->data;
- }
- }
-
- return NULL;
-}
-
-static void
-chat_window_close_clicked_cb (GtkWidget *button,
- EmpathyChat *chat)
-{
- EmpathyChatWindow *window;
-
- window = chat_window_find_chat (chat);
- empathy_chat_window_remove_chat (window, chat);
-}
-
-static void
-chat_window_close_button_style_set_cb (GtkWidget *button,
- GtkStyle *previous_style,
- gpointer user_data)
-{
- gint h, w;
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
- GTK_ICON_SIZE_MENU, &w, &h);
-
- gtk_widget_set_size_request (button, w, h);
-}
-
-static GtkWidget *
-chat_window_create_label (EmpathyChatWindow *window,
- EmpathyChat *chat)
-{
- EmpathyChatWindowPriv *priv;
- GtkWidget *hbox;
- GtkWidget *name_label;
- GtkWidget *status_image;
- GtkWidget *close_button;
- GtkWidget *close_image;
- GtkWidget *event_box;
- GtkWidget *event_box_hbox;
- PangoAttrList *attr_list;
- PangoAttribute *attr;
-
- priv = GET_PRIV (window);
-
- /* The spacing between the button and the label. */
- hbox = gtk_hbox_new (FALSE, 0);
-
- event_box = gtk_event_box_new ();
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
-
- name_label = gtk_label_new (empathy_chat_get_name (chat));
- gtk_label_set_ellipsize (GTK_LABEL (name_label), PANGO_ELLIPSIZE_END);
-
- attr_list = pango_attr_list_new ();
- attr = pango_attr_scale_new (1/1.2);
- attr->start_index = 0;
- attr->end_index = -1;
- pango_attr_list_insert (attr_list, attr);
- gtk_label_set_attributes (GTK_LABEL (name_label), attr_list);
- pango_attr_list_unref (attr_list);
+ attr_list = pango_attr_list_new ();
+ attr = pango_attr_scale_new (1/1.2);
+ attr->start_index = 0;
+ attr->end_index = -1;
+ pango_attr_list_insert (attr_list, attr);
+ gtk_label_set_attributes (GTK_LABEL (name_label), attr_list);
+ pango_attr_list_unref (attr_list);
gtk_misc_set_padding (GTK_MISC (name_label), 2, 0);
gtk_misc_set_alignment (GTK_MISC (name_label), 0.0, 0.5);
@@ -673,32 +306,6 @@
}
static void
-chat_window_update_status (EmpathyChatWindow *window,
- EmpathyChat *chat)
-{
- EmpathyChatWindowPriv *priv;
- GtkImage *image;
- const gchar *icon_name = NULL;
-
- priv = GET_PRIV (window);
-
- if (g_list_find (priv->chats_new_msg, chat)) {
- icon_name = EMPATHY_IMAGE_MESSAGE;
- }
- else if (g_list_find (priv->chats_composing, chat)) {
- icon_name = EMPATHY_IMAGE_TYPING;
- }
- else {
- icon_name = empathy_chat_get_status_icon_name (chat);
- }
- image = g_object_get_data (G_OBJECT (chat), "chat-window-tab-image");
- gtk_image_set_from_icon_name (image, icon_name, GTK_ICON_SIZE_MENU);
-
- chat_window_update_title (window, chat);
- chat_window_update_tooltip (window, chat);
-}
-
-static void
chat_window_update_title (EmpathyChatWindow *window,
EmpathyChat *chat)
{
@@ -728,6 +335,32 @@
}
static void
+chat_window_update_status (EmpathyChatWindow *window,
+ EmpathyChat *chat)
+{
+ EmpathyChatWindowPriv *priv;
+ GtkImage *image;
+ const gchar *icon_name = NULL;
+
+ priv = GET_PRIV (window);
+
+ if (g_list_find (priv->chats_new_msg, chat)) {
+ icon_name = EMPATHY_IMAGE_MESSAGE;
+ }
+ else if (g_list_find (priv->chats_composing, chat)) {
+ icon_name = EMPATHY_IMAGE_TYPING;
+ }
+ else {
+ icon_name = empathy_chat_get_status_icon_name (chat);
+ }
+ image = g_object_get_data (G_OBJECT (chat), "chat-window-tab-image");
+ gtk_image_set_from_icon_name (image, icon_name, GTK_ICON_SIZE_MENU);
+
+ chat_window_update_title (window, chat);
+ chat_window_update_tooltip (window, chat);
+}
+
+static void
chat_window_update_menu (EmpathyChatWindow *window)
{
EmpathyChatWindowPriv *priv;
@@ -1293,32 +926,6 @@
}
static void
-chat_window_update_tooltip (EmpathyChatWindow *window,
- EmpathyChat *chat)
-{
- EmpathyChatWindowPriv *priv;
- GtkWidget *widget;
- gchar *current_tooltip;
- gchar *str;
-
- priv = GET_PRIV (window);
-
- current_tooltip = empathy_chat_get_tooltip (chat);
-
- if (g_list_find (priv->chats_composing, chat)) {
- str = g_strconcat (current_tooltip, "\n", _("Typing a message."), NULL);
- g_free (current_tooltip);
- } else {
- str = current_tooltip;
- }
-
- widget = g_object_get_data (G_OBJECT (chat), "chat-window-tab-tooltip-widget");
- gtk_widget_set_tooltip_text (widget, str);
-
- g_free (str);
-}
-
-static void
chat_window_name_changed_cb (EmpathyChat *chat,
const gchar *name,
EmpathyChatWindow *window)
@@ -1697,10 +1304,281 @@
gtk_window_set_urgency_hint (GTK_WINDOW (priv->dialog), urgent);
}
-EmpathyChatWindow *
-empathy_chat_window_new (void)
+static void
+chat_window_finalize (GObject *object)
{
- return EMPATHY_CHAT_WINDOW (g_object_new (EMPATHY_TYPE_CHAT_WINDOW, NULL));
+ EmpathyChatWindow *window;
+ EmpathyChatWindowPriv *priv;
+
+ window = EMPATHY_CHAT_WINDOW (object);
+ priv = GET_PRIV (window);
+
+ empathy_debug (DEBUG_DOMAIN, "Finalized: %p", object);
+
+ if (priv->save_geometry_id != 0) {
+ g_source_remove (priv->save_geometry_id);
+ }
+
+ chat_windows = g_list_remove (chat_windows, window);
+ gtk_widget_destroy (priv->dialog);
+
+ g_signal_handlers_disconnect_by_func (priv->chatroom_manager,
+ chat_window_update_menu,
+ window);
+ g_object_unref (priv->chatroom_manager);
+
+ G_OBJECT_CLASS (empathy_chat_window_parent_class)->finalize (object);
+}
+
+static void
+empathy_chat_window_class_init (EmpathyChatWindowClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = empathy_chat_window_finalize;
+
+ g_type_class_add_private (object_class, sizeof (EmpathyChatWindowPriv));
+
+ /* Set up a style for the close button with no focus padding. */
+ gtk_rc_parse_string (
+ "style \"empathy-close-button-style\"\n"
+ "{\n"
+ " GtkWidget::focus-padding = 0\n"
+ " xthickness = 0\n"
+ " ythickness = 0\n"
+ "}\n"
+ "widget \"*.empathy-close-button\" style \"empathy-close-button-style\"");
+
+ gtk_notebook_set_window_creation_hook (chat_window_detach_hook, NULL, NULL);
+}
+
+static void
+empathy_chat_window_init (EmpathyChatWindow *window)
+{
+ EmpathyChatWindowPriv *priv;
+ GladeXML *glade;
+ GtkAccelGroup *accel_group;
+ GtkWidget *image;
+ GClosure *closure;
+ GtkWidget *menu_conv;
+ GtkWidget *menu;
+ gint i;
+ GtkWidget *chat_vbox;
+ gchar *filename;
+
+ priv = GET_PRIV (window);
+
+ filename = empathy_file_lookup ("empathy-chat-window.glade", "src");
+ glade = empathy_glade_get_file (filename,
+ "chat_window",
+ NULL,
+ "chat_window", &priv->dialog,
+ "chat_vbox", &chat_vbox,
+ "menu_conv", &menu_conv,
+ "menu_conv_clear", &priv->menu_conv_clear,
+ "menu_conv_insert_smiley", &priv->menu_conv_insert_smiley,
+ "menu_conv_call", &priv->menu_conv_call,
+ "menu_conv_call_separator", &priv->menu_conv_call_separator,
+ "menu_conv_log", &priv->menu_conv_log,
+ "menu_conv_separator", &priv->menu_conv_separator,
+ "menu_conv_add_contact", &priv->menu_conv_add_contact,
+ "menu_conv_info", &priv->menu_conv_info,
+ "menu_conv_close", &priv->menu_conv_close,
+ "menu_room", &priv->menu_room,
+ "menu_room_set_topic", &priv->menu_room_set_topic,
+ "menu_room_join_new", &priv->menu_room_join_new,
+ "menu_room_invite", &priv->menu_room_invite,
+ "menu_room_add", &priv->menu_room_add,
+ "menu_room_show_contacts", &priv->menu_room_show_contacts,
+ "menu_edit_cut", &priv->menu_edit_cut,
+ "menu_edit_copy", &priv->menu_edit_copy,
+ "menu_edit_paste", &priv->menu_edit_paste,
+ "menu_tabs_next", &priv->menu_tabs_next,
+ "menu_tabs_prev", &priv->menu_tabs_prev,
+ "menu_tabs_left", &priv->menu_tabs_left,
+ "menu_tabs_right", &priv->menu_tabs_right,
+ "menu_tabs_detach", &priv->menu_tabs_detach,
+ "menu_help_contents", &priv->menu_help_contents,
+ "menu_help_about", &priv->menu_help_about,
+ NULL);
+ g_free (filename);
+
+ empathy_glade_connect (glade,
+ window,
+ "chat_window", "configure-event", chat_window_configure_event_cb,
+ "menu_conv", "activate", chat_window_conv_activate_cb,
+ "menu_conv_clear", "activate", chat_window_clear_activate_cb,
+ "menu_conv_call", "activate", chat_window_call_activate_cb,
+ "menu_conv_log", "activate", chat_window_log_activate_cb,
+ "menu_conv_add_contact", "activate", chat_window_add_contact_activate_cb,
+ "menu_conv_info", "activate", chat_window_info_activate_cb,
+ "menu_conv_close", "activate", chat_window_close_activate_cb,
+ "menu_room_set_topic", "activate", chat_window_room_set_topic_activate_cb,
+ "menu_room_join_new", "activate", chat_window_room_join_new_activate_cb,
+ "menu_room_invite", "activate", chat_window_room_invite_activate_cb,
+ "menu_room_add", "activate", chat_window_room_add_activate_cb,
+ "menu_edit", "activate", chat_window_edit_activate_cb,
+ "menu_edit_cut", "activate", chat_window_cut_activate_cb,
+ "menu_edit_copy", "activate", chat_window_copy_activate_cb,
+ "menu_edit_paste", "activate", chat_window_paste_activate_cb,
+ "menu_tabs_left", "activate", chat_window_tabs_left_activate_cb,
+ "menu_tabs_right", "activate", chat_window_tabs_right_activate_cb,
+ "menu_tabs_detach", "activate", chat_window_detach_activate_cb,
+ "menu_help_contents", "activate", chat_window_help_contents_cb,
+ "menu_help_about", "activate", chat_window_help_about_cb,
+ NULL);
+
+ g_object_unref (glade);
+
+ /* Set up chatroom manager */
+ priv->chatroom_manager = empathy_chatroom_manager_new ();
+ g_signal_connect_swapped (priv->chatroom_manager, "chatroom-added",
+ G_CALLBACK (chat_window_update_menu),
+ window);
+ g_signal_connect_swapped (priv->chatroom_manager, "chatroom-removed",
+ G_CALLBACK (chat_window_update_menu),
+ window);
+
+ priv->notebook = gtk_notebook_new ();
+ gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), "EmpathyChatWindow");
+ gtk_box_pack_start (GTK_BOX (chat_vbox), priv->notebook, TRUE, TRUE, 0);
+ gtk_widget_show (priv->notebook);
+
+ /* Set up accels */
+ accel_group = gtk_accel_group_new ();
+ gtk_window_add_accel_group (GTK_WINDOW (priv->dialog), accel_group);
+
+ for (i = 0; i < G_N_ELEMENTS (tab_accel_keys); i++) {
+ closure = g_cclosure_new (G_CALLBACK (chat_window_accel_cb),
+ window,
+ NULL);
+ gtk_accel_group_connect (accel_group,
+ tab_accel_keys[i],
+ GDK_MOD1_MASK,
+ 0,
+ closure);
+ }
+
+ g_object_unref (accel_group);
+
+ /* Set the contact information menu item image to the Empathy
+ * stock image
+ */
+ image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (priv->menu_conv_info));
+ gtk_image_set_from_icon_name (GTK_IMAGE (image),
+ EMPATHY_IMAGE_CONTACT_INFORMATION,
+ GTK_ICON_SIZE_MENU);
+
+ /* Set up smiley menu */
+ menu = empathy_chat_view_get_smiley_menu (
+ G_CALLBACK (chat_window_insert_smiley_activate_cb),
+ window);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (priv->menu_conv_insert_smiley), menu);
+
+ /* Set up signals we can't do with glade since we may need to
+ * block/unblock them at some later stage.
+ */
+
+ g_signal_connect (priv->dialog,
+ "delete_event",
+ G_CALLBACK (chat_window_delete_event_cb),
+ window);
+
+ g_signal_connect (priv->menu_room_show_contacts,
+ "toggled",
+ G_CALLBACK (chat_window_show_contacts_toggled_cb),
+ window);
+
+ g_signal_connect_swapped (priv->menu_tabs_prev,
+ "activate",
+ G_CALLBACK (gtk_notebook_prev_page),
+ priv->notebook);
+ g_signal_connect_swapped (priv->menu_tabs_next,
+ "activate",
+ G_CALLBACK (gtk_notebook_next_page),
+ priv->notebook);
+
+ g_signal_connect (priv->dialog,
+ "focus_in_event",
+ G_CALLBACK (chat_window_focus_in_event_cb),
+ window);
+ g_signal_connect_after (priv->notebook,
+ "switch_page",
+ G_CALLBACK (chat_window_page_switched_cb),
+ window);
+ g_signal_connect (priv->notebook,
+ "page_reordered",
+ G_CALLBACK (chat_window_page_reordered_cb),
+ window);
+ g_signal_connect (priv->notebook,
+ "page_added",
+ G_CALLBACK (chat_window_page_added_cb),
+ window);
+ g_signal_connect (priv->notebook,
+ "page_removed",
+ G_CALLBACK (chat_window_page_removed_cb),
+ window);
+
+ /* Set up drag and drop */
+ gtk_drag_dest_set (GTK_WIDGET (priv->notebook),
+ GTK_DEST_DEFAULT_ALL,
+ drag_types_dest,
+ G_N_ELEMENTS (drag_types_dest),
+ GDK_ACTION_MOVE);
+
+ g_signal_connect (priv->notebook,
+ "drag-data-received",
+ G_CALLBACK (chat_window_drag_data_received),
+ window);
+
+ chat_windows = g_list_prepend (chat_windows, window);
+
+ /* Set up private details */
+ priv->chats = NULL;
+ priv->chats_new_msg = NULL;
+ priv->chats_composing = NULL;
+ priv->current_chat = NULL;
+}
+
+EmpathyChatWindow *
+empathy_chat_window_new (void)
+{
+ return EMPATHY_CHAT_WINDOW (g_object_new (EMPATHY_TYPE_CHAT_WINDOW, NULL));
+}
+
+/* Returns the window to open a new tab in if there is only one window
+ * visble, otherwise, returns NULL indicating that a new window should
+ * be added.
+ */
+EmpathyChatWindow *
+empathy_chat_window_get_default (void)
+{
+ GList *l;
+ gboolean separate_windows = TRUE;
+
+ empathy_conf_get_bool (empathy_conf_get (),
+ EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
+ &separate_windows);
+
+ if (separate_windows) {
+ /* Always create a new window */
+ return NULL;
+ }
+
+ for (l = chat_windows; l; l = l->next) {
+ EmpathyChatWindow *chat_window;
+ GtkWidget *dialog;
+
+ chat_window = l->data;
+
+ dialog = empathy_chat_window_get_dialog (chat_window);
+ if (empathy_window_get_is_visible (GTK_WINDOW (GTK_WINDOW (dialog)))) {
+ /* Found a visible window on this desktop */
+ return chat_window;
+ }
+ }
+
+ return NULL;
}
GtkWidget *
Copied: trunk/src/empathy-chat-window.glade (from r838, /trunk/libempathy-gtk/empathy-chat.glade)
==============================================================================
--- /trunk/libempathy-gtk/empathy-chat.glade (original)
+++ trunk/src/empathy-chat-window.glade Wed Apr 2 10:41:46 2008
@@ -3,122 +3,6 @@
<!--*- mode: xml -*-->
<glade-interface>
<widget class="GtkWindow" id="chat_window">
- <property name="border_width">6</property>
- <property name="title" translatable="yes">Group Chat</property>
- <property name="icon_name">system-users</property>
- <child>
- <widget class="GtkVBox" id="group_chat_widget">
- <property name="visible">True</property>
- <property name="border_width">4</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkHBox" id="hbox_topic">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkLabel" id="label80">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes"><b>Topic:</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label_topic">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="xalign">0</property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
- <property name="single_line_mode">True</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHPaned" id="hpaned">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <widget class="GtkVBox" id="vbox_left">
- <property name="width_request">600</property>
- <property name="height_request">500</property>
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkScrolledWindow" id="scrolled_window_chat">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkScrolledWindow" id="scrolled_window_input">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="resize">True</property>
- <property name="shrink">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkScrolledWindow" id="scrolled_window_contacts">
- <property name="width_request">200</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="resize">True</property>
- <property name="shrink">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <widget class="GtkWindow" id="chat_window">
<property name="title" translatable="yes">Chat</property>
<property name="default_width">350</property>
<property name="default_height">250</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]