[gnome-settings-daemon] Run gnome-color-manager apply program when the outputs change



commit db5a0b0b47f1d3a06215396211a77ed61fe7f7fc
Author: Richard Hughes <richard hughsie com>
Date:   Mon Nov 2 09:47:04 2009 +0000

    Run gnome-color-manager apply program when the outputs change

 plugins/xrandr/Makefile.am          |    1 +
 plugins/xrandr/gsd-xrandr-manager.c |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xrandr/Makefile.am b/plugins/xrandr/Makefile.am
index 78637e6..d84eca1 100644
--- a/plugins/xrandr/Makefile.am
+++ b/plugins/xrandr/Makefile.am
@@ -47,6 +47,7 @@ libxrandr_la_SOURCES = 		\
 
 libxrandr_la_CPPFLAGS =						\
 	-I$(top_srcdir)/gnome-settings-daemon			\
+	-DBINDIR=\"$(bindir)\"					\
 	-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\"	\
 	$(AM_CPPFLAGS)
 
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 6cd974f..4ea1ac2 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -1178,6 +1178,23 @@ auto_configure_outputs (GsdXrandrManager *manager, guint32 timestamp)
 }
 
 static void
+apply_color_profiles (void)
+{
+        gboolean ret;
+        GError *error = NULL;
+
+        /* run the gnome-color-manager apply program */
+        ret = g_spawn_command_line_async (BINDIR "/gcm-apply", &error);
+        if (!ret) {
+                /* only print the warning if the binary is installed */
+                if (error->code != G_SPAWN_ERROR_NOENT) {
+                        g_warning ("failed to apply color profiles: %s", error->message);
+                }
+                g_error_free (error);
+        }
+}
+
+static void
 on_randr_event (GnomeRRScreen *screen, gpointer data)
 {
         GsdXrandrManager *manager = GSD_XRANDR_MANAGER (data);
@@ -1268,6 +1285,9 @@ on_randr_event (GnomeRRScreen *screen, gpointer data)
 #endif
         }
 
+        /* poke gnome-color-manager */
+        apply_color_profiles ();
+
         refresh_tray_icon_menu_if_active (manager, MAX (change_timestamp, config_timestamp));
 }
 



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