[gthumb] extensions dialog: use a combo_box as category selector
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] extensions dialog: use a combo_box as category selector
- Date: Sat, 9 Apr 2011 18:15:17 +0000 (UTC)
commit 058d33cdbaef895060ab575ea01aba45261d256b
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Apr 9 20:14:28 2011 +0200
extensions dialog: use a combo_box as category selector
this way there is more space for the extension description
and dialog is less cluttered.
data/ui/extensions.ui | 129 +++++++++++++++--------------------------------
gthumb/dlg-extensions.c | 35 +++++++------
2 files changed, 58 insertions(+), 106 deletions(-)
---
diff --git a/data/ui/extensions.ui b/data/ui/extensions.ui
index f5ec383..88d0f94 100644
--- a/data/ui/extensions.ui
+++ b/data/ui/extensions.ui
@@ -2,6 +2,18 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
+ <object class="GtkListStore" id="category_liststore">
+ <columns>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name icon -->
+ <column type="gchararray"/>
+ <!-- column-name separator -->
+ <column type="gboolean"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="extensions_dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">gthumb Extensions</property>
@@ -10,7 +22,6 @@
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkHBox" id="hbox1">
@@ -20,123 +31,75 @@
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkHPaned" id="hpaned1">
+ <object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkVBox" id="vbox3">
+ <object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="extensions_label">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Categories:</property>
+ <property name="label" translatable="yes">Available _extensions:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="width_request">120</property>
+ <object class="GtkComboBox" id="category_combobox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
+ <property name="model">category_liststore</property>
<child>
- <object class="GtkTreeView" id="category_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="model">category_liststore</property>
- <property name="headers_visible">False</property>
- <property name="enable_search">False</property>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn1">
- <property name="sort_column_id">0</property>
- <child>
- <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
- <attributes>
- <attribute name="icon-name">2</attribute>
- </attributes>
- </child>
- <child>
- <object class="GtkCellRendererText" id="cellrendererpixbuf1"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
- </object>
- </child>
- </object>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="resize">False</property>
- <property name="shrink">False</property>
+ <property name="expand">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="extensions_label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Available _extensions:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="spacing">3</property>
<child>
- <object class="GtkVBox" id="vbox4">
+ <object class="GtkScrolledWindow" id="extensions_scrolledwindow">
+ <property name="width_request">400</property>
+ <property name="height_request">350</property>
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">3</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkScrolledWindow" id="extensions_scrolledwindow">
- <property name="width_request">350</property>
- <property name="height_request">350</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
+ <placeholder/>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
<packing>
- <property name="resize">False</property>
- <property name="shrink">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -241,16 +204,4 @@
<action-widget response="0">close_button</action-widget>
</action-widgets>
</object>
- <object class="GtkListStore" id="category_liststore">
- <columns>
- <!-- column-name id -->
- <column type="gchararray"/>
- <!-- column-name name -->
- <column type="gchararray"/>
- <!-- column-name icon -->
- <column type="gchararray"/>
- <!-- column-name separator -->
- <column type="gboolean"/>
- </columns>
- </object>
</interface>
diff --git a/gthumb/dlg-extensions.c b/gthumb/dlg-extensions.c
index aa57885..3a8aea5 100644
--- a/gthumb/dlg-extensions.c
+++ b/gthumb/dlg-extensions.c
@@ -386,22 +386,22 @@ reset_original_extension_status (DialogData *data)
static void
-category_treeview_selection_changed_cb (GtkTreeSelection *treeselection,
- gpointer user_data)
+category_combobox_changed_cb (GtkComboBox *combo_box,
+ gpointer user_data)
{
- DialogData *data = user_data;
- GtkTreeModel *model;
- GtkTreeIter iter;
+ DialogData *data = user_data;
+ GtkTreeIter iter;
- model = GTK_TREE_MODEL (data->model_filter);
- if (! gtk_tree_selection_get_selected (treeselection, &model, &iter))
+ if (! gtk_combo_box_get_active_iter (combo_box, &iter))
return;
reset_original_extension_status (data);
g_free (data->current_category);
- gtk_tree_model_get (model, &iter, CATEGORY_ID_COLUMN, &data->current_category, -1);
-
+ gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("category_liststore")),
+ &iter,
+ CATEGORY_ID_COLUMN, &data->current_category,
+ -1);
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (data->model_filter));
}
@@ -596,10 +596,9 @@ dlg_extensions (GthBrowser *browser)
}
g_list_free (extensions);
- /* the category list */
+ /* the category combobox */
data->current_category = g_strdup (EXTENSION_CATEGORY_ALL);
- gtk_tree_selection_set_mode (GTK_TREE_SELECTION (gtk_tree_view_get_selection (GTK_TREE_VIEW (GET_WIDGET ("category_treeview")))), GTK_SELECTION_BROWSE);
for (i = 0; extension_category[i].id != NULL; i++) {
GtkTreeIter iter;
@@ -618,14 +617,16 @@ dlg_extensions (GthBrowser *browser)
CATEGORY_SEPARATOR_COLUMN, FALSE,
-1);
}
- gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (GET_WIDGET ("category_treeview")),
- category_view_separator_func,
- data,
- NULL);
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (data->model_filter),
category_model_visible_func,
data,
NULL);
+ gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (GET_WIDGET ("category_combobox")),
+ category_view_separator_func,
+ data,
+ NULL);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("category_combobox")), 0);
+
/* Set the signals handlers. */
@@ -649,9 +650,9 @@ dlg_extensions (GthBrowser *browser)
"changed",
G_CALLBACK (list_view_selection_changed_cb),
data);
- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (GET_WIDGET ("category_treeview"))),
+ g_signal_connect (GET_WIDGET ("category_combobox"),
"changed",
- G_CALLBACK (category_treeview_selection_changed_cb),
+ G_CALLBACK (category_combobox_changed_cb),
data);
first = gtk_tree_path_new_first ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]