#include <glade/glade.h>
#include <glib/gi18n.h>
+#include <libmissioncontrol/mission-control.h>
+
#include <libempathy/empathy-contact-factory.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-log-manager.h>
#include <libempathy/empathy-contact.h>
#include <libempathy/empathy-debug.h>
#include <libempathy/empathy-message.h>
-#include <libempathy/empathy-conf.h>
#include <libempathy/empathy-utils.h>
#include "empathy-chat-window.h"
#include "empathy-contact-dialogs.h"
#include "empathy-log-window.h"
#include "empathy-new-chatroom-dialog.h"
+#include "empathy-conf.h"
#include "empathy-preferences.h"
#include "empathy-private-chat.h"
#include "empathy-group-chat.h"
//#include "empathy-sound.h"
#include "empathy-ui-utils.h"
+#include "empathy-about-dialog.h"
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT_WINDOW, EmpathyChatWindowPriv))
GtkWidget *menu_tabs_left;
GtkWidget *menu_tabs_right;
GtkWidget *menu_tabs_detach;
+
+ GtkWidget *menu_help_contents;
+ GtkWidget *menu_help_about;
guint save_geometry_id;
};
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);
"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);
empathy_glade_connect (glade,
"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);
for (l = chat_windows; l; l = l->next) {
EmpathyChatWindow *chat_window;
- GtkWidget *dialog;
- GdkWindow *window;
- gboolean visible;
+ GtkWidget *dialog;
chat_window = l->data;
dialog = empathy_chat_window_get_dialog (chat_window);
- window = dialog->window;
-
- g_object_get (dialog,
- "visible", &visible,
- NULL);
-
- visible = visible && !(gdk_window_get_state (window) & GDK_WINDOW_STATE_ICONIFIED);
-
- if (visible) {
+ if (empathy_window_get_is_visible (GTK_WINDOW (GTK_WINDOW (dialog)))) {
/* Found a visible window on this desktop */
return chat_window;
}
* connected to the room?
*/
chatroom = empathy_chatroom_manager_find (priv->chatroom_manager,
- priv->current_chat->account,
- empathy_chat_get_id (priv->current_chat));
+ empathy_chat_get_account (priv->current_chat),
+ empathy_chat_get_id (priv->current_chat));
gtk_widget_set_sensitive (priv->menu_room_add, chatroom == NULL);
gtk_widget_set_sensitive (priv->menu_conv_insert_smiley, is_connected);
priv = GET_PRIV (window);
- empathy_log_window_show (priv->current_chat->account,
- empathy_chat_get_id (priv->current_chat),
- empathy_chat_is_group_chat (priv->current_chat),
- GTK_WINDOW (priv->dialog));
+ empathy_log_window_show (empathy_chat_get_account (priv->current_chat),
+ empathy_chat_get_id (priv->current_chat),
+ empathy_chat_is_group_chat (priv->current_chat),
+ GTK_WINDOW (priv->dialog));
}
static void
manager = empathy_log_manager_new ();
log_exists = empathy_log_manager_exists (manager,
- priv->current_chat->account,
+ empathy_chat_get_account (priv->current_chat),
empathy_chat_get_id (priv->current_chat),
empathy_chat_is_group_chat (priv->current_chat));
g_object_unref (manager);
return;
}
- chatroom = empathy_chatroom_new_full (priv->current_chat->account,
- empathy_chat_get_id (priv->current_chat),
- empathy_chat_get_name (priv->current_chat),
- FALSE);
+ chatroom = empathy_chatroom_new_full (empathy_chat_get_account (priv->current_chat),
+ empathy_chat_get_id (priv->current_chat),
+ empathy_chat_get_name (priv->current_chat),
+ FALSE);
manager = empathy_chatroom_manager_new ();
empathy_chatroom_manager_add (manager, chatroom);
gtk_widget_show (priv->dialog);
}
+static void
+chat_window_help_contents_cb (GtkWidget *menuitem,
+ EmpathyChatWindow *window)
+{
+ //empathy_help_show ();
+}
+
+static void
+chat_window_help_about_cb (GtkWidget *menuitem,
+ EmpathyChatWindow *window)
+{
+ empathy_about_dialog_new (GTK_WINDOW (window));
+}
+
static gboolean
chat_window_delete_event_cb (GtkWidget *dialog,
GdkEvent *event,
guint time,
EmpathyChatWindow *window)
{
- /* FIXME: DnD of contact do not seems to work... */
if (info == DND_DRAG_TYPE_CONTACT_ID) {
EmpathyContactFactory *factory;
EmpathyContact *contact = NULL;
account = empathy_contact_get_account (contact);
chat = empathy_chat_window_find_chat (account, id);
- old_window = empathy_chat_get_window (chat);
-
+
+ if (!chat) {
+ empathy_chat_with_contact_id (account, id);
+ return;
+ }
+
+ old_window = empathy_chat_get_window (chat);
if (old_window) {
if (old_window == window) {
gtk_drag_finish (context, TRUE, FALSE, time);
chat = ll->data;
- if (empathy_account_equal (account, chat->account) &&
+ if (empathy_account_equal (account, empathy_chat_get_account (chat)) &&
strcmp (id, empathy_chat_get_id (chat)) == 0) {
return chat;
}