[gnome-control-center] Converted keyboard capplet to panel



commit 7840afd7a1db92c1339f5a1ff78f110f561db0be
Author: Sergey V. Udaltsov <svu gnome org>
Date:   Fri May 21 23:22:29 2010 +0100

    Converted keyboard capplet to panel

 capplets/Makefile.am                               |    2 -
 capplets/keyboard/Makefile.am                      |   42 ------
 configure.ac                                       |    4 +-
 panels/Makefile.am                                 |    2 +-
 {capplets => panels}/keyboard/.indent.pro          |    0
 panels/keyboard/Makefile.am                        |   58 ++++++++
 panels/keyboard/cc-keyboard-panel.c                |  139 ++++++++++++++++++++
 panels/keyboard/cc-keyboard-panel.h                |   74 +++++++++++
 ...gnome-keyboard-properties-a11y-notifications.ui |    0
 .../keyboard/gnome-keyboard-properties-a11y.c      |    0
 .../keyboard/gnome-keyboard-properties-a11y.h      |    0
 .../keyboard/gnome-keyboard-properties-dialog.ui   |    0
 .../gnome-keyboard-properties-layout-chooser.ui    |    0
 .../gnome-keyboard-properties-model-chooser.ui     |    0
 .../gnome-keyboard-properties-options-dialog.ui    |    0
 .../keyboard/gnome-keyboard-properties-xkb.c       |    0
 .../keyboard/gnome-keyboard-properties-xkb.h       |    0
 .../keyboard/gnome-keyboard-properties-xkblt.c     |    0
 .../keyboard/gnome-keyboard-properties-xkbltadd.c  |    0
 .../keyboard/gnome-keyboard-properties-xkbmc.c     |    0
 .../keyboard/gnome-keyboard-properties-xkbot.c     |    0
 .../keyboard/gnome-keyboard-properties-xkbpv.c     |    0
 .../keyboard/gnome-keyboard-properties.c           |  127 ++++++------------
 panels/keyboard/keyboard-module.c                  |   41 ++++++
 .../keyboard/keyboard.desktop.in.in                |    0
 {capplets => panels}/keyboard/use_cases.txt        |    0
 26 files changed, 355 insertions(+), 134 deletions(-)
---
diff --git a/capplets/Makefile.am b/capplets/Makefile.am
index 74efd34..f2430b6 100644
--- a/capplets/Makefile.am
+++ b/capplets/Makefile.am
@@ -5,7 +5,6 @@ SUBDIRS = \
 	default-applications	\
 	display			\
 	keybindings		\
-	keyboard		\
 	network			\
 	windows
 
@@ -15,7 +14,6 @@ DIST_SUBDIRS = \
 	appearance		\
 	default-applications	\
 	keybindings		\
-	keyboard		\
 	network			\
 	windows			\
 	display 		\
diff --git a/configure.ac b/configure.ac
index c8d87cc..742191a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -390,8 +390,6 @@ capplets/display/display-properties.desktop.in
 capplets/keybindings/Makefile
 capplets/keybindings/gnome-keybindings.pc
 capplets/keybindings/keybinding.desktop.in
-capplets/keyboard/Makefile
-capplets/keyboard/keyboard.desktop.in
 capplets/network/Makefile
 capplets/network/gnome-network-properties.desktop.in
 capplets/windows/Makefile
@@ -412,6 +410,8 @@ libwindow-settings/gnome-window-settings-2.0.pc
 panels/Makefile
 panels/mouse/Makefile
 panels/mouse/gnome-settings-mouse.desktop.in
+panels/keyboard/Makefile
+panels/keyboard/keyboard.desktop.in
 po/Makefile.in
 shell/Makefile
 shell/gnome-control-center.desktop.in
