int
main (int argc,
    char **argv)
{
  GtkApplication *app;
  gint retval;

  g_thread_init (NULL);
  gtk_init (&argc, &argv);
  empathy_gtk_init ();

  app = gtk_application_new (EMPATHY_DEBUGGER_DBUS_NAME,
      G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);

  g_set_application_name (_("Empathy Debugger"));

  /* Make empathy and empathy-debugger appear as the same app in gnome-shell */
  gdk_set_program_class ("Empathy");
  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  retval = g_application_run (G_APPLICATION (app), argc, argv);

  g_object_unref (app);

  return retval;
}
int
main (int argc,
    char **argv)
  {
    EmpathyClientFactory *factory;
    TpAccountManager *am;
    GMainLoop *loop;

    gtk_init (&argc, &argv);
    empathy_gtk_init ();

    /* The blocking dialog needs the contact list for the contacts completion
     * so we prepare it first. */
    factory = empathy_client_factory_dup ();

    tp_simple_client_factory_add_connection_features_varargs (
        TP_SIMPLE_CLIENT_FACTORY (factory),
        TP_CONNECTION_FEATURE_CONTACT_LIST,
        NULL);

    am = tp_account_manager_dup ();

    loop = g_main_loop_new (NULL, FALSE);

    tp_proxy_prepare_async (am, NULL, am_prepare_cb, loop);

    g_main_loop_run (loop);

    g_object_unref (am);
    return 0;
  }
Exemplo n.º 3
0
static gboolean
init (NstPlugin *plugin)
{
  g_print ("Init %s plugin\n", plugin->info->id);

  empathy_gtk_init ();

  return TRUE;
}
Exemplo n.º 4
0
static void
app_activate (GApplication *app)
{
  TpAccountManager *account_manager;

  empathy_gtk_init ();
  account_manager = tp_account_manager_dup ();

  /* Hold the application while preparing the AM */
  g_application_hold (app);

  tp_proxy_prepare_async (account_manager, NULL,
    account_manager_ready_for_accounts_cb, app);

  g_object_unref (account_manager);
}
Exemplo n.º 5
0
static gboolean
init (NstPlugin *plugin)
{
  g_print ("Init %s plugin\n", plugin->info->id);

  empathy_gtk_init ();

  acc_manager = empathy_account_manager_dup_singleton ();

  if (empathy_account_manager_is_ready (acc_manager))
    handle_account_manager_ready ();
  else
    g_signal_connect (acc_manager, "notify::ready",
        G_CALLBACK (acc_manager_ready_cb), NULL);

  return TRUE;
}
int
main (int argc,
    char **argv)
  {
    EmpathyContactManager *manager;
    GtkWidget *dialog;

    gtk_init (&argc, &argv);
    empathy_gtk_init ();

    manager = empathy_contact_manager_dup_singleton ();
    dialog = empathy_contact_blocking_dialog_new (NULL);

    gtk_dialog_run (GTK_DIALOG (dialog));

    g_object_unref (manager);
    return 0;
  }
