[file-roller/wip/jtojnar/gtk4: 2/2] wip: Correct return values of signal handlers
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/jtojnar/gtk4: 2/2] wip: Correct return values of signal handlers
- Date: Tue, 21 Dec 2021 04:40:14 +0000 (UTC)
commit 2442aab6c53f8615f316f40294b7dea51171b591
Author: Jan Tojnar <jtojnar gmail com>
Date: Tue Dec 21 04:42:49 2021 +0100
wip: 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/d0451e42055daef4de72354f110256aeab8dfd89/patches/voidize-signal-handlers.cocci
⚠ Still need to verify with Tartan that there were no false positives.
src/eggtreemultidnd.c | 22 +++---
src/fr-application.c | 4 +-
src/fr-command.c | 4 +-
src/fr-file-selector-dialog.c | 6 +-
src/fr-window.c | 152 +++++++++++++++++++++---------------------
5 files changed, 93 insertions(+), 95 deletions(-)
---
diff --git a/src/eggtreemultidnd.c b/src/eggtreemultidnd.c
index 3c43cb2c..7cb2a2d8 100644
--- a/src/eggtreemultidnd.c
+++ b/src/eggtreemultidnd.c
@@ -165,7 +165,7 @@ stop_drag_check (GtkWidget *widget)
}
-static gboolean
+static void
egg_tree_multi_drag_button_release_event (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
@@ -175,7 +175,7 @@ egg_tree_multi_drag_button_release_event (GtkWidget *widget,
priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
if (priv_data == NULL)
- return FALSE;
+ return;
priv_data->button_released = TRUE;
@@ -184,7 +184,7 @@ egg_tree_multi_drag_button_release_event (GtkWidget *widget,
stop_drag_check (widget);
- return FALSE;
+ return;
}
@@ -429,7 +429,7 @@ egg_tree_multi_drag_motion_event (GtkWidget *widget,
}
-static gboolean
+static void
egg_tree_multi_drag_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
@@ -442,10 +442,10 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
EggTreeMultiDndData *priv_data;
if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)))
- return FALSE;
+ return;
if (event->button == 3)
- return FALSE;
+ return;
tree_view = GTK_TREE_VIEW (widget);
priv_data = g_object_get_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING);
@@ -459,18 +459,18 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
}
if (g_slist_find (priv_data->event_list, event))
- return FALSE;
+ return;
if (priv_data->pending_event)
{
/* save the event to be propagated in order */
priv_data->event_list = g_slist_append (priv_data->event_list,
gdk_event_copy ((GdkEvent*)event));
- return TRUE;
+ return;
}
if (event->type == GDK_2BUTTON_PRESS)
- return FALSE;
+ return;
gtk_tree_view_get_path_at_pos (tree_view,
event->x, event->y,
@@ -523,10 +523,10 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
priv_data->button_released = FALSE;
gtk_tree_path_free (path);
/* We called the default handler so we don't let the default handler run */
- return TRUE;
+ return;
}
- return FALSE;
+ return;
}
diff --git a/src/fr-application.c b/src/fr-application.c
index 2721955b..104b13b8 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -133,7 +133,7 @@ window_ready_cb (GtkWidget *widget,
}
-static gboolean
+static void
window_progress_cb (FrWindow *window,
double fraction,
char *details,
@@ -151,7 +151,7 @@ window_progress_cb (FrWindow *window,
details),
NULL);
- return TRUE;
+ return;
}
diff --git a/src/fr-command.c b/src/fr-command.c
index 1a271554..377130ce 100644
--- a/src/fr-command.c
+++ b/src/fr-command.c
@@ -385,14 +385,14 @@ fr_command_handle_process_error (FrCommand *self,
/* -- _fr_command_set_process -- */
-static gboolean
+static void
process_sticky_only_cb (FrProcess *process,
gpointer user_data)
{
FrArchive *archive = user_data;
fr_archive_set_stoppable (archive, FALSE);
- return TRUE;
+ return;
}
diff --git a/src/fr-file-selector-dialog.c b/src/fr-file-selector-dialog.c
index c99df840..5bd4afbb 100644
--- a/src/fr-file-selector-dialog.c
+++ b/src/fr-file-selector-dialog.c
@@ -571,7 +571,7 @@ places_sidebar_open_location_cb (GtkPlacesSidebar *sidebar,
}
-static gboolean
+static void
files_treeview_button_press_event_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
@@ -584,10 +584,10 @@ files_treeview_button_press_event_cb (GtkWidget *widget,
gtk_tree_view_convert_bin_window_to_widget_coords (GTK_TREE_VIEW (widget), event->x,
event->y, &wx, &wy);
_gtk_popover_popup_at_position (self->file_context_menu, wx, wy);
- return TRUE;
+ return;
}
- return FALSE;
+ return;
}
diff --git a/src/fr-window.c b/src/fr-window.c
index a6b36aaa..a63c39c0 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -2100,7 +2100,7 @@ close_progress_dialog (FrWindow *window,
}
-static gboolean
+static void
progress_dialog_delete_event (GtkWidget *caller,
GdkEvent *event,
FrWindow *window)
@@ -2110,7 +2110,7 @@ progress_dialog_delete_event (GtkWidget *caller,
close_progress_dialog (window, TRUE);
}
- return TRUE;
+ return;
}
@@ -2441,7 +2441,7 @@ progress_dialog_update_action_description (FrWindow *window)
}
-static gboolean
+static void
fr_window_working_archive_cb (FrArchive *archive,
const char *archive_uri,
FrWindow *window)
@@ -2451,11 +2451,11 @@ fr_window_working_archive_cb (FrArchive *archive,
window->priv->working_archive = g_file_new_for_uri (archive_uri);
progress_dialog_update_action_description (window);
- return TRUE;
+ return;
}
-static gboolean
+static void
fr_archive_message_cb (FrArchive *archive,
const char *msg,
FrWindow *window)
@@ -2466,7 +2466,7 @@ fr_archive_message_cb (FrArchive *archive,
}
if (window->priv->progress_dialog == NULL)
- return TRUE;
+ return;
if (msg != NULL) {
while (*msg == ' ')
@@ -2483,7 +2483,7 @@ fr_archive_message_cb (FrArchive *archive,
else
utf8_msg = g_strdup (msg);
if (utf8_msg == NULL)
- return TRUE;
+ return;
if (g_utf8_validate (utf8_msg, -1, NULL)) {
gtk_label_set_text (GTK_LABEL (window->priv->pd_message), utf8_msg);
@@ -2510,7 +2510,7 @@ fr_archive_message_cb (FrArchive *archive,
progress_dialog_update_action_description (window);
- return TRUE;
+ return;
}
@@ -2654,7 +2654,7 @@ open_progress_dialog (FrWindow *window,
}
-static gboolean
+static void
fr_archive_progress_cb (FrArchive *archive,
double fraction,
FrWindow *window)
@@ -2710,7 +2710,7 @@ fr_archive_progress_cb (FrArchive *archive,
g_print ("progress > %2.2f\n", fraction);
#endif
}
- return TRUE;
+ return;
}
@@ -2763,13 +2763,13 @@ confirmation_dialog_response (GtkDialog *dialog,
}
-static gboolean
+static void
confirmation_dialog_delete_event (GtkWidget *dialog,
GdkEvent *event,
FrWindow *window)
{
fr_window_close_confirmation_dialog (window, GTK_DIALOG (dialog));
- return TRUE;
+ return;
}
@@ -3575,7 +3575,7 @@ fr_window_get_n_selected_files (FrWindow *window)
/**/
-static int
+static void
dir_tree_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
@@ -3584,11 +3584,11 @@ dir_tree_button_press_cb (GtkWidget *widget,
GtkTreeSelection *selection;
if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->tree_view)))
- return FALSE;
+ return;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->tree_view));
if (selection == NULL)
- return FALSE;
+ return;
if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3)) {
GtkTreePath *path;
@@ -3602,7 +3602,7 @@ dir_tree_button_press_cb (GtkWidget *widget,
if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->tree_store), &iter,
path)) {
gtk_tree_path_free (path);
- return FALSE;
+ return;
}
gtk_tree_path_free (path);
@@ -3617,18 +3617,18 @@ dir_tree_button_press_cb (GtkWidget *widget,
else
gtk_tree_selection_unselect_all (selection);
- return TRUE;
+ return;
}
else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 8)) {
fr_window_go_back (window);
- return TRUE;
+ return;
}
else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 9)) {
fr_window_go_forward (window);
- return TRUE;
+ return;
}
- return FALSE;
+ return;
}
@@ -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,
@@ -3751,11 +3751,11 @@ row_activated_cb (GtkTreeView *tree_view,
g_free (new_dir);
}
- return FALSE;
+ return;
}
-static int
+static void
file_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
@@ -3764,11 +3764,11 @@ file_button_press_cb (GtkWidget *widget,
GtkTreeSelection *selection;
if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view)))
- return FALSE;
+ return;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
if (selection == NULL)
- return FALSE;
+ return;
if (window->priv->path_clicked != NULL) {
gtk_tree_path_free (window->priv->path_clicked);
@@ -3788,7 +3788,7 @@ file_button_press_cb (GtkWidget *widget,
if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store), &iter,
path)) {
gtk_tree_path_free (path);
- return FALSE;
+ return;
}
gtk_tree_path_free (path);
@@ -3806,7 +3806,7 @@ file_button_press_cb (GtkWidget *widget,
_gtk_popover_popup_at_position (GTK_POPOVER (window->priv->folder_popup_menu), wx,
wy);
else
_gtk_popover_popup_at_position (GTK_POPOVER (window->priv->file_popup_menu), wx, wy);
- return TRUE;
+ return;
}
else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 1)) {
GtkTreePath *path = NULL;
@@ -3827,24 +3827,24 @@ file_button_press_cb (GtkWidget *widget,
gtk_tree_path_free (path);
}
- return FALSE;
+ return;
}
else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 8)) {
// go back
fr_window_go_back (window);
- return TRUE;
+ return;
}
else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 9)) {
// go forward
fr_window_go_forward (window);
- return TRUE;
+ return;
}
- return FALSE;
+ return;
}
-static int
+static void
file_button_release_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
@@ -3853,14 +3853,14 @@ file_button_release_cb (GtkWidget *widget,
GtkTreeSelection *selection;
if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view)))
- return FALSE;
+ return;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
if (selection == NULL)
- return FALSE;
+ return;
if (window->priv->path_clicked == NULL)
- return FALSE;
+ return;
if ((event->type == GDK_BUTTON_RELEASE)
&& (event->button == 1)
@@ -3893,11 +3893,11 @@ file_button_release_cb (GtkWidget *widget,
window->priv->path_clicked = NULL;
}
- return FALSE;
+ return;
}
-static gboolean
+static void
file_motion_notify_callback (GtkWidget *widget,
GdkEventMotion *event,
gpointer user_data)
@@ -3908,10 +3908,10 @@ file_motion_notify_callback (GtkWidget *widget,
GtkTreeIter iter;
if (! window->priv->single_click)
- return FALSE;
+ return;
if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view)))
- return FALSE;
+ return;
last_hover_path = window->priv->list_hover_path;
@@ -3953,11 +3953,11 @@ file_motion_notify_callback (GtkWidget *widget,
gtk_tree_path_free (last_hover_path);
- return FALSE;
+ return;
}
-static gboolean
+static void
file_leave_notify_callback (GtkWidget *widget,
GdkEventCrossing *event,
gpointer user_data)
@@ -3977,7 +3977,7 @@ file_leave_notify_callback (GtkWidget *widget,
window->priv->list_hover_path = NULL;
}
- return FALSE;
+ return;
}
@@ -4003,7 +4003,7 @@ get_file_list_from_selection_data (char *uri_list)
}
-static gboolean
+static void
fr_window_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
@@ -4017,10 +4017,10 @@ fr_window_drag_motion (GtkWidget *widget,
|| (gtk_drag_get_source_widget (context) == window->priv->tree_view))
{
gdk_drag_status (context, 0, time);
- return FALSE;
+ return;
}
- return TRUE;
+ return;
}
@@ -4367,31 +4367,29 @@ 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,
- context,
- GTK_TREE_MODEL (window->priv->list_store),
- COLUMN_NAME,
- data);
+ tree_view_drag_begin(widget, context,
+ GTK_TREE_MODEL(window->priv->list_store),
+ COLUMN_NAME, data);
+ return;
}
-static gboolean
+static void
folde_tree_drag_begin (GtkWidget *widget,
GdkDragContext *context,
gpointer data)
{
FrWindow *window = data;
- return tree_view_drag_begin (widget,
- context,
- GTK_TREE_MODEL (window->priv->tree_store),
- TREE_COLUMN_NAME,
- data);
+ tree_view_drag_begin(widget, context,
+ GTK_TREE_MODEL(window->priv->tree_store),
+ TREE_COLUMN_NAME, data);
+ return;
}
@@ -4572,7 +4570,7 @@ wait_dnd_extraction (FrWindow *window)
}
-static gboolean
+static void
fr_window_folder_tree_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
@@ -4590,11 +4588,11 @@ fr_window_folder_tree_drag_data_get (GtkWidget *widget,
debug (DEBUG_INFO, "::DragDataGet -->\n");
if (window->priv->activity_ref > 0)
- return FALSE;
+ return;
file_list = fr_window_get_folder_tree_selection (window, TRUE, NULL);
if (file_list == NULL)
- return FALSE;
+ return;
if (gtk_selection_data_get_target (selection_data) == XFR_ATOM) {
FrClipboardData *tmp;
@@ -4611,14 +4609,14 @@ fr_window_folder_tree_drag_data_get (GtkWidget *widget,
fr_clipboard_data_unref (tmp);
g_free (data);
- return TRUE;
+ return;
}
if (! nautilus_xds_dnd_is_valid_xds_context (context))
- return FALSE;
+ return;
uri = get_xds_atom_value (context);
- g_return_val_if_fail (uri != NULL, FALSE);
+ g_return_if_fail(uri != NULL);
destination = g_file_new_for_uri (uri);
destination_folder = g_file_get_parent (destination);
@@ -4667,7 +4665,7 @@ fr_window_folder_tree_drag_data_get (GtkWidget *widget,
debug (DEBUG_INFO, "::DragDataGet <--\n");
- return TRUE;
+ return;
}
@@ -4890,7 +4888,7 @@ key_press_cb (GtkWidget *widget,
}
-static gboolean
+static void
dir_tree_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
{
@@ -4908,11 +4906,11 @@ dir_tree_selection_changed_cb (GtkTreeSelection *selection,
g_free (path);
}
- return FALSE;
+ return;
}
-static gboolean
+static void
selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
{
@@ -4920,17 +4918,17 @@ selection_changed_cb (GtkTreeSelection *selection,
fr_window_update_sensitivity (window);
- return FALSE;
+ return;
}
-static gboolean
+static void
fr_window_delete_event_cb (GtkWidget *caller,
GdkEvent *event,
FrWindow *window)
{
fr_window_close (window);
- return TRUE;
+ return;
}
@@ -5292,7 +5290,7 @@ path_column_sort_func (GtkTreeModel *model,
}
-static gboolean
+static void
fr_window_show_cb (GtkWidget *widget,
FrWindow *window)
{
@@ -5303,7 +5301,7 @@ fr_window_show_cb (GtkWidget *widget,
gtk_widget_hide (window->priv->filter_bar);
- return TRUE;
+ return;
}
@@ -5376,7 +5374,7 @@ theme_changed_cb (GtkIconTheme *theme,
}
-static gboolean
+static void
fr_archive_stoppable_cb (FrArchive *archive,
gboolean stoppable,
FrWindow *window)
@@ -5386,7 +5384,7 @@ fr_archive_stoppable_cb (FrArchive *archive,
gtk_dialog_set_response_sensitive (GTK_DIALOG (window->priv->progress_dialog),
GTK_RESPONSE_OK,
stoppable);
- return TRUE;
+ return;
}
@@ -8038,12 +8036,12 @@ fr_window_archive_encrypt (FrWindow *window,
/* -- fr_window_view_last_output -- */
-static gboolean
+static void
last_output_window__unrealize_cb (GtkWidget *widget,
gpointer data)
{
pref_util_save_window_geometry (GTK_WINDOW (widget), LAST_OUTPUT_SCHEMA_NAME);
- return FALSE;
+ return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]