diff --git a/panels/Makefile.am b/panels/Makefile.am
index bdb76a9..44f4b4f 100644
--- a/panels/Makefile.am
+++ b/panels/Makefile.am
@@ -1 +1 @@
-SUBDIRS=mouse
+SUBDIRS=mouse keyboard
diff --git a/capplets/keyboard/.indent.pro b/panels/keyboard/.indent.pro
similarity index 100%
rename from capplets/keyboard/.indent.pro
rename to panels/keyboard/.indent.pro
diff --git a/panels/keyboard/Makefile.am b/panels/keyboard/Makefile.am
new file mode 100644
index 0000000..b33968c
--- /dev/null
+++ b/panels/keyboard/Makefile.am
@@ -0,0 +1,58 @@
+# This is used in GNOMECC_CAPPLETS_CFLAGS
+cappletname = keyboard
+
+INCLUDES = 						\
+	$(PANEL_CFLAGS)					\
+	$(GNOMECC_CAPPLETS_CFLAGS)			\
+	-DGNOMELOCALEDIR="\"$(datadir)/locale\""	\
+	-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\""		\
+	-DGNOMECC_UI_DIR="\"$(uidir)\""
+	$(NULL)
+
+
+ccpanelsdir = $(PANELS_DIR)
+ccpanels_LTLIBRARIES = libkeyboard-properties.la
+
+libkeyboard_properties_la_SOURCES =	\
+		keyboard-module.c \
+		cc-keyboard-panel.c \
+	        gnome-keyboard-properties.c \
+	        gnome-keyboard-properties-a11y.c \
+	        gnome-keyboard-properties-a11y.h \
+	        gnome-keyboard-properties-xkb.c \
+	        gnome-keyboard-properties-xkbmc.c \
+	        gnome-keyboard-properties-xkblt.c \
+	        gnome-keyboard-properties-xkbltadd.c \
+	        gnome-keyboard-properties-xkbot.c \
+	        gnome-keyboard-properties-xkbpv.c \
+	        gnome-keyboard-properties-xkb.h
+
+libkeyboard_properties_la_LIBADD = $(PANEL_LIBS) $(LIBGNOMEKBDUI_LIBS) \
+	$(top_builddir)/capplets/common/libcommon.la
+
+libkeyboard_properties_la_LDFLAGS = $(PANEL_LDFLAGS)
+
+ INTLTOOL_DESKTOP_RULE@
+
+uidir   = $(pkgdatadir)/ui
+ui_DATA = gnome-keyboard-properties-a11y-notifications.ui \
+		gnome-keyboard-properties-dialog.ui \
+		gnome-keyboard-properties-layout-chooser.ui \
+		gnome-keyboard-properties-model-chooser.ui \
+		gnome-keyboard-properties-options-dialog.ui
+
+desktopdir = $(datadir)/applications
+Desktop_in_files = keyboard.desktop.in
+desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
+
+INCLUDES = \
+           $(GNOMECC_CAPPLETS_CFLAGS) \
+           $(LIBGNOMEKBDUI_CFLAGS) \
+           -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
+           -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
+           -DGNOMECC_UI_DIR="\"$(uidir)\""
+CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
+EXTRA_DIST = $(ui_DATA)
+
+
+-include $(top_srcdir)/git.mk
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
new file mode 100644
index 0000000..be2bafd
--- /dev/null
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -0,0 +1,139 @@
+/*
+ * 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>
+ *
+ */
+
+#include "cc-keyboard-panel.h"
+#include <gconf/gconf-client.h>
+#include <gtk/gtk.h>
+
+G_DEFINE_DYNAMIC_TYPE (CcKeyboardPanel, cc_keyboard_panel, CC_TYPE_PANEL)
+#define KEYBOARD_PANEL_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_PANEL, CcKeyboardPanelPrivate))
+struct _CcKeyboardPanelPrivate {
+	GtkBuilder *builder;
+	GConfClient *client;
+};
+
+
+static void
+cc_keyboard_panel_get_property (GObject * object,
+				guint property_id,
+				GValue * value, GParamSpec * pspec)
+{
+	switch (property_id) {
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
+						   pspec);
+	}
+}
+
+static void
+cc_keyboard_panel_set_property (GObject * object,
+				guint property_id,
+				const GValue * value, GParamSpec * pspec)
+{
+	switch (property_id) {
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
+						   pspec);
+	}
+}
+
+static void
+cc_keyboard_panel_dispose (GObject * object)
+{
+	CcKeyboardPanelPrivate *priv = CC_KEYBOARD_PANEL (object)->priv;
+	if (priv->client) {
+		g_object_unref (priv->client);
+		priv->client = NULL;
+	}
+
+	if (priv->builder) {
+		g_object_unref (priv->builder);
+		priv->builder = NULL;
+	}
+
+	G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->dispose (object);
+}
+
+static void
+cc_keyboard_panel_finalize (GObject * object)
+{
+	G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->finalize (object);
+}
+
+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->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)
+{
+}
+
+GtkWidget *gnome_keyboard_properties_init (GConfClient * client,
+					   GtkBuilder * dialog);
+
+static void
+cc_keyboard_panel_init (CcKeyboardPanel * self)
+{
+	CcKeyboardPanelPrivate *priv;
+	GtkWidget *prefs_widget;
+	GError *error = NULL;
+
+	priv = self->priv = KEYBOARD_PANEL_PRIVATE (self);
+
+	priv->client = gconf_client_get_default ();
+	priv->builder = gtk_builder_new ();
+
+	gtk_builder_add_from_file (priv->builder,
+				   GNOMECC_UI_DIR
+				   "/gnome-keyboard-properties-dialog.ui",
+				   &error);
+	if (error != NULL) {
+		g_warning ("Error loading UI file: %s", error->message);
+		return;
+	}
+
+	gnome_keyboard_properties_init (priv->client, priv->builder);
+
+	prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
+							     "keyboard_notebook");
+
+	gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
+}
+
+void
+cc_keyboard_panel_register (GIOModule * module)
+{
+	cc_keyboard_panel_register_type (G_TYPE_MODULE (module));
+	g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
+					CC_TYPE_KEYBOARD_PANEL,
+					"keyboard.desktop", 0);
+}
diff --git a/panels/keyboard/cc-keyboard-panel.h b/panels/keyboard/cc-keyboard-panel.h
new file mode 100644
index 0000000..fe6a011
--- /dev/null
+++ b/panels/keyboard/cc-keyboard-panel.h
@@ -0,0 +1,74 @@
+/*
+ * 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>
+ *
+ */
+
+
+#ifndef _CC_KEYBOARD_PANEL_H
+#define _CC_KEYBOARD_PANEL_H
+
+#include <libgnome-control-center/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_KEYBOARD_PANEL cc_keyboard_panel_get_type()
+
+#define CC_KEYBOARD_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_KEYBOARD_PANEL, CcKeyboardPanel))
+
+#define CC_KEYBOARD_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_KEYBOARD_PANEL, CcKeyboardPanelClass))
+
+#define CC_IS_KEYBOARD_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_KEYBOARD_PANEL))
+
+#define CC_IS_KEYBOARD_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_KEYBOARD_PANEL))
+
+#define CC_KEYBOARD_PANEL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_KEYBOARD_PANEL, CcKeyboardPanelClass))
+
+typedef struct _CcKeyboardPanel CcKeyboardPanel;
+typedef struct _CcKeyboardPanelClass CcKeyboardPanelClass;
+typedef struct _CcKeyboardPanelPrivate CcKeyboardPanelPrivate;
+
+struct _CcKeyboardPanel
+{
+  CcPanel parent;
+
+  CcKeyboardPanelPrivate *priv;
+};
+
+struct _CcKeyboardPanelClass
+{
+  CcPanelClass parent_class;
+};
+
+GType cc_keyboard_panel_get_type (void) G_GNUC_CONST;
+
+void  cc_keyboard_panel_register (GIOModule *module);
+
+G_END_DECLS
+
+#endif /* _CC_KEYBOARD_PANEL_H */
diff --git a/capplets/keyboard/gnome-keyboard-properties-a11y-notifications.ui b/panels/keyboard/gnome-keyboard-properties-a11y-notifications.ui
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-a11y-notifications.ui
rename to panels/keyboard/gnome-keyboard-properties-a11y-notifications.ui
diff --git a/capplets/keyboard/gnome-keyboard-properties-a11y.c b/panels/keyboard/gnome-keyboard-properties-a11y.c
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-a11y.c
rename to panels/keyboard/gnome-keyboard-properties-a11y.c
diff --git a/capplets/keyboard/gnome-keyboard-properties-a11y.h b/panels/keyboard/gnome-keyboard-properties-a11y.h
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-a11y.h
rename to panels/keyboard/gnome-keyboard-properties-a11y.h
diff --git a/capplets/keyboard/gnome-keyboard-properties-dialog.ui b/panels/keyboard/gnome-keyboard-properties-dialog.ui
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-dialog.ui
rename to panels/keyboard/gnome-keyboard-properties-dialog.ui
diff --git a/capplets/keyboard/gnome-keyboard-properties-layout-chooser.ui b/panels/keyboard/gnome-keyboard-properties-layout-chooser.ui
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-layout-chooser.ui
rename to panels/keyboard/gnome-keyboard-properties-layout-chooser.ui
diff --git a/capplets/keyboard/gnome-keyboard-properties-model-chooser.ui b/panels/keyboard/gnome-keyboard-properties-model-chooser.ui
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-model-chooser.ui
rename to panels/keyboard/gnome-keyboard-properties-model-chooser.ui
diff --git a/capplets/keyboard/gnome-keyboard-properties-options-dialog.ui b/panels/keyboard/gnome-keyboard-properties-options-dialog.ui
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-options-dialog.ui
rename to panels/keyboard/gnome-keyboard-properties-options-dialog.ui
diff --git a/capplets/keyboard/gnome-keyboard-properties-xkb.c b/panels/keyboard/gnome-keyboard-properties-xkb.c
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-xkb.c
rename to panels/keyboard/gnome-keyboard-properties-xkb.c
diff --git a/capplets/keyboard/gnome-keyboard-properties-xkb.h b/panels/keyboard/gnome-keyboard-properties-xkb.h
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-xkb.h
rename to panels/keyboard/gnome-keyboard-properties-xkb.h
diff --git a/capplets/keyboard/gnome-keyboard-properties-xkblt.c b/panels/keyboard/gnome-keyboard-properties-xkblt.c
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-xkblt.c
rename to panels/keyboard/gnome-keyboard-properties-xkblt.c
diff --git a/capplets/keyboard/gnome-keyboard-properties-xkbltadd.c b/panels/keyboard/gnome-keyboard-properties-xkbltadd.c
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-xkbltadd.c
rename to panels/keyboard/gnome-keyboard-properties-xkbltadd.c
diff --git a/capplets/keyboard/gnome-keyboard-properties-xkbmc.c b/panels/keyboard/gnome-keyboard-properties-xkbmc.c
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-xkbmc.c
rename to panels/keyboard/gnome-keyboard-properties-xkbmc.c
diff --git a/capplets/keyboard/gnome-keyboard-properties-xkbot.c b/panels/keyboard/gnome-keyboard-properties-xkbot.c
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-xkbot.c
rename to panels/keyboard/gnome-keyboard-properties-xkbot.c
diff --git a/capplets/keyboard/gnome-keyboard-properties-xkbpv.c b/panels/keyboard/gnome-keyboard-properties-xkbpv.c
similarity index 100%
rename from capplets/keyboard/gnome-keyboard-properties-xkbpv.c
rename to panels/keyboard/gnome-keyboard-properties-xkbpv.c
diff --git a/capplets/keyboard/gnome-keyboard-properties.c b/panels/keyboard/gnome-keyboard-properties.c
similarity index 67%
rename from capplets/keyboard/gnome-keyboard-properties.c
rename to panels/keyboard/gnome-keyboard-properties.c
index d2aef71..b56376f 100644
--- a/capplets/keyboard/gnome-keyboard-properties.c
+++ b/panels/keyboard/gnome-keyboard-properties.c
@@ -43,18 +43,12 @@ enum {
 	RESPONSE_CLOSE
 };
 
