~charlesk/libdbusmenu/lp-977803

« back to all changes in this revision

Viewing changes to libdbusmenu-gtk/client.c

  • Committer: Charles Kerr
  • Date: 2012-03-21 14:34:42 UTC
  • mfrom: (387.2.2 crash2)
  • Revision ID: charles.kerr@canonical.com-20120321143442-3rp9dx04eq40dtmc
merge lp:~charlesk/dbusmenu/lp-953509 to fix a crash in dbusmenu-gtk's handling of menu icon theme changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
738
738
 
739
739
        if (variant != NULL) {
740
740
                const gchar * setname = NULL;
741
 
                setname = g_variant_dup_string(variant, NULL);
 
741
                setname = g_variant_get_string(variant, NULL);
742
742
                atk_object_set_name(aobj, setname);
743
743
        } else {
744
744
        /* The atk docs advise to set the name of the atk object to an empty
745
745
         * string, but GTK doesn't yet do the same, and setting the name to NULL
746
746
         * causes tests to fail.
747
747
         */
748
 
                gchar * setname = NULL;
749
748
                const gchar * label = NULL;
750
 
                /* We don't want the underscore for mnewmonics */
751
749
                label = dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL);
752
750
 
753
 
                GRegex * regex = g_regex_new ("_", 0, 0, NULL);
754
 
                setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL);
755
 
                g_regex_unref(regex);
756
 
 
757
 
                atk_object_set_name(aobj, setname);
758
 
                g_free(setname);
 
751
                if (label != NULL) {
 
752
                        gchar * setname = NULL;
 
753
 
 
754
                        /* We don't want the underscore for mnewmonics */
 
755
                        GRegex * regex = g_regex_new ("_", 0, 0, NULL);
 
756
                        setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL);
 
757
                        g_regex_unref(regex);
 
758
 
 
759
                        atk_object_set_name(aobj, setname);
 
760
                        g_free(setname);
 
761
                }
759
762
        }
760
763
 
761
764
        return;