Commit 2e822cb6 authored by Daiki Ueno's avatar Daiki Ueno
Browse files

Don't crash when all the keyboards are removed.

parent f2a90935
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include "eekboard/eekboard-client.h" #include "eekboard/eekboard-client.h"
#include "client.h" #include "client.h"
#define DEFAULT_KEYBOARD "us"
static gboolean opt_system = FALSE; static gboolean opt_system = FALSE;
static gboolean opt_session = FALSE; static gboolean opt_session = FALSE;
static gchar *opt_address = NULL; static gchar *opt_address = NULL;
......
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
#define CSW 640 #define CSW 640
#define CSH 480 #define CSH 480
#define DEFAULT_KEYBOARD "us"
static gchar *default_keyboards[2] = {
DEFAULT_KEYBOARD,
NULL
};
#define IBUS_INTERFACE_PANEL "org.freedesktop.IBus.Panel" #define IBUS_INTERFACE_PANEL "org.freedesktop.IBus.Panel"
enum { enum {
...@@ -141,6 +147,7 @@ client_set_property (GObject *object, ...@@ -141,6 +147,7 @@ client_set_property (GObject *object,
{ {
Client *client = CLIENT(object); Client *client = CLIENT(object);
GDBusConnection *connection; GDBusConnection *connection;
gchar **keyboards;
switch (prop_id) { switch (prop_id) {
case PROP_CONNECTION: case PROP_CONNECTION:
...@@ -166,7 +173,10 @@ client_set_property (GObject *object, ...@@ -166,7 +173,10 @@ client_set_property (GObject *object,
} }
break; break;
case PROP_KEYBOARDS: case PROP_KEYBOARDS:
client_set_keyboards (client, g_value_get_boxed (value)); keyboards = g_value_get_boxed (value);
if (g_strv_length (keyboards) == 0)
keyboards = default_keyboards;
client_set_keyboards (client, (const gchar * const *)keyboards);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......
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