-static GtkBuilder *
-create_dialog (void)
+static void
+create_dialog (GtkBuilder * dialog)
 {
-	GtkBuilder *dialog;
 	GtkSizeGroup *size_group;
 	GtkWidget *image;
 
-	dialog = gtk_builder_new ();
-    gtk_builder_add_from_file (dialog, GNOMECC_UI_DIR
-                               "/gnome-keyboard-properties-dialog.ui",
-                               NULL);
-
 	size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 	gtk_size_group_add_widget (size_group, WID ("repeat_slow_label"));
 	gtk_size_group_add_widget (size_group, WID ("delay_short_label"));
@@ -70,16 +64,19 @@ create_dialog (void)
 	size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 	gtk_size_group_add_widget (size_group, WID ("repeat_delay_scale"));
 	gtk_size_group_add_widget (size_group, WID ("repeat_speed_scale"));
-	gtk_size_group_add_widget (size_group, WID ("cursor_blink_time_scale"));
+	gtk_size_group_add_widget (size_group,
+				   WID ("cursor_blink_time_scale"));
 	g_object_unref (G_OBJECT (size_group));
 
-	image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON);
+	image =
+	    gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON);
 	gtk_button_set_image (GTK_BUTTON (WID ("xkb_layouts_add")), image);
 
