diff --git a/configure.ac b/configure.ac index 49d6e9d2a..583c0ef32 100644 --- a/configure.ac +++ b/configure.ac @@ -76,6 +76,7 @@ MUTTER_PC_MODULES=" $CLUTTER_PACKAGE >= 1.14.3 cogl-1.0 >= 1.13.3 upower-glib > 0.9.11 + gnome-desktop-3.0 " GLIB_GSETTINGS diff --git a/src/core/monitor-private.h b/src/core/monitor-private.h index c3ef12aae..b0fd70c4c 100644 --- a/src/core/monitor-private.h +++ b/src/core/monitor-private.h @@ -38,6 +38,7 @@ #define META_MONITOR_PRIVATE_H #include +#include #include "display-private.h" #include @@ -250,6 +251,8 @@ struct _MetaMonitorManager int persistent_timeout_id; MetaMonitorConfig *config; + + GnomePnpIds *pnp_ids; }; struct _MetaMonitorManagerClass diff --git a/src/core/monitor.c b/src/core/monitor.c index c52740b5e..d81ff1509 100644 --- a/src/core/monitor.c +++ b/src/core/monitor.c @@ -703,16 +703,41 @@ diagonal_to_str (double d) } static char * -make_display_name (MetaOutput *output) +make_display_name (MetaMonitorManager *manager, + MetaOutput *output) { + if (g_str_has_prefix (output->name, "LVDS") || + g_str_has_prefix (output->name, "eDP")) + return g_strdup (_("Built-in display")); + if (output->width_mm != -1 && output->height_mm != -1) { double d = sqrt (output->width_mm * output->width_mm + output->height_mm * output->height_mm); char *inches = diagonal_to_str (d / 25.4); + char *vendor_name; char *ret; - ret = g_strdup_printf ("%s %s", output->vendor, inches); + if (g_strcmp0 (output->vendor, "unknown") != 0) + { + if (!manager->pnp_ids) + manager->pnp_ids = gnome_pnp_ids_new (); + + vendor_name = gnome_pnp_ids_get_pnp_id (manager->pnp_ids, + output->vendor); + + ret = g_strdup_printf ("%s %s", vendor_name, inches); + + g_free (vendor_name); + } + else + { + /* TRANSLATORS: this is a monitor name (in case we don't know + the vendor), it's Unknown followed by a size in inches, + like 'Unknown 15"' + */ + ret = g_strdup_printf (_("Unknown %s"), inches); + } g_free (inches); return ret; @@ -789,7 +814,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, g_variant_builder_add (&properties, "{sv}", "serial", g_variant_new_string (output->serial)); g_variant_builder_add (&properties, "{sv}", "display-name", - g_variant_new_take_string (make_display_name (output))); + g_variant_new_take_string (make_display_name (manager, output))); g_variant_builder_add (&properties, "{sv}", "backlight", g_variant_new_int32 (output->backlight)); g_variant_builder_add (&properties, "{sv}", "primary",