Skip to content

Commit

Permalink
Get rid of compiler warnings
Browse files Browse the repository at this point in the history
If we can, we should rejig the code to avoid declaring unused arguments
and variables; if we can't, we can use G_GNUC_UNUSED to eliminate the
warning.
  • Loading branch information
ebassi committed Oct 21, 2023
1 parent 89650d9 commit e90e3e2
Show file tree
Hide file tree
Showing 23 changed files with 118 additions and 134 deletions.
20 changes: 8 additions & 12 deletions src/access.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,9 @@ send_response (AccessDialogHandle *handle)
}

static void
access_dialog_response (GtkWidget *widget,
int response,
gpointer user_data)
access_dialog_response (AccessDialogHandle *handle,
int response)
{
AccessDialogHandle *handle = user_data;

switch (response)
{
default:
Expand All @@ -138,9 +135,8 @@ access_dialog_response (GtkWidget *widget,
}

static gboolean
handle_close (XdpImplRequest *object,
GDBusMethodInvocation *invocation,
AccessDialogHandle *handle)
handle_close (AccessDialogHandle *handle,
GDBusMethodInvocation *invocation G_GNUC_UNUSED)
{
GVariantBuilder opt_builder;

Expand Down Expand Up @@ -181,7 +177,7 @@ add_choice (GtkWidget *box,
{
GtkWidget *label;
GtkWidget *group = NULL;
int i;
gsize i;

label = gtk_label_new (name);
gtk_widget_show (label);
Expand Down Expand Up @@ -315,7 +311,7 @@ handle_access_dialog (XdpImplAccess *object,

if (choices)
{
int i;
gsize i;

choice_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
for (i = 0; i < g_variant_n_children (choices); i++)
Expand Down Expand Up @@ -359,9 +355,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
handle->external_parent = external_parent;
handle->choices = choice_table;

g_signal_connect (request, "handle-close", G_CALLBACK (handle_close), handle);
g_signal_connect_swapped (request, "handle-close", G_CALLBACK (handle_close), handle);

g_signal_connect (dialog, "response", G_CALLBACK (access_dialog_response), handle);
g_signal_connect_swapped (dialog, "response", G_CALLBACK (access_dialog_response), handle);

gtk_widget_realize (dialog);

Expand Down
16 changes: 6 additions & 10 deletions src/account.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,12 @@ send_response (AccountDialogHandle *handle)
}

static void
account_dialog_done (GtkWidget *widget,
account_dialog_done (AccountDialogHandle *handle,
int response,
const char *user_name,
const char *real_name,
const char *icon_file,
gpointer user_data)
const char *icon_file)
{
AccountDialogHandle *handle = user_data;

g_clear_pointer (&handle->user_name, g_free);
g_clear_pointer (&handle->real_name, g_free);
g_clear_pointer (&handle->icon_uri, g_free);
Expand Down Expand Up @@ -123,9 +120,8 @@ account_dialog_done (GtkWidget *widget,
}

static gboolean
handle_close (XdpImplRequest *object,
GDBusMethodInvocation *invocation,
AccountDialogHandle *handle)
handle_close (AccountDialogHandle *handle,
GDBusMethodInvocation *invocation G_GNUC_UNUSED)
{
GVariantBuilder opt_builder;

Expand Down Expand Up @@ -206,9 +202,9 @@ handle_get_user_information (XdpImplAccount *object,
handle->real_name = g_strdup (real_name);
handle->icon_uri = g_filename_to_uri (icon_file, NULL, NULL);

g_signal_connect (request, "handle-close", G_CALLBACK (handle_close), handle);
g_signal_connect_swapped (request, "handle-close", G_CALLBACK (handle_close), handle);

g_signal_connect (dialog, "done", G_CALLBACK (account_dialog_done), handle);
g_signal_connect_swapped (dialog, "done", G_CALLBACK (account_dialog_done), handle);

gtk_widget_realize (dialog);

Expand Down
3 changes: 2 additions & 1 deletion src/accountdialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ account_dialog_finalize (GObject *object)
}

static gboolean
account_dialog_delete_event (GtkWidget *dialog, GdkEventAny *event)
account_dialog_delete_event (GtkWidget *dialog,
GdkEventAny *event G_GNUC_UNUSED)
{
gtk_widget_hide (dialog);

Expand Down
2 changes: 1 addition & 1 deletion src/appchooser.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ handle_choose_application (XdpImplAppChooser *object,
}

static gboolean
handle_update_choices (XdpImplAppChooser *object,
handle_update_choices (XdpImplAppChooser *object G_GNUC_UNUSED,
GDBusMethodInvocation *invocation,
const char *arg_handle,
const char **choices)
Expand Down
43 changes: 19 additions & 24 deletions src/appchooserdialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ G_DEFINE_TYPE (AppChooserDialog, app_chooser_dialog, GTK_TYPE_WINDOW)
static void
update_header (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer data)
gpointer data G_GNUC_UNUSED)
{
if (before != NULL &&
gtk_list_box_row_get_header (row) == NULL)
Expand Down Expand Up @@ -125,7 +125,7 @@ close_dialog (AppChooserDialog *dialog,
static void
show_more (AppChooserDialog *dialog)
{
int i;
guint i;

gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dialog->scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
Expand All @@ -147,9 +147,8 @@ show_more (AppChooserDialog *dialog)
}

static void
row_activated (GtkListBox *list,
GtkWidget *row,
AppChooserDialog *dialog)
row_activated (AppChooserDialog *dialog,
GtkWidget *row)
{
GAppInfo *info = NULL;

Expand All @@ -165,24 +164,21 @@ row_activated (GtkListBox *list,
}

static void
row_selected (GtkListBox *list,
GtkWidget *row,
AppChooserDialog *dialog)
row_selected (AppChooserDialog *dialog,
GtkWidget *row)
{
gtk_widget_set_sensitive (dialog->open_button, TRUE);
dialog->selected_row = row;
}

static void
cancel_clicked (GtkWidget *button,
AppChooserDialog *dialog)
cancel_clicked (AppChooserDialog *dialog)
{
close_dialog (dialog, NULL);
}

static void
open_clicked (GtkWidget *button,
AppChooserDialog *dialog)
open_clicked (AppChooserDialog *dialog)
{
GAppInfo *info = NULL;

Expand Down Expand Up @@ -230,14 +226,14 @@ launch_software (AppChooserDialog *dialog)
}

static void
find_in_software (GtkWidget *button,
AppChooserDialog *dialog)
find_in_software (AppChooserDialog *dialog)
{
launch_software (dialog);
}

static gboolean
app_chooser_delete_event (GtkWidget *dialog, GdkEventAny *event)
app_chooser_delete_event (GtkWidget *dialog,
GdkEventAny *event G_GNUC_UNUSED)
{
close_dialog (APP_CHOOSER_DIALOG (dialog), NULL);

Expand Down Expand Up @@ -319,7 +315,7 @@ static void
ensure_default_in_initial_list (const char **choices,
const char *default_id)
{
int i;
guint i;
guint n_choices;

if (default_id == NULL)
Expand Down Expand Up @@ -350,11 +346,10 @@ ensure_default_in_initial_list (const char **choices,
}

static void
more_pressed (GtkGestureMultiPress *gesture,
more_pressed (AppChooserDialog *dialog,
int n_press,
double x,
double y,
AppChooserDialog *dialog)
double x G_GNUC_UNUSED,
double y)
{
if (n_press != 1)
return;
Expand All @@ -370,8 +365,8 @@ app_chooser_dialog_new (const char **choices,
const char *location)
{
AppChooserDialog *dialog;
int n_choices;
int i;
guint n_choices;
guint i;
g_autofree char *short_location = shorten_location (location);

dialog = g_object_new (app_chooser_dialog_get_type (), NULL);
Expand Down Expand Up @@ -446,7 +441,7 @@ app_chooser_dialog_new (const char **choices,
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_BUBBLE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_PRIMARY);

g_signal_connect (gesture, "pressed", G_CALLBACK (more_pressed), dialog);
g_signal_connect_swapped (gesture, "pressed", G_CALLBACK (more_pressed), dialog);

gtk_list_box_row_set_selectable (GTK_LIST_BOX_ROW (row), FALSE);
image = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_BUTTON);
Expand All @@ -467,7 +462,7 @@ void
app_chooser_dialog_update_choices (AppChooserDialog *dialog,
const char **choices)
{
int i;
guint i;
GPtrArray *new_choices;

new_choices = g_ptr_array_new ();
Expand Down
10 changes: 5 additions & 5 deletions src/appchooserdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<property name="visible">1</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="use-underline">1</property>
<signal name="clicked" handler="cancel_clicked"/>
<signal name="clicked" handler="cancel_clicked" swapped="yes"/>
</object>
</child>
<child>
Expand All @@ -23,7 +23,7 @@
<property name="label" translatable="yes">_Open</property>
<property name="use-underline">1</property>
<property name="can-default">1</property>
<signal name="clicked" handler="open_clicked"/>
<signal name="clicked" handler="open_clicked" swapped="yes"/>
<style>
<class name="suggested-action"/>
</style>
Expand Down Expand Up @@ -67,8 +67,8 @@
<class name="frame"/>
<class name="view"/>
</style>
<signal name="row-activated" handler="row_activated"/>
<signal name="row-selected" handler="row_selected"/>
<signal name="row-activated" handler="row_activated" swapped="yes"/>
<signal name="row-selected" handler="row_selected" swapped="yes"/>
<property name="selection-mode">single</property>
<property name="activate-on-single-click">0</property>
<property name="visible">1</property>
Expand Down Expand Up @@ -140,7 +140,7 @@
<style>
<class name="suggested-action"/>
</style>
<signal name="clicked" handler="find_in_software"/>
<signal name="clicked" handler="find_in_software" swapped="yes"/>
<child>
<object class="GtkBox">
<property name="visible">1</property>
Expand Down
11 changes: 4 additions & 7 deletions src/dynamic-launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,9 @@ send_prepare_install_response (InstallDialogHandle *handle)
}

static void
handle_prepare_install_response (GtkDialog *dialog,
gint response,
gpointer data)
handle_prepare_install_response (InstallDialogHandle *handle,
int response)
{
InstallDialogHandle *handle = data;

switch (response)
{
default:
Expand Down Expand Up @@ -329,7 +326,7 @@ handle_prepare_install (XdpImplDynamicLauncher *object,

g_signal_connect (request, "handle-close", G_CALLBACK (handle_close), handle);

g_signal_connect (dialog, "response", G_CALLBACK (handle_prepare_install_response), handle);
g_signal_connect_swapped (dialog, "response", G_CALLBACK (handle_prepare_install_response), handle);

gtk_widget_realize (dialog);

Expand All @@ -352,7 +349,7 @@ static gboolean
handle_request_install_token (XdpImplDynamicLauncher *object,
GDBusMethodInvocation *invocation,
const char *arg_app_id,
GVariant *arg_options)
GVariant *arg_options G_GNUC_UNUSED)
{
/* Generally these should be allowed in each desktop specific x-d-p backend,
* but add them here as well as a fallback.
Expand Down
2 changes: 1 addition & 1 deletion src/email.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ handle_compose_email (XdpImplEmail *object,
GDBusMethodInvocation *invocation,
const char *arg_handle,
const char *arg_app_id,
const char *arg_parent_window,
const char *arg_parent_window G_GNUC_UNUSED,
GVariant *arg_options)
{
g_autoptr(Request) request = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/externalwindow-wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ external_window_wayland_dispose (GObject *object)
}

static void
external_window_wayland_init (ExternalWindowWayland *external_window_wayland)
external_window_wayland_init (ExternalWindowWayland *self G_GNUC_UNUSED)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/externalwindow-x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ external_window_x11_dispose (GObject *object)
}

static void
external_window_x11_init (ExternalWindowX11 *external_window_x11)
external_window_x11_init (ExternalWindowX11 *self G_GNUC_UNUSED)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/externalwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ external_window_get_property (GObject *object,
}

static void
external_window_init (ExternalWindow *external_window)
external_window_init (ExternalWindow *self G_GNUC_UNUSED)
{
}

Expand Down
8 changes: 4 additions & 4 deletions src/fdonotification.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ fdo_find_notification_by_notify_id (guint32 id)

static void
notify_signal (GDBusConnection *connection,
const char *sender_name,
const char *object_path,
const char *interface_name,
const char *sender_name G_GNUC_UNUSED,
const char *object_path G_GNUC_UNUSED,
const char *interface_name G_GNUC_UNUSED,
const char *signal_name,
GVariant *parameters,
gpointer user_data)
gpointer user_data G_GNUC_UNUSED)
{
guint32 id = 0;
const char *action = NULL;
Expand Down
Loading

0 comments on commit e90e3e2

Please sign in to comment.