Exemplo n.º 7
0
int
main (int argc, char *argv[])
{
  TpAccountManager *account_manager;
  GtkApplication *app;
  GObjectClass *app_class;
  gint retval;

  g_thread_init (NULL);
  empathy_init ();

  gtk_init (&argc, &argv);
  empathy_gtk_init ();

  g_set_application_name (_("Empathy Accounts"));

  /* Make empathy and empathy-accounts appear as the same app in gnome-shell */
  gdk_set_program_class ("Empathy");
  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  app = gtk_application_new (EMPATHY_ACCOUNTS_DBUS_NAME,
      G_APPLICATION_HANDLES_COMMAND_LINE);
  app_class = G_OBJECT_GET_CLASS (app);
  G_APPLICATION_CLASS (app_class)->local_command_line = local_cmdline;

  account_manager = tp_account_manager_dup ();

  tp_proxy_prepare_async (account_manager, NULL,
    account_manager_ready_for_accounts_cb, NULL);

  g_signal_connect (app, "command-line", G_CALLBACK (app_command_line_cb),
      NULL);

  retval = g_application_run (G_APPLICATION (app), argc, argv);

  g_object_unref (account_manager);
  g_object_unref (app);

  return retval;
}
int
main (int argc,
    char **argv)
{
  GtkWidget *window, *view1, *view2, *box_horiz;
  EmpathyIndividualManager *mgr;
  EmpathyRosterModel *model;

  gtk_init (&argc, &argv);
  empathy_gtk_init ();

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  empathy_set_css_provider (window);

  box_horiz = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);

  mgr = empathy_individual_manager_dup_singleton ();

  model = EMPATHY_ROSTER_MODEL (empathy_roster_model_manager_new (mgr));

  view1 = create_view_box (model, TRUE, TRUE);
  view2 = create_view_box (model, FALSE, FALSE);

  g_object_unref (model);
  g_object_unref (mgr);

  gtk_box_pack_start (GTK_BOX (box_horiz), view1, FALSE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX (box_horiz), view2, FALSE, TRUE, 0);
  gtk_container_add (GTK_CONTAINER (window), box_horiz);

  gtk_window_set_default_size (GTK_WINDOW (window), 600, 600);
  gtk_widget_show_all (window);

  g_signal_connect_swapped (window, "destroy",
      G_CALLBACK (gtk_main_quit), NULL);

  gtk_main ();

  return 0;
}
Exemplo n.º 9
0
int
main (int argc,
    char *argv[])
{
  TpAccountManager *mgr;

  gtk_init (&argc, &argv);
  empathy_gtk_init ();
  g_set_application_name (PACKAGE_NAME);
  gtk_window_set_default_icon_name ("empathy");

  mgr = tp_account_manager_dup ();

  tp_proxy_prepare_async (mgr, NULL, account_manager_prepare_cb, NULL);

  gtk_main ();

  g_object_unref (mgr);

  return EXIT_SUCCESS;
}
Exemplo n.º 10
0
int
main (int argc,
    char **argv)
{
  GtkWidget *window, *c;

  gtk_init (&argc, &argv);
  empathy_gtk_init ();

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  c = empathy_protocol_chooser_new ();

  gtk_container_add (GTK_CONTAINER (window), c);

  /*  gtk_window_set_default_size (GTK_WINDOW (window), 150, -1);*/
  gtk_widget_show_all (window);

  g_signal_connect_swapped (window, "destroy",
      G_CALLBACK (gtk_main_quit), NULL);

  gtk_main ();

  return 0;
}
Exemplo n.º 11
0
int
main (int argc, char *argv[])
{
	guint32            startup_timestamp;
	EmpathyStatusIcon *icon;
	EmpathyDispatcher *dispatcher;
	EmpathyChatroomManager *chatroom_manager;
	EmpathyCallFactory *call_factory;
	GtkWidget         *window;
	MissionControl    *mc;
	EmpathyIdle       *idle;
	gboolean           autoconnect = TRUE;
	gboolean           no_connect = FALSE; 
	gboolean           hide_contact_list = FALSE;
	gboolean           accounts_dialog = FALSE;
	GError            *error = NULL;
	GOptionEntry       options[] = {
		{ "no-connect", 'n',
		  0, G_OPTION_ARG_NONE, &no_connect,
		  N_("Don't connect on startup"),
		  NULL },
		{ "hide-contact-list", 'h',
		  0, G_OPTION_ARG_NONE, &hide_contact_list,
		  N_("Don't show the contact list on startup"),
		  NULL },
		{ "accounts", 'a',
		  0, G_OPTION_ARG_NONE, &accounts_dialog,
		  N_("Show the accounts dialog"),
		  NULL },
		{ "version", 'v',
		  G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, show_version_cb, NULL, NULL },
		{ NULL }
	};

	/* Init */
	g_thread_init (NULL);
	empathy_init ();

	if (!gtk_init_with_args (&argc, &argv,
				 N_("- Empathy Instant Messenger"),
				 options, GETTEXT_PACKAGE, &error)) {
		g_warning ("Error in empathy init: %s", error->message);
		return EXIT_FAILURE;
	}

	empathy_gtk_init ();
	g_set_application_name (_(PACKAGE_NAME));

	gst_init (&argc, &argv);

	gtk_window_set_default_icon_name ("empathy");
	textdomain (GETTEXT_PACKAGE);

        /* Setting up the bacon connection */
	startup_timestamp = get_startup_timestamp ();
	connection = bacon_message_connection_new ("empathy");
	if (connection != NULL) {
		if (!bacon_message_connection_get_is_server (connection)) {
			gchar *message;

			if (accounts_dialog) {
				DEBUG ("Showing accounts dialog from existing Empathy instance");

				message = g_strdup ("accounts");

			} else {

				DEBUG ("Activating existing instance");

				message = g_strdup_printf ("%" G_GUINT32_FORMAT,
							   startup_timestamp);
			}

			bacon_message_connection_send (connection, message);

			/* We never popup a window, so tell startup-notification
			 * that we are done. */
			gdk_notify_startup_complete ();

			g_free (message);
			bacon_message_connection_free (connection);

			return EXIT_SUCCESS;
		}
	} else {
		g_warning ("Cannot create the 'empathy' bacon connection.");
	}

	/* Setting up MC */
	mc = empathy_mission_control_dup_singleton ();
	g_signal_connect (mc, "ServiceEnded",
			  G_CALLBACK (service_ended_cb),
			  NULL);
	g_signal_connect (mc, "Error",
			  G_CALLBACK (operation_error_cb),
			  NULL);

	if (accounts_dialog) {
		GtkWidget *dialog;

		dialog = empathy_accounts_dialog_show (NULL, NULL);
		g_signal_connect (dialog, "destroy",
				  G_CALLBACK (gtk_main_quit),
				  NULL);

		gtk_main ();
		return 0;
	}

	/* Setting up Idle */
	idle = empathy_idle_dup_singleton ();
	empathy_idle_set_auto_away (idle, TRUE);
	use_nm_notify_cb (empathy_conf_get (), EMPATHY_PREFS_USE_NM, idle);
	empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_USE_NM,
				 use_nm_notify_cb, idle);

	/* Autoconnect */
	empathy_conf_get_bool (empathy_conf_get(),
			       EMPATHY_PREFS_AUTOCONNECT,
			       &autoconnect);
	if (autoconnect && ! no_connect &&
	    empathy_idle_get_state (idle) <= MC_PRESENCE_OFFLINE) {
		empathy_idle_set_state (idle, MC_PRESENCE_AVAILABLE);
	}
	
	create_salut_account ();

	/* Setting up UI */
	window = empathy_main_window_show ();
	icon = empathy_status_icon_new (GTK_WINDOW (window), hide_contact_list);

	if (connection) {
		/* We se the callback here because we need window */
		bacon_message_connection_set_callback (connection,
						       on_bacon_message_received,
						       window);
	}

	/* Handle channels */
	dispatcher = empathy_dispatcher_dup_singleton ();
	g_signal_connect (dispatcher, "dispatch", G_CALLBACK (dispatch_cb), NULL);

	chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
	empathy_chatroom_manager_observe (chatroom_manager, dispatcher);

	notify_init (_(PACKAGE_NAME));
	/* Create the call factory */
	call_factory = empathy_call_factory_initialise ();
	g_signal_connect (G_OBJECT (call_factory), "new-call-handler",
		G_CALLBACK (new_call_handler_cb), NULL);

	gtk_main ();

	empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE);

	g_object_unref (mc);
	g_object_unref (idle);
	g_object_unref (icon);
	g_object_unref (dispatcher);
	g_object_unref (chatroom_manager);

	notify_uninit ();

	return EXIT_SUCCESS;
}
Exemplo n.º 12
0
int
main (int argc, char *argv[])
{
#if HAVE_GEOCLUE
  EmpathyLocationManager *location_manager = NULL;
#endif
  EmpathyStatusIcon *icon;
  EmpathyDispatcher *dispatcher;
  TpAccountManager *account_manager;
  EmpathyLogManager *log_manager;
  EmpathyChatroomManager *chatroom_manager;
  EmpathyCallFactory *call_factory;
  EmpathyFTFactory  *ft_factory;
  GtkWidget *window;
  EmpathyIdle *idle;
  EmpathyConnectivity *connectivity;
  GError *error = NULL;
  TpDBusDaemon *dbus_daemon;
  UniqueApp *unique_app;
  gboolean chatroom_manager_ready;

  GOptionContext *optcontext;
  GOptionEntry options[] = {
      { "no-connect", 'n',
        0, G_OPTION_ARG_NONE, &no_connect,
        N_("Don't connect on startup"),
        NULL },
      { "start-hidden", 'h',
        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 },
      { NULL }
  };

  /* Init */
  g_thread_init (NULL);
  empathy_init ();

  optcontext = g_option_context_new (N_("- Empathy IM Client"));
  g_option_context_add_group (optcontext, gst_init_get_option_group ());
  g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
  g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);

  if (!g_option_context_parse (optcontext, &argc, &argv, &error)) {
    g_print ("%s\nRun '%s --help' to see a full list of available command line options.\n",
        error->message, argv[0]);
    g_warning ("Error in empathy init: %s", error->message);
    return EXIT_FAILURE;
  }

  g_option_context_free (optcontext);

  empathy_gtk_init ();
  g_set_application_name (_(PACKAGE_NAME));
  g_setenv ("PULSE_PROP_media.role", "phone", TRUE);

