[gtk/wip/baedert/for-master: 47/57] wiget: Fix whitespace issues




commit 8c4aca2b241a3a6701672bb7c29035c0a148984c
Author: Timm Bäder <mail baedert org>
Date:   Sun Dec 27 13:10:35 2020 +0100

    wiget: Fix whitespace issues
    
    Switch from tabs to spaces everywhere consistently and remove all
    trailing whitespace.

 gtk/gtkwidget.c | 571 +++++++++++++++++++++++++++-----------------------------
 1 file changed, 274 insertions(+), 297 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index dd1d7cfd00..c6345f257c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8,7 +8,7 @@
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
@@ -452,16 +452,11 @@
                                             GTK_STATE_FLAG_ACTIVE)
 
 typedef struct {
-  char                *name;           /* Name of the template automatic child */
-  gboolean             internal_child; /* Whether the automatic widget should be exported as an 
<internal-child> */
-  gssize               offset;         /* Instance private data offset where to set the automatic child (or 
0) */
+  char *name;           /* Name of the template automatic child */
+  gboolean internal_child; /* Whether the automatic widget should be exported as an <internal-child> */
+  gssize offset;         /* Instance private data offset where to set the automatic child (or 0) */
 } AutomaticChildClass;
 
-typedef struct {
-  char      *callback_name;
-  GCallback  callback_symbol;
-} CallbackSymbol;
-
 enum {
   DESTROY,
   SHOW,
@@ -521,70 +516,64 @@ enum {
   PROP_ACCESSIBLE_ROLE
 };
 
-static GParamSpec *widget_props[NUM_PROPERTIES] = { NULL, };
-
-typedef        struct  _GtkStateData    GtkStateData;
 
-struct _GtkStateData
+typedef struct
 {
   guint         flags_to_set;
   guint         flags_to_unset;
 
   int           old_scale_factor;
-};
-
-/* --- prototypes --- */
-static void    gtk_widget_base_class_init      (gpointer            g_class);
-static void    gtk_widget_class_init           (GtkWidgetClass     *klass);
-static void    gtk_widget_base_class_finalize  (GtkWidgetClass     *klass);
-static void     gtk_widget_init                  (GTypeInstance     *instance,
-                                                  gpointer           g_class);
-static void    gtk_widget_dispose               (GObject           *object);
-static void    gtk_widget_finalize              (GObject           *object);
-static void     gtk_widget_real_destroy          (GtkWidget         *object);
-static gboolean gtk_widget_real_focus            (GtkWidget         *widget,
-                                                  GtkDirectionType   direction);
-static void    gtk_widget_real_show             (GtkWidget         *widget);
-static void    gtk_widget_real_hide             (GtkWidget         *widget);
-static void    gtk_widget_real_map              (GtkWidget         *widget);
-static void    gtk_widget_real_unmap            (GtkWidget         *widget);
-static void    gtk_widget_real_realize          (GtkWidget         *widget);
-static void    gtk_widget_real_unrealize        (GtkWidget         *widget);
-static void    gtk_widget_real_direction_changed(GtkWidget         *widget,
-                                                  GtkTextDirection   previous_direction);
-
-static void     gtk_widget_real_css_changed      (GtkWidget         *widget,
-                                                  GtkCssStyleChange *change);
-static void     gtk_widget_real_system_setting_changed (GtkWidget         *widget,
-                                                        GtkSystemSetting   setting);
-
-static void             gtk_widget_real_set_focus_child         (GtkWidget        *widget,
-                                                                 GtkWidget        *child);
-static void             gtk_widget_real_move_focus              (GtkWidget        *widget,
-                                                                 GtkDirectionType  direction);
-static gboolean                gtk_widget_real_keynav_failed           (GtkWidget        *widget,
-                                                                GtkDirectionType  direction);
+} GtkStateData;
+
+
+static void     gtk_widget_base_class_init                      (gpointer            g_class);
+static void     gtk_widget_class_init                           (GtkWidgetClass     *klass);
+static void     gtk_widget_base_class_finalize                  (GtkWidgetClass     *klass);
+static void     gtk_widget_init                                 (GTypeInstance      *instance,
+                                                                 gpointer            g_class);
+static void     gtk_widget_dispose                              (GObject            *object);
+static void     gtk_widget_finalize                             (GObject            *object);
+static void     gtk_widget_real_destroy                         (GtkWidget          *object);
+static gboolean gtk_widget_real_focus                           (GtkWidget          *widget,
+                                                                 GtkDirectionType    direction);
+static void     gtk_widget_real_show                            (GtkWidget          *widget);
+static void     gtk_widget_real_hide                            (GtkWidget          *widget);
+static void     gtk_widget_real_map                             (GtkWidget          *widget);
+static void     gtk_widget_real_unmap                           (GtkWidget          *widget);
+static void     gtk_widget_real_realize                         (GtkWidget          *widget);
+static void     gtk_widget_real_unrealize                       (GtkWidget          *widget);
+static void     gtk_widget_real_direction_changed               (GtkWidget          *widget,
+                                                                 GtkTextDirection    previous_direction);
+static void     gtk_widget_real_css_changed                     (GtkWidget          *widget,
+                                                                 GtkCssStyleChange  *change);
+static void     gtk_widget_real_system_setting_changed          (GtkWidget          *widget,
+                                                                 GtkSystemSetting    setting);
+static void     gtk_widget_real_set_focus_child                 (GtkWidget          *widget,
+                                                                 GtkWidget          *child);
+static void     gtk_widget_real_move_focus                      (GtkWidget          *widget,
+                                                                GtkDirectionType     direction);
+static gboolean gtk_widget_real_keynav_failed                   (GtkWidget          *widget,
+                                                                 GtkDirectionType    direction);
 #ifdef G_ENABLE_CONSISTENCY_CHECKS
