Removed d-bus paths from service class

This commit is contained in:
Dorota Czaplejewicz
2019-06-22 15:40:20 +00:00
parent f1fbb37547
commit d6feec8010
6 changed files with 8 additions and 66 deletions

View File

@ -38,9 +38,7 @@
#define CSH 480 #define CSH 480
enum { enum {
PROP_0, PROP_0, // Magic: without this, keyboard is not useable in g_object_notify
PROP_OBJECT_PATH,
PROP_CLIENT_NAME,
PROP_KEYBOARD, PROP_KEYBOARD,
PROP_VISIBLE, PROP_VISIBLE,
PROP_FULLSCREEN, PROP_FULLSCREEN,
@ -220,16 +218,6 @@ eekboard_context_service_set_property (GObject *object,
EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE(object); EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE(object);
switch (prop_id) { switch (prop_id) {
case PROP_OBJECT_PATH:
if (context->priv->object_path)
g_free (context->priv->object_path);
context->priv->object_path = g_value_dup_string (value);
break;
case PROP_CLIENT_NAME:
if (context->priv->client_name)
g_free (context->priv->client_name);
context->priv->client_name = g_value_dup_string (value);
break;
case PROP_KEYBOARD: case PROP_KEYBOARD:
if (context->priv->keyboard) if (context->priv->keyboard)
g_object_unref (context->priv->keyboard); g_object_unref (context->priv->keyboard);
@ -261,12 +249,6 @@ eekboard_context_service_get_property (GObject *object,
EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE(object); EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE(object);
switch (prop_id) { switch (prop_id) {
case PROP_OBJECT_PATH:
g_value_set_string (value, context->priv->object_path);
break;
case PROP_CLIENT_NAME:
g_value_set_string (value, context->priv->client_name);
break;
case PROP_KEYBOARD: case PROP_KEYBOARD:
g_value_set_object (value, context->priv->keyboard); g_value_set_object (value, context->priv->keyboard);
break; break;
@ -466,34 +448,6 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
G_TYPE_NONE, G_TYPE_NONE,
0); 0);
/**
* EekboardContextService:object-path:
*
* D-Bus object path.
*/
pspec = g_param_spec_string ("object-path",
"Object-path",
"Object-path",
NULL,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_OBJECT_PATH,
pspec);
/**
* EekboardContextService:client-name:
*
* Name of a client who created this context service.
*/
pspec = g_param_spec_string ("client-name",
"Client-name",
"Client-name",
NULL,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_CLIENT_NAME,
pspec);
/** /**
* EekboardContextService:keyboard: * EekboardContextService:keyboard:
* *

View File

@ -208,7 +208,7 @@ eekboard_service_constructed (GObject *object)
EekboardContextService *context; EekboardContextService *context;
g_assert (klass->create_context); g_assert (klass->create_context);
context = klass->create_context (service, "client_name", "object_path"); context = klass->create_context (service);
g_object_set_data_full (G_OBJECT(context), g_object_set_data_full (G_OBJECT(context),
"owner", g_strdup ("sender"), "owner", g_strdup ("sender"),
(GDestroyNotify)g_free); (GDestroyNotify)g_free);

View File

@ -60,9 +60,7 @@ struct _EekboardServiceClass {
GObjectClass parent_class; GObjectClass parent_class;
/*< public >*/ /*< public >*/
EekboardContextService *(*create_context) (EekboardService *self, EekboardContextService *(*create_context) (EekboardService *self);
const gchar *client_name,
const gchar *object_path);
/*< private >*/ /*< private >*/
/* padding */ /* padding */

View File

@ -491,11 +491,8 @@ server_context_service_init (ServerContextService *context)
} }
ServerContextService * ServerContextService *
server_context_service_new (const gchar *client_name, server_context_service_new ()
const gchar *object_path)
{ {
return g_object_new (SERVER_TYPE_CONTEXT_SERVICE, return g_object_new (SERVER_TYPE_CONTEXT_SERVICE,
"client-name", client_name,
"object-path", object_path,
NULL); NULL);
} }

View File

@ -31,8 +31,7 @@ G_BEGIN_DECLS
typedef struct _ServerContextService ServerContextService; typedef struct _ServerContextService ServerContextService;
ServerContextService *server_context_service_new (const gchar *client_name, ServerContextService *server_context_service_new ();
const gchar *object_path);
G_END_DECLS G_END_DECLS
#endif /* SERVER_CONTEXT_SERVICE_H */ #endif /* SERVER_CONTEXT_SERVICE_H */

View File

@ -35,16 +35,10 @@ struct _ServerServiceClass {
G_DEFINE_TYPE (ServerService, server_service, EEKBOARD_TYPE_SERVICE); G_DEFINE_TYPE (ServerService, server_service, EEKBOARD_TYPE_SERVICE);
static EekboardContextService * static EekboardContextService *
server_service_real_create_context (EekboardService *self, server_service_real_create_context (EekboardService *self)
const gchar *client_name,
const gchar *object_path)
{ {
GDBusConnection *connection; (void)self;
ServerContextService *context; return EEKBOARD_CONTEXT_SERVICE(server_context_service_new ());
context = server_context_service_new (client_name, object_path);
return EEKBOARD_CONTEXT_SERVICE(context);
} }
static void static void