2010-05-24 17:42:52 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Intel, Inc
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Author: Thomas Wood <thomas.wood@intel.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-10-31 23:58:35 -04:00
|
|
|
#include "cc-keyboard-panel.h"
|
2010-12-07 16:29:22 +01:00
|
|
|
#include "keyboard-general.h"
|
|
|
|
#include "keyboard-shortcuts.h"
|
2010-05-24 17:42:52 +01:00
|
|
|
|
2010-10-31 23:58:35 -04:00
|
|
|
G_DEFINE_DYNAMIC_TYPE (CcKeyboardPanel, cc_keyboard_panel, CC_TYPE_PANEL)
|
2010-05-24 17:42:52 +01:00
|
|
|
|
2010-10-31 23:58:35 -04:00
|
|
|
#define KEYBOARD_PANEL_PRIVATE(o) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_PANEL, CcKeyboardPanelPrivate))
|
2010-05-24 17:42:52 +01:00
|
|
|
|
2010-10-31 23:58:35 -04:00
|
|
|
struct _CcKeyboardPanelPrivate
|
2010-05-24 17:42:52 +01:00
|
|
|
{
|
|
|
|
GtkBuilder *builder;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2010-10-31 23:58:35 -04:00
|
|
|
cc_keyboard_panel_get_property (GObject *object,
|
2010-05-24 17:42:52 +01:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-31 23:58:35 -04:00
|
|
|
cc_keyboard_panel_set_property (GObject *object,
|
2010-05-24 17:42:52 +01:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-31 23:58:35 -04:00
|
|
|
cc_keyboard_panel_dispose (GObject *object)
|
2010-05-24 17:42:52 +01:00
|
|
|
{
|
2010-12-07 16:29:22 +01:00
|
|
|
keyboard_general_dispose (CC_PANEL (object));
|
|
|
|
keyboard_shortcuts_dispose (CC_PANEL (object));
|
2010-11-16 12:13:01 +00:00
|
|
|
|
2010-10-31 23:58:35 -04:00
|
|
|
G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->dispose (object);
|
2010-05-24 17:42:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-31 23:58:35 -04:00
|
|
|
cc_keyboard_panel_finalize (GObject *object)
|
2010-05-24 17:42:52 +01:00
|
|
|
{
|
2010-10-31 23:58:35 -04:00
|
|
|
G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->finalize (object);
|
2010-05-24 17:42:52 +01:00
|
|
|
}
|
|
|
|
|
2010-11-16 12:13:01 +00:00
|
|
|
static GObject *
|
|
|
|
cc_keyboard_panel_constructor (GType gtype,
|
|
|
|
guint n_properties,
|
|
|
|
GObjectConstructParam *properties)
|
2010-05-24 17:42:52 +01:00
|
|
|
{
|
2010-11-16 12:13:01 +00:00
|
|
|
GObject *obj;
|
|
|
|
CcKeyboardPanel *self;
|
2010-10-31 23:58:35 -04:00
|
|
|
CcKeyboardPanelPrivate *priv;
|
2010-05-24 17:42:52 +01:00
|
|
|
GError *error = NULL;
|
2010-11-16 12:13:01 +00:00
|
|
|
GtkWidget *widget;
|
|
|
|
|
2010-10-31 23:58:35 -04:00
|
|
|
const gchar *uifile = GNOMECC_UI_DIR "/gnome-keyboard-panel.ui";
|
2010-05-24 17:42:52 +01:00
|
|
|
|
2010-11-16 12:13:01 +00:00
|
|
|
obj = G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->constructor (gtype, n_properties, properties);
|
2010-05-24 17:42:52 +01:00
|
|
|
|
2010-11-16 12:13:01 +00:00
|
|
|
self = CC_KEYBOARD_PANEL (obj);
|
|
|
|
priv = self->priv = KEYBOARD_PANEL_PRIVATE (self);
|
2010-05-24 17:42:52 +01:00
|
|
|
|
|
|
|
priv->builder = gtk_builder_new ();
|
|
|
|
|
|
|
|
if (gtk_builder_add_from_file (priv->builder, uifile, &error) == 0)
|
|
|
|
{
|
|
|
|
g_warning ("Could not load UI: %s", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
g_object_unref (priv->builder);
|
|
|
|
priv->builder = NULL;
|
2010-11-16 12:13:01 +00:00
|
|
|
return obj;
|
2010-05-24 17:42:52 +01:00
|
|
|
}
|
|
|
|
|
2010-12-07 16:29:22 +01:00
|
|
|
keyboard_general_init (CC_PANEL (self), priv->builder);
|
|
|
|
keyboard_shortcuts_init (CC_PANEL (self), priv->builder);
|
2010-05-24 17:42:52 +01:00
|
|
|
|
|
|
|
widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
|
2010-11-01 00:40:52 -04:00
|
|
|
"keyboard_notebook");
|
2010-05-24 17:42:52 +01:00
|
|
|
|
|
|
|
gtk_widget_reparent (widget, (GtkWidget *) self);
|
2010-11-16 12:13:01 +00:00
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (CcKeyboardPanelPrivate));
|
|
|
|
|
|
|
|
object_class->constructor = cc_keyboard_panel_constructor;
|
|
|
|
object_class->get_property = cc_keyboard_panel_get_property;
|
|
|
|
object_class->set_property = cc_keyboard_panel_set_property;
|
|
|
|
object_class->dispose = cc_keyboard_panel_dispose;
|
|
|
|
object_class->finalize = cc_keyboard_panel_finalize;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cc_keyboard_panel_class_finalize (CcKeyboardPanelClass *klass)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cc_keyboard_panel_init (CcKeyboardPanel *self)
|
|
|
|
{
|
2010-05-24 17:42:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-31 23:58:35 -04:00
|
|
|
cc_keyboard_panel_register (GIOModule *module)
|
2010-05-24 17:42:52 +01:00
|
|
|
{
|
2010-10-31 23:58:35 -04:00
|
|
|
cc_keyboard_panel_register_type (G_TYPE_MODULE (module));
|
2010-05-24 17:42:52 +01:00
|
|
|
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
|
2010-10-31 23:58:35 -04:00
|
|
|
CC_TYPE_KEYBOARD_PANEL,
|
|
|
|
"keyboard", 0);
|
2010-05-24 17:42:52 +01:00
|
|
|
}
|
|
|
|
|