Ubuntu

How to set up gsettings sync for GTK_RADIO_MENU_ITEM ? (work with gtk_check_menu_item so maybe a bug)

Asked by Aurélien RIVIERE on 2012-05-24

Hello, I have a problem with the libappindicator3 and GTK3. It's maybe a bug.
I set up synchronization for a gtk_check_menu_item. It works.
Then I set up synchronisation for two GTK_RADIO_MENU_ITEM in a same group. But it doesn't work properly.
When I change the selected item, the group is changed, but GSettings doesn't get the new value.
When I change the value using the GTK interface which propose the whole set of options for this software, or using dconf-editor, the active GTK_RADIO_MENU_ITEM of the group is changed.

In a nutshell, we can say that in my code, G_SETTINGS_BIND_DEFAULT works well for the checkbox, but for the radio_menu_item, it works like G_SETTINGS_BIND_GET.
I tried to replace it with G_SETTINGS_BIND_SET|G_SETTINGS_BIND_GET but I got the same result so the #define is right.

Here a part of my code with the bindings between GSettings and the widgets :

 menu = gtk_menu_new ();

 /* Live Wallpaper checkbutton */
 ctl = gtk_check_menu_item_new_with_label (_("LiveWallpaper"));
 g_settings_bind ( g_settings_new ("apps.livewallpapers.livewallpaper"),
       "active", ctl, "active", G_SETTINGS_BIND_DEFAULT);
 gtk_menu_shell_append (GTK_MENU_SHELL (menu), ctl);

    /* Separator */
    gtk_menu_shell_append ( GTK_MENU_SHELL (menu),
       gtk_separator_menu_item_new ());

    /* Galaxy Plugins */
    ctl = gtk_radio_menu_item_new_with_label (group, _("Galaxy"));
  g_settings_bind ( g_settings_new ("apps.livewallpapers.galaxy"),
      "active", ctl, "active", G_SETTINGS_BIND_DEFAULT);
  group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (ctl));
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), ctl);

    /* Nexus Plugins */
    ctl = gtk_radio_menu_item_new_with_label (group, _("Nexus"));
  g_settings_bind ( g_settings_new ("apps.livewallpapers.nexus"),
      "active", ctl, "active", G_SETTINGS_BIND_DEFAULT);
  group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (ctl));
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), ctl);

Thank you for helping me.
Yours faithfully.

Question information

Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Nobody can answer me ?

No one, really ?

Launchpad Janitor (janitor) said : #4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

22/06 => 24/06 = 15 days ? Well done Launchpad Janitor !

Launchpad Janitor (janitor) said : #6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.