-	image = gtk_image_new_from_stock (GTK_STOCK_REFRESH, GTK_ICON_SIZE_BUTTON);
-	gtk_button_set_image (GTK_BUTTON (WID ("xkb_reset_to_defaults")), image);
-
-	return dialog;
+	image =
+	    gtk_image_new_from_stock (GTK_STOCK_REFRESH,
+				      GTK_ICON_SIZE_BUTTON);
+	gtk_button_set_image (GTK_BUTTON (WID ("xkb_reset_to_defaults")),
+			      image);
 }
 
 static GConfValue *
@@ -157,26 +154,34 @@ setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset)
 		g_free (monitor);
 
 		peditor = gconf_peditor_new_boolean
-			(changeset, "/desktop/gnome/typing_break/enabled",
-	     		WID ("break_enabled_toggle"), NULL);
-		gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor),
-						WID ("break_details_table"));
+		    (changeset, "/desktop/gnome/typing_break/enabled",
+		     WID ("break_enabled_toggle"), NULL);
+		gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR
+						(peditor),
+						WID
+						("break_details_table"));
 		gconf_peditor_new_numeric_range (changeset,
 						 "/desktop/gnome/typing_break/type_time",
-						 WID ("break_enabled_spin"), NULL);
+						 WID
+						 ("break_enabled_spin"),
+						 NULL);
 		gconf_peditor_new_numeric_range (changeset,
 						 "/desktop/gnome/typing_break/break_time",
-						 WID ("break_interval_spin"),
+						 WID
+						 ("break_interval_spin"),
 						 NULL);
 		gconf_peditor_new_boolean (changeset,
 					   "/desktop/gnome/typing_break/allow_postpone",
-					   WID ("break_postponement_toggle"),
+					   WID
+					   ("break_postponement_toggle"),
 					   NULL);
 
 	} else {
 		/* don't show the typing break tab if the daemon is not available */
 		GtkNotebook *nb = GTK_NOTEBOOK (WID ("keyboard_notebook"));
-		gint tb_page = gtk_notebook_page_num (nb, WID ("break_enabled_toggle"));
+		gint tb_page =
+		    gtk_notebook_page_num (nb,
+					   WID ("break_enabled_toggle"));
 		gtk_notebook_remove_page (nb, tb_page);
 	}
 