-static void             gtk_widget_verify_invariants            (GtkWidget        *widget);
-static void             gtk_widget_push_verify_invariants       (GtkWidget        *widget);
-static void             gtk_widget_pop_verify_invariants        (GtkWidget        *widget);
+static void             gtk_widget_verify_invariants            (GtkWidget          *widget);
+static void             gtk_widget_push_verify_invariants       (GtkWidget          *widget);
+static void             gtk_widget_pop_verify_invariants        (GtkWidget          *widget);
 #else
 #define                 gtk_widget_verify_invariants(widget)
 #define                 gtk_widget_push_verify_invariants(widget)
 #define                 gtk_widget_pop_verify_invariants(widget)
 #endif
-static PangoContext*   gtk_widget_peek_pango_context           (GtkWidget        *widget);
-static void            gtk_widget_update_pango_context         (GtkWidget        *widget);
+static PangoContext*    gtk_widget_peek_pango_context           (GtkWidget          *widget);
+static void             gtk_widget_update_pango_context         (GtkWidget          *widget);
 static void             gtk_widget_propagate_state              (GtkWidget          *widget,
                                                                  const GtkStateData *data);
-static gboolean                gtk_widget_real_mnemonic_activate       (GtkWidget        *widget,
-                                                                gboolean          group_cycling);
+static gboolean         gtk_widget_real_mnemonic_activate       (GtkWidget          *widget,
+                                                                 gboolean            group_cycling);
 static void             gtk_widget_accessible_interface_init    (GtkAccessibleInterface *iface);
-
 static void             gtk_widget_buildable_interface_init     (GtkBuildableIface  *iface);
 static void             gtk_widget_buildable_set_id             (GtkBuildable       *buildable,
                                                                  const char         *id);
-static const char *    gtk_widget_buildable_get_id             (GtkBuildable       *buildable);
+static const char *     gtk_widget_buildable_get_id             (GtkBuildable       *buildable);
 static GObject *        gtk_widget_buildable_get_internal_child (GtkBuildable       *buildable,
                                                                  GtkBuilder         *builder,
                                                                  const char         *childname);
@@ -606,16 +595,12 @@ static void             gtk_widget_buildable_custom_finished    (GtkBuildable
                                                                  gpointer            data);
 static void             gtk_widget_buildable_parser_finished    (GtkBuildable       *buildable,
                                                                  GtkBuilder         *builder);
-
-static void                     gtk_widget_set_accessible_role  (GtkWidget          *self,
+static void               gtk_widget_set_accessible_role        (GtkWidget          *self,
                                                                  GtkAccessibleRole   role);
-static GtkAccessibleRole        gtk_widget_get_accessible_role  (GtkWidget          *self);
-
-static void                  template_data_free                 (GtkWidgetTemplate*template_data);
-
-static void gtk_widget_set_usize_internal (GtkWidget          *widget,
-                                          int                 width,
-                                          int                 height);
+static GtkAccessibleRole  gtk_widget_get_accessible_role        (GtkWidget          *self);
+static void               gtk_widget_set_usize_internal         (GtkWidget          *widget,
+                                                                 int                 width,
+                                                                 int                 height);
 
 static gboolean event_surface_is_still_viewable (GdkEvent *event);
 
@@ -627,21 +612,20 @@ static void gtk_widget_queue_compute_expand (GtkWidget *widget);
 
 
 
-/* --- variables --- */
 static int              GtkWidget_private_offset = 0;
 static gpointer         gtk_widget_parent_class = NULL;
 static guint            widget_signals[LAST_SIGNAL] = { 0 };
-GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
+static GParamSpec      *widget_props[NUM_PROPERTIES] = { NULL, };
+GtkTextDirection        gtk_default_direction = GTK_TEXT_DIR_LTR;
 
-static GQuark          quark_pango_context = 0;
-static GQuark          quark_mnemonic_labels = 0;
+static GQuark           quark_pango_context = 0;
+static GQuark           quark_mnemonic_labels = 0;
 static GQuark           quark_size_groups = 0;
 static GQuark           quark_auto_children = 0;
 static GQuark           quark_action_muxer = 0;
 static GQuark           quark_font_options = 0;
 static GQuark           quark_font_map = 0;
 
-/* --- functions --- */
 GType
 gtk_widget_get_type (void)
 {
@@ -651,16 +635,16 @@ gtk_widget_get_type (void)
     {
       const GTypeInfo widget_info =
       {
-       sizeof (GtkWidgetClass),
-       gtk_widget_base_class_init,
-       (GBaseFinalizeFunc) gtk_widget_base_class_finalize,
-       (GClassInitFunc) gtk_widget_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_init */
-       sizeof (GtkWidget),
-       0,              /* n_preallocs */
-       gtk_widget_init,
-       NULL,           /* value_table */
+        sizeof (GtkWidgetClass),
+        gtk_widget_base_class_init,
+        (GBaseFinalizeFunc) gtk_widget_base_class_finalize,
+        (GClassInitFunc) gtk_widget_class_init,
+        NULL, /* class_finalize */
+        NULL, /* class_init */
+        sizeof (GtkWidget),
+        0, /* n_preallocs */
+        gtk_widget_init,
+        NULL, /* value_table */
       };
 
       const GInterfaceInfo accessible_info =
@@ -672,16 +656,16 @@ gtk_widget_get_type (void)
 
       const GInterfaceInfo buildable_info =
       {
-       (GInterfaceInitFunc) gtk_widget_buildable_interface_init,
-       (GInterfaceFinalizeFunc) NULL,
-       NULL /* interface data */
+        (GInterfaceInitFunc) gtk_widget_buildable_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL /* interface data */
       };
 
       const GInterfaceInfo constraint_target_info =
       {
-       (GInterfaceInitFunc) NULL,
-       (GInterfaceFinalizeFunc) NULL,
-       NULL /* interface data */
+        (GInterfaceInitFunc) NULL,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL /* interface data */
       };
 
       widget_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, g_intern_static_string ("GtkWidget"),
@@ -689,8 +673,7 @@ gtk_widget_get_type (void)
 
       g_type_add_class_private (widget_type, sizeof (GtkWidgetClassPrivate));
 
-      GtkWidget_private_offset =
-        g_type_add_instance_private (widget_type, sizeof (GtkWidgetPrivate));
+      GtkWidget_private_offset = g_type_add_instance_private (widget_type, sizeof (GtkWidgetPrivate));
 
       g_type_add_interface_static (widget_type, GTK_TYPE_ACCESSIBLE,
                                    &accessible_info);
@@ -772,7 +755,7 @@ gtk_widget_real_contains (GtkWidget *widget,
  **/
 void
 _gtk_widget_grab_notify (GtkWidget *widget,
-                        gboolean   was_grabbed)
+                         gboolean   was_grabbed)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GList *l;
@@ -1642,12 +1625,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SHOW] =
     g_signal_new (I_("show"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, show),
-                 NULL, NULL,
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, show),
+                  NULL, NULL,
                   NULL,
-                 G_TYPE_NONE, 0);
+                  G_TYPE_NONE, 0);
 
   /**
    * GtkWidget::hide:
@@ -1658,12 +1641,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[HIDE] =
     g_signal_new (I_("hide"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, hide),
-                 NULL, NULL,
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, hide),
+                  NULL, NULL,
                   NULL,
-                 G_TYPE_NONE, 0);
+                  G_TYPE_NONE, 0);
 
   /**
    * GtkWidget::map:
@@ -1680,12 +1663,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[MAP] =
     g_signal_new (I_("map"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, map),
-                 NULL, NULL,
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, map),
+                  NULL, NULL,
                   NULL,
-                 G_TYPE_NONE, 0);
+                  G_TYPE_NONE, 0);
 
   /**
    * GtkWidget::unmap:
@@ -1700,12 +1683,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[UNMAP] =
     g_signal_new (I_("unmap"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, unmap),
-                 NULL, NULL,
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, unmap),
+                  NULL, NULL,
                   NULL,
-                 G_TYPE_NONE, 0);
+                  G_TYPE_NONE, 0);
 
   /**
    * GtkWidget::realize:
@@ -1717,12 +1700,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[REALIZE] =
     g_signal_new (I_("realize"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, realize),
-                 NULL, NULL,
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, realize),
+                  NULL, NULL,
                   NULL,
-                 G_TYPE_NONE, 0);
+                  G_TYPE_NONE, 0);
 
   /**
    * GtkWidget::unrealize:
@@ -1735,12 +1718,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[UNREALIZE] =
     g_signal_new (I_("unrealize"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_LAST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, unrealize),
-                 NULL, NULL,
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, unrealize),
+                  NULL, NULL,
                   NULL,
-                 G_TYPE_NONE, 0);
+                  G_TYPE_NONE, 0);
 
   /**
    * GtkWidget::state-flags-changed:
@@ -1770,13 +1753,13 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DIRECTION_CHANGED] =
     g_signal_new (I_("direction-changed"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, direction_changed),
-                 NULL, NULL,
-                 NULL,
-                 G_TYPE_NONE, 1,
-                 GTK_TYPE_TEXT_DIRECTION);
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, direction_changed),
+                  NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE, 1,
+                  GTK_TYPE_TEXT_DIRECTION);
 
   /**
    * GtkWidget::mnemonic-activate:
@@ -1791,13 +1774,13 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[MNEMONIC_ACTIVATE] =
     g_signal_new (I_("mnemonic-activate"),
-                 G_TYPE_FROM_CLASS (gobject_class),
-                 G_SIGNAL_RUN_LAST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, mnemonic_activate),
-                 _gtk_boolean_handled_accumulator, NULL,
-                 _gtk_marshal_BOOLEAN__BOOLEAN,
-                 G_TYPE_BOOLEAN, 1,
-                 G_TYPE_BOOLEAN);
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, mnemonic_activate),
+                  _gtk_boolean_handled_accumulator, NULL,
+                  _gtk_marshal_BOOLEAN__BOOLEAN,
+                  G_TYPE_BOOLEAN, 1,
+                  G_TYPE_BOOLEAN);
   g_signal_set_va_marshaller (widget_signals[MNEMONIC_ACTIVATE],
                               G_TYPE_FROM_CLASS (gobject_class),
                               _gtk_marshal_BOOLEAN__BOOLEANv);
@@ -1872,16 +1855,16 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[QUERY_TOOLTIP] =
     g_signal_new (I_("query-tooltip"),
-                 G_TYPE_FROM_CLASS (klass),
-                 G_SIGNAL_RUN_LAST,
-                 G_STRUCT_OFFSET (GtkWidgetClass, query_tooltip),
-                 _gtk_boolean_handled_accumulator, NULL,
-                 _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECT,
-                 G_TYPE_BOOLEAN, 4,
-                 G_TYPE_INT,
-                 G_TYPE_INT,
-                 G_TYPE_BOOLEAN,
-                 GTK_TYPE_TOOLTIP);
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GtkWidgetClass, query_tooltip),
+                  _gtk_boolean_handled_accumulator, NULL,
+                  _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECT,
+                  G_TYPE_BOOLEAN, 4,
+                  G_TYPE_INT,
+                  G_TYPE_INT,
+                  G_TYPE_BOOLEAN,
+                  GTK_TYPE_TOOLTIP);
   g_signal_set_va_marshaller (widget_signals[QUERY_TOOLTIP],
                               G_TYPE_FROM_CLASS (klass),
                               _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECTv);
@@ -1890,11 +1873,31 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   gtk_widget_class_set_accessible_role (klass, GTK_ACCESSIBLE_ROLE_WIDGET);
 }
 
+static void
+template_child_class_free (AutomaticChildClass *child_class)
+{
+  if (child_class)
+    {
+      g_free (child_class->name);
+      g_slice_free (AutomaticChildClass, child_class);
+    }
+}
+
 static void
 gtk_widget_base_class_finalize (GtkWidgetClass *klass)
 {
+  GtkWidgetTemplate *template_data = klass->priv->template;
+
+  if (template_data)
+    {
+      g_bytes_unref (template_data->data);
+      g_slist_free_full (template_data->children, (GDestroyNotify)template_child_class_free);
+
+      g_object_unref (template_data->scope);
+
+      g_slice_free (GtkWidgetTemplate, template_data);
+    }
 
-  template_data_free (klass->priv->template);
   g_object_unref (klass->priv->shortcuts);
 }
 
@@ -2690,7 +2693,7 @@ gtk_widget_hide (GtkWidget *widget)
 
       parent = gtk_widget_get_parent (widget);
       if (parent)
-       gtk_widget_queue_resize (parent);
+        gtk_widget_queue_resize (parent);
 
       gtk_widget_queue_allocate (widget);
 
@@ -3473,7 +3476,7 @@ gtk_widget_get_resize_needed (GtkWidget *widget)
 /*
  * gtk_widget_queue_resize_internal:
  * @widget: a #GtkWidget
- * 
+ *
  * Queue a resize on a widget, and on all other widgets grouped with this widget.
  */
 static void
