/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2002-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2010 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 "empathy-chatrooms-window.h"
#include "empathy-event-manager.h"
#include "empathy-ft-manager.h"
+#include "empathy-migrate-butterfly-logs.h"
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include <libempathy/empathy-debug.h>
/* Actions that are enabled when there are connected accounts */
GList *actions_connected;
+
+ /* The idle event source to migrate butterfly's logs */
+ guint butterfly_log_migration_contact_added_id;
} EmpathyMainWindow;
static EmpathyMainWindow *main_window = NULL;
TpAccount *account;
account = g_object_get_data (G_OBJECT (button), "account");
- empathy_accounts_dialog_show (GTK_WINDOW (window->window), account);
+
+ empathy_accounts_dialog_show_application (
+ gtk_widget_get_screen (GTK_WIDGET (button)),
+ account, FALSE, FALSE);
main_window_remove_error (window, account);
}
}
info_bar = gtk_info_bar_new ();
- gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
+ gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_ERROR);
gtk_widget_set_no_show_all (info_bar, TRUE);
gtk_box_pack_start (GTK_BOX (window->errors_vbox), info_bar, FALSE, TRUE, 0);
label = gtk_label_new (str);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_show (label);
g_free (str);
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar));
gtk_box_pack_start (GTK_BOX (content_area), image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (content_area), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), label, TRUE, TRUE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_REFRESH, GTK_ICON_SIZE_BUTTON);
retry_button = gtk_button_new ();
window);
g_object_unref (window->event_manager);
g_object_unref (window->ui_manager);
+ g_object_unref (window->chatroom_manager);
g_free (window);
}
value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
empathy_contact_list_store_set_is_compact (window->list_store,
value == CONTACT_LIST_COMPACT_SIZE);
-
- gtk_action_set_sensitive (GTK_ACTION (window->show_protocols),
- value != CONTACT_LIST_COMPACT_SIZE );
}
static void main_window_notify_show_protocols_cb (EmpathyConf *conf,
main_window_edit_accounts_cb (GtkAction *action,
EmpathyMainWindow *window)
{
- empathy_accounts_dialog_show (GTK_WINDOW (window->window), NULL);
+ empathy_accounts_dialog_show_application (gdk_screen_get_default (),
+ NULL, FALSE, FALSE);
}
static void
main_window_help_debug_cb (GtkAction *action,
EmpathyMainWindow *window)
{
- empathy_debug_window_new (NULL);
+ GdkScreen *screen = gdk_screen_get_default ();
+ GError *error = NULL;
+ gchar *argv[2] = { NULL, };
+ gint i = 0;
+ gchar *path;
+
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+
+ /* Try to run from source directory if possible */
+ path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"), "src",
+ "empathy-debugger", NULL);
+
+ if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+ g_free (path);
+ path = g_build_filename (BIN_DIR, "empathy-debugger", NULL);
+ }
+
+ argv[i++] = path;
+
+ gdk_spawn_on_screen (screen, NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, &error);
+
+ if (error) {
+ g_warning ("Failed to open debug window: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_free (path);
}
static void
return FALSE;
}
- empathy_accounts_dialog_show (GTK_WINDOW (window->window), NULL);
+ empathy_accounts_dialog_show_application (
+ gtk_widget_get_screen (GTK_WIDGET (throbber_ebox)),
+ NULL, FALSE, FALSE);
return FALSE;
}
g_list_free (accounts);
}
+static void
+main_window_contact_added_cb (EmpathyContactMonitor *monitor,
+ EmpathyContact *contact,
+ EmpathyMainWindow *window)
+{
+ if (!empathy_migrate_butterfly_logs (contact)) {
+ g_signal_handler_disconnect (monitor,
+ window->butterfly_log_migration_contact_added_id);
+ window->butterfly_log_migration_contact_added_id = 0;
+ }
+}
+
GtkWidget *
empathy_main_window_show (void)
{
GSList *l;
if (main_window) {
- empathy_window_present (GTK_WINDOW (main_window->window), TRUE);
+ empathy_window_present (GTK_WINDOW (main_window->window));
return main_window->window;
}
EMPATHY_CONTACT_FEATURE_ALL);
g_signal_connect (monitor, "contact-presence-changed",
G_CALLBACK (main_window_contact_presence_changed_cb), window);
+ window->butterfly_log_migration_contact_added_id = g_signal_connect (monitor, "contact-added",
+ G_CALLBACK (main_window_contact_added_cb), window);
g_object_unref (list_iface);
gtk_widget_show (GTK_WIDGET (window->list_view));