managers: Move visible flag to UI manager

This commit is contained in:
Dorota Czaplejewicz
2020-01-09 14:14:48 +00:00
parent 7e72722a47
commit 9f59279307
10 changed files with 98 additions and 116 deletions

View File

@ -48,7 +48,6 @@
enum {
PROP_0, // Magic: without this, keyboard is not useable in g_object_notify
PROP_KEYBOARD,
PROP_VISIBLE,
PROP_LAST
};
@ -66,7 +65,6 @@ static guint signals[LAST_SIGNAL] = { 0, };
struct _EekboardContextServicePrivate {
gboolean enabled;
gboolean visible;
LevelKeyboard *keyboard; // currently used keyboard
GHashTable *keyboard_hash; // a table of available keyboards, per layout
@ -135,18 +133,6 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
return keyboard;
}
void
eekboard_context_service_real_show_keyboard (EekboardContextService *self)
{
self->priv->visible = TRUE;
}
void
eekboard_context_service_real_hide_keyboard (EekboardContextService *self)
{
self->priv->visible = FALSE;
}
static void
eekboard_context_service_set_property (GObject *object,
guint prop_id,
@ -161,9 +147,6 @@ eekboard_context_service_set_property (GObject *object,
g_object_unref (context->priv->keyboard);
context->priv->keyboard = g_value_get_object (value);
break;
case PROP_VISIBLE:
context->priv->visible = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -182,9 +165,6 @@ eekboard_context_service_get_property (GObject *object,
case PROP_KEYBOARD:
g_value_set_object (value, context->priv->keyboard);
break;
case PROP_VISIBLE:
g_value_set_boolean (value, context->priv->visible);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -362,20 +342,6 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
g_object_class_install_property (gobject_class,
PROP_KEYBOARD,
pspec);
/**
* EekboardContextService:visible:
*
* Flag to indicate if keyboard is visible or not.
*/
pspec = g_param_spec_boolean ("visible",
"Visible",
"Visible",
FALSE,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_VISIBLE,
pspec);
}
static void
@ -437,26 +403,6 @@ eekboard_context_service_disable (EekboardContextService *context)
}
}
void
eekboard_context_service_show_keyboard (EekboardContextService *context)
{
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
if (!context->priv->visible) {
server_context_service_real_show_keyboard (context);
}
}
void
eekboard_context_service_hide_keyboard (EekboardContextService *context)
{
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
if (context->priv->visible) {
server_context_service_real_hide_keyboard (context);
}
}
/**
* eekboard_context_service_destroy:
* @context: an #EekboardContextService

View File

@ -88,14 +88,6 @@ GType eekboard_context_service_get_type
(void) G_GNUC_CONST;
void eekboard_context_service_enable (EekboardContextService *context);
void eekboard_context_service_disable (EekboardContextService *context);
void eekboard_context_service_show_keyboard
(EekboardContextService *context);
void
eekboard_context_service_real_show_keyboard (EekboardContextService *self);
void
eekboard_context_service_real_hide_keyboard (EekboardContextService *self);
void eekboard_context_service_hide_keyboard
(EekboardContextService *context);
void eekboard_context_service_destroy (EekboardContextService *context);
LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);

View File

@ -58,7 +58,7 @@ typedef struct _EekboardServicePrivate
guint registration_id;
char *object_path;
EekboardContextService *context; // unowned reference
ServerContextService *context; // unowned reference
} EekboardServicePrivate;
G_DEFINE_TYPE_WITH_PRIVATE (EekboardService, eekboard_service, G_TYPE_OBJECT)
@ -162,9 +162,9 @@ handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
if (priv->context) {
if (arg_visible) {
eekboard_context_service_show_keyboard (priv->context);
server_context_service_show_keyboard (priv->context);
} else {
eekboard_context_service_hide_keyboard (priv->context);
server_context_service_hide_keyboard (priv->context);
}
}
sm_puri_osk0_complete_set_visible(object, invocation);
@ -173,13 +173,13 @@ handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
static void on_visible(EekboardService *service,
GParamSpec *pspec,
EekboardContextService *context)
ServerContextService *context)
{
gboolean visible;
EekboardServicePrivate *priv;
g_return_if_fail (EEKBOARD_IS_SERVICE (service));
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE (context));
g_return_if_fail (SERVER_IS_CONTEXT_SERVICE (context));
priv = eekboard_service_get_instance_private (service);
g_object_get (context, "visible", &visible, NULL);
@ -295,7 +295,7 @@ eekboard_service_new (GDBusConnection *connection,
void
eekboard_service_set_context(EekboardService *service,
EekboardContextService *context)
ServerContextService *context)
{
EekboardServicePrivate *priv = eekboard_service_get_instance_private (service);

View File

@ -20,7 +20,7 @@
#define __EEKBOARD_SERVICE_H_INSIDE__ 1
#include "eekboard/eekboard-context-service.h"
#include "server-context-service.h"
G_BEGIN_DECLS
@ -50,6 +50,6 @@ GType eekboard_service_get_type (void) G_GNUC_CONST;
EekboardService * eekboard_service_new (GDBusConnection *connection,
const gchar *object_path);
void eekboard_service_set_context(EekboardService *service,
EekboardContextService *context);
ServerContextService *context);
G_END_DECLS
#endif /* EEKBOARD_SERVICE_H */