gtk: Stop using gtk_widget_show/hide

gtk_widget_set_visible and gtk_window_present
are better alternatives, and calling gtk_widget_show
on newly created widgets is no longer necessary
anyway.
This commit is contained in:
Matthias Clasen 2022-11-28 13:43:36 -05:00
parent 90c986e493
commit f339cc276c
62 changed files with 279 additions and 505 deletions

View File

@ -939,7 +939,7 @@ gtk_about_dialog_activate_link (GtkAboutDialog *about,
static void
update_website (GtkAboutDialog *about)
{
gtk_widget_show (about->website_label);
gtk_widget_set_visible (about->website_label, TRUE);
if (about->website_url)
{
@ -968,7 +968,7 @@ update_website (GtkAboutDialog *about)
if (about->website_text)
gtk_label_set_text (GTK_LABEL (about->website_label), about->website_text);
else
gtk_widget_hide (about->website_label);
gtk_widget_set_visible (about->website_label, FALSE);
}
}
@ -997,13 +997,9 @@ update_name_version (GtkAboutDialog *about)
gtk_window_set_title (GTK_WINDOW (about), title_string);
g_free (title_string);
gtk_widget_set_visible (about->version_label, about->version != NULL);
if (about->version != NULL)
{
gtk_label_set_markup (GTK_LABEL (about->version_label), about->version);
gtk_widget_show (about->version_label);
}
else
gtk_widget_hide (about->version_label);
name_string = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>",
about->name);
@ -1116,17 +1112,14 @@ gtk_about_dialog_set_copyright (GtkAboutDialog *about,
about->copyright = g_strdup (copyright);
g_free (tmp);
gtk_widget_set_visible (about->copyright_label, about->copyright != NULL);
if (about->copyright != NULL)
{
copyright_string = g_markup_printf_escaped ("<span size=\"small\">%s</span>",
about->copyright);
gtk_label_set_markup (GTK_LABEL (about->copyright_label), copyright_string);
g_free (copyright_string);
gtk_widget_show (about->copyright_label);
}
else
gtk_widget_hide (about->copyright_label);
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_COPYRIGHT]);
}
@ -1169,13 +1162,13 @@ gtk_about_dialog_set_comments (GtkAboutDialog *about,
{
about->comments = g_strdup (comments);
gtk_label_set_text (GTK_LABEL (about->comments_label), about->comments);
gtk_widget_show (about->comments_label);
}
else
{
about->comments = NULL;
gtk_widget_hide (about->comments_label);
}
gtk_widget_set_visible (about->comments_label, about->comments != NULL);
g_free (tmp);
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_COMMENTS]);
@ -1228,7 +1221,7 @@ gtk_about_dialog_set_license (GtkAboutDialog *about,
}
g_free (tmp);
gtk_widget_hide (about->license_label);
gtk_widget_set_visible (about->license_label, FALSE);
update_license_button_visibility (about);
@ -2072,7 +2065,7 @@ add_credits_section (GtkAboutDialog *about,
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_grid_attach (grid, label, 1, *row, 1, 1);
gtk_widget_show (label);
gtk_widget_set_visible (label, TRUE);
(*row)++;
}
@ -2167,8 +2160,7 @@ close_cb (GtkAboutDialog *about,
gpointer user_data)
{
gtk_stack_set_visible_child_name (GTK_STACK (about->stack), "main");
gtk_widget_hide (GTK_WIDGET (about));
gtk_widget_set_visible (GTK_WIDGET (about), FALSE);
return TRUE;
}
@ -2256,6 +2248,7 @@ gtk_about_dialog_set_license_type (GtkAboutDialog *about,
about->license_type = license_type;
gtk_widget_set_visible (about->license_label, TRUE);
/* custom licenses use the contents of the :license property */
if (about->license_type != GTK_LICENSE_CUSTOM)
{
@ -2283,15 +2276,10 @@ gtk_about_dialog_set_license_type (GtkAboutDialog *about,
about->license);
gtk_label_set_markup (GTK_LABEL (about->license_label), license_string);
g_free (license_string);
gtk_widget_show (about->license_label);
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_WRAP_LICENSE]);
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LICENSE]);
}
else
{
gtk_widget_show (about->license_label);
}
update_license_button_visibility (about);

View File

@ -788,7 +788,7 @@ show_help_overlay (GSimpleAction *action,
GtkApplicationWindowPrivate *priv = gtk_application_window_get_instance_private (window);
if (priv->help_overlay)
gtk_widget_show (GTK_WIDGET (priv->help_overlay));
gtk_window_present (GTK_WINDOW (priv->help_overlay));
}
/**

View File

@ -767,10 +767,8 @@ static void
compute_last_button_state (GtkAssistant *assistant)
{
gtk_widget_set_sensitive (assistant->last, assistant->current_page->complete);
if (last_button_visible (assistant, assistant->current_page))
gtk_widget_show (assistant->last);
else
gtk_widget_hide (assistant->last);
gtk_widget_set_visible (assistant->last,
last_button_visible (assistant, assistant->current_page));
}
static void
@ -782,11 +780,7 @@ compute_progress_state (GtkAssistant *assistant)
page_num = gtk_assistant_get_current_page (assistant);
page_num = (assistant->forward_function) (page_num, assistant->forward_function_data);
if (page_num >= 0 && page_num < n_pages)
gtk_widget_show (assistant->forward);
else
gtk_widget_hide (assistant->forward);
gtk_widget_set_visible (assistant->forward, page_num >= 0 && page_num < n_pages);
}
static void
@ -801,10 +795,10 @@ update_buttons_state (GtkAssistant *assistant)
gtk_widget_set_sensitive (assistant->cancel, TRUE);
gtk_widget_set_sensitive (assistant->forward, assistant->current_page->complete);
gtk_window_set_default_widget (GTK_WINDOW (assistant), assistant->forward);
gtk_widget_show (assistant->forward);
gtk_widget_hide (assistant->back);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->close);
gtk_widget_set_visible (assistant->forward, TRUE);
gtk_widget_set_visible (assistant->back, FALSE);
gtk_widget_set_visible (assistant->apply, FALSE);
gtk_widget_set_visible (assistant->close, FALSE);
compute_last_button_state (assistant);
break;
case GTK_ASSISTANT_PAGE_CONFIRM:
@ -812,68 +806,68 @@ update_buttons_state (GtkAssistant *assistant)
gtk_widget_set_sensitive (assistant->back, TRUE);
gtk_widget_set_sensitive (assistant->apply, assistant->current_page->complete);
gtk_window_set_default_widget (GTK_WINDOW (assistant), assistant->apply);
gtk_widget_show (assistant->back);
gtk_widget_show (assistant->apply);
gtk_widget_hide (assistant->forward);
gtk_widget_hide (assistant->close);
gtk_widget_hide (assistant->last);
gtk_widget_set_visible (assistant->back, TRUE);
gtk_widget_set_visible (assistant->apply, TRUE);
gtk_widget_set_visible (assistant->forward, FALSE);
gtk_widget_set_visible (assistant->close, FALSE);
gtk_widget_set_visible (assistant->last, FALSE);
break;
case GTK_ASSISTANT_PAGE_CONTENT:
gtk_widget_set_sensitive (assistant->cancel, TRUE);
gtk_widget_set_sensitive (assistant->back, TRUE);
gtk_widget_set_sensitive (assistant->forward, assistant->current_page->complete);
gtk_window_set_default_widget (GTK_WINDOW (assistant), assistant->forward);
gtk_widget_show (assistant->back);
gtk_widget_show (assistant->forward);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->close);
gtk_widget_set_visible (assistant->back, TRUE);
gtk_widget_set_visible (assistant->forward, TRUE);
gtk_widget_set_visible (assistant->apply, FALSE);
gtk_widget_set_visible (assistant->close, FALSE);
compute_last_button_state (assistant);
break;
case GTK_ASSISTANT_PAGE_SUMMARY:
gtk_widget_set_sensitive (assistant->close, assistant->current_page->complete);
gtk_window_set_default_widget (GTK_WINDOW (assistant), assistant->close);
gtk_widget_show (assistant->close);
gtk_widget_hide (assistant->back);
gtk_widget_hide (assistant->forward);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->last);
gtk_widget_set_visible (assistant->close, TRUE);
gtk_widget_set_visible (assistant->back, FALSE);
gtk_widget_set_visible (assistant->forward, FALSE);
gtk_widget_set_visible (assistant->apply, FALSE);
gtk_widget_set_visible (assistant->last, FALSE);
break;
case GTK_ASSISTANT_PAGE_PROGRESS:
gtk_widget_set_sensitive (assistant->cancel, assistant->current_page->complete);
gtk_widget_set_sensitive (assistant->back, assistant->current_page->complete);
gtk_widget_set_sensitive (assistant->forward, assistant->current_page->complete);
gtk_window_set_default_widget (GTK_WINDOW (assistant), assistant->forward);
gtk_widget_show (assistant->back);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->close);
gtk_widget_hide (assistant->last);
gtk_widget_set_visible (assistant->back, TRUE);
gtk_widget_set_visible (assistant->apply, FALSE);
gtk_widget_set_visible (assistant->close, FALSE);
gtk_widget_set_visible (assistant->last, FALSE);
compute_progress_state (assistant);
break;
case GTK_ASSISTANT_PAGE_CUSTOM:
gtk_widget_hide (assistant->cancel);
gtk_widget_hide (assistant->back);
gtk_widget_hide (assistant->forward);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->last);
gtk_widget_hide (assistant->close);
gtk_widget_set_visible (assistant->cancel, FALSE);
gtk_widget_set_visible (assistant->back, FALSE);
gtk_widget_set_visible (assistant->forward, FALSE);
gtk_widget_set_visible (assistant->apply, FALSE);
gtk_widget_set_visible (assistant->last, FALSE);
gtk_widget_set_visible (assistant->close, FALSE);
break;
default:
g_assert_not_reached ();
}
if (assistant->committed)
gtk_widget_hide (assistant->cancel);
gtk_widget_set_visible (assistant->cancel, FALSE);
else if (assistant->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY ||
assistant->current_page->type == GTK_ASSISTANT_PAGE_CUSTOM)
gtk_widget_hide (assistant->cancel);
gtk_widget_set_visible (assistant->cancel, FALSE);
else
gtk_widget_show (assistant->cancel);
gtk_widget_set_visible (assistant->cancel, TRUE);
/* this is quite general, we don't want to
* go back if it's the first page
*/
if (!assistant->visited_pages)
gtk_widget_hide (assistant->back);
gtk_widget_set_visible (assistant->back, FALSE);
}
static gboolean
@ -1711,8 +1705,8 @@ gtk_assistant_add_page (GtkAssistant *assistant,
gtk_label_set_xalign (GTK_LABEL (page_info->regular_title), 0.0);
gtk_label_set_xalign (GTK_LABEL (page_info->current_title), 0.0);
gtk_widget_show (page_info->regular_title);
gtk_widget_hide (page_info->current_title);
gtk_widget_set_visible (page_info->regular_title, TRUE);
gtk_widget_set_visible (page_info->current_title, FALSE);
gtk_widget_add_css_class (page_info->current_title, "highlight");

View File

@ -752,7 +752,7 @@ gtk_calendar_init (GtkCalendar *calendar)
gtk_grid_attach (GTK_GRID (calendar->grid), label, 0, 1 + i, 1, 1);
calendar->week_number_labels[i] = label;
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
}
{

View File

@ -506,8 +506,8 @@ gtk_color_chooser_widget_activate_color_customize (GtkWidget *widget,
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc->editor), &color);
gtk_widget_hide (cc->palette);
gtk_widget_show (cc->editor);
gtk_widget_set_visible (cc->palette, FALSE);
gtk_widget_set_visible (cc->editor, TRUE);
g_object_notify (G_OBJECT (cc), "show-editor");
}
@ -622,7 +622,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc), &rgba);
}
gtk_widget_hide (GTK_WIDGET (cc->editor));
gtk_widget_set_visible (GTK_WIDGET (cc->editor), FALSE);
}
/* GObject implementation {{{1 */
@ -809,7 +809,6 @@ add_custom_color (GtkColorChooserWidget *cc,
connect_custom_signals (p, cc);
gtk_box_insert_child_after (GTK_BOX (cc->custom), p, gtk_widget_get_first_child (cc->custom));
gtk_widget_show (p);
select_swatch (cc, GTK_COLOR_SWATCH (p));
save_custom_colors (cc);

View File

@ -184,7 +184,7 @@ dismiss_current_popup (GtkColorEditor *editor)
{
if (editor->current_popup)
{
gtk_widget_hide (editor->current_popup);
gtk_widget_set_visible (editor->current_popup, FALSE);
editor->current_popup = NULL;
editor->popup_position = 0;
if (editor->popdown_focus)
@ -245,7 +245,7 @@ popup_edit (GtkWidget *widget,
g_set_object (&editor->popdown_focus, gtk_root_get_focus (root));
editor->current_popup = popup;
editor->popup_position = position;
gtk_widget_show (popup);
gtk_widget_set_visible (popup, TRUE);
gtk_widget_grab_focus (focus);
}
}
@ -432,8 +432,7 @@ gtk_color_editor_init (GtkColorEditor *editor)
gtk_widget_remove_css_class (editor->swatch, "activatable");
editor->picker = gtk_color_picker_new ();
if (editor->picker == NULL)
gtk_widget_hide (editor->picker_button);
gtk_widget_set_visible (editor->picker_button, editor->picker != NULL);
}
static void

View File

@ -319,7 +319,7 @@ gtk_column_view_title_update_sort (GtkColumnViewTitle *self)
primary = gtk_column_view_sorter_get_primary_sort_column (view_sorter);
sort_order = gtk_column_view_sorter_get_primary_sort_order (view_sorter);
gtk_widget_show (self->sort);
gtk_widget_set_visible (self->sort, TRUE);
gtk_widget_remove_css_class (self->sort, "ascending");
gtk_widget_remove_css_class (self->sort, "descending");
gtk_widget_remove_css_class (self->sort, "unsorted");
@ -332,7 +332,7 @@ gtk_column_view_title_update_sort (GtkColumnViewTitle *self)
gtk_widget_add_css_class (self->sort, "ascending");
}
else
gtk_widget_hide (self->sort);
gtk_widget_set_visible (self->sort, FALSE);
}
GtkColumnViewColumn *

View File

@ -436,7 +436,6 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog,
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 1);
gtk_box_append (GTK_BOX (hbox), button);
gtk_widget_show (button);
data->spin_button = button;
@ -450,7 +449,6 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog,
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_box_append (GTK_BOX (hbox), label);
gtk_widget_show (label);
gtk_label_set_mnemonic_widget (GTK_LABEL (mnemonic_label), button);
g_object_set_data_full (G_OBJECT (hbox), "unit-data", data, g_free);
@ -727,7 +725,6 @@ wrap_in_frame (const char *label,
label_widget = gtk_label_new (NULL);
gtk_widget_set_halign (label_widget, GTK_ALIGN_START);
gtk_widget_set_valign (label_widget, GTK_ALIGN_CENTER);
gtk_widget_show (label_widget);
bold_text = g_markup_printf_escaped ("<b>%s</b>", label);
gtk_label_set_markup (GTK_LABEL (label_widget), bold_text);
@ -742,8 +739,6 @@ wrap_in_frame (const char *label,
gtk_box_append (GTK_BOX (frame), child);
gtk_widget_show (frame);
return frame;
}
@ -863,11 +858,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_set_margin_top (hbox, 20);
gtk_widget_set_margin_bottom (hbox, 20);
gtk_box_append (GTK_BOX (content_area), hbox);
gtk_widget_show (hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_append (GTK_BOX (hbox), vbox);
gtk_widget_show (vbox);
scrolled = gtk_scrolled_window_new ();
gtk_widget_set_vexpand (scrolled, TRUE);
@ -875,7 +868,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled), TRUE);
gtk_box_append (GTK_BOX (vbox), scrolled);
gtk_widget_show (scrolled);
model = GTK_SELECTION_MODEL (gtk_single_selection_new (g_object_ref (G_LIST_MODEL (dialog->custom_paper_list))));
g_signal_connect (model, "notify::selected", G_CALLBACK (selected_custom_paper_changed), dialog);
@ -913,7 +905,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
dialog->values_box = vbox;
gtk_box_append (GTK_BOX (hbox), vbox);
gtk_widget_show (vbox);
grid = gtk_grid_new ();
@ -923,29 +914,23 @@ G_GNUC_END_IGNORE_DEPRECATIONS
label = gtk_label_new_with_mnemonic (_("_Width:"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_widget_show (label);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
widget = new_unit_widget (dialog, user_units, label);
dialog->width_widget = widget;
gtk_grid_attach (GTK_GRID (grid), widget, 1, 0, 1, 1);
gtk_widget_show (widget);
label = gtk_label_new_with_mnemonic (_("_Height:"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_widget_show (label);
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
widget = new_unit_widget (dialog, user_units, label);
dialog->height_widget = widget;
gtk_grid_attach (GTK_GRID (grid), widget, 1, 1, 1, 1);
gtk_widget_show (widget);
frame = wrap_in_frame (_("Paper Size"), grid);
gtk_widget_show (grid);
gtk_box_append (GTK_BOX (vbox), frame);
gtk_widget_show (frame);
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
@ -955,49 +940,40 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
gtk_widget_show (label);
widget = new_unit_widget (dialog, user_units, label);
dialog->top_widget = widget;
gtk_grid_attach (GTK_GRID (grid), widget, 1, 0, 1, 1);
gtk_widget_show (widget);
label = gtk_label_new_with_mnemonic (_("_Bottom:"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
gtk_widget_show (label);
widget = new_unit_widget (dialog, user_units, label);
dialog->bottom_widget = widget;
gtk_grid_attach (GTK_GRID (grid), widget, 1, 1, 1, 1);
gtk_widget_show (widget);
label = gtk_label_new_with_mnemonic (_("_Left:"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
gtk_widget_show (label);
widget = new_unit_widget (dialog, user_units, label);
dialog->left_widget = widget;
gtk_grid_attach (GTK_GRID (grid), widget, 1, 2, 1, 1);
gtk_widget_show (widget);
label = gtk_label_new_with_mnemonic (_("_Right:"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
gtk_widget_show (label);
widget = new_unit_widget (dialog, user_units, label);
dialog->right_widget = widget;
gtk_grid_attach (GTK_GRID (grid), widget, 1, 3, 1, 1);
gtk_widget_show (widget);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_grid_attach (GTK_GRID (grid), hbox, 0, 4, 2, 1);
gtk_widget_show (hbox);
combo = gtk_drop_down_new (g_object_ref (dialog->printer_list), NULL);
@ -1021,9 +997,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
G_CALLBACK (margins_from_printer_changed), dialog);
frame = wrap_in_frame (_("Paper Margins"), grid);
gtk_widget_show (grid);
gtk_box_append (GTK_BOX (vbox), frame);
gtk_widget_show (frame);
update_custom_widgets_from_list (dialog);

View File

@ -418,7 +418,7 @@ gtk_drag_icon_get_for_drag (GdkDrag *drag)
g_object_set_qdata_full (G_OBJECT (drag), drag_icon_quark, g_object_ref_sink (self), g_object_unref);
if (GTK_DRAG_ICON (self)->child != NULL)
gtk_widget_show (self);
gtk_widget_set_visible (self, TRUE);
}
return self;
@ -480,7 +480,7 @@ gtk_drag_icon_set_child (GtkDragIcon *self,
if (self->child)
{
gtk_widget_set_parent (self->child, GTK_WIDGET (self));
gtk_widget_show (GTK_WIDGET (self));
gtk_widget_set_visible (GTK_WIDGET (self), TRUE);
}
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CHILD]);

View File

@ -700,14 +700,14 @@ bind_item (GtkSignalListItemFactory *factory,
if (gtk_widget_get_ancestor (box, GTK_TYPE_POPOVER) == self->popup)
{
gtk_widget_show (icon);
gtk_widget_set_visible (icon, TRUE);
g_signal_connect (self, "notify::selected-item",
G_CALLBACK (selected_item_changed), list_item);
selected_item_changed (self, NULL, list_item);
}
else
{
gtk_widget_hide (icon);
gtk_widget_set_visible (icon, FALSE);
}
}

View File

@ -380,7 +380,7 @@ add_recent_item (GtkEmojiChooser *chooser,
add_emoji (chooser->recent.box, TRUE, item, modifier, chooser);
/* Enable recent */
gtk_widget_show (chooser->recent.box);
gtk_widget_set_visible (chooser->recent.box, TRUE);
gtk_widget_set_sensitive (chooser->recent.button, TRUE);
g_settings_set_value (chooser->settings, "recent-emoji", g_variant_builder_end (&builder));

View File

@ -956,7 +956,6 @@ gtk_expander_set_label (GtkExpander *expander,
child = gtk_label_new (label);
gtk_label_set_use_underline (GTK_LABEL (child), expander->use_underline);
gtk_label_set_use_markup (GTK_LABEL (child), expander->use_markup);
gtk_widget_show (child);
gtk_expander_set_label_widget (expander, child);
}

View File

@ -98,7 +98,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* GTK_RESPONSE_ACCEPT,
* NULL);
*
* gtk_widget_show (dialog);
* gtk_window_present (GTK_WINDOW (dialog));
*
* g_signal_connect (dialog, "response",
* G_CALLBACK (on_open_response),
@ -144,7 +144,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* else
* gtk_file_chooser_set_file (chooser, existing_filename);
*
* gtk_widget_show (dialog);
* gtk_window_present (GTK_WINDOW (dialog));
*
* g_signal_connect (dialog, "response",
* G_CALLBACK (on_save_response),
@ -470,7 +470,6 @@ setup_search (GtkFileChooserDialog *dialog)
gtk_widget_set_focus_on_click (button, FALSE);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_button_set_icon_name (GTK_BUTTON (button), "edit-find-symbolic");
gtk_widget_show (button);
header = gtk_dialog_get_header_bar (GTK_DIALOG (dialog));
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);

View File

@ -576,7 +576,7 @@ dialog_response_cb (GtkDialog *dialog,
GtkFileChooserNative *self = data;
g_signal_handlers_disconnect_by_func (self->dialog, dialog_response_cb, self);
gtk_widget_hide (self->dialog);
gtk_widget_set_visible (self->dialog, FALSE);
_gtk_native_dialog_emit_response (GTK_NATIVE_DIALOG (self), response_id);
}
@ -622,7 +622,7 @@ static void
hide_dialog (GtkFileChooserNative *self)
{
g_signal_handlers_disconnect_by_func (self->dialog, dialog_response_cb, self);
gtk_widget_hide (self->dialog);
gtk_widget_set_visible (self->dialog, FALSE);
}
static gboolean

View File

View File

@ -2297,7 +2297,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
location_entry_create (impl);
gtk_widget_set_hexpand (impl->location_entry, TRUE);
gtk_grid_attach (GTK_GRID (impl->save_widgets_table), impl->location_entry, 1, 0, 1, 1);
gtk_widget_show (impl->location_entry);
gtk_widget_set_visible (impl->location_entry, TRUE);
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->location_entry);
impl->save_widgets = vbox;
@ -2357,7 +2357,7 @@ location_switch_to_filename_entry (GtkFileChooserWidget *impl)
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder);
gtk_widget_show (impl->location_entry);
gtk_widget_set_visible (impl->location_entry, TRUE);
gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "location");
@ -2492,13 +2492,9 @@ set_extra_widget (GtkFileChooserWidget *impl,
}
impl->extra_widget = extra_widget;
gtk_widget_set_visible (impl->extra_align, extra_widget != NULL);
if (impl->extra_widget)
{
gtk_box_append (GTK_BOX (impl->extra_align), impl->extra_widget);
gtk_widget_show (impl->extra_align);
}
else
gtk_widget_hide (impl->extra_align);
/* Calls update_extra_and_filters */
show_filters (impl, impl->filters != NULL);
@ -2638,7 +2634,7 @@ operation_mode_stop (GtkFileChooserWidget *impl,
g_clear_object (&impl->model_for_search);
search_stop_searching (impl, TRUE);
search_clear_model (impl, TRUE);
gtk_widget_hide (impl->remote_warning_bar);
gtk_widget_set_visible (impl->remote_warning_bar, FALSE);
}
}
@ -5664,7 +5660,7 @@ search_engine_finished_cb (GtkSearchEngine *engine,
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
set_busy_cursor (impl, FALSE);
gtk_widget_hide (impl->search_spinner);
gtk_widget_set_visible (impl->search_spinner, FALSE);
if (impl->show_progress_timeout)
{
@ -5721,7 +5717,7 @@ search_stop_searching (GtkFileChooserWidget *impl,
g_clear_object (&impl->search_engine);
set_busy_cursor (impl, FALSE);
gtk_widget_hide (impl->search_spinner);
gtk_widget_set_visible (impl->search_spinner, FALSE);
}
if (impl->show_progress_timeout)
@ -5748,7 +5744,7 @@ show_spinner (gpointer data)
{
GtkFileChooserWidget *impl = data;
gtk_widget_show (impl->search_spinner);
gtk_widget_set_visible (impl->search_spinner, TRUE);
gtk_spinner_start (GTK_SPINNER (impl->search_spinner));
impl->show_progress_timeout = 0;
@ -5808,7 +5804,7 @@ search_start_query (GtkFileChooserWidget *impl,
if (gtk_query_get_location (impl->search_query) &&
_gtk_file_consider_as_remote (gtk_query_get_location (impl->search_query)))
gtk_widget_show (impl->remote_warning_bar);
gtk_widget_set_visible (impl->remote_warning_bar, TRUE);
/* We're not showing the file list here already and instead rely on the
* GtkSearchEntry timeout and the ::hits-added signal from above to

View File

@ -3997,7 +3997,7 @@ gtk_flow_box_bound_model_changed (GListModel *list,
if (g_object_is_floating (widget))
g_object_ref_sink (widget);
gtk_widget_show (widget);
gtk_widget_set_visible (widget, TRUE);
gtk_flow_box_insert (box, widget, position + i);
g_object_unref (widget);

View File

@ -154,10 +154,9 @@ update_tweak_button (GtkFontChooserDialog *dialog)
return;
g_object_get (dialog->fontchooser, "level", &level, NULL);
if ((level & (GTK_FONT_CHOOSER_LEVEL_FEATURES | GTK_FONT_CHOOSER_LEVEL_VARIATIONS)) != 0)
gtk_widget_show (dialog->tweak_button);
else
gtk_widget_hide (dialog->tweak_button);
gtk_widget_set_visible (dialog->tweak_button,
(level & (GTK_FONT_CHOOSER_LEVEL_FEATURES |
GTK_FONT_CHOOSER_LEVEL_VARIATIONS)) != 0);
}
static void

View File

@ -1610,9 +1610,9 @@ add_axis (GtkFontChooserWidget *fontchooser,
g_signal_connect (axis->adjustment, "value-changed", G_CALLBACK (adjustment_changed), axis);
if (is_named_instance (hb_font) || !should_show_axis (ax))
{
gtk_widget_hide (axis->label);
gtk_widget_hide (axis->scale);
gtk_widget_hide (axis->spin);
gtk_widget_set_visible (axis->label, FALSE);
gtk_widget_set_visible (axis->scale, FALSE);
gtk_widget_set_visible (axis->spin, FALSE);
return FALSE;
}
@ -2536,15 +2536,15 @@ gtk_font_chooser_widget_update_font_features (GtkFontChooserWidget *fontchooser)
FeatureItem *item = l->data;
if (item->top)
{
gtk_widget_hide (item->top);
gtk_widget_hide (gtk_widget_get_parent (item->top));
gtk_widget_set_visible (item->top, FALSE);
gtk_widget_set_visible (gtk_widget_get_parent (item->top), FALSE);
}
else
{
gtk_widget_hide (gtk_widget_get_parent (item->feat));
gtk_widget_hide (item->feat);
gtk_widget_hide (gtk_widget_get_prev_sibling (item->feat));
gtk_widget_hide (item->example);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), FALSE);
gtk_widget_set_visible (item->feat, FALSE);
gtk_widget_set_visible (gtk_widget_get_prev_sibling (item->feat), FALSE);
gtk_widget_set_visible (item->example, FALSE);
}
}
@ -2605,15 +2605,15 @@ gtk_font_chooser_widget_update_font_features (GtkFontChooserWidget *fontchooser)
has_feature = TRUE;
if (item->top)
{
gtk_widget_show (item->top);
gtk_widget_show (gtk_widget_get_parent (item->top));
gtk_widget_set_visible (item->top, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (item->top), TRUE);
}
else
{
gtk_widget_show (gtk_widget_get_parent (item->feat));
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_prev_sibling (item->feat));
gtk_widget_show (item->example);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), TRUE);
gtk_widget_set_visible (item->feat, TRUE);
gtk_widget_set_visible (gtk_widget_get_prev_sibling (item->feat), TRUE);
gtk_widget_set_visible (item->example, TRUE);
}
update_feature_label (fontchooser, item, hb_font, script_tag, lang_tag);
@ -2624,8 +2624,8 @@ gtk_font_chooser_widget_update_font_features (GtkFontChooserWidget *fontchooser)
GtkWidget *def = GTK_WIDGET (g_object_get_data (G_OBJECT (item->feat), "default"));
if (def)
{
gtk_widget_show (def);
gtk_widget_show (gtk_widget_get_parent (def));
gtk_widget_set_visible (def, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (def), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (def), TRUE);
}
else
@ -2825,10 +2825,7 @@ gtk_font_chooser_widget_set_show_preview_entry (GtkFontChooserWidget *fontchoose
{
fontchooser->show_preview_entry = show_preview_entry;
if (show_preview_entry)
gtk_widget_show (fontchooser->preview);
else
gtk_widget_hide (fontchooser->preview);
gtk_widget_set_visible (fontchooser->preview, show_preview_entry);
g_object_notify (G_OBJECT (fontchooser), "show-preview-entry");
}
@ -2919,29 +2916,21 @@ static void
gtk_font_chooser_widget_set_level (GtkFontChooserWidget *fontchooser,
GtkFontChooserLevel level)
{
gboolean show_size;
if (fontchooser->level == level)
return;
fontchooser->level = level;
if ((level & GTK_FONT_CHOOSER_LEVEL_SIZE) != 0)
{
gtk_widget_show (fontchooser->size_label);
gtk_widget_show (fontchooser->size_slider);
gtk_widget_show (fontchooser->size_spin);
gtk_widget_show (fontchooser->size_label2);
gtk_widget_show (fontchooser->size_slider2);
gtk_widget_show (fontchooser->size_spin2);
}
else
{
gtk_widget_hide (fontchooser->size_label);
gtk_widget_hide (fontchooser->size_slider);
gtk_widget_hide (fontchooser->size_spin);
gtk_widget_hide (fontchooser->size_label2);
gtk_widget_hide (fontchooser->size_slider2);
gtk_widget_hide (fontchooser->size_spin2);
}
show_size = (level & GTK_FONT_CHOOSER_LEVEL_SIZE) != 0;
gtk_widget_set_visible (fontchooser->size_label, show_size);
gtk_widget_set_visible (fontchooser->size_slider, show_size);
gtk_widget_set_visible (fontchooser->size_spin, show_size);
gtk_widget_set_visible (fontchooser->size_label2, show_size);
gtk_widget_set_visible (fontchooser->size_slider2, show_size);
gtk_widget_set_visible (fontchooser->size_spin2, show_size);
update_fontlist (fontchooser);

View File

@ -628,10 +628,9 @@ update_font_info (GtkFontDialogButton *self)
gtk_label_set_text (GTK_LABEL (self->size_label), size);
g_free (size);
gtk_widget_show (self->font_size_box);
}
else
gtk_widget_hide (self->font_size_box);
gtk_widget_set_visible (self->font_size_box, self->level >= GTK_FONT_LEVEL_FONT);
}
static void

View File

@ -2279,7 +2279,7 @@ gtk_list_box_update_header (GtkListBox *box,
g_hash_table_insert (box->header_hash, new_header, row);
gtk_widget_unparent (new_header);
gtk_widget_set_parent (new_header, GTK_WIDGET (box));
gtk_widget_show (new_header);
gtk_widget_set_visible (new_header, TRUE);
}
gtk_widget_queue_resize (GTK_WIDGET (box));
}
@ -3647,7 +3647,7 @@ gtk_list_box_bound_model_changed (GListModel *list,
if (g_object_is_floating (widget))
g_object_ref_sink (widget);
gtk_widget_show (widget);
gtk_widget_set_visible (widget, TRUE);
gtk_list_box_insert (box, widget, position + i);
g_object_unref (widget);

View File

@ -283,7 +283,7 @@ gtk_menu_button_state_flags_changed (GtkWidget *widget,
if (!gtk_widget_is_sensitive (widget))
{
if (self->popover)
gtk_widget_hide (self->popover);
gtk_widget_set_visible (self->popover, FALSE);
}
}
@ -572,10 +572,7 @@ set_arrow_type (GtkWidget *arrow,
break;
}
if (visible)
gtk_widget_show (arrow);
else
gtk_widget_hide (arrow);
gtk_widget_set_visible (arrow, visible);
}
static void
@ -917,8 +914,7 @@ gtk_menu_button_set_popover (GtkMenuButton *menu_button,
if (menu_button->popover)
{
if (gtk_widget_get_visible (menu_button->popover))
gtk_widget_hide (menu_button->popover);
gtk_widget_set_visible (menu_button->popover, FALSE);
g_signal_handlers_disconnect_by_func (menu_button->popover,
menu_deactivate_cb,

View File

@ -201,7 +201,7 @@ gtk_popover_item_activate (GtkWidget *button,
if (popover != NULL)
{
gtk_widget_hide (popover);
gtk_widget_set_visible (popover, FALSE);
g_object_unref (popover);
}
}

View File

@ -232,14 +232,14 @@ gtk_message_dialog_set_property (GObject *object,
{
priv->has_secondary_text = TRUE;
gtk_widget_add_css_class (priv->label, "title");
gtk_widget_show (priv->secondary_label);
}
else
{
priv->has_secondary_text = FALSE;
gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
gtk_widget_set_visible (priv->secondary_label, priv->has_secondary_text);
}
break;
case PROP_SECONDARY_USE_MARKUP:
@ -329,10 +329,9 @@ gtk_message_dialog_constructed (GObject *object)
GtkWidget *label;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (box);
gtk_widget_set_size_request (box, -1, 16);
label = gtk_label_new ("");
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
gtk_widget_set_margin_top (label, 6);
gtk_widget_set_margin_bottom (label, 6);
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
@ -655,7 +654,6 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
msg = g_strdup_vprintf (message_format, args);
va_end (args);
gtk_widget_show (priv->secondary_label);
gtk_label_set_text (GTK_LABEL (priv->secondary_label), msg);
g_free (msg);
@ -664,8 +662,9 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
{
priv->has_secondary_text = FALSE;
gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
gtk_widget_set_visible (priv->secondary_label, priv->has_secondary_text);
}
/**
@ -714,7 +713,6 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
msg = g_strdup_vprintf (message_format, args);
va_end (args);
gtk_widget_show (priv->secondary_label);
gtk_label_set_markup (GTK_LABEL (priv->secondary_label), msg);
g_free (msg);
@ -723,8 +721,9 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
{
priv->has_secondary_text = FALSE;
gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
gtk_widget_set_visible (priv->secondary_label, priv->has_secondary_text);
}
/**

View File

@ -760,9 +760,9 @@ gtk_model_button_set_iconic (GtkModelButton *self,
self->iconic = iconic;
widget_node = gtk_widget_get_css_node (widget);
gtk_widget_set_visible (self->start_box, !iconic);
if (iconic)
{
gtk_widget_hide (self->start_box);
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("button"));
gtk_widget_add_css_class (widget, "model");
gtk_widget_add_css_class (widget, "image-button");
@ -770,7 +770,6 @@ gtk_model_button_set_iconic (GtkModelButton *self,
}
else
{
gtk_widget_show (self->start_box);
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("modelbutton"));
gtk_widget_remove_css_class (widget, "model");
gtk_widget_remove_css_class (widget, "image-button");

View File

@ -816,7 +816,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
else if (priv->display)
gtk_window_set_display (GTK_WINDOW (dialog), priv->display);
gtk_widget_show (GTK_WIDGET (dialog));
gtk_window_present (GTK_WINDOW (dialog));
g_object_ref (operation);
}
@ -1655,9 +1655,7 @@ gtk_mount_operation_show_processes_do_gtk (GtkMountOperation *op,
processes);
if (dialog != NULL)
{
gtk_widget_show (dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}

View File

@ -1473,7 +1473,7 @@ gtk_notebook_init (GtkNotebook *notebook)
"css-name", "header",
NULL);
gtk_widget_add_css_class (notebook->header_widget, "top");
gtk_widget_hide (notebook->header_widget);
gtk_widget_set_visible (notebook->header_widget, FALSE);
gtk_widget_set_parent (notebook->header_widget, GTK_WIDGET (notebook));
notebook->tabs_widget = gtk_gizmo_new_with_role ("tabs",
@ -2169,7 +2169,7 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
vis_pages++;
if (!gtk_widget_get_visible (page->tab_label))
gtk_widget_show (page->tab_label);
gtk_widget_set_visible (page->tab_label, TRUE);
gtk_widget_measure (page->tab_widget,
GTK_ORIENTATION_HORIZONTAL,
@ -2200,7 +2200,7 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
}
}
else if (gtk_widget_get_visible (page->tab_label))
gtk_widget_hide (page->tab_label);
gtk_widget_set_visible (page->tab_label, FALSE);
}
children = notebook->children;
@ -4070,10 +4070,8 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
if (page->tab_label)
{
if (notebook->show_tabs && gtk_widget_get_visible (page->child))
gtk_widget_show (page->tab_label);
else
gtk_widget_hide (page->tab_label);
gtk_widget_set_visible (page->tab_label,
notebook->show_tabs && gtk_widget_get_visible (page->child));
page->mnemonic_activate_signal =
g_signal_connect (page->tab_label,
@ -5606,7 +5604,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook,
g_signal_connect (menu_item, "clicked",
G_CALLBACK (gtk_notebook_menu_switch_page), page);
if (!gtk_widget_get_visible (page->child))
gtk_widget_hide (menu_item);
gtk_widget_set_visible (menu_item, FALSE);
}
static void
@ -6164,16 +6162,14 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
page->tab_label = NULL;
}
else
gtk_widget_hide (page->tab_label);
gtk_widget_set_visible (page->tab_label, FALSE);
}
gtk_widget_hide (notebook->header_widget);
}
else
{
gtk_notebook_update_labels (notebook);
gtk_widget_show (notebook->header_widget);
}
gtk_widget_set_visible (notebook->header_widget, show_tabs);
for (i = 0; i < N_ACTION_WIDGETS; i++)
{
@ -6557,7 +6553,7 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
if (notebook->show_tabs && gtk_widget_get_visible (child))
{
gtk_widget_show (page->tab_label);
gtk_widget_set_visible (page->tab_label, TRUE);
gtk_widget_queue_resize (GTK_WIDGET (notebook));
}

View File

@ -123,13 +123,10 @@ caps_lock_state_changed (GdkDevice *device,
{
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
if (gtk_editable_get_editable (GTK_EDITABLE (entry)) &&
gtk_widget_set_visible (entry->icon, gtk_editable_get_editable (GTK_EDITABLE (entry)) &&
gtk_widget_has_focus (entry->entry) &&
!gtk_text_get_visibility (GTK_TEXT (entry->entry)) &&
gdk_device_get_caps_lock_state (device))
gtk_widget_show (entry->icon);
else
gtk_widget_hide (entry->icon);
gdk_device_get_caps_lock_state (device));
}
static void

View File

@ -642,7 +642,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
-1);
gtk_widget_set_child_visible (path_bar->up_slider_button, TRUE);
gtk_widget_show (path_bar->up_slider_button);
gtk_widget_set_visible (path_bar->up_slider_button, TRUE);
if (direction == GTK_TEXT_DIR_LTR)
down_slider_offset += path_bar->slider_width;
@ -662,7 +662,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
-1);
gtk_widget_set_child_visible (path_bar->down_slider_button, TRUE);
gtk_widget_show (path_bar->down_slider_button);
gtk_widget_set_visible (path_bar->down_slider_button, TRUE);
gtk_path_bar_update_slider_buttons (path_bar);
}
else

View File

@ -1458,7 +1458,7 @@ update_places (GtkPlacesSidebar *sidebar)
g_object_unref (start_icon);
}
gtk_widget_show (GTK_WIDGET (sidebar));
gtk_widget_set_visible (GTK_WIDGET (sidebar), TRUE);
/* We want this hidden by default, but need to do it after the show_all call */
gtk_sidebar_row_hide (GTK_SIDEBAR_ROW (sidebar->new_bookmark_row), TRUE);
@ -1607,7 +1607,7 @@ stop_drop_feedback (GtkPlacesSidebar *sidebar)
if (sidebar->drag_row != NULL)
{
gtk_widget_show (sidebar->drag_row);
gtk_widget_set_visible (sidebar->drag_row, TRUE);
sidebar->drag_row = NULL;
}
@ -3503,7 +3503,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 (gtk_sidebar_row_clone (GTK_SIDEBAR_ROW (sidebar->drag_row)));
sidebar->drag_row_height = allocation.height;

View File

@ -870,20 +870,20 @@ update_network_state (GtkPlacesView *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);
}
}
@ -1630,7 +1630,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 *
@ -1956,7 +1956,7 @@ on_recent_servers_listbox_row_activated (GtkPlacesView *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

View File

@ -2289,7 +2289,7 @@ gtk_popover_popup (GtkPopover *popover)
{
g_return_if_fail (GTK_IS_POPOVER (popover));
gtk_widget_show (GTK_WIDGET (popover));
gtk_widget_set_visible (GTK_WIDGET (popover), TRUE);
}
static void
@ -2308,7 +2308,7 @@ cascade_popdown (GtkPopover *popover)
if (GTK_IS_POPOVER (parent))
{
if (gtk_popover_get_cascade_popdown (GTK_POPOVER (parent)))
gtk_widget_hide (parent);
gtk_widget_set_visible (parent, FALSE);
else
break;
}
@ -2331,7 +2331,7 @@ gtk_popover_popdown (GtkPopover *popover)
{
g_return_if_fail (GTK_IS_POPOVER (popover));
gtk_widget_hide (GTK_WIDGET (popover));
gtk_widget_set_visible (GTK_WIDGET (popover), FALSE);
cascade_popdown (popover);
}

View File

@ -210,7 +210,7 @@ gtk_popover_menu_close_submenus (GtkPopoverMenu *menu)
if (submenu)
{
gtk_popover_menu_close_submenus (GTK_POPOVER_MENU (submenu));
gtk_widget_hide (submenu);
gtk_widget_set_visible (submenu, FALSE);
gtk_popover_menu_set_open_submenu (menu, NULL);
}
}

View File

@ -733,7 +733,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (password_dialog_response), backend);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
}
void

View File

@ -949,7 +949,6 @@ construct_widgets (GtkPrinterOptionWidget *widget)
priv->combo = gtk_drop_down_new_from_strings (strings);
gtk_drop_down_set_selected (GTK_DROP_DOWN (priv->combo), 0);
gtk_widget_set_sensitive (GTK_WIDGET (widget), FALSE);
gtk_widget_show (priv->combo);
gtk_box_append (GTK_BOX (widget), priv->combo);
}
else switch (source->type)
@ -957,7 +956,6 @@ construct_widgets (GtkPrinterOptionWidget *widget)
case GTK_PRINTER_OPTION_TYPE_BOOLEAN:
priv->check = gtk_check_button_new_with_mnemonic (source->display_text);
g_signal_connect (priv->check, "toggled", G_CALLBACK (check_toggled_cb), widget);
gtk_widget_show (priv->check);
gtk_box_append (GTK_BOX (widget), priv->check);
break;
case GTK_PRINTER_OPTION_TYPE_PICKONE:
@ -986,7 +984,6 @@ construct_widgets (GtkPrinterOptionWidget *widget)
combo_box_append (priv->combo,
source->choices_display[i],
source->choices[i]);
gtk_widget_show (priv->combo);
gtk_box_append (GTK_BOX (widget), priv->combo);
if (GTK_IS_DROP_DOWN (priv->combo))
g_signal_connect (priv->combo, "notify::selected", G_CALLBACK (combo_changed_cb),widget);
@ -996,14 +993,12 @@ construct_widgets (GtkPrinterOptionWidget *widget)
text = g_strdup_printf ("%s:", source->display_text);
priv->label = gtk_label_new_with_mnemonic (text);
g_free (text);
gtk_widget_show (priv->label);
break;
case GTK_PRINTER_OPTION_TYPE_ALTERNATIVE:
group = NULL;
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_set_valign (priv->box, GTK_ALIGN_BASELINE);
gtk_widget_show (priv->box);
gtk_box_append (GTK_BOX (widget), priv->box);
for (i = 0; i < source->num_choices; i++)
{
@ -1023,7 +1018,6 @@ construct_widgets (GtkPrinterOptionWidget *widget)
priv->label = gtk_label_new_with_mnemonic (text);
gtk_widget_set_valign (priv->label, GTK_ALIGN_BASELINE);
g_free (text);
gtk_widget_show (priv->label);
}
break;
@ -1031,27 +1025,23 @@ construct_widgets (GtkPrinterOptionWidget *widget)
priv->entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (priv->entry),
gtk_printer_option_get_activates_default (source));
gtk_widget_show (priv->entry);
gtk_box_append (GTK_BOX (widget), priv->entry);
g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), widget);
text = g_strdup_printf ("%s:", source->display_text);
priv->label = gtk_label_new_with_mnemonic (text);
g_free (text);
gtk_widget_show (priv->label);
break;
case GTK_PRINTER_OPTION_TYPE_FILESAVE:
priv->button = gtk_button_new ();
gtk_widget_show (priv->button);
gtk_box_append (GTK_BOX (widget), priv->button);
g_signal_connect (priv->button, "clicked", G_CALLBACK (filesave_choose_cb), widget);
text = g_strdup_printf ("%s:", source->display_text);
priv->label = gtk_label_new_with_mnemonic (text);
g_free (text);
gtk_widget_show (priv->label);
break;
@ -1123,7 +1113,7 @@ update_widgets (GtkPrinterOptionWidget *widget)
if (source == NULL)
{
gtk_widget_hide (priv->image);
gtk_widget_set_visible (priv->image, FALSE);
return;
}
@ -1190,10 +1180,7 @@ update_widgets (GtkPrinterOptionWidget *widget)
break;
}
if (source->has_conflict)
gtk_widget_show (priv->image);
else
gtk_widget_hide (priv->image);
gtk_widget_set_visible (priv->image, source->has_conflict);
}
gboolean

