[file-roller/wip/jtojnar/gtk4: 11/16] Fix callback argument types with the help of tartan




commit eebb467bfdaf2702b2c337c9de0330612e5b8d1e
Author: Jan Tojnar <jtojnar gmail com>
Date:   Tue Dec 21 01:53:41 2021 +0100

    Fix callback argument types with the help of tartan
    
    The callback function type signature should match what the signal produces.

 src/dlg-add.c                     | 14 +++++++-------
 src/dlg-ask-password.c            |  2 +-
 src/dlg-delete.c                  |  4 ++--
 src/dlg-extract.c                 |  8 ++++----
 src/dlg-password.c                |  2 +-
 src/dlg-update.c                  |  2 +-
 src/fr-application.c              |  4 ++--
 src/fr-file-selector-dialog.c     |  6 +++---
 src/fr-window-actions-callbacks.c |  2 +-
 src/fr-window.c                   | 30 ++++++++++++++----------------
 src/test-server.c                 |  4 ++--
 11 files changed, 38 insertions(+), 40 deletions(-)
---
diff --git a/src/dlg-add.c b/src/dlg-add.c
index 688a2737..1c54d96c 100644
--- a/src/dlg-add.c
+++ b/src/dlg-add.c
@@ -47,7 +47,7 @@ typedef struct {
 
 
 static void
-file_selector_destroy_cb (GtkWidget  *widget,
+file_selector_destroy_cb (GtkDialog *dialog,
                          DialogData *data)
 {
        g_object_unref (data->builder);
@@ -61,7 +61,7 @@ static void dlg_add_folder_save_last_options (DialogData *data);
 
 
 static void
-file_selector_response_cb (GtkWidget    *widget,
+file_selector_response_cb (GtkDialog *dialog,
                           int           response,
                           DialogData   *data)
 {
@@ -100,7 +100,7 @@ file_selector_response_cb (GtkWidget    *widget,
                                           _("Could not add the files to the archive"),
                                           _("You don’t have the right permissions to read files from folder 
“%s”"),
                                           utf8_path);
-               g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+               g_signal_connect (GTK_MESSAGE_DIALOG (d), "response", G_CALLBACK (gtk_widget_destroy), NULL);
                gtk_widget_show (d);
                return;
        }
@@ -224,11 +224,11 @@ dlg_add (FrWindow *window)
 
        /* signals */
 
-       g_signal_connect (GTK_DIALOG (data->dialog),
+       g_signal_connect (FR_FILE_SELECTOR_DIALOG (data->dialog),
                          "destroy",
                          G_CALLBACK (file_selector_destroy_cb),
                          data);
-       g_signal_connect (GTK_DIALOG (data->dialog),
+       g_signal_connect (FR_FILE_SELECTOR_DIALOG (data->dialog),
                          "response",
                          G_CALLBACK (file_selector_response_cb),
                          data);
@@ -594,7 +594,7 @@ aod_destroy_cb (GtkWidget             *widget,
 
 
 static void
-aod_apply_cb (GtkWidget *widget,
+aod_apply_cb (GtkButton *button,
              gpointer   callback_data)
 {
        LoadOptionsDialogData *aod_data = callback_data;
@@ -682,7 +682,7 @@ aod_update_option_list (LoadOptionsDialogData *aod_data)
 
 
 static void
-aod_remove_cb (GtkWidget             *widget,
+aod_remove_cb (GtkButton *button,
               LoadOptionsDialogData *aod_data)
 {
        GtkTreeSelection *selection;
diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c
index 081d5ab3..a67066f0 100644
--- a/src/dlg-ask-password.c
+++ b/src/dlg-ask-password.c
@@ -58,7 +58,7 @@ destroy_cb (GtkWidget  *widget,
 
 
 static void
-ask_password__response_cb (GtkWidget  *dialog,
+ask_password__response_cb (GtkDialog  *dialog,
                           int         response_id,
                           DialogData *data)
 {
diff --git a/src/dlg-delete.c b/src/dlg-delete.c
index d0a123a7..d4307a6d 100644
--- a/src/dlg-delete.c
+++ b/src/dlg-delete.c
@@ -51,7 +51,7 @@ destroy_cb (GtkWidget  *widget,
 
 /* called when the dialog is dismissed. */
 static void
-response_cb (GtkWidget  *widget,
+response_cb (GtkDialog  *widget,
                        int         response_id,
                        DialogData *data)
 {
@@ -96,7 +96,7 @@ response_cb (GtkWidget  *widget,
 
 
 static void
-entry_changed_cb (GtkWidget  *widget,
+entry_changed_cb (GtkEditable *widget,
                  DialogData *data)
 {
        if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->d_files_radio)))
diff --git a/src/dlg-extract.c b/src/dlg-extract.c
index ac9df94f..f340e185 100644
--- a/src/dlg-extract.c
+++ b/src/dlg-extract.c
@@ -70,7 +70,7 @@ static void extract_cb_start_extracting (DialogData *data);
 static void create_destination_response_cb (GtkDialog *dialog, int response, DialogData *data);
 
 static void
-extract_cb (GtkWidget   *dialog,
+extract_cb (GtkDialog   *dialog,
            DialogData  *data)
 {
        data->extract_clicked = TRUE;
@@ -277,20 +277,20 @@ extract_cb_start_extracting (DialogData *data)
 
 
 static void
-file_selector_response_cb (GtkWidget    *widget,
+file_selector_response_cb (GtkDialog    *dialog,
                      int           response,
                      DialogData   *data)
 {
        if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
                gtk_widget_destroy (data->dialog);
        } else if (response == GTK_RESPONSE_OK) {
-               extract_cb (widget, data);
+               extract_cb (dialog, data);
        }
 }
 
 
 static void
-files_entry_changed_cb (GtkWidget  *widget,
+files_entry_changed_cb (GtkEditable  *widget,
                        DialogData *data)
 {
        if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("file_pattern_radiobutton"))))
diff --git a/src/dlg-password.c b/src/dlg-password.c
index c4808dda..a7664203 100644
--- a/src/dlg-password.c
+++ b/src/dlg-password.c
@@ -50,7 +50,7 @@ destroy_cb (GtkWidget  *widget,
 
 
 static void
-response_cb (GtkWidget  *dialog,
+response_cb (GtkDialog  *dialog,
             int         response_id,
             DialogData *data)
 {
diff --git a/src/dlg-update.c b/src/dlg-update.c
index c7cac194..05527950 100644
--- a/src/dlg-update.c
+++ b/src/dlg-update.c
@@ -250,7 +250,7 @@ n_selected (DialogData *data)
 
 static void
 is_selected_toggled (GtkCellRendererToggle *cell,
-                    char                  *path_string,
+                    const char            *path_string,
                     gpointer               callback_data)
 {
        DialogData   *data  = callback_data;
diff --git a/src/fr-application.c b/src/fr-application.c
index 73a49cae..e29d29c0 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -107,7 +107,7 @@ static const GOptionEntry options[] = {
 
 
 static void
-window_ready_cb (GtkWidget *widget,
+window_ready_cb (FrWindow *window,
                 GError    *error,
                 gpointer   user_data)
 {
@@ -125,7 +125,7 @@ window_ready_cb (GtkWidget *widget,
 static gboolean
 window_progress_cb (FrWindow *window,
                    double    fraction,
-                   char     *details,
+                   const char *details,
                    gpointer  user_data)
 {
        GDBusConnection *connection = user_data;
diff --git a/src/fr-file-selector-dialog.c b/src/fr-file-selector-dialog.c
index e7145504..8e3a2509 100644
--- a/src/fr-file-selector-dialog.c
+++ b/src/fr-file-selector-dialog.c
@@ -482,7 +482,7 @@ _update_sensitivity (FrFileSelectorDialog *self)
 
 static void
 is_selected_cellrenderertoggle_toggled_cb (GtkCellRendererToggle *cell_renderer,
-                                          gchar                 *path,
+                                          const gchar           *path,
                                           gpointer               user_data)
 {
        FrFileSelectorDialog *self = user_data;
@@ -561,13 +561,13 @@ go_up_button_clicked_cb (GtkButton *button,
 
 static void
 places_sidebar_open_location_cb (GtkPlacesSidebar  *sidebar,
-                                GObject           *location,
+                                GFile             *location,
                                 GtkPlacesOpenFlags open_flags,
                                 gpointer           user_data)
 {
        FrFileSelectorDialog *self = user_data;
 
-       fr_file_selector_dialog_set_current_folder (self, G_FILE (location));
+       fr_file_selector_dialog_set_current_folder (self, location);
 }
 
 
diff --git a/src/fr-window-actions-callbacks.c b/src/fr-window-actions-callbacks.c
index 62b1a8fc..c02e8d79 100644
--- a/src/fr-window-actions-callbacks.c
+++ b/src/fr-window-actions-callbacks.c
@@ -246,7 +246,7 @@ window_archive_loaded_cb (FrWindow  *window,
 
 
 static void
-open_file_response_cb (GtkWidget *w,
+open_file_response_cb (GtkDialog *dialog,
                       int        response,
                       GtkWidget *file_sel)
 {
diff --git a/src/fr-window.c b/src/fr-window.c
index 39533d07..55bf1fea 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -770,7 +770,7 @@ fr_window_update_paste_command_sensitivity (FrWindow     *window,
 
 static void
 clipboard_owner_change_cb (GtkClipboard *clipboard,
-                          GdkEvent     *event,
+                          GdkEventOwnerChange *event,
                           gpointer      user_data)
 {
        fr_window_update_paste_command_sensitivity ((FrWindow *) user_data, clipboard);
@@ -2719,16 +2719,16 @@ fr_archive_progress_cb (FrArchive *archive,
 
 static void
 fr_window_close_confirmation_dialog (FrWindow  *window,
-                                    GtkWidget *dialog)
+                                    GtkDialog *dialog)
 {
-       gtk_widget_destroy (dialog);
+       gtk_widget_destroy (GTK_WIDGET (dialog));
        if (window->priv->batch_mode && window->priv->destroy_with_confirmation_dialog)
                _fr_window_close_after_notification (window);
 }
 
 
 static void
-confirmation_dialog_response (GtkWidget *dialog,
+confirmation_dialog_response (GtkDialog *dialog,
                              int        response_id,
                              FrWindow  *window)
 {
@@ -2768,44 +2768,42 @@ confirmation_dialog_delete_event (GtkWidget *dialog,
                                  GdkEvent  *event,
                                  FrWindow  *window)
 {
-       fr_window_close_confirmation_dialog (window, dialog);
+       fr_window_close_confirmation_dialog (window, GTK_DIALOG (dialog));
        return TRUE;
 }
 
 
 static void
 fr_window_show_confirmation_dialog (FrWindow  *window,
-                                   GtkWidget *dialog)
+                                   GtkDialog *dialog)
 {
        close_progress_dialog (window, TRUE);
 
-       g_signal_connect (GTK_DIALOG (dialog),
+       g_signal_connect (dialog,
                          "response",
                          G_CALLBACK (confirmation_dialog_response),
                          window);
-       g_signal_connect (GTK_DIALOG (dialog),
+       g_signal_connect (dialog,
                          "delete_event",
                          G_CALLBACK (confirmation_dialog_delete_event),
                          window);
 
-       gtk_widget_show (dialog);
+       gtk_widget_show (GTK_WIDGET (dialog));
 }
 
 
 static void
 fr_window_show_confirmation_dialog_with_open_destination (FrWindow *window)
 {
-       GtkWidget *dialog;
-
-       dialog = _gtk_message_dialog_new (GTK_WINDOW (window),
+       GtkDialog *dialog = GTK_DIALOG (_gtk_message_dialog_new (GTK_WINDOW (window),
                                          GTK_DIALOG_MODAL,
                                          _("Extraction completed successfully"),
                                          NULL,
                                          _GTK_LABEL_CLOSE, GTK_RESPONSE_CLOSE,
                                          _("_Show the Files"), DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER,
-                                         NULL);
+                                         NULL));
 
-       gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
+       gtk_dialog_set_default_response (dialog, GTK_RESPONSE_CLOSE);
        fr_window_show_confirmation_dialog (window, dialog);
 }
 
@@ -2830,7 +2828,7 @@ fr_window_show_confirmation_dialog_with_open_archive (FrWindow *window)
                                          NULL);
 
        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
-       fr_window_show_confirmation_dialog (window, dialog);
+       fr_window_show_confirmation_dialog (window, GTK_DIALOG (dialog));
 
        g_free (message);
        g_free (basename);
@@ -5410,7 +5408,7 @@ fr_window_activate_filter (FrWindow *window)
 
 
 static void
-filter_entry_search_changed_cb (GtkEntry *entry,
+filter_entry_search_changed_cb (GtkSearchEntry *entry,
                                FrWindow *window)
 {
        fr_window_activate_filter (window);
diff --git a/src/test-server.c b/src/test-server.c
index 22efa172..2992575d 100644
--- a/src/test-server.c
+++ b/src/test-server.c
@@ -118,8 +118,8 @@ fileroller_addtoarchive_ready_cb (GObject      *source_object,
 
 static void
 on_signal (GDBusProxy *proxy,
-          char       *sender_name,
-          char       *signal_name,
+          const char *sender_name,
+          const char *signal_name,
           GVariant   *parameters,
           gpointer    user_data)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]