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 703270 - add GPropertyAction
add GPropertyAction
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gapplication
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-06-28 16:18 UTC by Allison Karlitskaya (desrt)
Modified: 2013-07-11 16:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add GPropertyAction (30.77 KB, patch)
2013-06-28 16:18 UTC, Allison Karlitskaya (desrt)
needs-work Details | Review
add GPropertyAction (30.87 KB, patch)
2013-07-11 16:35 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2013-06-28 16:18:10 UTC
See patch.
Comment 1 Allison Karlitskaya (desrt) 2013-06-28 16:18:12 UTC
Created attachment 248001 [details] [review]
add GPropertyAction

Add a new type of GAction that represents the value of a property on an
object.  As an example, this might be used on the "visible-child-name"
property of a GtkStack.
Comment 2 Matthias Clasen 2013-06-28 17:33:34 UTC
Review of attachment 248001 [details] [review]:

::: gio/gpropertyaction.c
@@ +403,3 @@
+   *
+   * The name of the action.  This is mostly meaningful for identifying
+   * the action once it has been added to a #GPropertyActionGroup.

Whats a GPropertyActionGroup ?

@@ +533,3 @@
+*
+ * Returns: a new #GPropertyAction
+ *

Should this say that the property action takes a strong reference on the object ?
Comment 3 Allison Karlitskaya (desrt) 2013-06-28 18:32:19 UTC
Review of attachment 248001 [details] [review]:

::: gio/gpropertyaction.c
@@ +403,3 @@
+   *
+   * The name of the action.  This is mostly meaningful for identifying
+   * the action once it has been added to a #GPropertyActionGroup.

It is a sed error :)

@@ +533,3 @@
+*
+ * Returns: a new #GPropertyAction
+ *

Yes.  Probably should.

::: gio/gpropertyaction.h
@@ +37,3 @@
+                                                             G_TYPE_PROPERTY_ACTION))
+
+GLIB_AVAILABLE_IN_ALL

obvious mistake here, as well...
Comment 4 Lars Karlitski 2013-06-28 21:17:52 UTC
Review of attachment 248001 [details] [review]:

::: gio/gpropertyaction.c
@@ +157,3 @@
+g_property_action_get_enabled (GAction *action)
+{
+  return TRUE;

Actions could be disabled when the property is not writable.

@@ +208,3 @@
+      gboolean value;
+
+      g_return_if_fail (paction->pspec->value_type == G_TYPE_BOOLEAN && parameter == NULL);

That first condition is always true. Did you put it there so that error messages are more understandable?

@@ +273,3 @@
+  gchar *detailed;
+
+  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (paction->object), property_name);

You are printing a critical when this returns NULL, but no other function checks it for NULL. Are you okay with it blowing up? You could check whether the property exists in g_property_action_new().

::: gio/gpropertyaction.h
@@ +1,2 @@
+/*
+ * Copyright © 2010 Codethink Limited

You wrote that three years ago? :P
Comment 5 Allison Karlitskaya (desrt) 2013-07-11 16:35:30 UTC
Review of attachment 248001 [details] [review]:

::: gio/gpropertyaction.c
@@ +157,3 @@
+g_property_action_get_enabled (GAction *action)
+{
+  return TRUE;

I want to wait for someone to request this feature.  I don't think that a real usecase exists for it.

@@ +208,3 @@
+      gboolean value;
+
+      g_return_if_fail (paction->pspec->value_type == G_TYPE_BOOLEAN && parameter == NULL);

Yes.

@@ +273,3 @@
+  gchar *detailed;
+
+  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (paction->object), property_name);

I just want to get a critical onto the screen at the point that we first notice the problem.  Things may well crash later, but at least they will know why (and be able to easily get a backtrace from the source of the problem).

I don't really feel like adding insane levels of extra checking everywhere to detect and re-detect programmer error...
Comment 6 Allison Karlitskaya (desrt) 2013-07-11 16:35:56 UTC
Created attachment 248942 [details] [review]
add GPropertyAction

Add a new type of GAction that represents the value of a property on an
object.  As an example, this might be used on the "visible-child-name"
property of a GtkStack.
Comment 7 Allison Karlitskaya (desrt) 2013-07-11 16:36:10 UTC
Attachment 248942 [details] pushed as f77e121 - add GPropertyAction