#if HAVE_LIBCHAMPLAIN
  gtk_clutter_init (&argc, &argv);
#endif

  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

#ifdef ENABLE_DEBUG
  /* Set up debugger */
  g_log_set_default_handler (default_log_handler, NULL);
#endif

  unique_app = unique_app_new_with_commands ("org.gnome.Empathy",
      NULL, "accounts_dialog", COMMAND_ACCOUNTS_DIALOG, NULL);

  if (unique_app_is_running (unique_app))
    {
      unique_app_send_message (unique_app, account_dialog_only ?
          COMMAND_ACCOUNTS_DIALOG : UNIQUE_ACTIVATE, NULL);

      g_object_unref (unique_app);
      return EXIT_SUCCESS;
    }

  /* Take well-known name */
  dbus_daemon = tp_dbus_daemon_dup (&error);
  if (error == NULL)
    {
      if (!tp_dbus_daemon_request_name (dbus_daemon,
          "org.gnome.Empathy", TRUE, &error))
        {
          DEBUG ("Failed to request well-known name: %s",
                 error ? error->message : "no message");
          g_clear_error (&error);
        }
      g_object_unref (dbus_daemon);
    }
  else
    {
      DEBUG ("Failed to dup dbus daemon: %s",
             error ? error->message : "no message");
      g_clear_error (&error);
    }

  if (account_dialog_only)
    {
      account_manager = tp_account_manager_dup ();
      show_accounts_ui (NULL, TRUE);

      gtk_main ();

      g_object_unref (account_manager);
      return 0;
    }

  notify_init (_(PACKAGE_NAME));

  /* Setting up Idle */
  idle = empathy_idle_dup_singleton ();
  empathy_idle_set_auto_away (idle, TRUE);

  /* Setting up Connectivity */
  connectivity = empathy_connectivity_dup_singleton ();
  use_conn_notify_cb (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
      connectivity);
  empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
      use_conn_notify_cb, connectivity);

  /* account management */
  account_manager = tp_account_manager_dup ();
  tp_account_manager_prepare_async (account_manager, NULL,
      account_manager_ready_cb, NULL);

  /* Handle channels */
  dispatcher = setup_dispatcher ();
  g_signal_connect (dispatcher, "dispatch", G_CALLBACK (dispatch_cb), NULL);

  migrate_config_to_xdg_dir ();

  /* Setting up UI */
  window = empathy_main_window_show ();
  icon = empathy_status_icon_new (GTK_WINDOW (window), start_hidden);

  g_signal_connect (unique_app, "message-received",
      G_CALLBACK (unique_app_message_cb), window);

  /* Logging */
  log_manager = empathy_log_manager_dup_singleton ();
  empathy_log_manager_observe (log_manager, dispatcher);

  chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
  empathy_chatroom_manager_observe (chatroom_manager, dispatcher);

  g_object_get (chatroom_manager, "ready", &chatroom_manager_ready, NULL);
  if (!chatroom_manager_ready)
    {
      g_signal_connect (G_OBJECT (chatroom_manager), "notify::ready",
          G_CALLBACK (chatroom_manager_ready_cb), account_manager);
    }
  else
    {
      chatroom_manager_ready_cb (chatroom_manager, NULL, account_manager);
    }

  /* Create the call factory */
  call_factory = empathy_call_factory_initialise ();
  g_signal_connect (G_OBJECT (call_factory), "new-call-handler",
      G_CALLBACK (new_call_handler_cb), NULL);
  /* Create the FT factory */
  ft_factory = empathy_ft_factory_dup_singleton ();
  g_signal_connect (ft_factory, "new-ft-handler",
      G_CALLBACK (new_ft_handler_cb), NULL);
  g_signal_connect (ft_factory, "new-incoming-transfer",
      G_CALLBACK (new_incoming_transfer_cb), NULL);

  /* Location mananger */
