After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694945 - Add API to reorder stack children
Add API to reorder stack children
Status: RESOLVED FIXED
Product: libgd
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: libgd maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-03-01 17:49 UTC by jessevdk@gmail.com
Modified: 2013-03-01 21:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Implemented gd_stack_reorder_child (5.33 KB, patch)
2013-03-01 17:49 UTC, jessevdk@gmail.com
none Details | Review
Implemented gd_stack_reorder_child (5.34 KB, patch)
2013-03-01 17:54 UTC, jessevdk@gmail.com
none Details | Review
Implemented gd_stack_reorder_child (7.44 KB, patch)
2013-03-01 19:19 UTC, jessevdk@gmail.com
none Details | Review
Implemented gd_stack_reorder_child (7.26 KB, patch)
2013-03-01 19:20 UTC, jessevdk@gmail.com
needs-work Details | Review
Implemented gd_stack_reorder_child (6.24 KB, patch)
2013-03-01 19:45 UTC, jessevdk@gmail.com
accepted-commit_now Details | Review

Description jessevdk@gmail.com 2013-03-01 17:49:49 UTC
This is similar to the reordering API of GtkBox and GtkNotebook.
GdStackSwitcher reorders its buttons accordingly.
Comment 1 jessevdk@gmail.com 2013-03-01 17:49:51 UTC
Created attachment 237726 [details] [review]
Implemented gd_stack_reorder_child
Comment 2 jessevdk@gmail.com 2013-03-01 17:54:35 UTC
Created attachment 237727 [details] [review]
Implemented gd_stack_reorder_child

This is similar to the reordering API of GtkBox and GtkNotebook.
GdStackSwitcher reorders its buttons accordingly.
Comment 3 jessevdk@gmail.com 2013-03-01 19:19:30 UTC
Created attachment 237733 [details] [review]
Implemented gd_stack_reorder_child

This is similar to the reordering API of GtkBox and GtkNotebook.
GdStackSwitcher reorders its buttons accordingly.
Comment 4 jessevdk@gmail.com 2013-03-01 19:20:40 UTC
Created attachment 237734 [details] [review]
Implemented gd_stack_reorder_child

This is similar to the reordering API of GtkBox and GtkNotebook.
GdStackSwitcher reorders its buttons accordingly.
Comment 5 Cosimo Cecchi 2013-03-01 19:36:26 UTC
Review of attachment 237734 [details] [review]:

Thanks, this looks mostly good. Some minor comments below.

::: libgd/gd-stack-switcher.c
@@ +157,3 @@
+  gtk_box_reorder_child (GTK_BOX (self), button, position);
+}
+  button = g_hash_table_lookup (self->priv->buttons, widget);

Extra newline here.

::: libgd/gd-stack.c
@@ +59,3 @@
   char *title;
   char *symbolic_icon_name;
+  guint position;

You register the property as int, so this should also be int.

@@ +437,3 @@
   switch (property_id)
     {
+      guint i;

Move this also at the top of the function

@@ +458,3 @@
+          ++i;
+        }
+        {

How can it happen that get_child_property is called but there are no children?

@@ +1028,3 @@
+  /* Loop to find the old position and link of child, new link of child and
+     total number of children. new_link will be NULL if the child should be
+  GdStackPrivate *priv;

We usually use this style for multiline comments:

/* Long comment that spans
 * multiple lines
 */

@@ +1048,3 @@
+            }
+
+

This appears to be unused.

::: libgd/gd-stack.h
@@ +82,3 @@
+void                  gd_stack_reorder_child           (GdStack               *stack,
+							GtkWidget             *child,
+							gint                   position);

This should be kept private for now, as for the discussion on IRC.
Comment 6 jessevdk@gmail.com 2013-03-01 19:45:40 UTC
Created attachment 237737 [details] [review]
Implemented gd_stack_reorder_child

This is similar to the reordering API of GtkBox and GtkNotebook.
GdStackSwitcher reorders its buttons accordingly.
Comment 7 Cosimo Cecchi 2013-03-01 20:00:34 UTC
Review of attachment 237737 [details] [review]:

Looks good to me, thanks!