Commit 6fe758a0 authored by Xavier Claessens's avatar Xavier Claessens Committed by Xavier Claessens

Fix warning when selecting all accounts.

2007-05-31  Xavier Claessens  <xclaesse@gmail.com>

	* libempathy-gtk/gossip-account-chooser.c: Fix warning when selecting
	all accounts.

	* src/empathy-accounts-main.c:
	* libempathy-gtk/empathy-status-icon.c:
	* libempathy-gtk/gossip-accounts-dialog.h:
	* libempathy-gtk/gossip-accounts-dialog.c:
	* libempathy-gtk/gossip-preferences.h:
	* libempathy-gtk/gossip-preferences.c: Set parent window.

	* libempathy-gtk/empathy-main-window.c: Implement favorite chatroom
	menu and fix a leak.

	* libempathy-gtk/Makefile.am:
	* libempathy/Makefile.am:
	* libempathy/gossip-chatroom.c:
	* libempathy/gossip-chatroom.h:
	* libempathy/gossip-chatroom-manager.c:
	* libempathy/gossip-chatroom-manager.h:
	* libempathy/gossip-chatroom-manager.dtd:
	* libempathy-gtk/gossip-chatrooms-window.glade:
	* libempathy-gtk/gossip-chatrooms-window.c:
	* libempathy-gtk/gossip-chatrooms-window.h: New files to implement
	favorite chatrooms and a window to show them.


	* libempathy-gtk/gossip-chat.c: Fix tooltip leaked.

	* libempathy-gtk/gossip-chat-window.h:
	* libempathy-gtk/gossip-chat-window.c: Do not use deprecated
	gtk_object_sink(). Implement favorite chatroom features. Find a chat
	by comparing the account AND the chat ID.

	* src/empathy-chat-main.c:
	* libempathy/empathy-tp-chat.h:
	* libempathy/empathy-tp-chat.c:
	* libempathy/gossip-utils.h:
	* libempathy/gossip-utils.c: empathy_tp_chat_get_id() returns the Text
	channel's name. The chat ID is unique only for a specified account.

	* libempathy/empathy-tp-contact-list.c: Fix some leaks and add a FIXME
	comment for a leak not yet fixed.

	* TODO: Would be cool to have a glade catalog for libempathy-gtk.


