/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2006-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-chatroom-manager.h>
#include <libempathy/empathy-chatroom.h>
#include <libempathy/empathy-message.h>
-#include <libempathy/empathy-debug.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-time.h>
#include "empathy-chat-view.h"
#include "empathy-ui-utils.h"
-#define DEBUG_DOMAIN "LogWindow"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
typedef struct {
GtkWidget *window;
static void log_window_chats_setup (EmpathyLogWindow *window);
static void log_window_chats_accounts_changed_cb (GtkWidget *combobox,
EmpathyLogWindow *window);
-static void log_window_chats_new_message_cb (EmpathyContact *own_contact,
- EmpathyMessage *message,
- EmpathyLogWindow *window);
static void log_window_chats_set_selected (EmpathyLogWindow *window,
McAccount *account,
const gchar *chat_id,
COL_CHAT_COUNT
};
-void
+GtkWidget *
empathy_log_window_show (McAccount *account,
const gchar *chat_id,
gboolean is_chatroom,
GList *accounts;
gint account_num;
GladeXML *glade;
+ gchar *filename;
if (window) {
gtk_window_present (GTK_WINDOW (window->window));
chat_id, is_chatroom);
}
- return;
+ return window->window;
}
window = g_new0 (EmpathyLogWindow, 1);
window->log_manager = empathy_log_manager_new ();
- glade = empathy_glade_get_file ("empathy-log-window.glade",
+ filename = empathy_file_lookup ("empathy-log-window.glade",
+ "libempathy-gtk");
+ glade = empathy_glade_get_file (filename,
"log_window",
NULL,
"log_window", &window->window,
"treeview_chats", &window->treeview_chats,
"scrolledwindow_chats", &window->scrolledwindow_chats,
NULL);
+ g_free (filename);
+
empathy_glade_connect (glade,
window,
"log_window", "destroy", log_window_destroy_cb,
}
gtk_widget_show (window->window);
+
+ return window->window;
}
static void
log_window_destroy_cb (GtkWidget *widget,
EmpathyLogWindow *window)
{
- g_signal_handlers_disconnect_by_func (window->log_manager,
- log_window_chats_new_message_cb,
- window);
-
g_free (window->last_find);
g_object_unref (window->log_manager);
log_window_chats_populate (window);
}
-static void
-log_window_chats_new_message_cb (EmpathyContact *own_contact,
- EmpathyMessage *message,
- EmpathyLogWindow *window)
-{
- empathy_chat_view_append_message (window->chatview_chats, message);
-
- /* Scroll to the most recent messages */
- empathy_chat_view_scroll_down (window->chatview_chats);
-}
-
static void
log_window_chats_set_selected (EmpathyLogWindow *window,
McAccount *account,
}
- empathy_debug (DEBUG_DOMAIN, "Marking date:'%s'", str);
+ DEBUG ("Marking date:'%s'", str);
gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
if (l->next) {
/* Turn back on scrolling */
empathy_chat_view_scroll (window->chatview_find, TRUE);
- /* Scroll to the most recent messages */
- empathy_chat_view_scroll_down (window->chatview_chats);
-
/* Give the search entry main focus */
gtk_widget_grab_focus (window->entry_chats);
date = g_strdup_printf ("%4.4d%2.2d%2.2d", year, month, day);
- empathy_debug (DEBUG_DOMAIN, "Currently selected date is:'%s'", date);
+ DEBUG ("Currently selected date is:'%s'", date);
log_window_chats_get_messages (window, date);
if (!log_window_chats_get_selected (window, &account,
&chat_id, &is_chatroom)) {
- empathy_debug (DEBUG_DOMAIN, "No chat selected to get dates for...");
+ DEBUG ("No chat selected to get dates for...");
return;
}
sscanf (str, "%4d%2d%2d", &year, &month, &day);
if (year == year_selected && month == month_selected) {
- empathy_debug (DEBUG_DOMAIN, "Marking date:'%s'", str);
+ DEBUG ("Marking date:'%s'", str);
gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
}
}
g_list_foreach (dates, (GFunc) g_free, NULL);
g_list_free (dates);
- empathy_debug (DEBUG_DOMAIN,
- "Currently showing month %d and year %d",
- month_selected, year_selected);
+ DEBUG ("Currently showing month %d and year %d", month_selected,
+ year_selected);
}
static void