View File

@ -1416,8 +1416,8 @@ pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
gtk_window_set_modal (GTK_WINDOW (plug), TRUE);
op_win32->embed_widget = plug;
gtk_box_append (GTK_BOX (plug), op->priv->custom_widget);
gtk_widget_show (op->priv->custom_widget);
gtk_widget_show (plug);
gtk_widget_set_visible (op->priv->custom_widget, TRUE);
gtk_widget_set_visible (plug, TRUE);
/* This dialog is modal, so we grab the embed widget */
gtk_grab_add (plug);

View File

@ -2797,7 +2797,7 @@ handle_progress_response (GtkWidget *dialog,
{
GtkPrintOperation *op = (GtkPrintOperation *)data;
gtk_widget_hide (dialog);
gtk_widget_set_visible (dialog, FALSE);
gtk_print_operation_cancel (op);
}
@ -2898,7 +2898,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_signal_connect (error_dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (error_dialog);
gtk_window_present (GTK_WINDOW (error_dialog));
print_pages_idle_done (data);
@ -3024,7 +3024,7 @@ gtk_print_operation_get_error (GtkPrintOperation *op,
* error->message);
* g_signal_connect (error_dialog, "response",
* G_CALLBACK (gtk_window_destroy), NULL);
* gtk_widget_show (error_dialog);
* gtk_window_present (GTK_WINDOW (error_dialog));
* g_error_free (error);
* }
* else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)