#if HAVE_GEOCLUE
  location_manager = empathy_location_manager_dup_singleton ();
#endif

  gtk_main ();

  empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);

  g_object_unref (idle);
  g_object_unref (connectivity);
  g_object_unref (icon);
  g_object_unref (account_manager);
  g_object_unref (log_manager);
  g_object_unref (dispatcher);
  g_object_unref (chatroom_manager);
#if HAVE_GEOCLUE
  g_object_unref (location_manager);
#endif
  g_object_unref (ft_factory);
  g_object_unref (unique_app);

  notify_uninit ();

  return EXIT_SUCCESS;
}
int
main (int argc,
    char **argv)
{
  GtkWidget *window, *view, *scrolled, *box, *search;
  GError *error = NULL;
  GOptionContext *context;
  EmpathyRosterModel *model;

  gtk_init (&argc, &argv);
  empathy_gtk_init ();

  context = g_option_context_new ("- test tree model performance");
  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
  g_option_context_add_group (context, gtk_get_option_group (TRUE));
  if (!g_option_context_parse (context, &argc, &argv, &error))
    {
      g_print ("option parsing failed: %s\n", error->message);
      return 1;
    }

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  empathy_set_css_provider (window);

  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);

  model = EMPATHY_ROSTER_MODEL (empathy_roster_model_aggregator_new (
          filter, NULL));
  view = empathy_roster_view_new (model);

  g_object_unref (model);
  g_signal_connect (view, "individual-activated",
      G_CALLBACK (individual_activated_cb), NULL);
  g_signal_connect (view, "popup-individual-menu",
      G_CALLBACK (popup_individual_menu_cb), NULL);
  g_signal_connect (view, "notify::empty",
      G_CALLBACK (empty_cb), NULL);
  g_signal_connect (view, "individual-tooltip",
      G_CALLBACK (individual_tooltip_cb), NULL);

  gtk_widget_set_has_tooltip (view, TRUE);

  empathy_roster_view_show_offline (EMPATHY_ROSTER_VIEW (view), show_offline);
  empathy_roster_view_show_groups (EMPATHY_ROSTER_VIEW (view), show_groups);

  search = tpaw_live_search_new (view);
  empathy_roster_view_set_live_search (EMPATHY_ROSTER_VIEW (view),
      TPAW_LIVE_SEARCH (search));

  scrolled = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  gtk_container_add (GTK_CONTAINER (scrolled), view);

  gtk_box_pack_start (GTK_BOX (box), search, FALSE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX (box), scrolled, TRUE, TRUE, 0);
  gtk_container_add (GTK_CONTAINER (window), box);

  gtk_window_set_default_size (GTK_WINDOW (window), 300, 600);
  gtk_widget_show_all (window);

  g_signal_connect_swapped (window, "destroy",
      G_CALLBACK (gtk_main_quit), NULL);

  gtk_main ();

  return 0;
}
Exemplo n.º 14
0
int
main (int argc,
    char *argv[])
{
  GOptionContext *optcontext;
  GOptionEntry options[] = {
      { NULL }
  };
#ifdef ENABLE_DEBUG
  TpDebugSender *debug_sender;
#endif
  GError *error = NULL;
  EmpathyChatManager *chat_mgr;
  EmpathyIdle *idle;
  gint retval;

  /* Init */
  g_thread_init (NULL);

  optcontext = g_option_context_new (N_("- Empathy Chat Client"));
  g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
  g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);

  if (!g_option_context_parse (optcontext, &argc, &argv, &error))
    {
      g_print ("%s\nRun '%s --help' to see a full list of available command "
          "line options.\n",
          error->message, argv[0]);
      g_warning ("Error in empathy-av init: %s", error->message);
      return EXIT_FAILURE;
    }

  g_option_context_free (optcontext);

  empathy_gtk_init ();

  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  app = gtk_application_new (EMPATHY_CHAT_DBUS_NAME, G_APPLICATION_IS_SERVICE);
  g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);