@@ -3494,12 +3497,10 @@ gtk_widget_queue_resize_internal (GtkWidget *widget)
   groups = _gtk_widget_get_sizegroups (widget);
 
   for (l = groups; l; l = l->next)
-  {
-    for (widgets = gtk_size_group_get_widgets (l->data); widgets; widgets = widgets->next)
-      {
+    {
+      for (widgets = gtk_size_group_get_widgets (l->data); widgets; widgets = widgets->next)
         gtk_widget_queue_resize_internal (widgets->data);
-      }
-  }
+    }
 
   if (_gtk_widget_get_visible (widget))
     {
@@ -3525,7 +3526,7 @@ gtk_widget_queue_resize_internal (GtkWidget *widget)
  * queues a resize to ensure there’s enough space for the new text.
  *
  * Note that you cannot call gtk_widget_queue_resize() on a widget
- * from inside its implementation of the GtkWidgetClass::size_allocate 
+ * from inside its implementation of the GtkWidgetClass::size_allocate
  * virtual method. Calls to gtk_widget_queue_resize() from inside
  * GtkWidgetClass::size_allocate will be silently ignored.
  **/
@@ -3695,17 +3696,17 @@ adjust_for_align (GtkAlign  align,
       break;
     case GTK_ALIGN_END:
       if (*allocated_size > natural_size)
-       {
-         *allocated_pos += (*allocated_size - natural_size);
-         *allocated_size = natural_size;
-       }
+        {
+          *allocated_pos += (*allocated_size - natural_size);
+          *allocated_size = natural_size;
+        }
       break;
     case GTK_ALIGN_CENTER:
       if (*allocated_size > natural_size)
-       {
-         *allocated_pos += (*allocated_size - natural_size) / 2;
-         *allocated_size = MIN (*allocated_size, natural_size);
-       }
+        {
+          *allocated_pos += (*allocated_size - natural_size) / 2;
+          *allocated_size = MIN (*allocated_size, natural_size);
+        }
       break;
     }
 }
