region: Easier to understand layout switching options

Use 2 groups of radio buttons to make layout options related
to windows easier to understand.

https://bugzilla.gnome.org/show_bug.cgi?id=641021
This commit is contained in:
Bastien Nocera 2011-02-07 01:06:39 +00:00
parent a950f9d9d1
commit 9c2bfba4ca
2 changed files with 93 additions and 46 deletions

View file

@ -81,19 +81,6 @@ reset_to_defaults (GtkWidget * button, GtkBuilder * dialog)
/* all the rest is g-s-d's business */
}
static void
chk_separate_group_per_window_toggled (GSettings * settings,
const gchar * key,
GtkBuilder * dialog)
{
if (!strcmp (key, GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW)) {
gboolean gpw = g_settings_get_boolean (settings, key);
gtk_widget_set_sensitive (WID
("chk_new_windows_inherit_layout"),
gpw);
}
}
static void
chk_new_windows_inherit_layout_toggled (GtkWidget *
chk_new_windows_inherit_layout,
@ -131,13 +118,25 @@ setup_xkb_tabs (GtkBuilder * dialog)
gkbd_keyboard_config_init (&initial_config, engine);
gkbd_keyboard_config_load_from_x_initial (&initial_config, NULL);
/* Set initial state */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chk_separate_group_per_window")),
g_settings_get_boolean (xkb_desktop_settings,
GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_new_windows_inherit_layout),
xkb_get_default_group () < 0);
g_settings_bind (xkb_desktop_settings,
GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
WID ("chk_separate_group_per_window"), "active",
G_SETTINGS_BIND_DEFAULT);
g_signal_connect (xkb_desktop_settings, "changed",
G_CALLBACK
(chk_separate_group_per_window_toggled), dialog);
g_settings_bind (xkb_desktop_settings,
GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
WID ("chk_new_windows_inherit_layout"), "sensitive",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (xkb_desktop_settings,
GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
WID ("chk_new_windows_default_layout"), "sensitive",
G_SETTINGS_BIND_DEFAULT);
#ifdef HAVE_X11_EXTENSIONS_XKB_H
if (strcmp (xkl_engine_get_backend_name (engine), "XKB"))
@ -147,15 +146,6 @@ setup_xkb_tabs (GtkBuilder * dialog)
xkb_layouts_prepare_selected_tree (dialog);
xkb_layouts_fill_selected_tree (dialog);
gtk_widget_set_sensitive (chk_new_windows_inherit_layout,
gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON
(WID
("chk_separate_group_per_window"))));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(chk_new_windows_inherit_layout),
xkb_get_default_group () < 0);
xkb_layouts_register_buttons_handlers (dialog);
g_signal_connect (G_OBJECT (WID ("xkb_reset_to_defaults")),
"clicked", G_CALLBACK (reset_to_defaults),

View file

@ -82,6 +82,11 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkVBox" id="region_vbox">
<property name="visible">True</property>
@ -225,7 +230,6 @@
<object class="GtkTreeView" id="xkb_layouts_selected">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">False</property>
<property name="headers_visible">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
@ -328,7 +332,6 @@
<object class="GtkVBox" id="vbox33">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">0</property>
<property name="spacing">12</property>
<child>
<object class="GtkVBox" id="vbox34">
@ -336,51 +339,110 @@
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="chk_separate_group_per_window">
<property name="label" translatable="yes">_Separate layout for each window</property>
<object class="GtkRadioButton" id="chk_same_group">
<property name="label" translatable="yes">Use same layout in all windows</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_new_windows_inherit_layout">
<property name="label" translatable="yes">New windows u_se active window's layout</property>
<object class="GtkRadioButton" id="chk_separate_group_per_window">
<property name="label" translatable="yes">Allow different layouts for each window</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">chk_same_group</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioButton" id="chk_new_windows_default_layout">
<property name="label" translatable="yes">Use default layout in new windows</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="chk_new_windows_inherit_layout">
<property name="label" translatable="yes">Use previous window's layout in new windows</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">chk_new_windows_default_layout</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox2">
@ -480,11 +542,6 @@ default settings</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
</object>