#ifdef ENABLE_DEBUG
  /* Set up debug sender */
  debug_sender = tp_debug_sender_dup ();
  g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif

  /* Setting up Idle */
  idle = empathy_idle_dup_singleton ();

  chat_mgr = empathy_chat_manager_dup_singleton ();

  g_signal_connect (chat_mgr, "handled-chats-changed",
      G_CALLBACK (handled_chats_changed_cb), GUINT_TO_POINTER (1));

  if (g_getenv ("EMPATHY_PERSIST") != NULL)
    {
      DEBUG ("Disable timer");

      use_timer = FALSE;
    }

  /* the inactivity timeout can only be set while the application is held */
  g_application_hold (G_APPLICATION (app));
  g_application_set_inactivity_timeout (G_APPLICATION (app), TIMEOUT * 1000);
  g_application_release (G_APPLICATION (app));

  DEBUG ("Waiting for text channels to handle");

  retval = g_application_run (G_APPLICATION (app), argc, argv);

  g_object_unref (app);
  g_object_unref (idle);
  g_object_unref (chat_mgr);

#ifdef ENABLE_DEBUG
  g_object_unref (debug_sender);
#endif

  return retval;
}
Exemplo n.º 15
0
int
main (int argc,
    char **argv)
{
  GOptionContext *context;
  GError *error = NULL;
  EmpathyAuthFactory *factory;
  TpDebugSender *debug_sender;
  TpSimpleClientFactory *tp_factory;
  TpDBusDaemon *dbus;

  context = g_option_context_new (N_(" — Empathy authentication client"));
  g_option_context_add_group (context, gtk_get_option_group (TRUE));
  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);

  if (!g_option_context_parse (context, &argc, &argv, &error))
    {
      g_print ("%s\nRun '%s --help' to see a full list of available command "
          "line options.\n", error->message, argv[0]);
      g_warning ("Error in empathy-auth-client init: %s", error->message);
      return EXIT_FAILURE;
    }

  g_option_context_free (context);

  empathy_gtk_init ();
  gnutls_global_init ();
  g_set_application_name (_("Empathy authentication client"));

  /* Make empathy and empathy-auth-client appear as the same app in
   * gnome-shell */
  g_set_prgname ("empathy");
  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  /* There is no 'main' UI window so just use the default GdkScreen */
  empathy_set_css_provider (NULL);

