Commit 6c40b623 authored by Zeeshan Ali's avatar Zeeshan Ali

client-info: Remove redundant binary path API/code

parent 14daec6a
......@@ -42,7 +42,6 @@ struct _GClueClientInfoPrivate
GDBusProxy *dbus_proxy;
guint watch_id;
gchar *bin_path;
guint32 user_id;
};
......@@ -74,7 +73,6 @@ gclue_client_info_finalize (GObject *object)
}
g_clear_pointer (&priv->bus_name, g_free);
g_clear_pointer (&priv->bin_path, g_free);
g_clear_object (&priv->connection);
/* Chain up to the parent class */
......@@ -219,80 +217,6 @@ on_get_user_id_ready (GObject *source_object,
g_object_unref (task);
}
static void
on_proc_info_ready (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GFile *proc_file = G_FILE (source_object);
GFileInfo *proc_info;
GTask *task = G_TASK (user_data);
gpointer *info = g_task_get_source_object (task);
GClueClientInfoPrivate *priv = GCLUE_CLIENT_INFO (info)->priv;
GError *error = NULL;
proc_info = g_file_query_info_finish (proc_file, res, &error);
g_object_unref (proc_file);
if (proc_info == NULL) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
priv->bin_path = g_strdup (g_file_info_get_symlink_target (proc_info));
g_dbus_proxy_call (priv->dbus_proxy,
"GetConnectionUnixUser",
g_variant_new ("(s)", priv->bus_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
g_task_get_cancellable (task),
on_get_user_id_ready,
task);
g_object_unref (proc_info);
}
static void
on_get_process_id_ready (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GTask *task = G_TASK (user_data);
GError *error = NULL;
GVariant *results = NULL;
guint32 process_id;
char *proc_path;
GFile *proc_file;
results = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object),
res,
&error);
if (results == NULL)
goto error_out;
g_assert (g_variant_n_children (results) > 0);
g_variant_get_child (results, 0, "u", &process_id);
g_variant_unref (results);
proc_path = g_strdup_printf ("/proc/%u/exe", process_id);
proc_file = g_file_new_for_path (proc_path);
g_free (proc_path);
g_file_query_info_async (proc_file,
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
G_PRIORITY_DEFAULT,
g_task_get_cancellable (task),
on_proc_info_ready,
task);
return;
error_out:
g_task_return_error (task, error);
g_object_unref (task);
}
static void
on_dbus_proxy_ready (GObject *source_object,
GAsyncResult *res,
......@@ -311,12 +235,12 @@ on_dbus_proxy_ready (GObject *source_object,
}
g_dbus_proxy_call (priv->dbus_proxy,
"GetConnectionUnixProcessID",
"GetConnectionUnixUser",
g_variant_new ("(s)", priv->bus_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
g_task_get_cancellable (task),
on_get_process_id_ready,
on_get_user_id_ready,
task);
}
......@@ -408,14 +332,6 @@ gclue_client_info_get_bus_name (GClueClientInfo *info)
return info->priv->bus_name;
}
const char *
gclue_client_info_get_bin_path (GClueClientInfo *info)
{
g_return_val_if_fail (GCLUE_IS_CLIENT_INFO(info), NULL);
return info->priv->bin_path;
}
guint32
gclue_client_info_get_user_id (GClueClientInfo *info)
{
......
......@@ -66,7 +66,6 @@ void gclue_client_info_new_async (const char *bus_name
GClueClientInfo * gclue_client_info_new_finish (GAsyncResult *res,
GError **error);
const char * gclue_client_info_get_bus_name (GClueClientInfo *info);
const char * gclue_client_info_get_bin_path (GClueClientInfo *info);
guint32 gclue_client_info_get_user_id (GClueClientInfo *info);
gboolean gclue_client_info_check_bus_name (GClueClientInfo *info,
const char *bus_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment