[gtk/mjog/mute-actionhelper-null-target-warning] actionhelper: Mute warnings for actions with null targets



commit b0a5fcf5e5fe6dbd64198d242021fe207e2ad27c
Author: Michael Gratton <mike vee net>
Date:   Wed Oct 30 16:02:12 2019 +1100

    actionhelper: Mute warnings for actions with null targets
    
    There's currently no way for actions parameterised with a target to be
    disabled on a per-target basis, except by setting the target to be
    null. This causes actionhelper to mark the associated widget as
    insensitive as desired, but also print a warning about the target's
    type being invalid.
    
    This patch mutes the warning only in case the target is null, if the
    target is otherwise the incorrect type then the warning will still be
    printed.

 gtk/gtkactionhelper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gtk/gtkactionhelper.c b/gtk/gtkactionhelper.c
index c5f4356b2b..4e2931a31a 100644
--- a/gtk/gtkactionhelper.c
+++ b/gtk/gtkactionhelper.c
@@ -145,7 +145,7 @@ gtk_action_helper_action_added (GtkActionHelper    *helper,
                           (helper->target != NULL && parameter_type != NULL &&
                           g_variant_is_of_type (helper->target, parameter_type));
 
-  if (!helper->can_activate)
+  if (helper->target != NULL && !helper->can_activate)
     {
       g_warning ("%s: action %s can't be activated due to parameter type mismatch "
                  "(parameter type %s, target type %s)",


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