]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-log-window.c
Updated Basque translation.
[empathy.git] / libempathy-gtk / empathy-log-window.c
index da553075f45b5946ef419d3f6fb4b77a22a7987b..f1d958a307e7dd042dcf51e70453c5e9b351b896 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- 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
@@ -35,7 +35,6 @@
 #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>
 
@@ -44,7 +43,8 @@
 #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;
@@ -93,9 +93,6 @@ static void     log_window_chats_populate                  (EmpathyLogWindow *wi
 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,
@@ -136,7 +133,7 @@ enum {
        COL_CHAT_COUNT
 };
 
-void
+GtkWidget *
 empathy_log_window_show (McAccount   *account,
                        const gchar *chat_id,
                        gboolean     is_chatroom,
@@ -147,6 +144,7 @@ empathy_log_window_show (McAccount   *account,
        GList                  *accounts;
        gint                    account_num;
        GladeXML               *glade;
+       gchar                  *filename;
 
        if (window) {
                gtk_window_present (GTK_WINDOW (window->window));
@@ -157,13 +155,15 @@ empathy_log_window_show (McAccount   *account,
                                                       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,
@@ -180,6 +180,8 @@ empathy_log_window_show (McAccount   *account,
                                       "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,
@@ -261,16 +263,14 @@ empathy_log_window_show (McAccount   *account,
        }
 
        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);
 
@@ -735,17 +735,6 @@ log_window_chats_accounts_changed_cb (GtkWidget       *combobox,
        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,
@@ -906,7 +895,7 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
                        }
 
 
-                       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) {
@@ -970,9 +959,6 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
        /* 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);
 
@@ -1000,7 +986,7 @@ log_window_calendar_chats_day_selected_cb (GtkWidget       *calendar,
 
        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);
 
@@ -1024,7 +1010,7 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
 
        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;
        }
 
@@ -1056,7 +1042,7 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
                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);
                }
        }
@@ -1064,9 +1050,8 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
        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