diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2007-05-25 05:58:26 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2007-05-25 05:58:26 +0800 |
commit | 654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557 (patch) | |
tree | 206ef8e29eb82baceaaa22281554ecaee58ee221 /libempathy-gtk | |
parent | dfaa395ba24f5ab5d309d30e7f16acd8bb106255 (diff) | |
download | gsoc2013-empathy-654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557.tar gsoc2013-empathy-654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557.tar.gz gsoc2013-empathy-654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557.tar.bz2 gsoc2013-empathy-654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557.tar.lz gsoc2013-empathy-654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557.tar.xz gsoc2013-empathy-654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557.tar.zst gsoc2013-empathy-654ac27bdf5aaac64c9a3ed4e2bfa55eccdd6557.zip |
Preset the server only for jabber protocol to conference.server. This
2007-05-25 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/gossip-new-chatroom-dialog.c: Preset the server only
for jabber protocol to conference.server. This fixes a warning.
* libempathy-gtk/gossip-group-chat.h:
* libempathy-gtk/gossip-group-chat.c: gossip_group_chat_set_topic() is
a public function.
* libempathy-gtk/empathy-images.h:
* libempathy-gtk/empathy-main-window.glade:
* libempathy-gtk/empathy-status-icon.glade: Make use of
empathy-new-message icon name.
* libempathy-gtk/gossip-contact-list-store.c: By default we sort by
contacts names.
* libempathy-gtk/gossip-chat.c: Do not display composing state if
it's our own contact that is composing.
* src/empathy-chat-main.c:
* libempathy/empathy-tp-chat.c:
* libempathy/empathy-tp-chat.h: Make possible to build the id based on
the account and the channel's name. For private chats that means the
contact's id.
* libempathy-gtk/gossip-chat-window.c: Un-comment the code related to
chatrooms that is now implemented. We can now Show/Hide contact list
for group chats, DnD contact on the window to begin a discussion, join
a new chatroom.
* libempathy-gtk/gossip-account-chooser.c: Add a FIXME message.
* data/22x22/empathy-new-message.png:
* data/22x22/empathy-proto-irc.png:
* data/22x22/Makefile.am:
* data/32x32/empathy-proto-irc.png:
* data/32x32/Makefile.am:
* data/gtalk.profile:
* data/16x16/empathy-new-message:
* data/16x16/empathy-message-new.png:
* data/16x16/empathy-proto-irc.png:
* data/16x16/Makefile.am:
* data/scalable/empathy-proto-irc.svg:
* data/scalable/Makefile.am:
* data/irc.profile: Adding icons for empathy-new-message and IRC
protocol. Make use of the irc icon in the irc profile.
svn path=/trunk/; revision=91
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-images.h | 5 | ||||
-rw-r--r-- | libempathy-gtk/empathy-main-window.glade | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-status-icon.glade | 2 | ||||
-rw-r--r-- | libempathy-gtk/gossip-account-chooser.c | 1 | ||||
-rw-r--r-- | libempathy-gtk/gossip-chat-window.c | 59 | ||||
-rw-r--r-- | libempathy-gtk/gossip-chat.c | 7 | ||||
-rw-r--r-- | libempathy-gtk/gossip-contact-list-store.c | 1 | ||||
-rw-r--r-- | libempathy-gtk/gossip-group-chat.c | 103 | ||||
-rw-r--r-- | libempathy-gtk/gossip-group-chat.h | 11 | ||||
-rw-r--r-- | libempathy-gtk/gossip-new-chatroom-dialog.c | 51 |
10 files changed, 123 insertions, 119 deletions
diff --git a/libempathy-gtk/empathy-images.h b/libempathy-gtk/empathy-images.h index 439f4c92e..5fb4e7173 100644 --- a/libempathy-gtk/empathy-images.h +++ b/libempathy-gtk/empathy-images.h @@ -33,9 +33,10 @@ G_BEGIN_DECLS #define EMPATHY_IMAGE_PENDING "empathy-pending" #define EMPATHY_IMAGE_MESSAGE "empathy-message" +#define EMPATHY_IMAGE_NEW_MESSAGE "empathy-new-message" #define EMPATHY_IMAGE_TYPING "empathy-typing" -#define EMPATHY_IMAGE_CONTACT_INFORMATION "vcard_16" -#define EMPATHY_IMAGE_GROUP_MESSAGE "gossip-group-message" +#define EMPATHY_IMAGE_CONTACT_INFORMATION "empathy-contact-information" +#define EMPATHY_IMAGE_GROUP_MESSAGE "empathy-group-message" G_END_DECLS diff --git a/libempathy-gtk/empathy-main-window.glade b/libempathy-gtk/empathy-main-window.glade index f64f2acb7..41e5d61ae 100644 --- a/libempathy-gtk/empathy-main-window.glade +++ b/libempathy-gtk/empathy-main-window.glade @@ -52,7 +52,7 @@ <widget class="GtkImage" id="image885"> <property name="visible">True</property> <property name="icon_size">1</property> - <property name="icon_name">empathy-message</property> + <property name="icon_name">empathy-new-message</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> diff --git a/libempathy-gtk/empathy-status-icon.glade b/libempathy-gtk/empathy-status-icon.glade index e44bafe95..d76a5dfda 100644 --- a/libempathy-gtk/empathy-status-icon.glade +++ b/libempathy-gtk/empathy-status-icon.glade @@ -30,7 +30,7 @@ <widget class="GtkImage" id="image599"> <property name="visible">True</property> <property name="icon_size">1</property> - <property name="icon_name">empathy-message</property> + <property name="icon_name">empathy-new-message</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> diff --git a/libempathy-gtk/gossip-account-chooser.c b/libempathy-gtk/gossip-account-chooser.c index 8d3439f7e..9cb8e5d41 100644 --- a/libempathy-gtk/gossip-account-chooser.c +++ b/libempathy-gtk/gossip-account-chooser.c @@ -554,6 +554,7 @@ account_chooser_status_changed_cb (MissionControl *mc, const gchar *unique_name, GossipAccountChooser *chooser) { + /* FIXME: implement */ } static gboolean diff --git a/libempathy-gtk/gossip-chat-window.c b/libempathy-gtk/gossip-chat-window.c index 7dfc8e0c5..35f3f9ae7 100644 --- a/libempathy-gtk/gossip-chat-window.c +++ b/libempathy-gtk/gossip-chat-window.c @@ -34,6 +34,8 @@ #include <glade/glade.h> #include <glib/gi18n.h> +#include <libempathy/empathy-contact-manager.h> +#include <libempathy/empathy-contact-list.h> #include <libempathy/gossip-contact.h> #include <libempathy/gossip-debug.h> #include <libempathy/gossip-message.h> @@ -45,9 +47,10 @@ //#include "gossip-chat-invite.h" //#include "gossip-contact-info-dialog.h" //#include "gossip-log-window.h" -//#include "gossip-new-chatroom-dialog.h" +#include "gossip-new-chatroom-dialog.h" #include "gossip-preferences.h" #include "gossip-private-chat.h" +#include "gossip-group-chat.h" //#include "gossip-sound.h" #include "gossip-ui-utils.h" @@ -228,7 +231,7 @@ typedef enum { } DndDragType; static const GtkTargetEntry drag_types_dest[] = { - { "text/contact-id", GTK_TARGET_SAME_APP, DND_DRAG_TYPE_CONTACT_ID }, + { "text/contact-id", 0, DND_DRAG_TYPE_CONTACT_ID }, { "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, DND_DRAG_TYPE_TAB }, }; @@ -759,16 +762,11 @@ chat_window_update_menu (GossipChatWindow *window) is_connected = gossip_chat_is_connected (priv->current_chat); if (gossip_chat_is_group_chat (priv->current_chat)) { -#if 0 -FIXME: - GossipGroupChat *group_chat; - GossipChatroomManager *manager; - GossipChatroom *chatroom; - GossipChatroomId id; - gboolean saved; + GossipGroupChat *group_chat; + gboolean saved = TRUE; + gboolean show_contacts; group_chat = GOSSIP_GROUP_CHAT (priv->current_chat); - chatroom = gossip_group_chat_get_chatroom (group_chat); /* Show / Hide widgets */ gtk_widget_show (priv->menu_room); @@ -780,9 +778,11 @@ FIXME: /* Can we add this room to our favourites and are we * connected to the room? */ + /* FIXME: manager = gossip_app_get_chatroom_manager (); id = gossip_chatroom_get_id (chatroom); saved = gossip_chatroom_manager_find (manager, id) != NULL; + */ gtk_widget_set_sensitive (priv->menu_room_add, !saved); gtk_widget_set_sensitive (priv->menu_conv_insert_smiley, is_connected); @@ -795,7 +795,7 @@ FIXME: * with 2 or more group chat windows where showing * contacts doesn't do anything. */ - show_contacts = gossip_chat_get_show_contacts (priv->current_chat); + show_contacts = gossip_group_chat_get_show_contacts (group_chat); g_signal_handlers_block_by_func (priv->menu_room_show_contacts, chat_window_show_contacts_toggled_cb, @@ -808,7 +808,6 @@ FIXME: g_signal_handlers_unblock_by_func (priv->menu_room_show_contacts, chat_window_show_contacts_toggled_cb, window); -#endif } else { GossipPrivateChat *chat; GossipSubscription subscription; @@ -1010,7 +1009,7 @@ chat_window_show_contacts_toggled_cb (GtkWidget *menuitem, g_return_if_fail (priv->current_chat != NULL); show = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (priv->menu_room_show_contacts)); - //gossip_group_chat_set_show_contacts (GOSSIP_GROUP_CHAT (priv->current_chat), show); + gossip_group_chat_set_show_contacts (GOSSIP_GROUP_CHAT (priv->current_chat), show); } static void @@ -1030,7 +1029,6 @@ static void chat_window_room_set_topic_activate_cb (GtkWidget *menuitem, GossipChatWindow *window) { -/*FIXME GossipChatWindowPriv *priv; priv = GET_PRIV (window); @@ -1040,7 +1038,7 @@ chat_window_room_set_topic_activate_cb (GtkWidget *menuitem, group_chat = GOSSIP_GROUP_CHAT (priv->current_chat); gossip_group_chat_set_topic (group_chat); - }*/ + } } static void @@ -1051,7 +1049,7 @@ chat_window_room_join_new_activate_cb (GtkWidget *menuitem, priv = GET_PRIV (window); - // FIXME: gossip_new_chatroom_dialog_show (GTK_WINDOW (priv->dialog)); + gossip_new_chatroom_dialog_show (GTK_WINDOW (priv->dialog)); } static void @@ -1591,14 +1589,15 @@ chat_window_drag_data_received (GtkWidget *widget, guint time, GossipChatWindow *window) { + /* FIXME: DnD of contact do not seems to work... */ if (info == DND_DRAG_TYPE_CONTACT_ID) { -#if 0 -FIXME: - GossipChatManager *manager; - GossipContact *contact; - GossipChat *chat; - GossipChatWindow *old_window; - const gchar *id = NULL; + EmpathyContactManager *manager; + GossipContact *contact; + GossipChat *chat; + GossipChatWindow *old_window; + McAccount *account; + const gchar *id = NULL; + gchar *chat_id; if (selection) { id = (const gchar*) selection->data; @@ -1606,15 +1605,20 @@ FIXME: gossip_debug (DEBUG_DOMAIN, "DND contact from roster with id:'%s'", id); - contact = gossip_session_find_contact (gossip_app_get_session (), id); + manager = empathy_contact_manager_new (); + contact = empathy_contact_list_find (EMPATHY_CONTACT_LIST (manager), id); + g_object_unref (manager); + if (!contact) { gossip_debug (DEBUG_DOMAIN, "DND contact from roster not found"); return; } - manager = gossip_app_get_chat_manager (); - chat = GOSSIP_CHAT (gossip_chat_manager_get_chat (manager, contact)); + account = gossip_contact_get_account (contact); + chat_id = empathy_tp_chat_build_id (account, id); + chat = gossip_chat_window_find_chat_by_id (chat_id); old_window = gossip_chat_get_window (chat); + g_free (chat_id); if (old_window) { if (old_window == window) { @@ -1628,7 +1632,7 @@ FIXME: } /* Added to take care of any outstanding chat events */ - gossip_chat_manager_show_chat (manager, contact); + gossip_chat_present (chat); /* We should return TRUE to remove the data when doing * GDK_ACTION_MOVE, but we don't here otherwise it has @@ -1636,7 +1640,6 @@ FIXME: * anyway with add_chat() and remove_chat(). */ gtk_drag_finish (context, TRUE, FALSE, time); -#endif } else if (info == DND_DRAG_TYPE_TAB) { GossipChat *chat = NULL; diff --git a/libempathy-gtk/gossip-chat.c b/libempathy-gtk/gossip-chat.c index 70d900d9f..4072b6eae 100644 --- a/libempathy-gtk/gossip-chat.c +++ b/libempathy-gtk/gossip-chat.c @@ -1072,11 +1072,18 @@ chat_state_changed_cb (EmpathyTpChat *tp_chat, GossipChat *chat) { GossipChatPriv *priv; + GossipContact *own_contact; GList *l; gboolean was_composing; priv = GET_PRIV (chat); + own_contact = gossip_contact_get_user (contact); + if (gossip_contact_equal (own_contact, contact)) { + /* We don't care about our own chat state */ + return; + } + was_composing = (priv->compositors != NULL); /* Find the contact in the list. After that l is the list elem or NULL */ diff --git a/libempathy-gtk/gossip-contact-list-store.c b/libempathy-gtk/gossip-contact-list-store.c index d9ece26bb..816102b2d 100644 --- a/libempathy-gtk/gossip-contact-list-store.c +++ b/libempathy-gtk/gossip-contact-list-store.c @@ -718,6 +718,7 @@ contact_list_store_setup (GossipContactListStore *store) contact_list_store_state_sort_func, store, NULL); + priv->sort_criterium = GOSSIP_CONTACT_LIST_STORE_SORT_NAME; gossip_contact_list_store_set_sort_criterium (store, priv->sort_criterium); } diff --git a/libempathy-gtk/gossip-group-chat.c b/libempathy-gtk/gossip-group-chat.c index 6cf897d67..f16bee0de 100644 --- a/libempathy-gtk/gossip-group-chat.c +++ b/libempathy-gtk/gossip-group-chat.c @@ -92,7 +92,6 @@ static void group_chat_topic_entry_activate_cb (GtkWidget *ent static void group_chat_topic_response_cb (GtkWidget *dialog, gint response, GossipGroupChat *chat); -void gossip_group_chat_set_topic (GossipGroupChat *chat); static const gchar * group_chat_get_name (GossipChat *chat); static gchar * group_chat_get_tooltip (GossipChat *chat); static const gchar * group_chat_get_status_icon_name (GossipChat *chat); @@ -209,7 +208,7 @@ gossip_group_chat_new (McAccount *account, } gboolean -gossip_group_chat_get_show_contacts (GossipChat *chat) +gossip_group_chat_get_show_contacts (GossipGroupChat *chat) { GossipGroupChat *group_chat; GossipGroupChatPriv *priv; @@ -223,8 +222,8 @@ gossip_group_chat_get_show_contacts (GossipChat *chat) } void -gossip_group_chat_set_show_contacts (GossipChat *chat, - gboolean show) +gossip_group_chat_set_show_contacts (GossipGroupChat *chat, + gboolean show) { GossipGroupChat *group_chat; GossipGroupChatPriv *priv; @@ -246,6 +245,55 @@ gossip_group_chat_set_show_contacts (GossipChat *chat, } } +void +gossip_group_chat_set_topic (GossipGroupChat *chat) +{ + GossipGroupChatPriv *priv; + GossipChatWindow *chat_window; + GtkWidget *chat_dialog; + GtkWidget *dialog; + GtkWidget *entry; + GtkWidget *hbox; + const gchar *topic; + + g_return_if_fail (GOSSIP_IS_GROUP_CHAT (chat)); + + priv = GET_PRIV (chat); + + chat_window = gossip_chat_get_window (GOSSIP_CHAT (chat)); + chat_dialog = gossip_chat_window_get_dialog (chat_window); + + dialog = gtk_message_dialog_new (GTK_WINDOW (chat_dialog), + 0, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_OK_CANCEL, + _("Enter the new topic you want to set for this room:")); + + topic = gtk_label_get_text (GTK_LABEL (priv->label_topic)); + + hbox = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + hbox, FALSE, TRUE, 4); + + entry = gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (entry), topic); + gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); + + gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 4); + + g_object_set (GTK_MESSAGE_DIALOG (dialog)->label, "use-markup", TRUE, NULL); + g_object_set_data (G_OBJECT (dialog), "entry", entry); + + g_signal_connect (entry, "activate", + G_CALLBACK (group_chat_topic_entry_activate_cb), + dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (group_chat_topic_response_cb), + chat); + + gtk_widget_show_all (dialog); +} + static void group_chat_create_ui (GossipGroupChat *chat) { @@ -402,53 +450,6 @@ group_chat_topic_response_cb (GtkWidget *dialog, gtk_widget_destroy (dialog); } -void -gossip_group_chat_set_topic (GossipGroupChat *chat) -{ - GossipGroupChatPriv *priv; - GossipChatWindow *chat_window; - GtkWidget *chat_dialog; - GtkWidget *dialog; - GtkWidget *entry; - GtkWidget *hbox; - const gchar *topic; - - priv = GET_PRIV (chat); - - chat_window = gossip_chat_get_window (GOSSIP_CHAT (chat)); - chat_dialog = gossip_chat_window_get_dialog (chat_window); - - dialog = gtk_message_dialog_new (GTK_WINDOW (chat_dialog), - 0, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_OK_CANCEL, - _("Enter the new topic you want to set for this room:")); - - topic = gtk_label_get_text (GTK_LABEL (priv->label_topic)); - - hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - hbox, FALSE, TRUE, 4); - - entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), topic); - gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); - - gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 4); - - g_object_set (GTK_MESSAGE_DIALOG (dialog)->label, "use-markup", TRUE, NULL); - g_object_set_data (G_OBJECT (dialog), "entry", entry); - - g_signal_connect (entry, "activate", - G_CALLBACK (group_chat_topic_entry_activate_cb), - dialog); - g_signal_connect (dialog, "response", - G_CALLBACK (group_chat_topic_response_cb), - chat); - - gtk_widget_show_all (dialog); -} - static const gchar * group_chat_get_name (GossipChat *chat) { diff --git a/libempathy-gtk/gossip-group-chat.h b/libempathy-gtk/gossip-group-chat.h index 871d65d61..37a7772bb 100644 --- a/libempathy-gtk/gossip-group-chat.h +++ b/libempathy-gtk/gossip-group-chat.h @@ -57,11 +57,12 @@ struct _GossipGroupChatClass { }; GType gossip_group_chat_get_type (void) G_GNUC_CONST; -GossipGroupChat *gossip_group_chat_new (McAccount *account, - TpChan *tp_chan); -gboolean gossip_group_chat_get_show_contacts (GossipChat *chat); -void gossip_group_chat_set_show_contacts (GossipChat *chat, - gboolean show); +GossipGroupChat *gossip_group_chat_new (McAccount *account, + TpChan *tp_chan); +gboolean gossip_group_chat_get_show_contacts (GossipGroupChat *chat); +void gossip_group_chat_set_show_contacts (GossipGroupChat *chat, + gboolean show); +void gossip_group_chat_set_topic (GossipGroupChat *chat); G_END_DECLS diff --git a/libempathy-gtk/gossip-new-chatroom-dialog.c b/libempathy-gtk/gossip-new-chatroom-dialog.c index 3200d543d..33c6f723e 100644 --- a/libempathy-gtk/gossip-new-chatroom-dialog.c +++ b/libempathy-gtk/gossip-new-chatroom-dialog.c @@ -127,7 +127,6 @@ static void new_chatroom_dialog_model_row_deleted_cb (GtkTreeMode GossipNewChatroomDialog *dialog); static void new_chatroom_dialog_model_selection_changed (GtkTreeSelection *selection, GossipNewChatroomDialog *dialog); -static void new_chatroom_dialog_set_defaults (GossipNewChatroomDialog *dialog); static void new_chatroom_dialog_join (GossipNewChatroomDialog *dialog); static void new_chatroom_dialog_request_handles_cb (DBusGProxy *proxy, GArray *handles, @@ -418,11 +417,29 @@ new_chatroom_dialog_update_widgets (GossipNewChatroomDialog *dialog) protocol = mc_profile_get_protocol_name (profile); /* hardcode here known protocols */ - if (strcmp (protocol, "jabber") == 0 || - strcmp (protocol, "salut") == 0) { + if (strcmp (protocol, "jabber") == 0) { + const gchar *server; + + server = mc_profile_get_default_account_domain (profile); + if (server) { + gchar *conference_server; + + conference_server = g_strconcat ("conference.", + server, NULL); + gtk_entry_set_text (GTK_ENTRY (dialog->entry_server), + conference_server); + g_free (conference_server); + } + gtk_widget_show (dialog->hbox_server); gtk_widget_show (dialog->hbox_nick); gtk_widget_show (dialog->vbox_browse); + + } + else if (strcmp (protocol, "salut") == 0) { + gtk_widget_hide (dialog->hbox_server); + gtk_widget_show (dialog->hbox_nick); + gtk_widget_show (dialog->vbox_browse); } else if (strcmp (protocol, "irc") == 0) { gtk_widget_hide (dialog->hbox_server); @@ -434,7 +451,6 @@ new_chatroom_dialog_update_widgets (GossipNewChatroomDialog *dialog) gtk_widget_hide (dialog->vbox_browse); } - new_chatroom_dialog_set_defaults (dialog); new_chatroom_dialog_update_buttons (dialog); /* Final set up of the dialog */ @@ -583,33 +599,6 @@ new_chatroom_dialog_model_selection_changed (GtkTreeSelection *selection, } static void -new_chatroom_dialog_set_defaults (GossipNewChatroomDialog *dialog) -{ - McAccount *account; - McProfile *profile; - GossipAccountChooser *account_chooser; - const gchar *server; - - account_chooser = GOSSIP_ACCOUNT_CHOOSER (dialog->account_chooser); - account = gossip_account_chooser_get_account (account_chooser); - profile = mc_account_get_profile (account); - server = mc_profile_get_default_account_domain (profile); - - if (server) { - gchar *conference_server; - - conference_server = g_strconcat ("conference.", - server, NULL); - gtk_entry_set_text (GTK_ENTRY (dialog->entry_server), - conference_server); - g_free (conference_server); - } - - g_object_unref (account); - g_object_unref (profile); -} - -static void new_chatroom_dialog_join (GossipNewChatroomDialog *dialog) { McAccount *account; |