[gnome-color-manager] Make VTE optional as there is no GTK3 port available
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Make VTE optional as there is no GTK3 port available
- Date: Wed, 16 Jun 2010 10:22:08 +0000 (UTC)
commit c54a6d0902f3cf09e423082dc1cfc30ac75d2da1
Author: Richard Hughes <richard hughsie com>
Date: Wed Jun 16 11:21:47 2010 +0100
Make VTE optional as there is no GTK3 port available
configure.ac | 11 +++++++++--
src/gcm-calibrate-argyll.c | 39 +++++++++++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6df92c4..4d57562 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,15 +115,21 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 gthread-2.0 gio-2
PKG_CHECK_MODULES(XORG, xxf86vm xrandr)
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(GNOMEDESKTOP, gnome-desktop-2.0 >= $GNOMEDESKTOP_REQUIRED)
-PKG_CHECK_MODULES(VTE, vte >= $VTE_REQUIRED)
PKG_CHECK_MODULES(GUDEV, gudev-1.0)
PKG_CHECK_MODULES(LCMS, lcms)
PKG_CHECK_MODULES(X11, x11)
PKG_CHECK_MODULES(NOTIFY, libnotify)
+dnl **** Check for VTE ****
+PKG_CHECK_MODULES(VTE, vte3 >= $VTE_REQUIRED, has_vte=yes, has_vte=no)
+AM_CONDITIONAL(GCM_USE_VTE, test x$has_vte = xyes)
+if test x$has_vte = xyes; then
+ AC_DEFINE(GCM_USE_VTE,1,[Use VTE terminal widget])
+fi
+
+dnl **** Check for SANE ****
AC_ARG_ENABLE(sane, AS_HELP_STRING([--enable-sane],[Enable SANE support for scanner support]), enable_sane=$enableval,
enable_sane=yes)
-dnl **** Check for SANE ****
if test x$enable_sane != xno; then
PKG_CHECK_MODULES(SANE, sane-backends, has_sane=yes, has_sane=no)
if test $has_sane = "no"; then
@@ -272,6 +278,7 @@ echo "
PackageKit integration: ${enable_packagekit}
SANE support: ${enable_sane}
RAW support: ${enable_exiv}
+ VTE support: ${has_vte}
building unit tests: ${enable_tests}
"
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index ffd4ffa..8134e2d 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -35,7 +35,9 @@
#include <gio/gio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
+#ifdef GCM_USE_VTE
#include <vte/vte.h>
+#endif
#include <canberra-gtk.h>
#include "gcm-calibrate-argyll.h"
@@ -183,6 +185,7 @@ gcm_calibrate_argyll_printer_get_patches (GcmCalibrateArgyll *calibrate_argyll)
return patches;
}
+#ifdef GCM_USE_VTE
/**
* gcm_calibrate_argyll_get_colorimeter_image_attach:
**/
@@ -232,6 +235,7 @@ gcm_calibrate_argyll_get_colorimeter_image_screen (GcmCalibrateArgyll *calibrate
return "munki-screen.svg";
return NULL;
}
+#endif
/**
* gcm_calibrate_argyll_get_display:
@@ -364,7 +368,8 @@ out:
static gboolean
gcm_calibrate_argyll_fork_command (GcmCalibrateArgyll *calibrate_argyll, gchar **argv, GError **error)
{
- gboolean ret;
+ gboolean ret = FALSE;
+#ifdef GCM_USE_VTE
const gchar *envp[] = { "ARGYLL_NOT_INTERACTIVE", NULL };
const gchar *working_directory;
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
@@ -392,6 +397,7 @@ gcm_calibrate_argyll_fork_command (GcmCalibrateArgyll *calibrate_argyll, gchar *
/* we're running */
priv->state = GCM_CALIBRATE_ARGYLL_STATE_RUNNING;
out:
+#endif
return ret;
}
@@ -488,6 +494,7 @@ gcm_calibrate_argyll_display_neutralise (GcmCalibrateArgyll *calibrate_argyll, G
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -499,6 +506,7 @@ gcm_calibrate_argyll_display_neutralise (GcmCalibrateArgyll *calibrate_argyll, G
ret = FALSE;
goto out;
}
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -578,6 +586,7 @@ gcm_calibrate_argyll_display_read_chart (GcmCalibrateArgyll *calibrate_argyll, G
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -589,6 +598,7 @@ gcm_calibrate_argyll_display_read_chart (GcmCalibrateArgyll *calibrate_argyll, G
ret = FALSE;
goto out;
}
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -683,6 +693,7 @@ gcm_calibrate_argyll_display_generate_patches (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -694,6 +705,7 @@ gcm_calibrate_argyll_display_generate_patches (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -777,6 +789,7 @@ gcm_calibrate_argyll_display_draw_and_measure (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -788,6 +801,7 @@ gcm_calibrate_argyll_display_draw_and_measure (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -892,6 +906,7 @@ gcm_calibrate_argyll_display_generate_profile (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -903,7 +918,7 @@ gcm_calibrate_argyll_display_generate_profile (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
-
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -1113,6 +1128,7 @@ gcm_calibrate_argyll_device_measure (GcmCalibrateArgyll *calibrate_argyll, GErro
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1124,6 +1140,7 @@ gcm_calibrate_argyll_device_measure (GcmCalibrateArgyll *calibrate_argyll, GErro
ret = FALSE;
goto out;
}
+#endif
out:
g_free (filename);
g_free (command);
@@ -1236,6 +1253,7 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1247,6 +1265,7 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
ret = FALSE;
goto out;
}
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -1485,6 +1504,7 @@ gcm_calibrate_argyll_spotread_read_chart (GcmCalibrateArgyll *calibrate_argyll,
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1496,6 +1516,7 @@ gcm_calibrate_argyll_spotread_read_chart (GcmCalibrateArgyll *calibrate_argyll,
ret = FALSE;
goto out;
}
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -1647,6 +1668,7 @@ gcm_calibrate_argyll_display_generate_targets (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
+#ifdef GCM_USE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1658,6 +1680,7 @@ gcm_calibrate_argyll_display_generate_targets (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
+#endif
out:
if (array != NULL)
g_ptr_array_unref (array);
@@ -2193,6 +2216,7 @@ out:
return ret;
}
+#ifdef GCM_USE_VTE
/**
* gcm_calibrate_argyll_exit_cb:
**/
@@ -2700,7 +2724,9 @@ out:
g_string_free (string, TRUE);
return ret;
}
+#endif
+#ifdef GCM_USE_VTE
/**
* gcm_calibrate_argyll_selection_func_cb:
**/
@@ -2751,6 +2777,7 @@ gcm_calibrate_argyll_cursor_moved_cb (VteTerminal *terminal, GcmCalibrateArgyll
g_free (output);
g_strfreev (split);
}
+#endif
/**
* gcm_calibrate_argyll_response_cb:
@@ -2769,7 +2796,9 @@ gcm_calibrate_argyll_response_cb (GtkWidget *widget, GtkResponseType response, G
/* send input if waiting */
if (priv->state == GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN) {
egg_debug ("sending '%s' to argyll", priv->argyllcms_ok);
+#ifdef GCM_USE_VTE
vte_terminal_feed_child (VTE_TERMINAL(priv->terminal), priv->argyllcms_ok, 1);
+#endif
gcm_calibrate_dialog_pop (priv->calibrate_dialog);
priv->state = GCM_CALIBRATE_ARGYLL_STATE_RUNNING;
}
@@ -2789,7 +2818,9 @@ gcm_calibrate_argyll_response_cb (GtkWidget *widget, GtkResponseType response, G
/* send input if waiting */
if (priv->state == GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN) {
egg_debug ("sending 'Q' to argyll");
+#ifdef GCM_USE_VTE
vte_terminal_feed_child (VTE_TERMINAL(priv->terminal), "Q", 1);
+#endif
priv->state = GCM_CALIBRATE_ARGYLL_STATE_RUNNING;
}
@@ -2935,6 +2966,7 @@ gcm_calibrate_argyll_init (GcmCalibrateArgyll *calibrate_argyll)
calibrate_argyll->priv->screen = gcm_screen_new ();
/* add vte widget */
+#ifdef GCM_USE_VTE
calibrate_argyll->priv->terminal = vte_terminal_new ();
vte_terminal_set_size (VTE_TERMINAL(calibrate_argyll->priv->terminal), 80, 10);
g_signal_connect (calibrate_argyll->priv->terminal, "child-exited",
@@ -2943,6 +2975,7 @@ gcm_calibrate_argyll_init (GcmCalibrateArgyll *calibrate_argyll)
G_CALLBACK (gcm_calibrate_argyll_cursor_moved_cb), calibrate_argyll);
gcm_calibrate_dialog_pack_details (calibrate_argyll->priv->calibrate_dialog,
calibrate_argyll->priv->terminal);
+#endif
}
/**
@@ -2963,6 +2996,7 @@ gcm_calibrate_argyll_finalize (GObject *object)
g_main_loop_run (priv->loop);
}
+#ifdef GCM_USE_VTE
/* we don't care if the VTE widget redraws now */
g_signal_handlers_disconnect_by_func (calibrate_argyll->priv->terminal,
G_CALLBACK (gcm_calibrate_argyll_exit_cb),
@@ -2970,6 +3004,7 @@ gcm_calibrate_argyll_finalize (GObject *object)
g_signal_handlers_disconnect_by_func (calibrate_argyll->priv->terminal,
G_CALLBACK (gcm_calibrate_argyll_cursor_moved_cb),
calibrate_argyll);
+#endif
/* hide */
gcm_calibrate_dialog_hide (priv->calibrate_dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]