diff options
author | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2014-01-28 21:21:26 +0000 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2014-01-28 21:21:26 +0000 |
commit | 6c40b623e747b71be231c52ccab2894f223b8f6c (patch) | |
tree | db455ab34363986070d2c74d51fba1e9292bec1a /src/gclue-client-info.c | |
parent | 14daec6a11cc5fa9e7bd0330758ac73450cc8295 (diff) | |
download | geoclue-6c40b623e747b71be231c52ccab2894f223b8f6c.tar.gz |
client-info: Remove redundant binary path API/code
Diffstat (limited to 'src/gclue-client-info.c')
-rw-r--r-- | src/gclue-client-info.c | 88 |
1 files changed, 2 insertions, 86 deletions
diff --git a/src/gclue-client-info.c b/src/gclue-client-info.c index 95ff4d4..9cde9bc 100644 --- a/src/gclue-client-info.c +++ b/src/gclue-client-info.c @@ -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 */ @@ -220,80 +218,6 @@ on_get_user_id_ready (GObject *source_object, } 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, gpointer user_data) @@ -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) { |