Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#3926 closed defect (fixed)

CP: keyboard section crashes Sugar

Reported by: erikos Owned by: manuq
Priority: Low Milestone:
Component: Sugar Version: 0.97.x
Severity: Critical Keywords: regression
Cc: dsd Distribution/OS: Fedora
Bug Status: Assigned

Description

1348038378.571953 DEBUG root: Remove date updating timer
/usr/lib/python2.7/site-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
/usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type `PyGtkGenericCellRenderer' is smaller than the parent type's `GtkCellRenderer' class size
  from gtk import _gtk
/usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion `node != NULL' failed
  from gtk import _gtk

Attachments (1)

temp.patch (5.8 KB) - added by manuq 7 years ago.
Partial patch, I still need to find a fix for the gconf_client_set_list #681433

Download all attachments as: .zip

Change History (19)

comment:1 Changed 7 years ago by manuq

Yes we are mixing static bindings:

./extensions/cpsection/keyboard/model.py:import xklavier

Changed 7 years ago by manuq

Partial patch, I still need to find a fix for the gconf_client_set_list #681433

comment:2 Changed 7 years ago by manuq

Well it turns out gconf_client_set_list can't be workarounded like gconf_client_get_list, because gconf_value_set_list [1] is not introspectable. So the list of values can't be made.

[1] http://developer.gnome.org/gconf/stable/gconf-gconf-value.html#gconf-value-set-list

The workaround for get_list is, for example:

from gi.repository import GConf

cli = GConf.Client.get_default()

val_list = cli.get('/desktop/sugar/protected_activities')
assert val_list.type == GConf.ValueType.LIST

for val in val_list.get_list():
    assert val.type == GConf.ValueType.STRING
    print val.get_string()

If we had gconf_value_set_list we could do something like:

list_of_values = []
for string in ['one', 'two', 'three']:
    val = GConf.Value()
    val.type = GConf.ValueType.STRING
    val.set_string('hola')
    list_of_values.append(val)

val_list = GConf.Value()
val_list.type = GConf.ValueType.LIST
val_list.set_list(list_of_values) #FIXME
val_list.set_list_type(GConf.ValueType.STRING)

cli.set('/test/layouts', val_list)

comment:3 Changed 7 years ago by manuq

there is also the new_from_string constructor for the GConf.Value but couldn't get a list from it. For value type STRING works like this:

v = GConf.Value.new_from_string(GConf.ValueType.STRING, 'hola')

comment:4 follow-up: Changed 7 years ago by dsd

Have you tried gconf_entry_set_value() passing a GConf.ValueType.LIST?

comment:5 in reply to: ↑ 4 Changed 7 years ago by manuq

Replying to dsd:

Have you tried gconf_entry_set_value() passing a GConf.ValueType.LIST?

Yes, I can do:

from gi.repository import GConf
val_list = GConf.Value()
val_list.type = GConf.ValueType.LIST
entry = GConf.Entry()
entry.set_value(val_list)

But how can a GConf.Entry replace the missing gconf_value_set_list ?

comment:6 Changed 7 years ago by erikos

  • Severity changed from Unspecified to Minor

Ok, I could not get it to work neither.

comment:7 Changed 7 years ago by dsd

  • Cc dsd added

Try getting the entry from gconf with gconf_engine_get_entry() and then set a value using gconf_entry_set_value().

It's not 100% clear to me that gconf_entry_set_value() in that context will cause the new value to be saved back to the gconf db. But worth a try.

If that doesn't work...use gconf_engine_set(), passing the GConfValue that you've constructed as a list. That looks like it will do the trick, and might even be cleaner than the GConfEntry approach.

comment:8 Changed 7 years ago by manuq

No luck doing that through introspection.

gconf_engine_get_entry doesn't have annotations at all: http://git.gnome.org/browse/gconf/tree/gconf/gconf.c#n1151

gconf_engine_get_default has (skip) in the annotations: http://git.gnome.org/browse/gconf/tree/gconf/gconf.c#n568

comment:9 follow-up: Changed 7 years ago by dsd

oops. Try gconf_client_set() in the style that I suggested using gconf_engine_set() above.

comment:10 in reply to: ↑ 9 Changed 7 years ago by manuq

Replying to dsd:

oops. Try gconf_client_set() in the style that I suggested using gconf_engine_set() above.

That's exactly what I was trying in comment 2 above. The problem is that I can't construct the GConfValue of type GConf.ValueType.LIST because gconf_value_set_list is not introspectable. See the part "If we had gconf_value_set_list we could do..."

comment:11 Changed 7 years ago by godiard

  • Priority changed from Unspecified by Maintainer to High

comment:12 Changed 7 years ago by godiard

  • Keywords regression added

comment:13 Changed 7 years ago by erikos

  • Priority changed from High to Normal
  • Severity changed from Minor to Critical

comment:14 Changed 7 years ago by godiard

  • Priority changed from Normal to Low

comment:15 Changed 6 years ago by walter

The other issues with keyboard section (there were many) are addressed in #4492. But this issue is still a blocker.

comment:16 Changed 6 years ago by walter

[1] is used to fix the gconf bug. In addition, [2] fixes a problem with selecting language (it used the language in ~/.i18n as its preference)

[1] https://github.com/sugarlabs/sugar-toolkit-gtk3/commit/79fa03e846d4a816790bb589de3d7ee0ca52520d

[2] https://github.com/sugarlabs/sugar/pull/32

comment:17 Changed 6 years ago by dnarvaez

  • Resolution set to fixed
  • Status changed from new to closed

comment:18 Changed 6 years ago by dnarvaez

  • Milestone 0.98 deleted

Milestone 0.98 deleted

Note: See TracTickets for help on using tickets.