diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-17 23:24:14 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-17 23:24:14 -0400 |
commit | 1bff328895b9ac3df4c67cb3c708c00d8ebe24ff (patch) | |
tree | ef5f5ae7f5c619d81a4204e49ced10a43d4a5cdb /gtk/inspector | |
parent | facf78a5b6fdc4dda59751bda708a9f573f9d488 (diff) | |
download | gtk+-1bff328895b9ac3df4c67cb3c708c00d8ebe24ff.tar.gz |
inspector: Clean up GtkInspectorLogs
Drop the Private struct, dispose properly,
and don't derive from GtkBox.
Diffstat (limited to 'gtk/inspector')
-rw-r--r-- | gtk/inspector/logs.c | 150 | ||||
-rw-r--r-- | gtk/inspector/logs.h | 18 | ||||
-rw-r--r-- | gtk/inspector/logs.ui | 2 |
3 files changed, 84 insertions, 86 deletions
diff --git a/gtk/inspector/logs.c b/gtk/inspector/logs.c index ab24213762..58f43386eb 100644 --- a/gtk/inspector/logs.c +++ b/gtk/inspector/logs.c @@ -40,10 +40,13 @@ #include "gtknative.h" #include "gskdebugprivate.h" #include "gskrendererprivate.h" +#include "gtkboxlayout.h" -struct _GtkInspectorLogsPrivate +struct _GtkInspectorLogs { + GtkWidget parent; + GtkWidget *events; GtkWidget *misc; GtkWidget *dnd; @@ -77,21 +80,28 @@ struct _GtkInspectorLogsPrivate GdkDisplay *display; }; -G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorLogs, gtk_inspector_logs, GTK_TYPE_BOX) +typedef struct _GtkInspectorLogsClass +{ + GtkWidgetClass parent; +} GtkInspectorLogsClass; + +G_DEFINE_TYPE (GtkInspectorLogs, gtk_inspector_logs, GTK_TYPE_WIDGET) static void gtk_inspector_logs_init (GtkInspectorLogs *logs) { - logs->priv = gtk_inspector_logs_get_instance_private (logs); gtk_widget_init_template (GTK_WIDGET (logs)); } static void -finalize (GObject *object) +dispose (GObject *object) { - //GtkInspectorLogs *logs = GTK_INSPECTOR_LOGS (object); + GtkWidget *child; - G_OBJECT_CLASS (gtk_inspector_logs_parent_class)->finalize (object); + while ((child = gtk_widget_get_first_child (GTK_WIDGET (object)))) + gtk_widget_unparent (child); + + G_OBJECT_CLASS (gtk_inspector_logs_parent_class)->dispose (object); } static void @@ -112,28 +122,28 @@ flag_toggled (GtkWidget *button, guint flags; GList *toplevels, *l; - flags = gdk_display_get_debug_flags (logs->priv->display); - update_flag (logs->priv->events, &flags, GDK_DEBUG_EVENTS); - update_flag (logs->priv->misc, &flags, GDK_DEBUG_MISC); - update_flag (logs->priv->dnd, &flags, GDK_DEBUG_DND); - update_flag (logs->priv->input, &flags, GDK_DEBUG_INPUT); - update_flag (logs->priv->eventloop, &flags, GDK_DEBUG_EVENTLOOP); - update_flag (logs->priv->frames, &flags, GDK_DEBUG_FRAMES); - update_flag (logs->priv->settings, &flags, GDK_DEBUG_SETTINGS); - update_flag (logs->priv->opengl, &flags, GDK_DEBUG_OPENGL); - update_flag (logs->priv->vulkan, &flags, GDK_DEBUG_VULKAN); - update_flag (logs->priv->selection, &flags, GDK_DEBUG_SELECTION); - update_flag (logs->priv->clipboard, &flags, GDK_DEBUG_CLIPBOARD); - gdk_display_set_debug_flags (logs->priv->display, flags); + flags = gdk_display_get_debug_flags (logs->display); + update_flag (logs->events, &flags, GDK_DEBUG_EVENTS); + update_flag (logs->misc, &flags, GDK_DEBUG_MISC); + update_flag (logs->dnd, &flags, GDK_DEBUG_DND); + update_flag (logs->input, &flags, GDK_DEBUG_INPUT); + update_flag (logs->eventloop, &flags, GDK_DEBUG_EVENTLOOP); + update_flag (logs->frames, &flags, GDK_DEBUG_FRAMES); + update_flag (logs->settings, &flags, GDK_DEBUG_SETTINGS); + update_flag (logs->opengl, &flags, GDK_DEBUG_OPENGL); + update_flag (logs->vulkan, &flags, GDK_DEBUG_VULKAN); + update_flag (logs->selection, &flags, GDK_DEBUG_SELECTION); + update_flag (logs->clipboard, &flags, GDK_DEBUG_CLIPBOARD); + gdk_display_set_debug_flags (logs->display, flags); flags = gsk_get_debug_flags (); - update_flag (logs->priv->renderer, &flags, GSK_DEBUG_RENDERER); - update_flag (logs->priv->cairo, &flags, GSK_DEBUG_CAIRO); - update_flag (logs->priv->opengl_gsk, &flags, GSK_DEBUG_OPENGL); - update_flag (logs->priv->vulkan_gsk, &flags, GSK_DEBUG_VULKAN); - update_flag (logs->priv->shaders, &flags, GSK_DEBUG_SHADERS); - update_flag (logs->priv->surface, &flags, GSK_DEBUG_SURFACE); - update_flag (logs->priv->glyphcache, &flags, GSK_DEBUG_GLYPH_CACHE); + update_flag (logs->renderer, &flags, GSK_DEBUG_RENDERER); + update_flag (logs->cairo, &flags, GSK_DEBUG_CAIRO); + update_flag (logs->opengl_gsk, &flags, GSK_DEBUG_OPENGL); + update_flag (logs->vulkan_gsk, &flags, GSK_DEBUG_VULKAN); + update_flag (logs->shaders, &flags, GSK_DEBUG_SHADERS); + update_flag (logs->surface, &flags, GSK_DEBUG_SURFACE); + update_flag (logs->glyphcache, &flags, GSK_DEBUG_GLYPH_CACHE); gsk_set_debug_flags (flags); toplevels = gtk_window_list_toplevels (); @@ -141,7 +151,7 @@ flag_toggled (GtkWidget *button, { GtkWidget *toplevel = l->data; - if (gtk_root_get_display (GTK_ROOT (toplevel)) == logs->priv->display) + if (gtk_root_get_display (GTK_ROOT (toplevel)) == logs->display) { GskRenderer *renderer = gtk_native_get_renderer (GTK_NATIVE (toplevel)); if (renderer) @@ -150,17 +160,17 @@ flag_toggled (GtkWidget *button, } g_list_free (toplevels); - flags = gtk_get_display_debug_flags (logs->priv->display); - update_flag (logs->priv->actions, &flags, GTK_DEBUG_ACTIONS); - update_flag (logs->priv->builder, &flags, GTK_DEBUG_BUILDER); - update_flag (logs->priv->sizes, &flags, GTK_DEBUG_SIZE_REQUEST); - update_flag (logs->priv->icons, &flags, GTK_DEBUG_ICONTHEME); - update_flag (logs->priv->keybindings, &flags, GTK_DEBUG_KEYBINDINGS); - update_flag (logs->priv->modules, &flags, GTK_DEBUG_MODULES); - update_flag (logs->priv->printing, &flags, GTK_DEBUG_PRINTING); - update_flag (logs->priv->tree, &flags, GTK_DEBUG_TREE); - update_flag (logs->priv->text, &flags, GTK_DEBUG_TEXT); - gtk_set_display_debug_flags (logs->priv->display, flags); + flags = gtk_get_display_debug_flags (logs->display); + update_flag (logs->actions, &flags, GTK_DEBUG_ACTIONS); + update_flag (logs->builder, &flags, GTK_DEBUG_BUILDER); + update_flag (logs->sizes, &flags, GTK_DEBUG_SIZE_REQUEST); + update_flag (logs->icons, &flags, GTK_DEBUG_ICONTHEME); + update_flag (logs->keybindings, &flags, GTK_DEBUG_KEYBINDINGS); + update_flag (logs->modules, &flags, GTK_DEBUG_MODULES); + update_flag (logs->printing, &flags, GTK_DEBUG_PRINTING); + update_flag (logs->tree, &flags, GTK_DEBUG_TREE); + update_flag (logs->text, &flags, GTK_DEBUG_TEXT); + gtk_set_display_debug_flags (logs->display, flags); } static void @@ -169,46 +179,48 @@ gtk_inspector_logs_class_init (GtkInspectorLogsClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - object_class->finalize = finalize; + object_class->dispose = dispose; gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/logs.ui"); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, events); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, misc); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, dnd); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, input); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, eventloop); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, frames); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, settings); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, opengl); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, vulkan); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, selection); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, clipboard); - - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, renderer); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, cairo); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, opengl_gsk); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, vulkan_gsk); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, shaders); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, surface); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, glyphcache); - - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, actions); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, builder); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, sizes); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, icons); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, keybindings); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, modules); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, printing); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, tree); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, text); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, events); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, misc); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, dnd); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, input); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, eventloop); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, frames); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, settings); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, opengl); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, vulkan); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, selection); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, clipboard); + + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, renderer); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, cairo); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, opengl_gsk); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, vulkan_gsk); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, shaders); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, surface); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, glyphcache); + + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, actions); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, builder); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, sizes); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, icons); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, keybindings); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, modules); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, printing); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, tree); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, text); gtk_widget_class_bind_template_callback (widget_class, flag_toggled); + + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); } void gtk_inspector_logs_set_display (GtkInspectorLogs *logs, GdkDisplay *display) { - logs->priv->display = display; + logs->display = display; } // vim: set et sw=2 ts=2: diff --git a/gtk/inspector/logs.h b/gtk/inspector/logs.h index c88fe85a42..0c8c6b21b7 100644 --- a/gtk/inspector/logs.h +++ b/gtk/inspector/logs.h @@ -23,28 +23,14 @@ #ifndef _GTK_INSPECTOR_LOGS_H_ #define _GTK_INSPECTOR_LOGS_H_ -#include <gtk/gtkbox.h> +#include <gtk/gtkwidget.h> #define GTK_TYPE_INSPECTOR_LOGS (gtk_inspector_logs_get_type()) #define GTK_INSPECTOR_LOGS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_LOGS, GtkInspectorLogs)) -#define GTK_INSPECTOR_LOGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_LOGS, GtkInspectorLogsClass)) #define GTK_INSPECTOR_IS_LOGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_LOGS)) -#define GTK_INSPECTOR_IS_LOGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_LOGS)) -#define GTK_INSPECTOR_LOGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_LOGS, GtkInspectorLogsClass)) -typedef struct _GtkInspectorLogsPrivate GtkInspectorLogsPrivate; - -typedef struct _GtkInspectorLogs -{ - GtkBox parent; - GtkInspectorLogsPrivate *priv; -} GtkInspectorLogs; - -typedef struct _GtkInspectorLogsClass -{ - GtkBoxClass parent; -} GtkInspectorLogsClass; +typedef struct _GtkInspectorLogs GtkInspectorLogs; G_BEGIN_DECLS diff --git a/gtk/inspector/logs.ui b/gtk/inspector/logs.ui index a73ba03286..89236ec6aa 100644 --- a/gtk/inspector/logs.ui +++ b/gtk/inspector/logs.ui @@ -1,5 +1,5 @@ <interface domain="gtk40"> - <template class="GtkInspectorLogs" parent="GtkBox"> + <template class="GtkInspectorLogs" parent="GtkWidget"> <child> <object class="GtkBox"> <property name="margin-start">20</property> |