svn path=/trunk/; revision=100
parent a0c9dc2f
2007-05-31 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/gossip-account-chooser.c: Fix warning when selecting
all accounts.
* src/empathy-accounts-main.c:
* libempathy-gtk/empathy-status-icon.c:
* libempathy-gtk/gossip-accounts-dialog.h:
* libempathy-gtk/gossip-accounts-dialog.c:
* libempathy-gtk/gossip-preferences.h:
* libempathy-gtk/gossip-preferences.c: Set parent window.
* libempathy-gtk/empathy-main-window.c: Implement favorite chatroom
menu and fix a leak.
* libempathy-gtk/Makefile.am:
* libempathy/Makefile.am:
* libempathy/gossip-chatroom.c:
* libempathy/gossip-chatroom.h:
* libempathy/gossip-chatroom-manager.c:
* libempathy/gossip-chatroom-manager.h:
* libempathy/gossip-chatroom-manager.dtd:
* libempathy-gtk/gossip-chatrooms-window.glade:
* libempathy-gtk/gossip-chatrooms-window.c:
* libempathy-gtk/gossip-chatrooms-window.h: New files to implement
favorite chatrooms and a window to show them.
* libempathy-gtk/gossip-chat.c: Fix tooltip leaked.
* libempathy-gtk/gossip-chat-window.h:
* libempathy-gtk/gossip-chat-window.c: Do not use deprecated
gtk_object_sink(). Implement favorite chatroom features. Find a chat
by comparing the account AND the chat ID.
* src/empathy-chat-main.c:
* libempathy/empathy-tp-chat.h:
* libempathy/empathy-tp-chat.c:
* libempathy/gossip-utils.h:
* libempathy/gossip-utils.c: empathy_tp_chat_get_id() returns the Text
channel's name. The chat ID is unique only for a specified account.
* libempathy/empathy-tp-contact-list.c: Fix some leaks and add a FIXME
comment for a leak not yet fixed.
* TODO: Would be cool to have a glade catalog for libempathy-gtk.
2007-05-26 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/gossip-contact-list-store.c: Do not highlight contacts
......
......@@ -3,7 +3,7 @@ Things you can do if you want to help:
- Rename all files and functions name to use the empathy namespace.
- Porting gossip-account-widget-*.{c,h} from gossip project (Guillaume is already working on IRC widget).
- Porting various UI widgets from gossip to libempathy-gtk for contact info, adding contact, personal info, etc.
- GtkWidget-ify gossip widgets imported in libempathy-gtk. Actually most window/dialog do not inherit from GtkWindow/GtkDialog...
- GtkWidget-ify gossip widgets imported in libempathy-gtk. Actually most window/dialog do not inherit from GtkWindow/GtkDialog. Need to create a glade catalog.
- Fix setting subscription for contacts in EmpathyTpContactList.
- Filter channels before dispatching them. For example we need a GtkStatusIcon that blink when an event arrives (text/voip/ft channel) and tells the MC to dispatch the channel only when the user clicked the icon. Like in gossip. For that we need a filter DBus API in MC, not yet written.
- Make use of NetworkManager to set the presence
......
......@@ -34,6 +34,7 @@ libempathy_gtk_la_SOURCES = \
gossip-about-dialog.c gossip-about-dialog.h \
gossip-account-chooser.c gossip-account-chooser.h \
gossip-new-chatroom-dialog.c gossip-new-chatroom-dialog.h \
gossip-chatrooms-window.c gossip-chatrooms-window.h \
gossip-ui-utils.c gossip-ui-utils.h
libempathy_gtk_la_LIBADD = \
......@@ -52,6 +53,7 @@ glade_DATA = \
gossip-account-widget-jabber.glade \
gossip-new-chatroom-dialog.glade \
gossip-group-chat.glade \
gossip-chatrooms-window.glade \
gossip-chat.glade
dtddir = $(datadir)/empathy
......
......@@ -31,6 +31,8 @@
#include <libempathy/gossip-contact.h>
#include <libempathy/gossip-debug.h>
#include <libempathy/gossip-utils.h>
#include <libempathy/gossip-chatroom-manager.h>
#include <libempathy/gossip-chatroom.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-contact-manager.h>
......@@ -46,6 +48,7 @@
#include "gossip-accounts-dialog.h"
#include "gossip-about-dialog.h"
#include "gossip-new-chatroom-dialog.h"
#include "gossip-chatrooms-window.h"
#define DEBUG_DOMAIN "MainWindow"
......@@ -62,6 +65,7 @@ typedef struct {
GossipContactListView *list_view;
GossipContactListStore *list_store;
MissionControl *mc;
GossipChatroomManager *chatroom_manager;
/* Main widgets */
GtkWidget *window;
......@@ -93,68 +97,79 @@ typedef struct {
guint size_timeout_id;
} EmpathyMainWindow;
static void main_window_destroy_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_favorite_chatroom_menu_setup (void);
static void main_window_chat_quit_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_new_message_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_history_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_room_join_new_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_room_join_favorites_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_room_manage_favorites_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_add_contact_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_show_offline_cb (GtkCheckMenuItem *item,
EmpathyMainWindow *window);
static gboolean main_window_edit_button_press_event_cb (GtkWidget *widget,
GdkEventButton *event,
EmpathyMainWindow *window);
static void main_window_edit_accounts_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_edit_personal_information_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_edit_preferences_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_help_about_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_help_contents_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static gboolean main_window_throbber_button_press_event_cb (GtkWidget *throbber_ebox,
GdkEventButton *event,
gpointer user_data);
static void main_window_status_changed_cb (MissionControl *mc,
TelepathyConnectionStatus status,
McPresence presence,
TelepathyConnectionStatusReason reason,
const gchar *unique_name,
EmpathyMainWindow *window);
static void main_window_update_status (EmpathyMainWindow *window);
static void main_window_accels_load (void);
static void main_window_accels_save (void);
static void main_window_connection_items_setup (EmpathyMainWindow *window,
GladeXML *glade);
static gboolean main_window_configure_event_timeout_cb (EmpathyMainWindow *window);
static gboolean main_window_configure_event_cb (GtkWidget *widget,
GdkEventConfigure *event,
EmpathyMainWindow *window);
static void main_window_notify_show_offline_cb (GossipConf *conf,
const gchar *key,
gpointer check_menu_item);
static void main_window_notify_show_avatars_cb (GossipConf *conf,
const gchar *key,
EmpathyMainWindow *window);
static void main_window_notify_compact_contact_list_cb (GossipConf *conf,
const gchar *key,
EmpathyMainWindow *window);
static void main_window_notify_sort_criterium_cb (GossipConf *conf,
const gchar *key,
EmpathyMainWindow *window);
static void main_window_destroy_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_favorite_chatroom_menu_setup (EmpathyMainWindow *window);
static void main_window_favorite_chatroom_menu_added_cb (GossipChatroomManager *manager,
GossipChatroom *chatroom,
EmpathyMainWindow *window);
static void main_window_favorite_chatroom_menu_removed_cb (GossipChatroomManager *manager,
GossipChatroom *chatroom,
EmpathyMainWindow *window);
static void main_window_favorite_chatroom_menu_activate_cb (GtkMenuItem *menu_item,
GossipChatroom *chatroom);
static void main_window_favorite_chatroom_menu_update (EmpathyMainWindow *window);
static void main_window_favorite_chatroom_menu_add (EmpathyMainWindow *window,
GossipChatroom *chatroom);
static void main_window_chat_quit_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_new_message_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_history_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_room_join_new_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_room_join_favorites_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_room_manage_favorites_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_add_contact_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_chat_show_offline_cb (GtkCheckMenuItem *item,
EmpathyMainWindow *window);
static gboolean main_window_edit_button_press_event_cb (GtkWidget *widget,
GdkEventButton *event,
EmpathyMainWindow *window);
static void main_window_edit_accounts_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_edit_personal_information_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_edit_preferences_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_help_about_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static void main_window_help_contents_cb (GtkWidget *widget,
EmpathyMainWindow *window);
static gboolean main_window_throbber_button_press_event_cb (GtkWidget *throbber_ebox,
GdkEventButton *event,
EmpathyMainWindow *window);
static void main_window_status_changed_cb (MissionControl *mc,
TelepathyConnectionStatus status,
McPresence presence,
TelepathyConnectionStatusReason reason,
const gchar *unique_name,
EmpathyMainWindow *window);
static void main_window_update_status (EmpathyMainWindow *window);
static void main_window_accels_load (void);
static void main_window_accels_save (void);
static void main_window_connection_items_setup (EmpathyMainWindow *window,
GladeXML *glade);
static gboolean main_window_configure_event_timeout_cb (EmpathyMainWindow *window);
static gboolean main_window_configure_event_cb (GtkWidget *widget,
GdkEventConfigure *event,
EmpathyMainWindow *window);
static void main_window_notify_show_offline_cb (GossipConf *conf,
const gchar *key,
gpointer check_menu_item);
static void main_window_notify_show_avatars_cb (GossipConf *conf,
const gchar *key,
EmpathyMainWindow *window);
static void main_window_notify_compact_contact_list_cb (GossipConf *conf,
const gchar *key,
EmpathyMainWindow *window);
static void main_window_notify_sort_criterium_cb (GossipConf *conf,
const gchar *key,
EmpathyMainWindow *window);
GtkWidget *
empathy_main_window_show (void)
......@@ -227,7 +242,7 @@ empathy_main_window_show (void)
window, NULL);
/* Set up menu */
main_window_favorite_chatroom_menu_setup ();
main_window_favorite_chatroom_menu_setup (window);
gtk_widget_hide (window->edit_context);
gtk_widget_hide (window->edit_context_separator);
......@@ -263,7 +278,7 @@ empathy_main_window_show (void)
g_signal_connect (ebox,
"button-press-event",
G_CALLBACK (main_window_throbber_button_press_event_cb),
NULL);
window);
/* Set up contact list. */
gossip_status_presets_get_all ();
......@@ -374,8 +389,116 @@ main_window_destroy_cb (GtkWidget *widget,
}
static void
main_window_favorite_chatroom_menu_setup (void)
main_window_favorite_chatroom_menu_setup (EmpathyMainWindow *window)
{
GList *chatrooms, *l;
window->chatroom_manager = gossip_chatroom_manager_new ();
chatrooms = gossip_chatroom_manager_get_chatrooms (window->chatroom_manager, NULL);
window->room_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (window->room));
for (l = chatrooms; l; l = l->next) {
main_window_favorite_chatroom_menu_add (window, l->data);
}
if (!chatrooms) {
gtk_widget_hide (window->room_sep);
}
gtk_widget_set_sensitive (window->room_join_favorites, chatrooms != NULL);
g_signal_connect (window->chatroom_manager, "chatroom-added",
G_CALLBACK (main_window_favorite_chatroom_menu_added_cb),
window);
g_signal_connect (window->chatroom_manager, "chatroom-removed",
G_CALLBACK (main_window_favorite_chatroom_menu_removed_cb),
window);
g_list_free (chatrooms);
}
static void
main_window_favorite_chatroom_menu_added_cb (GossipChatroomManager *manager,
GossipChatroom *chatroom,
EmpathyMainWindow *window)
{
main_window_favorite_chatroom_menu_add (window, chatroom);
gtk_widget_show (window->room_sep);
gtk_widget_set_sensitive (window->room_join_favorites, TRUE);
}
static void
main_window_favorite_chatroom_menu_removed_cb (GossipChatroomManager *manager,
GossipChatroom *chatroom,
EmpathyMainWindow *window)
{
GtkWidget *menu_item;
menu_item = g_object_get_data (G_OBJECT (chatroom), "menu_item");
g_object_set_data (G_OBJECT (chatroom), "menu_item", NULL);
gtk_widget_destroy (menu_item);
main_window_favorite_chatroom_menu_update (window);
}
static void
main_window_favorite_chatroom_menu_activate_cb (GtkMenuItem *menu_item,
GossipChatroom *chatroom)
{
/*FIXME:
GossipSession *session;
GossipAccount *account;
GossipChatroomProvider *provider;
session = gossip_app_get_session ();
account = gossip_chatroom_get_account (chatroom);
provider = gossip_session_get_chatroom_provider (session, account);
gossip_group_chat_new (provider, chatroom);
*/
}
static void
main_window_favorite_chatroom_menu_update (EmpathyMainWindow *window)
{
GList *chatrooms;
chatrooms = gossip_chatroom_manager_get_chatrooms (window->chatroom_manager, NULL);
if (chatrooms) {
gtk_widget_show (window->room_sep);
} else {
gtk_widget_hide (window->room_sep);
}
gtk_widget_set_sensitive (window->room_join_favorites, chatrooms != NULL);
g_list_free (chatrooms);
}
static void
main_window_favorite_chatroom_menu_add (EmpathyMainWindow *window,
GossipChatroom *chatroom)
{
GtkWidget *menu_item;
const gchar *name;
if (g_object_get_data (G_OBJECT (chatroom), "menu_item")) {
return;
}
name = gossip_chatroom_get_name (chatroom);
menu_item = gtk_menu_item_new_with_label (name);
g_object_set_data (G_OBJECT (chatroom), "menu_item", menu_item);
g_signal_connect (menu_item, "activate",
G_CALLBACK (main_window_favorite_chatroom_menu_activate_cb),
chatroom);
gtk_menu_shell_insert (GTK_MENU_SHELL (window->room_menu),
menu_item, 3);
gtk_widget_show (menu_item);
}
static void
......@@ -417,7 +540,7 @@ static void
main_window_room_manage_favorites_cb (GtkWidget *widget,
EmpathyMainWindow *window)
{
//gossip_chatrooms_window_show (NULL, FALSE);
gossip_chatrooms_window_show (GTK_WINDOW (window->window));
}
static void
......@@ -510,7 +633,7 @@ static void
main_window_edit_accounts_cb (GtkWidget *widget,
EmpathyMainWindow *window)
{
gossip_accounts_dialog_show ();
gossip_accounts_dialog_show (GTK_WINDOW (window->window));
}
static void
......@@ -524,7 +647,7 @@ static void
main_window_edit_preferences_cb (GtkWidget *widget,
EmpathyMainWindow *window)
{
gossip_preferences_show ();
gossip_preferences_show (GTK_WINDOW (window->window));
}
static void
......@@ -542,16 +665,16 @@ main_window_help_contents_cb (GtkWidget *widget,
}
static gboolean
main_window_throbber_button_press_event_cb (GtkWidget *throbber_ebox,
GdkEventButton *event,
gpointer user_data)
main_window_throbber_button_press_event_cb (GtkWidget *throbber_ebox,
GdkEventButton *event,
EmpathyMainWindow *window)
{
if (event->type != GDK_BUTTON_PRESS ||
event->button != 1) {
return FALSE;
}
gossip_accounts_dialog_show ();
gossip_accounts_dialog_show (GTK_WINDOW (window->window));
return FALSE;
}
......@@ -614,8 +737,6 @@ main_window_update_status (EmpathyMainWindow *window)
for (l = window->widgets_disconnected; l; l = l->next) {
gtk_widget_set_sensitive (l->data, (disconnected > 0));
}
//app_favorite_chatroom_menu_update ();
}
/*
......@@ -768,6 +889,7 @@ main_window_notify_sort_criterium_cb (GossipConf *conf,
type = gossip_contact_list_store_sort_get_type ();
enum_class = G_ENUM_CLASS (g_type_class_peek (type));
enum_value = g_enum_get_value_by_nick (enum_class, str);
g_free (str);
if (enum_value) {
gossip_contact_list_store_set_sort_criterium (window->list_store,
......
......@@ -231,7 +231,7 @@ status_icon_toggle_visibility (EmpathyStatusIcon *icon)
} else {
gossip_debug (DEBUG_DOMAIN,
"No enabled account, Showing account dialog");
gossip_accounts_dialog_show ();
gossip_accounts_dialog_show (GTK_WINDOW (priv->window));
}
}
}
......
......@@ -593,6 +593,9 @@ account_chooser_set_account_foreach (GtkTreeModel *model,
/* Special case so we can make it possible to select the All option */
if (!data->account && !account) {
equal = TRUE;
}
else if ((data->account && !account) || (!data->account && account)) {
equal = FALSE;
} else {
equal = gossip_account_equal (data->account, account);
g_object_unref (account);
......
......@@ -944,7 +944,7 @@ accounts_dialog_destroy_cb (GtkWidget *widget,
}
GtkWidget *
gossip_accounts_dialog_show (void)
gossip_accounts_dialog_show (GtkWindow *parent)
{
static GossipAccountsDialog *dialog = NULL;
GladeXML *glade;
......@@ -1026,6 +1026,11 @@ gossip_accounts_dialog_show (void)
accounts_dialog_setup (dialog);
accounts_dialog_model_select_first (dialog);
if (parent) {
gtk_window_set_transient_for (GTK_WINDOW (dialog->window),
GTK_WINDOW (parent));
}
gtk_widget_show (dialog->window);
return dialog->window;
......
......@@ -28,7 +28,7 @@
G_BEGIN_DECLS
GtkWidget *gossip_accounts_dialog_show (void);
GtkWidget *gossip_accounts_dialog_show (GtkWindow *parent);
G_END_DECLS
......
......@@ -36,10 +36,12 @@
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/gossip-chatroom-manager.h>
#include <libempathy/gossip-contact.h>
#include <libempathy/gossip-debug.h>
#include <libempathy/gossip-message.h>
#include <libempathy/gossip-conf.h>
#include <libempathy/gossip-utils.h>
#include "gossip-chat-window.h"
#include "empathy-images.h"
......@@ -274,8 +276,7 @@ gossip_chat_window_init (GossipChatWindow *window)
priv = GET_PRIV (window);
priv->tooltips = g_object_ref (gtk_tooltips_new ());
gtk_object_sink (GTK_OBJECT (priv->tooltips));
priv->tooltips = g_object_ref_sink (gtk_tooltips_new ());
glade = gossip_glade_get_file ("gossip-chat.glade",
"chat_window",
......@@ -762,9 +763,10 @@ chat_window_update_menu (GossipChatWindow *window)
is_connected = gossip_chat_is_connected (priv->current_chat);
if (gossip_chat_is_group_chat (priv->current_chat)) {
GossipGroupChat *group_chat;
gboolean saved = TRUE;
gboolean show_contacts;
GossipGroupChat *group_chat;
GossipChatroom *chatroom;
GossipChatroomManager *manager;
gboolean show_contacts;
group_chat = GOSSIP_GROUP_CHAT (priv->current_chat);
......@@ -778,13 +780,13 @@ chat_window_update_menu (GossipChatWindow *window)
/* 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;
*/
manager = gossip_chatroom_manager_new ();
chatroom = gossip_chatroom_manager_find (manager,
priv->current_chat->account,
gossip_chat_get_id (priv->current_chat));
g_object_unref (manager);
gtk_widget_set_sensitive (priv->menu_room_add, !saved);
gtk_widget_set_sensitive (priv->menu_room_add, chatroom == NULL);
gtk_widget_set_sensitive (priv->menu_conv_insert_smiley, is_connected);
gtk_widget_set_sensitive (priv->menu_room_join_new, is_connected);
gtk_widget_set_sensitive (priv->menu_room_invite, is_connected);
......@@ -1079,9 +1081,7 @@ static void
chat_window_room_add_activate_cb (GtkWidget *menuitem,
GossipChatWindow *window)
{
/* FIXME:
GossipChatWindowPriv *priv;
GossipGroupChat *group_chat;
GossipChatroomManager *manager;
GossipChatroom *chatroom;
......@@ -1093,16 +1093,17 @@ chat_window_room_add_activate_cb (GtkWidget *menuitem,
return;
}
group_chat = GOSSIP_GROUP_CHAT (priv->current_chat);
chatroom = gossip_group_chat_get_chatroom (group_chat);
gossip_chatroom_set_favourite (chatroom, TRUE);
chatroom = gossip_chatroom_new_full (priv->current_chat->account,
gossip_chat_get_id (priv->current_chat),
gossip_chat_get_name (priv->current_chat),
FALSE);
manager = gossip_app_get_chatroom_manager ();
manager = gossip_chatroom_manager_new ();
gossip_chatroom_manager_add (manager, chatroom);
gossip_chatroom_manager_store (manager);
chat_window_update_menu (window);
*/
g_object_unref (chatroom);
g_object_unref (manager);
}
static void
......@@ -1597,7 +1598,6 @@ chat_window_drag_data_received (GtkWidget *widget,
GossipChatWindow *old_window;
McAccount *account;
const gchar *id = NULL;
gchar *chat_id;
if (selection) {
id = (const gchar*) selection->data;
......@@ -1615,10 +1615,8 @@ chat_window_drag_data_received (GtkWidget *widget,
}
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);
chat = gossip_chat_window_find_chat (account, id);
old_window = gossip_chat_get_window (chat);
g_free (chat_id);
if (old_window) {
if (old_window == window) {
......@@ -1882,7 +1880,8 @@ gossip_chat_window_has_focus (GossipChatWindow *window)
}
GossipChat *
gossip_chat_window_find_chat_by_id (const gchar *id)
gossip_chat_window_find_chat (McAccount *account,
const gchar *id)
{
GList *l;
......@@ -1899,7 +1898,8 @@ gossip_chat_window_find_chat_by_id (const gchar *id)
chat = ll->data;
if (strcmp (id, gossip_chat_get_id (chat)) == 0) {
if (gossip_account_equal (account, chat->account) &&
strcmp (id, gossip_chat_get_id (chat)) == 0) {
return chat;
}
}
......
......@@ -30,6 +30,8 @@
#include <glib-object.h>
#include <libmissioncontrol/mc-account.h>
G_BEGIN_DECLS
#define GOSSIP_TYPE_CHAT_WINDOW (gossip_chat_window_get_type ())
......@@ -70,7 +72,8 @@ void gossip_chat_window_move_chat (GossipChatWindow *old_wind
void gossip_chat_window_switch_to_chat (GossipChatWindow *window,
GossipChat *chat);
gboolean gossip_chat_window_has_focus (GossipChatWindow *window);
GossipChat * gossip_chat_window_find_chat_by_id (const gchar *id);
GossipChat * gossip_chat_window_find_chat (McAccount *account,
const gchar *id);
G_END_DECLS
......
......@@ -228,7 +228,7 @@ gossip_chat_init (GossipChat *chat)
priv = GET_PRIV (chat);
priv->manager = empathy_contact_manager_new ();
priv->tooltips = gtk_tooltips_new ();
priv->tooltips = g_object_ref_sink (gtk_tooltips_new ());
priv->default_window_height = -1;
priv->vscroll_visible = FALSE;
priv->sensitive = TRUE;
......@@ -337,6 +337,7 @@ chat_finalize (GObject *object)
chat_composing_remove_timeout (chat);
g_object_unref (chat->account);
g_object_unref (priv->manager);
g_object_unref (priv->tooltips);
if (priv->tp_chat) {
g_object_unref (priv->tp_chat);
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2004-2007 Imendio AB
* Copyright (C) 2007 Collabora Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors: Xavier Claessens <xclaesse@gmail.com>
* Martyn Russell <martyn@imendio.com>
* Mikael Hallendal <micke@imendio.com>
*/
#include "config.h"
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <libempathy/gossip-chatroom-manager.h>
#include <libempathy/gossip-utils.h>
#include "gossip-account-chooser.h"
#include "gossip-chatrooms-window.h"
//#include "gossip-edit-chatroom-dialog.h"
#include "gossip-new-chatroom-dialog.h"
#include "gossip-ui-utils.h"
typedef struct {
GossipChatroomManager *manager;
GtkWidget *window;
GtkWidget *hbox_account;
GtkWidget *label_account;
GtkWidget *account_chooser;
GtkWidget *treeview;
GtkWidget *button_remove;
GtkWidget *button_edit;
GtkWidget *button_close;
gint room_column;
} GossipChatroomsWindow;
static void chatrooms_window_destroy_cb (GtkWidget *widget,
GossipChatroomsWindow *window);
static void chatrooms_window_model_setup (GossipChatroomsWindow *window);
static void chatrooms_window_model_add_columns (GossipChatroomsWindow *window);
static void chatrooms_window_model_refresh_data (GossipChatroomsWindow *window,
gboolean first_time);
static void chatrooms_window_model_add (GossipChatroomsWindow *window,
GossipChatroom *chatroom,
gboolean set_active);