#include <telepathy-glib/connection-manager.h>
#include <telepathy-glib/interfaces.h>
+#ifdef ENABLE_TPL
+#include <telepathy-logger/log-manager.h>
+#include <telepathy-logger/log-store-empathy.h>
+#else
+
+#include <libempathy/empathy-log-manager.h>
+#endif /* ENABLE_TPL */
#include <libempathy/empathy-idle.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-call-factory.h>
#include <libempathy/empathy-connection-managers.h>
#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-dispatch-operation.h>
-#include <libempathy/empathy-log-manager.h>
#include <libempathy/empathy-ft-factory.h>
#include <libempathy/empathy-tp-chat.h>
#include <libempathy/empathy-tp-call.h>
#include <libempathy-gtk/empathy-location-manager.h>
#include "empathy-main-window.h"
+#include "empathy-import-mc4-accounts.h"
+#include "empathy-accounts-common.h"
#include "empathy-accounts-dialog.h"
#include "empathy-status-icon.h"
#include "empathy-call-window.h"
#include <gst/gst.h>
-#define COMMAND_ACCOUNTS_DIALOG 1
-
-static gboolean account_dialog_only = FALSE;
static gboolean start_hidden = FALSE;
static gboolean no_connect = FALSE;
+static void account_manager_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data);
+
static void
dispatch_cb (EmpathyDispatcher *dispatcher,
EmpathyDispatchOperation *operation,
g_warning ("accounts application exited with status %d: '%s'",
status, g_strerror (status));
}
-
- if (account_dialog_only)
- gtk_main_quit ();
}
static void
show_accounts_ui (GdkScreen *screen,
- gboolean try_import)
+ gboolean if_needed)
{
empathy_accounts_dialog_show_application (screen,
- accounts_application_exited_cb, NULL, NULL, try_import, start_hidden);
+ accounts_application_exited_cb, NULL, NULL, if_needed, start_hidden);
}
static UniqueResponse
gpointer user_data)
{
GtkWindow *window = user_data;
+ TpAccountManager *account_manager;
DEBUG ("Other instance launched, presenting the main window. "
"Command=%d, timestamp %u", command, timestamp);
- if (command == COMMAND_ACCOUNTS_DIALOG)
- {
- show_accounts_ui (gdk_screen_get_default (), TRUE);
- }
- else
- {
- /* XXX: the standalone app somewhat breaks this case, since
- * communicating it would be a pain */
+ /* XXX: the standalone app somewhat breaks this case, since
+ * communicating it would be a pain */
- /* We're requested to show stuff again, disable the start hidden global
- * in case the accounts wizard wants to pop up.
- */
- start_hidden = FALSE;
+ /* We're requested to show stuff again, disable the start hidden global
+ * in case the accounts wizard wants to pop up.
+ */
+ start_hidden = FALSE;
- gtk_window_set_screen (GTK_WINDOW (window),
- unique_message_data_get_screen (data));
- gtk_window_set_startup_id (GTK_WINDOW (window),
- unique_message_data_get_startup_id (data));
- gtk_window_present_with_time (GTK_WINDOW (window), timestamp);
- }
+ gtk_window_set_screen (GTK_WINDOW (window),
+ unique_message_data_get_screen (data));
+ gtk_window_set_startup_id (GTK_WINDOW (window),
+ unique_message_data_get_startup_id (data));
+ gtk_window_present_with_time (GTK_WINDOW (window), timestamp);
+ gtk_window_set_skip_taskbar_hint (window, FALSE);
+
+ account_manager = tp_account_manager_dup ();
+ tp_account_manager_prepare_async (account_manager, NULL,
+ account_manager_ready_cb, NULL);
+ g_object_unref (account_manager);
return UNIQUE_RESPONSE_OK;
}
/* if current state is Offline, then put it online */
empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE);
- show_accounts_ui (gdk_screen_get_default (), TRUE);
+ /* Pop up the accounts dialog if it's needed (either when we don't have any
+ * accounts yet or when we haven't imported mc4 accounts yet */
+ if (!empathy_accounts_has_accounts (manager)
+ || !empathy_import_mc4_has_imported ())
+ show_accounts_ui (gdk_screen_get_default (), TRUE);
g_object_unref (idle);
g_object_unref (connectivity);
EmpathyStatusIcon *icon;
EmpathyDispatcher *dispatcher;
TpAccountManager *account_manager;
+#ifdef ENABLE_TPL
+ TplLogManager *log_manager;
+#else
EmpathyLogManager *log_manager;
+#endif /* ENABLE_TPL */
EmpathyChatroomManager *chatroom_manager;
EmpathyCallFactory *call_factory;
EmpathyFTFactory *ft_factory;
#ifdef ENABLE_DEBUG
TpDebugSender *debug_sender;
-#endif
+#endif /* ENABLE_TPL */
GOptionContext *optcontext;
GOptionEntry options[] = {
0, G_OPTION_ARG_NONE, &start_hidden,
N_("Don't display the contact list or any other dialogs on startup"),
NULL },
- { "accounts", 'a',
- 0, G_OPTION_ARG_NONE, &account_dialog_only,
- N_("Show the accounts dialog"),
- NULL },
{ "version", 'v',
G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, show_version_cb,
NULL, NULL },
g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif
- unique_app = unique_app_new_with_commands (
- "org.freedesktop.Telepathy.Client.Empathy",
- NULL, "accounts_dialog", COMMAND_ACCOUNTS_DIALOG, NULL);
+ unique_app = unique_app_new ("org.gnome."PACKAGE_NAME, NULL);
if (unique_app_is_running (unique_app))
{
- unique_app_send_message (unique_app, account_dialog_only ?
- COMMAND_ACCOUNTS_DIALOG : UNIQUE_ACTIVATE, NULL);
+ unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL);
g_object_unref (unique_app);
return EXIT_SUCCESS;
}
- if (account_dialog_only)
- {
- account_manager = tp_account_manager_dup ();
- show_accounts_ui (gdk_screen_get_default (), FALSE);
-
- gtk_main ();
-
- g_object_unref (account_manager);
- return 0;
- }
-
notify_init (_(PACKAGE_NAME));
/* Setting up Idle */
G_CALLBACK (unique_app_message_cb), window);
/* Logging */
+#ifdef ENABLE_TPL
+ log_manager = tpl_log_manager_dup_singleton ();
+#else
log_manager = empathy_log_manager_dup_singleton ();
empathy_log_manager_observe (log_manager, dispatcher);
+#endif
chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
empathy_chatroom_manager_observe (chatroom_manager, dispatcher);