Merge branch 'window-destroy' into 'master'

Drop gtk_widget_destroy

See merge request GNOME/gtk!1864
This commit is contained in:
Matthias Clasen 2020-05-11 17:15:59 +00:00
commit 7ae1d9d796
189 changed files with 1051 additions and 1243 deletions

View File

@ -317,7 +317,7 @@ save_response_cb (GtkNativeDialog *dialog,
"Saving failed");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
g_error_free (error);
}
@ -403,7 +403,7 @@ constraint_editor_done (ConstraintEditor *editor,
g_clear_object (&old_constraint);
gtk_widget_destroy (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW));
gtk_window_destroy (GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW)));
}
static void
@ -444,7 +444,7 @@ guide_editor_done (GuideEditor *editor,
GtkConstraintGuide *guide,
ConstraintEditorWindow *win)
{
gtk_widget_destroy (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW));
gtk_window_destroy (GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW)));
}
static void

View File

@ -47,7 +47,7 @@ show_action_dialog (GSimpleAction *action)
name);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
}
@ -120,7 +120,7 @@ open_response_cb (GtkNativeDialog *dialog,
"Error loading file: \"%s\"",
error->message);
g_signal_connect (message_dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
g_error_free (error);
}
@ -234,7 +234,7 @@ activate_quit (GSimpleAction *action,
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
gtk_window_destroy (GTK_WINDOW (win));
list = next;
}

View File

@ -31,12 +31,7 @@ on_name_vanished (GDBusConnection *connection,
if (!name_seen)
return;
if (placeholder)
{
gtk_widget_destroy (placeholder);
g_object_unref (placeholder);
placeholder = NULL;
}
g_clear_object (&placeholder);
}
#ifdef G_OS_WIN32

View File

@ -26,7 +26,7 @@ apply_changes_gradually (gpointer data)
else
{
/* Close automatically once changes are fully applied. */
gtk_widget_destroy (data);
gtk_window_destroy (GTK_WINDOW (data));
return G_SOURCE_REMOVE;
}
}
@ -41,7 +41,7 @@ on_assistant_apply (GtkWidget *widget, gpointer data)
static void
on_assistant_close_cancel (GtkWidget *widget, gpointer data)
{
gtk_widget_destroy (widget);
gtk_window_destroy (GTK_WINDOW (widget));
}
static void
@ -178,8 +178,7 @@ do_assistant (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (assistant),
gtk_widget_get_display (do_widget));
g_signal_connect (assistant, "destroy",
G_CALLBACK (gtk_widget_destroyed), &assistant);
g_object_add_weak_pointer (G_OBJECT (assistant), (gpointer *)&assistant);
create_page1 (assistant);
create_page2 (assistant);
@ -199,7 +198,7 @@ do_assistant (GtkWidget *do_widget)
if (!gtk_widget_get_visible (assistant))
gtk_widget_show (assistant);
else
gtk_widget_destroy (assistant);
gtk_window_destroy (GTK_WINDOW (assistant));
return assistant;
}

View File

