Example #1
0
static void
empathy_contact_manager_init (EmpathyContactManager *manager)
{
	EmpathyContactManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
		EMPATHY_TYPE_CONTACT_MANAGER, EmpathyContactManagerPriv);
	TpDBusDaemon *bus;
	GError *error = NULL;

	manager->priv = priv;
	priv->lists = g_hash_table_new_full (empathy_proxy_hash,
					     empathy_proxy_equal,
					     (GDestroyNotify) g_object_unref,
					     (GDestroyNotify) g_object_unref);

	priv->favourites = g_hash_table_new_full (g_str_hash, g_str_equal,
						  (GDestroyNotify) g_free,
						  (GDestroyNotify)
						  g_hash_table_unref);

	priv->account_manager = tp_account_manager_dup ();
	priv->contact_monitor = NULL;

	tp_account_manager_prepare_async (priv->account_manager, NULL,
	    account_manager_prepared_cb, manager);

	bus = tp_dbus_daemon_dup (&error);

	if (error == NULL) {
		priv->logger = g_object_new (TP_TYPE_PROXY,
				"bus-name", "org.freedesktop.Telepathy.Logger",
				"object-path",
					"/org/freedesktop/Telepathy/Logger",
				"dbus-daemon", bus,
				NULL);
		g_object_unref (bus);

		tp_proxy_add_interface_by_id (priv->logger,
				EMP_IFACE_QUARK_LOGGER);

		logger_favourite_contacts_setup (manager);

		priv->favourite_contacts_changed_signal =
			emp_cli_logger_connect_to_favourite_contacts_changed (
				priv->logger,
				logger_favourite_contacts_changed_cb, NULL,
				NULL, G_OBJECT (manager), NULL);
	} else {
		DEBUG ("Failed to get telepathy-logger proxy: %s",
				error->message);
		g_clear_error (&error);
	}
}
Example #2
0
static void
empathy_tube_do_dispatch (EmpathyTubeDispatch *self)
{
  EmpathyTubeDispatchPriv *priv = GET_PRIV (self);
  TpChannel *channel;
  TpProxy *connection;
  TpProxy *thandler;
  gchar   *object_path;
  guint    handle_type;
  guint    handle;

  channel = empathy_dispatch_operation_get_channel (priv->operation);

  /* Create the proxy for the tube handler */
  thandler = g_object_new (TP_TYPE_PROXY,
    "dbus-connection", tp_get_bus (),
    "bus-name", priv->bus_name,
    "object-path", priv->object_path,
    NULL);

  tp_proxy_add_interface_by_id (thandler, EMP_IFACE_QUARK_TUBE_HANDLER);

  /* Give the tube to the handler */
  g_object_get (channel,
    "connection", &connection,
    "object-path", &object_path,
    "handle_type", &handle_type,
    "handle", &handle,
    NULL);

  emp_cli_tube_handler_call_handle_tube (thandler, -1,
    connection->bus_name, connection->object_path,
    object_path, handle_type, handle,
    empathy_tube_dispatch_handle_tube_cb, NULL, NULL, G_OBJECT (self));

  g_object_unref (thandler);
  g_object_unref (connection);
  g_free (object_path);
}
Example #3
0
void
empathy_chat_manager_call_undo_closed_chat (void)
{
  TpDBusDaemon *dbus_daemon = tp_dbus_daemon_dup (NULL);
  TpProxy *proxy;

  if (dbus_daemon == NULL)
    return;

  proxy = g_object_new (TP_TYPE_PROXY,
      "dbus-daemon", dbus_daemon,
      "dbus-connection", tp_proxy_get_dbus_connection (TP_PROXY (dbus_daemon)),
      "bus-name", EMPATHY_CHAT_BUS_NAME,
      "object-path", "/org/gnome/Empathy/ChatManager",
      NULL);

  tp_proxy_add_interface_by_id (proxy, EMP_IFACE_QUARK_CHAT_MANAGER);

  emp_cli_chat_manager_call_undo_closed_chat (proxy, -1, empathy_get_current_action_time (),
      NULL, NULL, NULL, NULL);

  g_object_unref (proxy);
  g_object_unref (dbus_daemon);
}
static void
debug_dialog_cm_chooser_changed_cb (GtkComboBox *cm_chooser,
    EmpathyDebugDialog *debug_dialog)
{
  EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
  MissionControl *mc;
  TpDBusDaemon *dbus;
  GError *error = NULL;
  gchar *bus_name;
  TpProxy *proxy;
  GtkTreeIter iter;

  if (!gtk_combo_box_get_active_iter (cm_chooser, &iter))
    {
      DEBUG ("No CM is selected");
      if (gtk_tree_model_iter_n_children (
          GTK_TREE_MODEL (priv->cms), NULL) > 0)
        {
          gtk_combo_box_set_active (cm_chooser, 0);
        }
      return;
    }

  mc = empathy_mission_control_dup_singleton ();
  dbus = tp_dbus_daemon_dup (&error);

  if (error != NULL)
    {
      DEBUG ("Failed at duping the dbus daemon: %s", error->message);
      g_object_unref (mc);
    }

  gtk_tree_model_get (GTK_TREE_MODEL (priv->cms), &iter,
      COL_CM_UNIQUE_NAME, &bus_name, -1);
  proxy = g_object_new (TP_TYPE_PROXY,
      "bus-name", bus_name,
      "dbus-daemon", dbus,
      "object-path", DEBUG_OBJECT_PATH,
      NULL);
  g_free (bus_name);

  gtk_list_store_clear (priv->store);

  /* Disable debug signalling */
  if (priv->proxy != NULL)
    debug_dialog_set_enabled (debug_dialog, FALSE);

  /* Disconnect from previous NewDebugMessage signal */
  if (priv->new_debug_message_signal != NULL)
    {
      tp_proxy_signal_connection_disconnect (priv->new_debug_message_signal);
      priv->new_debug_message_signal = NULL;
    }

  if (priv->proxy != NULL)
    g_object_unref (priv->proxy);

  priv->proxy = proxy;

  tp_proxy_add_interface_by_id (priv->proxy, emp_iface_quark_debug ());

  emp_cli_debug_call_get_messages (priv->proxy, -1,
      debug_dialog_get_messages_cb, debug_dialog, NULL, NULL);

  g_object_unref (dbus);
  g_object_unref (mc);
}