[gnome-color-manager] Show a label in the device section when the user is using a xrandr-fallback driver. Fixes rh#566606



commit fafaf73221627bd12cc15f28b2f17efca94f3da3
Author: Richard Hughes <richard hughsie com>
Date:   Fri Feb 19 09:17:42 2010 +0000

    Show a label in the device section when the user is using a xrandr-fallback driver. Fixes rh#566606

 data/gcm-prefs.ui       |   19 +++++++++++++++++++
 src/gcm-device-xrandr.c |   20 +++++++++++++++++++-
 src/gcm-prefs.c         |   18 ++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 7b0661c..5aa5bb5 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -291,6 +291,25 @@
                                             <property name="position">2</property>
                                           </packing>
                                         </child>
+                                        <child>
+                                          <object class="GtkHBox" id="hbox3">
+                                            <property name="visible">True</property>
+                                            <child>
+                                              <object class="GtkLabel" id="label_problems">
+                                                <property name="visible">True</property>
+                                                <property name="label">problems</property>
+                                                <property name="selectable">True</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="position">3</property>
+                                          </packing>
+                                        </child>
                                       </object>
                                       <packing>
                                         <property name="position">0</property>
diff --git a/src/gcm-device-xrandr.c b/src/gcm-device-xrandr.c
index 2efa6e7..c687a6a 100644
--- a/src/gcm-device-xrandr.c
+++ b/src/gcm-device-xrandr.c
@@ -57,11 +57,13 @@ struct _GcmDeviceXrandrPrivate
 	GConfClient			*gconf_client;
 	GcmXserver			*xserver;
 	GcmScreen			*screen;
+	gboolean			 xrandr_fallback;
 };
 
 enum {
 	PROP_0,
 	PROP_NATIVE_DEVICE,
+	PROP_XRANDR_FALLBACK,
 	PROP_LAST
 };
 
@@ -327,8 +329,12 @@ gcm_device_xrandr_get_gamma_size (GcmDeviceXrandr *device_xrandr, GnomeRRCrtc *c
 		size = 0;
 
 	/* some drivers support Xrandr 1.2, not 1.3 */
-	if (size == 0)
+	if (size == 0) {
+		priv->xrandr_fallback = TRUE;
 		size = gcm_device_xrandr_get_gamma_size_fallback ();
+	} else {
+		priv->xrandr_fallback = FALSE;
+	}
 
 	/* no size, or X popped an error */
 	if (size == 0) {
@@ -594,6 +600,9 @@ gcm_device_xrandr_get_property (GObject *object, guint prop_id, GValue *value, G
 	case PROP_NATIVE_DEVICE:
 		g_value_set_string (value, priv->native_device);
 		break;
+	case PROP_XRANDR_FALLBACK:
+		g_value_set_boolean (value, priv->xrandr_fallback);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -644,6 +653,14 @@ gcm_device_xrandr_class_init (GcmDeviceXrandrClass *klass)
 				     G_PARAM_READWRITE);
 	g_object_class_install_property (object_class, PROP_NATIVE_DEVICE, pspec);
 
+	/**
+	 * GcmDeviceXrandr:xrandr-fallback:
+	 */
+	pspec = g_param_spec_boolean ("xrandr-fallback", NULL, NULL,
+				      FALSE,
+				      G_PARAM_READABLE);
+	g_object_class_install_property (object_class, PROP_XRANDR_FALLBACK, pspec);
+
 	g_type_class_add_private (klass, sizeof (GcmDeviceXrandrPrivate));
 }
 
@@ -655,6 +672,7 @@ gcm_device_xrandr_init (GcmDeviceXrandr *device_xrandr)
 {
 	device_xrandr->priv = GCM_DEVICE_XRANDR_GET_PRIVATE (device_xrandr);
 	device_xrandr->priv->native_device = NULL;
+	device_xrandr->priv->xrandr_fallback = FALSE;
 	device_xrandr->priv->gamma_size = 0;
 	device_xrandr->priv->edid = gcm_edid_new ();
 	device_xrandr->priv->dmi = gcm_dmi_new ();
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 4b441e4..7153a99 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -1124,6 +1124,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 	gfloat contrast;
 	gboolean connected;
 	gchar *id = NULL;
+	gboolean ret;
 	GcmDeviceTypeEnum type;
 	gchar *device_serial = NULL;
 	gchar *device_model = NULL;
@@ -1167,6 +1168,23 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 		gtk_widget_set_sensitive (widget, TRUE);
 	}
 
+	/* show broken devices */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_problems"));
+	if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY) {
+		g_object_get (current_device,
+			      "xrandr-fallback", &ret,
+			      NULL);
+		if (ret) {
+			/* TRANSLATORS: this is when the user is using a binary blob */
+			gtk_label_set_label (GTK_LABEL (widget), _("Per-device settings not supported. Check your display driver."));
+			gtk_widget_show (widget);
+		} else {
+			gtk_widget_hide (widget);
+		}
+	} else {
+		gtk_widget_hide (widget);
+	}
+
 	g_object_get (current_device,
 		      "profile-filename", &profile_filename,
 		      "gamma", &localgamma,



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