[gnome-color-manager] Show the ICC profile type in the UI



commit f2b767ca7771c82c7791311ca77da2bfaa6982a9
Author: Richard Hughes <richard hughsie com>
Date:   Mon Nov 9 23:34:32 2009 +0000

    Show the ICC profile type in the UI

 data/gcm-prefs.ui |   46 ++++++++++++++++++++++++++++++++++++++++-
 src/gcm-prefs.c   |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 3 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 0025dbd..a22b6e8 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -94,9 +94,9 @@
                         <child>
                           <object class="GtkTable" id="table_details">
                             <property name="visible">True</property>
-                            <property name="n_rows">2</property>
+                            <property name="n_rows">3</property>
                             <property name="n_columns">2</property>
-                            <property name="column_spacing">3</property>
+                            <property name="column_spacing">9</property>
                             <property name="row_spacing">3</property>
                             <child>
                               <object class="GtkHBox" id="hbox5">
@@ -176,6 +176,48 @@
                                 <property name="bottom_attach">2</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkHBox" id="hbox6">
+                                <property name="visible">True</property>
+                                <child>
+                                  <object class="GtkLabel" id="label_title_type">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Profile type:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHBox" id="hbox18">
+                                <property name="visible">True</property>
+                                <child>
+                                  <object class="GtkLabel" id="label_type">
+                                    <property name="visible">True</property>
+                                    <property name="label">Output or input</property>
+                                    <property name="use_markup">True</property>
+                                    <property name="wrap">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <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>
+                              </packing>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 24d7e57..3c9f7bc 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -683,6 +683,44 @@ gcm_prefs_add_profiles (GtkWidget *widget)
 }
 
 /**
+ * gcm_prefs_profile_type_to_text:
+ **/
+static gchar *
+gcm_prefs_profile_type_to_text (GcmProfileType type)
+{
+	if (type == GCM_PROFILE_TYPE_INPUT_DEVICE) {
+		/* TRANSLATORS: this the ICC profile type */
+		return _("Input device");
+	}
+	if (type == GCM_PROFILE_TYPE_DISPLAY_DEVICE) {
+		/* TRANSLATORS: this the ICC profile type */
+		return _("Display device");
+	}
+	if (type == GCM_PROFILE_TYPE_OUTPUT_DEVICE) {
+		/* TRANSLATORS: this the ICC profile type */
+		return _("Output device");
+	}
+	if (type == GCM_PROFILE_TYPE_DEVICELINK) {
+		/* TRANSLATORS: this the ICC profile type */
+		return _("Devicelink");
+	}
+	if (type == GCM_PROFILE_TYPE_COLORSPACE_CONVERSION) {
+		/* TRANSLATORS: this the ICC profile type */
+		return _("Colorspace conversion");
+	}
+	if (type == GCM_PROFILE_TYPE_ABSTRACT) {
+		/* TRANSLATORS: this the ICC profile type */
+		return _("Abstract");
+	}
+	if (type == GCM_PROFILE_TYPE_NAMED_COLOUR) {
+		/* TRANSLATORS: this the ICC profile type */
+		return _("Named color");
+	}
+	/* TRANSLATORS: this the ICC profile type */
+	return _("Unknown");
+}
+
+/**
  * gcm_prefs_profile_combo_changed_cb:
  **/
 static void
@@ -698,6 +736,8 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
 	GcmProfile *profile = NULL;
 	gboolean changed;
 	GcmDeviceType type;
+	GcmProfileType profile_type = GCM_PROFILE_TYPE_UNKNOWN;
+	const gchar *profile_type_text;
 
 	active = gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
 	egg_debug ("now %i", active);
@@ -737,9 +777,25 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
 		g_object_get (profile,
 			      "copyright", &copyright,
 			      "vendor", &vendor,
+			      "type", &profile_type,
 			      NULL);
 	}
 
+	/* set type */
+	if (profile_type == GCM_PROFILE_TYPE_UNKNOWN) {
+		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_title_type"));
+		gtk_widget_hide (widget);
+		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_type"));
+		gtk_widget_hide (widget);
+	} else {
+		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_title_type"));
+		gtk_widget_show (widget);
+		profile_type_text = gcm_prefs_profile_type_to_text (profile_type);
+		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_type"));
+		gtk_label_set_label (GTK_LABEL (widget), profile_type_text);
+		gtk_widget_show (widget);
+	}
+
 	/* set new descriptions */
 	if (copyright == NULL) {
 		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_title_copyright"));
@@ -769,7 +825,7 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
 	}
 
 	/* set new descriptions */
-	if (copyright == NULL && vendor == NULL) {
+	if (copyright == NULL && vendor == NULL && profile_type == GCM_PROFILE_TYPE_UNKNOWN) {
 		widget = GTK_WIDGET (gtk_builder_get_object (builder, "table_details"));
 		gtk_widget_hide (widget);
 	} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]