#ifdef ENABLE_DEBUG
  /* Set up debug sender */
  debug_sender = tp_debug_sender_dup ();
  g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif

  dbus = tp_dbus_daemon_dup (NULL);
  tp_factory = tp_simple_client_factory_new (dbus);
  tp_simple_client_factory_add_account_features_varargs (tp_factory,
      TP_ACCOUNT_FEATURE_STORAGE,
      0);

  factory = empathy_auth_factory_new (tp_factory);
  g_object_unref (tp_factory);
  g_object_unref (dbus);

  g_signal_connect (factory, "new-server-tls-handler",
      G_CALLBACK (auth_factory_new_tls_handler_cb), NULL);

  g_signal_connect (factory, "new-server-sasl-handler",
      G_CALLBACK (auth_factory_new_sasl_handler_cb), NULL);

  g_signal_connect (factory, "auth-password-failed",
      G_CALLBACK (auth_factory_auth_passsword_failed), NULL);

  if (!empathy_auth_factory_register (factory, &error))
    {
      g_critical ("Failed to register the auth factory: %s\n", error->message);
      g_error_free (error);
      g_object_unref (factory);

      return EXIT_FAILURE;
    }

  DEBUG ("Empathy auth client started.");

  if (g_getenv ("EMPATHY_PERSIST") != NULL)
    {
      DEBUG ("Timed-exit disabled");

      use_timer = FALSE;
    }

  /* Wait for the migration code to be done before starting the timer */
  empathy_sanity_checking_run_async (sanity_cb, NULL);

  gtk_main ();

  g_object_unref (factory);
  g_object_unref (debug_sender);

  return EXIT_SUCCESS;
}
Exemplo n.º 16
0
int
main (int argc,
    char *argv[])
{
  GOptionContext *optcontext;
  GOptionEntry options[] = {
      { NULL }
  };
#ifdef ENABLE_DEBUG
  TpDebugSender *debug_sender;
#endif
  GError *error = NULL;
  gint retval;

  /* Init */
  g_thread_init (NULL);

  optcontext = g_option_context_new (N_("- Empathy Audio/Video Client"));
  g_option_context_add_group (optcontext, gst_init_get_option_group ());
  g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
  g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);

  if (!g_option_context_parse (optcontext, &argc, &argv, &error)) {
    g_print ("%s\nRun '%s --help' to see a full list of available command "
        "line options.\n",
        error->message, argv[0]);
    g_warning ("Error in empathy-av init: %s", error->message);
    return EXIT_FAILURE;
  }

  g_option_context_free (optcontext);

  clutter_gst_init (&argc, &argv);

  empathy_gtk_init ();
  g_set_application_name (_("Empathy Audio/Video Client"));
  g_setenv ("PULSE_PROP_media.role", "phone", TRUE);

  /* Make empathy and empathy-av appear as the same app in gnome-shell */
  gdk_set_program_class ("Empathy");
  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  app = gtk_application_new (EMPATHY_AV_DBUS_NAME, G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);

