Keep a reference to GSettings handle until server-context is disposed.

This commit is contained in:
Daiki Ueno
2011-06-10 16:56:23 +09:00
parent f76a835e33
commit fe9a02e514

View File

@ -116,6 +116,7 @@ struct _ServerContext {
gulong key_released_handler; gulong key_released_handler;
gulong notify_visible_handler; gulong notify_visible_handler;
GSettings *settings;
ServerContextUIToolkitType ui_toolkit; ServerContextUIToolkitType ui_toolkit;
}; };
@ -398,6 +399,11 @@ server_context_dispose (GObject *object)
context->introspection_data = NULL; context->introspection_data = NULL;
} }
if (context->settings) {
g_object_unref (context->settings);
context->settings = NULL;
}
G_OBJECT_CLASS (server_context_parent_class)->dispose (object); G_OBJECT_CLASS (server_context_parent_class)->dispose (object);
} }
@ -473,7 +479,6 @@ server_context_class_init (ServerContextClass *klass)
static void static void
server_context_init (ServerContext *context) server_context_init (ServerContext *context)
{ {
GSettings *settings;
GError *error; GError *error;
context->connection = NULL; context->connection = NULL;
@ -501,8 +506,8 @@ server_context_init (ServerContext *context)
context->ui_toolkit = UI_TOOLKIT_DEFAULT; context->ui_toolkit = UI_TOOLKIT_DEFAULT;
settings = g_settings_new ("org.fedorahosted.eekboard"); context->settings = g_settings_new ("org.fedorahosted.eekboard");
g_settings_bind (settings, "ui-toolkit", g_settings_bind (context->settings, "ui-toolkit",
context, "ui-toolkit", context, "ui-toolkit",
G_SETTINGS_BIND_GET); G_SETTINGS_BIND_GET);
} }