diff options
author | Corey Berla <corey@berla.me> | 2022-12-23 16:19:34 -0800 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-12-25 01:46:44 +0000 |
commit | 3b7ec5d5eafe4e4fb2b8dc527e0413fbef2d2fc4 (patch) | |
tree | 48b8db811c4f957d561757c2807cab9f99662d48 /src | |
parent | a8a4288e0cfbc5684c76e7fedbaf3e7fb1fa8faf (diff) | |
download | nautilus-3b7ec5d5eafe4e4fb2b8dc527e0413fbef2d2fc4.tar.gz |
general: Stop using gtk_widget_show and gtk_widget_hide
Replace with gtk_widget_set_visible() or gtk_window_present()
In some cases we use gtk_widget_show() unnecessarily because
widgets are visible by default
Diffstat (limited to 'src')
24 files changed, 90 insertions, 134 deletions
diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c index d897a61af..16c68d79a 100644 --- a/src/gtk/nautilusgtkplacessidebar.c +++ b/src/gtk/nautilusgtkplacessidebar.c @@ -1435,7 +1435,6 @@ update_places (NautilusGtkPlacesSidebar *sidebar) g_object_unref (start_icon); } - gtk_widget_show (GTK_WIDGET (sidebar)); /* We want this hidden by default, but need to do it after the show_all call */ nautilus_gtk_sidebar_row_hide (NAUTILUS_GTK_SIDEBAR_ROW (sidebar->new_bookmark_row), TRUE); @@ -1617,7 +1616,7 @@ stop_drop_feedback (NautilusGtkPlacesSidebar *sidebar) if (sidebar->drag_row != NULL) { - gtk_widget_show (sidebar->drag_row); + gtk_widget_set_visible (sidebar->drag_row, TRUE); sidebar->drag_row = NULL; } @@ -3634,7 +3633,7 @@ on_row_dragged (GtkGestureDrag *gesture, g_signal_connect (drag, "cancel", G_CALLBACK (dnd_cancel_cb), sidebar); gtk_widget_get_allocation (sidebar->drag_row, &allocation); - gtk_widget_hide (sidebar->drag_row); + gtk_widget_set_visible (sidebar->drag_row, FALSE); drag_widget = GTK_WIDGET (nautilus_gtk_sidebar_row_clone (NAUTILUS_GTK_SIDEBAR_ROW (sidebar->drag_row))); sidebar->drag_row_height = allocation.height; diff --git a/src/gtk/nautilusgtkplacesview.c b/src/gtk/nautilusgtkplacesview.c index 0d062c9ee..255d88869 100644 --- a/src/gtk/nautilusgtkplacesview.c +++ b/src/gtk/nautilusgtkplacesview.c @@ -883,20 +883,20 @@ update_network_state (NautilusGtkPlacesView *view) * otherwise just show the spinner in the header */ if (!has_networks (view)) { - gtk_widget_show (view->network_placeholder); + gtk_widget_set_visible (view->network_placeholder, TRUE); gtk_label_set_text (GTK_LABEL (view->network_placeholder_label), _("Searching for network locations")); } } else if (!has_networks (view)) { - gtk_widget_show (view->network_placeholder); + gtk_widget_set_visible (view->network_placeholder, TRUE); gtk_label_set_text (GTK_LABEL (view->network_placeholder_label), _("No network locations found")); } else { - gtk_widget_hide (view->network_placeholder); + gtk_widget_set_visible (view->network_placeholder, FALSE); } } @@ -1680,7 +1680,7 @@ populate_available_protocols_grid (GtkGrid *grid) } if (!has_any) - gtk_widget_hide (GTK_WIDGET (grid)); + gtk_widget_set_visible (GTK_WIDGET (grid), FALSE); } static GMenuModel * @@ -2014,7 +2014,7 @@ on_recent_servers_listbox_row_activated (NautilusGtkPlacesView *view, gtk_editable_set_text (GTK_EDITABLE (view->address_entry), uri); - gtk_widget_hide (view->recent_servers_popover); + gtk_widget_set_visible (view->recent_servers_popover, FALSE); } static void diff --git a/src/gtk/nautilusgtksidebarrow.c b/src/gtk/nautilusgtksidebarrow.c index 9b6ebafee..4fa69358b 100644 --- a/src/gtk/nautilusgtksidebarrow.c +++ b/src/gtk/nautilusgtksidebarrow.c @@ -245,12 +245,12 @@ nautilus_gtk_sidebar_row_set_property (GObject *object, { self->end_icon = G_ICON (g_object_ref (object)); gtk_image_set_from_gicon (GTK_IMAGE (self->end_icon_widget), self->end_icon); - gtk_widget_show (self->end_icon_widget); + gtk_widget_set_visible (self->end_icon_widget, TRUE); } else { gtk_image_clear (GTK_IMAGE (self->end_icon_widget)); - gtk_widget_hide (self->end_icon_widget); + gtk_widget_set_visible (self->end_icon_widget, FALSE); } break; } @@ -276,9 +276,9 @@ nautilus_gtk_sidebar_row_set_property (GObject *object, case PROP_EJECTABLE: self->ejectable = g_value_get_boolean (value); if (self->ejectable) - gtk_widget_show (self->eject_button); + gtk_widget_set_visible (self->eject_button, TRUE); else - gtk_widget_hide (self->eject_button); + gtk_widget_set_visible (self->eject_button, FALSE); break; case PROP_ORDER_INDEX: @@ -383,13 +383,13 @@ on_child_revealed (GObject *self, * still allocate the paddings, even if the revealer is not revealed, and * therefore the row will be still somewhat visible. */ if (!gtk_revealer_get_reveal_child (GTK_REVEALER (self))) - gtk_widget_hide (GTK_WIDGET (NAUTILUS_GTK_SIDEBAR_ROW (user_data))); + gtk_widget_set_visible (GTK_WIDGET (NAUTILUS_GTK_SIDEBAR_ROW (user_data)), FALSE); } void nautilus_gtk_sidebar_row_reveal (NautilusGtkSidebarRow *self) { - gtk_widget_show (GTK_WIDGET (self)); + gtk_widget_set_visible (GTK_WIDGET (self), TRUE); gtk_revealer_set_reveal_child (GTK_REVEALER (self->revealer), TRUE); } diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c index 731b522c2..682b7753d 100644 --- a/src/nautilus-batch-rename-dialog.c +++ b/src/nautilus-batch-rename-dialog.c @@ -445,7 +445,6 @@ listbox_header_func (GtkListBoxRow *row, if (separator == NULL) { separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_widget_show (separator); gtk_list_box_row_set_header (row, separator); } @@ -534,8 +533,6 @@ create_original_name_label (NautilusBatchRenameDialog *dialog, dialog->listbox_labels_old = g_list_prepend (dialog->listbox_labels_old, label_old); - gtk_widget_show (label_old); - return label_old; } @@ -553,8 +550,6 @@ create_result_label (NautilusBatchRenameDialog *dialog, dialog->listbox_labels_new = g_list_prepend (dialog->listbox_labels_new, label_new); - gtk_widget_show (label_new); - return label_new; } @@ -579,8 +574,6 @@ create_arrow (NautilusBatchRenameDialog *dialog, dialog->listbox_icons = g_list_prepend (dialog->listbox_icons, icon); - gtk_widget_show (icon); - return icon; } @@ -604,7 +597,6 @@ prepare_batch_rename (NautilusBatchRenameDialog *dialog) gtk_widget_set_cursor_from_name (GTK_WIDGET (dialog), "progress"); - gtk_widget_hide (GTK_WIDGET (dialog)); begin_batch_rename (dialog, dialog->new_names); gtk_window_destroy (GTK_WINDOW (dialog)); @@ -891,7 +883,7 @@ update_listbox (NautilusBatchRenameDialog *dialog) gtk_widget_set_sensitive (dialog->rename_button, FALSE); - gtk_widget_show (dialog->conflict_box); + gtk_widget_set_visible (dialog->conflict_box, TRUE); dialog->selected_conflict = 0; dialog->conflicts_number = g_list_length (dialog->duplicates); @@ -911,7 +903,7 @@ update_listbox (NautilusBatchRenameDialog *dialog) } else { - gtk_widget_hide (dialog->conflict_box); + gtk_widget_set_visible (dialog->conflict_box, FALSE); /* re-enable the rename button if there are no more name conflicts */ if (dialog->duplicates == NULL && !gtk_widget_is_sensitive (dialog->rename_button)) @@ -1239,13 +1231,13 @@ have_unallowed_character (NautilusBatchRenameDialog *dialog) gtk_widget_set_sensitive (dialog->conflict_down, FALSE); gtk_widget_set_sensitive (dialog->conflict_up, FALSE); - gtk_widget_show (dialog->conflict_box); + gtk_widget_set_visible (dialog->conflict_box, TRUE); return TRUE; } else { - gtk_widget_hide (dialog->conflict_box); + gtk_widget_set_visible (dialog->conflict_box, FALSE); return FALSE; } diff --git a/src/nautilus-compress-dialog-controller.c b/src/nautilus-compress-dialog-controller.c index 9937bebe9..53735eb80 100644 --- a/src/nautilus-compress-dialog-controller.c +++ b/src/nautilus-compress-dialog-controller.c @@ -564,7 +564,7 @@ nautilus_compress_dialog_controller_new (GtkWindow *parent_window, gtk_editable_set_text (GTK_EDITABLE (name_entry), initial_name); } - gtk_widget_show (compress_dialog); + gtk_window_present (GTK_WINDOW (compress_dialog)); return self; } diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c index f7c3cc702..44eea2b1c 100644 --- a/src/nautilus-file-conflict-dialog.c +++ b/src/nautilus-file-conflict-dialog.c @@ -110,7 +110,7 @@ nautilus_file_conflict_dialog_set_replace_button_label (NautilusFileConflictDial void nautilus_file_conflict_dialog_disable_skip (NautilusFileConflictDialog *fcd) { - gtk_widget_hide (fcd->skip_button); + gtk_widget_set_visible (fcd->skip_button, FALSE); } void @@ -122,7 +122,7 @@ nautilus_file_conflict_dialog_disable_replace (NautilusFileConflictDialog *fcd) void nautilus_file_conflict_dialog_disable_apply_to_all (NautilusFileConflictDialog *fcd) { - gtk_widget_hide (fcd->checkbox); + gtk_widget_set_visible (fcd->checkbox, FALSE); } static void @@ -164,8 +164,8 @@ on_expanded_notify (GtkExpander *w, { if (gtk_expander_get_expanded (w)) { - gtk_widget_hide (dialog->replace_button); - gtk_widget_show (dialog->rename_button); + gtk_widget_set_visible (dialog->replace_button, FALSE); + gtk_widget_set_visible (dialog->rename_button, TRUE); gtk_dialog_set_default_response (GTK_DIALOG (dialog), CONFLICT_RESPONSE_RENAME); gtk_widget_set_sensitive (dialog->checkbox, FALSE); @@ -189,8 +189,8 @@ on_expanded_notify (GtkExpander *w, } else { - gtk_widget_hide (dialog->rename_button); - gtk_widget_show (dialog->replace_button); + gtk_widget_set_visible (dialog->rename_button, FALSE); + gtk_widget_set_visible (dialog->replace_button, TRUE); gtk_dialog_set_default_response (GTK_DIALOG (dialog), CONFLICT_RESPONSE_REPLACE); gtk_widget_set_sensitive (dialog->checkbox, TRUE); diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index 1f62e3fd8..875891f3d 100644 --- a/src/nautilus-file-operations.c +++ b/src/nautilus-file-operations.c @@ -1405,8 +1405,6 @@ do_run_simple_dialog (gpointer _data) MAXIMUM_DISPLAYED_ERROR_MESSAGE_LENGTH); gtk_box_append (GTK_BOX (content_area), label); - - gtk_widget_show (label); } if (data->dbus_data != NULL) @@ -1428,7 +1426,7 @@ do_run_simple_dialog (gpointer _data) /* Run it. */ g_signal_connect (dialog, "response", G_CALLBACK (simple_dialog_cb), data); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); return FALSE; } @@ -3104,7 +3102,7 @@ nautilus_file_operations_unmount_mount_full (GtkWindow *parent_win dialog = create_empty_trash_prompt (parent_window); g_signal_connect (dialog, "response", G_CALLBACK (empty_trash_prompt_cb), data); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); return; } diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index 14913978f..b0657c7bd 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -423,7 +423,7 @@ remove_loading_floating_bar (NautilusFilesView *view) priv->floating_bar_loading_timeout_id = 0; } - gtk_widget_hide (priv->floating_bar); + gtk_widget_set_visible (priv->floating_bar, FALSE); nautilus_floating_bar_set_show_stop (NAUTILUS_FLOATING_BAR (priv->floating_bar), FALSE); } @@ -441,7 +441,7 @@ real_setup_loading_floating_bar (NautilusFilesView *view) nautilus_floating_bar_set_show_stop (NAUTILUS_FLOATING_BAR (priv->floating_bar), priv->loading); gtk_widget_set_halign (priv->floating_bar, GTK_ALIGN_END); - gtk_widget_show (priv->floating_bar); + gtk_widget_set_visible (priv->floating_bar, TRUE); } static gboolean @@ -515,7 +515,7 @@ real_floating_bar_set_short_status (NautilusFilesView *view, if (primary_status == NULL && detail_status == NULL) { - gtk_widget_hide (priv->floating_bar); + gtk_widget_set_visible (priv->floating_bar, FALSE); nautilus_floating_bar_remove_hover_timeout (NAUTILUS_FLOATING_BAR (priv->floating_bar)); return; } @@ -524,7 +524,7 @@ real_floating_bar_set_short_status (NautilusFilesView *view, primary_status, detail_status); - gtk_widget_show (priv->floating_bar); + gtk_widget_set_visible (priv->floating_bar, TRUE); } typedef struct @@ -1490,7 +1490,7 @@ choose_program (NautilusFilesView *view, "directory-view:files", files, (GDestroyNotify) nautilus_file_list_free); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); g_signal_connect_object (dialog, "response", G_CALLBACK (app_chooser_dialog_response_cb), @@ -1803,7 +1803,7 @@ select_pattern (NautilusFilesView *view) g_signal_connect (dialog, "response", G_CALLBACK (pattern_select_response_cb), view); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); } static void @@ -6017,7 +6017,7 @@ copy_or_move_selection (NautilusFilesView *view, G_CALLBACK (on_destination_dialog_response), copy_data); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); } static void @@ -6202,7 +6202,7 @@ real_action_rename (NautilusFilesView *view) nautilus_files_view_get_model (view), window); - gtk_widget_show (GTK_WIDGET (dialog)); + gtk_window_present (GTK_WINDOW (dialog)); } else { @@ -6456,7 +6456,7 @@ extract_files_to_chosen_location (NautilusFilesView *view, G_CALLBACK (on_extract_destination_dialog_response), data); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); } static void @@ -9760,8 +9760,6 @@ nautilus_files_view_init (NautilusFilesView *view) g_signal_connect_object (nautilus_signaller_get_current (), "popup-menu-changed", G_CALLBACK (schedule_update_context_menus), view, G_CONNECT_SWAPPED); - gtk_widget_show (GTK_WIDGET (view)); - g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_CLICK_POLICY, G_CALLBACK (click_policy_changed_callback), diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c index 04e6d375b..3ea0741b5 100644 --- a/src/nautilus-floating-bar.c +++ b/src/nautilus-floating-bar.c @@ -232,14 +232,14 @@ check_pointer_timeout (gpointer user_data) pointer_y < data->y_down_limit || pointer_y > data->y_upper_limit) { - gtk_widget_show (GTK_WIDGET (self)); + gtk_widget_set_visible (GTK_WIDGET (self), TRUE); self->hover_timeout_id = 0; return G_SOURCE_REMOVE; } else { - gtk_widget_hide (GTK_WIDGET (self)); + gtk_widget_set_visible (GTK_WIDGET (self), FALSE); } return G_SOURCE_CONTINUE; @@ -374,20 +374,17 @@ nautilus_floating_bar_constructed (GObject *obj) "margin-start", 12, "margin-end", 12, NULL); - gtk_widget_show (labels_box); w = gtk_label_new (NULL); gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_MIDDLE); gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE); gtk_box_append (GTK_BOX (labels_box), w); self->primary_label_widget = w; - gtk_widget_show (w); w = gtk_label_new (NULL); gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE); gtk_box_append (GTK_BOX (labels_box), w); self->details_label_widget = w; - gtk_widget_show (w); w = gtk_button_new_from_icon_name ("process-stop-symbolic"); gtk_widget_add_css_class (w, "circular"); diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c index 665efd628..b9b96f02a 100644 --- a/src/nautilus-list-view.c +++ b/src/nautilus-list-view.c @@ -584,18 +584,14 @@ action_visible_columns (GSimpleAction *action, { NautilusListView *self = NAUTILUS_LIST_VIEW (user_data); - if (self->column_editor) - { - gtk_widget_show (self->column_editor); - } - else + if (self->column_editor == NULL) { self->column_editor = create_column_editor (self); g_object_add_weak_pointer (G_OBJECT (self->column_editor), (gpointer *) &self->column_editor); - - gtk_widget_show (self->column_editor); } + + gtk_window_present (GTK_WINDOW (self->column_editor)); } static void diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c index d4dfd1602..b9b8d3078 100644 --- a/src/nautilus-mime-actions.c +++ b/src/nautilus-mime-actions.c @@ -1155,7 +1155,7 @@ choose_program (GtkDialog *message_dialog, nautilus_file_ref (file), (GDestroyNotify) nautilus_file_unref); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); g_signal_connect (dialog, "response", diff --git a/src/nautilus-new-folder-dialog-controller.c b/src/nautilus-new-folder-dialog-controller.c index 9638c8787..2b214b566 100644 --- a/src/nautilus-new-folder-dialog-controller.c +++ b/src/nautilus-new-folder-dialog-controller.c @@ -146,7 +146,7 @@ nautilus_new_folder_dialog_controller_new (GtkWindow *parent_window, gtk_label_set_text (GTK_LABEL (name_label), _("Folder name")); gtk_window_set_title (GTK_WINDOW (new_folder_dialog), _("New Folder")); - gtk_widget_show (new_folder_dialog); + gtk_window_present (GTK_WINDOW (new_folder_dialog)); return self; } diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c index 2371339a5..2209a2dbd 100644 --- a/src/nautilus-operations-ui-manager.c +++ b/src/nautilus-operations-ui-manager.c @@ -500,7 +500,7 @@ run_file_conflict_dialog (gpointer user_data) data); g_signal_connect (data->dialog, "response", G_CALLBACK (on_conflict_dialog_response), data); - gtk_widget_show (GTK_WIDGET (data->dialog)); + gtk_window_present (GTK_WINDOW (data->dialog)); g_list_free (files); @@ -593,7 +593,7 @@ open_file_in_application (gpointer user_data) gtk_app_chooser_dialog_set_heading (GTK_APP_CHOOSER_DIALOG (dialog), heading); g_signal_connect (dialog, "response", G_CALLBACK (on_app_chooser_response), data); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); return G_SOURCE_REMOVE; } @@ -664,7 +664,7 @@ run_passphrase_dialog (gpointer user_data) g_signal_connect (dialog, "response", G_CALLBACK (on_request_passphrase_cb), data); gtk_window_set_transient_for (GTK_WINDOW (dialog), data->parent_window); - gtk_widget_show (GTK_WIDGET (dialog)); + gtk_window_present (GTK_WINDOW (dialog)); return G_SOURCE_REMOVE; } diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c index 6f7d2327e..885833b0c 100644 --- a/src/nautilus-pathbar.c +++ b/src/nautilus-pathbar.c @@ -791,12 +791,12 @@ nautilus_path_bar_update_button_appearance (ButtonData *button_data, if (icon != NULL) { gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), icon); - gtk_widget_show (GTK_WIDGET (button_data->image)); + gtk_widget_set_visible (GTK_WIDGET (button_data->image), TRUE); g_object_unref (icon); } else { - gtk_widget_hide (GTK_WIDGET (button_data->image)); + gtk_widget_set_visible (GTK_WIDGET (button_data->image), FALSE); } } @@ -1113,7 +1113,7 @@ make_button_data (NautilusPathBar *self, } gtk_button_set_child (GTK_BUTTON (button_data->button), child); - gtk_widget_show (button_data->container); + gtk_widget_set_visible (button_data->container, TRUE); button_data->path_bar = self; diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c index e9e77851f..3ec1cb04f 100644 --- a/src/nautilus-places-view.c +++ b/src/nautilus-places-view.c @@ -385,7 +385,7 @@ nautilus_places_view_init (NautilusPlacesView *self) NAUTILUS_OPEN_FLAG_NEW_TAB | NAUTILUS_OPEN_FLAG_NEW_WINDOW | NAUTILUS_OPEN_FLAG_NORMAL); gtk_widget_set_hexpand (priv->places_view, TRUE); gtk_widget_set_vexpand (priv->places_view, TRUE); - gtk_widget_show (priv->places_view); + gtk_widget_set_visible (priv->places_view, TRUE); gtk_box_append (GTK_BOX (self), priv->places_view); g_signal_connect_object (priv->places_view, "notify::loading", diff --git a/src/nautilus-preferences-window.c b/src/nautilus-preferences-window.c index e8d66639c..352ed4286 100644 --- a/src/nautilus-preferences-window.c +++ b/src/nautilus-preferences-window.c @@ -382,7 +382,7 @@ static void nautilus_preferences_window_setup(GtkBuilder *builder, gtk_window_set_transient_for (GTK_WINDOW (preferences_window), parent_window); - gtk_widget_show (preferences_window); + gtk_window_present (GTK_WINDOW (preferences_window)); } void nautilus_preferences_window_show(GtkWindow *window) diff --git a/src/nautilus-progress-indicator.c b/src/nautilus-progress-indicator.c index fdb4a6eae..6c43a97d6 100644 --- a/src/nautilus-progress-indicator.c +++ b/src/nautilus-progress-indicator.c @@ -467,7 +467,7 @@ operations_list_create_widget (GObject *item, GtkWidget *widget; widget = nautilus_progress_info_widget_new (info); - gtk_widget_show (widget); + gtk_widget_set_visible (widget, TRUE); return widget; } diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c index 6a47c6447..e9e24264f 100644 --- a/src/nautilus-properties-window.c +++ b/src/nautilus-properties-window.c @@ -794,7 +794,7 @@ setup_star_button (NautilusPropertiesWindow *self) if (nautilus_tag_manager_can_star_contents (tag_manager, parent_location)) { - gtk_widget_show (self->star_button); + gtk_widget_set_visible (self->star_button, TRUE); update_star (self, tag_manager); g_signal_connect_object (tag_manager, "starred-changed", G_CALLBACK (on_starred_changed), self, 0); @@ -1080,7 +1080,7 @@ get_mime_list (NautilusPropertiesWindow *self) static gboolean start_spinner_callback (NautilusPropertiesWindow *self) { - gtk_widget_show (self->contents_spinner); + gtk_widget_set_visible (self->contents_spinner, TRUE); gtk_spinner_start (GTK_SPINNER (self->contents_spinner)); self->deep_count_spinner_timeout_id = 0; @@ -1103,7 +1103,7 @@ static void stop_spinner (NautilusPropertiesWindow *self) { gtk_spinner_stop (GTK_SPINNER (self->contents_spinner)); - gtk_widget_hide (self->contents_spinner); + gtk_widget_set_visible (self->contents_spinner, FALSE); g_clear_handle_id (&self->deep_count_spinner_timeout_id, g_source_remove); } @@ -2538,7 +2538,7 @@ setup_volume_information (NautilusPropertiesWindow *self) } gtk_label_set_text (self->type_file_system_label, fs_label); - gtk_widget_show (GTK_WIDGET (self->type_file_system_label)); + gtk_widget_set_visible (GTK_WIDGET (self->type_file_system_label), TRUE); } } @@ -2705,19 +2705,19 @@ setup_basic_page (NautilusPropertiesWindow *self) if (should_show_volume_usage (self)) { - gtk_widget_show (self->disk_list_box); + gtk_widget_set_visible (self->disk_list_box, TRUE); setup_volume_usage_widget (self); } if (should_show_file_type (self)) { - gtk_widget_show (self->type_value_label); + gtk_widget_set_visible (self->type_value_label, TRUE); add_updatable_label (self, self->type_value_label, "detailed_type"); } if (should_show_link_target (self)) { - gtk_widget_show (self->link_target_row); + gtk_widget_set_visible (self->link_target_row, TRUE); add_updatable_label (self, self->link_target_value_label, "link_target"); should_show_locations_list_box = TRUE; @@ -2729,19 +2729,19 @@ setup_basic_page (NautilusPropertiesWindow *self) /* We have a more efficient way to measure used space in volumes. */ if (!is_volume_properties (self)) { - gtk_widget_show (self->contents_box); + gtk_widget_set_visible (self->contents_box, TRUE); setup_contents_field (self); } } else { - gtk_widget_show (self->size_value_label); + gtk_widget_set_visible (self->size_value_label, TRUE); add_updatable_label (self, self->size_value_label, "size"); } if (should_show_location_info (self)) { - gtk_widget_show (self->parent_folder_row); + gtk_widget_set_visible (self->parent_folder_row, TRUE); add_updatable_label (self, self->parent_folder_value_label, "where"); should_show_locations_list_box = TRUE; @@ -2749,29 +2749,29 @@ setup_basic_page (NautilusPropertiesWindow *self) if (should_show_trashed_info (self)) { - gtk_widget_show (self->trashed_list_box); + gtk_widget_set_visible (self->trashed_list_box, TRUE); add_updatable_label (self, self->original_folder_value_label, "trash_orig_path"); add_updatable_label (self, self->trashed_on_value_label, "trashed_on_full"); } if (should_show_modified_date (self)) { - gtk_widget_show (self->times_list_box); - gtk_widget_show (self->modified_row); + gtk_widget_set_visible (self->times_list_box, TRUE); + gtk_widget_set_visible (self->modified_row, TRUE); add_updatable_label (self, self->modified_value_label, "date_modified_full"); } if (should_show_created_date (self)) { - gtk_widget_show (self->created_row); - gtk_widget_show (self->times_list_box); + gtk_widget_set_visible (self->created_row, TRUE); + gtk_widget_set_visible (self->times_list_box, TRUE); add_updatable_label (self, self->created_value_label, "date_created_full"); } if (should_show_accessed_date (self)) { - gtk_widget_show (self->times_list_box); - gtk_widget_show (self->accessed_row); + gtk_widget_set_visible (self->times_list_box, TRUE); + gtk_widget_set_visible (self->accessed_row, TRUE); add_updatable_label (self, self->accessed_value_label, "date_accessed_full"); } @@ -2780,14 +2780,14 @@ setup_basic_page (NautilusPropertiesWindow *self) /* We have a more efficient way to measure free space in volumes. */ if (!is_volume_properties (self)) { - gtk_widget_show (self->free_space_value_label); + gtk_widget_set_visible (self->free_space_value_label, TRUE); add_updatable_label (self, self->free_space_value_label, "free_space"); } } if (should_show_locations_list_box) { - gtk_widget_show (self->locations_list_box); + gtk_widget_set_visible (self->locations_list_box, TRUE); } } @@ -2993,7 +2993,7 @@ update_execution_row (GtkWidget *row, if (!should_show_exectution_switch (self)) { - gtk_widget_hide (GTK_WIDGET (self->execution_row)); + gtk_widget_set_visible (GTK_WIDGET (self->execution_row), FALSE); } else { @@ -3011,7 +3011,7 @@ update_execution_row (GtkWidget *row, gtk_widget_set_sensitive (row, target_perm->can_set_any_file_permission); - gtk_widget_show (GTK_WIDGET (self->execution_row)); + gtk_widget_set_visible (GTK_WIDGET (self->execution_row), TRUE); } } @@ -3309,7 +3309,7 @@ create_permissions_row (NautilusPropertiesWindow *self, expression = gtk_property_expression_new (NAUTILUS_TYPE_PERMISSION_ENTRY, NULL, "name"); adw_combo_row_set_expression (row, expression); - gtk_widget_show (GTK_WIDGET (row)); + gtk_widget_set_visible (GTK_WIDGET (row), TRUE); g_object_set_data (G_OBJECT (row), "permission-type", GINT_TO_POINTER (permission_type)); g_object_set_data (G_OBJECT (row), "filter-type", GINT_TO_POINTER (filter_type)); @@ -3625,7 +3625,7 @@ on_change_permissions_clicked (GtkWidget *button, set_active_from_umask (combo, PERMISSION_OTHER, FOLDERS_ONLY); g_signal_connect (dialog, "response", G_CALLBACK (on_change_permissions_response), self); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); } static void @@ -3644,15 +3644,15 @@ setup_permissions_page (NautilusPropertiesWindow *self) if (!all_can_set_permissions (file_list)) { - gtk_widget_show (self->not_the_owner_label); - gtk_widget_show (self->bottom_prompt_seperator); + gtk_widget_set_visible (self->not_the_owner_label, TRUE); + gtk_widget_set_visible (self->bottom_prompt_seperator, TRUE); } gtk_stack_set_visible_child_name (GTK_STACK (self->permissions_stack), "permissions-box"); create_simple_permissions (self); #ifdef HAVE_SELINUX - gtk_widget_show (self->security_context_list_box); + gtk_widget_set_visible (self->security_context_list_box, TRUE); /* Stash a copy of the file attribute name in this field for the callback's sake. */ g_object_set_data_full (G_OBJECT (self->security_context_value_label), "file_attribute", @@ -3664,7 +3664,7 @@ setup_permissions_page (NautilusPropertiesWindow *self) if (self->has_recursive_apply) { - gtk_widget_show (self->change_permissions_button_box); + gtk_widget_set_visible (self->change_permissions_button_box, TRUE); g_signal_connect (self->change_permissions_button, "clicked", G_CALLBACK (on_change_permissions_clicked), self); @@ -3923,12 +3923,12 @@ create_properties_window (StartupData *startup_data) if (should_show_permissions (window)) { setup_permissions_page (window); - gtk_widget_show (window->permissions_navigation_row); + gtk_widget_set_visible (window->permissions_navigation_row, TRUE); } if (should_show_exectution_switch (window)) { - gtk_widget_show (GTK_WIDGET (window->execution_row)); + gtk_widget_set_visible (GTK_WIDGET (window->execution_row), TRUE); } /* Add available extension models pages */ @@ -4285,7 +4285,7 @@ custom_icon_file_chooser_response_cb (GtkDialog *dialog, break; } - gtk_widget_hide (GTK_WIDGET (dialog)); + gtk_window_destroy (GTK_WINDOW (dialog)); } static void @@ -4366,7 +4366,7 @@ select_image_button_callback (GtkWidget *widget, g_signal_connect (dialog, "response", G_CALLBACK (custom_icon_file_chooser_response_cb), self); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); } static void diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c index a567331b3..7de9dddd6 100644 --- a/src/nautilus-query-editor.c +++ b/src/nautilus-query-editor.c @@ -622,7 +622,7 @@ nautilus_query_editor_init (NautilusQueryEditor *editor) gtk_widget_set_parent (image, GTK_WIDGET (editor)); editor->tags_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_widget_hide (editor->tags_box); + gtk_widget_set_visible (editor->tags_box, FALSE); gtk_widget_set_parent (editor->tags_box, GTK_WIDGET (editor)); editor->text = gtk_text_new (); diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c index e8e313659..c810b2083 100644 --- a/src/nautilus-search-popover.c +++ b/src/nautilus-search-popover.c @@ -237,7 +237,6 @@ listbox_header_func (GtkListBoxRow *row, GtkWidget *separator; separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_widget_show (separator); gtk_list_box_row_set_header (row, separator); } @@ -397,7 +396,6 @@ create_row_for_label (const gchar *text, NULL); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), label); - gtk_widget_show (row); return row; } @@ -694,7 +692,7 @@ show_other_types_dialog (NautilusSearchPopover *popover) gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listview); g_signal_connect (dialog, "response", G_CALLBACK (on_other_types_dialog_response), popover); - gtk_widget_show (dialog); + gtk_window_present (GTK_WINDOW (dialog)); } static void @@ -718,7 +716,7 @@ update_date_label (NautilusSearchPopover *popover, gtk_editable_set_text (GTK_EDITABLE (popover->date_entry), days < 1 ? label : ""); - gtk_widget_show (popover->clear_date_button); + gtk_widget_set_visible (popover->clear_date_button, TRUE); gtk_label_set_label (GTK_LABEL (popover->select_date_button_label), label); g_date_time_unref (now); @@ -729,7 +727,7 @@ update_date_label (NautilusSearchPopover *popover, gtk_label_set_label (GTK_LABEL (popover->select_date_button_label), _("Select Dates…")); gtk_editable_set_text (GTK_EDITABLE (popover->date_entry), ""); - gtk_widget_hide (popover->clear_date_button); + gtk_widget_set_visible (popover->clear_date_button, FALSE); } } diff --git a/src/nautilus-special-location-bar.c b/src/nautilus-special-location-bar.c index ae976454c..6592c3719 100644 --- a/src/nautilus-special-location-bar.c +++ b/src/nautilus-special-location-bar.c @@ -187,28 +187,26 @@ set_special_location (NautilusSpecialLocationBar *bar, gtk_label_set_text (GTK_LABEL (bar->label), message); g_free (message); - gtk_widget_show (bar->label); - if (learn_more_markup) { gtk_label_set_markup (GTK_LABEL (bar->learn_more_label), learn_more_markup); - gtk_widget_show (bar->learn_more_label); + gtk_widget_set_visible (bar->learn_more_label, TRUE); g_free (learn_more_markup); } else { - gtk_widget_hide (bar->learn_more_label); + gtk_widget_set_visible (bar->learn_more_label, FALSE); } if (button_label) { gtk_button_set_label (GTK_BUTTON (bar->button), button_label); - gtk_widget_show (bar->button); + gtk_widget_set_visible (bar->button, TRUE); } else { - gtk_widget_hide (bar->button); + gtk_widget_set_visible (bar->button, FALSE); } } @@ -292,7 +290,6 @@ nautilus_special_location_bar_init (NautilusSpecialLocationBar *bar) info_bar = gtk_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_QUESTION); - gtk_widget_show (info_bar); adw_bin_set_child (ADW_BIN (bar), info_bar); attrs = pango_attr_list_new (); diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c index aad0fd3d0..397e9bdfe 100644 --- a/src/nautilus-toolbar.c +++ b/src/nautilus-toolbar.c @@ -249,7 +249,6 @@ nautilus_toolbar_constructed (GObject *object) * the whole title widget. */ gtk_editable_set_max_width_chars (GTK_EDITABLE (self->location_entry), 88); - gtk_widget_show (GTK_WIDGET (self)); toolbar_update_appearance (self); } diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c index 49fa95faa..b2e50cbd4 100644 --- a/src/nautilus-window-slot.c +++ b/src/nautilus-window-slot.c @@ -676,7 +676,6 @@ nautilus_window_slot_add_extra_location_widget (NautilusWindowSlot *self, GtkWidget *widget) { gtk_box_append (GTK_BOX (self->extra_location_widgets), widget); - gtk_widget_show (self->extra_location_widgets); } static void @@ -912,18 +911,15 @@ nautilus_window_slot_constructed (GObject *object) gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL); - gtk_widget_show (GTK_WIDGET (self)); extras_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); self->extra_location_widgets = extras_vbox; gtk_box_append (GTK_BOX (self), extras_vbox); - gtk_widget_show (extras_vbox); self->query_editor = NAUTILUS_QUERY_EDITOR (nautilus_query_editor_new ()); /* We want to keep alive the query editor betwen additions and removals on the * UI, specifically when the toolbar adds or removes it */ g_object_ref_sink (self->query_editor); - gtk_widget_show (GTK_WIDGET (self->query_editor)); self->search_info_label = GTK_LABEL (gtk_label_new (NULL)); self->search_info_label_revealer = GTK_REVEALER (gtk_revealer_new ()); @@ -933,9 +929,6 @@ nautilus_window_slot_constructed (GObject *object) gtk_box_append (GTK_BOX (self), GTK_WIDGET (self->search_info_label_revealer)); - gtk_widget_show (GTK_WIDGET (self->search_info_label)); - gtk_widget_show (GTK_WIDGET (self->search_info_label_revealer)); - gtk_widget_add_css_class (GTK_WIDGET (self->search_info_label), "search-information"); g_object_bind_property (self, "location", @@ -2035,7 +2028,6 @@ setup_view (NautilusWindowSlot *self, } change_view (self); - gtk_widget_show (GTK_WIDGET (self->window)); out: nautilus_profile_end (NULL); @@ -2498,7 +2490,6 @@ nautilus_window_slot_show_x_content_bar (NautilusWindowSlot *self, } bar = nautilus_x_content_bar_new (mount, x_content_types); - gtk_widget_show (bar); nautilus_window_slot_add_extra_location_widget (self, bar); } @@ -2569,7 +2560,6 @@ nautilus_window_slot_show_special_location_bar (NautilusWindowSlot *self, GtkWidget *bar; bar = nautilus_special_location_bar_new (special_location); - gtk_widget_show (bar); nautilus_window_slot_add_extra_location_widget (self, bar); } @@ -2617,8 +2607,6 @@ view_started_loading (NautilusWindowSlot *self, gtk_widget_grab_focus (GTK_WIDGET (self->window)); } - gtk_widget_show (GTK_WIDGET (self->window)); - nautilus_window_slot_set_loading (self, TRUE); } @@ -2816,7 +2804,6 @@ nautilus_window_slot_switch_new_content_view (NautilusWindowSlot *self) widget = GTK_WIDGET (self->content_view); gtk_box_append (GTK_BOX (self), widget); gtk_widget_set_vexpand (widget, TRUE); - gtk_widget_show (widget); self->searching_binding = g_object_bind_property (self->content_view, "searching", self, "searching", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c index 689e1294b..6b2e2505d 100644 --- a/src/nautilus-x-content-bar.c +++ b/src/nautilus-x-content-bar.c @@ -146,8 +146,6 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar, gtk_label_set_text (GTK_LABEL (bar->label), message); g_free (message); - gtk_widget_show (bar->label); - for (n = 0; bar->x_content_types[n] != NULL; n++) { const char *name; @@ -200,8 +198,6 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar, gtk_box_append (GTK_BOX (box), gtk_label_new (name)); gtk_button_set_child (GTK_BUTTON (button), box); - - gtk_widget_show (button); } g_ptr_array_free (apps, TRUE); @@ -329,7 +325,6 @@ nautilus_x_content_bar_init (NautilusXContentBar *bar) info_bar = gtk_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_QUESTION); - gtk_widget_show (info_bar); adw_bin_set_child (ADW_BIN (bar), info_bar); attrs = pango_attr_list_new (); |