[gnome-color-manager] Port to GtkComboBoxText
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Port to GtkComboBoxText
- Date: Tue, 26 Oct 2010 15:42:29 +0000 (UTC)
commit 31ddaf41699daad971b20eca1e19bc1b4bb14346
Author: Richard Hughes <richard hughsie com>
Date: Tue Oct 26 17:15:48 2010 +0100
Port to GtkComboBoxText
data/gcm-calibrate.ui | 3 ++-
data/gcm-prefs.ui | 9 ++++++---
data/gcm-viewer.ui | 3 ++-
src/cc-color-panel.c | 15 ++++++++-------
src/gcm-calibrate-dialog.c | 4 ++--
src/gcm-picker.c | 7 ++++++-
src/gcm-viewer.c | 39 ++++++---------------------------------
7 files changed, 32 insertions(+), 48 deletions(-)
---
diff --git a/data/gcm-calibrate.ui b/data/gcm-calibrate.ui
index fe35adb..06d182b 100644
--- a/data/gcm-calibrate.ui
+++ b/data/gcm-calibrate.ui
@@ -256,7 +256,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="combobox_target">
+ <object class="GtkComboBoxText" id="combobox_target">
+ <property name="entry-text-column">0</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index be6a7f3..f9b9c5a 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -222,7 +222,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="combobox_virtual_type">
+ <object class="GtkComboBoxText" id="combobox_virtual_type">
+ <property name="entry-text-column">0</property>
<property name="visible">True</property>
</object>
<packing>
@@ -1241,7 +1242,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="combobox_rendering_display">
+ <object class="GtkComboBoxText" id="combobox_rendering_display">
+ <property name="entry-text-column">0</property>
<property name="visible">True</property>
</object>
<packing>
@@ -1283,7 +1285,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="combobox_rendering_softproof">
+ <object class="GtkComboBoxText" id="combobox_rendering_softproof">
+ <property name="entry-text-column">0</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/data/gcm-viewer.ui b/data/gcm-viewer.ui
index 8ce1ea7..6519b1b 100644
--- a/data/gcm-viewer.ui
+++ b/data/gcm-viewer.ui
@@ -144,7 +144,8 @@
<object class="GtkHBox" id="hbox38">
<property name="visible">True</property>
<child>
- <object class="GtkComboBox" id="combobox_graph">
+ <object class="GtkComboBoxText" id="combobox_graph">
+ <property name="entry-text-column">0</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/src/cc-color-panel.c b/src/cc-color-panel.c
index ebb9418..e20ea61 100644
--- a/src/cc-color-panel.c
+++ b/src/cc-color-panel.c
@@ -2202,6 +2202,7 @@ cc_color_panel_setup_space_combobox (CcColorPanel *panel, GtkWidget *widget, Gcm
gchar *text = NULL;
GPtrArray *profile_array = NULL;
GtkTreeIter iter;
+ GtkTreeModel *model;
/* get new list */
profile_array = gcm_profile_store_get_array (panel->priv->profile_store);
@@ -2231,7 +2232,11 @@ cc_color_panel_setup_space_combobox (CcColorPanel *panel, GtkWidget *widget, Gcm
/* TRANSLATORS: this is when there are no profiles that can be used; the search term is either "RGB" or "CMYK" */
text = g_strdup_printf (_("No %s color spaces available"),
gcm_colorspace_to_localised_string (colorspace));
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), text);
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
+ gtk_list_store_append (GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter,
+ GCM_PREFS_COMBO_COLUMN_TEXT, text,
+ -1);
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_set_sensitive (widget, FALSE);
}
@@ -2307,7 +2312,7 @@ cc_color_panel_setup_rendering_combobox (GtkWidget *widget, GcmIntent intent)
label = g_strdup_printf ("%s - %s",
gcm_intent_to_localized_text (i),
gcm_intent_to_localized_description (i));
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), label);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), label);
g_free (label);
if (i == intent) {
ret = TRUE;
@@ -2451,7 +2456,6 @@ cc_color_panel_startup_idle_cb (CcColorPanel *panel)
/* setup rendering lists */
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, "combobox_rendering_display"));
- cc_color_panel_set_combo_simple_text (widget);
intent_display = g_settings_get_enum (panel->priv->settings, GCM_SETTINGS_RENDERING_INTENT_DISPLAY);
cc_color_panel_setup_rendering_combobox (widget, intent_display);
g_object_set_data (G_OBJECT(widget), "GCM:GSettingsKey", (gpointer) GCM_SETTINGS_RENDERING_INTENT_DISPLAY);
@@ -2459,7 +2463,6 @@ cc_color_panel_startup_idle_cb (CcColorPanel *panel)
G_CALLBACK (cc_color_panel_renderer_combo_changed_cb), panel);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, "combobox_rendering_softproof"));
- cc_color_panel_set_combo_simple_text (widget);
intent_softproof = g_settings_get_enum (panel->priv->settings, GCM_SETTINGS_RENDERING_INTENT_SOFTPROOF);
cc_color_panel_setup_rendering_combobox (widget, intent_softproof);
g_object_set_data (G_OBJECT(widget), "GCM:GSettingsKey", (gpointer) GCM_SETTINGS_RENDERING_INTENT_SOFTPROOF);
@@ -2651,7 +2654,7 @@ cc_color_panel_setup_virtual_combobox (GtkWidget *widget)
for (i=GCM_DEVICE_KIND_SCANNER; i<GCM_DEVICE_KIND_LAST; i++) {
text = gcm_device_kind_to_localised_string (i);
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), text);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(widget), text);
}
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), GCM_DEVICE_KIND_PRINTER - 2);
}
@@ -2885,9 +2888,7 @@ cc_color_panel_init (CcColorPanel *panel)
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, "button_virtual_cancel"));
g_signal_connect (widget, "clicked",
G_CALLBACK (cc_color_panel_button_virtual_cancel_cb), panel);
-
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, "combobox_virtual_type"));
- cc_color_panel_set_combo_simple_text (widget);
cc_color_panel_setup_virtual_combobox (widget);
/* set up assign dialog */
diff --git a/src/gcm-calibrate-dialog.c b/src/gcm-calibrate-dialog.c
index 24eba20..37b18de 100644
--- a/src/gcm-calibrate-dialog.c
+++ b/src/gcm-calibrate-dialog.c
@@ -823,8 +823,8 @@ gcm_calibrate_dialog_init (GcmCalibrateDialog *calibrate_dialog)
/* add the list of charts */
for (i = 0; i < GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN; i++) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
- gcm_calibrate_dialog_reference_kind_to_localised_string (i));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget),
+ gcm_calibrate_dialog_reference_kind_to_localised_string (i));
}
/* use IT8 by default */
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index 2bd2231..f31568e 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -487,6 +487,7 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget)
gchar *text = NULL;
GPtrArray *profile_array = NULL;
GtkTreeIter iter;
+ GtkTreeModel *model;
/* get new list */
profile_array = gcm_profile_store_get_array (profile_store);
@@ -514,7 +515,11 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget)
/* TRANSLATORS: this is when there are no profiles that can be used; the search term is either "RGB" or "CMYK" */
text = g_strdup_printf (_("No %s color spaces available"),
gcm_colorspace_to_localised_string (GCM_COLORSPACE_RGB));
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), text);
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
+ gtk_list_store_append (GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter,
+ GCM_PREFS_COMBO_COLUMN_TEXT, text,
+ -1);
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_set_sensitive (widget, FALSE);
}
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index 65d5fe1..a941ba6 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -859,32 +859,6 @@ gcm_viewer_profiles_treeview_clicked_cb (GtkTreeSelection *selection, GcmViewerP
}
/**
- * gcm_viewer_set_combo_simple_text:
- **/
-static void
-gcm_viewer_set_combo_simple_text (GtkWidget *combo_box)
-{
- GtkCellRenderer *renderer;
- GtkListStore *store;
-
- store = gtk_list_store_new (4, G_TYPE_STRING, GCM_TYPE_PROFILE, G_TYPE_UINT, G_TYPE_STRING);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), GCM_VIEWER_COMBO_COLUMN_SORTABLE, GTK_SORT_ASCENDING);
- gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
- g_object_unref (store);
-
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "ellipsize", PANGO_ELLIPSIZE_END,
- "wrap-mode", PANGO_WRAP_WORD_CHAR,
- "width-chars", 60,
- NULL);
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
- "text", GCM_VIEWER_COMBO_COLUMN_TEXT,
- NULL);
-}
-
-/**
* gcm_viewer_profile_store_added_cb:
**/
static void
@@ -1025,20 +999,20 @@ gcm_viewer_setup_graph_combobox (GcmViewerPrivate *viewer, GtkWidget *widget)
gint active;
/* TRANSLATORS: combo-entry, no graph selected to be shown */
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("None"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(widget), _("None"));
/* TRANSLATORS: combo-entry, this is a graph plot type (look it up on google...) */
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("CIE 1931 xy"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(widget), _("CIE 1931 xy"));
/* TRANSLATORS: combo-entry, this is a graph plot type (what goes in, v.s. what goes out) */
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("Transfer response curve"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(widget), _("Transfer response curve"));
/* TRANSLATORS: combo-entry, this is a graph plot type (what data we snd the graphics card) */
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("Video card gamma table"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(widget), _("Video card gamma table"));
/* TRANSLATORS: combo-entry, this is a preview image of what the profile looks like */
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("Image preview (from sRGB)"));
- gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("Image preview (to sRGB)"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(widget), _("Image preview (from sRGB)"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(widget), _("Image preview (to sRGB)"));
/* get from settings */
active = g_settings_get_enum (viewer->settings, GCM_SETTINGS_PROFILE_GRAPH_TYPE);
@@ -1169,7 +1143,6 @@ main (int argc, char **argv)
/* hide widgets by default */
widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder, "combobox_graph"));
- gcm_viewer_set_combo_simple_text (widget);
gcm_viewer_setup_graph_combobox (viewer, widget);
g_signal_connect (widget, "changed",
G_CALLBACK (gcm_viewer_graph_combo_changed_cb), viewer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]