mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 23:32:14 +02:00
use g_autoptr for GError
This commit is contained in:
@@ -135,7 +135,7 @@ static void mm_manager_new_cb(GDBusConnection *connection,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
struct EG25Manager *manager)
|
struct EG25Manager *manager)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
g_autoptr (GError) *error = NULL;
|
||||||
|
|
||||||
manager->mm_manager = mm_manager_new_finish(res, &error);
|
manager->mm_manager = mm_manager_new_finish(res, &error);
|
||||||
if (!manager->mm_manager)
|
if (!manager->mm_manager)
|
||||||
|
@@ -42,14 +42,13 @@ static void inhibit_done(GObject *source,
|
|||||||
{
|
{
|
||||||
GDBusProxy *suspend_proxy = G_DBUS_PROXY(source);
|
GDBusProxy *suspend_proxy = G_DBUS_PROXY(source);
|
||||||
struct EG25Manager *manager = user_data;
|
struct EG25Manager *manager = user_data;
|
||||||
GError *error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
GVariant *res;
|
GVariant *res;
|
||||||
GUnixFDList *fd_list;
|
GUnixFDList *fd_list;
|
||||||
|
|
||||||
res = g_dbus_proxy_call_with_unix_fd_list_finish(suspend_proxy, &fd_list, result, &error);
|
res = g_dbus_proxy_call_with_unix_fd_list_finish(suspend_proxy, &fd_list, result, &error);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
g_warning("inhibit failed: %s", error->message);
|
g_warning("inhibit failed: %s", error->message);
|
||||||
g_error_free(error);
|
|
||||||
} else {
|
} else {
|
||||||
if (!fd_list || g_unix_fd_list_get_length(fd_list) != 1)
|
if (!fd_list || g_unix_fd_list_get_length(fd_list) != 1)
|
||||||
g_warning("didn't get a single fd back");
|
g_warning("didn't get a single fd back");
|
||||||
@@ -127,13 +126,12 @@ static void on_proxy_acquired(GObject *object,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
struct EG25Manager *manager)
|
struct EG25Manager *manager)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
char *owner;
|
char *owner;
|
||||||
|
|
||||||
manager->suspend_proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
|
manager->suspend_proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
|
||||||
if (!manager->suspend_proxy) {
|
if (!manager->suspend_proxy) {
|
||||||
g_warning("failed to acquire logind proxy: %s", error->message);
|
g_warning("failed to acquire logind proxy: %s", error->message);
|
||||||
g_clear_error(&error);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user