Commit graph

27 commits

Author SHA1 Message Date
Christophe Fergeau
99ef490875 keyboard: Fix leak in settings_get_binding()
This fixes:
==5944== 64,392 bytes in 4,223 blocks are definitely lost in loss record 16,020 of 16,045
==5944==    at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5944==    by 0x1445EFCC: g_malloc (gmem.c:94)
==5944==    by 0x1445F2AE: g_malloc_n (gmem.c:330)
==5944==    by 0x144981DC: g_variant_get_strv (gvariant.c:1572)
==5944==    by 0x48FA45: settings_get_binding (cc-keyboard-item.c:369)
==5944==    by 0x48FA9D: binding_changed (cc-keyboard-item.c:384)
==5944==    by 0x141C3E2F: g_cclosure_marshal_VOID__STRINGv (gmarshal.c:1794)
==5944==    by 0x141BFBE3: _g_closure_invoke_va (gclosure.c:864)
==5944==    by 0x141DA3E7: g_signal_emit_valist (gsignal.c:3292)
==5944==    by 0x141DB55F: g_signal_emit (gsignal.c:3439)
==5944==    by 0x13EDC81D: g_settings_real_change_event (gsettings.c:386)

https://bugzilla.gnome.org/show_bug.cgi?id=756762
2015-10-19 11:19:17 +02:00
Christophe Fergeau
baff31f43e keyboard: Don't leak CcKeyboardItem::binding
It contains a strdup'ed string, but it's overwritten without being freed
first from cc_keyboard_item_load_from_gsettings_path() and
cc_keyboard_item_load_from_gsettings().

This fixes:
==5944== 976 bytes in 64 blocks are definitely lost in loss record 15,439 of 16,045
==5944==    at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5944==    by 0x1445EFCC: g_malloc (gmem.c:94)
==5944==    by 0x1445F2AE: g_malloc_n (gmem.c:330)
==5944==    by 0x144981DC: g_variant_get_strv (gvariant.c:1572)
==5944==    by 0x48FA45: settings_get_binding (cc-keyboard-item.c:369)
==5944==    by 0x48FDDD: cc_keyboard_item_load_from_gsettings (cc-keyboard-item.c:438)
==5944==    by 0x489EB7: append_section (keyboard-shortcuts.c:249)
==5944==    by 0x48ADF6: append_sections_from_file (keyboard-shortcuts.c:578)
==5944==    by 0x48B4EE: reload_sections (keyboard-shortcuts.c:737)
==5944==    by 0x48EA22: keyboard_shortcuts_init (keyboard-shortcuts.c:2109)
==5944==    by 0x489236: cc_keyboard_panel_constructor (cc-keyboard-panel.c:133)
==5944==    by 0x141C7C3F: g_object_new_with_custom_constructor (gobject.c:1697)
==5944==    by 0x141C7E71: g_object_new_internal (gobject.c:1777)
==5944==    by 0x141C8ADA: g_object_new_valist (gobject.c:2038)
==5944==    by 0x141C7A85: g_object_new (gobject.c:1622)
==5944==    by 0x4547DF: cc_panel_loader_load_by_name (cc-panel-loader.c:213)
==5944==    by 0x44DFCB: activate_panel (cc-window.c:157)
==5944==    by 0x4504D6: cc_window_set_active_panel_from_id (cc-window.c:1036)

https://bugzilla.gnome.org/show_bug.cgi?id=756762
2015-10-19 11:19:17 +02:00
Christophe Fergeau
b442126db1 keyboard: Remove 'gettext_package' handling
It's part of CcKeyboardItem but nothing uses it. It's also parsed
when loading KeyListEntry XML, but never used. The key description is
translated using Keylist::package before gettext_package is assigned.

https://bugzilla.gnome.org/show_bug.cgi?id=749381
2015-05-15 19:44:00 +02:00
Christophe Fergeau
241b4034ce keyboard: Remove unused cc_keyboard_item_get_binding
https://bugzilla.gnome.org/show_bug.cgi?id=749381
2015-05-15 19:44:00 +02:00
Christophe Fergeau
b7a2d17548 keyboard: Make CcKeyboardItem::binding private
It's not used outside of CcKeyboardItem

