diff options
author | Ondrej Holy <oholy@redhat.com> | 2023-03-17 12:53:10 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2023-03-29 13:43:10 +0000 |
commit | cb48f51b980f9b0c5f29e0485b611f5c8b602c67 (patch) | |
tree | 2fc51c3e0cd19f89dd706b21f0c270b58a7086ce | |
parent | 11c25a37db29177f4d1cd696b3b4ddd72f9fed4d (diff) | |
download | nautilus-cb48f51b980f9b0c5f29e0485b611f5c8b602c67.tar.gz |
window: Initialize drag action for tab bar
The `‘action’ may be used uninitialized` warning is shown during build
currently. It can really happen that uninitialized value is used when
dropping something else then the `GDK_TYPE_FILE_LIST` and `G_TYPE_STRING`
on the tab bar. Let's initialize the action to prevent this.
-rw-r--r-- | src/nautilus-window.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 30299b19d..9424f154d 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1476,29 +1476,23 @@ extra_drag_value_cb (AdwTabBar *self, { NautilusWindowSlot *slot = NAUTILUS_WINDOW_SLOT (adw_tab_page_get_child (page)); g_autoptr (NautilusFile) file = nautilus_file_get (nautilus_window_slot_get_location (slot)); - GdkDragAction action; + GdkDragAction action = 0; - if (value == NULL) + if (value != NULL) { - action = 0; - } - else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST)) - { - GSList *file_list = g_value_get_boxed (value); - - if (file_list == NULL) + if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST)) { - action = 0; + GSList *file_list = g_value_get_boxed (value); + if (file_list != NULL) + { + action = nautilus_dnd_get_preferred_action (file, G_FILE (file_list->data)); + } } - else + else if (G_VALUE_HOLDS (value, G_TYPE_STRING)) { - action = nautilus_dnd_get_preferred_action (file, G_FILE (file_list->data)); + action = GDK_ACTION_COPY; } } - else if (G_VALUE_HOLDS (value, G_TYPE_STRING)) - { - action = GDK_ACTION_COPY; - } /* We set the preferred action on the drop from the results of this function, * but since we don't have access to the GtkDropTarget, we can't get the preferred |