@@ -3992,7 +3993,7 @@ out:
  **/
 GtkWidget *
 gtk_widget_common_ancestor (GtkWidget *widget_a,
-                           GtkWidget *widget_b)
+                            GtkWidget *widget_b)
 {
   GtkWidget *parent_a;
   GtkWidget *parent_b;
@@ -4312,10 +4313,10 @@ gtk_widget_mnemonic_activate (GtkWidget *widget,
     handled = TRUE;
   else
     g_signal_emit (widget,
-                  widget_signals[MNEMONIC_ACTIVATE],
-                  0,
-                  group_cycling,
-                  &handled);
+                   widget_signals[MNEMONIC_ACTIVATE],
+                   0,
+                   group_cycling,
+                   &handled);
   return handled;
 }
 
@@ -4350,7 +4351,7 @@ gtk_widget_real_mnemonic_activate (GtkWidget *widget,
   else
     {
       g_warning ("widget '%s' isn't suitable for mnemonic activation",
-                G_OBJECT_TYPE_NAME (widget));
+                 G_OBJECT_TYPE_NAME (widget));
       gtk_widget_error_bell (widget);
     }
   return TRUE;
@@ -5191,7 +5192,7 @@ gtk_widget_is_focus (GtkWidget *widget)
  **/
 void
 gtk_widget_set_focus_on_click (GtkWidget *widget,
-                              gboolean   focus_on_click)
+                               gboolean   focus_on_click)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
 
@@ -5355,8 +5356,8 @@ _gtk_widget_set_has_grab (GtkWidget *widget,
  * of alphanumeric symbols, dashes and underscores will suffice.
  */
 void
-gtk_widget_set_name (GtkWidget  *widget,
-                    const char *name)
+gtk_widget_set_name (GtkWidget  *widget,
+                     const char *name)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
 
@@ -6212,9 +6213,9 @@ gtk_widget_get_pango_context (GtkWidget *widget)
     {
       context = gtk_widget_create_pango_context (GTK_WIDGET (widget));
       g_object_set_qdata_full (G_OBJECT (widget),
-                              quark_pango_context,
-                              context,
-                              g_object_unref);
+                               quark_pango_context,
+                               context,
+                               g_object_unref);
     }
 
   return context;
@@ -6251,8 +6252,8 @@ update_pango_context (GtkWidget    *widget,
   pango_font_description_free (font_desc);
 
   pango_context_set_base_dir (context,
-                             _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
-                             PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
+                              _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
+                              PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
 
   pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
 
@@ -6434,8 +6435,8 @@ gtk_widget_create_pango_context (GtkWidget *widget)
  * Returns: (transfer full): the new #PangoLayout
  **/
 PangoLayout *
-gtk_widget_create_pango_layout (GtkWidget   *widget,
-                               const char *text)
+gtk_widget_create_pango_layout (GtkWidget  *widget,
+                                const char *text)
 {
   PangoLayout *layout;
   PangoContext *context;
@@ -6501,17 +6502,17 @@ gtk_widget_set_child_visible (GtkWidget *widget,
 
       root = _gtk_widget_get_root (widget);
       if (GTK_WIDGET (root) != widget && GTK_IS_WINDOW (root))
-       _gtk_window_unset_focus_and_default (GTK_WINDOW (root), widget);
+        _gtk_window_unset_focus_and_default (GTK_WINDOW (root), widget);
     }
 
   if (priv->parent && _gtk_widget_get_realized (priv->parent))
     {
       if (_gtk_widget_get_mapped (priv->parent) &&
-         priv->child_visible &&
-         _gtk_widget_get_visible (widget))
-       gtk_widget_map (widget);
+          priv->child_visible &&
+          _gtk_widget_get_visible (widget))
+        gtk_widget_map (widget);
       else
-       gtk_widget_unmap (widget);
+        gtk_widget_unmap (widget);
     }
 
   gtk_widget_verify_invariants (widget);
@@ -6721,7 +6722,7 @@ gtk_widget_keynav_failed (GtkWidget        *widget,
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
   g_signal_emit (widget, widget_signals[KEYNAV_FAILED], 0,
-                direction, &return_val);
+                 direction, &return_val);
 
   return return_val;
 }
@@ -6762,9 +6763,9 @@ gtk_widget_error_bell (GtkWidget *widget)
 }
 
 static void
-gtk_widget_set_usize_internal (GtkWidget          *widget,
-                              int                 width,
-                              int                 height)
+gtk_widget_set_usize_internal (GtkWidget *widget,
+                               int        width,
+                               int        height)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   gboolean changed = FALSE;
@@ -6799,7 +6800,7 @@ gtk_widget_set_usize_internal (GtkWidget          *widget,
  * @height: height @widget should request, or -1 to unset
  *
  * Sets the minimum size of a widget; that is, the widget’s size
- * request will be at least @width by @height. You can use this 
+ * request will be at least @width by @height. You can use this
  * function to force a widget to be larger than it normally would be.
  *
  * In most cases, gtk_window_set_default_size() is a better choice for
@@ -6904,7 +6905,7 @@ gtk_widget_has_size_request (GtkWidget *widget)
  **/
 GtkWidget*
 gtk_widget_get_ancestor (GtkWidget *widget,
-                        GType      widget_type)
+                         GType      widget_type)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
@@ -6952,7 +6953,7 @@ gtk_widget_get_settings (GtkWidget *widget)
  **/
 gboolean
 gtk_widget_is_ancestor (GtkWidget *widget,
-                       GtkWidget *ancestor)
+                        GtkWidget *ancestor)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   g_return_val_if_fail (ancestor != NULL, FALSE);
@@ -7108,11 +7109,11 @@ gtk_widget_set_default_direction (GtkTextDirection dir)
       g_list_foreach (toplevels, (GFunc)g_object_ref, NULL);
 
       while (tmp_list)
