Commit 9d88c1c5 authored by Daiki Ueno's avatar Daiki Ueno
Browse files

Fix memleaks; add doc comments.

parent a6bde781
......@@ -35,10 +35,15 @@
<part id="apireference">
<title>API Manual</title>
<chapter>
<title>D-Bus client interface to eekboard-server</title>
<xi:include href="xml/eekboard-eekboard.xml"/>
<title>Client interface to eekboard-server</title>
<xi:include href="xml/eekboard-client.xml"/>
<xi:include href="xml/eekboard-context.xml"/>
</chapter>
<chapter>
<title>Server interface to implement custom eekboard-server</title>
<xi:include href="xml/eekboard-service.xml"/>
<xi:include href="xml/eekboard-context-service.xml"/>
</chapter>
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
......
<SECTION>
<FILE>eekboard-eekboard</FILE>
<TITLE>EekboardEekboard</TITLE>
EekboardEekboard
EekboardEekboardClass
EekboardEekboardPrivate
eekboard_eekboard_new
eekboard_eekboard_create_context
eekboard_eekboard_push_context
eekboard_eekboard_pop_context
eekboard_eekboard_destroy_context
<FILE>eekboard-client</FILE>
<TITLE>EekboardClient</TITLE>
EEKBOARD_TYPE_CLIENT
EEKBOARD_CLIENT
EEKBOARD_CLIENT_CLASS
EEKBOARD_CLIENT_GET_CLASS
EekboardClient
EekboardClientClass
eekboard_client_new
eekboard_client_create_context
eekboard_client_push_context
eekboard_client_pop_context
eekboard_client_destroy_context
EekboardClientPrivate
<SUBSECTION Standard>
EEKBOARD_EEKBOARD
EEKBOARD_IS_EEKBOARD
EEKBOARD_TYPE_EEKBOARD
eekboard_eekboard_get_type
EEKBOARD_EEKBOARD_CLASS
eekboard_client_get_type
EEKBOARD_IS_EEKBOARD_CLASS
EEKBOARD_EEKBOARD_GET_CLASS
</SECTION>
<SECTION>
<FILE>eekboard-service</FILE>
<TITLE>EekboardService</TITLE>
EEKBOARD_SERVICE_PATH
EEKBOARD_SERVICE_INTERFACE
EekboardService
EekboardServiceClass
eekboard_service_new
EekboardServicePrivate
<SUBSECTION Standard>
EEKBOARD_SERVICE
EEKBOARD_IS_SERVICE
EEKBOARD_TYPE_SERVICE
eekboard_service_get_type
EEKBOARD_SERVICE_CLASS
EEKBOARD_IS_SERVICE_CLASS
EEKBOARD_SERVICE_GET_CLASS
</SECTION>
<SECTION>
......@@ -24,17 +43,21 @@ EEKBOARD_EEKBOARD_GET_CLASS
<TITLE>EekboardContext</TITLE>
EekboardContext
EekboardContextClass
EekboardContextPrivate
eekboard_context_new
eekboard_context_add_keyboard
eekboard_context_remove_keyboard
eekboard_context_set_keyboard
eekboard_context_show_keyboard
eekboard_context_hide_keyboard
eekboard_context_set_group
eekboard_context_press_key
eekboard_context_release_key
eekboard_context_get_group
eekboard_context_press_keycode
eekboard_context_release_keycode
eekboard_context_is_keyboard_visible
eekboard_context_set_enabled
eekboard_context_is_enabled
eekboard_context_set_fullscreen
EekboardContextPrivate
<SUBSECTION Standard>
EEKBOARD_CONTEXT
EEKBOARD_IS_CONTEXT
......@@ -45,3 +68,37 @@ EEKBOARD_IS_CONTEXT_CLASS
EEKBOARD_CONTEXT_GET_CLASS
</SECTION>
<SECTION>
<FILE>eekboard-context-service</FILE>
<TITLE>EekboardContextService</TITLE>
EEKBOARD_CONTEXT_SERVICE_PATH
EEKBOARD_CONTEXT_SERVICE_INTERFACE
EekboardContextService
EekboardContextServiceClass
eekboard_context_service_enable
eekboard_context_service_disable
eekboard_context_service_get_keyboard
eekboard_context_service_get_fullscreen
eekboard_context_service_get_client_name
EekboardContextServicePrivate
<SUBSECTION Standard>
EEKBOARD_CONTEXT_SERVICE
EEKBOARD_IS_CONTEXT_SERVICE
EEKBOARD_TYPE_CONTEXT_SERVICE
eekboard_context_service_get_type
EEKBOARD_CONTEXT_SERVICE_CLASS
EEKBOARD_IS_CONTEXT_SERVICE_CLASS
EEKBOARD_CONTEXT_SERVICE_GET_CLASS
</SECTION>
<SECTION>
<FILE>eekboard-xklutil</FILE>
eekboard_xkl_config_rec_from_string
eekboard_xkl_config_rec_to_string
eekboard_xkl_list_models
eekboard_xkl_list_layouts
eekboard_xkl_list_option_groups
eekboard_xkl_list_layout_variants
eekboard_xkl_list_options
</SECTION>
eekboard_client_get_type
eekboard_context_get_type
eekboard_eekboard_get_type
eekboard_context_service_get_type
eekboard_service_get_type
......@@ -18,7 +18,7 @@
/**
* SECTION:eekboard-client
* @short_description: D-Bus proxy of eekboard-server
* @short_description: client interface of eekboard service
*
* The #EekboardClient class provides a client side access to eekboard-server.
*/
......@@ -126,7 +126,7 @@ eekboard_name_vanished_callback (GDBusConnection *connection,
* @connection: a #GDBusConnection
* @cancellable: a #GCancellable
*
* Create a D-Bus proxy of eekboard-eekboard.
* Create a client.
*/
EekboardClient *
eekboard_client_new (GDBusConnection *connection,
......
......@@ -15,6 +15,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:eekboard-context-service
* @short_description: base server implementation of eekboard input
* context service
*
* The #EekboardService class provides a base server side
* implementation of eekboard input context service.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
......@@ -171,10 +181,9 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
error = NULL;
input = g_file_read (file, NULL, &error);
if (input == NULL) {
g_object_unref (file);
g_object_unref (file);
if (input == NULL)
return NULL;
}
layout = eek_xml_layout_new (G_INPUT_STREAM(input));
}
keyboard = eek_keyboard_new (layout, CSW, CSH);
......
......@@ -18,7 +18,7 @@
/**
* SECTION:eekboard-context
* @short_description: input context maintained by #EekboardServer.
* @short_description: client interface of eekboard input context service
*
* The #EekboardContext class provides a client access to remote input
* context.
......@@ -91,10 +91,13 @@ eekboard_context_real_g_signal (GDBusProxy *self,
g_return_if_fail (variant != NULL);
serializable = eek_serializable_deserialize (variant);
g_variant_unref (variant);
g_return_if_fail (EEK_IS_SYMBOL(serializable));
g_signal_emit_by_name (context, "key-pressed",
keyname, EEK_SYMBOL(serializable), modifiers);
g_object_unref (serializable);
return;
}
......
......@@ -15,6 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:eekboard-service
* @short_description: base server implementation of eekboard service
*
* The #EekboardService class provides a base server side
* implementation of eekboard service.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
......@@ -221,6 +230,12 @@ eekboard_service_class_init (EekboardServiceClass *klass)
gobject_class->dispose = eekboard_service_dispose;
gobject_class->finalize = eekboard_service_finalize;
/**
* EekboardService::destroyed:
* @service: an #EekboardService
*
* The ::destroyed signal is emitted when the service is vanished.
*/
signals[DESTROYED] =
g_signal_new (I_("destroyed"),
G_TYPE_FROM_CLASS(gobject_class),
......@@ -348,7 +363,9 @@ handle_method_call (GDBusConnection *connection,
object_path = g_strdup_printf (EEKBOARD_CONTEXT_SERVICE_PATH, context_id++);
g_assert (klass->create_context);
context = klass->create_context (service, client_name, object_path);
g_object_set_data (G_OBJECT(context), "owner", g_strdup (sender));
g_object_set_data_full (G_OBJECT(context),
"owner", g_strdup (sender),
(GDestroyNotify)g_free);
g_hash_table_insert (priv->context_hash,
object_path,
context);
......
......@@ -3,5 +3,5 @@ eek/eek-container.c
eek/eek-key.c
eek/eek-keyboard.c
eek/eek-section.c
eekboard/eekboard-eekboard.c
eekboard/eekboard-client.c
eekboard/eekboard-context.c
......@@ -239,6 +239,21 @@ client_dispose (GObject *object)
G_OBJECT_CLASS (client_parent_class)->dispose (object);
}
static void
client_finalize (GObject *object)
{
Client *client = CLIENT(object);
if (client->keyboards) {
GSList *next = client->keyboards->next;
/* client->keyboards is a ring; break it before free */
client->keyboards->next = NULL;
g_slist_free (next);
}
G_OBJECT_CLASS (client_parent_class)->finalize (object);
}
static void
client_class_init (ClientClass *klass)
{
......@@ -248,6 +263,7 @@ client_class_init (ClientClass *klass)
gobject_class->set_property = client_set_property;
gobject_class->get_property = client_get_property;
gobject_class->dispose = client_dispose;
gobject_class->finalize = client_finalize;
pspec = g_param_spec_object ("connection",
"Connection",
......
......@@ -292,8 +292,8 @@ update_widget (ServerContextService *context)
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED(context->widget));
actor = eek_clutter_keyboard_new (context->keyboard);
clutter_actor_set_name (actor, "keyboard");
if (theme)
eek_clutter_keyboard_set_theme (EEK_CLUTTER_KEYBOARD(actor), theme);
eek_clutter_keyboard_set_theme (EEK_CLUTTER_KEYBOARD(actor), theme);
g_object_unref (theme);
clutter_container_add_actor (CLUTTER_CONTAINER(stage), actor);
clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);
......@@ -302,9 +302,8 @@ update_widget (ServerContextService *context)
#endif
} else {
context->widget = eek_gtk_keyboard_new (keyboard);
if (theme)
eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget),
theme);
eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), theme);
g_object_unref (theme);
}
if (!context->window) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment