/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007 Collabora Ltd.
+ * Copyright (C) 2007-2008 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
#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;
}
chat_window_show_contacts_toggled_cb,
window);
} else {
- EmpathyPrivateChat *chat;
- EmpathyContact *contact;
- EmpathyPresence *presence;
+ EmpathyPrivateChat *chat;
+ EmpathyContact *contact;
+ McPresence presence;
chat = EMPATHY_PRIVATE_CHAT (priv->current_chat);
/* Show / Hide widgets */
gtk_widget_hide (priv->menu_room);
- /* presence==NULL means this contact refuses to send us his
+ /* Unset presence means this contact refuses to send us his
* presence. By adding the contact we ask the contact to accept
* to send his presence. */
contact = empathy_private_chat_get_contact (chat);
presence = empathy_contact_get_presence (contact);
- if (!presence) {
+ if (presence == MC_PRESENCE_UNSET) {
gtk_widget_show (priv->menu_conv_add_contact);
} else {
gtk_widget_hide (priv->menu_conv_add_contact);
chat = EMPATHY_PRIVATE_CHAT (priv->current_chat);
contact = empathy_private_chat_get_contact (chat);
- empathy_call_contact (contact);
+ empathy_call_with_contact (contact);
}
}
priv = GET_PRIV (window);
- /* Only save geometry information if there is ONE chat visible. */
- if (g_list_length (priv->chats) > 1) {
- return FALSE;
- }
-
if (priv->save_geometry_id != 0) {
g_source_remove (priv->save_geometry_id);
}
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,
chat = empathy_chat_window_find_chat (account, id);
if (!chat) {
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ empathy_chat_with_contact_id (account, id);
return;
}
EmpathyChat *chat)
{
EmpathyChatWindowPriv *priv;
- GtkWidget *label;
- GtkWidget *child;
+ GtkWidget *label;
+ GtkWidget *child;
+ gint x, y, w, h;
g_return_if_fail (window != NULL);
g_return_if_fail (EMPATHY_IS_CHAT (chat));
/* Set the chat window */
empathy_chat_set_window (chat, window);
- if (g_list_length (priv->chats) == 0) {
- gint x, y, w, h;
-
- empathy_chat_load_geometry (chat, &x, &y, &w, &h);
+ empathy_chat_load_geometry (chat, &x, &y, &w, &h);
- if (x >= 0 && y >= 0) {
- /* Let the window manager position it if we don't have
- * good x, y coordinates.
- */
- gtk_window_move (GTK_WINDOW (priv->dialog), x, y);
- }
+ if (x >= 0 && y >= 0) {
+ /* Let the window manager position it if we don't have
+ * good x, y coordinates.
+ */
+ gtk_window_move (GTK_WINDOW (priv->dialog), x, y);
+ }
- if (w > 0 && h > 0) {
- /* Use the defaults from the glade file if we don't have
- * good w, h geometry.
- */
- gtk_window_resize (GTK_WINDOW (priv->dialog), w, h);
- }
+ if (w > 0 && h > 0) {
+ /* Use the defaults from the glade file if we don't have
+ * good w, h geometry.
+ */
+ gtk_window_resize (GTK_WINDOW (priv->dialog), w, h);
}
child = empathy_chat_get_widget (chat);