keyboard: Expose creating sections directly

This commit is contained in:
Dorota Czaplejewicz
2019-08-02 15:24:49 +00:00
parent 18163e3ecc
commit c8adb45ab5
4 changed files with 10 additions and 22 deletions

View File

@ -145,7 +145,7 @@ section_child_removed_cb (EekContainer *container,
name);
}
static EekSection *
EekSection *
eek_keyboard_real_create_section (EekKeyboard *self)
{
EekSection *section;
@ -422,8 +422,6 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
klass->create_section = eek_keyboard_real_create_section;
/* signals */
container_class->child_added = eek_keyboard_real_child_added;
container_class->child_removed = eek_keyboard_real_child_removed;
@ -500,21 +498,6 @@ eek_keyboard_init (EekKeyboard *self)
self->scale = 1.0;
}
/**
* eek_keyboard_create_section:
* @keyboard: an #EekKeyboard
*
* Create an #EekSection instance and append it to @keyboard. This
* function is rarely called by application but called by #EekLayout
* implementation.
*/
EekSection *
eek_keyboard_create_section (EekKeyboard *keyboard)
{
g_return_val_if_fail (EEK_IS_KEYBOARD(keyboard), NULL);
return EEK_KEYBOARD_GET_CLASS(keyboard)->create_section (keyboard);
}
/**
* eek_keyboard_find_key_by_name:
* @keyboard: an #EekKeyboard

View File

@ -88,8 +88,6 @@ struct _EekKeyboardClass
gpointer get_symbol_index;
/*< public >*/
EekSection *(* create_section) (EekKeyboard *self);
EekKey *(* find_key_by_name) (EekKeyboard *self,
const gchar *name);
@ -196,5 +194,12 @@ void eek_keyboard_release_key(EekKeyboard *keyboard, EekKey *key, guint32 timest
gchar * eek_keyboard_get_keymap
(EekKeyboard *keyboard);
/* Create an #EekSection instance and append it to @keyboard. This
* function is rarely called by application but called by #EekLayout
* implementation.
*/
EekSection *
eek_keyboard_real_create_section (EekKeyboard *self);
G_END_DECLS
#endif /* EEK_KEYBOARD_H */

View File

@ -372,7 +372,7 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
}
if (g_strcmp0 (element_name, "section") == 0) {
data->section = eek_keyboard_create_section (data->keyboard);
data->section = eek_keyboard_real_create_section (data->keyboard);
attribute = get_attribute (attribute_names, attribute_values,
"id");
if (attribute != NULL)

View File

@ -29,7 +29,7 @@ test_create (void)
EekKey *key0, *key1;
keyboard = g_object_new (EEK_TYPE_KEYBOARD, NULL);
section = eek_keyboard_create_section (keyboard);
section = eek_keyboard_real_create_section (keyboard);
g_assert (EEK_IS_SECTION(section));
eek_section_add_row (section, 2, EEK_ORIENTATION_HORIZONTAL);
key0 = eek_section_create_key (section, "key0", 1);