-       {
-         gtk_widget_set_default_direction_recurse (tmp_list->data, old_dir);
-         g_object_unref (tmp_list->data);
-         tmp_list = tmp_list->next;
-       }
+      {
+        gtk_widget_set_default_direction_recurse (tmp_list->data, old_dir);
+        g_object_unref (tmp_list->data);
+        tmp_list = tmp_list->next;
+      }
 
       g_list_free (toplevels);
     }
@@ -7202,8 +7203,8 @@ typedef struct {
 } FinalizeAssertion;
 
 static void
-finalize_assertion_weak_ref (gpointer data,
-                            GObject *where_the_object_was)
+finalize_assertion_weak_ref (gpointer  data,
+                             GObject  *where_the_object_was)
 {
   FinalizeAssertion *assertion = (FinalizeAssertion *)data;
   assertion->did_finalize = TRUE;
@@ -7281,43 +7282,43 @@ gtk_widget_real_destroy (GtkWidget *object)
 
 #ifdef G_ENABLE_CONSISTENCY_CHECKS
       for (l = assertions; l; l = l->next)
-       {
-         FinalizeAssertion *assertion = l->data;
-
-         if (!assertion->did_finalize)
-           g_critical ("Automated component '%s' of class '%s' did not finalize in dispose()"
-                       "Current reference count is %d",
-                       assertion->child_class->name,
-                       g_type_name (assertion->widget_type),
-                       assertion->object->ref_count);
-
-         g_slice_free (FinalizeAssertion, assertion);
-       }
+        {
+          FinalizeAssertion *assertion = l->data;
+
+          if (!assertion->did_finalize)
+            g_critical ("Automated component '%s' of class '%s' did not finalize in dispose()"
+            "Current reference count is %d",
+            assertion->child_class->name,
+            g_type_name (assertion->widget_type),
+            assertion->object->ref_count);
+
+          g_slice_free (FinalizeAssertion, assertion);
+        }
       g_slist_free (assertions);
 #endif /* G_ENABLE_CONSISTENCY_CHECKS */
 
       /* Set any automatic private data pointers to NULL */
       for (class = GTK_WIDGET_GET_CLASS (widget);
-          GTK_IS_WIDGET_CLASS (class);
-          class = g_type_class_peek_parent (class))
-       {
-         if (!class->priv->template)
-           continue;
+           GTK_IS_WIDGET_CLASS (class);
+           class = g_type_class_peek_parent (class))
+        {
+          if (!class->priv->template)
+            continue;
 
-         for (l = class->priv->template->children; l; l = l->next)
-           {
-             AutomaticChildClass *child_class = l->data;
+          for (l = class->priv->template->children; l; l = l->next)
+            {
+              AutomaticChildClass *child_class = l->data;
 
-             if (child_class->offset != 0)
-               {
-                 gpointer field_p;
+              if (child_class->offset != 0)
+                {
+                  gpointer field_p;
 
-                 /* Nullify instance private data for internal children */
-                 field_p = G_STRUCT_MEMBER_P (widget, child_class->offset);
-                 (* (gpointer *) field_p) = NULL;
-               }
-           }
-       }
+                  /* Nullify instance private data for internal children */
+                  field_p = G_STRUCT_MEMBER_P (widget, child_class->offset);
+                  (* (gpointer *) field_p) = NULL;
+                }
+            }
+        }
     }
 
   /* Callers of add_mnemonic_label() should disconnect on ::destroy */
