show/hide 'default' column, b.g.o#555261

svn path=/trunk/; revision=9128
This commit is contained in:
Sergey V. Udaltsov 2008-10-27 22:44:57 +00:00
parent fab37a0965
commit d178f241d9
3 changed files with 250 additions and 224 deletions

View file

@ -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):

View file

@ -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

View file

@ -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>
@ -417,6 +419,20 @@
<widget class="GtkVBox" id="vbox34">
<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>
@ -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,16 +1079,158 @@
<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">1</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Slow&lt;/i&gt;&lt;/small&gt;</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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_slow_label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Slow&lt;/i&gt;&lt;/small&gt;</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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHScale" id="mousekeys_accel_time_slide">
<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>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkHScale" id="mousekeys_max_speed_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 1000 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">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_fast_label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Long&lt;/i&gt;&lt;/small&gt;</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Fast&lt;/i&gt;&lt;/small&gt;</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">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="mousekeys_fast_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Fast&lt;/i&gt;&lt;/small&gt;</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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_speed_label">
<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="justify">GTK_JUSTIFY_CENTER</property>
<property name="mnemonic_widget">mousekeys_max_speed_slide</property>
</widget>
<packing>
<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="GtkLabel" id="mousekeys_acceleration_label">
<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>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_delay_label">
<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>
</widget>
<packing>
<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_short_label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Short&lt;/i&gt;&lt;/small&gt;</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>
@ -1109,160 +1255,18 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_short_label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Short&lt;/i&gt;&lt;/small&gt;</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="GtkLabel" id="mousekeys_long_label">
<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>
</widget>
<packing>
<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_acceleration_label">
<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>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_speed_label">
<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="justify">GTK_JUSTIFY_CENTER</property>
<property name="mnemonic_widget">mousekeys_max_speed_slide</property>
</widget>
<packing>
<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="GtkLabel" id="mousekeys_fast_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Fast&lt;/i&gt;&lt;/small&gt;</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Long&lt;/i&gt;&lt;/small&gt;</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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_fast_label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Fast&lt;/i&gt;&lt;/small&gt;</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">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_max_speed_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 1000 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">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkHScale" id="mousekeys_accel_time_slide">
<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>
</widget>
<packing>
<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_slow_label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Slow&lt;/i&gt;&lt;/small&gt;</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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="mousekeys_slow_label2">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;Slow&lt;/i&gt;&lt;/small&gt;</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="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -1731,14 +1735,25 @@
<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="GtkComboBox" id="xkb_countries_available">
<property name="visible">True</property>
</widget>
<packing>
<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>
@ -1759,25 +1774,14 @@
</packing>
</child>
<child>
<widget class="GtkComboBox" id="xkb_countries_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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="xkb_country_variants_available">
<property name="visible">True</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,14 +1816,25 @@
<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="GtkComboBox" id="xkb_languages_available">
<property name="visible">True</property>
</widget>
<packing>
<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>
@ -1840,25 +1855,14 @@
</packing>
</child>
<child>
<widget class="GtkComboBox" id="xkb_languages_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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="xkb_language_variants_available">
<property name="visible">True</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>