#ifdef ENABLE_DEBUG
  /* Set up debug sender */
  debug_sender = tp_debug_sender_dup ();
  g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif

  if (g_getenv ("EMPATHY_PERSIST") != NULL)
    {
      DEBUG ("Disable timer");

      use_timer = FALSE;
    }

  /* the inactivity timeout can only be set while the application is held */
  g_application_hold (G_APPLICATION (app));
  g_application_set_inactivity_timeout (G_APPLICATION (app), TIMEOUT * 1000);
  g_application_release (G_APPLICATION (app));

  retval = g_application_run (G_APPLICATION (app), argc, argv);

  g_object_unref (app);
  tp_clear_object (&call_factory);

#ifdef ENABLE_DEBUG
  g_object_unref (debug_sender);
#endif

  return retval;
}
Exemplo n.º 17
0
int
main (int argc,
    char *argv[])
{
  GOptionContext *optcontext;
  GOptionEntry options[] = {
      { NULL }
  };
#ifdef ENABLE_DEBUG
  TpDebugSender *debug_sender;
#endif
  GError *error = NULL;
  gint retval;
  GtkSettings *gtk_settings;

  /* Init */
  g_thread_init (NULL);

#ifdef GDK_WINDOWING_X11
  /* We can't call clutter_gst_init() before gtk_clutter_init(), so no choice
   * but to intiialise X11 threading ourself */
  XInitThreads ();
#endif

  /* Clutter needs this */
  gdk_disable_multidevice ();

  optcontext = g_option_context_new (N_("- Empathy Audio/Video Client"));
  g_option_context_add_group (optcontext, gst_init_get_option_group ());
  g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
  g_option_context_add_group (optcontext, cogl_get_option_group ());
  g_option_context_add_group (optcontext,
      clutter_get_option_group_without_init ());
  g_option_context_add_group (optcontext, gtk_clutter_get_option_group ());
  g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);

  if (!g_option_context_parse (optcontext, &argc, &argv, &error)) {
    g_print ("%s\nRun '%s --help' to see a full list of available command "
        "line options.\n",
        error->message, argv[0]);
    g_warning ("Error in empathy-call init: %s", error->message);
    return EXIT_FAILURE;
  }

  g_option_context_free (optcontext);

  clutter_gst_init (&argc, &argv);

  empathy_gtk_init ();
  g_set_application_name (_("Empathy Audio/Video Client"));

  /* Make empathy and empathy-call appear as the same app in gnome-shell */
  gdk_set_program_class ("Empathy");
  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  gtk_settings = gtk_settings_get_default ();
  g_object_set (G_OBJECT (gtk_settings), "gtk-application-prefer-dark-theme",
      TRUE, NULL);

  app = gtk_application_new (EMPATHY_CALL_DBUS_NAME, G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);

