diff options
author | Richard Hughes <richard@hughsie.com> | 2012-06-18 10:29:57 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2012-06-18 10:35:17 +0100 |
commit | 8c5e0368590edf1ef442d1ec07bcb0acfb5b8000 (patch) | |
tree | fa1ab86284d312380faf29a7b489e4596987b728 | |
parent | da7018619b1bd0a7c9336e3fbcc4ccb32e56a6d1 (diff) | |
download | colord-gtk-8c5e0368590edf1ef442d1ec07bcb0acfb5b8000.tar.gz |
Import GTK-specific code from colord into a new project
This removes the dependancy loop when bootstrapping a distro, or using jhbuild.
36 files changed, 2908 insertions, 0 deletions
@@ -0,0 +1 @@ +Richard Hughes <richard@hughsie.com> diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..026b705 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1 @@ +Richard Hughes <richard@hughsie.com> diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..797bfe1 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,85 @@ +AUTOMAKE_OPTIONS = 1.7 + +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + +NULL = + +SUBDIRS = \ + contrib \ + libcolord-gtk \ + po + +# this needs libcolord-gtk +SUBDIRS += \ + client \ + doc + +snapshot: + $(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"` + +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-introspection \ + --enable-gtk-doc + +EXTRA_DIST = \ + COPYING \ + MAINTAINERS \ + AUTHORS \ + INSTALL \ + README \ + NEWS \ + autogen.sh \ + config.h \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in + +MAINTAINERCLEANFILES = \ + $(srcdir)/INSTALL \ + $(srcdir)/ABOUT-NLS \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/compile \ + $(srcdir)/config.guess \ + $(srcdir)/config.rpath \ + $(srcdir)/config.h.in \ + $(srcdir)/config.sub \ + $(srcdir)/configure.scan \ + $(srcdir)/depcomp \ + $(srcdir)/install-sh \ + $(srcdir)/ltmain.sh \ + $(srcdir)/missing \ + $(srcdir)/mkinstalldirs \ + $(srcdir)/omf.make \ + $(srcdir)/xmldocs.make \ + $(srcdir)/gtk-doc.make \ + $(srcdir)/ChangeLog \ + $(srcdir)/po/Makefile.in.in~ \ + $(srcdir)/colord-*.tar.* \ + `find "$(srcdir)" -type f -name Makefile.in -print` + +GITIGNOREFILES = \ + .tx + +distclean-local: + if test $(srdcir) = .; then :; else \ + rm -f ChangeLog; \ + fi + +ChangeLog: + @echo Creating $@ + @if test -d "$(srcdir)/.git"; then \ + (GIT_DIR=$(top_srcdir)/.git ./missing --run git log e197d80c8937c622f21f569457d1bbd05746d951.. --stat -M -C --name-status --date=short --no-color) | fmt --split-only > $@.tmp \ + && mv -f $@.tmp $@ \ + || ($(RM) $@.tmp; \ + echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ + (test -f $@ || echo git-log is required to generate this file >> $@)); \ + else \ + test -f $@ || \ + (echo A git checkout and git-log is required to generate ChangeLog >&2 && \ + echo A git checkout and git-log is required to generate this file >> $@); \ + fi + +.PHONY: ChangeLog + +-include $(top_srcdir)/git.mk @@ -0,0 +1,15 @@ +Version 0.1.21 +~~~~~~~~~~~~~~ +Released: 2012-05-22 + +Bugfixes: + - Do not add sensors that are ignored or have no caps (Richard Hughes) + - Do not install any parts of colord-sane if --disable-sane is specified (Christoph Brill) + - Do not use 'WantedBy=graphical.target' in the shipped systemd file (Benedikt Morbach) + - Fix autotools when configuring without systemd (Benedikt Morbach) + - Fix InstallSystemWide() by not writing a private file (Richard Hughes) + - Fix srcdir != builddir with introspection enabled (Colin Walters) + - Fix the description in the systemd service file (Benedikt Morbach) + - Isolate gtk dependency to cd-convert (Yanko Kaneti) + - Save the CCMX and ITx files to be compatible with argyllcms (Richard Hughes) + - The ColorHug has a new VID and PID (Richard Hughes) @@ -0,0 +1,5 @@ + colord-gtk + +colord-gtk is a GTK+ support library. + +See http://colord.hughsie.com/ for more details. @@ -0,0 +1,65 @@ +colord-gtk Release Notes + +1. Write NEWS entries for colord in the same format as usual. + +git shortlog COLORD_GTK_0_1_21.. | grep -i -v trivial | grep -v Merge > NEWS.new + +Version 0.1.22 +~~~~~~~~~~~~~~ +Released: 2012-xx-xx + +Translations: +New Features: +Bugfixes: + +Write release date to doc/website/download.html + +Update translations: + +tx push --source +tx pull --all +git add po/*.po + +2. Commit changes to git: + +# MAKE SURE THESE ARE CORRECT +export release_version="0.1.22" +export release_tag="COLORD_GTK_0_1_22" + +git commit -a -m "Release colord-gtk ${release_version}" +git tag -s -f -m "Release colord-gtk ${release_version}" "${release_tag}" +<wait> +git push --tags +git push + +3. Generate the tarball: + +make dist + +3a. Generate the additon verification metadata + +sha1sum colord-${release_version}.tar.xz > colord-${release_version}.tar.xz.sha1 +gpg -b -a colord-${release_version}.tar.xz + +4. Upload tarball: + +scp colord-${release_version}.tar.* hughsient@annarchy.freedesktop.org:/srv/www.freedesktop.org/www/software/colord/releases/ + +5. Do post release version bump in configure.ac + +6. Commit changes: + +git commit -a -m "trivial: post release version bump" +git push +tx push --source + +7. Sync website with ./upload.sh + +8. Send an email to colord@lists.freedesktop.org + +colord is a system activated daemon that maps devices to color profiles. + +See http://www.freedesktop.org/software/colord/ for more details. + +Tarballs can be found here: +http://www.freedesktop.org/software/colord/releases/ @@ -0,0 +1,11 @@ + Things still left to do... + +These are a list of things that have to be done, in no particular order. +If you're taking on one of these items, please email the mailing list +to ensure hard work is not duplicated. + +* device.Created has to be saved in the database + +* device.Modified has to be saved in the database (even for temp devices) + +* Test device.Modified gets changed on profile changes diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..f0ecc62 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright (C) 2010 Richard Hughes <richard@hughsie.com> +# +# Run this to generate all the initial makefiles, etc. +# +# Licensed under the GNU General Public License Version 2 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +test -n "$srcdir" || srcdir=`dirname "$0"` +test -n "$srcdir" || srcdir=. + +olddir=`pwd` +cd "$srcdir" + +GTKDOCIZE=`which gtkdocize` +if test -z $GTKDOCIZE; then + echo "*** No GTK-Doc found, please install it ***" + exit 1 +fi + +AUTORECONF=`which autoreconf` +if test -z $AUTORECONF; then + echo "*** No autoreconf found, please install it ***" + exit 1 +fi + +gtkdocize || exit $? +autopoint --force +ACLOCAL="${ACLOCAL-aclocal} $ACLOCAL_FLAGS" AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose + +cd "$olddir" +test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" diff --git a/client/Makefile.am b/client/Makefile.am new file mode 100644 index 0000000..23e5af7 --- /dev/null +++ b/client/Makefile.am @@ -0,0 +1,32 @@ +INCLUDES = \ + $(GLIB_CFLAGS) \ + $(GTK_CFLAGS) \ + $(COLORD_CFLAGS) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libcolord-gtk \ + -DG_LOG_DOMAIN=\"Cd\" \ + -DCD_COMPILATION \ + -DVERSION="\"$(VERSION)\"" \ + -DLOCALEDIR=\""$(localedir)"\" + +COLORD_GTK_LIBS = \ + $(top_builddir)/libcolord-gtk/libcolord-gtk.la + +noinst_PROGRAMS = \ + colord-convert + +colord_convert_SOURCES = \ + cd-convert.c + +colord_convert_LDADD = \ + $(LCMS_LIBS) \ + $(COLORD_LIBS) \ + $(COLORD_GTK_LIBS) \ + $(GTK_LIBS) \ + $(GLIB_LIBS) \ + -lm + +colord_convert_CFLAGS = \ + $(WARNINGFLAGS_C) + +-include $(top_srcdir)/git.mk diff --git a/client/cd-convert.c b/client/cd-convert.c new file mode 100644 index 0000000..ee0943f --- /dev/null +++ b/client/cd-convert.c @@ -0,0 +1,387 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include <glib.h> +#include <stdlib.h> +#include <gtk/gtk.h> +#include <glib/gi18n.h> +#include <gio/gio.h> +#include <locale.h> +#include <colord.h> + +#include "cd-sample-window.h" + +/** + * cd_convert_ti3_ti3_to_ccmx: + **/ +static gboolean +cd_convert_ti3_ti3_to_ccmx (const gchar *reference_fn, + const gchar *measured_fn, + const gchar *device_fn, + GError **error) +{ + CdIt8 *it8_ccmx = NULL; + CdIt8 *it8_measured = NULL; + CdIt8 *it8_reference = NULL; + gboolean ret; + GFile *file_ccmx = NULL; + GFile *file_measured = NULL; + GFile *file_reference = NULL; + + /* load reference */ + it8_reference = cd_it8_new (); + file_reference = g_file_new_for_path (reference_fn); + ret = cd_it8_load_from_file (it8_reference, + file_reference, + error); + if (!ret) + goto out; + + /* load measured */ + it8_measured = cd_it8_new (); + file_measured = g_file_new_for_path (measured_fn); + ret = cd_it8_load_from_file (it8_measured, + file_measured, + error); + if (!ret) + goto out; + + /* calculate calibration matrix */ + it8_ccmx = cd_it8_new_with_kind (CD_IT8_KIND_CCMX); + ret = cd_it8_utils_calculate_ccmx (it8_reference, + it8_measured, + it8_ccmx, + error); + if (!ret) + goto out; + + /* save file */ + file_ccmx = g_file_new_for_path (device_fn); + cd_it8_set_title (it8_ccmx, "Factory Calibration"); + cd_it8_set_originator (it8_ccmx, "cd-convert"); + cd_it8_add_option (it8_ccmx, "TYPE_FACTORY"); + ret = cd_it8_save_to_file (it8_ccmx, file_ccmx, error); + if (!ret) + goto out; +out: + if (file_reference != NULL) + g_object_unref (file_reference); + if (file_measured != NULL) + g_object_unref (file_measured); + if (file_ccmx != NULL) + g_object_unref (file_ccmx); + if (it8_reference != NULL) + g_object_unref (it8_reference); + if (it8_measured != NULL) + g_object_unref (it8_measured); + if (it8_ccmx != NULL) + g_object_unref (it8_ccmx); + return ret; +} + +/** + * cd_convert_setup_sensor: + **/ +static CdSensor * +cd_convert_setup_sensor (CdClient *client, + GError **error) +{ + CdSensor *sensor = NULL; + CdSensor *sensor_tmp; + gboolean ret; + GPtrArray *sensors = NULL; + + /* get sensor */ + sensors = cd_client_get_sensors_sync (client, NULL, error); + if (sensors == NULL) { + ret = FALSE; + goto out; + } + if (sensors->len == 0) { + ret = FALSE; + g_set_error_literal (error, 1, 0, + "No native sensors plugged in!"); + goto out; + } + sensor_tmp = g_ptr_array_index (sensors, 0); + ret = cd_sensor_connect_sync (sensor_tmp, NULL, error); + if (!ret) + goto out; + sensor = g_object_ref (sensor_tmp); +out: + if (sensors != NULL) + g_ptr_array_unref (sensors); + return sensor; +} + +/** + * cd_convert_idle_delay_cb: + **/ +static gboolean +cd_convert_idle_delay_cb (gpointer user_data) +{ + GMainLoop *loop = (GMainLoop *) user_data; + g_main_loop_quit (loop); + return FALSE; +} + +/** + * cd_convert_idle_delay: + **/ +static void +cd_convert_idle_delay (guint ms) +{ + GMainLoop *loop; + loop = g_main_loop_new (NULL, FALSE); + g_timeout_add (ms, cd_convert_idle_delay_cb, loop); + g_main_loop_run (loop); + g_main_loop_unref (loop); +} + +/** + * cd_convert_ti1_to_ti3: + **/ +static gboolean +cd_convert_ti1_to_ti3 (const gchar *patches_fn, + const gchar *measured_fn, + CdSensor *sensor, + GError **error) +{ + CdColorRGB rgb; + CdColorXYZ *xyz_tmp; + CdIt8 *it8_measured = NULL; + CdIt8 *it8_patches = NULL; + gboolean ret; + GFile *file_measured = NULL; + GFile *file_patches = NULL; + GtkWindow *sample_window = NULL; + guint i; + guint size; + + /* load patches */ + it8_patches = cd_it8_new (); + file_patches = g_file_new_for_path (patches_fn); + ret = cd_it8_load_from_file (it8_patches, + file_patches, + error); + if (!ret) + goto out; + + /* lock the sensor */ + ret = cd_sensor_lock_sync (sensor, + NULL, + error); + if (!ret) + goto out; + + /* create measurement file */ + sample_window = cd_sample_window_new (); + gtk_window_present (sample_window); + it8_measured = cd_it8_new_with_kind (CD_IT8_KIND_TI3); + size = cd_it8_get_data_size (it8_patches); + for (i = 0; i < size; i++) { + cd_it8_get_data_item (it8_patches, i, &rgb, NULL); + cd_sample_window_set_color (CD_SAMPLE_WINDOW (sample_window), &rgb); + cd_sample_window_set_fraction (CD_SAMPLE_WINDOW (sample_window), + (gdouble) i / (gdouble) size); + cd_convert_idle_delay (200); + + /* get the sample using the default matrix */ + xyz_tmp = cd_sensor_get_sample_sync (sensor, + CD_SENSOR_CAP_LCD, + NULL, + error); + if (xyz_tmp == NULL) { + ret = FALSE; + goto out; + } + + /* add to measured sheet */ + cd_it8_add_data (it8_measured, &rgb, xyz_tmp); + cd_color_xyz_free (xyz_tmp); + } + + /* unlock the sensor */ + ret = cd_sensor_unlock_sync (sensor, + NULL, + error); + if (!ret) + goto out; + + /* save file */ + file_measured = g_file_new_for_path (measured_fn); + cd_it8_set_title (it8_measured, "Calibration"); + cd_it8_set_originator (it8_measured, "cd-convert"); + cd_it8_set_instrument (it8_measured, cd_sensor_get_model (sensor)); + ret = cd_it8_save_to_file (it8_measured, file_measured, error); + if (!ret) + goto out; +out: + if (file_patches != NULL) + g_object_unref (file_patches); + if (file_measured != NULL) + g_object_unref (file_measured); + if (it8_patches != NULL) + g_object_unref (it8_patches); + if (it8_measured != NULL) + g_object_unref (it8_measured); + return ret; +} + +/** + * main: + **/ +int +main (int argc, char **argv) +{ + CdClient *client = NULL; + CdDevice *device = NULL; + CdSensor *sensor = NULL; + gboolean ret; + gchar *device_id = NULL; + GError *error = NULL; + gint retval = EXIT_FAILURE; + GOptionContext *context; + guint xid = 0; + + const GOptionEntry options[] = { + { "device", '\0', 0, G_OPTION_ARG_STRING, &device_id, + /* TRANSLATORS: command line option */ + _("Use this device for profiling"), NULL }, + { "xid", '\0', 0, G_OPTION_ARG_INT, &xid, + /* TRANSLATORS: command line option */ + _("Make the window modal to this XID"), NULL }, + { NULL} + }; + + setlocale (LC_ALL, ""); + + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + gtk_init (&argc, &argv); + + /* TRANSLATORS: just dumps the EDID to disk */ + context = g_option_context_new (_("gcm-dispread")); + g_option_context_add_main_entries (context, options, NULL); + g_option_context_add_group (context, gtk_get_option_group (TRUE)); + ret = g_option_context_parse (context, &argc, &argv, &error); + if (!ret) + goto out; + + /* get client */ + client = cd_client_new (); + ret = cd_client_connect_sync (client, NULL, &error); + if (!ret) + goto out; + + /* check device */ + if (device_id != NULL) { + device = cd_client_find_device_sync (client, + device_id, + NULL, + &error); + if (device == NULL) { + ret = FALSE; + goto out; + } + ret = cd_device_connect_sync (device, + NULL, + &error); + if (!ret) + goto out; + } + + /* create a .ccmx from two .ti3 files */ + if (argc == 4 && + g_str_has_suffix (argv[1], ".ti3") && + g_str_has_suffix (argv[2], ".ti3") && + g_str_has_suffix (argv[3], ".ccmx")) { + ret = cd_convert_ti3_ti3_to_ccmx (argv[1], + argv[2], + argv[3], + &error); + if (!ret) { + g_print ("failed to create ccmx: %s", error->message); + g_error_free (error); + goto out; + } + } else if (argc == 3 && + g_str_has_suffix (argv[1], ".ti1") && + g_str_has_suffix (argv[2], ".ti3")) { + + /* get sensor */ + sensor = cd_convert_setup_sensor (client, &error); + if (sensor == NULL) { + ret = FALSE; + goto out; + } + + /* mark device to be profiled in colord */ + if (device != NULL) { + ret = cd_device_profiling_inhibit_sync (device, + NULL, + &error); + if (!ret) + goto out; + } + + /* run the samples */ + ret = cd_convert_ti1_to_ti3 (argv[1], + argv[2], + sensor, + &error); + if (!ret) { + g_print ("failed to create ti3: %s", error->message); + g_error_free (error); + goto out; + } + } else { + ret = FALSE; + g_set_error_literal (&error, 1, 0, + "Specify one of:\n" + "patches.ti1 measured.ti3\n" + "reference.ti3 measured.ti3 device.ccmx"); + goto out; + } + + /* success */ + retval = EXIT_SUCCESS; +out: + if (!ret) { + g_print ("%s: %s\n", + _("Failed to calibrate"), + error->message); + g_error_free (error); + } + g_option_context_free (context); + if (device != NULL) + g_object_unref (device); + if (client != NULL) + g_object_unref (client); + if (sensor != NULL) + g_object_unref (sensor); + g_free (device_id); + return retval; +} diff --git a/colord-gtk.doap b/colord-gtk.doap new file mode 100644 index 0000000..d6e6028 --- /dev/null +++ b/colord-gtk.doap @@ -0,0 +1,25 @@ +<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:foaf="http://xmlns.com/foaf/0.1/" + xmlns:gnome="http://api.gnome.org/doap-extensions#" + xmlns="http://usefulinc.com/ns/doap#"> + + <name xml:lang="en">colord-gtk</name> + <shortdesc xml:lang="en">colord-gtk is a Gtk helper library for colord.</shortdesc> + <description xml:lang="en"> + colord-gtk is a Gtk helper library for colord. + </description> + + <homepage rdf:resource="http://colord.hughsie.com/" /> + + <maintainer> + <foaf:Person> + <foaf:name>Richard Hughes</foaf:name> + <foaf:mbox rdf:resource="mailto:richard@hughsie.com" /> + <foaf:homepage rdf:resource="http://www.hughsie.com/" /> + </foaf:Person> + </maintainer> + + <license rdf:resource="http://www.gnu.org/licenses/gpl-2.0.txt" /> + +</Project> diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..d608fbf --- /dev/null +++ b/configure.ac @@ -0,0 +1,180 @@ +# Copyright (C) 2012 Richard Hughes <richard@hughsie.com> +AC_PREREQ(2.63) + +m4_define([cd_major_version], [0]) +m4_define([cd_minor_version], [1]) +m4_define([cd_micro_version], [22]) +m4_define([cd_version], + [cd_major_version.cd_minor_version.cd_micro_version]) + +AC_INIT([colord-gtk],[cd_version],[http://hughsie.com]) +AC_CONFIG_SRCDIR(libcolord-gtk) +AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz tar-ustar]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) +AC_PROG_LIBTOOL + +GOBJECT_INTROSPECTION_CHECK([0.9.8]) + +# set up gtk-doc +GTK_DOC_CHECK(1.9) + +# use this in cd-version.h +CD_GTK_MAJOR_VERSION=cd_major_version +CD_GTK_MINOR_VERSION=cd_minor_version +CD_GTK_MICRO_VERSION=cd_micro_version +AC_SUBST(VERSION) +AC_SUBST(CD_GTK_MAJOR_VERSION) +AC_SUBST(CD_GTK_MINOR_VERSION) +AC_SUBST(CD_GTK_MICRO_VERSION) + +# libtool versioning - this applies to libcolord-gtk +# +# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details +# +# increment; +# CURRENT If the API or ABI interface has changed (reset REVISION to 0) +# REVISION If the API and ABI remains the same, but bugs are fixed. +# AGE Don't use. +LT_CURRENT=1 +LT_REVISION=11 +LT_AGE=0 +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) + +# enable nice build output on automake1.11 +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +AS_ALL_LINGUAS +AC_PROG_CC +AC_PROG_INSTALL +LT_INIT +AM_PROG_CC_C_O +IT_PROG_INTLTOOL([0.35.0]) +AC_PATH_PROG(XSLTPROC, xsltproc) + +dnl --------------------------------------------------------------------------- +dnl - Use strict options (default enabled for devs, disabled in releases) +dnl --------------------------------------------------------------------------- +if test -d ".git"; then + default_strict=yes +else + default_strict=no +fi + +AC_ARG_ENABLE(strict, AS_HELP_STRING([--enable-strict], + [Enable strict compilation options]), + enable_strict=$enableval, + enable_strict=$default_strict) +if test x$enable_strict != xno; then + CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES" + CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED" + CPPFLAGS="$CPPFLAGS -DGSEAL_ENABLE" + if test "$GCC" = "yes"; then + CPPFLAGS="$CPPFLAGS -Werror" + fi +fi + +dnl --------------------------------------------------------------------------- +dnl - Extra verbose warning switches +dnl --------------------------------------------------------------------------- + +if test "$GCC" = "yes"; then + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wall" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align -Wno-uninitialized" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-declarations" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wpointer-arith" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wwrite-strings" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Winit-self" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wreturn-type" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-nonliteral" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-security" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-include-dirs" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-format-attribute" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wclobbered" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wempty-body" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wignored-qualifiers" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wsign-compare" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wtype-limits" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wuninitialized" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Waggregate-return" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wdeclaration-after-statement" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init" +else + WARNINGFLAGS_C="" +fi +AC_SUBST(WARNINGFLAGS_C) + +dnl --------------------------------------------------------------------------- +dnl - gettext stuff +dnl --------------------------------------------------------------------------- +AM_GNU_GETTEXT_VERSION([0.17]) +AM_GNU_GETTEXT([external]) + +GETTEXT_PACKAGE=AC_PACKAGE_NAME +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE(GETTEXT_PACKAGE, "AC_PACKAGE_NAME", [foo]) + +GLIB_GSETTINGS + +dnl --------------------------------------------------------------------------- +dnl - Check library dependencies +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28.0 gobject-2.0 gthread-2.0 gio-2.0 >= 2.25.9 gio-unix-2.0 gmodule-2.0) +PKG_CHECK_MODULES(GTK, gtk+-3.0) +PKG_CHECK_MODULES(COLORD, colord) +PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2) + +dnl --------------------------------------------------------------------------- +dnl - Build VALA support +dnl --------------------------------------------------------------------------- +if test x$found_introspection != xno; then + AC_PATH_PROG([VAPIGEN], [vapigen], []) + if test "x$VAPIGEN" = "x"; then + has_vapigen="no" + AC_MSG_WARN([vapigen not found, will not build Vala binding]) + else + has_vapigen="yes" + fi +else + has_vapigen="no" + AC_MSG_WARN([Not introspection found, will not build Vala binding]) +fi +AM_CONDITIONAL(HAVE_VAPIGEN, [test "x$has_vapigen" = "xyes"]) + +dnl --------------------------------------------------------------------------- +dnl - Makefiles, etc. +dnl --------------------------------------------------------------------------- +AC_CONFIG_FILES([ +Makefile +contrib/Makefile +doc/Makefile +doc/api/Makefile +doc/api/version.xml +po/Makefile.in +client/Makefile +libcolord-gtk/cd-version.h +libcolord-gtk/colord-gtk.pc +libcolord-gtk/Makefile +]) +AC_OUTPUT + +dnl ========================================================================== +echo " + colord-gtk $VERSION + =================== + + prefix: ${prefix} + datadir: ${datadir} + compiler: ${CC} + cflags: ${CFLAGS} + cppflags: ${CPPFLAGS} + gobject-introspection: ${found_introspection} + Vala API generator: ${has_vapigen} +" diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 0000000..ae44c94 --- /dev/null +++ b/contrib/Makefile.am @@ -0,0 +1 @@ +-include $(top_srcdir)/git.mk diff --git a/contrib/colord-gtk.spec.in b/contrib/colord-gtk.spec.in new file mode 100644 index 0000000..93f4546 --- /dev/null +++ b/contrib/colord-gtk.spec.in @@ -0,0 +1,77 @@ +%define alphatag #ALPHATAG# + +Summary: GTK support library for colord +Name: colord-gtk +Version: #VERSION# +Release: 0.#BUILD#%{?alphatag}%{?dist} +License: LGPLv2+ +URL: http://www.freedesktop.org/software/colord/ +Source0: http://www.freedesktop.org/software/colord/releases/%{name}-%{version}.tar.xz + +BuildRequires: docbook-utils +BuildRequires: gettext +BuildRequires: glib2-devel +BuildRequires: intltool +BuildRequires: lcms2-devel >= 2.2 +BuildRequires: gobject-introspection-devel +BuildRequires: vala-tools +BuildRequires: gtk3-devel +BuildRequires: gtk-doc + +%description +colord is a support library for colord and provides additional +functionality that requires GTK+. + +%package devel +Summary: Development package for %{name} +Requires: %{name} = %{version}-%{release} + +%description devel +Files for development with %{name}. + +%prep +%setup -q + +%build +%configure \ + --enable-gtk-doc \ + --disable-static \ + --disable-rpath \ + --disable-dependency-tracking + +make %{?_smp_mflags} + +%install +make install DESTDIR=$RPM_BUILD_ROOT + +# Remove static libs and libtool archives. +find %{buildroot} -name '*.la' -exec rm -f {} ';' +find %{buildroot} -name '*.a' -exec rm -f {} ';' + +%find_lang %{name} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc README AUTHORS NEWS COPYING +%{_libdir}/libcolord-gtk.so.* +%{_datadir}/gir-1.0/ColordGtk-1.0.gir + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libcolord-gtk.so +%{_libdir}/pkgconfig/colord-gtk.pc +%dir %{_includedir}/colord-1 +%{_includedir}/colord-1/colord-gtk.h +%dir %{_includedir}/colord-1/colord-gtk +%{_includedir}/colord-1/colord-gtk/*.h +%{_libdir}/girepository-1.0/ColordGtk-1.0.typelib +%dir %{_datadir}/gtk-doc/html/colord-gtk +%{_datadir}/gtk-doc/html/colord-gtk + +%changelog +* #LONGDATE# Richard Hughes <richard@hughsie.com> #VERSION#-0.#BUILD##ALPHATAG# +- Update from git + diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..1dc641b --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = \ + api + +-include $(top_srcdir)/git.mk diff --git a/doc/api/Makefile.am b/doc/api/Makefile.am new file mode 100644 index 0000000..4bef5e7 --- /dev/null +++ b/doc/api/Makefile.am @@ -0,0 +1,70 @@ +AUTOMAKE_OPTIONS = 1.7 + +# The name of the module. +DOC_MODULE=colord-gtk + +# The top-level SGML file. +DOC_MAIN_SGML_FILE=colord-gtk-docs.xml + +# Extra options to supply to gtkdoc-scan +SCAN_OPTIONS=--ignore-headers=config.h + +# The directory containing the source code. Relative to $(srcdir) +DOC_SOURCE_DIR=../../libcolord-gtk + +# Used for dependencies +HFILE_GLOB= +CFILE_GLOB= + +# Headers to ignore +IGNORE_HFILES= \ + config.h + +# CFLAGS and LDFLAGS for compiling scan program. Only needed +# if $(DOC_MODULE).types is non-empty. +INCLUDES = \ + $(GLIB_CFLAGS) \ + -I$(top_srcdir)/libcolord-gtk \ + -I$(top_builddir)/libcolord-gtk + +COLORD_LIBS = $(top_builddir)/libcolord-gtk/libcolord-gtk.la + +GTKDOC_LIBS = \ + $(GLIB_LIBS) \ + $(COLORD_LIBS) + +# Extra options to supply to gtkdoc-mkdb +MKDB_OPTIONS=--sgml-mode --output-format=xml + +# Extra options to supply to gtkdoc-mktmpl +MKTMPL_OPTIONS= + +# Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE) +content_files = \ + version.xml + +# Images to copy into HTML directory +HTML_IMAGES = \ + $(NULL) + +# Extra options to supply to gtkdoc-fixref +FIXXREF_OPTIONS= + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in \ + colord-gtk.types \ + colord-*.txt + +if ENABLE_GTK_DOC +include $(top_srcdir)/gtk-doc.make +CLEANFILES += tmpl +else +EXTRA_DIST = +CLEANFILES = tmpl +endif + +# Version information for marking the documentation +EXTRA_DIST += version.xml.in + +-include $(top_srcdir)/git.mk diff --git a/doc/api/clean.sh b/doc/api/clean.sh new file mode 100755 index 0000000..ff8c845 --- /dev/null +++ b/doc/api/clean.sh @@ -0,0 +1,7 @@ +rm -f *.txt +rm -f colord-scan* +rm -f colord.types +rm -rf html/ +rm -rf tmpl/ +rm -f *.stamp + diff --git a/doc/api/colord-gtk-docs.xml b/doc/api/colord-gtk-docs.xml new file mode 100644 index 0000000..708ba82 --- /dev/null +++ b/doc/api/colord-gtk-docs.xml @@ -0,0 +1,92 @@ +<?xml version="1.0"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<!ENTITY version SYSTEM "version.xml"> +]> +<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude"> + <bookinfo> + <title>colord-gtk Reference Manual</title> + <releaseinfo>Version &version;</releaseinfo> + <authorgroup> + <author> + <firstname>Richard</firstname> + <surname>Hughes</surname> + <affiliation> + <address> + <email>richard@hughsie.com</email> + </address> + </affiliation> + </author> + </authorgroup> + + <copyright> + <year>2012</year> + <holder>The colord-gtk authors</holder> + </copyright> + + <legalnotice> + <para> + Permission is granted to copy, distribute and/or modify this + document under the terms of the <citetitle>GNU Free + Documentation License</citetitle>, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the <citetitle>GNU Free + Documentation License</citetitle> from the Free Software + Foundation by visiting <ulink type="http" + url="http://www.fsf.org">their Web site</ulink> or by writing + to: + + <address> + The Free Software Foundation, Inc., + <street>59 Temple Place</street> - Suite 330, + <city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>, + <country>USA</country> + </address> + </para> + + <para> + Many of the names used by companies to distinguish their + products and services are claimed as trademarks. Where those + names appear in any freedesktop.org documentation, and those + trademarks are made aware to the members of the + freedesktop.org Project, the names have been printed in caps + or initial caps. + </para> + </legalnotice> + </bookinfo> + + <reference id="libcolord-gtk"> + <title>libcolord-gtk GObjects</title> + <partintro> + <para> + This part documents GObjects used in libcolord-gtk. + </para> + </partintro> + <xi:include href="xml/cd-sample-window.xml"/> + <xi:include href="xml/cd-window.xml"/> + </reference> + + <reference id="libcolord-glib-helpers"> + <title>libcolord-glib helpers</title> + <partintro> + <para> + This part documents helper funtions in libcolord-gtk. + </para> + </partintro> + <xi:include href="xml/cd-version.xml"/> + </reference> + + <index> + <title>Index</title> + </index> + + <!-- License --> + + <appendix id="license"> + <title>License</title> + <para> +<programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../../COPYING" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting> + </para> + </appendix> +</book> diff --git a/doc/api/version.xml.in b/doc/api/version.xml.in new file mode 100644 index 0000000..d78bda9 --- /dev/null +++ b/doc/api/version.xml.in @@ -0,0 +1 @@ +@VERSION@ @@ -0,0 +1,200 @@ +# git.mk +# +# Copyright 2009, Red Hat, Inc. +# Written by Behdad Esfahbod +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +# +# The canonical source for this file is pango/git.mk, or whereever the +# header of pango/git.mk suggests in the future. +# +# To use in your project, import this file in your git repo's toplevel, +# then do "make -f git.mk". This modifies all Makefile.am files in +# your project to include git.mk. +# +# This enables automatic .gitignore generation. If you need to ignore +# more files, add them to the GITIGNOREFILES variable in your Makefile.am. +# But think twice before doing that. If a file has to be in .gitignore, +# chances are very high that it's a generated file and should be in one +# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. +# +# The only case that you need to manually add a file to GITIGNOREFILES is +# when remove files in one of mostlyclean-local, clean-local, distclean-local, +# or maintainer-clean-local. +# +# Note that for files like editor backup, etc, there are better places to +# ignore them. See "man gitignore". +# +# If "make maintainer-clean" removes the files but they are not recognized +# by this script (that is, if "git status" shows untracked files still), send +# me the output of "git status" as well as your Makefile.am and Makefile for +# the directories involved. +# +# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see +# pango/Makefile.am. +# +# Don't EXTRA_DIST this file. It is supposed to only live in git clones, +# not tarballs. It serves no useful purpose in tarballs and clutters the +# build dir. +# +# This file knows how to handle autoconf, automake, libtool, gtk-doc, +# gnome-doc-utils, mallard, intltool, gsettings. +# +# +# KNOWN ISSUES: +# +# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the +# submodule doesn't find us. If you have configure.{in,ac} files in +# subdirs, add a proxy git.mk file in those dirs that simply does: +# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. +# And add those files to git. See vte/gnome-pty-helper/git.mk for +# example. +# +# ChangeLog +# +# - 2010-12-06 Add support for Mallard docs +# - 2010-12-06 Start this change log + +git-all: git-mk-install + +git-mk-install: + @echo Installing git makefile + @any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \ + if grep 'include .*/git.mk' $$x >/dev/null; then \ + echo $$x already includes git.mk; \ + else \ + failed=; \ + echo "Updating $$x"; \ + { cat $$x; \ + echo ''; \ + echo '-include $$(top_srcdir)/git.mk'; \ + } > $$x.tmp || failed=1; \ + if test x$$failed = x; then \ + mv $$x.tmp $$x || failed=1; \ + fi; \ + if test x$$failed = x; then : else \ + echo Failed updating $$x; >&2 \ + any_failed=1; \ + fi; \ + fi; done; test -z "$$any_failed" + +.PHONY: git-all git-mk-install + + +### .gitignore generation + +$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk + $(AM_V_GEN) \ + { \ + if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ + for x in \ + $(DOC_MODULE)-decl-list.txt \ + $(DOC_MODULE)-decl.txt \ + tmpl/$(DOC_MODULE)-unused.sgml \ + "tmpl/*.bak" \ + xml html \ + ; do echo /$$x; done; \ + fi; \ + if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ + for x in \ + $(_DOC_C_DOCS) \ + $(_DOC_LC_DOCS) \ + $(_DOC_OMF_ALL) \ + $(_DOC_DSK_ALL) \ + $(_DOC_HTML_ALL) \ + $(_DOC_MOFILES) \ + $(_DOC_POFILES) \ + $(DOC_H_FILE) \ + "*/.xml2po.mo" \ + "*/*.omf.out" \ + ; do echo /$$x; done; \ + fi; \ + if test "x$(gsettings_SCHEMAS)" = x; then :; else \ + for x in \ + $(gsettings_SCHEMAS:.xml=.valid) \ + $(gsettings__enum_file) \ + ; do echo /$$x; done; \ + fi; \ + if test -f $(srcdir)/po/Makefile.in.in; then \ + for x in \ + po/Makefile.in.in \ + po/Makefile.in \ + po/Makefile \ + po/POTFILES \ + po/stamp-it \ + po/.intltool-merge-cache \ + "po/*.gmo" \ + "po/*.mo" \ + po/$(GETTEXT_PACKAGE).pot \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in \ + ; do echo /$$x; done; \ + fi; \ + if test -f $(srcdir)/configure; then \ + for x in \ + autom4te.cache \ + configure \ + config.h \ + stamp-h1 \ + libtool \ + config.lt \ + ; do echo /$$x; done; \ + fi; \ + for x in \ + .gitignore \ + $(GITIGNOREFILES) \ + $(CLEANFILES) \ + $(PROGRAMS) \ + $(check_PROGRAMS) \ + $(EXTRA_PROGRAMS) \ + $(LTLIBRARIES) \ + so_locations \ + .libs _libs \ + $(MOSTLYCLEANFILES) \ + "*.$(OBJEXT)" \ + "*.lo" \ + $(DISTCLEANFILES) \ + $(am__CONFIG_DISTCLEAN_FILES) \ + $(CONFIG_CLEAN_FILES) \ + TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ + "*.tab.c" \ + $(MAINTAINERCLEANFILES) \ + $(BUILT_SOURCES) \ + $(DEPDIR) \ + Makefile \ + Makefile.in \ + "*.orig" \ + "*.rej" \ + "*.bak" \ + "*~" \ + ".*.sw[nop]" \ + ".dirstamp" \ + ; do echo /$$x; done; \ + } | \ + sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ + sed 's@/[.]/@/@g' | \ + LC_ALL=C sort | uniq > $@.tmp && \ + mv $@.tmp $@; + +all: $(srcdir)/.gitignore gitignore-recurse-maybe +gitignore-recurse-maybe: + @if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \ + $(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \ + fi; +gitignore-recurse: + @for subdir in $(DIST_SUBDIRS); do \ + case " $(SUBDIRS) " in \ + *" $$subdir "*) :;; \ + *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir");; \ + esac; \ + done +gitignore: $(srcdir)/.gitignore gitignore-recurse + +maintainer-clean: gitignore-clean +gitignore-clean: + -rm -f $(srcdir)/.gitignore + +.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe diff --git a/libcolord-gtk/Makefile.am b/libcolord-gtk/Makefile.am new file mode 100644 index 0000000..32ea122 --- /dev/null +++ b/libcolord-gtk/Makefile.am @@ -0,0 +1,130 @@ +if HAVE_INTROSPECTION +-include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = +INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ + --add-include-path=$(top_builddir)/libcolord-gtk +INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) \ + --includedir=$(top_srcdir)/libcolord-gtk \ + --includedir=$(top_builddir)/libcolord-gtk +endif + +INCLUDES = \ + $(GLIB_CFLAGS) \ + $(COLORD_CFLAGS) \ + $(GTK_CFLAGS) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libcolord-gtk \ + -DCD_COMPILATION \ + -DG_LOG_DOMAIN=\"libcolord-gtk\" \ + -DTESTDATADIR=\""$(top_srcdir)/data/tests"\" \ + -DPACKAGE_DATA_DIR=\""$(datadir)"\" + +lib_LTLIBRARIES = \ + libcolord-gtk.la + +libcolord_includedir = $(includedir)/colord-1 +libcolord_include_HEADERS = \ + colord-gtk.h + +libcolordgtkbase_includedir = $(libcolord_includedir)/colord-gtk +libcolordgtkbase_include_HEADERS = \ + cd-version.h \ + cd-sample-window.h \ + cd-window.h \ + cd-window-sync.h + +libcolord_gtk_la_SOURCES = \ + cd-sample-window.c \ + cd-window.c \ + cd-window-sync.c + +libcolord_gtk_la_LIBADD = \ + $(COLORD_LIBS) \ + $(GTK_LIBS) \ + $(GLIB_LIBS) + +libcolord_gtk_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -export-dynamic \ + -no-undefined \ + -export-symbols-regex '^cd_.*' + +libcolord_gtk_la_CFLAGS = \ + $(WARNINGFLAGS_C) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = colord-gtk.pc + +check_PROGRAMS = \ + cd-self-test + +cd_self_test_SOURCES = \ + cd-self-test.c + +cd_self_test_LDADD = \ + $(COLORD_LIBS) \ + $(GLIB_LIBS) \ + $(GTK_LIBS) \ + $(lib_LTLIBRARIES) + +cd_self_test_CFLAGS = $(WARNINGFLAGS_C) + +TESTS = cd-self-test + +EXTRA_DIST = \ + colord-gtk.pc.in + +MAINTAINERCLEANFILES = \ + $(noinst_LIBRARIES) + +CLEANFILES = $(BUILT_SOURCES) + +if HAVE_INTROSPECTION +introspection_sources = \ + $(libcolordgtk_la_SOURCES) \ + $(libcolordgtkbase_include_HEADERS) + +ColordGtk-1.0.gir: libcolord-gtk.la +ColordGtk_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 Gtk-3.0 Colord-1.0 +ColordGtk_1_0_gir_CFLAGS = $(INCLUDES) +ColordGtk_1_0_gir_SCANNERFLAGS = --identifier-prefix=Cd \ + --symbol-prefix=cd_ \ + --warn-all \ + --add-include-path=$(srcdir) \ + --add-include-path=$(top_srcdir)/libcolord \ + --c-include="colord-gtk.h" +ColordGtk_1_0_gir_EXPORT_PACKAGES = colord-gtk +ColordGtk_1_0_gir_LIBS = libcolord-gtk.la +ColordGtk_1_0_gir_FILES = $(introspection_sources) +INTROSPECTION_GIRS += ColordGtk-1.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) + +if FALSE +if HAVE_VAPIGEN +colord-gtk.vapi: ColordGtk-1.0.gir + $(MAKE) $(AM_MAKEFLAGS) ColordGtk-1.0.gir + $(AM_V_GEN)$(VAPIGEN) $(VAPIGENFLAGS) \ + --library colord-gtk \ + --pkg gio-2.0 \ + ColordGtk-1.0.gir + touch $@ +vapidir = $(datadir)/vala/vapi +dist_vapi_DATA = \ + colord-gtk.vapi +CLEANFILES += $(dist_vapi_DATA) +endif +endif + +endif + +clean-local: + rm -f *~ + +-include $(top_srcdir)/git.mk diff --git a/libcolord-gtk/cd-sample-window.c b/libcolord-gtk/cd-sample-window.c new file mode 100644 index 0000000..81f9667 --- /dev/null +++ b/libcolord-gtk/cd-sample-window.c @@ -0,0 +1,274 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2009-2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include <glib-object.h> + +#include <colord.h> + +#include "cd-sample-window.h" + +static void cd_sample_window_finalize (GObject *object); + +#define CD_SAMPLE_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CD_TYPE_SAMPLE_WINDOW, CdSampleWindowPrivate)) +#define CD_SAMPLE_WINDOW_PULSE_DELAY 80 /* ms */ + +/** + * CdSampleWindowPrivate: + * + * Private #CdSampleWindow data + **/ +struct _CdSampleWindowPrivate +{ + GtkWidget *image; + GtkWidget *progress_bar; + guint pulse_id; +}; + +G_DEFINE_TYPE (CdSampleWindow, cd_sample_window, GTK_TYPE_WINDOW) + +/** + * cd_sample_window_pulse_cb: + **/ +static gboolean +cd_sample_window_pulse_cb (CdSampleWindow *sample_window) +{ + gtk_progress_bar_pulse (GTK_PROGRESS_BAR (sample_window->priv->progress_bar)); + return TRUE; +} + +/** + * cd_sample_window_set_fraction: + * @sample_window: a valid #CdSampleWindow instance + * @percentage: the fraction value to show, or -1 for pulsing. + * + * Sets the percentage value on the window. + **/ +void +cd_sample_window_set_fraction (CdSampleWindow *sample_window, + gdouble fraction) +{ + CdSampleWindowPrivate *priv = sample_window->priv; + + /* make pulse */ + if (fraction == -1) { + if (priv->pulse_id == 0) { + priv->pulse_id = g_timeout_add (CD_SAMPLE_WINDOW_PULSE_DELAY, + (GSourceFunc) cd_sample_window_pulse_cb, + sample_window); + } + return; + } + + /* no more pulsing */ + if (priv->pulse_id != 0) { + g_source_remove (priv->pulse_id); + priv->pulse_id = 0; + } + + /* set static value */ + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (sample_window->priv->progress_bar), fraction); +} + +/** + * cd_sample_window_set_color: + * @sample_window: a valid #CdSampleWindow instance + * @red: the red color value + * @green: the green color value + * @blue: the blue color value + * + * Sets the window to a specific color. + **/ +void +cd_sample_window_set_color (CdSampleWindow *sample_window, + const CdColorRGB *color) +{ + GdkPixbuf *pixbuf; + gint width; + gint height; + gint i; + guchar *data; + guchar *pixels; + GtkWindow *window = GTK_WINDOW (sample_window); + + /* get the window size */ + gtk_window_get_size (window, &width, &height); + + /* if no pixbuf, create it */ + g_debug ("setting RGB: %f, %f, %f", color->R, color->G, color->B); + pixbuf = gtk_image_get_pixbuf (GTK_IMAGE (sample_window->priv->image)); + if (pixbuf == NULL) { + data = g_new0 (guchar, width * height * 3); + pixbuf = gdk_pixbuf_new_from_data (data, + GDK_COLORSPACE_RGB, + FALSE, + 8, + width, + height, + width * 3, + (GdkPixbufDestroyNotify) g_free, + NULL); + gtk_image_set_from_pixbuf (GTK_IMAGE (sample_window->priv->image), + pixbuf); + } + + /* get the pixbuf size */ + height = gdk_pixbuf_get_height (pixbuf); + width = gdk_pixbuf_get_width (pixbuf); + + /* set the pixel array */ + pixels = gdk_pixbuf_get_pixels (pixbuf); + for (i = 0; i < width * height * 3; i += 3) { + pixels[i+0] = (guchar) (color->R * 255.0f); + pixels[i+1] = (guchar) (color->G * 255.0f); + pixels[i+2] = (guchar) (color->B * 255.0f); + } + + /* force redraw */ + gtk_widget_set_visible (sample_window->priv->image, FALSE); + gtk_widget_set_visible (sample_window->priv->image, TRUE); +} + +/** + * cd_sample_window_class_init: + **/ +static void +cd_sample_window_class_init (CdSampleWindowClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = cd_sample_window_finalize; + g_type_class_add_private (klass, sizeof (CdSampleWindowPrivate)); +} + +/** + * cd_sample_window_enter_notify_cb: + **/ +static gboolean +cd_sample_window_enter_notify_cb (GtkWidget *widget, GdkEventCrossing *event, CdSampleWindow *sample_window) +{ + GdkCursor *cursor; + + /* hide cursor */ + cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_BLANK_CURSOR); + gdk_window_set_cursor (gtk_widget_get_window (widget), cursor); + g_object_unref (cursor); + + return FALSE; +} + +/** + * cd_sample_window_leave_notify_cb: + **/ +static gboolean +cd_sample_window_leave_notify_cb (GtkWidget *widget, GdkEventCrossing *event, + CdSampleWindow *sample_window) +{ + /* restore cursor */ + gdk_window_set_cursor (gtk_widget_get_window (widget), NULL); + return FALSE; +} + +static gboolean +cd_sample_window_visibility_notify_cb (GtkWidget *widget, GdkEventVisibility *event, + CdSampleWindow *sample_window) +{ + /* reshow it */ + gtk_window_present (GTK_WINDOW (widget)); + return TRUE; +} + +/** + * cd_sample_window_init: + **/ +static void +cd_sample_window_init (CdSampleWindow *sample_window) +{ + GtkWindow *window = GTK_WINDOW (sample_window); + GtkWidget *vbox; + sample_window->priv = CD_SAMPLE_WINDOW_GET_PRIVATE (sample_window); + sample_window->priv->image = gtk_image_new (); + sample_window->priv->progress_bar = gtk_progress_bar_new (); + + /* pack in two widgets into the window */ + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_container_add (GTK_CONTAINER (sample_window), vbox); + gtk_box_pack_start (GTK_BOX (vbox), sample_window->priv->image, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), sample_window->priv->progress_bar, FALSE, FALSE, 0); + gtk_widget_set_size_request (sample_window->priv->image, 400, 400); + gtk_widget_show_all (vbox); + + /* be clever and allow the colorimeter to do it's job */ + g_signal_connect (window, "enter-notify-event", + G_CALLBACK(cd_sample_window_enter_notify_cb), + sample_window); + g_signal_connect (window, "leave-notify-event", + G_CALLBACK(cd_sample_window_leave_notify_cb), + sample_window); + g_signal_connect (window, "visibility-notify-event", + G_CALLBACK(cd_sample_window_visibility_notify_cb), + sample_window); + + /* show on all virtual desktops */ + gtk_window_stick (window); +} + +/** + * cd_sample_window_finalize: + **/ +static void +cd_sample_window_finalize (GObject *object) +{ + CdSampleWindow *sample_window = CD_SAMPLE_WINDOW (object); + CdSampleWindowPrivate *priv = sample_window->priv; + + if (priv->pulse_id != 0) + g_source_remove (priv->pulse_id); + + G_OBJECT_CLASS (cd_sample_window_parent_class)->finalize (object); +} + +/** + * cd_sample_window_new: + * + * Return value: a new #CdSampleWindow object. + **/ +GtkWindow * +cd_sample_window_new (void) +{ + CdSampleWindow *sample_window; + sample_window = g_object_new (CD_TYPE_SAMPLE_WINDOW, + "accept-focus", FALSE, + "decorated", FALSE, + "default-height", 400, + "default-width", 400, + "deletable", FALSE, + "destroy-with-parent", TRUE, + "icon-name", "icc-profile", + "resizable", FALSE, + "skip-pager-hint", TRUE, + "skip-taskbar-hint", TRUE, + "title", "calibration square", + "type-hint", GDK_WINDOW_TYPE_HINT_SPLASHSCREEN, + "urgency-hint", TRUE, + NULL); + return GTK_WINDOW (sample_window); +} diff --git a/libcolord-gtk/cd-sample-window.h b/libcolord-gtk/cd-sample-window.h new file mode 100644 index 0000000..137a229 --- /dev/null +++ b/libcolord-gtk/cd-sample-window.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2010-2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __CD_SAMPLE_WINDOW_H +#define __CD_SAMPLE_WINDOW_H + +#include <glib-object.h> +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define CD_TYPE_SAMPLE_WINDOW (cd_sample_window_get_type ()) +#define CD_SAMPLE_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CD_TYPE_SAMPLE_WINDOW, CdSampleWindow)) +#define CD_IS_SAMPLE_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CD_TYPE_SAMPLE_WINDOW)) + +typedef struct _CdSampleWindowPrivate CdSampleWindowPrivate; +typedef struct _CdSampleWindow CdSampleWindow; +typedef struct _CdSampleWindowClass CdSampleWindowClass; + +struct _CdSampleWindow +{ + GtkWindow parent; + CdSampleWindowPrivate *priv; +}; + +struct _CdSampleWindowClass +{ + GtkWindowClass parent_class; +}; + +GType cd_sample_window_get_type (void); +GtkWindow *cd_sample_window_new (void); +void cd_sample_window_set_color (CdSampleWindow *sample_window, + const CdColorRGB *color); +void cd_sample_window_set_fraction (CdSampleWindow *sample_window, + gdouble fraction); + +G_END_DECLS + +#endif /* __CD_SAMPLE_WINDOW_H */ + diff --git a/libcolord-gtk/cd-self-test.c b/libcolord-gtk/cd-self-test.c new file mode 100644 index 0000000..4da81cb --- /dev/null +++ b/libcolord-gtk/cd-self-test.c @@ -0,0 +1,134 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2010-2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include <colord.h> +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +#include "cd-sample-window.h" +#include "cd-window.h" + +static void +cd_window_get_profile_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + CdWindow *window = CD_WINDOW (source); + GtkWidget *widget = GTK_WIDGET (user_data); + GError *error = NULL; + CdProfile *profile; + + profile = cd_window_get_profile_finish (window, + res, + &error); + g_assert_no_error (error); + g_assert (profile != NULL); + g_debug ("profile was %s", cd_profile_get_filename (profile)); + g_object_unref (profile); + + /* kill the dialog */ + gtk_widget_destroy (widget); +} + +static void +map_cb (GtkWidget *this_widget, gpointer user_data) +{ + CdWindow *window = CD_WINDOW (user_data); + + /* get the profile for this widget */ + cd_window_get_profile (window, + this_widget, + NULL, + cd_window_get_profile_cb, + this_widget); +} + +static void +colord_window_func (void) +{ + CdWindow *window; + GtkWidget *dialog; + + window = cd_window_new (); + dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "%s", "Hello world"); + g_signal_connect (dialog, "map", + G_CALLBACK (map_cb), + window); + gtk_dialog_run (GTK_DIALOG (dialog)); + g_object_unref (window); +} + +static gboolean +colord_sample_window_loop_cb (GMainLoop *loop) +{ + g_main_loop_quit (loop); + return FALSE; +} + +static void +colord_sample_window_func (void) +{ + GtkWindow *window; + GMainLoop *loop; + CdColorRGB source; + + window = cd_sample_window_new (); + g_assert (window != NULL); + source.R = 1.0f; + source.G = 1.0f; + source.B = 0.0f; + cd_sample_window_set_color (CD_SAMPLE_WINDOW (window), &source); + cd_sample_window_set_fraction (CD_SAMPLE_WINDOW (window), -1); + + /* move to the center of device lvds1 */ + gtk_window_present (window); + + loop = g_main_loop_new (NULL, FALSE); + g_timeout_add_seconds (2, (GSourceFunc) colord_sample_window_loop_cb, loop); + g_main_loop_run (loop); + + g_main_loop_unref (loop); + gtk_widget_destroy (GTK_WIDGET (window)); +} + +int +main (int argc, char **argv) +{ + g_type_init (); + g_test_init (&argc, &argv, NULL); + gtk_init (&argc, &argv); + + /* only critical and error are fatal */ + g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); + + /* tests go here */ + g_test_add_func ("/colord/window", colord_window_func); + g_test_add_func ("/colors/sample-window", colord_sample_window_func); + return g_test_run (); +} + diff --git a/libcolord-gtk/cd-version.h.in b/libcolord-gtk/cd-version.h.in new file mode 100644 index 0000000..5ad7569 --- /dev/null +++ b/libcolord-gtk/cd-version.h.in @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * SECTION:cd-version + * @short_description: Obtains the version for the installed colord + * + * These compile time macros allow the user to enable parts of client code + * depending on the version of libcolord installed. + * + * See also: #CdClient, #CdDevice + */ + +#if !defined (__COLORD_H_INSIDE__) && !defined (CD_COMPILATION) +#error "Only <colord.h> can be included directly." +#endif + +#ifndef __CD_VERSION_H +#define __CD_VERSION_H + +/** + * CD_GTK_MAJOR_VERSION: + * + * The compile-time major version + */ +#define CD_GTK_MAJOR_VERSION (@CD_GTK_MAJOR_VERSION@) + +/** + * CD_GTK_MINOR_VERSION: + * + * The compile-time minor version + */ +#define CD_GTK_MINOR_VERSION (@CD_GTK_MINOR_VERSION@) + +/** + * CD_GTK_MICRO_VERSION: + * + * The compile-time micro version + */ +#define CD_GTK_MICRO_VERSION (@CD_GTK_MICRO_VERSION@) + +/** + * CD_CHECK_VERSION: + * + * Check whether a colord version equal to or greater than + * major.minor.micro. + */ +#define CD_CHECK_VERSION(major,minor,micro) \ + (CD_GTK_MAJOR_VERSION > (major) || \ + (CD_GTK_MAJOR_VERSION == (major) && CD_GTK_MINOR_VERSION > (minor)) || \ + (CD_GTK_MAJOR_VERSION == (major) && CD_GTK_MINOR_VERSION == (minor) && \ + CD_GTK_MICRO_VERSION >= (micro))) + +#endif /* __CD_VERSION_H */ diff --git a/libcolord-gtk/cd-window-sync.c b/libcolord-gtk/cd-window-sync.c new file mode 100644 index 0000000..6692172 --- /dev/null +++ b/libcolord-gtk/cd-window-sync.c @@ -0,0 +1,102 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * SECTION:cd-window-sync + * @short_description: Sync helpers for #CdWindow + * + * These helper functions provide a simple way to use the async functions + * in command line tools. + * + * See also: #CdWindow + */ + +#include "config.h" + +#include <glib.h> +#include <gio/gio.h> + +#include <colord.h> + +#include "cd-window.h" +#include "cd-window-sync.h" + +/* tiny helper to help us do the async operation */ +typedef struct { + GError **error; + GMainLoop *loop; + CdProfile *profile; + CdWindow *window; +} CdWindowHelper; + +/**********************************************************************/ + +static void +cd_window_get_profile_finish_sync (CdWindow *window, + GAsyncResult *res, + CdWindowHelper *helper) +{ + helper->profile = cd_window_get_profile_finish (window, + res, + helper->error); + g_main_loop_quit (helper->loop); +} + +/** + * cd_window_get_profile_sync: + * @window: a #CdWindow instance. + * @widget: a #GtkWidget + * @cancellable: a #GCancellable or %NULL + * @error: a #GError, or %NULL. + * + * Gets the screen profile that should be used for the widget, + * which corresponds to the screen output the widget most covers. + * + * WARNING: This function is synchronous, and may block. + * Do not use it in GUI applications. + * + * Return value: (transfer full): a #CdProfile or %NULL + * + * Since: 0.1.20 + **/ +CdProfile * +cd_window_get_profile_sync (CdWindow *window, + GtkWidget *widget, + GCancellable *cancellable, + GError **error) +{ + CdWindowHelper helper; + + /* create temp object */ + helper.loop = g_main_loop_new (NULL, FALSE); + helper.error = error; + + /* run async method */ + cd_window_get_profile (window, widget, cancellable, + (GAsyncReadyCallback) cd_window_get_profile_finish_sync, + &helper); + g_main_loop_run (helper.loop); + + /* free temp object */ + g_main_loop_unref (helper.loop); + + return helper.profile; +} diff --git a/libcolord-gtk/cd-window-sync.h b/libcolord-gtk/cd-window-sync.h new file mode 100644 index 0000000..6afe83b --- /dev/null +++ b/libcolord-gtk/cd-window-sync.h @@ -0,0 +1,41 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if !defined (__COLORD_H_INSIDE__) && !defined (CD_COMPILATION) +#error "Only <colord.h> can be included directly." +#endif + +#ifndef __CD_WINDOW_SYNC_H +#define __CD_WINDOW_SYNC_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +CdProfile *cd_window_get_profile_sync (CdWindow *window, + GtkWidget *widget, + GCancellable *cancellable, + GError **error); + +G_END_DECLS + +#endif /* __CD_WINDOW_SYNC_H */ + diff --git a/libcolord-gtk/cd-window.c b/libcolord-gtk/cd-window.c new file mode 100644 index 0000000..b26835d --- /dev/null +++ b/libcolord-gtk/cd-window.c @@ -0,0 +1,578 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * SECTION:cd-window + * @short_description: Additional helper classes for working with GTK + * + * These functions are useful when GTK is being used alongside colord and + * are just provided for convenience. + * + * See also: #CdDevice + */ + +#include "config.h" + +#include <gio/gio.h> +#include <glib.h> +#include <gtk/gtk.h> +#include <gdk/gdkx.h> + +#include <colord.h> + +#include "cd-window.h" + +static void cd_window_class_init (CdWindowClass *klass); +static void cd_window_init (CdWindow *window); +static void cd_window_finalize (GObject *object); + +#define CD_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CD_TYPE_WINDOW, CdWindowPrivate)) + +/** + * CdWindowPrivate: + * + * Private #CdWindow data + **/ +struct _CdWindowPrivate +{ + CdClient *client; + CdDevice *device; + CdProfile *profile; + gchar *plug_name; + GtkWidget *widget; + guint device_changed_id; +}; + +enum { + SIGNAL_CHANGED, + SIGNAL_LAST +}; + +enum { + PROP_0, + PROP_PROFILE, + PROP_LAST +}; + +static guint signals [SIGNAL_LAST] = { 0 }; + +G_DEFINE_TYPE (CdWindow, cd_window, G_TYPE_OBJECT) + +/** + * cd_window_error_quark: + * + * Return value: An error quark. + * + * Since: 0.1.20 + **/ +GQuark +cd_window_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) { + quark = g_quark_from_static_string ("cd_window_error"); + } + return quark; +} + +/** + * cd_window_get_last_profile: + * @window: a #CdWindow instance. + * + * Gets the color profile to use for this widget. + * + * Return value: (transfer none): a #CdProfile + * + * Since: 0.1.20 + **/ +CdProfile * +cd_window_get_last_profile (CdWindow *window) +{ + g_return_val_if_fail (CD_IS_WINDOW (window), NULL); + return window->priv->profile; +} + +typedef struct { + CdWindow *window; + GCancellable *cancellable; + GSimpleAsyncResult *res; +} CdWindowSetWidgetHelper; + +/** + * cd_window_get_profile_finish: + * @window: a #CdWindow instance. + * @res: the #GAsyncResult + * @error: A #GError or %NULL + * + * Gets the result from the asynchronous function. + * + * Return value: (transfer full): a #CdProfile or %NULL + * + * Since: 0.1.20 + **/ +CdProfile * +cd_window_get_profile_finish (CdWindow *window, + GAsyncResult *res, + GError **error) +{ + GSimpleAsyncResult *simple; + + g_return_val_if_fail (CD_IS_WINDOW (window), NULL); + g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (res), NULL); + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + simple = G_SIMPLE_ASYNC_RESULT (res); + if (g_simple_async_result_propagate_error (simple, error)) + return NULL; + + return g_object_ref (g_simple_async_result_get_op_res_gpointer (simple)); +} + +static void +cd_window_import_free_helper (CdWindowSetWidgetHelper *helper) +{ + if (helper->cancellable != NULL) + g_object_unref (helper->cancellable); + g_object_unref (helper->window); + g_object_unref (helper->res); + g_free (helper); +} + +static void cd_window_get_profile_new_data (CdWindowSetWidgetHelper *helper); + +static void +cd_window_get_profile_client_connect_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + CdClient *client = CD_CLIENT (source); + CdWindowSetWidgetHelper *helper = (CdWindowSetWidgetHelper *) user_data; + gboolean ret; + GError *error = NULL; + + ret = cd_client_connect_finish (client, res, &error); + if (!ret) { + g_simple_async_result_set_error (helper->res, + CD_WINDOW_ERROR, + CD_WINDOW_ERROR_FAILED, + "failed to connect to colord: %s", + error->message); + g_simple_async_result_complete_in_idle (helper->res); + cd_window_import_free_helper (helper); + g_error_free (error); + return; + } + cd_window_get_profile_new_data (helper); +} + +static void +cd_window_get_profile_device_connect_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + CdDevice *device = CD_DEVICE (source); + CdWindowSetWidgetHelper *helper = (CdWindowSetWidgetHelper *) user_data; + CdWindowPrivate *priv = helper->window->priv; + gboolean ret; + GError *error = NULL; + + ret = cd_device_connect_finish (device, res, &error); + if (!ret) { + g_simple_async_result_set_error (helper->res, + CD_WINDOW_ERROR, + CD_WINDOW_ERROR_FAILED, + "failed to connect to device: %s", + error->message); + g_simple_async_result_complete_in_idle (helper->res); + cd_window_import_free_helper (helper); + g_error_free (error); + return; + } + + /* get the default profile for the device */ + priv->profile = cd_device_get_default_profile (priv->device); + if (priv->profile == NULL) { + g_simple_async_result_set_error (helper->res, + CD_WINDOW_ERROR, + CD_WINDOW_ERROR_FAILED, + "no default profile for device: %s", + priv->plug_name); + g_simple_async_result_complete_in_idle (helper->res); + cd_window_import_free_helper (helper); + return; + } + + cd_window_get_profile_new_data (helper); +} + +static void +cd_window_get_profile_profile_connect_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + CdProfile *profile = CD_PROFILE (source); + CdWindowSetWidgetHelper *helper = (CdWindowSetWidgetHelper *) user_data; + CdWindowPrivate *priv = helper->window->priv; + const gchar *filename; + gboolean ret; + GError *error = NULL; + + ret = cd_profile_connect_finish (profile, res, &error); + if (!ret) { + g_simple_async_result_set_error (helper->res, + CD_WINDOW_ERROR, + CD_WINDOW_ERROR_FAILED, + "failed to connect to profile: %s", + error->message); + g_simple_async_result_complete_in_idle (helper->res); + cd_window_import_free_helper (helper); + g_error_free (error); + return; + } + + /* get the filename of the profile */ + filename = cd_profile_get_filename (priv->profile); + if (filename == NULL) { + g_simple_async_result_set_error (helper->res, + CD_WINDOW_ERROR, + CD_WINDOW_ERROR_FAILED, + "profile has no physical file, must be virtual"); + g_simple_async_result_complete_in_idle (helper->res); + cd_window_import_free_helper (helper); + return; + } + + /* SUCCESS! */ + g_simple_async_result_set_op_res_gpointer (helper->res, + g_object_ref (priv->profile), + (GDestroyNotify) g_object_unref); + g_simple_async_result_complete_in_idle (helper->res); + cd_window_import_free_helper (helper); +} + +static void +cd_window_get_profile_device_find_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + CdClient *client = CD_CLIENT (source); + CdWindowSetWidgetHelper *helper = (CdWindowSetWidgetHelper *) user_data; + CdWindowPrivate *priv = helper->window->priv; + GError *error = NULL; + + priv->device = cd_client_find_device_by_property_finish (client, + res, + &error); + if (priv->device == NULL) { + g_simple_async_result_set_error (helper->res, + CD_WINDOW_ERROR, + CD_WINDOW_ERROR_FAILED, + "no device with that property: %s", + error->message); + g_simple_async_result_complete_in_idle (helper->res); + cd_window_import_free_helper (helper); + g_error_free (error); + return; + } + cd_window_get_profile_new_data (helper); +} + +static void +cd_window_device_changed_cb (CdDevice *device, CdWindow *window) +{ + CdProfile *profile; + + /* no device set yet */ + if (window->priv->device == NULL) + return; + + /* the same device */ + if (!cd_device_equal (device, window->priv->device)) + return; + + /* get new default profile */ + profile = cd_device_get_default_profile (window->priv->device); + if (cd_profile_equal (profile, window->priv->profile)) + return; + + /* replace profile instance and emit if changed */ + if (window->priv->profile != NULL) + g_object_unref (window->priv->profile); + window->priv->profile = g_object_ref (profile); + g_signal_emit (window, signals[SIGNAL_CHANGED], 0, + window->priv->profile); +} + +static void +cd_window_get_profile_new_data (CdWindowSetWidgetHelper *helper) +{ + CdWindowPrivate *priv = helper->window->priv; + + /* connect to the daemon */ + if (priv->client == NULL) { + priv->client = cd_client_new (); + priv->device_changed_id = + g_signal_connect (priv->client, "device-changed", + G_CALLBACK (cd_window_device_changed_cb), + helper->window); + cd_client_connect (priv->client, + helper->cancellable, + cd_window_get_profile_client_connect_cb, + helper); + goto out; + } + + /* find the new device */ + if (priv->device == NULL && priv->plug_name != NULL) { + cd_client_find_device_by_property (priv->client, + CD_DEVICE_METADATA_XRANDR_NAME, + priv->plug_name, + helper->cancellable, + cd_window_get_profile_device_find_cb, + helper); + goto out; + } + + /* connect to the device */ + if (priv->device != NULL && !cd_device_get_connected (priv->device)) { + cd_device_connect (priv->device, + helper->cancellable, + cd_window_get_profile_device_connect_cb, + helper); + goto out; + } + + /* connect to the profile */ + if (priv->profile != NULL && !cd_profile_get_connected (priv->profile)) { + cd_profile_connect (priv->profile, + helper->cancellable, + cd_window_get_profile_profile_connect_cb, + helper); + goto out; + } +out: + return; +} + +static void +cd_window_update_widget_plug_name (CdWindow *window, + GtkWidget *widget) +{ + CdWindowPrivate *priv = window->priv; + const gchar *plug_name; + GdkScreen *screen; + GdkWindow *gdk_window; + gint monitor_num; + + /* use the largest bounding area */ + gdk_window = gtk_widget_get_window (widget); + screen = gdk_window_get_screen (gdk_window); + + monitor_num = gdk_screen_get_monitor_at_window (screen, + gdk_window); + plug_name = gdk_screen_get_monitor_plug_name (screen, monitor_num); + + /* ignoring MAP as plug_name has not changed */ + if (g_strcmp0 (plug_name, priv->plug_name) == 0) + return; + + /* refresh data */ + g_free (priv->plug_name); + priv->plug_name = g_strdup (plug_name); + if (priv->device != NULL) { + g_object_unref (priv->device); + priv->device = NULL; + } + if (priv->profile != NULL) { + g_object_unref (priv->profile); + priv->profile = NULL; + } +} + +/** + * cd_window_get_profile: + * @window: a #CdWindow instance. + * @widget: a #GtkWidget + * @cancellable: a #GCancellable or %NULL + * @callback: the function to run on completion + * @user_data: the data to pass to @callback + * + * Gets the screen profile that should be used for the widget, + * which corresponds to the screen output the widget most covers. + * + * This method should be called when the widget has mapped, i.e. + * g_signal_connect (dialog, "map", G_CALLBACK (map_cb), priv); + * + * Note, the returned profile from cd_client_get_profile_for_widget_finish() + * has already been connected to, as is ready to use. + * + * Since: 0.1.20 + **/ +void +cd_window_get_profile (CdWindow *window, + GtkWidget *widget, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + CdWindowSetWidgetHelper *helper; + + g_return_if_fail (CD_IS_WINDOW (window)); + g_return_if_fail (GTK_IS_WIDGET (widget)); + g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); + + helper = g_new0 (CdWindowSetWidgetHelper, 1); + helper->window = g_object_ref (window); + helper->res = g_simple_async_result_new (G_OBJECT (window), + callback, + user_data, + cd_window_get_profile); + if (cancellable != NULL) + helper->cancellable = g_object_ref (cancellable); + + /* intially set the plug name */ + window->priv->widget = g_object_ref (widget); + cd_window_update_widget_plug_name (window, widget); + cd_window_get_profile_new_data (helper); +} + +/**********************************************************************/ + +/* + * cd_window_get_property: + */ +static void +cd_window_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + CdWindow *window = CD_WINDOW (object); + + switch (prop_id) { + case PROP_PROFILE: + g_value_set_object (value, window->priv->profile); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/* + * cd_window_class_init: + */ +static void +cd_window_class_init (CdWindowClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = cd_window_get_property; + object_class->finalize = cd_window_finalize; + + /** + * CdWindow:profile: + * + * The window profile. + * + * Since: 0.1.20 + */ + g_object_class_install_property (object_class, + PROP_PROFILE, + g_param_spec_string ("Profile", + "Color profile", + NULL, + NULL, + G_PARAM_READABLE)); + + /** + * CdWindow::changed: + * @window: the #CdDevice instance that emitted the signal + * + * The ::changed signal is emitted when the device profile has + * changed. The #CdProfile that is referenced in the callback + * has not been connected to, and you will need to call + * cd_profile_connect() if the ICC filename is required. + * + * Since: 0.1.20 + **/ + signals [SIGNAL_CHANGED] = + g_signal_new ("changed", + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CdWindowClass, changed), + NULL, NULL, g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, CD_TYPE_PROFILE); + + g_type_class_add_private (klass, sizeof (CdWindowPrivate)); +} + +/* + * cd_window_init: + */ +static void +cd_window_init (CdWindow *window) +{ + window->priv = CD_WINDOW_GET_PRIVATE (window); + + /* ensure the remote errors are registered */ + cd_window_error_quark (); +} + +/* + * cd_window_finalize: + */ +static void +cd_window_finalize (GObject *object) +{ + CdWindow *window = CD_WINDOW (object); + + g_return_if_fail (CD_IS_WINDOW (object)); + + if (window->priv->client != NULL) { + g_signal_handler_disconnect (window->priv->client, + window->priv->device_changed_id); + g_object_unref (window->priv->client); + } + if (window->priv->device != NULL) + g_object_unref (window->priv->device); + if (window->priv->profile != NULL) + g_object_unref (window->priv->profile); + g_free (window->priv->plug_name); + + G_OBJECT_CLASS (cd_window_parent_class)->finalize (object); +} + +/** + * cd_window_new: + * + * Creates a new #CdWindow object. + * + * Return value: a new CdWindow object. + * + * Since: 0.1.20 + **/ +CdWindow * +cd_window_new (void) +{ + CdWindow *window; + window = g_object_new (CD_TYPE_WINDOW, NULL); + return CD_WINDOW (window); +} diff --git a/libcolord-gtk/cd-window.h b/libcolord-gtk/cd-window.h new file mode 100644 index 0000000..3b993a8 --- /dev/null +++ b/libcolord-gtk/cd-window.h @@ -0,0 +1,103 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if !defined (__COLORD_H_INSIDE__) && !defined (CD_COMPILATION) +#error "Only <colord-gtk.h> can be included directly." +#endif + +#ifndef __CD_WINDOW_H +#define __CD_WINDOW_H + +#include <glib-object.h> +#include <gio/gio.h> +#include <gtk/gtk.h> + +#include "cd-window.h" + +G_BEGIN_DECLS + +#define CD_TYPE_WINDOW (cd_window_get_type ()) +#define CD_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CD_TYPE_WINDOW, CdWindow)) +#define CD_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CD_TYPE_WINDOW, CdWindowClass)) +#define CD_IS_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CD_TYPE_WINDOW)) +#define CD_IS_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CD_TYPE_WINDOW)) +#define CD_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CD_TYPE_WINDOW, CdWindowClass)) +#define CD_WINDOW_ERROR (cd_window_error_quark ()) +#define CD_WINDOW_TYPE_ERROR (cd_window_error_get_type ()) + +typedef struct _CdWindowPrivate CdWindowPrivate; + +typedef struct +{ + GObject parent; + CdWindowPrivate *priv; +} CdWindow; + +typedef struct +{ + GObjectClass parent_class; + void (*changed) (CdWindow *window, + CdProfile *profile); + /*< private >*/ + /* Padding for future expansion */ + void (*_cd_window_reserved1) (void); + void (*_cd_window_reserved2) (void); + void (*_cd_window_reserved3) (void); + void (*_cd_window_reserved4) (void); + void (*_cd_window_reserved5) (void); + void (*_cd_window_reserved6) (void); + void (*_cd_window_reserved7) (void); + void (*_cd_window_reserved8) (void); +} CdWindowClass; + +/** + * CdWindowError: + * @CD_WINDOW_ERROR_FAILED: the transaction failed for an unknown reason + * + * Errors that can be thrown + */ +typedef enum +{ + CD_WINDOW_ERROR_FAILED, + CD_WINDOW_ERROR_LAST +} CdWindowError; + +GType cd_window_get_type (void); +GQuark cd_window_error_quark (void); +CdWindow *cd_window_new (void); + +/* async */ +void cd_window_get_profile (CdWindow *window, + GtkWidget *widget, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +CdProfile *cd_window_get_profile_finish (CdWindow *window, + GAsyncResult *res, + GError **error); + +/* getters */ +CdProfile *cd_window_get_last_profile (CdWindow *window); + +G_END_DECLS + +#endif /* __CD_WINDOW_H */ + diff --git a/libcolord-gtk/colord-gtk.h b/libcolord-gtk/colord-gtk.h new file mode 100644 index 0000000..658ec60 --- /dev/null +++ b/libcolord-gtk/colord-gtk.h @@ -0,0 +1,50 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2010-2011 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * SECTION:colord-gtk + * @short_description: Client objects for accessing colord with GTK + * + * These objects allow client programs to get access to profiles. + * + * See also: #CdClient, #CdDevice + */ + +#ifndef __COLORD_GTK_H__ +#define __COLORD_GTK_H__ + +#define __COLORD_H_INSIDE__ + +#include <gtk/gtk.h> + +#include <colord.h> +//#include <colord/cd-device.h> +//#include <colord/cd-profile.h> +//#include <colord/cd-color.h> +#include <colord-gtk/cd-sample-window.h> +#include <colord-gtk/cd-version.h> +#include <colord-gtk/cd-window.h> +#include <colord-gtk/cd-window-sync.h> + +#undef __COLORD_H_INSIDE__ + +#endif /* __COLORD_GTK_H__ */ + diff --git a/libcolord-gtk/colord-gtk.pc.in b/libcolord-gtk/colord-gtk.pc.in new file mode 100644 index 0000000..72e3eca --- /dev/null +++ b/libcolord-gtk/colord-gtk.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: colord-gtk +Description: colord-gtk is GTK integration for libcolord +Version: @VERSION@ +Requires: colord, gtk+-3.0 +Libs: -L${libdir} -lcolord-gtk +Cflags: -I${includedir}/colord-1 diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..0f4126c --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1 @@ +*.m4 diff --git a/m4/as-linguas.m4 b/m4/as-linguas.m4 new file mode 100644 index 0000000..92b28f7 --- /dev/null +++ b/m4/as-linguas.m4 @@ -0,0 +1,24 @@ +# Set ALL_ALL_LINGUAS based on the .po files present. Optional argument is the +# name of the po directory. $podir/LINGUAS.ignore can be used to ignore a +# subset of the po files. + +AC_DEFUN([AS_ALL_LINGUAS], +[ + AC_MSG_CHECKING([for linguas]) + podir="m4_default([$1],[$srcdir/po])" + linguas=`cd $podir && ls *.po 2>/dev/null | awk 'BEGIN { FS="."; ORS=" " } { print $[]1 }'` + if test -f "$podir/LINGUAS.ignore"; then + ALL_LINGUAS=""; + ignore_linguas=`sed -n -e 's/^\s\+\|\s\+$//g' -e '/^#/b' -e '/\S/!b' \ + -e 's/\s\+/\n/g' -e p "$podir/LINGUAS.ignore"`; + for lang in $linguas; do + if ! echo "$ignore_linguas" | grep -q "^${lang}$"; then + ALL_LINGUAS="$ALL_LINGUAS $lang"; + fi; + done; + else + ALL_LINGUAS="$linguas"; + fi; + AC_SUBST([ALL_LINGUAS]) + AC_MSG_RESULT($ALL_LINGUAS) +]) diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 0000000..7e78a29 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,10 @@ +*.gmo +*.header +.intltool-merge-cache +Makefile.in.in +Makevars.template +POTFILES +Rules-quot +*.sed +*.sin +stamp-it diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..5de969c --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1 @@ +client/cd-convert.c diff --git a/po/en_GB.po b/po/en_GB.po new file mode 100644 index 0000000..f5b74cc --- /dev/null +++ b/po/en_GB.po @@ -0,0 +1,24 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Richard Hughes <richard@hughsie.com>, 2012. +msgid "" +msgstr "" +"Project-Id-Version: colord\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-05-09 22:55+0100\n" +"PO-Revision-Date: 2012-05-09 21:57+0000\n" +"Last-Translator: Richard Hughes <richard@hughsie.com>\n" +"Language-Team: English (United Kingdom) (http://www.transifex.net/projects/p/freedesktop/language/en_GB/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en_GB\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#. TRANSLATORS: command line option +#: ../client/cd-convert.c:273 +msgid "Use this device for profiling" +msgstr "" |