https://bugzilla.gnome.org/show_bug.cgi?id=749381
2015-05-15 19:44:00 +02:00
Bastien Nocera
110bc2ebb5 keyboard: Fix warnings when clearing the help shortcut
(gnome-control-center:20334): GLib-CRITICAL **: g_variant_new_string: assertion 'string != NULL' failed

 #0  g_logv (log_domain=0x7fffec6a040e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd148) at gmessages.c:1046
 #1  0x00007fffec63ca12 in g_log (log_domain=log_domain@entry=0x7fffec6a040e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fffec6a9cbd "%s: assertion '%s' failed") at gmessages.c:1079
 #2  0x00007fffec63ca39 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7fffec6a040e "GLib", pretty_function=pretty_function@entry=0x7fffec6fa860 <__FUNCTION__.5201> "g_variant_new_string", expression=expression@entry=0x7fffec6fc5f2 "string != NULL") at gmessages.c:1088
 #3  0x00007fffec66890a in g_variant_new_string (string=string@entry=0x0) at gvariant.c:1227
 #4  0x00007fffecc34dd4 in g_settings_set_string (settings=settings@entry=0x14b3640, key=key@entry=0x14caac0 "help", value=value@entry=0x0) at gsettings.c:1708
 #5  0x000000000047cd2e in settings_set_binding (value=0x0, key=0x14caac0 "help", settings=0x14b3640) at cc-keyboard-item.c:117
 #6  _set_binding (set_backend=1, value=<optimized out>, item=<optimized out>) at cc-keyboard-item.c:155
 #7  cc_keyboard_item_set_property (object=<optimized out>, prop_id=<optimized out>, value=<optimized out>, pspec=0x146e300) at cc-keyboard-item.c:204
 #8  0x00007fffec93b3eb in object_set_property (nqueue=<optimized out>, value=<optimized out>, pspec=<optimized out>, object=<optimized out>) at gobject.c:1415
 #9  g_object_set_valist (object=0x149fc00, first_property_name=0x146e300 "\320\064\231", var_args=0x7fffffffd378) at gobject.c:2159
 #10 0x00007fffec93bc0f in g_object_set (_object=0x149fc00, first_property_name=first_property_name@entry=0x53a4a6 "binding") at gobject.c:2269
 #11 0x0000000000479652 in accel_cleared_callback (cell=<optimized out>, path_string=<optimized out>, data=<optimized out>) at keyboard-shortcuts.c:1625
2014-09-05 10:05:58 +02:00
Christophe Fergeau
ba9a8bc8ff keyboard: Add support for hidden keybinding XML data
If a KeyListEntry has a hidden="true" attribute, then the corresponding
binding information will be loaded as usual, but the binding won't be
displayed in the user interface.

This is useful as the keyboard panel will take into account hidden
keybindings when detecting conflicting shortcuts, or to suggest to set a
reverse shortcut.

For now, this will be used for the various reverse mutter keybindings
({switch,cycle}.*-backward) as they should not be shown in the UI, but
we still want the keyboard panel to know about them.

https://bugzilla.gnome.org/show_bug.cgi?id=731618
2014-08-17 20:16:27 +02:00
Christophe Fergeau
f059f42487 keyboard: Add 'reverse' helpers to CcKeyboardItem
In order to handle shortcuts which can be reversed (for example,
super-space and shift-super-space to switch input methods
forward/backward), we are going to add new attributes to the xml files
describing the keyboard shortcuts to show in the panel.

This commit is a first step towards that and adds the notion of
'reverse' items to CcKeyboardItem.

We will then indicate in the xml description files that
'switch-input-source' is reversed by 'switch-input-source-backward' and
that 'switch-input-source-backward' reverses 'switch-input-source'.