View File

@ -1235,7 +1235,6 @@ wrap_in_frame (const char *label,
label_widget = gtk_label_new (NULL);
gtk_widget_set_halign (label_widget, GTK_ALIGN_START);
gtk_widget_set_valign (label_widget, GTK_ALIGN_CENTER);
gtk_widget_show (label_widget);
bold_text = g_markup_printf_escaped ("<b>%s</b>", label);
gtk_label_set_markup (GTK_LABEL (label_widget), bold_text);
@ -1274,7 +1273,6 @@ add_option_to_extension_point (GtkPrinterOption *option,
GtkWidget *widget;
widget = gtk_printer_option_widget_new (option);
gtk_widget_show (widget);
if (gtk_printer_option_widget_has_external_label (GTK_PRINTER_OPTION_WIDGET (widget)))
{
@ -1283,7 +1281,7 @@ add_option_to_extension_point (GtkPrinterOption *option,
gtk_widget_set_valign (widget, GTK_ALIGN_BASELINE);
label = gtk_printer_option_widget_get_external_label (GTK_PRINTER_OPTION_WIDGET (widget));
gtk_widget_show (label);
gtk_widget_set_visible (label, TRUE);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
@ -1292,7 +1290,6 @@ add_option_to_extension_point (GtkPrinterOption *option,
gtk_widget_set_valign (hbox, GTK_ALIGN_BASELINE);
gtk_box_append (GTK_BOX (hbox), label);
gtk_box_append (GTK_BOX (hbox), widget);
gtk_widget_show (hbox);
gtk_box_append (GTK_BOX (extension_point), hbox);
}
@ -1346,12 +1343,11 @@ add_option_to_table (GtkPrinterOption *option,
row = grid_rows (table);
widget = gtk_printer_option_widget_new (option);
gtk_widget_show (widget);
if (gtk_printer_option_widget_has_external_label (GTK_PRINTER_OPTION_WIDGET (widget)))
{
label = gtk_printer_option_widget_get_external_label (GTK_PRINTER_OPTION_WIDGET (widget));
gtk_widget_show (label);
gtk_widget_set_visible (label, TRUE);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
@ -1377,10 +1373,7 @@ setup_page_table (GtkPrinterOptionSet *options,
table);
nrows = grid_rows (GTK_GRID (table));
if (nrows == 0)
gtk_widget_hide (page);
else
gtk_widget_show (page);
gtk_widget_set_visible (page, nrows > 0);
}
static void
@ -1471,11 +1464,11 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
if (dialog->current_printer == NULL)
{
clear_per_printer_ui (dialog);
gtk_widget_hide (dialog->job_page);
gtk_widget_hide (dialog->advanced_page);
gtk_widget_hide (dialog->image_quality_page);
gtk_widget_hide (dialog->finishing_page);
gtk_widget_hide (dialog->color_page);
gtk_widget_set_visible (dialog->job_page, FALSE);
gtk_widget_set_visible (dialog->advanced_page, FALSE);
gtk_widget_set_visible (dialog->image_quality_page, FALSE);
gtk_widget_set_visible (dialog->finishing_page, FALSE);
gtk_widget_set_visible (dialog->color_page, FALSE);
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
return;
@ -1495,10 +1488,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
has_job |= setup_option (dialog, "gtk-cover-after", dialog->cover_after);
has_job |= setup_print_at (dialog);
if (has_job)
gtk_widget_show (dialog->job_page);
else
gtk_widget_hide (dialog->job_page);
gtk_widget_set_visible (dialog->job_page, has_job);
setup_page_table (dialog->options,
"ImageQualityPage",
@ -1567,10 +1557,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
}
}
if (has_advanced)
gtk_widget_show (dialog->advanced_page);
else
gtk_widget_hide (dialog->advanced_page);
gtk_widget_set_visible (dialog->advanced_page, has_advanced);
g_list_free_full (groups, g_free);
}
@ -1762,10 +1749,7 @@ mark_conflicts (GtkPrintUnixDialog *dialog)
g_signal_handler_unblock (dialog->options, dialog->options_changed_handler);
}
if (have_conflict)
gtk_widget_show (dialog->conflicts_widget);
else
gtk_widget_hide (dialog->conflicts_widget);
gtk_widget_set_visible (dialog->conflicts_widget, have_conflict);
}
static gboolean
@ -3377,8 +3361,8 @@ gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog,
{
gtk_notebook_insert_page (GTK_NOTEBOOK (dialog->notebook),
child, tab_label, 2);
gtk_widget_show (child);
gtk_widget_show (tab_label);
gtk_widget_set_visible (child, TRUE);
gtk_widget_set_visible (tab_label, TRUE);
}
/**
@ -3449,16 +3433,8 @@ gtk_print_unix_dialog_set_support_selection (GtkPrintUnixDialog *dialog,
if (dialog->selection_radio)
{
if (support_selection)
{
gtk_widget_set_sensitive (dialog->selection_radio, dialog->has_selection);
gtk_widget_show (dialog->selection_radio);
}
else
{
gtk_widget_set_sensitive (dialog->selection_radio, FALSE);
gtk_widget_hide (dialog->selection_radio);
}
gtk_widget_set_visible (dialog->selection_radio, support_selection);
gtk_widget_set_sensitive (dialog->selection_radio, support_selection && dialog->has_selection);
}
g_object_notify (G_OBJECT (dialog), "support-selection");

View File

@ -2348,10 +2348,7 @@ gtk_range_adjustment_changed (GtkAdjustment *adjustment,
double upper = gtk_adjustment_get_upper (priv->adjustment);
double lower = gtk_adjustment_get_lower (priv->adjustment);
if (upper == lower && GTK_IS_SCALE (range))
gtk_widget_hide (priv->slider_widget);
else
gtk_widget_show (priv->slider_widget);
gtk_widget_set_visible (priv->slider_widget, upper != lower || !GTK_IS_SCALE (range));
gtk_widget_queue_allocate (priv->trough_widget);

View File

@ -360,7 +360,7 @@ gtk_search_bar_init (GtkSearchBar *bar)
gtk_widget_set_valign (bar->close_button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (bar->close_button, "close");
gtk_center_box_set_end_widget (GTK_CENTER_BOX (bar->box_center), bar->close_button);
gtk_widget_hide (bar->close_button);
gtk_widget_set_visible (bar->close_button, FALSE);
gtk_revealer_set_child (GTK_REVEALER (bar->revealer), bar->box_center);

View File

@ -402,7 +402,7 @@ gtk_shortcuts_section_init (GtkShortcutsSection *self)
gtk_widget_remove_css_class (GTK_WIDGET (self->switcher), "linked");
self->show_all = gtk_button_new_with_mnemonic (_("_Show All"));
gtk_widget_hide (self->show_all);
gtk_widget_set_visible (self->show_all, FALSE);
g_signal_connect_swapped (self->show_all, "clicked",
G_CALLBACK (gtk_shortcuts_section_show_all), self);

View File

@ -285,15 +285,9 @@ gtk_shortcuts_shortcut_set_icon (GtkShortcutsShortcut *self,
static void
update_visible_from_direction (GtkShortcutsShortcut *self)
{
if (self->direction == GTK_TEXT_DIR_NONE ||
self->direction == gtk_widget_get_direction (GTK_WIDGET (self)))
{
gtk_widget_show (GTK_WIDGET (self));
}
else
{
gtk_widget_hide (GTK_WIDGET (self));
}
gtk_widget_set_visible (GTK_WIDGET (self),
self->direction == GTK_TEXT_DIR_NONE ||
self->direction == gtk_widget_get_direction (GTK_WIDGET (self)));
}
static void

View File

@ -242,13 +242,12 @@ 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);
}
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, object != NULL);
break;
}
@ -266,10 +265,7 @@ 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);
else
gtk_widget_hide (self->eject_button);
gtk_widget_set_visible (self->eject_button, self->ejectable);
break;
case PROP_ORDER_INDEX:
@ -369,13 +365,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 (GTK_SIDEBAR_ROW (user_data)));
gtk_widget_set_visible (GTK_WIDGET (GTK_SIDEBAR_ROW (user_data)), FALSE);
}
void
gtk_sidebar_row_reveal (GtkSidebarRow *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);
}

View File

@ -120,7 +120,7 @@
* button = gtk_spin_button_new (adjustment, 1.0, 0);
* gtk_window_set_child (GTK_WINDOW (window), button);
*
* gtk_widget_show (window);
* gtk_window_present (GTK_WINDOW (window));
* }
* ```
*
@ -151,7 +151,7 @@
* button = gtk_spin_button_new (adjustment, 0.001, 3);
* gtk_window_set_child (GTK_WINDOW (window), button);
*
* gtk_widget_show (window);
* gtk_window_present (GTK_WINDOW (window));
* }
* ```
*

View File

@ -2030,7 +2030,7 @@ gtk_text_ensure_magnifier (GtkText *self)
gtk_widget_add_css_class (priv->magnifier_popover, "magnifier");
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
gtk_popover_set_child (GTK_POPOVER (priv->magnifier_popover), priv->magnifier);
gtk_widget_show (priv->magnifier);
gtk_widget_set_visible (priv->magnifier, TRUE);
}
static void
@ -2266,7 +2266,7 @@ gtk_text_move_handle (GtkText *self,
/* Hide the handle if it's not being manipulated
* and fell outside of the visible text area.
*/
gtk_widget_hide (GTK_WIDGET (handle));
gtk_widget_set_visible (GTK_WIDGET (handle), FALSE);
}
else
{
@ -2279,7 +2279,7 @@ gtk_text_move_handle (GtkText *self,
gtk_text_handle_set_position (handle, &rect);
gtk_widget_set_direction (GTK_WIDGET (handle), priv->resolved_dir);
gtk_widget_show (GTK_WIDGET (handle));
gtk_widget_set_visible (GTK_WIDGET (handle), TRUE);
}
}
@ -2317,9 +2317,9 @@ gtk_text_update_handles (GtkText *self)
if (!priv->text_handles_enabled)
{
if (priv->text_handles[TEXT_HANDLE_CURSOR])
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]));
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]), FALSE);
if (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND])
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]));
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]), FALSE);
}
else
{
@ -2358,7 +2358,7 @@ gtk_text_update_handles (GtkText *self)
}
else
{
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]));
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]), FALSE);
gtk_text_handle_set_role (priv->text_handles[TEXT_HANDLE_CURSOR],
GTK_TEXT_HANDLE_ROLE_CURSOR);
gtk_text_move_handle (self,
@ -5942,7 +5942,7 @@ hide_selection_bubble (GtkText *self)
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->selection_bubble && gtk_widget_get_visible (priv->selection_bubble))
gtk_widget_hide (priv->selection_bubble);
gtk_widget_set_visible (priv->selection_bubble, FALSE);
}
static void
@ -6175,11 +6175,9 @@ append_bubble_item (GtkText *self,
item = gtk_button_new ();
gtk_widget_set_focus_on_click (item, FALSE);
image = gtk_image_new_from_icon_name (icon_name);
gtk_widget_show (image);
gtk_button_set_child (GTK_BUTTON (item), image);
gtk_widget_add_css_class (item, "image-button");
gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
gtk_widget_show (GTK_WIDGET (item));
gtk_box_append (GTK_BOX (toolbar), item);
}
@ -6224,7 +6222,6 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
gtk_widget_set_margin_end (box, 10);
gtk_widget_set_margin_top (box, 10);
gtk_widget_set_margin_bottom (box, 10);
gtk_widget_show (box);
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (toolbar, "linked");
gtk_popover_set_child (GTK_POPOVER (priv->selection_bubble), box);
@ -6279,7 +6276,7 @@ gtk_text_selection_bubble_popup_unset (GtkText *self)
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->selection_bubble)
gtk_widget_hide (priv->selection_bubble);
gtk_widget_set_visible (priv->selection_bubble, FALSE);
if (priv->selection_bubble_timeout_id)
{

View File

@ -2041,7 +2041,7 @@ _gtk_text_view_ensure_magnifier (GtkTextView *text_view)
gtk_widget_add_css_class (priv->magnifier_popover, "magnifier");
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
gtk_popover_set_child (GTK_POPOVER (priv->magnifier_popover), priv->magnifier);
gtk_widget_show (priv->magnifier);
gtk_widget_set_visible (priv->magnifier, TRUE);
}
/**
@ -5204,14 +5204,14 @@ gtk_text_view_set_handle_position (GtkTextView *text_view,
/* Hide the handle if it's not being manipulated
* and fell outside of the visible text area.
*/
gtk_widget_hide (GTK_WIDGET (handle));
gtk_widget_set_visible (GTK_WIDGET (handle), FALSE);
}
else
{
GtkTextDirection dir = GTK_TEXT_DIR_LTR;
GtkTextAttributes attributes = { 0 };
gtk_widget_show (GTK_WIDGET (handle));
gtk_widget_set_visible (GTK_WIDGET (handle), TRUE);
rect.x = CLAMP (x, 0, SCREEN_WIDTH (text_view));
rect.y = CLAMP (y, 0, SCREEN_HEIGHT (text_view));
@ -5406,9 +5406,9 @@ gtk_text_view_update_handles (GtkTextView *text_view)
if (!priv->text_handles_enabled)
{
if (priv->text_handles[TEXT_HANDLE_CURSOR])
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]));
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]), FALSE);
if (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND])
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]));
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]), FALSE);
}
else
{
@ -5423,7 +5423,7 @@ gtk_text_view_update_handles (GtkTextView *text_view)
if (gtk_text_iter_compare (&cursor, &bound) == 0 && priv->editable)
{
/* Cursor mode */
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]));
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]), FALSE);
gtk_text_view_set_handle_position (text_view,
priv->text_handles[TEXT_HANDLE_CURSOR],
@ -5448,8 +5448,8 @@ gtk_text_view_update_handles (GtkTextView *text_view)
}
else
{
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]));
gtk_widget_hide (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]));
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]), FALSE);
gtk_widget_set_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]), FALSE);
}
}
}
@ -7558,7 +7558,7 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
}
if (priv->magnifier_popover)
gtk_widget_hide (priv->magnifier_popover);
gtk_widget_set_visible (priv->magnifier_popover, FALSE);
if (!drag_gesture_get_text_surface_coords (gesture, text_view,
&start_x, &start_y, &x, &y))
@ -7686,7 +7686,7 @@ gtk_text_view_end_selection_drag (GtkTextView *text_view)
}
if (priv->magnifier_popover)
gtk_widget_hide (priv->magnifier_popover);
gtk_widget_set_visible (priv->magnifier_popover, FALSE);
return TRUE;
}
@ -8419,7 +8419,7 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment,
if (gtk_widget_get_realized (GTK_WIDGET (text_view)))
{
if (priv->selection_bubble)
gtk_widget_hide (priv->selection_bubble);
gtk_widget_set_visible (priv->selection_bubble, FALSE);
}
}
@ -8793,7 +8793,7 @@ hide_selection_bubble (GtkTextView *text_view)
GtkTextViewPrivate *priv = text_view->priv;
if (priv->selection_bubble && gtk_widget_get_visible (priv->selection_bubble))
gtk_widget_hide (priv->selection_bubble);
gtk_widget_set_visible (priv->selection_bubble, FALSE);
}
static void
@ -9273,7 +9273,7 @@ gtk_text_view_selection_bubble_popup_show (gpointer user_data)
rect.height += 10;
gtk_popover_set_pointing_to (GTK_POPOVER (priv->selection_bubble), &rect);
gtk_widget_show (priv->selection_bubble);
gtk_widget_set_visible (priv->selection_bubble, TRUE);
return G_SOURCE_REMOVE;
}
@ -9286,7 +9286,7 @@ gtk_text_view_selection_bubble_popup_unset (GtkTextView *text_view)
priv = text_view->priv;
if (priv->selection_bubble)
gtk_widget_hide (priv->selection_bubble);
gtk_widget_set_visible (priv->selection_bubble, FALSE);
if (priv->selection_bubble_timeout_id)
{

View File

@ -105,7 +105,7 @@
* gtk_box_append (GTK_BOX (box), toggle2);
*
* gtk_window_set_child (GTK_WINDOW (window), box);
* gtk_widget_show (window);
* gtk_window_present (GTK_WINDOW (window));
* }
* ```
*/

View File

@ -747,7 +747,7 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
gtk_tooltip_position (tooltip, display, tooltip_widget, device);
gtk_widget_show (GTK_WIDGET (tooltip->window));
gtk_widget_set_visible (GTK_WIDGET (tooltip->window), TRUE);
/* Now a tooltip is visible again on the display, make sure browse
* mode is enabled.
@ -793,7 +793,7 @@ gtk_tooltip_hide_tooltip (GtkTooltip *tooltip)
}
if (tooltip->window)
gtk_widget_hide (tooltip->window);
gtk_widget_set_visible (tooltip->window, FALSE);
}
static int

View File

@ -181,7 +181,7 @@ mapped_changed (GdkSurface *surface,
GtkWidget *widget)
{
if (!gdk_surface_get_mapped (surface))
gtk_widget_hide (widget);
gtk_widget_set_visible (widget, FALSE);
}
static gboolean
@ -430,12 +430,9 @@ gtk_tooltip_window_set_label_markup (GtkTooltipWindow *window,
{
gtk_label_set_markup (GTK_LABEL (window->label), markup);
update_label_width (GTK_LABEL (window->label));
gtk_widget_show (window->label);
}
else
{
gtk_widget_hide (window->label);
}
gtk_widget_set_visible (window->label, markup != NULL);
}
void
@ -446,12 +443,9 @@ gtk_tooltip_window_set_label_text (GtkTooltipWindow *window,
{
gtk_label_set_text (GTK_LABEL (window->label), text);
update_label_width (GTK_LABEL (window->label));
gtk_widget_show (window->label);
}
else
{
gtk_widget_hide (window->label);
}
gtk_widget_set_visible (window->label, text != NULL);
}
void
@ -459,44 +453,27 @@ gtk_tooltip_window_set_image_icon (GtkTooltipWindow *window,
GdkPaintable *paintable)
{
if (paintable != NULL)
{
gtk_image_set_from_paintable (GTK_IMAGE (window->image), paintable);
gtk_widget_show (window->image);
}
else
{
gtk_widget_hide (window->image);
}
gtk_widget_set_visible (window->image, paintable != NULL);
}
void
gtk_tooltip_window_set_image_icon_from_name (GtkTooltipWindow *window,
const char *icon_name)
{
gtk_widget_set_visible (window->image, icon_name != NULL);
if (icon_name)
{
gtk_image_set_from_icon_name (GTK_IMAGE (window->image), icon_name);
gtk_widget_show (window->image);
}
else
{
gtk_widget_hide (window->image);
}
}
void
gtk_tooltip_window_set_image_icon_from_gicon (GtkTooltipWindow *window,
GIcon *gicon)
{
gtk_widget_set_visible (window->image, gicon != NULL);
if (gicon != NULL)
{
gtk_image_set_from_gicon (GTK_IMAGE (window->image), gicon);
gtk_widget_show (window->image);
}
else
{
gtk_widget_hide (window->image);
}
}
void
@ -525,9 +502,9 @@ gtk_tooltip_window_set_custom_widget (GtkTooltipWindow *window,
window->custom_widget = g_object_ref (custom_widget);
gtk_box_append (GTK_BOX (window->box), custom_widget);
gtk_widget_show (custom_widget);
gtk_widget_hide (window->image);
gtk_widget_hide (window->label);
gtk_widget_set_visible (custom_widget, TRUE);
gtk_widget_set_visible (window->image, FALSE);
gtk_widget_set_visible (window->label, FALSE);
}
}

View File

@ -5667,10 +5667,12 @@ gtk_widget_set_visible (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (visible)
gtk_widget_show (widget);
else
gtk_widget_hide (widget);
G_GNUC_END_IGNORE_DEPRECATIONS
}
void

View File

@ -3664,7 +3664,7 @@ gtk_window_close_request (GtkWindow *window)
if (priv->hide_on_close)
{
gtk_widget_hide (GTK_WIDGET (window));
gtk_widget_set_visible (GTK_WIDGET (window), FALSE);
return TRUE;
}
@ -5271,7 +5271,7 @@ gtk_window_present_with_time (GtkWindow *window,
else
{
priv->initial_timestamp = timestamp;
gtk_widget_show (widget);
gtk_widget_set_visible (widget, TRUE);
}
g_assert (priv->surface != NULL);
@ -6148,7 +6148,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
check = gtk_check_button_new_with_label (_("Dont show this message again"));
gtk_widget_set_margin_start (check, 10);
gtk_widget_show (check);
gtk_box_append (GTK_BOX (area), check);
g_object_set_data (G_OBJECT (dialog), "check", check);
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_NO);
@ -6156,7 +6155,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_signal_connect (dialog, "response", G_CALLBACK (warn_response), inspector_window);
g_object_set_data (G_OBJECT (inspector_window), "warning_dialog", dialog);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
G_GNUC_END_IGNORE_DEPRECATIONS
}
@ -6167,7 +6166,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
{
inspector_window = gtk_inspector_window_get (display);
gtk_widget_hide (inspector_window);
gtk_widget_set_visible (inspector_window, FALSE);
}
}

View File

@ -184,7 +184,7 @@ update_window_icon (GtkWindow *window,
{
gtk_image_set_from_paintable (GTK_IMAGE (icon), paintable);
g_object_unref (paintable);
gtk_widget_show (icon);
gtk_widget_set_visible (icon, TRUE);
return TRUE;
}

View File

@ -339,10 +339,7 @@ update_attributes (GtkInspectorA11y *sl)
gtk_column_view_set_model (GTK_COLUMN_VIEW (sl->attributes), GTK_SELECTION_MODEL (selection));
g_object_unref (selection);
if (g_list_model_get_n_items (G_LIST_MODEL (filter_model)) > 0)
gtk_widget_show (sl->attributes);
else
gtk_widget_hide (sl->attributes);
gtk_widget_set_visible (sl->attributes, g_list_model_get_n_items (G_LIST_MODEL (filter_model)) > 0);
}
static void

View File

@ -126,7 +126,7 @@ gtk_inspector_action_editor_init (GtkInspectorActionEditor *r)
gtk_box_append (GTK_BOX (activate), r->activate_button);
r->parameter_entry = gtk_inspector_variant_editor_new (NULL, parameter_changed, r);
gtk_widget_hide (r->parameter_entry);
gtk_widget_set_visible (r->parameter_entry, FALSE);
gtk_box_append (GTK_BOX (activate), r->parameter_entry);
gtk_widget_set_parent (row, GTK_WIDGET (r));
@ -137,7 +137,7 @@ gtk_inspector_action_editor_init (GtkInspectorActionEditor *r)
r->state_entry = gtk_inspector_variant_editor_new (NULL, state_changed, r);
gtk_box_append (GTK_BOX (r->state_editor), r->state_entry);
gtk_widget_set_parent (r->state_editor, GTK_WIDGET (r));
gtk_widget_hide (r->state_editor);
gtk_widget_set_visible (r->state_editor, FALSE);
}
static void
@ -199,26 +199,19 @@ update_widgets (GtkInspectorActionEditor *r)
state = NULL;
gtk_widget_set_sensitive (r->activate_button, r->enabled);
if (r->parameter_type)
{
gtk_inspector_variant_editor_set_type (r->parameter_entry, r->parameter_type);
gtk_widget_show (r->parameter_entry);
gtk_widget_set_sensitive (r->parameter_entry, r->enabled);
}
else
gtk_widget_hide (r->parameter_entry);
gtk_widget_set_visible (r->parameter_entry, r->parameter_type != NULL);
if (r->parameter_type)
gtk_inspector_variant_editor_set_type (r->parameter_entry, r->parameter_type);
gtk_widget_set_visible (r->state_editor, state != NULL);
if (state)
{
if (r->state_type)
g_variant_type_free (r->state_type);
r->state_type = g_variant_type_copy (g_variant_get_type (state));
gtk_inspector_variant_editor_set_value (r->state_entry, state);
gtk_widget_show (r->state_editor);
}
else
gtk_widget_hide (r->state_editor);
if (G_IS_ACTION_GROUP (r->owner))
{

View File

@ -185,7 +185,7 @@ init_app_id (GtkInspectorGeneral *gen)
app = g_application_get_default ();
if (!app)
{
gtk_widget_hide (gen->app_id_frame);
gtk_widget_set_visible (gen->app_id_frame, FALSE);
return;
}
@ -552,7 +552,7 @@ set_path_label (GtkWidget *w,
{
GtkWidget *r;
r = gtk_widget_get_ancestor (w, GTK_TYPE_LIST_BOX_ROW);
gtk_widget_hide (r);
gtk_widget_set_visible (r, FALSE);
}
}
@ -591,7 +591,7 @@ populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
GtkWidget *child;
GtkListBox *list;
gtk_widget_show (gen->display_composited);
gtk_widget_set_visible (gen->display_composited, TRUE);
list = GTK_LIST_BOX (gen->display_box);
children = NULL;
for (child = gtk_widget_get_first_child (GTK_WIDGET (list));

View File

@ -183,7 +183,7 @@ void
gtk_inspector_on_inspect (GtkWidget *button,
GtkInspectorWindow *iw)
{
gtk_widget_hide (GTK_WIDGET (iw));
gtk_widget_set_visible (GTK_WIDGET (iw), FALSE);
g_signal_connect (iw, "event", G_CALLBACK (handle_event), NULL);
}

View File

@ -56,6 +56,7 @@ struct _GtkInspectorMiscInfo
GtkWidget *mnemonic_label;
GtkWidget *request_mode_row;
GtkWidget *request_mode;
GtkWidget *measure_info_row;
GtkWidget *measure_row;
GtkWidget *measure_expand_toggle;
GtkWidget *measure_picture;
@ -244,73 +245,56 @@ show_frame_clock (GtkWidget *button, GtkInspectorMiscInfo *sl)
static void
update_surface (GtkInspectorMiscInfo *sl)
{
gtk_widget_set_visible (sl->surface_row, GTK_IS_NATIVE (sl->object));
if (GTK_IS_NATIVE (sl->object))
{
GObject *obj;
char *tmp;
gtk_widget_show (sl->surface_row);
obj = (GObject *)gtk_native_get_surface (GTK_NATIVE (sl->object));
tmp = g_strdup_printf ("%p", obj);
gtk_label_set_label (GTK_LABEL (sl->surface), tmp);
g_free (tmp);
}
else
{
gtk_widget_hide (sl->surface_row);
}
}
static void
update_renderer (GtkInspectorMiscInfo *sl)
{
gtk_widget_set_visible (sl->renderer_row, GTK_IS_NATIVE (sl->object));
if (GTK_IS_NATIVE (sl->object))
{
GObject *obj;
char *tmp;
gtk_widget_show (sl->renderer_row);
obj = (GObject *)gtk_native_get_surface (GTK_NATIVE (sl->object));
tmp = g_strdup_printf ("%p", obj);
gtk_label_set_label (GTK_LABEL (sl->renderer), tmp);
g_free (tmp);
}
else
{
gtk_widget_hide (sl->renderer_row);
}
}
static void
update_frame_clock (GtkInspectorMiscInfo *sl)
{
gtk_widget_set_visible (sl->frame_clock_row, GTK_IS_ROOT (sl->object));
if (GTK_IS_ROOT (sl->object))
{
GObject *clock;
gtk_widget_show (sl->frame_clock_row);
clock = (GObject *)gtk_widget_get_frame_clock (GTK_WIDGET (sl->object));
gtk_widget_set_sensitive (sl->frame_clock_button, clock != NULL);
if (clock)
{
char *tmp;
tmp = g_strdup_printf ("%p", clock);
char *tmp = g_strdup_printf ("%p", clock);
gtk_label_set_label (GTK_LABEL (sl->frame_clock), tmp);
g_free (tmp);
gtk_widget_set_sensitive (sl->frame_clock_button, TRUE);
}
else
{
gtk_label_set_label (GTK_LABEL (sl->frame_clock), "NULL");
gtk_widget_set_sensitive (sl->frame_clock_button, FALSE);
}
}
else
{
gtk_widget_hide (sl->frame_clock_row);
}
}
static void
@ -379,7 +363,6 @@ update_info (gpointer data)
tmp = g_strdup_printf ("%p (%s)", l->data, g_type_name_from_instance ((GTypeInstance*)l->data));
button = gtk_button_new_with_label (tmp);
g_free (tmp);
gtk_widget_show (button);
gtk_box_append (GTK_BOX (sl->mnemonic_label), button);
g_object_set_data (G_OBJECT (button), "mnemonic-label", l->data);
g_signal_connect (button, "clicked", G_CALLBACK (show_mnemonic_label), sl);
@ -495,28 +478,32 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
sl->object = NULL;
}
gtk_widget_show (GTK_WIDGET (sl));
gtk_widget_set_visible (GTK_WIDGET (sl), TRUE);
sl->object = object;
g_object_weak_ref (G_OBJECT (sl), disconnect_each_other, object);
g_object_weak_ref (object, disconnect_each_other, sl);
gtk_widget_set_visible (sl->refcount_row, G_IS_OBJECT (object));
gtk_widget_set_visible (sl->state_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->direction_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->request_mode_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->allocated_size_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->baseline_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->measure_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->measure_info_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->mnemonic_label_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->tick_callback_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->mapped_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->realized_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->is_toplevel_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->frame_clock_row, GTK_IS_WIDGET (object));
gtk_widget_set_visible (sl->buildable_id_row, GTK_IS_BUILDABLE (object));
gtk_widget_set_visible (sl->framecount_row, GDK_IS_FRAME_CLOCK (object));
gtk_widget_set_visible (sl->framerate_row, GDK_IS_FRAME_CLOCK (object));
if (GTK_IS_WIDGET (object))
{
gtk_widget_show (sl->refcount_row);
gtk_widget_show (sl->state_row);
gtk_widget_show (sl->direction_row);
gtk_widget_show (sl->request_mode_row);
gtk_widget_show (sl->allocated_size_row);
gtk_widget_show (sl->baseline_row);
gtk_widget_show (sl->mnemonic_label_row);
gtk_widget_show (sl->tick_callback_row);
gtk_widget_show (sl->mapped_row);
gtk_widget_show (sl->realized_row);
gtk_widget_show (sl->is_toplevel_row);
gtk_widget_show (sl->is_toplevel_row);
gtk_widget_show (sl->frame_clock_row);
g_signal_connect_object (object, "state-flags-changed", G_CALLBACK (state_flags_changed), sl, 0);
state_flags_changed (GTK_WIDGET (sl->object), 0, sl);
@ -525,40 +512,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
}
else
{
gtk_widget_hide (sl->state_row);
gtk_widget_hide (sl->direction_row);
gtk_widget_hide (sl->request_mode_row);
gtk_widget_hide (sl->measure_row);
gtk_inspector_measure_graph_clear (GTK_INSPECTOR_MEASURE_GRAPH (sl->measure_graph));
gtk_widget_hide (sl->mnemonic_label_row);
gtk_widget_hide (sl->allocated_size_row);
gtk_widget_hide (sl->baseline_row);
gtk_widget_hide (sl->tick_callback_row);
gtk_widget_hide (sl->mapped_row);
gtk_widget_hide (sl->realized_row);
gtk_widget_hide (sl->is_toplevel_row);
gtk_widget_hide (sl->child_visible_row);
gtk_widget_hide (sl->frame_clock_row);
}
if (GTK_IS_BUILDABLE (object))
{
gtk_widget_show (sl->buildable_id_row);
}
else
{
gtk_widget_hide (sl->buildable_id_row);
}
if (GDK_IS_FRAME_CLOCK (object))
{
gtk_widget_show (sl->framecount_row);
gtk_widget_show (sl->framerate_row);
}
else
{
gtk_widget_hide (sl->framecount_row);
gtk_widget_hide (sl->framerate_row);
}
update_info (sl);
@ -635,6 +589,7 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, request_mode_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, request_mode);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_info_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_expand_toggle);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_picture);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_graph);

View File

@ -1090,7 +1090,6 @@ property_editor (GObject *object,
"vscrollbar-policy", GTK_POLICY_NEVER,
NULL);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show (box);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box);
fclass = G_FLAGS_CLASS (g_type_class_ref (spec->value_type));
@ -1101,7 +1100,6 @@ property_editor (GObject *object,
b = gtk_check_button_new_with_label (fclass->values[j].value_nick);
g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j));
gtk_widget_show (b);
gtk_box_append (GTK_BOX (box), b);
connect_controller (G_OBJECT (b), "toggled",
object, spec, G_CALLBACK (flags_modified));
@ -1155,8 +1153,6 @@ property_editor (GObject *object,
self);
gtk_box_append (GTK_BOX (prop_edit), label);
gtk_box_append (GTK_BOX (prop_edit), button);
gtk_widget_show (label);
gtk_widget_show (button);
g_object_connect_property (object, spec,
G_CALLBACK (object_changed),

View File

@ -624,7 +624,7 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
gtk_sort_list_model_set_sorter (sorted, gtk_column_view_get_sorter (GTK_COLUMN_VIEW (pl->priv->list)));
gtk_column_view_sort_by_column (GTK_COLUMN_VIEW (pl->priv->list), pl->priv->name, GTK_SORT_ASCENDING);
gtk_widget_show (GTK_WIDGET (pl));
gtk_widget_set_visible (GTK_WIDGET (pl), TRUE);
g_object_unref (list);

View File

@ -639,16 +639,10 @@ bind_value_widgets (GtkSignalListItemFactory *factory,
label = gtk_widget_get_first_child (box);
picture = gtk_widget_get_next_sibling (label);
gtk_label_set_text (GTK_LABEL (label), property->value);
gtk_widget_set_visible (picture, property->texture != NULL);
if (property->texture)
{
gtk_widget_show (picture);
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (property->texture));
}
else
{
gtk_widget_hide (picture);
}
}
static GskRenderNode *
make_dot (double x, double y)

View File

@ -66,14 +66,12 @@ add_string (GtkInspectorStrvEditor *editor,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box, "linked");
gtk_widget_show (box);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), str);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Value"),
-1);
gtk_widget_show (entry);
gtk_box_append (GTK_BOX (box), entry);
g_object_set_data (G_OBJECT (box), "entry", entry);
g_signal_connect_swapped (entry, "notify::text", G_CALLBACK (emit_changed), editor);
@ -84,7 +82,6 @@ add_string (GtkInspectorStrvEditor *editor,
GTK_ACCESSIBLE_PROPERTY_LABEL,
g_strdup_printf (_("Remove %s"), str),
-1);
gtk_widget_show (button);
gtk_box_append (GTK_BOX (box), button);
g_signal_connect (button, "clicked", G_CALLBACK (remove_string), editor);
@ -108,7 +105,7 @@ gtk_inspector_strv_editor_init (GtkInspectorStrvEditor *editor)
gtk_box_set_spacing (GTK_BOX (editor), 6);
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor), GTK_ORIENTATION_VERTICAL);
editor->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (editor->box);
gtk_widget_set_visible (editor->box, TRUE);
editor->button = gtk_button_new_from_icon_name ("list-add-symbolic");
gtk_widget_add_css_class (editor->button, "image-button");
@ -117,7 +114,6 @@ gtk_inspector_strv_editor_init (GtkInspectorStrvEditor *editor)
gtk_accessible_update_property (GTK_ACCESSIBLE (editor->button),
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Add"),
-1);
gtk_widget_show (editor->button);
g_signal_connect (editor->button, "clicked", G_CALLBACK (add_cb), editor);
gtk_box_append (GTK_BOX (editor), editor->box);

View File

@ -276,8 +276,6 @@ gtk_inspector_window_init (GtkInspectorWindow *iw)
gtk_stack_add_titled (GTK_STACK (iw->top_stack), widget, name, title);
gtk_stack_add_named (GTK_STACK (iw->button_stack), button, name);
gtk_widget_show (widget);
gtk_widget_show (button);
g_free (title);
}
@ -947,7 +945,7 @@ update_go_buttons (GtkInspectorWindow *iw)
update_go_button (iw->go_next_button,
GTK_IS_WIDGET (object) && gtk_widget_get_next_sibling (GTK_WIDGET (object)) != NULL,
"Next sibling");
gtk_widget_hide (iw->list_position_label);
gtk_widget_set_visible (iw->list_position_label, FALSE);
break;
case CHILD_KIND_LISTITEM:
update_go_button (iw->go_down_button, FALSE, NULL);
@ -957,7 +955,7 @@ update_go_buttons (GtkInspectorWindow *iw)
char *text = g_strdup_printf ("%u", position);
gtk_label_set_label (GTK_LABEL (iw->list_position_label), text);
g_free (text);
gtk_widget_show (iw->list_position_label);
gtk_widget_set_visible (iw->list_position_label, TRUE);
}
break;
case CHILD_KIND_PROPERTY:
@ -966,7 +964,7 @@ update_go_buttons (GtkInspectorWindow *iw)
update_go_button (iw->go_down_button, FALSE, NULL);
update_go_button (iw->go_previous_button, FALSE, NULL);
update_go_button (iw->go_next_button, FALSE, NULL);
gtk_widget_hide (iw->list_position_label);
gtk_widget_set_visible (iw->list_position_label, FALSE);
break;
default:
g_assert_not_reached ();