diff options
author | Sergey V. Udaltsov <svu@src.gnome.org> | 2008-10-27 22:44:57 +0000 |
---|---|---|
committer | Sergey V. Udaltsov <svu@src.gnome.org> | 2008-10-27 22:44:57 +0000 |
commit | d178f241d9d60a8428e7f5e5d341a1f743e20ca7 (patch) | |
tree | 7645f3f71ac88a8a31e3c1b8a4a36d968dee22c6 /capplets/keyboard | |
parent | fab37a0965b5c2a421c9419202394325692e8853 (diff) | |
download | gnome-control-center-d178f241d9d60a8428e7f5e5d341a1f743e20ca7.tar.gz |
show/hide 'default' column, b.g.o#555261
svn path=/trunk/; revision=9128
Diffstat (limited to 'capplets/keyboard')
-rw-r--r-- | capplets/keyboard/ChangeLog | 6 | ||||
-rw-r--r-- | capplets/keyboard/gnome-keyboard-properties-xkblt.c | 52 | ||||
-rw-r--r-- | capplets/keyboard/gnome-keyboard-properties.glade | 280 |
3 files changed, 182 insertions, 156 deletions
diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog index d145fd5b6..5a2234661 100644 --- a/capplets/keyboard/ChangeLog +++ b/capplets/keyboard/ChangeLog @@ -1,3 +1,9 @@ +2008-10-27 Sergey Udaltsov <svu@gnome.org> + + * gnome-keyboard-properties-xkblt.c, gnome-keyboard-properties.glade: + hide/show the "Default" column depending on the "layout per window" + checkbox, http://bugzilla.gnome.org/show_bug.cgi?id=555261 + 2008-10-26 Jens Granseuer <jensgr@gmx.net> * gnome-keyboard-properties-xkbot.c: (xkb_options_popup_dialog): diff --git a/capplets/keyboard/gnome-keyboard-properties-xkblt.c b/capplets/keyboard/gnome-keyboard-properties-xkblt.c index 195df59d5..bc4733469 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkblt.c +++ b/capplets/keyboard/gnome-keyboard-properties-xkblt.c @@ -208,16 +208,43 @@ xkb_layouts_enable_disable_buttons (GladeXML * dialog) (n_selected_selected_layouts > 0)); } +static GtkTreeViewColumn * +xkb_layouts_create_default_layout_column () +{ + GtkTreeViewColumn *def_column = + gtk_tree_view_column_new_with_attributes (_("Default"), + toggle_renderer, + "active", + SEL_LAYOUT_TREE_COL_DEFAULT, + NULL); + gtk_tree_view_column_set_sizing (def_column, + GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_column_set_resizable (def_column, TRUE); + gtk_tree_view_column_set_expand (def_column, FALSE); + return def_column; +} + void xkb_layouts_enable_disable_default (GladeXML * dialog, gboolean enable) { - GValue val = { 0 }; GtkWidget *tree_view = WID ("xkb_layouts_selected"); - g_value_init (&val, G_TYPE_BOOLEAN); - g_value_set_boolean (&val, enable); - g_object_set_property (G_OBJECT (toggle_renderer), "activatable", - &val); + if (enable) { + gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), + xkb_layouts_create_default_layout_column + ()); + g_object_unref (toggle_renderer); + } else { + GtkTreeViewColumn *col = + gtk_tree_view_get_column (GTK_TREE_VIEW (tree_view), + 1); + if (col != NULL) { + g_object_ref (toggle_renderer); + gtk_tree_view_column_clear (col); + gtk_tree_view_remove_column (GTK_TREE_VIEW + (tree_view), col); + } + } gtk_widget_draw (tree_view, NULL); } @@ -290,16 +317,17 @@ xkb_layouts_prepare_selected_tree (GladeXML * dialog, gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING); GtkWidget *tree_view = WID ("xkb_layouts_selected"); - GtkTreeViewColumn *desc_column, *def_column; GtkTreeSelection *selection; GtkTargetEntry self_drag_target = { "xkb_layouts_selected", GTK_TARGET_SAME_WIDGET, 0 }; + GtkTreeViewColumn *desc_column; text_renderer = GTK_CELL_RENDERER (gtk_cell_renderer_text_new ()); toggle_renderer = GTK_CELL_RENDERER (gtk_cell_renderer_toggle_new ()); gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE (toggle_renderer), TRUE); + g_object_ref (toggle_renderer); desc_column = gtk_tree_view_column_new_with_attributes (_("Layout"), @@ -307,12 +335,6 @@ xkb_layouts_prepare_selected_tree (GladeXML * dialog, "text", SEL_LAYOUT_TREE_COL_DESCRIPTION, NULL); - def_column = - gtk_tree_view_column_new_with_attributes (_("Default"), - toggle_renderer, - "active", - SEL_LAYOUT_TREE_COL_DEFAULT, - NULL); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); @@ -321,17 +343,11 @@ xkb_layouts_prepare_selected_tree (GladeXML * dialog, gtk_tree_view_column_set_sizing (desc_column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); - gtk_tree_view_column_set_sizing (def_column, - GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_column_set_resizable (desc_column, TRUE); - gtk_tree_view_column_set_resizable (def_column, TRUE); gtk_tree_view_column_set_expand (desc_column, TRUE); - gtk_tree_view_column_set_expand (def_column, FALSE); gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), desc_column); - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - def_column); g_signal_connect_swapped (G_OBJECT (selection), "changed", G_CALLBACK diff --git a/capplets/keyboard/gnome-keyboard-properties.glade b/capplets/keyboard/gnome-keyboard-properties.glade index e120a3ad6..6916477b3 100644 --- a/capplets/keyboard/gnome-keyboard-properties.glade +++ b/capplets/keyboard/gnome-keyboard-properties.glade @@ -1,4 +1,6 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> +<!--Generated with glade3 3.4.5 on Mon Oct 27 19:13:30 2008 --> <glade-interface> <widget class="GtkDialog" id="keyboard_dialog"> <property name="border_width">5</property> @@ -364,7 +366,7 @@ </widget> </child> <child> - <widget class="GtkLabel" id="label1"> + <widget class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="label" translatable="yes">General</property> <property name="justify">GTK_JUSTIFY_CENTER</property> @@ -418,6 +420,20 @@ <property name="visible">True</property> <property name="spacing">6</property> <child> + <widget class="GtkCheckButton" id="chk_separate_group_per_window"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Separate _layout for each window</property> + <property name="use_underline">True</property> + <property name="response_id">0</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + <child> <widget class="GtkVBox" id="vbox41"> <property name="visible">True</property> <property name="spacing">6</property> @@ -459,19 +475,7 @@ </packing> </child> </widget> - </child> - <child> - <widget class="GtkCheckButton" id="chk_separate_group_per_window"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Separate _layout for each window</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - </widget> <packing> - <property name="expand">False</property> - <property name="fill">False</property> <property name="position">1</property> </packing> </child> @@ -1075,100 +1079,84 @@ <property name="column_spacing">12</property> <property name="row_spacing">6</property> <child> - <widget class="GtkLabel" id="mousekeys_long_label"> + <widget class="GtkLabel" id="mousekeys_slow_label2"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><small><i>Long</i></small></property> + <property name="xalign">1</property> + <property name="label" translatable="yes"><small><i>Slow</i></small></property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_CENTER</property> </widget> <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkHScale" id="mousekeys_init_delay_slide"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property> - <property name="adjustment">300 10 2000 10 10 0</property> - <property name="digits">0</property> - <property name="draw_value">False</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="mousekeys_short_label"> + <widget class="GtkLabel" id="mousekeys_slow_label"> <property name="visible">True</property> <property name="xalign">1</property> - <property name="label" translatable="yes"><small><i>Short</i></small></property> + <property name="label" translatable="yes"><small><i>Slow</i></small></property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_CENTER</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="mousekeys_delay_label"> + <widget class="GtkHScale" id="mousekeys_accel_time_slide"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Delay:</property> - <property name="use_underline">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="mnemonic_widget">mousekeys_init_delay_slide</property> + <property name="can_focus">True</property> + <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property> + <property name="adjustment">1800 0 3000 10 10 0</property> + <property name="draw_value">False</property> + <property name="value_pos">GTK_POS_RIGHT</property> </widget> <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> + <property name="left_attach">2</property> + <property name="right_attach">3</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <widget class="GtkLabel" id="mousekeys_acceleration_label"> + <widget class="GtkHScale" id="mousekeys_max_speed_slide"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">A_cceleration:</property> - <property name="use_underline">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="mnemonic_widget">mousekeys_accel_time_slide</property> + <property name="can_focus">True</property> + <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property> + <property name="adjustment">300 10 1000 10 10 0</property> + <property name="digits">0</property> + <property name="draw_value">False</property> </widget> <packing> - <property name="x_options">GTK_FILL</property> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <widget class="GtkLabel" id="mousekeys_speed_label"> + <widget class="GtkLabel" id="mousekeys_fast_label2"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">_Speed:</property> - <property name="use_underline">True</property> + <property name="label" translatable="yes"><small><i>Fast</i></small></property> + <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="mnemonic_widget">mousekeys_max_speed_slide</property> </widget> <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> + <property name="y_options"></property> </packing> </child> <child> @@ -1187,82 +1175,98 @@ </packing> </child> <child> - <widget class="GtkLabel" id="mousekeys_fast_label2"> + <widget class="GtkLabel" id="mousekeys_speed_label"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes"><small><i>Fast</i></small></property> - <property name="use_markup">True</property> + <property name="label" translatable="yes">_Speed:</property> + <property name="use_underline">True</property> <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="mnemonic_widget">mousekeys_max_speed_slide</property> </widget> <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> + <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <widget class="GtkHScale" id="mousekeys_max_speed_slide"> + <widget class="GtkLabel" id="mousekeys_acceleration_label"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property> - <property name="adjustment">300 10 1000 10 10 0</property> - <property name="digits">0</property> - <property name="draw_value">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">A_cceleration:</property> + <property name="use_underline">True</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="mnemonic_widget">mousekeys_accel_time_slide</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <widget class="GtkHScale" id="mousekeys_accel_time_slide"> + <widget class="GtkLabel" id="mousekeys_delay_label"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property> - <property name="adjustment">1800 0 3000 10 10 0</property> - <property name="draw_value">False</property> - <property name="value_pos">GTK_POS_RIGHT</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Delay:</property> + <property name="use_underline">True</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="mnemonic_widget">mousekeys_init_delay_slide</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <widget class="GtkLabel" id="mousekeys_slow_label"> + <widget class="GtkLabel" id="mousekeys_short_label"> <property name="visible">True</property> <property name="xalign">1</property> - <property name="label" translatable="yes"><small><i>Slow</i></small></property> + <property name="label" translatable="yes"><small><i>Short</i></small></property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_CENTER</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="mousekeys_slow_label2"> + <widget class="GtkHScale" id="mousekeys_init_delay_slide"> <property name="visible">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes"><small><i>Slow</i></small></property> + <property name="can_focus">True</property> + <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property> + <property name="adjustment">300 10 2000 10 10 0</property> + <property name="digits">0</property> + <property name="draw_value">False</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="mousekeys_long_label"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes"><small><i>Long</i></small></property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_CENTER</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> @@ -1731,53 +1735,53 @@ <property name="column_spacing">12</property> <property name="row_spacing">6</property> <child> - <widget class="GtkLabel" id="label3"> + <widget class="GtkComboBox" id="xkb_country_variants_available"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Country:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">xkb_countries_available</property> </widget> <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label4"> + <widget class="GtkComboBox" id="xkb_countries_available"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Variants:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">xkb_country_variants_available</property> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="xkb_countries_available"> + <widget class="GtkLabel" id="label4"> <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Variants:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">xkb_country_variants_available</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="xkb_country_variants_available"> + <widget class="GtkLabel" id="label3"> <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Country:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">xkb_countries_available</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> @@ -1812,53 +1816,53 @@ <property name="column_spacing">12</property> <property name="row_spacing">6</property> <child> - <widget class="GtkLabel" id="label12"> + <widget class="GtkComboBox" id="xkb_language_variants_available"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Language:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">xkb_countries_available</property> </widget> <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label13"> + <widget class="GtkComboBox" id="xkb_languages_available"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Variants:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">xkb_country_variants_available</property> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="xkb_languages_available"> + <widget class="GtkLabel" id="label13"> <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Variants:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">xkb_country_variants_available</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="xkb_language_variants_available"> + <widget class="GtkLabel" id="label12"> <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Language:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">xkb_countries_available</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> @@ -1897,7 +1901,7 @@ <property name="visible">True</property> <property name="spacing">6</property> <child> - <widget class="GtkLabel" id="label2"> + <widget class="GtkLabel" id="label10"> <property name="visible">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Preview:</property> @@ -1967,7 +1971,7 @@ </packing> </child> <child> - <widget class="GtkButton" id="btnOk"> + <widget class="GtkButton" id="btnOk1"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> |