[gnome-todo] Rename GtdTextWidthLayout to GtdMaxSizeLayout



commit c0c26f03025709c92b6346b7f39e9011b252afad
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu May 7 22:12:28 2020 -0300

    Rename GtdTextWidthLayout to GtdMaxSizeLayout

 src/gnome-todo.h                                   |   2 +-
 ...d-text-width-layout.c => gtd-max-size-layout.c} | 122 ++++++++++-----------
 ...d-text-width-layout.h => gtd-max-size-layout.h} |  16 +--
 src/gtd-omni-area.c                                |   4 +-
 src/gtd-omni-area.ui                               |   2 +-
 src/meson.build                                    |   8 +-
 src/plugins/task-lists-workspace/gtd-sidebar.c     |   4 +-
 src/plugins/task-lists-workspace/gtd-sidebar.ui    |   2 +-
 8 files changed, 80 insertions(+), 80 deletions(-)
---
diff --git a/src/gnome-todo.h b/src/gnome-todo.h
index 3bb6434..ba8f1f7 100644
--- a/src/gnome-todo.h
+++ b/src/gnome-todo.h
@@ -27,6 +27,7 @@
 #include "gtd-list-model-sort.h"
 #include "gtd-list-store.h"
 #include "gtd-manager.h"
+#include "gtd-max-size-layout.h"
 #include "gtd-menu-button.h"
 #include "gtd-notification.h"
 #include "gtd-object.h"
@@ -39,7 +40,6 @@
 #include "gtd-task.h"
 #include "gtd-task-list.h"
 #include "gtd-task-list-view.h"
-#include "gtd-text-width-layout.h"
 #include "gtd-types.h"
 #include "gtd-utils.h"
 #include "gtd-widget.h"
diff --git a/src/gtd-text-width-layout.c b/src/gtd-max-size-layout.c
similarity index 66%
rename from src/gtd-text-width-layout.c
rename to src/gtd-max-size-layout.c
index 2cca130..b88c3d0 100644
--- a/src/gtd-text-width-layout.c
+++ b/src/gtd-max-size-layout.c
@@ -1,4 +1,4 @@
-/* gtd-text-width-layout.c
+/* gtd-max-size-layout.c
  *
  * Copyright 2020 Georges Basile Stavracas Neto <georges stavracas gmail com>
  *
@@ -18,9 +18,9 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "gtd-text-width-layout.h"
+#include "gtd-max-size-layout.h"
 
-struct _GtdTextWidthLayout
+struct _GtdMaxSizeLayout
 {
   GtkLayoutManager    parent;
 
@@ -28,7 +28,7 @@ struct _GtdTextWidthLayout
   gint                width_chars;
 };
 
-G_DEFINE_TYPE (GtdTextWidthLayout, gtd_text_width_layout, GTK_TYPE_LAYOUT_MANAGER)
+G_DEFINE_TYPE (GtdMaxSizeLayout, gtd_max_size_layout, GTK_TYPE_LAYOUT_MANAGER)
 
 enum
 {
@@ -46,16 +46,16 @@ static GParamSpec *properties [N_PROPS];
  */
 
 static void
