[gtk/nbpage: 13/21] Implement position property somewhat



commit f64b0a705e8e656a0ca767ff93fd3f305ad6820a
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 20 22:25:54 2019 -0500

    Implement position property somewhat

 gtk/gtknotebook.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 34ee81199c..f1159db721 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -392,10 +392,14 @@ gtk_notebook_page_set_property (GObject      *object,
       break;
 
     case CHILD_PROP_POSITION:
-#if 0
-      gtk_notebook_reorder_child (GTK_NOTEBOOK (container), child,
-                                  g_value_get_int (value));
-#endif
+      {
+        GtkNotebook *notebook = NULL;
+        if (page->tab_widget)
+          notebook = GTK_NOTEBOOK (g_object_get_data (G_OBJECT (page->tab_widget), "notebook"));
+
+        if (notebook)
+          gtk_notebook_reorder_child (notebook, page->child, g_value_get_int (value));
+      }
       break;
 
     case CHILD_PROP_TAB_EXPAND:
@@ -451,9 +455,14 @@ gtk_notebook_page_get_property (GObject    *object,
       break;
 
     case CHILD_PROP_POSITION:
-#if 0
-      g_value_set_int (value, g_list_position (priv->children, list));
-#endif
+      {
+        GtkNotebook *notebook = NULL;
+        if (page->tab_widget)
+          notebook = GTK_NOTEBOOK (g_object_get_data (G_OBJECT (page->tab_widget), "notebook"));
+
+        if (notebook)
+          g_value_set_int (value, g_list_index (notebook->priv->children, page));
+      }
       break;
 
     case CHILD_PROP_TAB_EXPAND:


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