@@ -7616,9 +7617,9 @@ _gtk_widget_list_devices (GtkWidget *widget,
  */
 void
 _gtk_widget_synthesize_crossing (GtkWidget       *from,
-                                GtkWidget       *to,
+                                 GtkWidget       *to,
                                  GdkDevice       *device,
-                                GdkCrossingMode  mode)
+                                 GdkCrossingMode  mode)
 {
   GdkSurface *from_surface = NULL, *to_surface = NULL;
   GtkCrossingData crossing;
@@ -8321,7 +8322,7 @@ gtk_widget_buildable_interface_init (GtkBuildableIface *iface)
 
 static void
 gtk_widget_buildable_set_id (GtkBuildable *buildable,
-                              const char   *id)
+                             const char   *id)
 {
   g_object_set_qdata_full (G_OBJECT (buildable), quark_builder_set_id,
                            g_strdup (id), g_free);
@@ -8335,8 +8336,8 @@ gtk_widget_buildable_get_id (GtkBuildable *buildable)
 
 static GObject *
 gtk_widget_buildable_get_internal_child (GtkBuildable *buildable,
-                                        GtkBuilder   *builder,
-                                        const char   *childname)
+                                         GtkBuilder   *builder,
+                                         const char   *childname)
 {
   GtkWidgetClass *class;
   GSList *l;
@@ -8352,15 +8353,15 @@ gtk_widget_buildable_get_internal_child (GtkBuildable *buildable,
       GtkWidgetTemplate *template = class->priv->template;
 
       if (!template)
-       continue;
+        continue;
 
       for (l = template->children; l && internal_child_type == 0; l = l->next)
-       {
-         AutomaticChildClass *child_class = l->data;
+        {
+          AutomaticChildClass *child_class = l->data;
 
-         if (child_class->internal_child && strcmp (childname, child_class->name) == 0)
-           internal_child_type = G_OBJECT_CLASS_TYPE (class);
-       }
+          if (child_class->internal_child && strcmp (childname, child_class->name) == 0)
+            internal_child_type = G_OBJECT_CLASS_TYPE (class);
+        }
     }
 
   /* Now return the 'internal-child' from the class which declared it, note
@@ -8375,7 +8376,7 @@ gtk_widget_buildable_get_internal_child (GtkBuildable *buildable,
 
 static void
 gtk_widget_buildable_parser_finished (GtkBuildable *buildable,
-                                     GtkBuilder   *builder)
+                                      GtkBuilder   *builder)
 {
 }
 
@@ -9359,7 +9360,7 @@ gtk_widget_get_clipboard (GtkWidget *widget)
  * gtk_widget_get_primary_clipboard:
  * @widget: a #GtkWidget
  *
- * This is a utility function to get the primary clipboard object 
+ * This is a utility function to get the primary clipboard object
  * for the #GdkDisplay that @widget is using.
  *
  * Note that this function always works, even when @widget is not
@@ -9435,7 +9436,7 @@ gtk_widget_add_mnemonic_label (GtkWidget *widget,
   new_list = g_slist_prepend (old_list, label);
 
   g_object_set_qdata_full (G_OBJECT (widget), quark_mnemonic_labels,
-                          new_list, (GDestroyNotify) g_slist_free);
+                           new_list, (GDestroyNotify) g_slist_free);
 
   /* The ATContext takes ownership of the GList returned by list_mnemonic_labels(),
    * so we don't need to free it
@@ -9471,7 +9472,7 @@ gtk_widget_remove_mnemonic_label (GtkWidget *widget,
 
   if (new_list)
     g_object_set_qdata_full (G_OBJECT (widget), quark_mnemonic_labels,
-                            new_list, (GDestroyNotify) g_slist_free);
+                             new_list, (GDestroyNotify) g_slist_free);
 
   if (new_list != NULL && new_list->data != NULL)
     {
@@ -10386,7 +10387,7 @@ gtk_widget_ensure_resize (GtkWidget *widget)
 
 void
 _gtk_widget_add_sizegroup (GtkWidget    *widget,
-                          gpointer      group)
+                           gpointer      group)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GSList *groups;
@@ -10400,7 +10401,7 @@ _gtk_widget_add_sizegroup (GtkWidget    *widget,
 
 void
 _gtk_widget_remove_sizegroup (GtkWidget    *widget,
-                             gpointer      group)
+                              gpointer      group)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GSList *groups;
@@ -10669,34 +10670,10 @@ template_child_class_new (const char *name,
   return child_class;
 }
 
-static void
-template_child_class_free (AutomaticChildClass *child_class)
-{
-  if (child_class)
-    {
-      g_free (child_class->name);
-      g_slice_free (AutomaticChildClass, child_class);
-    }
-}
-
-static void
-template_data_free (GtkWidgetTemplate *template_data)
-{
-  if (template_data)
-    {
-      g_bytes_unref (template_data->data);
-      g_slist_free_full (template_data->children, (GDestroyNotify)template_child_class_free);
-
-      g_object_unref (template_data->scope);
-
-      g_slice_free (GtkWidgetTemplate, template_data);
-    }
-}
-
 static GHashTable *
 get_auto_child_hash (GtkWidget *widget,
-                    GType      type,
-                    gboolean   create)
+                     GType      type,
+                     gboolean   create)
 {
   GHashTable *auto_children;
   GHashTable *auto_child_hash;
@@ -10709,7 +10686,7 @@ get_auto_child_hash (GtkWidget *widget,
 
       auto_children = g_hash_table_new_full (g_direct_hash,
                                              NULL,
-                                            NULL, (GDestroyNotify)g_hash_table_destroy);
+                                             NULL, (GDestroyNotify)g_hash_table_destroy);
       g_object_set_qdata_full (G_OBJECT (widget),
                                quark_auto_children,
                                auto_children,
@@ -10722,13 +10699,13 @@ get_auto_child_hash (GtkWidget *widget,
   if (!auto_child_hash && create)
     {
       auto_child_hash = g_hash_table_new_full (g_str_hash,
-                                              g_str_equal,
-                                              NULL,
-                                              (GDestroyNotify)g_object_unref);
+                                               g_str_equal,
+                                               NULL,
+                                               (GDestroyNotify)g_object_unref);
 
       g_hash_table_insert (auto_children,
-                          GSIZE_TO_POINTER (type),
-                          auto_child_hash);
+                           GSIZE_TO_POINTER (type),
+                           auto_child_hash);
     }
 
   return auto_child_hash;
@@ -10748,7 +10725,7 @@ setup_template_child (GtkWidgetTemplate   *template_data,
   if (!object)
     {
       g_critical ("Unable to retrieve object '%s' from class template for type '%s' while building a '%s'",
-                 child_class->name, g_type_name (class_type), G_OBJECT_TYPE_NAME (widget));
+                  child_class->name, g_type_name (class_type), G_OBJECT_TYPE_NAME (widget));
       return FALSE;
     }
 
@@ -10821,13 +10798,13 @@ gtk_widget_init_template (GtkWidget *widget)
    * will validate that the template is created for the correct GType and assert that
    * there is no infinite recursion.
    */
-  if (!gtk_builder_extend_with_template  (builder, G_OBJECT (widget), class_type,
-                                         (const char *)g_bytes_get_data (template->data, NULL),
-                                         g_bytes_get_size (template->data),
-                                         &error))
+  if (!gtk_builder_extend_with_template (builder, G_OBJECT (widget), class_type,
+                                         (const char *)g_bytes_get_data (template->data, NULL),
+                                         g_bytes_get_size (template->data),
+                                         &error))
     {
       g_critical ("Error building template class '%s' for an instance of type '%s': %s",
-                 g_type_name (class_type), G_OBJECT_TYPE_NAME (object), error->message);
+                  g_type_name (class_type), G_OBJECT_TYPE_NAME (object), error->message);
       g_error_free (error);
 
       /* This should never happen, if the template XML cannot be built
@@ -10848,14 +10825,14 @@ gtk_widget_init_template (GtkWidget *widget)
        * invocations which may follow by reference in child classes.
        */
       if (!setup_template_child (template,
-                                 class_type,
-                                 child_class,
-                                 widget,
-                                 builder))
-       {
-         g_object_unref (builder);
-         return;
-       }
+                                 class_type,
+                                 child_class,
+                                 widget,
+                                 builder))
+        {
+          g_object_unref (builder);
+          return;
+        }
     }
 
   g_object_unref (builder);
