ref: use gnome C style conventions

This commit is contained in:
noise 2026-03-01 00:35:36 +03:00
parent 5a2fe1756c
commit 3db57eb3fc
3 changed files with 13 additions and 14 deletions

View File

@ -9,7 +9,7 @@ static void register_with_portal (void) {
GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (bus == NULL) { if (bus == NULL) {
g_warning ("portal register: can't get session bus: %s", error->message); g_warning ("portal register: can't get session bus: %s", error->message);
g_error_free (error); g_clear_error (&error);
return; return;
} }
GVariantBuilder options; GVariantBuilder options;
@ -28,7 +28,7 @@ static void register_with_portal (void) {
-1, NULL, &error); -1, NULL, &error);
if (result == NULL) { if (result == NULL) {
g_info ("portal register: %s", error->message); g_info ("portal register: %s", error->message);
g_error_free (error); g_clear_error (&error);
} else { } else {
g_variant_unref (result); g_variant_unref (result);
} }

View File

@ -93,8 +93,8 @@ static void toggle_window(MoeMojiApplication *self) {
} }
} }
static gboolean on_close_request(GtkWindow *window, gpointer user_data) { static gboolean on_close_request(GtkWindow *window,
(void)user_data; G_GNUC_UNUSED gpointer user_data) {
gtk_widget_set_visible(GTK_WIDGET(window), FALSE); gtk_widget_set_visible(GTK_WIDGET(window), FALSE);
return TRUE; return TRUE;
} }
@ -297,7 +297,7 @@ static void setup_sni(MoeMojiApplication *self) {
g_dbus_node_info_new_for_xml(sni_introspection_xml, &error); g_dbus_node_info_new_for_xml(sni_introspection_xml, &error);
if (sni_node == NULL) { if (sni_node == NULL) {
g_warning("Failed to parse SNI introspection XML: %s", error->message); g_warning("Failed to parse SNI introspection XML: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
self->sni_registration_id = g_dbus_connection_register_object( self->sni_registration_id = g_dbus_connection_register_object(
@ -306,14 +306,14 @@ static void setup_sni(MoeMojiApplication *self) {
g_dbus_node_info_unref(sni_node); g_dbus_node_info_unref(sni_node);
if (self->sni_registration_id == 0) { if (self->sni_registration_id == 0) {
g_warning("Failed to register SNI object: %s", error->message); g_warning("Failed to register SNI object: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
GDBusNodeInfo *menu_node = GDBusNodeInfo *menu_node =
g_dbus_node_info_new_for_xml(dbusmenu_introspection_xml, &error); g_dbus_node_info_new_for_xml(dbusmenu_introspection_xml, &error);
if (menu_node == NULL) { if (menu_node == NULL) {
g_warning("Failed to parse dbusmenu introspection XML: %s", error->message); g_warning("Failed to parse dbusmenu introspection XML: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
self->menu_registration_id = g_dbus_connection_register_object( self->menu_registration_id = g_dbus_connection_register_object(
@ -322,7 +322,7 @@ static void setup_sni(MoeMojiApplication *self) {
g_dbus_node_info_unref(menu_node); g_dbus_node_info_unref(menu_node);
if (self->menu_registration_id == 0) { if (self->menu_registration_id == 0) {
g_warning("dbusmenu register: %s", error->message); g_warning("dbusmenu register: %s", error->message);
g_error_free(error); g_clear_error(&error);
} }
const gchar *unique_name = g_dbus_connection_get_unique_name(self->dbus_conn); const gchar *unique_name = g_dbus_connection_get_unique_name(self->dbus_conn);
g_dbus_connection_call( g_dbus_connection_call(
@ -332,11 +332,10 @@ static void setup_sni(MoeMojiApplication *self) {
NULL, NULL, NULL); NULL, NULL, NULL);
} }
static void on_shortcuts_activated(GDBusProxy *proxy, const gchar *sender_name, static void on_shortcuts_activated(G_GNUC_UNUSED GDBusProxy *proxy,
G_GNUC_UNUSED const gchar *sender_name,
const gchar *signal_name, const gchar *signal_name,
GVariant *parameters, gpointer user_data) { GVariant *parameters, gpointer user_data) {
(void)proxy;
(void)sender_name;
if (g_strcmp0(signal_name, "Activated") != 0) if (g_strcmp0(signal_name, "Activated") != 0)
return; return;
MoeMojiApplication *self = MOEMOJI_APPLICATION(user_data); MoeMojiApplication *self = MOEMOJI_APPLICATION(user_data);
@ -481,7 +480,7 @@ static void setup_global_shortcuts(MoeMojiApplication *self) {
"org.freedesktop.portal.GlobalShortcuts", NULL, &error); "org.freedesktop.portal.GlobalShortcuts", NULL, &error);
if (self->shortcuts_proxy == NULL) { if (self->shortcuts_proxy == NULL) {
g_warning("GlobalShortcuts: Failed to create proxy: %s", error->message); g_warning("GlobalShortcuts: Failed to create proxy: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
g_timeout_add(500, (GSourceFunc)begin_create_session, self); g_timeout_add(500, (GSourceFunc)begin_create_session, self);

View File

@ -222,8 +222,8 @@ static void update_spacer_height(MoeMojiWindow *self) {
gtk_widget_set_size_request(self->bottom_spacer, -1, spacer_h); gtk_widget_set_size_request(self->bottom_spacer, -1, spacer_h);
} }
static void on_scroll_changed(GtkAdjustment *adj, gpointer user_data) { static void on_scroll_changed(G_GNUC_UNUSED GtkAdjustment *adj,
(void)adj; gpointer user_data) {
MoeMojiWindow *self = MOEMOJI_WINDOW(user_data); MoeMojiWindow *self = MOEMOJI_WINDOW(user_data);
update_chip_from_scroll(self); update_chip_from_scroll(self);
} }