[file-roller/wip/jtojnar/gtk4: 2/2] Correct return values of signal handlers




commit 3d1f1175e93ec6d7c446f2935b7f465c453e8063
Author: Jan Tojnar <jtojnar gmail com>
Date:   Tue Dec 21 02:23:29 2021 +0100

    Correct return values of signal handlers
    
    I verified using the following semantic patch that there are no signals that return a value in File 
Roller, and very little in GLib and GTK: 
https://gitlab.gnome.org/jtojnar/glib-refactoring/-/blob/5d70945511ce1f924f2f3eae59cb382bf39caeb7/patches/find-non-void-signals.cocci
    
    Then I ran this semantic patch to set return values of all handlers to void:
    
https://gitlab.gnome.org/jtojnar/glib-refactoring/-/blob/5d70945511ce1f924f2f3eae59cb382bf39caeb7/patches/voidize-signal-handlers.cocci

 src/fr-window.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index a6b36aaa..f13214e3 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -3717,7 +3717,7 @@ fr_window_current_folder_activated (FrWindow *window,
 }
 
 
-static gboolean
+static void
 row_activated_cb (GtkTreeView       *tree_view,
                  GtkTreePath       *path,
                  GtkTreeViewColumn *column,
@@ -3730,7 +3730,7 @@ row_activated_cb (GtkTreeView       *tree_view,
        if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store),
                                       &iter,
                                       path))
-               return FALSE;
+               return;
 
        gtk_tree_model_get (GTK_TREE_MODEL (window->priv->list_store), &iter,
                            COLUMN_FILE_DATA, &fdata,
@@ -3750,8 +3750,6 @@ row_activated_cb (GtkTreeView       *tree_view,
                fr_window_go_to_location (window, new_dir, FALSE);
                g_free (new_dir);
        }
-
-       return FALSE;
 }
 
 
@@ -4367,13 +4365,13 @@ tree_view_drag_begin (GtkWidget          *widget,
 }
 
 
-static gboolean
+static void
 file_list_drag_begin (GtkWidget          *widget,
                      GdkDragContext     *context,
                      gpointer            data)
 {
        FrWindow *window = data;
-       return tree_view_drag_begin (widget,
+       tree_view_drag_begin (widget,
                                     context,
                                     GTK_TREE_MODEL (window->priv->list_store),
                                     COLUMN_NAME,
@@ -4381,13 +4379,13 @@ file_list_drag_begin (GtkWidget          *widget,
 }
 
 
-static gboolean
-folde_tree_drag_begin (GtkWidget          *widget,
+static void
+folder_tree_drag_begin (GtkWidget         *widget,
                       GdkDragContext     *context,
                       gpointer            data)
 {
        FrWindow *window = data;
-       return tree_view_drag_begin (widget,
+       tree_view_drag_begin (widget,
                                     context,
                                     GTK_TREE_MODEL (window->priv->tree_store),
                                     TREE_COLUMN_NAME,
@@ -4890,7 +4888,7 @@ key_press_cb (GtkWidget   *widget,
 }
 
 
-static gboolean
+static void
 dir_tree_selection_changed_cb (GtkTreeSelection *selection,
                               gpointer          user_data)
 {
@@ -4907,20 +4905,16 @@ dir_tree_selection_changed_cb (GtkTreeSelection *selection,
                fr_window_go_to_location (window, path, FALSE);
                g_free (path);
        }
-
-       return FALSE;
 }
 
 
-static gboolean
+static void
 selection_changed_cb (GtkTreeSelection *selection,
                      gpointer          user_data)
 {
        FrWindow *window = user_data;
 
        fr_window_update_sensitivity (window);
-
-       return FALSE;
 }
 
 
@@ -5716,7 +5710,7 @@ fr_window_construct (FrWindow *window)
 
        g_signal_connect (GTK_TREE_VIEW (window->priv->tree_view),
                          "drag_begin",
-                         G_CALLBACK (folde_tree_drag_begin),
+                         G_CALLBACK (folder_tree_drag_begin),
                          window);
        g_signal_connect (GTK_TREE_VIEW (window->priv->tree_view),
                          "drag_end",


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