@@ -10864,7 +10841,7 @@ gtk_widget_init_template (GtkWidget *widget)
 /**
  * gtk_widget_class_set_template:
  * @widget_class: A #GtkWidgetClass
- * @template_bytes: A #GBytes holding the #GtkBuilder XML 
+ * @template_bytes: A #GBytes holding the #GtkBuilder XML
  *
  * This should be called at class initialization time to specify
  * the GtkBuilder XML to be used to extend a widget.
@@ -10876,7 +10853,7 @@ gtk_widget_init_template (GtkWidget *widget)
  */
 void
 gtk_widget_class_set_template (GtkWidgetClass    *widget_class,
-                              GBytes            *template_bytes)
+                               GBytes            *template_bytes)
 {
   GBytes *data = NULL;
 
@@ -10918,7 +10895,7 @@ gtk_widget_class_set_template (GtkWidgetClass    *widget_class,
  */
 void
 gtk_widget_class_set_template_from_resource (GtkWidgetClass    *widget_class,
-                                            const char        *resource_name)
+                                             const char        *resource_name)
 {
   GError *error = NULL;
   GBytes *bytes = NULL;
@@ -10938,7 +10915,7 @@ gtk_widget_class_set_template_from_resource (GtkWidgetClass    *widget_class,
   if (!bytes)
     {
       g_critical ("Unable to load resource for composite template for type '%s': %s",
-                 G_OBJECT_CLASS_NAME (widget_class), error->message);
+                  G_OBJECT_CLASS_NAME (widget_class), error->message);
       g_error_free (error);
       return;
     }
@@ -11002,7 +10979,7 @@ gtk_widget_class_bind_template_callback_full (GtkWidgetClass *widget_class,
  */
 void
 gtk_widget_class_set_template_scope (GtkWidgetClass  *widget_class,
-                                    GtkBuilderScope *scope)
+                                     GtkBuilderScope *scope)
 {
   g_return_if_fail (GTK_IS_WIDGET_CLASS (widget_class));
   g_return_if_fail (widget_class->priv->template != NULL);
@@ -11537,12 +11514,12 @@ gtk_widget_child_observer_destroyed (gpointer widget)
  * gtk_widget_observe_children:
  * @widget: a #GtkWidget
  *
- * Returns a #GListModel to track the children of @widget. 
+ * Returns a #GListModel to track the children of @widget.
  *
  * Calling this function will enable extra internal bookkeeping to track
  * children and emit signals on the returned listmodel. It may slow down
  * operations a lot.
- * 
+ *
  * Applications should try hard to avoid calling this function because of
  * the slowdowns.
  *
@@ -11609,12 +11586,12 @@ gtk_widget_controller_list_get_item (gpointer item,
  * gtk_widget_observe_controllers:
  * @widget: a #GtkWidget
  *
- * Returns a #GListModel to track the #GtkEventControllers of @widget. 
+ * Returns a #GListModel to track the #GtkEventControllers of @widget.
  *
  * Calling this function will enable extra internal bookkeeping to track
  * controllers and emit signals on the returned listmodel. It may slow down
  * operations a lot.
- * 
+ *
  * Applications should try hard to avoid calling this function because of
  * the slowdowns.
  *
@@ -12048,9 +12025,9 @@ gtk_widget_set_can_target (GtkWidget *widget,
 /**
  * gtk_widget_get_can_target:
  * @widget: a #GtkWidget
- * 
+ *
  * Queries whether @widget can be the target of pointer events.
- * 
+ *
  * Returns: %TRUE if @widget can receive pointer events
  */
 gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]