#ifdef ENABLE_DEBUG
  /* Set up debug sender */
  debug_sender = tp_debug_sender_dup ();
  g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif

  if (g_getenv ("EMPATHY_PERSIST") != NULL)
    {
      DEBUG ("Disable timer");

      use_timer = FALSE;
    }

  call_windows = g_hash_table_new_full (g_direct_hash, g_direct_equal,
      g_object_unref, NULL);

  /* the inactivity timeout can only be set while the application is held */
  g_application_hold (G_APPLICATION (app));
  g_application_set_inactivity_timeout (G_APPLICATION (app), TIMEOUT * 1000);
  g_application_release (G_APPLICATION (app));

  retval = g_application_run (G_APPLICATION (app), argc, argv);

  g_hash_table_unref (call_windows);
  g_object_unref (app);
  tp_clear_object (&call_factory);

#ifdef ENABLE_DEBUG
  g_object_unref (debug_sender);
#endif

  return retval;
}
Exemplo n.º 18
0
int
main (int argc, char *argv[])
{
  TpAccountManager *account_manager;
  GError *error = NULL;
  UniqueApp *unique_app;

  GOptionContext *optcontext;
  GOptionEntry options[] = {
      { "hidden", 'h',
        0, G_OPTION_ARG_NONE, &hidden,
        N_("Don't display any dialogs; do any work (eg, importing) and exit"),
        NULL },
      { "if-needed", 'n',
        0, G_OPTION_ARG_NONE, &only_if_needed,
        N_("Don't display any dialogs if there are any non-salut accounts"),
        NULL },
      { "select-account", 's',
        G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &selected_account_name,
        N_("Initially select given account (eg, "
            "gabble/jabber/foo_40example_2eorg0)"),
        N_("<account-id>") },

      { NULL }
  };

  g_thread_init (NULL);
  empathy_init ();

  optcontext = g_option_context_new (N_("- Empathy Accounts"));
  g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
  g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);

  if (!g_option_context_parse (optcontext, &argc, &argv, &error))
    {
      g_print ("%s\nRun '%s --help' to see a full list of available command line options.\n",
          error->message, argv[0]);
      g_warning ("Error in empathy init: %s", error->message);
      return EXIT_FAILURE;
    }

  g_option_context_free (optcontext);

  empathy_gtk_init ();

  g_set_application_name (_("Empathy Accounts"));

  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  unique_app = unique_app_new (EMPATHY_ACCOUNTS_DBUS_NAME, NULL);

  if (unique_app_is_running (unique_app))
    {
      unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL);

      g_object_unref (unique_app);
      return EXIT_SUCCESS;
    }

  account_manager = tp_account_manager_dup ();

  tp_account_manager_prepare_async (account_manager, NULL,
    account_manager_ready_for_accounts_cb, selected_account_name);

  g_signal_connect (unique_app, "message-received",
      G_CALLBACK (unique_app_message_cb), NULL);

  gtk_main ();

  g_object_unref (account_manager);
  g_object_unref (unique_app);

  return EXIT_SUCCESS;
}