Skip to content

Commit

Permalink
Rename clear_template to dispose_template
Browse files Browse the repository at this point in the history
Make it more clear that the function is supposed to be called during the
dispose sequence of a widget.
  • Loading branch information
ebassi committed Jul 11, 2022
1 parent 63fe334 commit f4f683a
Show file tree
Hide file tree
Showing 28 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion demos/constraint-editor/constraint-editor-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ save_cb (GtkWidget *button,
static void
constraint_editor_window_dispose (GObject *object)
{
gtk_widget_clear_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_WINDOW_TYPE);
gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_WINDOW_TYPE);

G_OBJECT_CLASS (constraint_editor_window_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/constraint-editor/constraint-editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ constraint_editor_dispose (GObject *object)
g_clear_object (&self->model);
g_clear_object (&self->constraint);

gtk_widget_clear_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_TYPE);
gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_TYPE);

G_OBJECT_CLASS (constraint_editor_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/constraint-editor/guide-editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ guide_editor_dispose (GObject *object)

g_clear_object (&self->guide);

gtk_widget_clear_template (GTK_WIDGET (self), GUIDE_EDITOR_TYPE);
gtk_widget_dispose_template (GTK_WIDGET (self), GUIDE_EDITOR_TYPE);

G_OBJECT_CLASS (guide_editor_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/gtk-demo/application.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ demo_application_window_dispose (GObject *object)

demo_application_window_store_state (window);

gtk_widget_clear_template (GTK_WIDGET (window), demo_application_window_get_type ());
gtk_widget_dispose_template (GTK_WIDGET (window), demo_application_window_get_type ());

G_OBJECT_CLASS (demo_application_window_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/gtk-demo/demo3widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ demo3_widget_dispose (GObject *object)

g_clear_object (&self->paintable);

gtk_widget_clear_template (GTK_WIDGET (self), DEMO3_TYPE_WIDGET);
gtk_widget_dispose_template (GTK_WIDGET (self), DEMO3_TYPE_WIDGET);

G_OBJECT_CLASS (demo3_widget_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/gtk-demo/listbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ gtk_message_row_state_flags_changed (GtkWidget *widget,
static void
gtk_message_row_dispose (GObject *obj)
{
gtk_widget_clear_template (GTK_WIDGET (obj), GTK_TYPE_MESSAGE_ROW);
gtk_widget_dispose_template (GTK_WIDGET (obj), GTK_TYPE_MESSAGE_ROW);
G_OBJECT_CLASS (gtk_message_row_parent_class)->dispose (obj);
}

Expand Down
2 changes: 1 addition & 1 deletion demos/icon-browser/iconbrowserwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ icon_browser_window_init (IconBrowserWindow *win)
static void
icon_browser_window_dispose (GObject *object)
{
gtk_widget_clear_template (GTK_WIDGET (object), ICON_BROWSER_WINDOW_TYPE);
gtk_widget_dispose_template (GTK_WIDGET (object), ICON_BROWSER_WINDOW_TYPE);

G_OBJECT_CLASS (icon_browser_window_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/node-editor/node-editor-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ dark_mode_cb (GtkToggleButton *button,
static void
node_editor_window_dispose (GObject *object)
{
gtk_widget_clear_template (GTK_WIDGET (object), NODE_EDITOR_WINDOW_TYPE);
gtk_widget_dispose_template (GTK_WIDGET (object), NODE_EDITOR_WINDOW_TYPE);

G_OBJECT_CLASS (node_editor_window_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkemojichooser.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ gtk_emoji_chooser_finalize (GObject *object)
static void
gtk_emoji_chooser_dispose (GObject *object)
{
gtk_widget_clear_template (GTK_WIDGET (object), GTK_TYPE_EMOJI_CHOOSER);
gtk_widget_dispose_template (GTK_WIDGET (object), GTK_TYPE_EMOJI_CHOOSER);

G_OBJECT_CLASS (gtk_emoji_chooser_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkfilechooserdialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ gtk_file_chooser_dialog_activate_response (GtkWidget *widget,
static void
gtk_file_chooser_dialog_dispose (GObject *object)
{
gtk_widget_clear_template (GTK_WIDGET (object), GTK_TYPE_FILE_CHOOSER_DIALOG);
gtk_widget_dispose_template (GTK_WIDGET (object), GTK_TYPE_FILE_CHOOSER_DIALOG);

G_OBJECT_CLASS (gtk_file_chooser_dialog_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkfilechooserwidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -3137,7 +3137,7 @@ gtk_file_chooser_widget_dispose (GObject *object)

remove_settings_signal (impl);

gtk_widget_clear_template (GTK_WIDGET (impl), GTK_TYPE_FILE_CHOOSER_WIDGET);
gtk_widget_dispose_template (GTK_WIDGET (impl), GTK_TYPE_FILE_CHOOSER_WIDGET);

G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkfontchooserdialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ gtk_font_chooser_dialog_dispose (GObject *object)
/* tweak_button is not a template child */
g_clear_pointer (&dialog->tweak_button, gtk_widget_unparent);

gtk_widget_clear_template (GTK_WIDGET (dialog), GTK_TYPE_FONT_CHOOSER_DIALOG);
gtk_widget_dispose_template (GTK_WIDGET (dialog), GTK_TYPE_FONT_CHOOSER_DIALOG);

G_OBJECT_CLASS (gtk_font_chooser_dialog_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkmediacontrols.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ gtk_media_controls_dispose (GObject *object)

gtk_media_controls_set_media_stream (controls, NULL);

gtk_widget_clear_template (GTK_WIDGET (object), GTK_TYPE_MEDIA_CONTROLS);
gtk_widget_dispose_template (GTK_WIDGET (object), GTK_TYPE_MEDIA_CONTROLS);

G_OBJECT_CLASS (gtk_media_controls_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkstatusbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ gtk_statusbar_dispose (GObject *object)
g_slist_free_full (self->keys, g_free);
self->keys = NULL;

gtk_widget_clear_template (GTK_WIDGET (self), GTK_TYPE_STATUSBAR);
gtk_widget_dispose_template (GTK_WIDGET (self), GTK_TYPE_STATUSBAR);

G_OBJECT_CLASS (gtk_statusbar_parent_class)->dispose (object);
}
Expand Down
14 changes: 7 additions & 7 deletions gtk/gtkwidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
* }
* ```
*
* as well as calling [[email protected].clear_template] from the dispose
* as well as calling [[email protected].dispose_template] from the dispose
* function:
*
* ```c
Expand All @@ -404,7 +404,7 @@
* // Dispose objects for which you have a reference...
*
* // Clear the template children for this widget type
* gtk_widget_clear_template (GTK_WIDGET (self), FOO_TYPE_WIDGET);
* gtk_widget_dispose_template (GTK_WIDGET (self), FOO_TYPE_WIDGET);
*
* G_OBJECT_CLASS (foo_widget_parent_class)->dispose (gobject);
* }
Expand All @@ -428,7 +428,7 @@
* static void
* foo_widget_dispose (GObject *gobject)
* {
* gtk_widget_clear_template (GTK_WIDGET (gobject), FOO_TYPE_WIDGET);
* gtk_widget_dispose_template (GTK_WIDGET (gobject), FOO_TYPE_WIDGET);
*
* G_OBJECT_CLASS (foo_widget_parent_class)->dispose (gobject);
* }
Expand Down Expand Up @@ -10998,7 +10998,7 @@ gtk_widget_init_template (GtkWidget *widget)
}

/**
* gtk_widget_clear_template:
* gtk_widget_dispose_template:
* @widget: the widget with a template
* @widget_type: the type of the widget to finalize the template for
*
Expand All @@ -11022,7 +11022,7 @@ gtk_widget_init_template (GtkWidget *widget)
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_clear_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
Expand All @@ -11031,8 +11031,8 @@ gtk_widget_init_template (GtkWidget *widget)
* Since: 4.8
*/
void
gtk_widget_clear_template (GtkWidget *widget,
GType widget_type)
gtk_widget_dispose_template (GtkWidget *widget,
GType widget_type)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (g_type_name (widget_type) != NULL);
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ GObject *gtk_widget_get_template_child (GtkWidget *
GType widget_type,
const char *name);
GDK_AVAILABLE_IN_4_8
void gtk_widget_clear_template (GtkWidget *widget,
void gtk_widget_dispose_template (GtkWidget *widget,
GType widget_type);
GDK_AVAILABLE_IN_ALL
void gtk_widget_class_set_template (GtkWidgetClass *widget_class,
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/a11y.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ dispose (GObject *o)

g_clear_object (&sl->object);

gtk_widget_clear_template (GTK_WIDGET (o), GTK_TYPE_INSPECTOR_A11Y);
gtk_widget_dispose_template (GTK_WIDGET (o), GTK_TYPE_INSPECTOR_A11Y);

G_OBJECT_CLASS (gtk_inspector_a11y_parent_class)->dispose (o);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ dispose (GObject *object)
g_clear_object (&sl->actions);
g_clear_object (&sl->object);

gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_ACTIONS);
gtk_widget_dispose_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_ACTIONS);

G_OBJECT_CLASS (gtk_inspector_actions_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ gtk_inspector_clipboard_dispose (GObject *object)

gtk_inspector_clipboard_unset_display (self);

gtk_widget_clear_template (GTK_WIDGET (self), GTK_TYPE_INSPECTOR_CLIPBOARD);
gtk_widget_dispose_template (GTK_WIDGET (self), GTK_TYPE_INSPECTOR_CLIPBOARD);

G_OBJECT_CLASS (gtk_inspector_clipboard_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/general.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ gtk_inspector_general_dispose (GObject *object)
disconnect_seat (gen, GDK_SEAT (l->data));
g_list_free (list);

gtk_widget_clear_template (GTK_WIDGET (gen), GTK_TYPE_INSPECTOR_GENERAL);
gtk_widget_dispose_template (GTK_WIDGET (gen), GTK_TYPE_INSPECTOR_GENERAL);

G_OBJECT_CLASS (gtk_inspector_general_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/list-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ dispose (GObject *object)
{
GtkInspectorListData *sl = GTK_INSPECTOR_LIST_DATA (object);

gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_LIST_DATA);
gtk_widget_dispose_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_LIST_DATA);

G_OBJECT_CLASS (gtk_inspector_list_data_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/logs.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ gtk_inspector_logs_init (GtkInspectorLogs *logs)
static void
dispose (GObject *object)
{
gtk_widget_clear_template (GTK_WIDGET (object), GTK_TYPE_INSPECTOR_LOGS);
gtk_widget_dispose_template (GTK_WIDGET (object), GTK_TYPE_INSPECTOR_LOGS);

G_OBJECT_CLASS (gtk_inspector_logs_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/misc-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ dispose (GObject *o)
{
GtkInspectorMiscInfo *sl = GTK_INSPECTOR_MISC_INFO (o);

gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_MISC_INFO);
gtk_widget_dispose_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_MISC_INFO);

G_OBJECT_CLASS (gtk_inspector_misc_info_parent_class)->dispose (o);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/recorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,7 @@ gtk_inspector_recorder_dispose (GObject *object)
g_clear_object (&recorder->render_node_root_model);
g_clear_object (&recorder->render_node_selection);

gtk_widget_clear_template (GTK_WIDGET (recorder), GTK_TYPE_INSPECTOR_RECORDER);
gtk_widget_dispose_template (GTK_WIDGET (recorder), GTK_TYPE_INSPECTOR_RECORDER);

G_OBJECT_CLASS (gtk_inspector_recorder_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/resource-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ dispose (GObject *object)
g_clear_object (&rl->selection);
g_clear_object (&rl->tree_model);

gtk_widget_clear_template (GTK_WIDGET (rl), GTK_TYPE_INSPECTOR_RESOURCE_LIST);
gtk_widget_dispose_template (GTK_WIDGET (rl), GTK_TYPE_INSPECTOR_RESOURCE_LIST);

G_OBJECT_CLASS (gtk_inspector_resource_list_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/tree-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ dispose (GObject *object)
{
GtkInspectorTreeData *sl = GTK_INSPECTOR_TREE_DATA (object);

gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_TREE_DATA);
gtk_widget_dispose_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_TREE_DATA);

G_OBJECT_CLASS (gtk_inspector_tree_data_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/visual.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ gtk_inspector_visual_dispose (GObject *object)
{
GtkInspectorVisual *vis = GTK_INSPECTOR_VISUAL (object);

gtk_widget_clear_template (GTK_WIDGET (vis), GTK_TYPE_INSPECTOR_VISUAL);
gtk_widget_dispose_template (GTK_WIDGET (vis), GTK_TYPE_INSPECTOR_VISUAL);

G_OBJECT_CLASS (gtk_inspector_visual_parent_class)->dispose (object);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk/inspector/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ gtk_inspector_window_dispose (GObject *object)
g_clear_object (&iw->flash_overlay);
g_clear_pointer (&iw->objects, g_array_unref);

gtk_widget_clear_template (GTK_WIDGET (iw), GTK_TYPE_INSPECTOR_WINDOW);
gtk_widget_dispose_template (GTK_WIDGET (iw), GTK_TYPE_INSPECTOR_WINDOW);

G_OBJECT_CLASS (gtk_inspector_window_parent_class)->dispose (object);
}
Expand Down

0 comments on commit f4f683a

Please sign in to comment.