Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compile warnings #458

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions src/access.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "config.h"

#include "access.h"

#include <errno.h>
#include <locale.h>
#include <string.h>
Expand Down Expand Up @@ -110,12 +112,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 +137,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 +179,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 @@ -302,8 +300,8 @@ handle_access_dialog (XdpImplAccess *object,
0,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
arg_title,
NULL);
"%s",
arg_title);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fake_parent));
gtk_window_set_modal (GTK_WINDOW (dialog), modal);
gtk_dialog_add_button (GTK_DIALOG (dialog), deny_label, GTK_RESPONSE_CANCEL);
Expand All @@ -315,7 +313,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 +357,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
1 change: 1 addition & 0 deletions src/accountdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
typedef struct _AccountDialog AccountDialog;
typedef struct _AccountDialogClass AccountDialogClass;

GType account_dialog_get_type (void);
AccountDialog * account_dialog_new (const char *app_id,
const char *user_name,
const char *real_name,
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-x11.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
typedef struct _ExternalWindowX11 ExternalWindowX11;
typedef struct _ExternalWindowX11Class ExternalWindowX11Class;

GType external_window_get_type (void);
GType external_window_x11_get_type (void);
ExternalWindowX11 *external_window_x11_new (const char *handle_str);
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
3 changes: 3 additions & 0 deletions src/fc-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED,
case UPDATE_RESTART:
g_debug ("Got %-38s for %s: waiting on fontconfig update", event_name, path);
break;

default:
g_assert_not_reached ();
}

g_free (path);
Expand Down
Loading