https://bugzilla.gnome.org/show_bug.cgi?id=731618
2014-08-17 20:16:26 +02:00
Daniel Mustieles
2c5951819d Updated FSF's address 2014-01-29 11:27:38 +01:00
Tomas Bzatek
30c073ffee keyboard: Allocate required space for replacing a key shortcut
https://bugzilla.gnome.org/show_bug.cgi?id=670236
2012-02-20 11:20:35 +01:00
Bastien Nocera
7ca6df2452 keyboard: Fix shortcut always showing up empty
When starting afresh. The binding was never read from
GSettings on startup otherwise.

Spotted by Yanko Kaneti <yaneti@declera.com>
2011-11-25 11:58:43 +00:00
Bastien Nocera
9f107a4760 keyboard: Remove support code for GConf keybindings 2011-11-14 18:09:39 +00:00
Florian Müllner
656d0ee4b0 keyboard: Port custom shortcuts to GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=625899
2011-11-14 18:09:39 +00:00
Bastien Nocera
df493ef93c keyboard: Use GTK+ to parse keys
Instead of some custom code

https://bugzilla.gnome.org/show_bug.cgi?id=663341
2011-11-04 17:00:39 +00:00
Bastien Nocera
6e99f7663a keyboard: Use GtkCellRendererAccel
Instead of custom code. This means loads of code we don't need
to maintain, whoo!
2011-10-27 16:25:35 +01:00
Florian Müllner
b72c71a970 keyboard: Support string array keybindings
Metacity/Mutter stores keybindings as string array to support multiple
bindings per action. Even though multiple bindings are not exposed in
the UI, support keybindings stored as string array by getting/setting
the first element of the array.

https://bugzilla.gnome.org/show_bug.cgi?id=653613
2011-06-30 13:57:40 +02:00
Florian Müllner
a6d3ad6af3 keyboard: Fix a small memory leak
Unless g_conf_client_get_string(), g_settings_get_string() always
returns a newly allocated string.

https://bugzilla.gnome.org/show_bug.cgi?id=653613
2011-06-30 13:57:40 +02:00
Bastien Nocera
3d5c7b65a6 keyboard: Avoid warnings when adding new shortcuts
We don't want to unset GConf watches if we didn't set them
in the first place.
2011-04-26 15:54:59 +01:00
Bastien Nocera
b77df51384 keyboard: Add _equal() helper function 2011-02-24 04:20:07 +00:00
Bastien Nocera
1961501680 keyboard: Fix stupidness when setting GConf keys
When setting a new binding in GConf, actually set something...
2011-02-24 04:19:19 +00:00
Bastien Nocera
52f8687c37 keyboard: Only listen to our own key
Rather than all the possible changes that could have happened in
the schemas.
2011-02-17 16:52:07 +00:00
Bastien Nocera
2bd214a1d4 keyboard: Fix memleaks in CcKeyboardItem 2011-02-17 13:00:30 +00:00
Bastien Nocera
fbe10dc98c keyboard: Remove some debug 2011-02-17 13:00:30 +00:00
Bastien Nocera
73f155eaac keyboard: Pass a gettext package when loading GConf
As GConf itself won't be passing us a translated entry by itself.

https://bugzilla.gnome.org/show_bug.cgi?id=576570
2011-02-17 13:00:30 +00:00
Bastien Nocera
27cf30ed54 keyboard: Add support for GSettings shortcuts 2011-02-16 18:00:38 +00:00
Bastien Nocera
6b5fa49cc6 keyboard: Don't update binding by hand
Let the CcKeyboardItem update keyval, keymask, etc. for us when
we set the binding value, instead of having us do it by hand.
2011-02-16 01:28:04 +00:00
Bastien Nocera
5c755904e1 keyboard: Clean up GConf handling
Move most of the horrible GConf monitoring code to a separate
GObject(-ish). While quite ugly, it's not as bad as the code that
used to be there before.

Also fix the setting of KeyEntry->model (or CcKeyboardItem->model now)
to be the correct model (eg. the shortcut model rather than the section
model)
2011-02-16 01:24:49 +00:00