mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 13:23:07 +02:00
GDesktopAppInfo: Tidy up code a bit
* Remove an unneeded field from LaunchUrisData and add annotations * Rename local GError* variables to local_error * Use g_set_object * Fix indentation
This commit is contained in:
parent
361b4a8fc9
commit
d12cf95836
@ -3261,9 +3261,8 @@ g_desktop_app_info_launch_uris (GAppInfo *appinfo,
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GAppInfo *appinfo;
|
GList *uris; /* (element-type utf8) (owned) (nullable) */
|
||||||
GList *uris;
|
GAppLaunchContext *context; /* (owned) (nullable) */
|
||||||
GAppLaunchContext *context;
|
|
||||||
} LaunchUrisData;
|
} LaunchUrisData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3280,13 +3279,13 @@ launch_uris_with_dbus_cb (GObject *object,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GTask *task = G_TASK (user_data);
|
GTask *task = G_TASK (user_data);
|
||||||
GError *error = NULL;
|
GError *local_error = NULL;
|
||||||
|
|
||||||
g_dbus_connection_call_finish (G_DBUS_CONNECTION (object), result, &error);
|
g_dbus_connection_call_finish (G_DBUS_CONNECTION (object), result, &local_error);
|
||||||
if (error != NULL)
|
if (local_error != NULL)
|
||||||
{
|
{
|
||||||
g_dbus_error_strip_remote_error (error);
|
g_dbus_error_strip_remote_error (local_error);
|
||||||
g_task_return_error (task, g_steal_pointer (&error));
|
g_task_return_error (task, g_steal_pointer (&local_error));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
@ -3316,7 +3315,7 @@ launch_uris_bus_get_cb (GObject *object,
|
|||||||
LaunchUrisData *data = g_task_get_task_data (task);
|
LaunchUrisData *data = g_task_get_task_data (task);
|
||||||
GCancellable *cancellable = g_task_get_cancellable (task);
|
GCancellable *cancellable = g_task_get_cancellable (task);
|
||||||
GDBusConnection *session_bus;
|
GDBusConnection *session_bus;
|
||||||
GError *error = NULL;
|
GError *local_error = NULL;
|
||||||
|
|
||||||
session_bus = g_bus_get_finish (result, NULL);
|
session_bus = g_bus_get_finish (result, NULL);
|
||||||
|
|
||||||
@ -3342,10 +3341,10 @@ launch_uris_bus_get_cb (GObject *object,
|
|||||||
data->uris, data->context,
|
data->uris, data->context,
|
||||||
_SPAWN_FLAGS_DEFAULT, NULL,
|
_SPAWN_FLAGS_DEFAULT, NULL,
|
||||||
NULL, NULL, NULL, -1, -1, -1,
|
NULL, NULL, NULL, -1, -1, -1,
|
||||||
&error);
|
&local_error);
|
||||||
if (error != NULL)
|
if (local_error != NULL)
|
||||||
{
|
{
|
||||||
g_task_return_error (task, g_steal_pointer (&error));
|
g_task_return_error (task, g_steal_pointer (&local_error));
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
else if (session_bus)
|
else if (session_bus)
|
||||||
@ -3379,7 +3378,7 @@ g_desktop_app_info_launch_uris_async (GAppInfo *appinfo,
|
|||||||
|
|
||||||
data = g_new0 (LaunchUrisData, 1);
|
data = g_new0 (LaunchUrisData, 1);
|
||||||
data->uris = g_list_copy_deep (uris, (GCopyFunc) g_strdup, NULL);
|
data->uris = g_list_copy_deep (uris, (GCopyFunc) g_strdup, NULL);
|
||||||
data->context = (context != NULL) ? g_object_ref (context) : NULL;
|
g_set_object (&data->context, context);
|
||||||
g_task_set_task_data (task, g_steal_pointer (&data), (GDestroyNotify) launch_uris_data_free);
|
g_task_set_task_data (task, g_steal_pointer (&data), (GDestroyNotify) launch_uris_data_free);
|
||||||
|
|
||||||
g_bus_get (G_BUS_TYPE_SESSION, cancellable, launch_uris_bus_get_cb, task);
|
g_bus_get (G_BUS_TYPE_SESSION, cancellable, launch_uris_bus_get_cb, task);
|
||||||
@ -3929,7 +3928,7 @@ run_update_command (char *command,
|
|||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
GPid pid = 0;
|
GPid pid = 0;
|
||||||
GError *error = NULL;
|
GError *local_error = NULL;
|
||||||
|
|
||||||
argv[0] = command;
|
argv[0] = command;
|
||||||
argv[1] = g_build_filename (g_get_user_data_dir (), subdir, NULL);
|
argv[1] = g_build_filename (g_get_user_data_dir (), subdir, NULL);
|
||||||
@ -3942,7 +3941,7 @@ run_update_command (char *command,
|
|||||||
G_SPAWN_DO_NOT_REAP_CHILD,
|
G_SPAWN_DO_NOT_REAP_CHILD,
|
||||||
NULL, NULL, /* No setup function */
|
NULL, NULL, /* No setup function */
|
||||||
&pid,
|
&pid,
|
||||||
&error))
|
&local_error))
|
||||||
g_child_watch_add (pid, update_program_done, NULL);
|
g_child_watch_add (pid, update_program_done, NULL);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3952,8 +3951,8 @@ run_update_command (char *command,
|
|||||||
* dialog at this point, so we just do a g_warning to give the user a
|
* dialog at this point, so we just do a g_warning to give the user a
|
||||||
* chance of debugging it.
|
* chance of debugging it.
|
||||||
*/
|
*/
|
||||||
g_warning ("%s", error->message);
|
g_warning ("%s", local_error->message);
|
||||||
g_error_free (error);
|
g_error_free (local_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (argv[1]);
|
g_free (argv[1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user