libeek: abolish arguments for eek_clutter_keyboard_new() and eek_xkb_layout_new()
This commit is contained in:
		@ -49,9 +49,8 @@ eek_clutter_key_real_set_name (EekElement *self,
 | 
			
		||||
    EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
 | 
			
		||||
        set_name (self, name);
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->actor);
 | 
			
		||||
 | 
			
		||||
    clutter_actor_set_name (CLUTTER_ACTOR(priv->actor), name);
 | 
			
		||||
    if (priv->actor)
 | 
			
		||||
        clutter_actor_set_name (CLUTTER_ACTOR(priv->actor), name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -63,10 +62,10 @@ eek_clutter_key_real_set_bounds (EekElement *self,
 | 
			
		||||
    EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
 | 
			
		||||
        set_bounds (self, bounds);
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->actor);
 | 
			
		||||
 | 
			
		||||
    clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
 | 
			
		||||
    clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
 | 
			
		||||
    if (priv->actor) {
 | 
			
		||||
        clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
 | 
			
		||||
        clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
 | 
			
		||||
@ -57,9 +57,8 @@ eek_clutter_keyboard_real_set_name (EekElement *self,
 | 
			
		||||
    EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
 | 
			
		||||
        set_name (self, name);
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->actor);
 | 
			
		||||
 | 
			
		||||
    clutter_actor_set_name (priv->actor, name);
 | 
			
		||||
    if (priv->actor)
 | 
			
		||||
        clutter_actor_set_name (priv->actor, name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -71,10 +70,10 @@ eek_clutter_keyboard_real_set_bounds (EekElement *self,
 | 
			
		||||
    EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
 | 
			
		||||
        set_bounds (self, bounds);
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->actor);
 | 
			
		||||
 | 
			
		||||
    clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
 | 
			
		||||
    clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
 | 
			
		||||
    if (priv->actor) {
 | 
			
		||||
        clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
 | 
			
		||||
        clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -176,29 +175,13 @@ eek_clutter_keyboard_init (EekClutterKeyboard *self)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_clutter_keyboard_new:
 | 
			
		||||
 * @width: max width of the area where the keyboard to be drawn
 | 
			
		||||
 * @height: max height of the area where the keyboard to be drawn
 | 
			
		||||
 *
 | 
			
		||||
 * Create a new #EekClutterKeyboard.
 | 
			
		||||
 */
 | 
			
		||||
EekKeyboard*
 | 
			
		||||
eek_clutter_keyboard_new (gfloat width,
 | 
			
		||||
                          gfloat height)
 | 
			
		||||
eek_clutter_keyboard_new (void)
 | 
			
		||||
{
 | 
			
		||||
    EekKeyboard *keyboard;
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
 | 
			
		||||
    keyboard = g_object_new (EEK_TYPE_CLUTTER_KEYBOARD, NULL);
 | 
			
		||||
    g_return_val_if_fail (keyboard, NULL);
 | 
			
		||||
 | 
			
		||||
    /* Can't call set_bounds of this class since it needs priv->actor
 | 
			
		||||
       initialized */
 | 
			
		||||
    memset (&bounds, 0, sizeof bounds);
 | 
			
		||||
    bounds.width = width;
 | 
			
		||||
    bounds.height = height;
 | 
			
		||||
    EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
 | 
			
		||||
        set_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
			
		||||
    return keyboard;
 | 
			
		||||
    return g_object_new (EEK_TYPE_CLUTTER_KEYBOARD, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
 | 
			
		||||
@ -50,8 +50,7 @@ struct _EekClutterKeyboardClass
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GType         eek_clutter_keyboard_get_type  (void) G_GNUC_CONST;
 | 
			
		||||
EekKeyboard  *eek_clutter_keyboard_new       (gfloat width,
 | 
			
		||||
                                              gfloat height);
 | 
			
		||||
EekKeyboard  *eek_clutter_keyboard_new       (void);
 | 
			
		||||
ClutterActor *eek_clutter_keyboard_get_actor (EekClutterKeyboard *keyboard);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
@ -48,9 +48,8 @@ eek_clutter_section_real_set_name (EekElement  *self,
 | 
			
		||||
    EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
 | 
			
		||||
        set_name (self, name);
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->actor);
 | 
			
		||||
 | 
			
		||||
    clutter_actor_set_name (priv->actor, name);
 | 
			
		||||
    if (priv->actor)
 | 
			
		||||
        clutter_actor_set_name (priv->actor, name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -62,10 +61,10 @@ eek_clutter_section_real_set_bounds (EekElement *self,
 | 
			
		||||
    EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
 | 
			
		||||
        set_bounds (self, bounds);
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->actor);
 | 
			
		||||
 | 
			
		||||
    clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
 | 
			
		||||
    clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
 | 
			
		||||
    if (priv->actor) {
 | 
			
		||||
        clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
 | 
			
		||||
        clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
 | 
			
		||||
@ -544,32 +544,19 @@ get_names (EekXkbLayout *layout)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_new:
 | 
			
		||||
 * @keycodes: component name for keycodes
 | 
			
		||||
 * @geometry: component name for geometry
 | 
			
		||||
 * @symbols: component name for symbols
 | 
			
		||||
 *
 | 
			
		||||
 * Create a new #EekXkbLayout.
 | 
			
		||||
 */
 | 
			
		||||
EekLayout *
 | 
			
		||||
eek_xkb_layout_new (const gchar *keycodes,
 | 
			
		||||
                    const gchar *geometry,
 | 
			
		||||
                    const gchar *symbols)
 | 
			
		||||
eek_xkb_layout_new (void)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayout *layout;
 | 
			
		||||
    EekXkbLayoutPrivate *priv;
 | 
			
		||||
 | 
			
		||||
    layout = g_object_new (EEK_TYPE_XKB_LAYOUT, NULL);
 | 
			
		||||
    g_return_val_if_fail (layout, NULL);
 | 
			
		||||
    priv = layout->priv;
 | 
			
		||||
    if (keycodes)
 | 
			
		||||
        priv->names.keycodes = g_strdup (keycodes);
 | 
			
		||||
    if (geometry)
 | 
			
		||||
        priv->names.geometry = g_strdup (geometry);
 | 
			
		||||
    if (symbols)
 | 
			
		||||
        priv->names.symbols = g_strdup (symbols);
 | 
			
		||||
 | 
			
		||||
    get_keyboard (layout);
 | 
			
		||||
    if (priv->xkb == NULL) {
 | 
			
		||||
    if (layout->priv->xkb == NULL) {
 | 
			
		||||
        g_object_unref (layout);
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -52,11 +52,7 @@ struct _EekXkbLayoutClass
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GType                 eek_xkb_layout_get_type  (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
EekLayout            *eek_xkb_layout_new       (const gchar          *keycodes,
 | 
			
		||||
                                                const gchar          *geometry,
 | 
			
		||||
                                                const gchar          *symbols);
 | 
			
		||||
 | 
			
		||||
EekLayout            *eek_xkb_layout_new       (void);
 | 
			
		||||
 | 
			
		||||
gboolean              eek_xkb_layout_set_names (EekXkbLayout         *layout,
 | 
			
		||||
                                                XkbComponentNamesRec *names);
 | 
			
		||||
 | 
			
		||||
@ -383,15 +383,20 @@ on_resize (GObject *object,
 | 
			
		||||
 | 
			
		||||
static GtkWidget *
 | 
			
		||||
create_widget_clutter (Eekboard *eekboard,
 | 
			
		||||
                       gfloat    initial_width,
 | 
			
		||||
                       gfloat    initial_height)
 | 
			
		||||
                       gint      initial_width,
 | 
			
		||||
                       gint      initial_height)
 | 
			
		||||
{
 | 
			
		||||
    ClutterActor *stage, *actor;
 | 
			
		||||
    ClutterColor stage_color = { 0xff, 0xff, 0xff, 0xff };
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
 | 
			
		||||
    eekboard->keyboard = eek_clutter_keyboard_new (initial_width,
 | 
			
		||||
                                                   initial_height);
 | 
			
		||||
    bounds.x = bounds.y = 0;
 | 
			
		||||
    bounds.width = initial_width;
 | 
			
		||||
    bounds.height = initial_height;
 | 
			
		||||
 | 
			
		||||
    eekboard->keyboard = eek_clutter_keyboard_new ();
 | 
			
		||||
    eek_keyboard_set_layout (eekboard->keyboard, eekboard->layout);
 | 
			
		||||
    eek_element_set_bounds (EEK_ELEMENT(eekboard->keyboard), &bounds);
 | 
			
		||||
    g_signal_connect (eekboard->keyboard, "key-pressed",
 | 
			
		||||
                      G_CALLBACK(on_key_pressed), eekboard);
 | 
			
		||||
    g_signal_connect (eekboard->keyboard, "key-released",
 | 
			
		||||
@ -416,8 +421,8 @@ create_widget_clutter (Eekboard *eekboard,
 | 
			
		||||
 | 
			
		||||
static GtkWidget *
 | 
			
		||||
create_widget_gtk (Eekboard *eekboard,
 | 
			
		||||
                   gfloat    initial_width,
 | 
			
		||||
                   gfloat    initial_height)
 | 
			
		||||
                   gint      initial_width,
 | 
			
		||||
                   gint      initial_height)
 | 
			
		||||
{
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,7 @@ test_create (void)
 | 
			
		||||
    EekLayout *layout;
 | 
			
		||||
    const gchar *keycodes, *geometry, *symbols;
 | 
			
		||||
 | 
			
		||||
    layout = eek_xkb_layout_new (NULL, "winbook", NULL);
 | 
			
		||||
    layout = eek_xkb_layout_new ();
 | 
			
		||||
    g_assert (layout);
 | 
			
		||||
    keycodes = eek_xkb_layout_get_keycodes (EEK_XKB_LAYOUT(layout));
 | 
			
		||||
    g_assert (keycodes);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user