@@ -187,79 +192,27 @@ setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset)
 	setup_a11y_tabs (dialog, changeset);
 }
 
-int
-main (int argc, char **argv)
-{
-	GConfClient *client;
-	GConfChangeSet *changeset;
-	GtkBuilder *dialog;
-	GOptionContext *context;
-
-	static gboolean apply_only = FALSE;
-	static gboolean switch_to_typing_break_page = FALSE;
-	static gboolean switch_to_a11y_page = FALSE;
-
-	static GOptionEntry cap_options[] = {
-		{"apply", 0, 0, G_OPTION_ARG_NONE, &apply_only,
-		 N_
-		 ("Just apply settings and quit (compatibility only; now handled by daemon)"),
-		 NULL},
-		{"init-session-settings", 0, 0, G_OPTION_ARG_NONE,
-		 &apply_only,
-		 N_
-		 ("Just apply settings and quit (compatibility only; now handled by daemon)"),
-		 NULL},
-		{"typing-break", 0, 0, G_OPTION_ARG_NONE,
-		 &switch_to_typing_break_page,
-		 N_
-		 ("Start the page with the typing break settings showing"),
-		 NULL},
-		{"a11y", 0, 0, G_OPTION_ARG_NONE,
-		 &switch_to_a11y_page,
-		 N_
-		 ("Start the page with the accessibility settings showing"),
-		 NULL},
-		{NULL}
-	};
-
-
-	context = g_option_context_new (_("- GNOME Keyboard Preferences"));
-	g_option_context_add_main_entries (context, cap_options,
-					   GETTEXT_PACKAGE);
-
-	capplet_init (context, &argc, &argv);
 
+GtkWidget *
+gnome_keyboard_properties_init (GConfClient * client, GtkBuilder * dialog)
+{
+	GtkWidget *dialog_win = NULL;
 	activate_settings_daemon ();
 
-	client = gconf_client_get_default ();
 	gconf_client_add_dir (client,
 			      "/desktop/gnome/peripherals/keyboard",
 			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 	gconf_client_add_dir (client, "/desktop/gnome/interface",
 			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-	g_object_unref (client);
-
-	changeset = NULL;
-	dialog = create_dialog ();
-	setup_dialog (dialog, changeset);
-	if (switch_to_typing_break_page) {
-		gtk_notebook_set_current_page (GTK_NOTEBOOK
-					       (WID
-						("keyboard_notebook")),
-					       4);
-	}
-	else if (switch_to_a11y_page) {
-		gtk_notebook_set_current_page (GTK_NOTEBOOK
-					       (WID
-						("keyboard_notebook")),
-					       2);
-
+	create_dialog (dialog);
+	if (dialog) {
+		setup_dialog (dialog, NULL);
+		dialog_win = WID ("keyboard_dialog");
+		/* g_signal_connect (dialog_win, "response",
+		   G_CALLBACK (dialog_response_cb), NULL); */
+		capplet_set_icon (dialog_win,
+				  "preferences-desktop-keyboard");
 	}
 
-	capplet_set_icon (WID ("keyboard_dialog"),
-			  "preferences-desktop-keyboard");
-	gtk_widget_show (WID ("keyboard_dialog"));
-	gtk_main ();
-
-	return 0;
+	return dialog_win;
 }
diff --git a/panels/keyboard/keyboard-module.c b/panels/keyboard/keyboard-module.c
new file mode 100644
index 0000000..0afca41
--- /dev/null
+++ b/panels/keyboard/keyboard-module.c
@@ -0,0 +1,41 @@
+/*
+ * 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: Sergey Udaltsov <svu gnome org>
+ *
+ */
+
+#include <config.h>
+
+#include "cc-keyboard-panel.h"
+
+#include <glib/gi18n.h>
+
+void
+g_io_module_load (GIOModule * module)
+{
+	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* register the panel */
+	cc_keyboard_panel_register (module);
+}
+
+void
+g_io_module_unload (GIOModule * module)
+{
+}
diff --git a/capplets/keyboard/keyboard.desktop.in.in b/panels/keyboard/keyboard.desktop.in.in
similarity index 100%
rename from capplets/keyboard/keyboard.desktop.in.in
rename to panels/keyboard/keyboard.desktop.in.in
diff --git a/capplets/keyboard/use_cases.txt b/panels/keyboard/use_cases.txt
similarity index 100%
rename from capplets/keyboard/use_cases.txt
rename to panels/keyboard/use_cases.txt



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]