@ -12,7 +12,7 @@ quit_activate (GSimpleAction *action,
{
GtkWidget *window = user_data;
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
}
static void
@ -74,8 +74,7 @@ do_builder (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
actions = (GActionGroup*)g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (actions),
win_entries, G_N_ELEMENTS (win_entries),
@ -88,7 +87,7 @@ do_builder (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -69,7 +69,7 @@ paste_received (GObject *source_object,
"Could not paste text: %s",
error->message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_error_free (error);
@ -108,9 +108,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_start (vbox, 8);
@ -187,7 +185,7 @@ do_clipboard (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -315,9 +315,7 @@ do_combobox (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Combo Boxes");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_widget_set_margin_start (vbox, 10);
@ -450,7 +448,7 @@ do_combobox (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -25,9 +25,9 @@ simple_grid_dispose (GObject *object)
{
SimpleGrid *self = SIMPLE_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
g_clear_pointer (&self->button1, gtk_widget_unparent);
g_clear_pointer (&self->button2, gtk_widget_unparent);
g_clear_pointer (&self->button3, gtk_widget_unparent);
G_OBJECT_CLASS (simple_grid_parent_class)->dispose (object);
}
@ -263,8 +263,7 @@ do_constraints (GtkWidget *do_widget)
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_window_set_child (GTK_WINDOW (window), box);
@ -278,13 +277,13 @@ do_constraints (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy), window);
G_CALLBACK (gtk_window_destroy), window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -26,9 +26,9 @@ interactive_grid_dispose (GObject *object)
{
InteractiveGrid *self = INTERACTIVE_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
g_clear_pointer (&self->button1, gtk_widget_unparent);
g_clear_pointer (&self->button2, gtk_widget_unparent);
g_clear_pointer (&self->button3, gtk_widget_unparent);
G_OBJECT_CLASS (interactive_grid_parent_class)->dispose (object);
}
@ -219,8 +219,7 @@ do_constraints2 (GtkWidget *do_widget)
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_window_set_child (GTK_WINDOW (window), box);
@ -234,13 +233,13 @@ do_constraints2 (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy), window);
G_CALLBACK (gtk_window_destroy), window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -24,9 +24,9 @@ vfl_grid_dispose (GObject *object)
{
VflGrid *self = VFL_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
g_clear_pointer (&self->button1, gtk_widget_unparent);
g_clear_pointer (&self->button2, gtk_widget_unparent);
g_clear_pointer (&self->button3, gtk_widget_unparent);
G_OBJECT_CLASS (vfl_grid_parent_class)->dispose (object);
}
@ -139,8 +139,7 @@ do_constraints3 (GtkWidget *do_widget)
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_window_set_child (GTK_WINDOW (window), box);
@ -154,13 +153,13 @@ do_constraints3 (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy), window);
G_CALLBACK (gtk_window_destroy), window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -28,8 +28,7 @@ do_css_accordion (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
@ -63,7 +62,7 @@ do_css_accordion (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -76,8 +76,7 @@ do_css_basics (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "CSS Basics");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
text = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (text,
@ -113,7 +112,7 @@ do_css_basics (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -125,7 +125,7 @@ do_css_blendmodes (GtkWidget *do_widget)
window = WID ("window");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
/* Setup the CSS provider for window */
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
@ -140,7 +140,7 @@ do_css_blendmodes (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -90,8 +90,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Multiple Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
container = gtk_overlay_new ();
gtk_window_set_child (GTK_WINDOW (window), container);
@ -153,7 +152,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -76,8 +76,7 @@ do_css_pixbufs (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Animated Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_window_set_child (GTK_WINDOW (window), paned);
@ -120,7 +119,7 @@ do_css_pixbufs (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -95,8 +95,7 @@ do_css_shadows (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Shadows");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_window_set_child (GTK_WINDOW (window), paned);
@ -138,7 +137,7 @@ do_css_shadows (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -36,7 +36,7 @@ do_cursors (GtkWidget *do_widget)
gtk_widget_show (window);
else
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
}
return window;

View File

@ -26,7 +26,7 @@ message_dialog_clicked (GtkButton *button,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%d", i);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
i++;
}
@ -89,7 +89,7 @@ interactive_dialog_clicked (GtkButton *button,
gtk_editable_set_text (GTK_EDITABLE (entry2), gtk_editable_get_text (GTK_EDITABLE (local_entry2)));
}
gtk_widget_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
}
GtkWidget *
@ -109,9 +109,7 @@ do_dialog (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Dialogs and Message Boxes");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
frame = gtk_frame_new ("Dialogs");
gtk_widget_set_margin_start (frame, 8);
@ -170,7 +168,7 @@ do_dialog (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -138,7 +138,7 @@ edit_label_done (GtkWidget *entry, gpointer data)
gtk_label_set_text (GTK_LABEL (label), gtk_editable_get_text (GTK_EDITABLE (entry)));
gtk_widget_show (label);
gtk_widget_destroy (entry);
gtk_container_remove (GTK_CONTAINER (canvas), entry);
}
static void
@ -170,7 +170,9 @@ edit_cb (GtkWidget *button, GtkWidget *child)
static void
delete_cb (GtkWidget *button, GtkWidget *child)
{
gtk_widget_destroy (child);
GtkWidget *canvas = gtk_widget_get_parent (child);
gtk_container_remove (GTK_CONTAINER (canvas), child);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
@ -419,7 +421,6 @@ do_dnd (GtkWidget *do_widget)
{
GtkWidget *sw;
GtkWidget *canvas;
GtkWidget *widget;
GtkWidget *box, *box2, *box3;
const char *colors[] = {
"red", "green", "blue", "magenta", "orange", "gray", "black", "yellow",
@ -430,17 +431,14 @@ do_dnd (GtkWidget *do_widget)
int i;
int x, y;
widget = gtk_color_button_new ();
gtk_widget_destroy (widget);
g_type_ensure (GTK_TYPE_COLOR_BUTTON);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Drag-and-Drop");
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
@ -494,7 +492,7 @@ do_dnd (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -260,7 +260,7 @@ do_drawingarea (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -352,8 +352,7 @@ do_editable_cells (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Editable Cells");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 5);
@ -410,7 +409,7 @@ do_editable_cells (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -50,9 +50,7 @@ do_entry_completion (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Entry Completion");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 5);
@ -88,7 +86,7 @@ do_entry_completion (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -25,8 +25,7 @@ do_entry_undo (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Entry Undo");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 5);
@ -49,7 +48,7 @@ do_entry_undo (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -15,7 +15,7 @@ static GtkWidget *window = NULL;
static void
response_cb (GtkDialog *dialog, gint response_id)
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
window = NULL;
}
@ -90,7 +90,7 @@ do_expander (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -125,8 +125,7 @@ do_filtermodel (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
store = (GtkListStore*)gtk_builder_get_object (builder, "liststore1");
@ -199,7 +198,7 @@ do_filtermodel (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -273,15 +273,13 @@ do_fishbowl (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
bowl = GTK_WIDGET (gtk_builder_get_object (builder, "bowl"));
selected_widget_type = -1;
set_widget_type (GTK_FISHBOWL (bowl), 0);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_widget_realize (window);
g_object_unref (builder);
@ -290,7 +288,7 @@ do_fishbowl (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -161,7 +161,7 @@ do_fixed (GtkWidget *do_widget)
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
else
gtk_widget_destroy (demo_window);
gtk_window_destroy (GTK_WINDOW (demo_window));
return demo_window;
}

View File

@ -724,9 +724,7 @@ do_flowbox (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Flow Box");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@ -745,7 +743,7 @@ do_flowbox (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -1025,7 +1025,7 @@ denorm_coord (hb_ot_var_axis_info_t *axis, int coord)
static void
update_font_variations (void)
{
GtkWidget *child, *next;
GtkWidget *child;
PangoFont *pango_font = NULL;
hb_font_t *hb_font;
hb_face_t *hb_face;
@ -1037,12 +1037,8 @@ update_font_variations (void)
int i;
child = gtk_widget_get_first_child (variations_grid);
while (child != NULL)
{
next = gtk_widget_get_next_sibling (child);
gtk_widget_destroy (child);
child = next;
}
while ((child = gtk_widget_get_first_child (variations_grid)))
gtk_container_remove (GTK_CONTAINER (variations_grid), child);
instance_combo = NULL;
@ -1333,8 +1329,7 @@ do_font_features (GtkWidget *do_widget)
font_features_font_changed ();
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_object_unref (builder);
@ -1344,7 +1339,7 @@ do_font_features (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_window_present (GTK_WINDOW (window));
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -281,7 +281,7 @@ do_fontrendering (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -85,7 +85,7 @@ do_gears (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Gears");
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 640);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
overlay = gtk_overlay_new ();
gtk_widget_set_margin_start (overlay, 12);
@ -131,7 +131,7 @@ do_gears (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -149,8 +149,7 @@ do_gestures (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
gtk_window_set_title (GTK_WINDOW (window), "Gestures");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
drawing_area = gtk_drawing_area_new ();
gtk_window_set_child (GTK_WINDOW (window), drawing_area);
@ -210,7 +209,7 @@ do_gestures (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -427,7 +427,7 @@ create_glarea_window (GtkWidget *do_widget)
button = gtk_button_new_with_label ("Quit");
gtk_widget_set_hexpand (button, TRUE);
gtk_container_add (GTK_CONTAINER (box), button);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
return window;
}
@ -441,7 +441,7 @@ do_glarea (GtkWidget *do_widget)
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
else
gtk_widget_destroy (demo_window);
gtk_window_destroy (GTK_WINDOW (demo_window));
return demo_window;
}

View File

@ -25,8 +25,8 @@ do_headerbar (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Welcome to Facebook - Log in, sign up or learn more");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
header = gtk_header_bar_new ();
@ -58,7 +58,7 @@ do_headerbar (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -237,9 +237,7 @@ do_hypertext (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
@ -275,7 +273,7 @@ do_hypertext (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -209,12 +209,10 @@ do_iconscroll (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/iconscroll/iconscroll.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
scrolledwindow = GTK_WIDGET (gtk_builder_get_object (builder, "scrolledwindow"));
gtk_widget_realize (window);
hadjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "hadjustment"));
@ -225,7 +223,7 @@ do_iconscroll (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -228,7 +228,7 @@ home_clicked (GtkButton *item,
static void close_window(void)
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
window = NULL;
g_object_unref (file_pixbuf);
@ -320,7 +320,7 @@ do_iconview (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -111,9 +111,7 @@ do_iconview_edit (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Editing and Drag-and-Drop");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
store = create_store ();
fill_store (store);
@ -152,7 +150,7 @@ do_iconview_edit (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -91,7 +91,7 @@ progressive_timeout (gpointer data)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
@ -119,7 +119,7 @@ progressive_timeout (gpointer data)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
@ -152,7 +152,7 @@ progressive_timeout (gpointer data)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
@ -189,7 +189,7 @@ progressive_timeout (gpointer data)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
@ -223,7 +223,7 @@ progressive_timeout (gpointer data)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
@ -335,9 +335,8 @@ do_images (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Images");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_signal_connect (window, "destroy",
G_CALLBACK (cleanup_callback), NULL);
@ -472,7 +471,7 @@ do_images (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -29,10 +29,8 @@ on_bar_response (GtkInfoBar *info_bar,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"Your response has id %d", response_id);
g_signal_connect_swapped (dialog,
"response",
G_CALLBACK (gtk_widget_destroy),
dialog);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_window_destroy), dialog);
gtk_widget_show (dialog);
}
@ -58,8 +56,7 @@ do_infobar (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Info Bars");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_start (vbox, 8);
@ -149,7 +146,7 @@ do_infobar (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -12,7 +12,7 @@ response_cb (GtkWidget *dialog,
gint response_id,
gpointer data)
{
gtk_widget_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
}
static gboolean
@ -59,8 +59,7 @@ do_links (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Links");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\""
"title=\"plain text\">text</a> may be marked up "
@ -88,7 +87,7 @@ do_links (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -257,9 +257,7 @@ do_list_store (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "List Store");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_set_margin_start (vbox, 8);
@ -309,7 +307,7 @@ do_list_store (GtkWidget *do_widget)
}
else
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
window = NULL;
if (timeout != 0)
{

View File

@ -351,13 +351,8 @@ do_listbox (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "List Box");
gtk_window_set_default_size (GTK_WINDOW (window),
400, 600);
/* NULL window variable when window is closed */
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&window);
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_window_set_child (GTK_WINDOW (window), vbox);
@ -392,7 +387,7 @@ do_listbox (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -101,7 +101,7 @@ activate_quit (GSimpleAction *action,
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
gtk_window_destroy (GTK_WINDOW (win));
list = next;
}

View File

@ -58,8 +58,7 @@ do_markup (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
stack = gtk_stack_new ();
gtk_widget_show (stack);
@ -126,7 +125,7 @@ do_markup (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -43,8 +43,7 @@ do_modelbutton (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
actions = (GActionGroup*)g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (actions),
@ -59,7 +58,7 @@ do_modelbutton (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;

View File

@ -79,15 +79,13 @@ do_overlay (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), entry);
gtk_window_set_child (GTK_WINDOW (window), overlay);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -60,9 +60,7 @@ do_overlay2 (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), overlay);
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
image = gtk_picture_new_for_resource ("/overlay2/decor1.png");
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), image);
@ -97,7 +95,7 @@ do_overlay2 (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -11,7 +11,7 @@
static void
done_cb (GtkDialog *dialog, gint response, gpointer data)
{
gtk_widget_destroy (GTK_WIDGET (dialog));
gtk_window_destroy (GTK_WINDOW (dialog));
}
GtkWidget *
@ -22,14 +22,14 @@ do_pagesetup (GtkWidget *do_widget)
if (!window)
{
window = gtk_page_setup_unix_dialog_new ("Page Setup", GTK_WINDOW (do_widget));
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_signal_connect (window, "response", G_CALLBACK (done_cb), NULL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -405,16 +405,13 @@ do_paint (GtkWidget *toplevel)
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
gtk_window_set_title (GTK_WINDOW (window), "Paint");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -171,7 +171,7 @@ do_paintable (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -203,7 +203,7 @@ do_paintable_animated (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -306,7 +306,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -152,9 +152,7 @@ do_panes (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
@ -204,7 +202,7 @@ do_panes (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -45,8 +45,7 @@ do_password_entry (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Choose a Password");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_set_margin_start (box, 18);
@ -75,7 +74,7 @@ do_password_entry (GtkWidget *do_widget)
button = gtk_button_new_with_mnemonic ("_Done");
gtk_widget_add_css_class (button, "suggested-action");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_widget_set_sensitive (button, FALSE);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
@ -85,7 +84,7 @@ do_password_entry (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -284,8 +284,7 @@ do_peg_solitaire (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Peg Solitaire");
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
grid = gtk_grid_new ();
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
@ -349,7 +348,7 @@ do_peg_solitaire (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -18,9 +18,7 @@ do_pickers (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pickers");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
table = gtk_grid_new ();
gtk_widget_set_margin_start (table, 20);
@ -77,7 +75,7 @@ do_pickers (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -179,9 +179,7 @@ do_pixbufs (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
error = NULL;
if (!load_pixbufs (&error))
@ -198,7 +196,7 @@ do_pixbufs (GtkWidget *do_widget)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
}
@ -222,7 +220,7 @@ do_pixbufs (GtkWidget *do_widget)
gtk_widget_show (window);
else
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
g_object_unref (frame);
}

View File

@ -188,7 +188,7 @@ do_printing (GtkWidget *do_widget)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
}

View File

@ -85,7 +85,7 @@ do_revealer (GtkWidget *do_widget)
}
else
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
}

View File

@ -180,8 +180,7 @@ do_rotated_text (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");
gtk_window_set_default_size (GTK_WINDOW (window), 4 * RADIUS, 2 * RADIUS);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
@ -213,7 +212,7 @@ do_rotated_text (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -21,8 +21,7 @@ do_scale (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_object_unref (builder);
}
@ -30,7 +29,7 @@ do_scale (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;

View File

@ -319,7 +319,7 @@ do_search_entry (GtkWidget *do_widget)
else
{
g_clear_object (&actions);
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
}
return window;

View File

@ -73,9 +73,7 @@ do_search_entry2 (GtkWidget *do_widget)
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_widget_set_size_request (window, 200, -1);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), vbox);
@ -145,7 +143,7 @@ do_search_entry2 (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -56,9 +56,7 @@ do_shortcut_triggers (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Shortcuts");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
list = gtk_list_box_new ();
gtk_widget_set_margin_top (list, 6);
@ -88,7 +86,7 @@ do_shortcut_triggers (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -89,8 +89,7 @@ do_shortcuts (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_object_unref (builder);
}
@ -98,7 +97,7 @@ do_shortcuts (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -43,9 +43,7 @@ do_sidebar (GtkWidget *do_widget)
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR(header), TRUE);
gtk_window_set_titlebar (GTK_WINDOW(window), header);
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
sidebar = gtk_stack_sidebar_new ();
@ -80,7 +78,7 @@ do_sidebar (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -104,8 +104,7 @@ do_sizegroup (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Size Groups");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 5);
@ -161,7 +160,7 @@ do_sizegroup (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -460,8 +460,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Sliding Puzzle");
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
frame = gtk_aspect_frame_new (0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
gtk_window_set_child (GTK_WINDOW (window), frame);
@ -472,7 +471,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -196,8 +196,7 @@ do_spinbutton (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Spin Buttons");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "basic_adjustment"));
label = GTK_WIDGET (gtk_builder_get_object (builder, "basic_label"));
@ -238,7 +237,7 @@ do_spinbutton (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -45,9 +45,8 @@ do_spinner (GtkWidget *do_widget)
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
G_CALLBACK (gtk_window_destroy), NULL);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
@ -93,7 +92,7 @@ do_spinner (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -21,8 +21,7 @@ do_stack (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_object_unref (builder);
}
@ -30,7 +29,7 @@ do_stack (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;

View File

@ -23,9 +23,7 @@ do_tabs (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
@ -53,7 +51,7 @@ do_tabs (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -72,8 +72,7 @@ do_tagged_entry (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "A tagged entry");
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_set_margin_start (box, 18);
@ -99,7 +98,7 @@ do_tagged_entry (GtkWidget *do_widget)
button = gtk_button_new_with_mnemonic ("_Done");
gtk_widget_add_css_class (button, "suggested-action");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
@ -108,7 +107,7 @@ do_tagged_entry (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -63,9 +63,7 @@ do_textmask (GtkWidget *do_widget)
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_widget_set_size_request (window, 400, 200);
gtk_window_set_title (GTK_WINDOW (window), "Text Mask");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
da = gtk_drawing_area_new ();
@ -76,7 +74,7 @@ do_textmask (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -182,8 +182,7 @@ do_textscroll (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Automatic Scrolling");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@ -197,7 +196,7 @@ do_textscroll (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -26,11 +26,8 @@ do_textundo (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_title (GTK_WINDOW (window), "TextView Undo");
@ -63,7 +60,7 @@ do_textundo (GtkWidget *do_widget)
}
else
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
window = NULL;
}

View File

@ -477,11 +477,8 @@ do_textview (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
@ -526,7 +523,7 @@ do_textview (GtkWidget *do_widget)
}
else
{
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
window = NULL;
}

View File

@ -178,12 +178,10 @@ do_themes (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/themes/themes.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
header = GTK_WIDGET (gtk_builder_get_object (builder, "header"));
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked), builder);
@ -195,7 +193,7 @@ do_themes (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -25,8 +25,7 @@ do_theming_style_classes (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
builder = gtk_builder_new_from_resource ("/theming_style_classes/theming.ui");
@ -38,7 +37,7 @@ do_theming_style_classes (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -22,9 +22,7 @@ do_transparent (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
@ -64,7 +62,7 @@ do_transparent (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -394,8 +394,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Tree Store");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_set_margin_start (vbox, 8);
@ -437,7 +436,7 @@ do_tree_store (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -23,7 +23,7 @@ open_dialog_response_cb (GtkWidget *dialog,
g_object_unref (file);
}
gtk_widget_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
@ -67,8 +67,7 @@ do_video_player (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Video Player");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
video = gtk_video_new ();
gtk_window_set_child (GTK_WINDOW (window), video);
@ -89,7 +88,7 @@ do_video_player (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@ -375,7 +375,7 @@ open_response_cb (GtkWidget *dialog,
g_object_unref (file);
}
gtk_widget_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
@ -441,7 +441,7 @@ save_response_cb (GtkWidget *dialog,
"Saving failed");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
g_error_free (error);
}
@ -450,7 +450,7 @@ save_response_cb (GtkWidget *dialog,
g_object_unref (file);
}
gtk_widget_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
@ -558,14 +558,14 @@ export_image_response_cb (GtkWidget *dialog,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Exporting to image failed");
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
}
g_object_unref (file);
}
gtk_widget_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (texture);
}

View File

@ -311,7 +311,7 @@ activate_quit (GSimpleAction *action,
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
gtk_window_destroy (GTK_WINDOW (win));
list = next;
}

View File

@ -194,12 +194,13 @@
a g_signal_connect() with the difference lying in how the callback function is
treated. g_signal_connect_swapped() allows you to specify what the callback
function should take as parameter by letting you pass it as data. In this case
the function being called back is gtk_widget_destroy() and the
<varname>window</varname> pointer is passed to it. This has the effect that when
the button is clicked, the whole GTK window is destroyed. In contrast, if a normal
g_signal_connect() were used to connect the "clicked" signal with
gtk_widget_destroy(), then the <varname>button</varname> itself would have been
destroyed, not the window. More information about creating buttons can be found
the function being called back is gtk_window_destroy() and the <varname>window</varname>
pointer is passed to it. This has the effect that when the button is clicked,
the whole GTK window is destroyed. In contrast if a normal g_signal_connect() were used
to connect the "clicked" signal with gtk_window_destroy(), then the function
would be called on <varname>button</varname> (which would not go well, since
the function expects a GtkWindow as argument).
More information about creating buttons can be found
<ulink url="https://wiki.gnome.org/HowDoI/Buttons">here</ulink>.
</para>

View File

@ -3955,9 +3955,7 @@ GtkCallback
GtkRequisition
GtkAllocation
gtk_widget_new
gtk_widget_destroy
gtk_widget_in_destruction
gtk_widget_destroyed
gtk_widget_unparent
gtk_widget_show
gtk_widget_hide
@ -4191,6 +4189,7 @@ gtk_requisition_get_type
GtkWindow
GtkWindowClass
gtk_window_new
gtk_window_destroy
gtk_window_get_child
gtk_window_set_child
gtk_window_set_title
@ -4246,7 +4245,6 @@ gtk_window_get_focus_visible
gtk_window_set_focus_visible
gtk_window_get_application
gtk_window_set_application
gtk_window_set_has_user_ref_count
gtk_window_set_titlebar
gtk_window_get_titlebar
gtk_window_set_interactive_debugging

View File

@ -123,8 +123,8 @@ after creating it ?
<para>
If <structname>GtkFoo</structname> isn't a toplevel window, then
<informalexample><programlisting>
foo = gtk_foo_new (<!-- -->);
gtk_widget_destroy (foo);
foo = gtk_foo_new ();
g_object_unref (foo);
</programlisting></informalexample>
is a memory leak, because no one assumed the initial floating
reference. If you are using a widget and you aren't immediately
@ -137,19 +137,12 @@ To get this, you must acquire a reference to the widget and drop the
floating reference (<quote>ref and sink</quote> in GTK parlance) after
creating it:
<informalexample><programlisting>
foo = gtk_foo_new (<!-- -->);
foo = gtk_foo_new ();
g_object_ref_sink (foo);
</programlisting></informalexample>
When you want to get rid of the widget, you must call gtk_widget_destroy()
to break any external connections to the widget before dropping your
reference:
<informalexample><programlisting>
gtk_widget_destroy (foo);
g_object_unref (foo);
</programlisting></informalexample>
When you immediately add a widget to a container, it takes care of
assuming the initial floating reference and you don't have to worry
about reference counting at all ... just call gtk_widget_destroy()
about reference counting at all ... just call gtk_container_remove()
to get rid of the widget.
</para>
</answer>

View File

@ -247,7 +247,7 @@ shoot_one (WidgetInfo *info)
{
g_warning ("unable to save shot of %s", info->name);
}
gtk_widget_destroy (info->window);
gtk_window_destroy (GTK_WINDOW (info->window));
shot_id = 0;

View File

@ -16,7 +16,7 @@ action_activated (GSimpleAction *action,
g_action_get_name (G_ACTION (action)));
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
G_CALLBACK (gtk_window_destroy), dialog);
gtk_widget_show (dialog);
}

View File

@ -374,7 +374,7 @@ response (GtkDialog *dialog,
if (response_id == GTK_RESPONSE_CLOSE)
{
gtk_widget_destroy (GTK_WIDGET (dialog));
gtk_window_destroy (GTK_WINDOW (dialog));
return;
}

View File

@ -42,7 +42,7 @@ activate (GtkApplication *app,
gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 1);
button = gtk_button_new_with_label ("Quit");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
/* Place the Quit button in the grid cell (0, 1), and make it
* span 2 columns.

View File

@ -24,7 +24,7 @@ activate (GtkApplication *app,
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_show (window);

View File

@ -173,7 +173,7 @@ quit_app (GSimpleAction *action,
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
gtk_window_destroy (GTK_WINDOW (win));
list = next;
}
@ -382,7 +382,7 @@ configure_plugins (GSimpleAction *action,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black"));
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), (char *) "black");
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_window_present (GTK_WINDOW (dialog));

View File

@ -101,7 +101,7 @@ quit_app (GSimpleAction *action,
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
gtk_window_destroy (GTK_WINDOW (win));
list = next;
}

View File

@ -249,13 +249,13 @@ other_application_dialog_response_cb (GtkDialog *dialog,
* 'Other application'
*/
gtk_combo_box_set_active (GTK_COMBO_BOX (self->combobox), self->last_active);
gtk_widget_destroy (GTK_WIDGET (dialog));
gtk_window_destroy (GTK_WINDOW (dialog));
return;
}
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
gtk_window_destroy (GTK_WINDOW (dialog));
/* refresh the combobox to get the new application */
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));

View File

@ -400,7 +400,7 @@ show_error_dialog (const gchar *primary,
gtk_widget_show (message_dialog);
g_signal_connect (message_dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
}
static void

View File

@ -724,7 +724,7 @@ gtk_application_window_dispose (GObject *object)
if (priv->help_overlay)
{
gtk_widget_destroy (GTK_WIDGET (priv->help_overlay));
gtk_window_destroy (GTK_WINDOW (priv->help_overlay));
g_clear_object (&priv->help_overlay);
}
@ -922,7 +922,7 @@ gtk_application_window_set_help_overlay (GtkApplicationWindow *window,
g_return_if_fail (help_overlay == NULL || GTK_IS_SHORTCUTS_WINDOW (help_overlay));
if (priv->help_overlay)
gtk_widget_destroy (GTK_WIDGET (priv->help_overlay));
gtk_window_destroy (GTK_WINDOW (priv->help_overlay));
g_set_object (&priv->help_overlay, help_overlay);
if (!priv->help_overlay)

View File

@ -39,14 +39,14 @@
* and drops these references when it is finalized. This finalization can
* cause the destruction of non-widget objects or widgets which are not
* contained in a toplevel window. For toplevel windows constructed by a
* builder, it is the responsibility of the user to call gtk_widget_destroy()
* builder, it is the responsibility of the user to call gtk_window_destroy()
* to get rid of them and all the widgets they contain.
*
* The functions gtk_builder_get_object() and gtk_builder_get_objects()
* can be used to access the widgets in the interface by the names assigned
* to them inside the UI description. Toplevel windows returned by these
* functions will stay around until the user explicitly destroys them
* with gtk_widget_destroy(). Other widgets will either be part of a
* with gtk_window_destroy(). Other widgets will either be part of a
* larger hierarchy constructed by the builder (in which case you should
* not have to worry about their lifecycle), or without a parent, in which
* case they have to be added to some container to make use of them.

View File

@ -309,7 +309,7 @@ gtk_color_button_finalize (GObject *object)
GtkColorButton *button = GTK_COLOR_BUTTON (object);
if (button->cs_dialog != NULL)
gtk_widget_destroy (button->cs_dialog);
gtk_window_destroy (GTK_WINDOW (button->cs_dialog));
g_free (button->title);
gtk_widget_unparent (button->button);

Some files were not shown because too many files have changed in this diff Show More