-gtd_text_width_layout_measure (GtkLayoutManager *layout_manager,
-                               GtkWidget        *widget,
-                               GtkOrientation    orientation,
-                               gint              for_size,
-                               gint             *minimum,
-                               gint             *natural,
-                               gint             *minimum_baseline,
-                               gint             *natural_baseline)
+gtd_max_size_layout_measure (GtkLayoutManager *layout_manager,
+                             GtkWidget        *widget,
+                             GtkOrientation    orientation,
+                             gint              for_size,
+                             gint             *minimum,
+                             gint             *natural,
+                             gint             *minimum_baseline,
+                             gint             *natural_baseline)
 {
-  GtdTextWidthLayout *self = (GtdTextWidthLayout *)layout_manager;
+  GtdMaxSizeLayout *self = (GtdMaxSizeLayout *)layout_manager;
   GtkWidget *child;
 
   for (child = gtk_widget_get_first_child (widget);
@@ -114,11 +114,11 @@ gtd_text_width_layout_measure (GtkLayoutManager *layout_manager,
 }
 
 static void
-gtd_text_width_layout_allocate (GtkLayoutManager *layout_manager,
-                                GtkWidget        *widget,
-                                gint              width,
-                                gint              height,
-                                gint              baseline)
+gtd_max_size_layout_allocate (GtkLayoutManager *layout_manager,
+                              GtkWidget        *widget,
+                              gint              width,
+                              gint              height,
+                              gint              baseline)
 {
   GtkWidget *child;
 
@@ -137,12 +137,12 @@ gtd_text_width_layout_allocate (GtkLayoutManager *layout_manager,
  */
 
 static void
-gtd_text_width_layout_get_property (GObject    *object,
-                                    guint       prop_id,
-                                    GValue     *value,
-                                    GParamSpec *pspec)
+gtd_max_size_layout_get_property (GObject    *object,
+                                  guint       prop_id,
+                                  GValue     *value,
+                                  GParamSpec *pspec)
 {
-  GtdTextWidthLayout *self = GTD_TEXT_WIDTH_LAYOUT (object);
+  GtdMaxSizeLayout *self = GTD_MAX_SIZE_LAYOUT (object);
 
   switch (prop_id)
     {
@@ -160,21 +160,21 @@ gtd_text_width_layout_get_property (GObject    *object,
 }
 
 static void
-gtd_text_width_layout_set_property (GObject      *object,
-                                    guint         prop_id,
-                                    const GValue *value,
-                                    GParamSpec   *pspec)
+gtd_max_size_layout_set_property (GObject      *object,
+                                  guint         prop_id,
+                                  const GValue *value,
+                                  GParamSpec   *pspec)
 {
-  GtdTextWidthLayout *self = GTD_TEXT_WIDTH_LAYOUT (object);
+  GtdMaxSizeLayout *self = GTD_MAX_SIZE_LAYOUT (object);
 
   switch (prop_id)
     {
     case PROP_MAX_WIDTH_CHARS:
-      gtd_text_width_layout_set_max_width_chars (self, g_value_get_int (value));
+      gtd_max_size_layout_set_max_width_chars (self, g_value_get_int (value));
       break;
 
     case PROP_WIDTH_CHARS:
-      gtd_text_width_layout_set_width_chars (self, g_value_get_int (value));
+      gtd_max_size_layout_set_width_chars (self, g_value_get_int (value));
       break;
 
     default:
@@ -183,19 +183,19 @@ gtd_text_width_layout_set_property (GObject      *object,
 }
 
 static void
-gtd_text_width_layout_class_init (GtdTextWidthLayoutClass *klass)
+gtd_max_size_layout_class_init (GtdMaxSizeLayoutClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkLayoutManagerClass *layout_manager_class = GTK_LAYOUT_MANAGER_CLASS (klass);
 
-  layout_manager_class->measure = gtd_text_width_layout_measure;
-  layout_manager_class->allocate = gtd_text_width_layout_allocate;
+  layout_manager_class->measure = gtd_max_size_layout_measure;
+  layout_manager_class->allocate = gtd_max_size_layout_allocate;
 
-  object_class->get_property = gtd_text_width_layout_get_property;
-  object_class->set_property = gtd_text_width_layout_set_property;
+  object_class->get_property = gtd_max_size_layout_get_property;
+  object_class->set_property = gtd_max_size_layout_set_property;
 
   /**
-   * GtdTextWidthLayout:max-width-chars:
+   * GtdMaxSizeLayout:max-width-chars:
    *
    * Sets the maximum size of the #GtkWidget in characters.
    */
@@ -208,7 +208,7 @@ gtd_text_width_layout_class_init (GtdTextWidthLayoutClass *klass)
                                                        G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | 
G_PARAM_STATIC_STRINGS);
 
   /**
-   * GtdTextWidthLayout:width-chars:
+   * GtdMaxSizeLayout:width-chars:
    *
    * Sets the size of the #GtkWidget in characters.
    */
@@ -224,53 +224,53 @@ gtd_text_width_layout_class_init (GtdTextWidthLayoutClass *klass)
 }
 
 static void
-gtd_text_width_layout_init (GtdTextWidthLayout *self)
+gtd_max_size_layout_init (GtdMaxSizeLayout *self)
 {
   self->max_width_chars = -1;
   self->width_chars = -1;
 }
 
 /**
- * gtd_text_width_layout_new:
+ * gtd_max_size_layout_new:
  *
- * Creates a new #GtdTextWidthLayout.
+ * Creates a new #GtdMaxSizeLayout.
  *
- * Returns: (transfer full): a #GtdTextWidthLayout
+ * Returns: (transfer full): a #GtdMaxSizeLayout
  */
 GtkLayoutManager*
-gtd_text_width_layout_new (void)
+gtd_max_size_layout_new (void)
 {
-  return g_object_new (GTD_TYPE_TEXT_WIDTH_LAYOUT, NULL);
+  return g_object_new (GTD_TYPE_MAX_SIZE_LAYOUT, NULL);
 }
 
 /**
- * gtd_text_width_layout_get_max_width_chars:
+ * gtd_max_size_layout_get_max_width_chars:
  *
  * Retrieves the maximum width in characters of @self.
  *
  * Returns: maximum width in characters
  */
 gint
-gtd_text_width_layout_get_max_width_chars (GtdTextWidthLayout *self)
+gtd_max_size_layout_get_max_width_chars (GtdMaxSizeLayout *self)
 {
-  g_return_val_if_fail (GTD_IS_TEXT_WIDTH_LAYOUT (self), -1);
+  g_return_val_if_fail (GTD_IS_MAX_SIZE_LAYOUT (self), -1);
 
   return self->max_width_chars;
 }
 
 /**
- * gtd_text_width_layout_set_max_width_chars:
- * @self: a #GtdTextWidthLayout
+ * gtd_max_size_layout_set_max_width_chars:
+ * @self: a #GtdMaxSizeLayout
  * @with_chars: maximum width of the widget @self is attached to, in character length
  *
  * Sets the maximum width @self has, in characters length. It is a programming
- * error to set a value smaller than #GtdTextWidthLayout:width-layout.
+ * error to set a value smaller than #GtdMaxSizeLayout:width-layout.
  */
 void
-gtd_text_width_layout_set_max_width_chars (GtdTextWidthLayout *self,
-                                           gint                max_width_chars)
+gtd_max_size_layout_set_max_width_chars (GtdMaxSizeLayout *self,
+                                         gint              max_width_chars)
 {
-  g_return_if_fail (GTD_IS_TEXT_WIDTH_LAYOUT (self));
+  g_return_if_fail (GTD_IS_MAX_SIZE_LAYOUT (self));
   g_return_if_fail (max_width_chars >= -1);
   g_return_if_fail (self->width_chars == -1 || max_width_chars >= self->width_chars);
 
@@ -284,33 +284,33 @@ gtd_text_width_layout_set_max_width_chars (GtdTextWidthLayout *self,
 }
 
 /**
- * gtd_text_width_layout_get_width_chars:
+ * gtd_max_size_layout_get_width_chars:
  *
  * Retrieves the minimum width in characters of @self.
  *
  * Returns: minimum width in characters
  */
 gint
-gtd_text_width_layout_get_width_chars (GtdTextWidthLayout *self)
+gtd_max_size_layout_get_width_chars (GtdMaxSizeLayout *self)
 {
-  g_return_val_if_fail (GTD_IS_TEXT_WIDTH_LAYOUT (self), -1);
+  g_return_val_if_fail (GTD_IS_MAX_SIZE_LAYOUT (self), -1);
 
   return self->width_chars;
 }
 
 /**
- * gtd_text_width_layout_set_width_chars:
- * @self: a #GtdTextWidthLayout
+ * gtd_max_size_layout_set_width_chars:
+ * @self: a #GtdMaxSizeLayout
  * @with_chars: minimum width of the widget @self is attached to, in character length
  *
  * Sets the minimum width @self has, in characters length. It is a programming
- * error to set a value bigger than #GtdTextWidthLayout:max-width-layout.
+ * error to set a value bigger than #GtdMaxSizeLayout:max-width-layout.
  */
 void
-gtd_text_width_layout_set_width_chars (GtdTextWidthLayout *self,
-                                       gint                width_chars)
+gtd_max_size_layout_set_width_chars (GtdMaxSizeLayout *self,
+                                     gint              width_chars)
 {
-  g_return_if_fail (GTD_IS_TEXT_WIDTH_LAYOUT (self));
+  g_return_if_fail (GTD_IS_MAX_SIZE_LAYOUT (self));
   g_return_if_fail (width_chars >= -1);
   g_return_if_fail (self->max_width_chars == -1 || width_chars <= self->max_width_chars);
 
diff --git a/src/gtd-text-width-layout.h b/src/gtd-max-size-layout.h
similarity index 62%
rename from src/gtd-text-width-layout.h
rename to src/gtd-max-size-layout.h
index f7754a7..c91c0fe 100644
--- a/src/gtd-text-width-layout.h
+++ b/src/gtd-max-size-layout.h
@@ -1,4 +1,4 @@
-/* gtd-text-width-layout.h
+/* gtd-max-size-layout.h
  *
  * Copyright 2020 Georges Basile Stavracas Neto <georges stavracas gmail com>
  *
@@ -24,19 +24,19 @@
 
 G_BEGIN_DECLS
 
-#define GTD_TYPE_TEXT_WIDTH_LAYOUT (gtd_text_width_layout_get_type())
-G_DECLARE_FINAL_TYPE (GtdTextWidthLayout, gtd_text_width_layout, GTD, TEXT_WIDTH_LAYOUT, GtkLayoutManager)
+#define GTD_TYPE_MAX_SIZE_LAYOUT (gtd_max_size_layout_get_type())
+G_DECLARE_FINAL_TYPE (GtdMaxSizeLayout, gtd_max_size_layout, GTD, MAX_SIZE_LAYOUT, GtkLayoutManager)
 
-GtkLayoutManager*    gtd_text_width_layout_new                   (void);
+GtkLayoutManager*    gtd_max_size_layout_new                     (void);
 
-gint                 gtd_text_width_layout_get_max_width_chars   (GtdTextWidthLayout *self);
+gint                 gtd_max_size_layout_get_max_width_chars     (GtdMaxSizeLayout   *self);
 
-void                 gtd_text_width_layout_set_max_width_chars   (GtdTextWidthLayout *self,
+void                 gtd_max_size_layout_set_max_width_chars     (GtdMaxSizeLayout   *self,
                                                                   gint                max_width_chars);
 
-gint                 gtd_text_width_layout_get_width_chars       (GtdTextWidthLayout *self);
+gint                 gtd_max_size_layout_get_width_chars         (GtdMaxSizeLayout   *self);
 
-void                 gtd_text_width_layout_set_width_chars       (GtdTextWidthLayout *self,
+void                 gtd_max_size_layout_set_width_chars         (GtdMaxSizeLayout   *self,
                                                                   gint                width_chars);
 
 G_END_DECLS
diff --git a/src/gtd-omni-area.c b/src/gtd-omni-area.c
index f54006e..a4f05c7 100644
--- a/src/gtd-omni-area.c
+++ b/src/gtd-omni-area.c
@@ -23,8 +23,8 @@
 #include "gtd-omni-area.h"
 
 #include "gtd-debug.h"
+#include "gtd-max-size-layout.h"
 #include "gtd-omni-area-addin.h"
-#include "gtd-text-width-layout.h"
 
 #include <libpeas/peas.h>
 
@@ -137,7 +137,7 @@ gtd_omni_area_class_init (GtdOmniAreaClass *klass)
   object_class->dispose = gtd_omni_area_dispose;
   object_class->finalize = gtd_omni_area_finalize;
 
-  g_type_ensure (GTD_TYPE_TEXT_WIDTH_LAYOUT);
+  g_type_ensure (GTD_TYPE_MAX_SIZE_LAYOUT);
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/todo/ui/gtd-omni-area.ui");
 
diff --git a/src/gtd-omni-area.ui b/src/gtd-omni-area.ui
index 4d9b197..ea79f1f 100644
--- a/src/gtd-omni-area.ui
+++ b/src/gtd-omni-area.ui
@@ -17,7 +17,7 @@
           <object class="GtkFrame">
             <property name="css-name"></property>
             <property name="layout-manager">
-              <object class="GtdTextWidthLayout">
+              <object class="GtdMaxSizeLayout">
                 <property name="width-chars">25</property>
                 <property name="max-width-chars">40</property>
               </object>
diff --git a/src/meson.build b/src/meson.build
index 09663cc..c1f0f65 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -63,12 +63,12 @@ headers = enum_headers + files(
   'widgets/gtd-menu-button.h',
   'widgets/gtd-star-widget.h',
   'gtd-clock.h',
+  'gtd-max-size-layout.h',
   'gtd-object.h',
   'gtd-omni-area.h',
   'gtd-omni-area-addin.h',
   'gtd-task.h',
   'gtd-task-list.h',
-  'gtd-text-width-layout.h',
   'gtd-types.h',
   'gtd-utils.h',
   'gtd-widget.h',
@@ -115,6 +115,7 @@ sources += files(
   'gtd-initial-setup-window.c',
   'gtd-clock.c',
   'gtd-css-provider.c',
+  'gtd-max-size-layout.c',
   'gtd-object.c',
   'gtd-omni-area.c',
   'gtd-omni-area-addin.c',
@@ -123,7 +124,6 @@ sources += files(
   'gtd-rows-common.c',
   'gtd-task.c',
   'gtd-task-list.c',
-  'gtd-text-width-layout.c',
   'gtd-theme-manager.c',
   'gtd-utils.c',
   'gtd-widget.c',
@@ -274,6 +274,8 @@ if get_option('introspection')
     'gtd-enums.h',
     'gtd-clock.c',
     'gtd-clock.h',
+    'gtd-max-size-layout.c',
+    'gtd-max-size-layout.h',
     'gtd-object.c',
     'gtd-object.h',
     'gtd-omni-area.c',
@@ -284,8 +286,6 @@ if get_option('introspection')
     'gtd-task.h',
     'gtd-task-list.c',
     'gtd-task-list.h',
-    'gtd-text-width-layout.c',
-    'gtd-text-width-layout.h',
     'gtd-types.h',
     'gtd-widget.c',
     'gtd-widget.h',
diff --git a/src/plugins/task-lists-workspace/gtd-sidebar.c b/src/plugins/task-lists-workspace/gtd-sidebar.c
index 6380d4f..6a5971c 100644
--- a/src/plugins/task-lists-workspace/gtd-sidebar.c
+++ b/src/plugins/task-lists-workspace/gtd-sidebar.c
@@ -22,6 +22,7 @@
 
 #include "gtd-debug.h"
 #include "gtd-manager.h"
+#include "gtd-max-size-layout.h"
 #include "gtd-panel.h"
 #include "gtd-provider.h"
 #include "gtd-sidebar.h"
@@ -30,7 +31,6 @@
 #include "gtd-sidebar-provider-row.h"
 #include "gtd-task-list.h"
 #include "gtd-task-list-panel.h"
-#include "gtd-text-width-layout.h"
 #include "gtd-utils.h"
 #include "notification/gtd-notification.h"
 
@@ -819,7 +819,7 @@ gtd_sidebar_class_init (GtdSidebarClass *klass)
 
   object_class->constructed = gtd_sidebar_constructed;
 
-  g_type_ensure (GTD_TYPE_TEXT_WIDTH_LAYOUT);
+  g_type_ensure (GTD_TYPE_MAX_SIZE_LAYOUT);
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/todo/plugins/task-lists-workspace/gtd-sidebar.ui");
 
diff --git a/src/plugins/task-lists-workspace/gtd-sidebar.ui b/src/plugins/task-lists-workspace/gtd-sidebar.ui
index e32d520..4c7a19e 100644
--- a/src/plugins/task-lists-workspace/gtd-sidebar.ui
+++ b/src/plugins/task-lists-workspace/gtd-sidebar.ui
@@ -3,7 +3,7 @@
   <template class="GtdSidebar" parent="GtdWidget">
     <property name="hexpand">0</property>
     <property name="layout-manager">
-      <object class="GtdTextWidthLayout">
+      <object class="GtdMaxSizeLayout">
         <property name="width-chars">35</property>
         <property name="max-width-chars">35</property>
       </object>


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