diff options
author | William Jon McCann <jmccann@redhat.com> | 2010-01-16 22:43:55 -0500 |
---|---|---|
committer | William Jon McCann <jmccann@redhat.com> | 2010-01-16 22:44:23 -0500 |
commit | de38485c5fb296b7af601abfd29d12f01776461e (patch) | |
tree | cd041ff70750ca09a06345d0d99673d7f62da7a0 | |
parent | ce6e1fe0b1104483ce1713ef524d01b47af24bbf (diff) | |
download | gnome-control-center-de38485c5fb296b7af601abfd29d12f01776461e.tar.gz |
[keyboard] Convert to CcPage
-rw-r--r-- | capplets/keyboard/Makefile.am | 29 | ||||
-rw-r--r-- | capplets/keyboard/cc-keyboard-panel.c | 153 | ||||
-rw-r--r-- | capplets/keyboard/gnome-keyboard-properties-dialog.ui | 2 |
3 files changed, 32 insertions, 152 deletions
diff --git a/capplets/keyboard/Makefile.am b/capplets/keyboard/Makefile.am index e608163df..7232a9c06 100644 --- a/capplets/keyboard/Makefile.am +++ b/capplets/keyboard/Makefile.am @@ -10,29 +10,15 @@ INCLUDES = \ -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ -DGNOMECC_UI_DIR="\"$(uidir)\"" -noinst_LTLIBRARIES = libkeyboard-common.la - bin_PROGRAMS = gnome-keyboard-properties -libkeyboard_common_la_SOURCES = \ - 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_common_la_LDFLAGS = \ - -no-undefined -export_dynamic -avoid-version - ccmodulesdir = $(libdir)/control-center-1/extensions ccmodules_LTLIBRARIES = libkeyboard.la libkeyboard_la_SOURCES = \ keyboard-module.c \ + cc-keyboard-page.h \ + cc-keyboard-page.c \ cc-keyboard-panel.h \ cc-keyboard-panel.c @@ -40,7 +26,6 @@ libkeyboard_la_LDFLAGS = \ $(module_flags) libkeyboard_la_LIBADD = \ - libkeyboard-common.la \ $(GNOMECC_CAPPLETS_LIBS) \ $(LIBGNOMEKBDUI_LIBS) @@ -49,10 +34,18 @@ libkeyboard_la_CFLAGS = \ -I$(top_srcdir)/shell gnome_keyboard_properties_SOURCES = \ + 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 \ gnome-keyboard-properties.c gnome_keyboard_properties_LDADD = \ - libkeyboard-common.la \ $(GNOMECC_CAPPLETS_LIBS) \ $(LIBGNOMEKBDUI_LIBS) diff --git a/capplets/keyboard/cc-keyboard-panel.c b/capplets/keyboard/cc-keyboard-panel.c index bd45ee692..bc8fc0519 100644 --- a/capplets/keyboard/cc-keyboard-panel.c +++ b/capplets/keyboard/cc-keyboard-panel.c @@ -27,13 +27,10 @@ #include <gio/gio.h> #include <glib/gi18n-lib.h> -#include "cc-keyboard-panel.h" - -#include "gconf-property-editor.h" -#include "capplet-stock-icons.h" +#include <gconf/gconf-client.h> -#include "gnome-keyboard-properties-a11y.h" -#include "gnome-keyboard-properties-xkb.h" +#include "cc-keyboard-panel.h" +#include "cc-keyboard-page.h" #define CC_KEYBOARD_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_PANEL, CcKeyboardPanelPrivate)) @@ -41,7 +38,8 @@ struct CcKeyboardPanelPrivate { - gpointer dummy; + GtkWidget *notebook; + CcPage *keyboard_page; }; enum { @@ -80,137 +78,26 @@ cc_keyboard_panel_get_property (GObject *object, } } - -static GConfValue * -blink_from_widget (GConfPropertyEditor *peditor, - const GConfValue *value) -{ - GConfValue *new_value; - - new_value = gconf_value_new (GCONF_VALUE_INT); - gconf_value_set_int (new_value, - 2600 - gconf_value_get_int (value)); - - return new_value; -} - -static GConfValue * -blink_to_widget (GConfPropertyEditor * peditor, const GConfValue * value) -{ - GConfValue *new_value; - gint current_rate; - - current_rate = gconf_value_get_int (value); - new_value = gconf_value_new (GCONF_VALUE_INT); - gconf_value_set_int (new_value, - CLAMP (2600 - current_rate, 100, 2500)); - - return new_value; -} - static void setup_panel (CcKeyboardPanel *panel) { - GtkBuilder *builder; - GtkSizeGroup *size_group; - GtkWidget *image; - GtkWidget *widget; - GObject *peditor; - char *monitor; - GConfChangeSet *changeset; - - changeset = NULL; - - builder = gtk_builder_new (); - gtk_builder_add_from_file (builder, - 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")); - gtk_size_group_add_widget (size_group, WID ("blink_slow_label")); - g_object_unref (G_OBJECT (size_group)); - - size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - gtk_size_group_add_widget (size_group, WID ("repeat_fast_label")); - gtk_size_group_add_widget (size_group, WID ("delay_long_label")); - gtk_size_group_add_widget (size_group, WID ("blink_fast_label")); - g_object_unref (G_OBJECT (size_group)); - - 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")); - g_object_unref (G_OBJECT (size_group)); - - 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); - - peditor = gconf_peditor_new_boolean (changeset, "/desktop/gnome/peripherals/keyboard/repeat", - WID ("repeat_toggle"), NULL); - gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), - WID ("repeat_table")); - - gconf_peditor_new_numeric_range (changeset, "/desktop/gnome/peripherals/keyboard/delay", - WID ("repeat_delay_scale"), NULL); - - gconf_peditor_new_numeric_range (changeset, "/desktop/gnome/peripherals/keyboard/rate", - WID ("repeat_speed_scale"), NULL); - - peditor = gconf_peditor_new_boolean (changeset, "/desktop/gnome/interface/cursor_blink", - WID ("cursor_toggle"), NULL); - gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), - WID ("cursor_hbox")); - gconf_peditor_new_numeric_range (changeset, - "/desktop/gnome/interface/cursor_blink_time", - WID ("cursor_blink_time_scale"), - "conv-to-widget-cb", - blink_to_widget, - "conv-from-widget-cb", - blink_from_widget, NULL); - - /* Ergonomics */ - monitor = g_find_program_in_path ("gnome-typing-monitor"); - if (monitor != NULL) { - 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")); - gconf_peditor_new_numeric_range (changeset, - "/desktop/gnome/typing_break/type_time", - WID ("break_enabled_spin"), NULL); - gconf_peditor_new_numeric_range (changeset, - "/desktop/gnome/typing_break/break_time", - WID ("break_interval_spin"), - NULL); - gconf_peditor_new_boolean (changeset, - "/desktop/gnome/typing_break/allow_postpone", - WID ("break_postponement_toggle"), - NULL); - - } else { - /* don't show the typing break tab if the daemon is not available */ - GtkNotebook *nb; - gint tb_page; - - nb = GTK_NOTEBOOK (WID ("keyboard_notebook")); - tb_page = gtk_notebook_page_num (nb, WID ("break_enabled_toggle")); - gtk_notebook_remove_page (nb, tb_page); - } + GtkWidget *label; + char *display_name; - setup_xkb_tabs (builder, changeset); - setup_a11y_tabs (builder, changeset); + panel->priv->notebook = gtk_notebook_new (); + gtk_container_add (GTK_CONTAINER (panel), panel->priv->notebook); + gtk_widget_show (panel->priv->notebook); - widget = WID ("main-vbox"); - gtk_widget_reparent (widget, GTK_WIDGET (panel)); - gtk_widget_show (widget); + panel->priv->keyboard_page = cc_keyboard_page_new (); + g_object_get (panel->priv->keyboard_page, + "display-name", &display_name, + NULL); + label = gtk_label_new (display_name); + g_free (display_name); + gtk_notebook_append_page (GTK_NOTEBOOK (panel->priv->notebook), + GTK_WIDGET (panel->priv->keyboard_page), + label); + gtk_widget_show (GTK_WIDGET (panel->priv->keyboard_page)); } static GObject * diff --git a/capplets/keyboard/gnome-keyboard-properties-dialog.ui b/capplets/keyboard/gnome-keyboard-properties-dialog.ui index 54597873e..5de255124 100644 --- a/capplets/keyboard/gnome-keyboard-properties-dialog.ui +++ b/capplets/keyboard/gnome-keyboard-properties-dialog.ui @@ -93,7 +93,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <child> - <object class="GtkVBox" id="vbox2"> + <object class="GtkVBox" id="general_vbox"> <property name="visible">True</property> <property name="border_width">12</property> <property name="orientation">vertical</property> |