[libhandy] expander-row: Drop the title prop and its accessors



commit c8a172dca4a4a9e32cd9772f8839920ea947fbbe
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Jul 27 09:57:42 2020 +0200

    expander-row: Drop the title prop and its accessors
    
    Use the title property inherited from HdyPreferencesRow instead.
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/258

 debian/libhandy-1-0.symbols |  2 --
 src/hdy-expander-row.c      | 67 ---------------------------------------------
 src/hdy-expander-row.h      |  6 ----
 src/hdy-expander-row.ui     |  1 +
 tests/test-expander-row.c   | 16 -----------
 5 files changed, 1 insertion(+), 91 deletions(-)
---
diff --git a/debian/libhandy-1-0.symbols b/debian/libhandy-1-0.symbols
index 5e9320bf..353a872a 100644
--- a/debian/libhandy-1-0.symbols
+++ b/debian/libhandy-1-0.symbols
@@ -106,7 +106,6 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
  hdy_expander_row_get_icon_name@LIBHANDY_1_0 0.80.0
  hdy_expander_row_get_show_enable_switch@LIBHANDY_1_0 0.0.6
  hdy_expander_row_get_subtitle@LIBHANDY_1_0 0.80.0
- hdy_expander_row_get_title@LIBHANDY_1_0 0.80.0
  hdy_expander_row_get_type@LIBHANDY_1_0 0.0.6
  hdy_expander_row_get_use_underline@LIBHANDY_1_0 0.80.0
  hdy_expander_row_new@LIBHANDY_1_0 0.0.6
@@ -115,7 +114,6 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
  hdy_expander_row_set_icon_name@LIBHANDY_1_0 0.80.0
  hdy_expander_row_set_show_enable_switch@LIBHANDY_1_0 0.0.6
  hdy_expander_row_set_subtitle@LIBHANDY_1_0 0.80.0
- hdy_expander_row_set_title@LIBHANDY_1_0 0.80.0
  hdy_expander_row_set_use_underline@LIBHANDY_1_0 0.80.0
  hdy_get_enable_animations@LIBHANDY_1_0 0.0.11
  hdy_header_bar_get_centering_policy@LIBHANDY_1_0 0.0.10
diff --git a/src/hdy-expander-row.c b/src/hdy-expander-row.c
index 7c577a16..a6a7f5e1 100644
--- a/src/hdy-expander-row.c
+++ b/src/hdy-expander-row.c
@@ -65,7 +65,6 @@ static GtkBuildableIface *parent_buildable_iface;
 
 enum {
   PROP_0,
-  PROP_TITLE,
   PROP_SUBTITLE,
   PROP_USE_UNDERLINE,
   PROP_ICON_NAME,
@@ -118,9 +117,6 @@ hdy_expander_row_get_property (GObject    *object,
   HdyExpanderRow *self = HDY_EXPANDER_ROW (object);
 
   switch (prop_id) {
-  case PROP_TITLE:
-    g_value_set_string (value, hdy_expander_row_get_title (self));
-    break;
   case PROP_SUBTITLE:
     g_value_set_string (value, hdy_expander_row_get_subtitle (self));
     break;
@@ -153,9 +149,6 @@ hdy_expander_row_set_property (GObject      *object,
   HdyExpanderRow *self = HDY_EXPANDER_ROW (object);
 
   switch (prop_id) {
-  case PROP_TITLE:
-    hdy_expander_row_set_title (self, g_value_get_string (value));
-    break;
   case PROP_SUBTITLE:
     hdy_expander_row_set_subtitle (self, g_value_get_string (value));
     break;
@@ -280,20 +273,6 @@ hdy_expander_row_class_init (HdyExpanderRowClass *klass)
   container_class->remove = hdy_expander_row_remove;
   container_class->forall = hdy_expander_row_forall;
 
-  /**
-   * HdyExpanderRow:title:
-   *
-   * The title for this row.
-   *
-   * Since: 1.0
-   */
-  props[PROP_TITLE] =
-    g_param_spec_string ("title",
-                         _("Title"),
-                         _("The title for this row"),
-                         "",
-                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
-
   /**
    * HdyExpanderRow:subtitle:
    *
@@ -393,7 +372,6 @@ func (gpointer this) { \
   g_object_notify_by_pspec (G_OBJECT (this), props[prop]); \
 } \
 
-NOTIFY (notify_title_cb, PROP_TITLE);
 NOTIFY (notify_subtitle_cb, PROP_SUBTITLE);
 NOTIFY (notify_use_underline_cb, PROP_USE_UNDERLINE);
 NOTIFY (notify_icon_name_cb, PROP_ICON_NAME);
@@ -410,7 +388,6 @@ hdy_expander_row_init (HdyExpanderRow *self)
   hdy_expander_row_set_enable_expansion (self, TRUE);
   hdy_expander_row_set_expanded (self, FALSE);
 
-  g_signal_connect_object (priv->action_row, "notify::title", G_CALLBACK (notify_title_cb), self, 
G_CONNECT_SWAPPED);
   g_signal_connect_object (priv->action_row, "notify::subtitle", G_CALLBACK (notify_subtitle_cb), self, 
G_CONNECT_SWAPPED);
   g_signal_connect_object (priv->action_row, "notify::use-underline", G_CALLBACK (notify_use_underline_cb), 
self, G_CONNECT_SWAPPED);
   g_signal_connect_object (priv->action_row, "notify::icon-name", G_CALLBACK (notify_icon_name_cb), self, 
G_CONNECT_SWAPPED);
@@ -457,50 +434,6 @@ hdy_expander_row_new (void)
   return g_object_new (HDY_TYPE_EXPANDER_ROW, NULL);
 }
 
-/**
- * hdy_expander_row_get_title:
- * @self: a #HdyExpanderRow
- *
- * Gets the title for @self.
- *
- * Returns: the title for @self.
- *
- * Since: 1.0
- */
-const gchar *
-hdy_expander_row_get_title (HdyExpanderRow *self)
-{
-  HdyExpanderRowPrivate *priv;
-
-  g_return_val_if_fail (HDY_IS_EXPANDER_ROW (self), NULL);
-
-  priv = hdy_expander_row_get_instance_private (self);
-
-  return hdy_preferences_row_get_title (HDY_PREFERENCES_ROW (priv->action_row));
-}
-
-/**
- * hdy_expander_row_set_title:
- * @self: a #HdyExpanderRow
- * @title: the title
- *
- * Sets the title for @self.
- *
- * Since: 1.0
- */
-void
-hdy_expander_row_set_title (HdyExpanderRow *self,
-                            const gchar    *title)
-{
-  HdyExpanderRowPrivate *priv;
-
-  g_return_if_fail (HDY_IS_EXPANDER_ROW (self));
-
-  priv = hdy_expander_row_get_instance_private (self);
-
-  hdy_preferences_row_set_title (HDY_PREFERENCES_ROW (priv->action_row), title);
-}
-
 /**
  * hdy_expander_row_get_subtitle:
  * @self: a #HdyExpanderRow
diff --git a/src/hdy-expander-row.h b/src/hdy-expander-row.h
index e54e0ffd..295f1d02 100644
--- a/src/hdy-expander-row.h
+++ b/src/hdy-expander-row.h
@@ -37,12 +37,6 @@ struct _HdyExpanderRowClass
 HDY_AVAILABLE_IN_ALL
 GtkWidget   *hdy_expander_row_new (void);
 
-HDY_AVAILABLE_IN_ALL
-const gchar *hdy_expander_row_get_title (HdyExpanderRow *self);
-HDY_AVAILABLE_IN_ALL
-void         hdy_expander_row_set_title (HdyExpanderRow *self,
-                                         const gchar    *title);
-
 HDY_AVAILABLE_IN_ALL
 const gchar *hdy_expander_row_get_subtitle (HdyExpanderRow *self);
 HDY_AVAILABLE_IN_ALL
diff --git a/src/hdy-expander-row.ui b/src/hdy-expander-row.ui
index 0c3a7cb3..54d26507 100644
--- a/src/hdy-expander-row.ui
+++ b/src/hdy-expander-row.ui
@@ -36,6 +36,7 @@
                 <!-- The header row must be focusable for keyboard navigation to
                      work as expected. -->
                 <property name="can-focus">True</property>
+                <property name="title" bind-source="HdyExpanderRow" bind-property="title" 
bind-flags="sync-create"/>
                 <property name="visible">True</property>
                 <style>
                   <class name="header"/>
diff --git a/tests/test-expander-row.c b/tests/test-expander-row.c
index cb945d37..69412459 100644
--- a/tests/test-expander-row.c
+++ b/tests/test-expander-row.c
@@ -24,21 +24,6 @@ test_hdy_expander_row_add (void)
 }
 
 
-static void
-test_hdy_expander_row_title (void)
-{
-  g_autoptr (HdyExpanderRow) row = NULL;
-
-  row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
-  g_assert_nonnull (row);
-
-  g_assert_cmpstr (hdy_expander_row_get_title (row), ==, "");
-
-  hdy_expander_row_set_title (row, "Dummy title");
-  g_assert_cmpstr (hdy_expander_row_get_title (row), ==, "Dummy title");
-}
-
-
 static void
 test_hdy_expander_row_subtitle (void)
 {
@@ -158,7 +143,6 @@ main (gint argc,
   hdy_init ();
 
   g_test_add_func("/Handy/ExpanderRow/add", test_hdy_expander_row_add);
-  g_test_add_func("/Handy/ExpanderRow/title", test_hdy_expander_row_title);
   g_test_add_func("/Handy/ExpanderRow/subtitle", test_hdy_expander_row_subtitle);
   g_test_add_func("/Handy/ExpanderRow/icon_name", test_hdy_expander_row_icon_name);
   g_test_add_func("/Handy/ExpanderRow/use_underline", test_hdy_expander_row_use_undeline);


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