From 31d19e6f3942ad09035ca11a8e6de2f01c94fa8b Mon Sep 17 00:00:00 2001 From: Alexandre Rostovtsev Date: Wed, 7 Mar 2012 17:51:55 -0500 Subject: [PATCH] Use gcm_calibrate_argyll_get_tool_filename () for dispcal Do not assume that dispcal is /usr/bin/dispcal; in some distros (e.g. Gentoo), it's argyll-dispcal. --- src/gcm-calibrate-argyll.c | 11 ++++++++--- src/gcm-calibrate-argyll.h | 6 ++++-- src/gcm-calibrate-main.c | 7 +++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c index 3f04aa1..a7476a0 100644 --- a/src/gcm-calibrate-argyll.c +++ b/src/gcm-calibrate-argyll.c @@ -122,10 +122,14 @@ gcm_calibrate_argyll_get_display (const gchar *output_name, GError **error) gint exit_status; guint display = G_MAXUINT; guint i; - gchar *name; + gchar *command, *name; + + command = gcm_calibrate_argyll_get_tool_filename ("dispcal", error); + if (!command == NULL) + goto out; /* execute it and capture stderr */ - ret = g_spawn_command_line_sync ("dispcal", NULL, &data, &exit_status, error); + ret = g_spawn_command_line_sync (command, NULL, &data, &exit_status, error); if (!ret) goto out; @@ -157,6 +161,7 @@ gcm_calibrate_argyll_get_display (const gchar *output_name, GError **error) goto out; } out: + g_free (command); g_free (data); g_strfreev (split); return display; @@ -198,7 +203,7 @@ gcm_calibrate_argyll_debug_argv (const gchar *program, gchar **argv) /** * gcm_calibrate_argyll_get_tool_filename: **/ -static gchar * +gchar * gcm_calibrate_argyll_get_tool_filename (const gchar *command, GError **error) { gboolean ret; diff --git a/src/gcm-calibrate-argyll.h b/src/gcm-calibrate-argyll.h index e1c84e5..9d98286 100644 --- a/src/gcm-calibrate-argyll.h +++ b/src/gcm-calibrate-argyll.h @@ -48,8 +48,10 @@ struct _GcmCalibrateArgyllClass GcmCalibrateClass parent_class; }; -GType gcm_calibrate_argyll_get_type (void); -GcmCalibrate *gcm_calibrate_argyll_new (void); +GType gcm_calibrate_argyll_get_type (void); +GcmCalibrate *gcm_calibrate_argyll_new (void); +gchar *gcm_calibrate_argyll_get_tool_filename (const gchar *command, + GError **error); G_END_DECLS diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c index 901a428..9ad57cb 100644 --- a/src/gcm-calibrate-main.c +++ b/src/gcm-calibrate-main.c @@ -1774,6 +1774,7 @@ gcm_calib_add_pages (GcmCalibratePriv *calib) { gboolean ret; const gchar *xrandr_name; + gchar *command; /* device not found */ if (calib->device_kind == CD_DEVICE_KIND_UNKNOWN) { @@ -1789,9 +1790,11 @@ gcm_calib_add_pages (GcmCalibratePriv *calib) gcm_calib_setup_page_sensor (calib); /* find whether argyllcms is installed using a tool which should exist */ - ret = g_file_test ("/usr/bin/dispcal", G_FILE_TEST_EXISTS); - if (!ret) + command = gcm_calibrate_argyll_get_tool_filename ("dispcal", NULL); + if (command == NULL) gcm_calib_setup_page_install_argyllcms (calib); + else + g_free (command); xrandr_name = cd_device_get_metadata_item (calib->device, CD_DEVICE_METADATA_XRANDR_NAME); -- 1.7.8.5