eliminating up/down buttons in the layout list
svn path=/trunk/; revision=7873
This commit is contained in:
parent
0b8909ef13
commit
52edca17a1
3 changed files with 61 additions and 137 deletions
|
@ -1,3 +1,8 @@
|
|||
2007-07-24 Sergey Udaltsov <svu@gnome.org>
|
||||
|
||||
* gnome-keyboard-properties-xkblt.c, gnome-keyboard-properties.glade:
|
||||
eliminating up/down buttons in the layout list, making it look nicer.
|
||||
|
||||
2007-07-23 Sergey Udaltsov <svu@gnome.org>
|
||||
|
||||
* gnome-keyboard-properties-xkblt.c: Implementing DND in the selected
|
||||
|
|
|
@ -180,8 +180,6 @@ xkb_layouts_enable_disable_buttons (GladeXML * dialog)
|
|||
{
|
||||
GtkWidget *add_layout_btn = WID ("xkb_layouts_add");
|
||||
GtkWidget *del_layout_btn = WID ("xkb_layouts_remove");
|
||||
GtkWidget *up_layout_btn = WID ("xkb_layouts_up");
|
||||
GtkWidget *dn_layout_btn = WID ("xkb_layouts_down");
|
||||
GtkWidget *selected_layouts_tree = WID ("xkb_layouts_selected");
|
||||
|
||||
GtkTreeSelection *s_selection =
|
||||
|
@ -189,9 +187,6 @@ xkb_layouts_enable_disable_buttons (GladeXML * dialog)
|
|||
(selected_layouts_tree));
|
||||
const int n_selected_selected_layouts =
|
||||
gtk_tree_selection_count_selected_rows (s_selection);
|
||||
gboolean can_move_up = FALSE;
|
||||
gboolean can_move_dn = FALSE;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *selected_layouts_model = gtk_tree_view_get_model
|
||||
(GTK_TREE_VIEW (selected_layouts_tree));
|
||||
const int n_selected_layouts =
|
||||
|
@ -207,22 +202,6 @@ xkb_layouts_enable_disable_buttons (GladeXML * dialog)
|
|||
|| max_selected_layouts == 0));
|
||||
gtk_widget_set_sensitive (del_layout_btn,
|
||||
n_selected_selected_layouts > 0);
|
||||
|
||||
if (gtk_tree_selection_get_selected (s_selection, NULL, &iter)) {
|
||||
GtkTreePath *path =
|
||||
gtk_tree_model_get_path (selected_layouts_model,
|
||||
&iter);
|
||||
if (path != NULL) {
|
||||
int *indices = gtk_tree_path_get_indices (path);
|
||||
int idx = indices[0];
|
||||
can_move_up = idx > 0;
|
||||
can_move_dn = idx < (n_selected_layouts - 1);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (up_layout_btn, can_move_up);
|
||||
gtk_widget_set_sensitive (dn_layout_btn, can_move_dn);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -338,6 +317,8 @@ xkb_layouts_prepare_selected_tree (GladeXML * dialog,
|
|||
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);
|
||||
|
@ -454,7 +435,7 @@ add_selected_layout (GtkWidget * button, GladeXML * dialog)
|
|||
}
|
||||
|
||||
static void
|
||||
move_selected_layout (GladeXML * dialog, int offset)
|
||||
remove_selected_layout (GtkWidget * button, GladeXML * dialog)
|
||||
{
|
||||
gint idx = find_selected_layout_idx (dialog);
|
||||
|
||||
|
@ -468,47 +449,18 @@ move_selected_layout (GladeXML * dialog, int offset)
|
|||
|
||||
id = (char *) node2Remove->data;
|
||||
g_slist_free_1 (node2Remove);
|
||||
|
||||
if (offset == 0) {
|
||||
g_free (id);
|
||||
|
||||
if (default_group > idx)
|
||||
save_default_group (default_group - 1);
|
||||
else if (default_group == idx)
|
||||
save_default_group (-1);
|
||||
} else {
|
||||
layouts_list =
|
||||
g_slist_insert (layouts_list, id,
|
||||
idx + offset);
|
||||
idx2select = idx + offset;
|
||||
if (idx == default_group)
|
||||
save_default_group (idx2select);
|
||||
else if (idx2select == default_group)
|
||||
save_default_group (idx);
|
||||
}
|
||||
|
||||
xkb_layouts_set_selected_list (layouts_list);
|
||||
clear_xkb_elements_list (layouts_list);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_selected_layout (GtkWidget * button, GladeXML * dialog)
|
||||
{
|
||||
move_selected_layout (dialog, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
up_selected_layout (GtkWidget * button, GladeXML * dialog)
|
||||
{
|
||||
move_selected_layout (dialog, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
down_selected_layout (GtkWidget * button, GladeXML * dialog)
|
||||
{
|
||||
move_selected_layout (dialog, +1);
|
||||
}
|
||||
|
||||
void
|
||||
xkb_layouts_register_buttons_handlers (GladeXML * dialog)
|
||||
{
|
||||
|
@ -516,10 +468,6 @@ xkb_layouts_register_buttons_handlers (GladeXML * dialog)
|
|||
G_CALLBACK (add_selected_layout), dialog);
|
||||
g_signal_connect (G_OBJECT (WID ("xkb_layouts_remove")), "clicked",
|
||||
G_CALLBACK (remove_selected_layout), dialog);
|
||||
g_signal_connect (G_OBJECT (WID ("xkb_layouts_up")), "clicked",
|
||||
G_CALLBACK (up_selected_layout), dialog);
|
||||
g_signal_connect (G_OBJECT (WID ("xkb_layouts_down")), "clicked",
|
||||
G_CALLBACK (down_selected_layout), dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
<widget class="GtkDialog" id="keyboard_dialog">
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Keyboard Preferences</property>
|
||||
<property name="default_width">450</property>
|
||||
<property name="default_height">430</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
|
@ -496,59 +498,6 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVButtonBox" id="vbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="xkb_layouts_add">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">_Add...</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="xkb_layouts_remove">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="xkb_layouts_up">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-go-up</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="xkb_layouts_down">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-go-down</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
@ -578,7 +527,29 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<widget class="GtkButton" id="xkb_layouts_add">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">_Add...</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="xkb_layouts_remove">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="xkb_reset_to_defaults">
|
||||
|
@ -1053,27 +1024,16 @@
|
|||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="xkb_variants_available">
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Layouts:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">xkb_layouts_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">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="xkb_layouts_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">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -1092,16 +1052,27 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<widget class="GtkComboBox" id="xkb_layouts_available">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Layouts:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">xkb_layouts_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>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="xkb_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">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue