diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-09-30 14:09:32 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-09-30 14:09:32 +0200 |
commit | 0537caaf4af94a9ead8b292679f6b34c90b55e06 (patch) | |
tree | 6761cfdf959926be7af3147cf770e7f253390fe8 /src/util | |
parent | eca5837e235a356c8db9416bbbc13577db3e6f76 (diff) | |
parent | 5e9f4eea451a77ba3b93db3747841ed2bd969e9f (diff) |
Update upstream source from tag 'upstream/0.30.1'
Update to upstream version '0.30.1'
with Debian dir dc242531effff8d9c6fab093414edee28b403c6a
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/KeyValueMap.c | 1143 | ||||
-rw-r--r-- | src/util/Util.c | 36 | ||||
-rw-r--r-- | src/util/file.c | 1733 | ||||
-rw-r--r-- | src/util/image.c | 2633 | ||||
-rw-r--r-- | src/util/image.vala | 121 | ||||
-rw-r--r-- | src/util/misc.c | 3020 | ||||
-rw-r--r-- | src/util/string.c | 2033 | ||||
-rw-r--r-- | src/util/system.c | 189 | ||||
-rw-r--r-- | src/util/system.vala | 30 | ||||
-rw-r--r-- | src/util/ui.c | 234 | ||||
-rw-r--r-- | src/util/ui.vala | 17 |
11 files changed, 44 insertions, 11145 deletions
diff --git a/src/util/KeyValueMap.c b/src/util/KeyValueMap.c deleted file mode 100644 index f1405c4..0000000 --- a/src/util/KeyValueMap.c +++ /dev/null @@ -1,1143 +0,0 @@ -/* KeyValueMap.c generated by valac 0.40.4, the Vala compiler - * generated from KeyValueMap.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ - - -#include <glib.h> -#include <glib-object.h> -#include <stdlib.h> -#include <string.h> -#include <gee.h> -#include <float.h> -#include <math.h> -#include <gdk/gdk.h> -#include <stdio.h> -#include <gobject/gvaluecollector.h> - - -#define TYPE_KEY_VALUE_MAP (key_value_map_get_type ()) -#define KEY_VALUE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_KEY_VALUE_MAP, KeyValueMap)) -#define KEY_VALUE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_KEY_VALUE_MAP, KeyValueMapClass)) -#define IS_KEY_VALUE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_KEY_VALUE_MAP)) -#define IS_KEY_VALUE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_KEY_VALUE_MAP)) -#define KEY_VALUE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_KEY_VALUE_MAP, KeyValueMapClass)) - -typedef struct _KeyValueMap KeyValueMap; -typedef struct _KeyValueMapClass KeyValueMapClass; -typedef struct _KeyValueMapPrivate KeyValueMapPrivate; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _key_value_map_unref0(var) ((var == NULL) ? NULL : (var = (key_value_map_unref (var), NULL))) -typedef struct _ParamSpecKeyValueMap ParamSpecKeyValueMap; -#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); -#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } -#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } -#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); - -struct _KeyValueMap { - GTypeInstance parent_instance; - volatile int ref_count; - KeyValueMapPrivate * priv; -}; - -struct _KeyValueMapClass { - GTypeClass parent_class; - void (*finalize) (KeyValueMap *self); -}; - -struct _KeyValueMapPrivate { - gchar* group; - GeeHashMap* map; -}; - -struct _ParamSpecKeyValueMap { - GParamSpec parent_instance; -}; - - -static gpointer key_value_map_parent_class = NULL; - -gpointer key_value_map_ref (gpointer instance); -void key_value_map_unref (gpointer instance); -GParamSpec* param_spec_key_value_map (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags); -void value_set_key_value_map (GValue* value, - gpointer v_object); -void value_take_key_value_map (GValue* value, - gpointer v_object); -gpointer value_get_key_value_map (const GValue* value); -GType key_value_map_get_type (void) G_GNUC_CONST; -#define KEY_VALUE_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_KEY_VALUE_MAP, KeyValueMapPrivate)) -KeyValueMap* key_value_map_new (const gchar* group); -KeyValueMap* key_value_map_construct (GType object_type, - const gchar* group); -KeyValueMap* key_value_map_copy (KeyValueMap* self); -gchar* key_value_map_get_group (KeyValueMap* self); -GeeSet* key_value_map_get_keys (KeyValueMap* self); -gboolean key_value_map_has_key (KeyValueMap* self, - const gchar* key); -void key_value_map_set_string (KeyValueMap* self, - const gchar* key, - const gchar* value); -void key_value_map_set_int (KeyValueMap* self, - const gchar* key, - gint value); -void key_value_map_set_double (KeyValueMap* self, - const gchar* key, - gdouble value); -void key_value_map_set_float (KeyValueMap* self, - const gchar* key, - gfloat value); -void key_value_map_set_bool (KeyValueMap* self, - const gchar* key, - gboolean value); -gchar* key_value_map_get_string (KeyValueMap* self, - const gchar* key, - const gchar* def); -gint key_value_map_get_int (KeyValueMap* self, - const gchar* key, - gint def); -gdouble key_value_map_get_double (KeyValueMap* self, - const gchar* key, - gdouble def); -gfloat key_value_map_get_float (KeyValueMap* self, - const gchar* key, - gfloat def); -gboolean key_value_map_get_bool (KeyValueMap* self, - const gchar* key, - gboolean def); -void key_value_map_get_point (KeyValueMap* self, - const gchar* key, - GdkPoint* def, - GdkPoint* result); -void key_value_map_set_point (KeyValueMap* self, - const gchar* key, - GdkPoint* point); -static void key_value_map_finalize (KeyValueMap * obj); - - -KeyValueMap* -key_value_map_construct (GType object_type, - const gchar* group) -{ - KeyValueMap* self = NULL; - gchar* _tmp0_; -#line 11 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - self = (KeyValueMap*) g_type_create_instance (object_type); -#line 12 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = g_strdup (group); -#line 12 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (self->priv->group); -#line 12 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - self->priv->group = _tmp0_; -#line 11 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return self; -#line 144 "KeyValueMap.c" -} - - -KeyValueMap* -key_value_map_new (const gchar* group) -{ -#line 11 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return key_value_map_construct (TYPE_KEY_VALUE_MAP, group); -#line 153 "KeyValueMap.c" -} - - -KeyValueMap* -key_value_map_copy (KeyValueMap* self) -{ - KeyValueMap* result = NULL; - KeyValueMap* clone = NULL; - const gchar* _tmp0_; - KeyValueMap* _tmp1_; -#line 16 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->group; -#line 16 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = key_value_map_new (_tmp0_); -#line 16 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - clone = _tmp1_; -#line 170 "KeyValueMap.c" - { - GeeIterator* _key_it = NULL; - GeeHashMap* _tmp2_; - GeeSet* _tmp3_; - GeeSet* _tmp4_; - GeeSet* _tmp5_; - GeeIterator* _tmp6_; - GeeIterator* _tmp7_; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = self->priv->map; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = gee_abstract_map_get_keys (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)); -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_ = _tmp3_; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp5_ = _tmp4_; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp6_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEE_TYPE_ITERABLE, GeeIterable)); -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp7_ = _tmp6_; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_object_unref0 (_tmp5_); -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _key_it = _tmp7_; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - while (TRUE) { -#line 197 "KeyValueMap.c" - GeeIterator* _tmp8_; - gchar* key = NULL; - GeeIterator* _tmp9_; - gpointer _tmp10_; - KeyValueMap* _tmp11_; - GeeHashMap* _tmp12_; - const gchar* _tmp13_; - GeeHashMap* _tmp14_; - const gchar* _tmp15_; - gpointer _tmp16_; - gchar* _tmp17_; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp8_ = _key_it; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (!gee_iterator_next (_tmp8_)) { -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - break; -#line 215 "KeyValueMap.c" - } -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp9_ = _key_it; -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp10_ = gee_iterator_get (_tmp9_); -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - key = (gchar*) _tmp10_; -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp11_ = clone; -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp12_ = _tmp11_->priv->map; -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp13_ = key; -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp14_ = self->priv->map; -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp15_ = key; -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp16_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp15_); -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp17_ = (gchar*) _tmp16_; -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp13_, _tmp17_); -#line 18 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (_tmp17_); -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (key); -#line 243 "KeyValueMap.c" - } -#line 17 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_object_unref0 (_key_it); -#line 247 "KeyValueMap.c" - } -#line 20 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = clone; -#line 20 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 253 "KeyValueMap.c" -} - - -gchar* -key_value_map_get_group (KeyValueMap* self) -{ - gchar* result = NULL; - const gchar* _tmp0_; - gchar* _tmp1_; -#line 24 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->group; -#line 24 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = g_strdup (_tmp0_); -#line 24 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = _tmp1_; -#line 24 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 271 "KeyValueMap.c" -} - - -GeeSet* -key_value_map_get_keys (KeyValueMap* self) -{ - GeeSet* result = NULL; - GeeHashMap* _tmp0_; - GeeSet* _tmp1_; - GeeSet* _tmp2_; -#line 28 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 28 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = gee_abstract_map_get_keys (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)); -#line 28 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = _tmp1_; -#line 28 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = _tmp2_; -#line 28 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 292 "KeyValueMap.c" -} - - -gboolean -key_value_map_has_key (KeyValueMap* self, - const gchar* key) -{ - gboolean result = FALSE; - GeeHashMap* _tmp0_; -#line 32 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 32 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = gee_abstract_map_has_key (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key); -#line 32 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 308 "KeyValueMap.c" -} - - -void -key_value_map_set_string (KeyValueMap* self, - const gchar* key, - const gchar* value) -{ - GeeHashMap* _tmp0_; -#line 36 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _vala_assert (key != NULL, "key != null"); -#line 38 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 38 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key, value); -#line 324 "KeyValueMap.c" -} - - -void -key_value_map_set_int (KeyValueMap* self, - const gchar* key, - gint value) -{ - GeeHashMap* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_; -#line 42 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _vala_assert (key != NULL, "key != null"); -#line 44 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 44 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = g_strdup_printf ("%i", value); -#line 44 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = _tmp1_; -#line 44 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key, _tmp2_); -#line 44 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (_tmp2_); -#line 348 "KeyValueMap.c" -} - - -static gchar* -double_to_string (gdouble self) -{ - gchar* result = NULL; - gchar* _tmp0_; - gchar* _tmp1_; - gint _tmp1__length1; - const gchar* _tmp2_; - gchar* _tmp3_; - gchar* _tmp4_; -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE); -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _tmp0_; -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE; -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = g_ascii_dtostr (_tmp1_, G_ASCII_DTOSTR_BUF_SIZE, self); -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp3_ = g_strdup (_tmp2_); -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp4_ = _tmp3_; -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = (g_free (_tmp1_), NULL); -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp4_; -#line 883 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 380 "KeyValueMap.c" -} - - -void -key_value_map_set_double (KeyValueMap* self, - const gchar* key, - gdouble value) -{ - GeeHashMap* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_; -#line 48 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _vala_assert (key != NULL, "key != null"); -#line 50 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 50 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = double_to_string (value); -#line 50 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = _tmp1_; -#line 50 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key, _tmp2_); -#line 50 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (_tmp2_); -#line 404 "KeyValueMap.c" -} - - -void -key_value_map_set_float (KeyValueMap* self, - const gchar* key, - gfloat value) -{ - GeeHashMap* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_; -#line 54 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _vala_assert (key != NULL, "key != null"); -#line 56 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 56 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = g_strdup_printf ("%g", value); -#line 56 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = _tmp1_; -#line 56 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key, _tmp2_); -#line 56 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (_tmp2_); -#line 428 "KeyValueMap.c" -} - - -static gchar* -bool_to_string (gboolean self) -{ - gchar* result = NULL; -#line 37 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (self) { -#line 438 "KeyValueMap.c" - gchar* _tmp0_; -#line 38 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_strdup ("true"); -#line 38 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp0_; -#line 38 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 446 "KeyValueMap.c" - } else { - gchar* _tmp1_; -#line 40 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = g_strdup ("false"); -#line 40 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp1_; -#line 40 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 455 "KeyValueMap.c" - } -} - - -void -key_value_map_set_bool (KeyValueMap* self, - const gchar* key, - gboolean value) -{ - GeeHashMap* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_; -#line 60 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _vala_assert (key != NULL, "key != null"); -#line 62 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 62 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = bool_to_string (value); -#line 62 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = _tmp1_; -#line 62 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key, _tmp2_); -#line 62 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (_tmp2_); -#line 480 "KeyValueMap.c" -} - - -gchar* -key_value_map_get_string (KeyValueMap* self, - const gchar* key, - const gchar* def) -{ - gchar* result = NULL; - gchar* value = NULL; - GeeHashMap* _tmp0_; - gpointer _tmp1_; - const gchar* _tmp2_ = NULL; - const gchar* _tmp3_; - gchar* _tmp5_; -#line 66 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 66 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key); -#line 66 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value = (gchar*) _tmp1_; -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = value; -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (_tmp3_ != NULL) { -#line 506 "KeyValueMap.c" - const gchar* _tmp4_; -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_ = value; -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = _tmp4_; -#line 512 "KeyValueMap.c" - } else { -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = def; -#line 516 "KeyValueMap.c" - } -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp5_ = g_strdup (_tmp2_); -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = _tmp5_; -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 68 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 526 "KeyValueMap.c" -} - - -gint -key_value_map_get_int (KeyValueMap* self, - const gchar* key, - gint def) -{ - gint result = 0; - gchar* value = NULL; - GeeHashMap* _tmp0_; - gpointer _tmp1_; - gint _tmp2_ = 0; - const gchar* _tmp3_; -#line 72 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 72 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key); -#line 72 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value = (gchar*) _tmp1_; -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = value; -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (_tmp3_ != NULL) { -#line 551 "KeyValueMap.c" - const gchar* _tmp4_; -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_ = value; -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = atoi (_tmp4_); -#line 557 "KeyValueMap.c" - } else { -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = def; -#line 561 "KeyValueMap.c" - } -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = _tmp2_; -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 74 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 569 "KeyValueMap.c" -} - - -static gdouble -double_parse (const gchar* str) -{ - gdouble result = 0.0; - gdouble _tmp0_; -#line 890 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_ascii_strtod (str, NULL); -#line 890 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp0_; -#line 890 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 584 "KeyValueMap.c" -} - - -gdouble -key_value_map_get_double (KeyValueMap* self, - const gchar* key, - gdouble def) -{ - gdouble result = 0.0; - gchar* value = NULL; - GeeHashMap* _tmp0_; - gpointer _tmp1_; - gdouble _tmp2_ = 0.0; - const gchar* _tmp3_; -#line 78 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 78 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key); -#line 78 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value = (gchar*) _tmp1_; -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = value; -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (_tmp3_ != NULL) { -#line 609 "KeyValueMap.c" - const gchar* _tmp4_; -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_ = value; -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = double_parse (_tmp4_); -#line 615 "KeyValueMap.c" - } else { -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = def; -#line 619 "KeyValueMap.c" - } -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = _tmp2_; -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 80 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 627 "KeyValueMap.c" -} - - -gfloat -key_value_map_get_float (KeyValueMap* self, - const gchar* key, - gfloat def) -{ - gfloat result = 0.0F; - gchar* value = NULL; - GeeHashMap* _tmp0_; - gpointer _tmp1_; - gfloat _tmp2_ = 0.0F; - const gchar* _tmp3_; -#line 84 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 84 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key); -#line 84 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value = (gchar*) _tmp1_; -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = value; -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (_tmp3_ != NULL) { -#line 652 "KeyValueMap.c" - const gchar* _tmp4_; -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_ = value; -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = (gfloat) double_parse (_tmp4_); -#line 658 "KeyValueMap.c" - } else { -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = def; -#line 662 "KeyValueMap.c" - } -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = _tmp2_; -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 86 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 670 "KeyValueMap.c" -} - - -static gboolean -bool_parse (const gchar* str) -{ - gboolean result = FALSE; -#line 45 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (g_strcmp0 (str, "true") == 0) { -#line 46 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = TRUE; -#line 46 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 684 "KeyValueMap.c" - } else { -#line 48 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = FALSE; -#line 48 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 690 "KeyValueMap.c" - } -} - - -gboolean -key_value_map_get_bool (KeyValueMap* self, - const gchar* key, - gboolean def) -{ - gboolean result = FALSE; - gchar* value = NULL; - GeeHashMap* _tmp0_; - gpointer _tmp1_; - gboolean _tmp2_ = FALSE; - const gchar* _tmp3_; -#line 90 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 90 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key); -#line 90 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value = (gchar*) _tmp1_; -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = value; -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (_tmp3_ != NULL) { -#line 716 "KeyValueMap.c" - const gchar* _tmp4_; -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_ = value; -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = bool_parse (_tmp4_); -#line 722 "KeyValueMap.c" - } else { -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = def; -#line 726 "KeyValueMap.c" - } -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - result = _tmp2_; -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 92 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return result; -#line 734 "KeyValueMap.c" -} - - -void -key_value_map_get_point (KeyValueMap* self, - const gchar* key, - GdkPoint* def, - GdkPoint* result) -{ - gchar* value = NULL; - GeeHashMap* _tmp0_; - gpointer _tmp1_; - const gchar* _tmp2_; -#line 101 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 101 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key); -#line 101 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value = (gchar*) _tmp1_; -#line 103 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = value; -#line 103 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (_tmp2_ == NULL) { -#line 758 "KeyValueMap.c" - GdkPoint _tmp3_; -#line 104 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = *def; -#line 104 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - *result = _tmp3_; -#line 104 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 104 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return; -#line 768 "KeyValueMap.c" - } else { - GdkPoint _result_ = {0}; - GdkPoint _tmp4_ = {0}; - const gchar* _tmp5_; -#line 106 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_.x = 0; -#line 106 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _result_ = _tmp4_; -#line 107 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp5_ = value; -#line 107 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (sscanf (_tmp5_, "(%d, %d)", &_result_.x, &_result_.y) == 2) { -#line 108 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - *result = _result_; -#line 108 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 108 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return; -#line 787 "KeyValueMap.c" - } else { - GdkPoint _tmp6_; -#line 110 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp6_ = *def; -#line 110 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - *result = _tmp6_; -#line 110 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 110 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return; -#line 798 "KeyValueMap.c" - } - } -#line 100 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (value); -#line 803 "KeyValueMap.c" -} - - -void -key_value_map_set_point (KeyValueMap* self, - const gchar* key, - GdkPoint* point) -{ - GeeHashMap* _tmp0_; - GdkPoint _tmp1_; - gint _tmp2_; - GdkPoint _tmp3_; - gint _tmp4_; - gchar* _tmp5_; - gchar* _tmp6_; -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = self->priv->map; -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp1_ = *point; -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp2_ = _tmp1_.x; -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp3_ = *point; -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp4_ = _tmp3_.y; -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp5_ = g_strdup_printf ("(%d, %d)", _tmp2_, _tmp4_); -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp6_ = _tmp5_; -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), key, _tmp6_); -#line 115 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (_tmp6_); -#line 837 "KeyValueMap.c" -} - - -static void -value_key_value_map_init (GValue* value) -{ -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value->data[0].v_pointer = NULL; -#line 846 "KeyValueMap.c" -} - - -static void -value_key_value_map_free_value (GValue* value) -{ -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (value->data[0].v_pointer) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - key_value_map_unref (value->data[0].v_pointer); -#line 857 "KeyValueMap.c" - } -} - - -static void -value_key_value_map_copy_value (const GValue* src_value, - GValue* dest_value) -{ -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (src_value->data[0].v_pointer) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - dest_value->data[0].v_pointer = key_value_map_ref (src_value->data[0].v_pointer); -#line 870 "KeyValueMap.c" - } else { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - dest_value->data[0].v_pointer = NULL; -#line 874 "KeyValueMap.c" - } -} - - -static gpointer -value_key_value_map_peek_pointer (const GValue* value) -{ -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return value->data[0].v_pointer; -#line 884 "KeyValueMap.c" -} - - -static gchar* -value_key_value_map_collect_value (GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (collect_values[0].v_pointer) { -#line 896 "KeyValueMap.c" - KeyValueMap * object; - object = collect_values[0].v_pointer; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (object->parent_instance.g_class == NULL) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); -#line 903 "KeyValueMap.c" - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); -#line 907 "KeyValueMap.c" - } -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value->data[0].v_pointer = key_value_map_ref (object); -#line 911 "KeyValueMap.c" - } else { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value->data[0].v_pointer = NULL; -#line 915 "KeyValueMap.c" - } -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return NULL; -#line 919 "KeyValueMap.c" -} - - -static gchar* -value_key_value_map_lcopy_value (const GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ - KeyValueMap ** object_p; - object_p = collect_values[0].v_pointer; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (!object_p) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); -#line 935 "KeyValueMap.c" - } -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (!value->data[0].v_pointer) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - *object_p = NULL; -#line 941 "KeyValueMap.c" - } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - *object_p = value->data[0].v_pointer; -#line 945 "KeyValueMap.c" - } else { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - *object_p = key_value_map_ref (value->data[0].v_pointer); -#line 949 "KeyValueMap.c" - } -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return NULL; -#line 953 "KeyValueMap.c" -} - - -GParamSpec* -param_spec_key_value_map (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags) -{ - ParamSpecKeyValueMap* spec; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_val_if_fail (g_type_is_a (object_type, TYPE_KEY_VALUE_MAP), NULL); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - G_PARAM_SPEC (spec)->value_type = object_type; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return G_PARAM_SPEC (spec); -#line 973 "KeyValueMap.c" -} - - -gpointer -value_get_key_value_map (const GValue* value) -{ -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_KEY_VALUE_MAP), NULL); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return value->data[0].v_pointer; -#line 984 "KeyValueMap.c" -} - - -void -value_set_key_value_map (GValue* value, - gpointer v_object) -{ - KeyValueMap * old; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_KEY_VALUE_MAP)); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - old = value->data[0].v_pointer; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (v_object) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_KEY_VALUE_MAP)); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value->data[0].v_pointer = v_object; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - key_value_map_ref (value->data[0].v_pointer); -#line 1007 "KeyValueMap.c" - } else { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value->data[0].v_pointer = NULL; -#line 1011 "KeyValueMap.c" - } -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (old) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - key_value_map_unref (old); -#line 1017 "KeyValueMap.c" - } -} - - -void -value_take_key_value_map (GValue* value, - gpointer v_object) -{ - KeyValueMap * old; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_KEY_VALUE_MAP)); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - old = value->data[0].v_pointer; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (v_object) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_KEY_VALUE_MAP)); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value->data[0].v_pointer = v_object; -#line 1039 "KeyValueMap.c" - } else { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - value->data[0].v_pointer = NULL; -#line 1043 "KeyValueMap.c" - } -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (old) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - key_value_map_unref (old); -#line 1049 "KeyValueMap.c" - } -} - - -static void -key_value_map_class_init (KeyValueMapClass * klass) -{ -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - key_value_map_parent_class = g_type_class_peek_parent (klass); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - ((KeyValueMapClass *) klass)->finalize = key_value_map_finalize; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_type_class_add_private (klass, sizeof (KeyValueMapPrivate)); -#line 1063 "KeyValueMap.c" -} - - -static void -key_value_map_instance_init (KeyValueMap * self) -{ - GeeHashMap* _tmp0_; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - self->priv = KEY_VALUE_MAP_GET_PRIVATE (self); -#line 9 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -#line 9 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - self->priv->map = _tmp0_; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - self->ref_count = 1; -#line 1079 "KeyValueMap.c" -} - - -static void -key_value_map_finalize (KeyValueMap * obj) -{ - KeyValueMap * self; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_KEY_VALUE_MAP, KeyValueMap); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_signal_handlers_destroy (self); -#line 8 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_free0 (self->priv->group); -#line 9 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - _g_object_unref0 (self->priv->map); -#line 1095 "KeyValueMap.c" -} - - -GType -key_value_map_get_type (void) -{ - static volatile gsize key_value_map_type_id__volatile = 0; - if (g_once_init_enter (&key_value_map_type_id__volatile)) { - static const GTypeValueTable g_define_type_value_table = { value_key_value_map_init, value_key_value_map_free_value, value_key_value_map_copy_value, value_key_value_map_peek_pointer, "p", value_key_value_map_collect_value, "p", value_key_value_map_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (KeyValueMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) key_value_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KeyValueMap), 0, (GInstanceInitFunc) key_value_map_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - GType key_value_map_type_id; - key_value_map_type_id = g_type_register_fundamental (g_type_fundamental_next (), "KeyValueMap", &g_define_type_info, &g_define_type_fundamental_info, 0); - g_once_init_leave (&key_value_map_type_id__volatile, key_value_map_type_id); - } - return key_value_map_type_id__volatile; -} - - -gpointer -key_value_map_ref (gpointer instance) -{ - KeyValueMap * self; - self = instance; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_atomic_int_inc (&self->ref_count); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - return instance; -#line 1124 "KeyValueMap.c" -} - - -void -key_value_map_unref (gpointer instance) -{ - KeyValueMap * self; - self = instance; -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - if (g_atomic_int_dec_and_test (&self->ref_count)) { -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - KEY_VALUE_MAP_GET_CLASS (self)->finalize (self); -#line 7 "/home/jens/Source/shotwell/src/util/KeyValueMap.vala" - g_type_free_instance ((GTypeInstance *) self); -#line 1139 "KeyValueMap.c" - } -} - - - diff --git a/src/util/Util.c b/src/util/Util.c deleted file mode 100644 index 3a44398..0000000 --- a/src/util/Util.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Util.c generated by valac 0.40.4, the Vala compiler - * generated from Util.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ - - -#include <glib.h> -#include <glib-object.h> -#include <stdlib.h> -#include <string.h> - - - - -#define UTIL_FILE_ATTRIBUTES "standard::*,time::*,id::file,id::filesystem,etag::value" -void util_init (GError** error); -void util_terminate (void); - - -void -util_init (GError** error) -{ -} - - -void -util_terminate (void) -{ -} - - - diff --git a/src/util/file.c b/src/util/file.c deleted file mode 100644 index ccb75a9..0000000 --- a/src/util/file.c +++ /dev/null @@ -1,1733 +0,0 @@ -/* file.c generated by valac 0.40.4, the Vala compiler - * generated from file.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ -/* Returns true if the file is claimed, false if it exists, and throws an Error otherwise. The file*/ -/* will be created when the function exits and should be overwritten. Note that the file is not*/ -/* held open; claiming a file is merely based on its existence.*/ -/**/ -/* This function is thread-safe.*/ - - -#include <glib.h> -#include <glib-object.h> -#include <gio/gio.h> -#include <stdlib.h> -#include <string.h> -#include <gee.h> -#include <time.h> - -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -typedef gboolean (*ProgressMonitor) (guint64 current, guint64 total, gboolean do_event_loop, void* user_data); - - -gboolean claim_file (GFile* file, - GError** error); -GFile* generate_unique_file (GFile* dir, - const gchar* basename, - gboolean* collision, - GError** error); -void disassemble_filename (const gchar* basename, - gchar* * name, - gchar* * ext); -glong find_last_offset (const gchar* str, - gchar c); -guint64 query_total_file_size (GFile* file_or_dir, - GCancellable* cancellable, - GError** error); -void delete_all_files (GFile* dir, - GeeSet* exceptions, - ProgressMonitor monitor, - void* monitor_target, - guint64 file_count, - GCancellable* cancellable, - GError** error); -time_t query_file_modified (GFile* file, - GError** error); -gboolean query_is_directory (GFile* file); -gboolean query_is_directory_empty (GFile* dir, - GError** error); -gchar* get_display_pathname (GFile* file); -gchar* strip_pretty_path (const gchar* path); -gchar* get_file_info_id (GFileInfo* info); -void skip_uint64 (GInputStream* input, - guint64 skip_amount, - GError** error); -guint64 count_files_in_directory (GFile* dir, - GError** error); -gboolean file_equal (GFile* a, - GFile* b); -guint file_hash (GFile* file); - - -static gpointer -_g_error_copy0 (gpointer self) -{ -#line 23 "/home/jens/Source/shotwell/src/util/file.vala" - return self ? g_error_copy (self) : NULL; -#line 76 "file.c" -} - - -gboolean -claim_file (GFile* file, - GError** error) -{ - gboolean result = FALSE; - gboolean _tmp9_ = FALSE; - GError * _inner_error_ = NULL; -#line 12 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (file), FALSE); -#line 89 "file.c" - { - GFileOutputStream* _tmp0_; - GFileOutputStream* _tmp1_; -#line 14 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_create (file, G_FILE_CREATE_NONE, NULL, &_inner_error_); -#line 14 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = _tmp0_; -#line 14 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp1_); -#line 14 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 101 "file.c" - goto __catch0_g_error; - } -#line 17 "/home/jens/Source/shotwell/src/util/file.vala" - result = TRUE; -#line 17 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 108 "file.c" - } - goto __finally0; - __catch0_g_error: - { - GError* err = NULL; - GError* _tmp2_; -#line 13 "/home/jens/Source/shotwell/src/util/file.vala" - err = _inner_error_; -#line 13 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = NULL; -#line 20 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = err; -#line 20 "/home/jens/Source/shotwell/src/util/file.vala" - if (!g_error_matches (_tmp2_, G_IO_ERROR, G_IO_ERROR_EXISTS)) { -#line 123 "file.c" - gchar* _tmp3_; - gchar* _tmp4_; - GError* _tmp5_; - const gchar* _tmp6_; - GError* _tmp7_; - GError* _tmp8_; -#line 21 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = g_file_get_path (file); -#line 21 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = _tmp3_; -#line 21 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = err; -#line 21 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp6_ = _tmp5_->message; -#line 21 "/home/jens/Source/shotwell/src/util/file.vala" - g_warning ("file.vala:21: claim_file %s: %s", _tmp4_, _tmp6_); -#line 21 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp4_); -#line 23 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp7_ = err; -#line 23 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = _g_error_copy0 (_tmp7_); -#line 23 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = _tmp8_; -#line 23 "/home/jens/Source/shotwell/src/util/file.vala" - _g_error_free0 (err); -#line 150 "file.c" - goto __finally0; - } -#line 26 "/home/jens/Source/shotwell/src/util/file.vala" - result = FALSE; -#line 26 "/home/jens/Source/shotwell/src/util/file.vala" - _g_error_free0 (err); -#line 26 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 159 "file.c" - } - __finally0: -#line 13 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 13 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp9_; -#line 166 "file.c" -} - - -GFile* -generate_unique_file (GFile* dir, - const gchar* basename, - gboolean* collision, - GError** error) -{ - gboolean _vala_collision = FALSE; - GFile* result = NULL; - GFile* file = NULL; - GFile* _tmp0_; - gboolean _tmp1_ = FALSE; - GFile* _tmp2_; - gchar* name = NULL; - gchar* ext = NULL; - gchar* _tmp3_ = NULL; - gchar* _tmp4_ = NULL; - gchar* _tmp22_; - gchar* _tmp23_; - GError * _inner_error_ = NULL; -#line 36 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (dir), NULL); -#line 36 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (basename != NULL, NULL); -#line 38 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_get_child (dir, basename); -#line 38 "/home/jens/Source/shotwell/src/util/file.vala" - file = _tmp0_; -#line 39 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = file; -#line 39 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = claim_file (_tmp2_, &_inner_error_); -#line 39 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 39 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 39 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (file); -#line 39 "/home/jens/Source/shotwell/src/util/file.vala" - return NULL; -#line 209 "file.c" - } -#line 39 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp1_) { -#line 40 "/home/jens/Source/shotwell/src/util/file.vala" - _vala_collision = FALSE; -#line 42 "/home/jens/Source/shotwell/src/util/file.vala" - result = file; -#line 42 "/home/jens/Source/shotwell/src/util/file.vala" - if (collision) { -#line 42 "/home/jens/Source/shotwell/src/util/file.vala" - *collision = _vala_collision; -#line 221 "file.c" - } -#line 42 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 225 "file.c" - } -#line 46 "/home/jens/Source/shotwell/src/util/file.vala" - _vala_collision = TRUE; -#line 49 "/home/jens/Source/shotwell/src/util/file.vala" - disassemble_filename (basename, &_tmp3_, &_tmp4_); -#line 49 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (name); -#line 49 "/home/jens/Source/shotwell/src/util/file.vala" - name = _tmp3_; -#line 49 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (ext); -#line 49 "/home/jens/Source/shotwell/src/util/file.vala" - ext = _tmp4_; -#line 239 "file.c" - { - gint ctr = 0; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - ctr = 1; -#line 244 "file.c" - { - gboolean _tmp5_ = FALSE; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = TRUE; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - while (TRUE) { -#line 251 "file.c" - gint _tmp7_; - gchar* _tmp8_ = NULL; - const gchar* _tmp9_; - gchar* new_name = NULL; - gchar* _tmp17_; - const gchar* _tmp18_; - GFile* _tmp19_; - gboolean _tmp20_ = FALSE; - GFile* _tmp21_; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - if (!_tmp5_) { -#line 263 "file.c" - gint _tmp6_; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp6_ = ctr; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - ctr = _tmp6_ + 1; -#line 269 "file.c" - } -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = FALSE; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp7_ = ctr; -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - if (!(_tmp7_ < G_MAXINT)) { -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - break; -#line 279 "file.c" - } -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp9_ = ext; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp9_ != NULL) { -#line 285 "file.c" - const gchar* _tmp10_; - gint _tmp11_; - const gchar* _tmp12_; - gchar* _tmp13_; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp10_ = name; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp11_ = ctr; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp12_ = ext; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp13_ = g_strdup_printf ("%s_%d.%s", _tmp10_, _tmp11_, _tmp12_); -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp8_); -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = _tmp13_; -#line 302 "file.c" - } else { - const gchar* _tmp14_; - gint _tmp15_; - gchar* _tmp16_; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp14_ = name; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp15_ = ctr; -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp16_ = g_strdup_printf ("%s_%d", _tmp14_, _tmp15_); -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp8_); -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = _tmp16_; -#line 317 "file.c" - } -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp17_ = g_strdup (_tmp8_); -#line 53 "/home/jens/Source/shotwell/src/util/file.vala" - new_name = _tmp17_; -#line 55 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp18_ = new_name; -#line 55 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp19_ = g_file_get_child (dir, _tmp18_); -#line 55 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (file); -#line 55 "/home/jens/Source/shotwell/src/util/file.vala" - file = _tmp19_; -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp21_ = file; -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp20_ = claim_file (_tmp21_, &_inner_error_); -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (new_name); -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp8_); -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (ext); -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (name); -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (file); -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - return NULL; -#line 351 "file.c" - } -#line 56 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp20_) { -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - result = file; -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (new_name); -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp8_); -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (ext); -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (name); -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - if (collision) { -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - *collision = _vala_collision; -#line 369 "file.c" - } -#line 57 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 373 "file.c" - } -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (new_name); -#line 52 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp8_); -#line 379 "file.c" - } - } - } -#line 60 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp22_ = g_file_get_path (dir); -#line 60 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp23_ = _tmp22_; -#line 60 "/home/jens/Source/shotwell/src/util/file.vala" - g_warning ("file.vala:60: generate_unique_filename %s for %s: unable to claim file", _tmp23_, basename); -#line 60 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp23_); -#line 62 "/home/jens/Source/shotwell/src/util/file.vala" - result = NULL; -#line 62 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (ext); -#line 62 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (name); -#line 62 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (file); -#line 62 "/home/jens/Source/shotwell/src/util/file.vala" - if (collision) { -#line 62 "/home/jens/Source/shotwell/src/util/file.vala" - *collision = _vala_collision; -#line 403 "file.c" - } -#line 62 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 407 "file.c" -} - - -static glong -string_strnlen (gchar* str, - glong maxlen) -{ - glong result = 0L; - gchar* end = NULL; - gchar* _tmp0_; - gchar* _tmp1_; -#line 1336 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = memchr (str, 0, (gsize) maxlen); -#line 1336 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - end = _tmp0_; -#line 1337 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = end; -#line 1337 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (_tmp1_ == NULL) { -#line 1338 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = maxlen; -#line 1338 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 431 "file.c" - } else { - gchar* _tmp2_; -#line 1340 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = end; -#line 1340 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = (glong) (_tmp2_ - str); -#line 1340 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 440 "file.c" - } -} - - -static gchar* -string_substring (const gchar* self, - glong offset, - glong len) -{ - gchar* result = NULL; - glong string_length = 0L; - gboolean _tmp0_ = FALSE; - glong _tmp6_; - gchar* _tmp7_; -#line 1347 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, NULL); -#line 1349 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (offset >= ((glong) 0)) { -#line 1349 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = len >= ((glong) 0); -#line 461 "file.c" - } else { -#line 1349 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = FALSE; -#line 465 "file.c" - } -#line 1349 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (_tmp0_) { -#line 1351 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - string_length = string_strnlen ((gchar*) self, offset + len); -#line 471 "file.c" - } else { - gint _tmp1_; - gint _tmp2_; -#line 1353 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = strlen (self); -#line 1353 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = _tmp1_; -#line 1353 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - string_length = (glong) _tmp2_; -#line 481 "file.c" - } -#line 1356 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (offset < ((glong) 0)) { -#line 485 "file.c" - glong _tmp3_; -#line 1357 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp3_ = string_length; -#line 1357 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - offset = _tmp3_ + offset; -#line 1358 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (offset >= ((glong) 0), NULL); -#line 493 "file.c" - } else { - glong _tmp4_; -#line 1360 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp4_ = string_length; -#line 1360 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (offset <= _tmp4_, NULL); -#line 500 "file.c" - } -#line 1362 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (len < ((glong) 0)) { -#line 504 "file.c" - glong _tmp5_; -#line 1363 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp5_ = string_length; -#line 1363 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - len = _tmp5_ - offset; -#line 510 "file.c" - } -#line 1365 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp6_ = string_length; -#line 1365 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail ((offset + len) <= _tmp6_, NULL); -#line 1366 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp7_ = g_strndup (((gchar*) self) + offset, (gsize) len); -#line 1366 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp7_; -#line 1366 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 522 "file.c" -} - - -void -disassemble_filename (const gchar* basename, - gchar* * name, - gchar* * ext) -{ - gchar* _vala_name = NULL; - gchar* _vala_ext = NULL; - glong offset = 0L; - glong _tmp0_; -#line 65 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_if_fail (basename != NULL); -#line 66 "/home/jens/Source/shotwell/src/util/file.vala" - offset = find_last_offset (basename, '.'); -#line 67 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = offset; -#line 67 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp0_ <= ((glong) 0)) { -#line 543 "file.c" - gchar* _tmp1_; -#line 68 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = g_strdup (basename); -#line 68 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_vala_name); -#line 68 "/home/jens/Source/shotwell/src/util/file.vala" - _vala_name = _tmp1_; -#line 69 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_vala_ext); -#line 69 "/home/jens/Source/shotwell/src/util/file.vala" - _vala_ext = NULL; -#line 555 "file.c" - } else { - glong _tmp2_; - gchar* _tmp3_; - glong _tmp4_; - gchar* _tmp5_; -#line 71 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = offset; -#line 71 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = string_substring (basename, (glong) 0, _tmp2_); -#line 71 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_vala_name); -#line 71 "/home/jens/Source/shotwell/src/util/file.vala" - _vala_name = _tmp3_; -#line 72 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = offset; -#line 72 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = string_substring (basename, _tmp4_ + 1, (glong) -1); -#line 72 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_vala_ext); -#line 72 "/home/jens/Source/shotwell/src/util/file.vala" - _vala_ext = _tmp5_; -#line 577 "file.c" - } -#line 65 "/home/jens/Source/shotwell/src/util/file.vala" - if (name) { -#line 65 "/home/jens/Source/shotwell/src/util/file.vala" - *name = _vala_name; -#line 583 "file.c" - } else { -#line 65 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_vala_name); -#line 587 "file.c" - } -#line 65 "/home/jens/Source/shotwell/src/util/file.vala" - if (ext) { -#line 65 "/home/jens/Source/shotwell/src/util/file.vala" - *ext = _vala_ext; -#line 593 "file.c" - } else { -#line 65 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_vala_ext); -#line 597 "file.c" - } -} - - -guint64 -query_total_file_size (GFile* file_or_dir, - GCancellable* cancellable, - GError** error) -{ - guint64 result = 0ULL; - GFileType type = 0; - GFileType _tmp0_; - GFileEnumerator* enumerator = NULL; - guint64 total_bytes = 0ULL; - GFileInfo* info = NULL; - GError * _inner_error_ = NULL; -#line 77 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (file_or_dir), 0ULL); -#line 77 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail ((cancellable == NULL) || G_IS_CANCELLABLE (cancellable), 0ULL); -#line 78 "/home/jens/Source/shotwell/src/util/file.vala" - type = g_file_query_file_type (file_or_dir, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL); -#line 79 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = type; -#line 79 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp0_ == G_FILE_TYPE_REGULAR) { -#line 624 "file.c" - GFileInfo* info = NULL; - GFileInfo* _tmp12_; -#line 80 "/home/jens/Source/shotwell/src/util/file.vala" - info = NULL; -#line 629 "file.c" - { - GFileInfo* _tmp1_ = NULL; - GFileInfo* _tmp2_; - GFileInfo* _tmp3_; -#line 82 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = g_file_query_info (file_or_dir, G_FILE_ATTRIBUTE_STANDARD_SIZE, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable, &_inner_error_); -#line 82 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = _tmp2_; -#line 82 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 640 "file.c" - goto __catch1_g_error; - } -#line 82 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = _tmp1_; -#line 82 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = NULL; -#line 82 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 82 "/home/jens/Source/shotwell/src/util/file.vala" - info = _tmp3_; -#line 81 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp1_); -#line 653 "file.c" - } - goto __finally1; - __catch1_g_error: - { - GError* err = NULL; - GError* _tmp4_; - gchar* _tmp7_; - gchar* _tmp8_; - GError* _tmp9_; - const gchar* _tmp10_; -#line 81 "/home/jens/Source/shotwell/src/util/file.vala" - err = _inner_error_; -#line 81 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = NULL; -#line 85 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = err; -#line 85 "/home/jens/Source/shotwell/src/util/file.vala" - if (g_error_matches (_tmp4_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { -#line 672 "file.c" - GError* _tmp5_; - GError* _tmp6_; -#line 86 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = err; -#line 86 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp6_ = _g_error_copy0 (_tmp5_); -#line 86 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = _tmp6_; -#line 86 "/home/jens/Source/shotwell/src/util/file.vala" - _g_error_free0 (err); -#line 683 "file.c" - goto __finally1; - } -#line 88 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp7_ = g_file_get_path (file_or_dir); -#line 88 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = _tmp7_; -#line 88 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp9_ = err; -#line 88 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp10_ = _tmp9_->message; -#line 88 "/home/jens/Source/shotwell/src/util/file.vala" - g_debug ("file.vala:88: Unable to query filesize for %s: %s", _tmp8_, _tmp10_); -#line 88 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp8_); -#line 90 "/home/jens/Source/shotwell/src/util/file.vala" - result = (guint64) 0; -#line 90 "/home/jens/Source/shotwell/src/util/file.vala" - _g_error_free0 (err); -#line 90 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 90 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 706 "file.c" - } - __finally1: -#line 81 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 711 "file.c" - guint64 _tmp11_ = 0ULL; -#line 81 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 81 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 81 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp11_; -#line 719 "file.c" - } -#line 93 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp12_ = info; -#line 93 "/home/jens/Source/shotwell/src/util/file.vala" - result = (guint64) g_file_info_get_size (_tmp12_); -#line 93 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 93 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 729 "file.c" - } else { - GFileType _tmp13_; -#line 94 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp13_ = type; -#line 94 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp13_ != G_FILE_TYPE_DIRECTORY) { -#line 95 "/home/jens/Source/shotwell/src/util/file.vala" - result = (guint64) 0; -#line 95 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 740 "file.c" - } - } - { - GFileEnumerator* _tmp14_ = NULL; - GFileEnumerator* _tmp15_; - GFileEnumerator* _tmp16_; - GFileEnumerator* _tmp17_; -#line 100 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp15_ = g_file_enumerate_children (file_or_dir, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable, &_inner_error_); -#line 100 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp14_ = _tmp15_; -#line 100 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 754 "file.c" - goto __catch2_g_error; - } -#line 100 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp16_ = _tmp14_; -#line 100 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp14_ = NULL; -#line 100 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 100 "/home/jens/Source/shotwell/src/util/file.vala" - enumerator = _tmp16_; -#line 102 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp17_ = enumerator; -#line 102 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp17_ == NULL) { -#line 103 "/home/jens/Source/shotwell/src/util/file.vala" - result = (guint64) 0; -#line 103 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp14_); -#line 103 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 103 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 777 "file.c" - } -#line 99 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp14_); -#line 781 "file.c" - } - goto __finally2; - __catch2_g_error: - { - GError* err = NULL; - gboolean _tmp18_ = FALSE; - GError* _tmp19_; - GError* _tmp21_; - GError* _tmp22_; -#line 99 "/home/jens/Source/shotwell/src/util/file.vala" - err = _inner_error_; -#line 99 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = NULL; -#line 106 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp19_ = err; -#line 106 "/home/jens/Source/shotwell/src/util/file.vala" - if (g_error_matches (_tmp19_, G_FILE_ERROR, G_FILE_ERROR_PERM)) { -#line 106 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp18_ = TRUE; -#line 801 "file.c" - } else { - GError* _tmp20_; -#line 106 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp20_ = err; -#line 106 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp18_ = g_error_matches (_tmp20_, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED); -#line 808 "file.c" - } -#line 106 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp18_) { -#line 107 "/home/jens/Source/shotwell/src/util/file.vala" - result = (guint64) 0; -#line 107 "/home/jens/Source/shotwell/src/util/file.vala" - _g_error_free0 (err); -#line 107 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 107 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 820 "file.c" - } -#line 109 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp21_ = err; -#line 109 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp22_ = _g_error_copy0 (_tmp21_); -#line 109 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = _tmp22_; -#line 109 "/home/jens/Source/shotwell/src/util/file.vala" - _g_error_free0 (err); -#line 830 "file.c" - goto __finally2; - } - __finally2: -#line 99 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 836 "file.c" - guint64 _tmp23_ = 0ULL; -#line 99 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 99 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 99 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp23_; -#line 844 "file.c" - } -#line 112 "/home/jens/Source/shotwell/src/util/file.vala" - total_bytes = (guint64) 0; -#line 114 "/home/jens/Source/shotwell/src/util/file.vala" - info = NULL; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - while (TRUE) { -#line 852 "file.c" - GFileInfo* _tmp24_ = NULL; - GFileEnumerator* _tmp25_; - GFileInfo* _tmp26_; - GFileInfo* _tmp28_; - GFileInfo* _tmp29_; - guint64 _tmp30_ = 0ULL; - GFileInfo* _tmp31_; - const gchar* _tmp32_; - GFile* _tmp33_; - GFile* _tmp34_; - guint64 _tmp35_; - guint64 _tmp37_; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp25_ = enumerator; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp26_ = g_file_enumerator_next_file (_tmp25_, cancellable, &_inner_error_); -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp24_ = _tmp26_; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 873 "file.c" - guint64 _tmp27_ = 0ULL; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp27_; -#line 883 "file.c" - } -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp28_ = _tmp24_; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp24_ = NULL; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - info = _tmp28_; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp29_ = info; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - if (!(_tmp29_ != NULL)) { -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp24_); -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - break; -#line 901 "file.c" - } -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp31_ = info; -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp32_ = g_file_info_get_name (_tmp31_); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp33_ = g_file_get_child (file_or_dir, _tmp32_); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp34_ = _tmp33_; -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp35_ = query_total_file_size (_tmp34_, cancellable, &_inner_error_); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp34_); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp30_ = _tmp35_; -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 919 "file.c" - guint64 _tmp36_ = 0ULL; -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp24_); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp36_; -#line 931 "file.c" - } -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp37_ = total_bytes; -#line 116 "/home/jens/Source/shotwell/src/util/file.vala" - total_bytes = _tmp37_ + _tmp30_; -#line 115 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp24_); -#line 939 "file.c" - } -#line 118 "/home/jens/Source/shotwell/src/util/file.vala" - result = total_bytes; -#line 118 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 118 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 118 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 949 "file.c" -} - - -void -delete_all_files (GFile* dir, - GeeSet* exceptions, - ProgressMonitor monitor, - void* monitor_target, - guint64 file_count, - GCancellable* cancellable, - GError** error) -{ - GFileType type = 0; - GFileType _tmp0_; - GFileEnumerator* enumerator = NULL; - GFileEnumerator* _tmp7_; - GFileInfo* info = NULL; - guint64 i = 0ULL; - GError * _inner_error_ = NULL; -#line 125 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_if_fail (G_IS_FILE (dir)); -#line 125 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_if_fail ((exceptions == NULL) || GEE_IS_SET (exceptions)); -#line 125 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_if_fail ((cancellable == NULL) || G_IS_CANCELLABLE (cancellable)); -#line 127 "/home/jens/Source/shotwell/src/util/file.vala" - type = g_file_query_file_type (dir, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL); -#line 128 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = type; -#line 128 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp0_ != G_FILE_TYPE_DIRECTORY) { -#line 981 "file.c" - gchar* _tmp1_; - gchar* _tmp2_; - gchar* _tmp3_; - gchar* _tmp4_; - GError* _tmp5_; - GError* _tmp6_; -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = g_file_get_path (dir); -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = _tmp1_; -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = g_strdup_printf ("%s is not a directory", _tmp2_); -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = _tmp3_; -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY, _tmp4_); -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp6_ = _tmp5_; -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp4_); -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp2_); -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = _tmp6_; -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 129 "/home/jens/Source/shotwell/src/util/file.vala" - return; -#line 1010 "file.c" - } -#line 131 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp7_ = g_file_enumerate_children (dir, "standard::name,standard::type", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable, &_inner_error_); -#line 131 "/home/jens/Source/shotwell/src/util/file.vala" - enumerator = _tmp7_; -#line 131 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 131 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 131 "/home/jens/Source/shotwell/src/util/file.vala" - return; -#line 1022 "file.c" - } -#line 133 "/home/jens/Source/shotwell/src/util/file.vala" - info = NULL; -#line 134 "/home/jens/Source/shotwell/src/util/file.vala" - i = (guint64) 0; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - while (TRUE) { -#line 1030 "file.c" - GFileInfo* _tmp8_ = NULL; - GFileEnumerator* _tmp9_; - GFileInfo* _tmp10_; - GFileInfo* _tmp11_; - GFileInfo* _tmp12_; - GFileInfo* _tmp13_; - gboolean _tmp14_ = FALSE; - GFile* file = NULL; - GFileInfo* _tmp17_; - const gchar* _tmp18_; - GFile* _tmp19_; - gboolean _tmp26_ = FALSE; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp9_ = enumerator; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp10_ = g_file_enumerator_next_file (_tmp9_, cancellable, &_inner_error_); -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = _tmp10_; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - return; -#line 1059 "file.c" - } -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp11_ = _tmp8_; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = NULL; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - info = _tmp11_; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp12_ = info; -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - if (!(_tmp12_ != NULL)) { -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp8_); -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - break; -#line 1077 "file.c" - } -#line 136 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp13_ = info; -#line 136 "/home/jens/Source/shotwell/src/util/file.vala" - if (g_file_info_get_file_type (_tmp13_) != G_FILE_TYPE_REGULAR) { -#line 137 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp8_); -#line 137 "/home/jens/Source/shotwell/src/util/file.vala" - continue; -#line 1087 "file.c" - } -#line 139 "/home/jens/Source/shotwell/src/util/file.vala" - if (exceptions != NULL) { -#line 1091 "file.c" - GFileInfo* _tmp15_; - const gchar* _tmp16_; -#line 139 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp15_ = info; -#line 139 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp16_ = g_file_info_get_name (_tmp15_); -#line 139 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp14_ = gee_collection_contains (G_TYPE_CHECK_INSTANCE_CAST (exceptions, GEE_TYPE_COLLECTION, GeeCollection), _tmp16_); -#line 1100 "file.c" - } else { -#line 139 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp14_ = FALSE; -#line 1104 "file.c" - } -#line 139 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp14_) { -#line 140 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp8_); -#line 140 "/home/jens/Source/shotwell/src/util/file.vala" - continue; -#line 1112 "file.c" - } -#line 142 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp17_ = info; -#line 142 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp18_ = g_file_info_get_name (_tmp17_); -#line 142 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp19_ = g_file_get_child (dir, _tmp18_); -#line 142 "/home/jens/Source/shotwell/src/util/file.vala" - file = _tmp19_; -#line 1122 "file.c" - { - GFile* _tmp20_; -#line 144 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp20_ = file; -#line 144 "/home/jens/Source/shotwell/src/util/file.vala" - g_file_delete (_tmp20_, cancellable, &_inner_error_); -#line 144 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 1131 "file.c" - goto __catch3_g_error; - } - } - goto __finally3; - __catch3_g_error: - { - GError* err = NULL; - GFile* _tmp21_; - gchar* _tmp22_; - gchar* _tmp23_; - GError* _tmp24_; - const gchar* _tmp25_; -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - err = _inner_error_; -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - _inner_error_ = NULL; -#line 146 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp21_ = file; -#line 146 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp22_ = g_file_get_path (_tmp21_); -#line 146 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp23_ = _tmp22_; -#line 146 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp24_ = err; -#line 146 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp25_ = _tmp24_->message; -#line 146 "/home/jens/Source/shotwell/src/util/file.vala" - g_warning ("file.vala:146: Unable to delete file %s: %s", _tmp23_, _tmp25_); -#line 146 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp23_); -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - _g_error_free0 (err); -#line 1164 "file.c" - } - __finally3: -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (file); -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp8_); -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 143 "/home/jens/Source/shotwell/src/util/file.vala" - return; -#line 1181 "file.c" - } -#line 149 "/home/jens/Source/shotwell/src/util/file.vala" - if (monitor != NULL) { -#line 149 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp26_ = file_count > ((guint64) 0); -#line 1187 "file.c" - } else { -#line 149 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp26_ = FALSE; -#line 1191 "file.c" - } -#line 149 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp26_) { -#line 1195 "file.c" - guint64 _tmp27_; - guint64 _tmp28_; -#line 150 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp27_ = i; -#line 150 "/home/jens/Source/shotwell/src/util/file.vala" - i = _tmp27_ + 1; -#line 150 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp28_ = i; -#line 150 "/home/jens/Source/shotwell/src/util/file.vala" - monitor (file_count, _tmp28_, TRUE, monitor_target); -#line 1206 "file.c" - } -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (file); -#line 135 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp8_); -#line 1212 "file.c" - } -#line 125 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 125 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 1218 "file.c" -} - - -time_t -query_file_modified (GFile* file, - GError** error) -{ - time_t result = 0; - GFileInfo* info = NULL; - GFileInfo* _tmp0_; - GTimeVal _tmp2_ = {0}; - glong _tmp3_; - GError * _inner_error_ = NULL; -#line 154 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (file), 0); -#line 155 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); -#line 155 "/home/jens/Source/shotwell/src/util/file.vala" - info = _tmp0_; -#line 155 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 1240 "file.c" - time_t _tmp1_ = 0; -#line 155 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 155 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp1_; -#line 1246 "file.c" - } -#line 158 "/home/jens/Source/shotwell/src/util/file.vala" - g_file_info_get_modification_time (info, &_tmp2_); -#line 158 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = _tmp2_.tv_sec; -#line 158 "/home/jens/Source/shotwell/src/util/file.vala" - result = (time_t) _tmp3_; -#line 158 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 158 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1258 "file.c" -} - - -gboolean -query_is_directory (GFile* file) -{ - gboolean result = FALSE; -#line 161 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (file), FALSE); -#line 162 "/home/jens/Source/shotwell/src/util/file.vala" - result = g_file_query_file_type (file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == G_FILE_TYPE_DIRECTORY; -#line 162 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1272 "file.c" -} - - -gboolean -query_is_directory_empty (GFile* dir, - GError** error) -{ - gboolean result = FALSE; - GFileEnumerator* enumerator = NULL; - GFileEnumerator* _tmp0_; - GFileEnumerator* _tmp2_; - GFileInfo* _tmp3_ = NULL; - GFileEnumerator* _tmp4_; - GFileInfo* _tmp5_; - GError * _inner_error_ = NULL; -#line 165 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (dir), FALSE); -#line 166 "/home/jens/Source/shotwell/src/util/file.vala" - if (g_file_query_file_type (dir, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) != G_FILE_TYPE_DIRECTORY) { -#line 167 "/home/jens/Source/shotwell/src/util/file.vala" - result = FALSE; -#line 167 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1296 "file.c" - } -#line 169 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_enumerate_children (dir, "standard::name", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); -#line 169 "/home/jens/Source/shotwell/src/util/file.vala" - enumerator = _tmp0_; -#line 169 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 1304 "file.c" - gboolean _tmp1_ = FALSE; -#line 169 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 169 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp1_; -#line 1310 "file.c" - } -#line 171 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = enumerator; -#line 171 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp2_ == NULL) { -#line 172 "/home/jens/Source/shotwell/src/util/file.vala" - result = FALSE; -#line 172 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 172 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1322 "file.c" - } -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = enumerator; -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = g_file_enumerator_next_file (_tmp4_, NULL, &_inner_error_); -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = _tmp5_; -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 1332 "file.c" - gboolean _tmp6_ = FALSE; -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp6_; -#line 1340 "file.c" - } -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp3_ == NULL; -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp3_); -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 174 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1350 "file.c" -} - - -gchar* -get_display_pathname (GFile* file) -{ - gchar* result = NULL; - gchar* path = NULL; - gchar* _tmp0_; - gchar* home = NULL; - const gchar* _tmp1_; - gchar* _tmp2_; - const gchar* _tmp3_; - const gchar* _tmp4_; - const gchar* _tmp6_; - const gchar* _tmp7_; -#line 177 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (file), NULL); -#line 179 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_get_parse_name (file); -#line 179 "/home/jens/Source/shotwell/src/util/file.vala" - path = _tmp0_; -#line 180 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = g_get_home_dir (); -#line 180 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = g_strdup (_tmp1_); -#line 180 "/home/jens/Source/shotwell/src/util/file.vala" - home = _tmp2_; -#line 182 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = path; -#line 182 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = home; -#line 182 "/home/jens/Source/shotwell/src/util/file.vala" - if (g_strcmp0 (_tmp3_, _tmp4_) == 0) { -#line 1385 "file.c" - gchar* _tmp5_; -#line 183 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = g_strdup ("~"); -#line 183 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp5_; -#line 183 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (home); -#line 183 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (path); -#line 183 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1397 "file.c" - } -#line 185 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp6_ = path; -#line 185 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp7_ = home; -#line 185 "/home/jens/Source/shotwell/src/util/file.vala" - if (g_str_has_prefix (_tmp6_, _tmp7_)) { -#line 1405 "file.c" - const gchar* _tmp8_; - const gchar* _tmp9_; - gint _tmp10_; - gint _tmp11_; - gchar* _tmp12_; - gchar* _tmp13_; - gchar* _tmp14_; - gchar* _tmp15_; -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = path; -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp9_ = home; -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp10_ = strlen (_tmp9_); -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp11_ = _tmp10_; -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp12_ = string_substring (_tmp8_, (glong) _tmp11_, (glong) -1); -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp13_ = _tmp12_; -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp14_ = g_strdup_printf ("~%s", _tmp13_); -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp15_ = _tmp14_; -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp13_); -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp15_; -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (home); -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (path); -#line 186 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1440 "file.c" - } -#line 188 "/home/jens/Source/shotwell/src/util/file.vala" - result = path; -#line 188 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (home); -#line 188 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1448 "file.c" -} - - -gchar* -strip_pretty_path (const gchar* path) -{ - gchar* result = NULL; - const gchar* _tmp1_; - gchar* _tmp2_; - gchar* _tmp3_; - gchar* _tmp4_; - gchar* _tmp5_; -#line 191 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (path != NULL, NULL); -#line 192 "/home/jens/Source/shotwell/src/util/file.vala" - if (!g_str_has_prefix (path, "~")) { -#line 1465 "file.c" - gchar* _tmp0_; -#line 193 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_strdup (path); -#line 193 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp0_; -#line 193 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1473 "file.c" - } -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = g_get_home_dir (); -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = string_substring (path, (glong) 1, (glong) -1); -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = _tmp2_; -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = g_strconcat (_tmp1_, _tmp3_, NULL); -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp5_ = _tmp4_; -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - _g_free0 (_tmp3_); -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp5_; -#line 195 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1491 "file.c" -} - - -gchar* -get_file_info_id (GFileInfo* info) -{ - gchar* result = NULL; - const gchar* _tmp0_; - gchar* _tmp1_; -#line 198 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE_INFO (info), NULL); -#line 199 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILE); -#line 199 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = g_strdup (_tmp0_); -#line 199 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp1_; -#line 199 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1511 "file.c" -} - - -void -skip_uint64 (GInputStream* input, - guint64 skip_amount, - GError** error) -{ - GError * _inner_error_ = NULL; -#line 203 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_if_fail (G_IS_INPUT_STREAM (input)); -#line 204 "/home/jens/Source/shotwell/src/util/file.vala" - while (TRUE) { -#line 204 "/home/jens/Source/shotwell/src/util/file.vala" - if (!(skip_amount > ((guint64) 0))) { -#line 204 "/home/jens/Source/shotwell/src/util/file.vala" - break; -#line 1529 "file.c" - } -#line 206 "/home/jens/Source/shotwell/src/util/file.vala" - if (skip_amount >= ((guint64) G_MAXSSIZE)) { -#line 207 "/home/jens/Source/shotwell/src/util/file.vala" - g_input_stream_skip (input, (gsize) G_MAXSSIZE, NULL, &_inner_error_); -#line 207 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 207 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 207 "/home/jens/Source/shotwell/src/util/file.vala" - return; -#line 1541 "file.c" - } -#line 208 "/home/jens/Source/shotwell/src/util/file.vala" - skip_amount = skip_amount - G_MAXSSIZE; -#line 1545 "file.c" - } else { -#line 210 "/home/jens/Source/shotwell/src/util/file.vala" - g_input_stream_skip (input, (gsize) skip_amount, NULL, &_inner_error_); -#line 210 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 210 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 210 "/home/jens/Source/shotwell/src/util/file.vala" - return; -#line 1555 "file.c" - } -#line 211 "/home/jens/Source/shotwell/src/util/file.vala" - skip_amount = (guint64) 0; -#line 1559 "file.c" - } - } -} - - -guint64 -count_files_in_directory (GFile* dir, - GError** error) -{ - guint64 result = 0ULL; - guint64 count = 0ULL; - GFileEnumerator* enumerator = NULL; - GFileEnumerator* _tmp0_; - GFileInfo* info = NULL; - GError * _inner_error_ = NULL; -#line 217 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail (G_IS_FILE (dir), 0ULL); -#line 218 "/home/jens/Source/shotwell/src/util/file.vala" - if (!query_is_directory (dir)) { -#line 219 "/home/jens/Source/shotwell/src/util/file.vala" - result = (guint64) 0; -#line 219 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1583 "file.c" - } -#line 221 "/home/jens/Source/shotwell/src/util/file.vala" - count = (guint64) 0; -#line 222 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_enumerate_children (dir, "standard::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); -#line 222 "/home/jens/Source/shotwell/src/util/file.vala" - enumerator = _tmp0_; -#line 222 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 1593 "file.c" - guint64 _tmp1_ = 0ULL; -#line 222 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 222 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp1_; -#line 1599 "file.c" - } -#line 225 "/home/jens/Source/shotwell/src/util/file.vala" - info = NULL; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - while (TRUE) { -#line 1605 "file.c" - GFileInfo* _tmp2_ = NULL; - GFileEnumerator* _tmp3_; - GFileInfo* _tmp4_; - GFileInfo* _tmp6_; - GFileInfo* _tmp7_; - guint64 _tmp8_; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp3_ = enumerator; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp4_ = g_file_enumerator_next_file (_tmp3_, NULL, &_inner_error_); -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = _tmp4_; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 1620 "file.c" - guint64 _tmp5_ = 0ULL; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - g_propagate_error (error, _inner_error_); -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - return _tmp5_; -#line 1630 "file.c" - } -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp6_ = _tmp2_; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp2_ = NULL; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - info = _tmp6_; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp7_ = info; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - if (!(_tmp7_ != NULL)) { -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp2_); -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - break; -#line 1648 "file.c" - } -#line 227 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp8_ = count; -#line 227 "/home/jens/Source/shotwell/src/util/file.vala" - count = _tmp8_ + 1; -#line 226 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (_tmp2_); -#line 1656 "file.c" - } -#line 229 "/home/jens/Source/shotwell/src/util/file.vala" - result = count; -#line 229 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (info); -#line 229 "/home/jens/Source/shotwell/src/util/file.vala" - _g_object_unref0 (enumerator); -#line 229 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1666 "file.c" -} - - -gboolean -file_equal (GFile* a, - GFile* b) -{ - gboolean result = FALSE; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; -#line 233 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail ((a == NULL) || G_IS_FILE (a), FALSE); -#line 233 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail ((b == NULL) || G_IS_FILE (b), FALSE); -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - if (a != NULL) { -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = b != NULL; -#line 1685 "file.c" - } else { -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp1_ = FALSE; -#line 1689 "file.c" - } -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - if (_tmp1_) { -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_equal (a, b); -#line 1695 "file.c" - } else { -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = FALSE; -#line 1699 "file.c" - } -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp0_; -#line 234 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1705 "file.c" -} - - -guint -file_hash (GFile* file) -{ - guint result = 0U; - guint _tmp0_ = 0U; -#line 238 "/home/jens/Source/shotwell/src/util/file.vala" - g_return_val_if_fail ((file == NULL) || G_IS_FILE (file), 0U); -#line 239 "/home/jens/Source/shotwell/src/util/file.vala" - if (file != NULL) { -#line 239 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = g_file_hash (file); -#line 1720 "file.c" - } else { -#line 239 "/home/jens/Source/shotwell/src/util/file.vala" - _tmp0_ = (guint) 0; -#line 1724 "file.c" - } -#line 239 "/home/jens/Source/shotwell/src/util/file.vala" - result = _tmp0_; -#line 239 "/home/jens/Source/shotwell/src/util/file.vala" - return result; -#line 1730 "file.c" -} - - - diff --git a/src/util/image.c b/src/util/image.c deleted file mode 100644 index 5f3cbd0..0000000 --- a/src/util/image.c +++ /dev/null @@ -1,2633 +0,0 @@ -/* image.c generated by valac 0.40.4, the Vala compiler - * generated from image.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU LGPL (version 2.1 or later). - * See the COPYING file in this distribution. - */ -/* XPM */ - - -#include <glib.h> -#include <glib-object.h> -#include <stdlib.h> -#include <string.h> -#include <gdk/gdk.h> -#include <cairo.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gtk/gtk.h> -#include <float.h> -#include <math.h> - -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -#define TYPE_DIMENSIONS (dimensions_get_type ()) -typedef struct _Dimensions Dimensions; -#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL))) -#define _cairo_surface_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_surface_destroy (var), NULL))) - -#define TYPE_CONFIGURATION_FACADE (configuration_facade_get_type ()) -#define CONFIGURATION_FACADE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONFIGURATION_FACADE, ConfigurationFacade)) -#define CONFIGURATION_FACADE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONFIGURATION_FACADE, ConfigurationFacadeClass)) -#define IS_CONFIGURATION_FACADE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONFIGURATION_FACADE)) -#define IS_CONFIGURATION_FACADE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONFIGURATION_FACADE)) -#define CONFIGURATION_FACADE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONFIGURATION_FACADE, ConfigurationFacadeClass)) - -typedef struct _ConfigurationFacade ConfigurationFacade; -typedef struct _ConfigurationFacadeClass ConfigurationFacadeClass; - -#define CONFIG_TYPE_FACADE (config_facade_get_type ()) -#define CONFIG_FACADE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONFIG_TYPE_FACADE, ConfigFacade)) -#define CONFIG_FACADE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONFIG_TYPE_FACADE, ConfigFacadeClass)) -#define CONFIG_IS_FACADE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONFIG_TYPE_FACADE)) -#define CONFIG_IS_FACADE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONFIG_TYPE_FACADE)) -#define CONFIG_FACADE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONFIG_TYPE_FACADE, ConfigFacadeClass)) - -typedef struct _ConfigFacade ConfigFacade; -typedef struct _ConfigFacadeClass ConfigFacadeClass; -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define TYPE_BOX (box_get_type ()) -typedef struct _Box Box; -#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); -#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } -#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } -#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); - -struct _Dimensions { - gint width; - gint height; -}; - -struct _Box { - gint left; - gint top; - gint right; - gint bottom; -}; - - -extern cairo_surface_t* background_surface; -cairo_surface_t* background_surface = NULL; - -gboolean is_color_parsable (const gchar* spec); -void parse_color (const gchar* spec, - GdkRGBA* result); -void fetch_color (const gchar* spec, - GdkRGBA* result); -void set_source_color_from_string (cairo_t* ctx, - const gchar* spec); -#define MIN_SCALED_WIDTH 10 -#define MIN_SCALED_HEIGHT 10 -GdkPixbuf* get_placeholder_pixbuf (void); -GdkPixbuf* scale_pixbuf (GdkPixbuf* pixbuf, - gint scale, - GdkInterpType interp, - gboolean scale_up); -GType dimensions_get_type (void) G_GNUC_CONST; -Dimensions* dimensions_dup (const Dimensions* self); -void dimensions_free (Dimensions* self); -void dimensions_for_pixbuf (GdkPixbuf* pixbuf, - Dimensions* result); -void dimensions_get_scaled (Dimensions *self, - gint scale, - gboolean scale_up, - Dimensions* result); -void dimensions_with_min (Dimensions *self, - gint min_width, - gint min_height, - Dimensions* result); -GdkPixbuf* resize_pixbuf (GdkPixbuf* pixbuf, - Dimensions* resized, - GdkInterpType interp); -#define DEGREE (G_PI / 180.0) -void draw_rounded_corners_filled (cairo_t* ctx, - Dimensions* dim, - GdkPoint* origin, - gdouble radius_proportion); -void context_rounded_corners (cairo_t* cx, - Dimensions* dim, - GdkPoint* origin, - gdouble radius_proportion); -gint dimensions_minor_axis (Dimensions *self); -guchar shift_color_byte (gint b, - gint shift); -void shift_colors (GdkPixbuf* pixbuf, - gint red, - gint green, - gint blue, - gint alpha); -gboolean coord_in_rectangle (gint x, - gint y, - GdkRectangle* rect); -gboolean rectangles_equal (GdkRectangle* a, - GdkRectangle* b); -gchar* rectangle_to_string (GdkRectangle* rect); -void clamp_rectangle (GdkRectangle* original, - Dimensions* max, - GdkRectangle* result); -void scale_point (GdkPoint* p, - gdouble factor, - GdkPoint* result); -void add_points (GdkPoint* p1, - GdkPoint* p2, - GdkPoint* result); -void subtract_points (GdkPoint* p1, - GdkPoint* p2, - GdkPoint* result); -void fix_cairo_pixbuf (GdkPixbuf* pixbuf); -void compute_arb_rotated_size (gdouble src_width, - gdouble src_height, - gdouble angle, - gdouble* dest_width, - gdouble* dest_height); -gdouble degrees_to_radians (gdouble theta); -GdkPixbuf* rotate_arb (GdkPixbuf* source_pixbuf, - gdouble angle); -void rotate_point_arb (GdkPoint* source_point, - gint img_w, - gint img_h, - gdouble angle, - gboolean invert, - GdkPoint* result); -void derotate_point_arb (GdkPoint* source_point, - gint img_w, - gint img_h, - gdouble angle, - GdkPoint* result); -cairo_surface_t* get_background_surface (void); -GType configuration_facade_get_type (void) G_GNUC_CONST; -GType config_facade_get_type (void) G_GNUC_CONST; -ConfigFacade* config_facade_get_instance (void); -gchar* configuration_facade_get_transparent_background_type (ConfigurationFacade* self); -gchar* configuration_facade_get_transparent_background_color (ConfigurationFacade* self); -void invalidate_transparent_background (void); -void paint_pixmap_with_background (cairo_t* ctx, - GdkPixbuf* pixbuf, - gint x, - gint y); -GType box_get_type (void) G_GNUC_CONST; -Box* box_dup (const Box* self); -void box_free (Box* self); -void clamp_inside_rotated_image (Box* src, - gint img_w, - gint img_h, - gdouble angle_deg, - gboolean preserve_geom, - Box* result); -void box_get_offset (Box *self, - gint xofs, - gint yofs, - Box* result); -void box_init (Box *self, - gint left, - gint top, - gint right, - gint bottom); - -const gchar* fallback_image_missing[103] = {"48 48 54 1 ", " c #6A6D67", ". c #6C6E69", "X c #72746F", "o c #747672", "O c #777974", "+ c #797B77", "@ c #7C7E7A", "# c #7F817C", "$ c #81837F", "% c #848682", "& c #878984", "* c #888A86", "= c #8C8D8A", "- c #8F908C", "; c #90928E", ": c #949591", "> c #969894", ", c #999B96", "< c #9C9E9A", "1 c #9FA09C", "2 c #A1A39E", "3 c #A4A6A2", "4 c #A6A9A4", "5 c #A9ABA6", "6 c #ACADA9", "7 c #AEB1AB", "8 c #B1B2AF", "9 c #B3B4B1", "0 c #B6B9B3", "q c #B9BCB6", "w c #BDBEBA", "e c #BEC2BB", "r c #C1C4BE", "t c #C5C5C2", "y c #C6C9C3", "u c #C9CCC6", "i c #CCCDCB", "p c #CED2CA", "a c #D2D6CE", "s c #D5D5D3", "d c #D7D8D5", "f c #D9D9D6", "g c #DCDCDA", "h c #DFE0DD", "j c #E0E0DE", "k c #E4E4E2", "l c #E7E8E5", "z c #E9E9E7", "x c #EDEDEC", "c c #EFF0EE", "v c #F1F1EF", "b c #F2F2F1", "n c #FFFFFF", "m c None", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmaaaaaaaaaasaisaaaaaaaaaaaaaaaaaaapppiipuuuuumm", "mannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnym", "manbbbbbbbbbvbbvvvvxvvvbvvvvvvvvccccccxxvxvxxnym", "manbt89898888988888888888999999999999999999txnrm", "manb6======================-;;=;;;;;;;;;;=:7znrm", "manv6&%%**%*%%%%*%%****=======;==;;;;=;=;==7znem", "manv4%%%%$%%%%%%%%%%%=****=======;==-======6znwm", "manx3%%#$$$$##%#$%%%*%**==========-=--=====6znqm", "manx1$@%#$@$###%%%%=****=*===--;;----====*=5lnqm", "manx<@@@@@@@@##%$%%%%****========-==-======5kn0m", "manz<@@@+@+@@@#$%%%%%=%=%===;=:=--------=-*4kn8m", "manz>O+O+O+@@@#$$%%%%========;;=--------=*=3kn9m", "mpnl:OOOOO+@@$##%%%%%=%=====;=;;--;-----===3kn8m", "munl;OooOOO@@@#$%%%%%======;;;;;:;;;;;---==1hn7m", "munl;oXoOO+@###$%%=%=======;::;::::;;---&#+-gn7m", "mynk*XXooOO+$$#$%%%%=%===;;:;:::::;:-$#XooX-fn5m", "mynk*XXOOO@@$$$$%%=%====;::::>::;*#OXXXXXXX*dn5m", "mrnk*oOO@@@#$$$$%=====::::>>>=%@OXOooXXXooo&dn3m", "mrnj*++@$$$$**$===-;;::>>:=@Ooo@XOOoo#o#OOO=fn3m", "menj*@#$$$$$**===;;:::=%@@@@@@O@#O#Oo#o#++@;gn2m", "menj*$$$$&**===;:;=*#@@@@@@@@@@@#######o##%>gn2m", "menh*$$%**===;=*%###########%@@@###$####$%=,gn1m", "m0nj=%***=**&$$$%$$$%$$%$$$$%$$$$$$$$$$%*;:2hn<m", "m0nj****&&&$$&&$%%%%%%%%%%%%%%%%$$*$%%%*;>13gn,m", "m0ng****&&&&&&&&&&&&*%*%*%%*%******%**-:,136kz;m", "m0nh***$&&&&&&&&&&&&%**********%*$***;:,1358r7*m", "m8ng*&&&&&&&&&*$&*&&&&$=$=$=&&&&&&**=:,<11>$65mm", "m7ng*&&&&&&&&&**&&&&&&**=$-$&&&&&&*-:,1..&1wi:mm", "m7ng&&&&&&&&=$*$&&&&&***$$$$&&&***=>,1<onxsi6*mm", "m6nf*&&&&&*&$***&&&&*$*$--$-&&&%*=;,13,:ztw9%mmm", "m5nf*%&&&&&&=$=$%*&&**%*$$&&&&**=>,225;5srw%mmmm", "m4nf3*&&**&&$-$-*******%$;&&*&*->,2365+ui7$mmmmm", "m3nsfffdddsddaffssssdassgaaaassddfgjg4wu;ommmmmm", "m3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnvq3<$.mmmmmmm", "mm2211111,<,,,,,,>>>>:::;::;----=====@mmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"}; - -gboolean -is_color_parsable (const gchar* spec) -{ - gboolean result = FALSE; - GdkRGBA color = {0}; -#line 117 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (spec != NULL, FALSE); -#line 118 "/home/jens/Source/shotwell/src/util/image.vala" - memset (&color, 0, sizeof (GdkRGBA)); -#line 119 "/home/jens/Source/shotwell/src/util/image.vala" - result = gdk_rgba_parse (&color, spec); -#line 119 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 206 "image.c" -} - - -void -parse_color (const gchar* spec, - GdkRGBA* result) -{ - GdkRGBA _tmp0_ = {0}; -#line 122 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (spec != NULL); -#line 123 "/home/jens/Source/shotwell/src/util/image.vala" - fetch_color (spec, &_tmp0_); -#line 123 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _tmp0_; -#line 123 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 223 "image.c" -} - - -void -fetch_color (const gchar* spec, - GdkRGBA* result) -{ - GdkRGBA rgba = {0}; -#line 126 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (spec != NULL); -#line 127 "/home/jens/Source/shotwell/src/util/image.vala" - memset (&rgba, 0, sizeof (GdkRGBA)); -#line 128 "/home/jens/Source/shotwell/src/util/image.vala" - if (!gdk_rgba_parse (&rgba, spec)) { -#line 129 "/home/jens/Source/shotwell/src/util/image.vala" - g_error ("image.vala:129: Can't parse color %s", spec); -#line 240 "image.c" - } -#line 131 "/home/jens/Source/shotwell/src/util/image.vala" - *result = rgba; -#line 131 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 246 "image.c" -} - - -void -set_source_color_from_string (cairo_t* ctx, - const gchar* spec) -{ - GdkRGBA rgba = {0}; - GdkRGBA _tmp0_ = {0}; - GdkRGBA _tmp1_; - gdouble _tmp2_; - GdkRGBA _tmp3_; - gdouble _tmp4_; - GdkRGBA _tmp5_; - gdouble _tmp6_; - GdkRGBA _tmp7_; - gdouble _tmp8_; -#line 134 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (ctx != NULL); -#line 134 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (spec != NULL); -#line 135 "/home/jens/Source/shotwell/src/util/image.vala" - fetch_color (spec, &_tmp0_); -#line 135 "/home/jens/Source/shotwell/src/util/image.vala" - rgba = _tmp0_; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = rgba; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp1_.red; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = rgba; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_.green; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = rgba; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_.blue; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = rgba; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = _tmp7_.alpha; -#line 136 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_set_source_rgba (ctx, _tmp2_, _tmp4_, _tmp6_, _tmp8_); -#line 290 "image.c" -} - - -static gpointer -_g_object_ref0 (gpointer self) -{ -#line 147 "/home/jens/Source/shotwell/src/util/image.vala" - return self ? g_object_ref (self) : NULL; -#line 299 "image.c" -} - - -GdkPixbuf* -get_placeholder_pixbuf (void) -{ - GdkPixbuf* result = NULL; - GdkPixbuf* pixbuf = NULL; - GError * _inner_error_ = NULL; -#line 144 "/home/jens/Source/shotwell/src/util/image.vala" - pixbuf = NULL; -#line 311 "image.c" - { - GtkIconTheme* icon_theme = NULL; - GtkIconTheme* _tmp0_; - GtkIconTheme* _tmp1_; - GdkPixbuf* _tmp2_ = NULL; - GdkPixbuf* _tmp3_; - GdkPixbuf* _tmp4_; -#line 147 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = gtk_icon_theme_get_default (); -#line 147 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _g_object_ref0 (_tmp0_); -#line 147 "/home/jens/Source/shotwell/src/util/image.vala" - icon_theme = _tmp1_; -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = gtk_icon_theme_load_icon (icon_theme, "image-missing", (gint) GTK_ICON_SIZE_DIALOG, 0, &_inner_error_); -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp3_; -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - _g_object_unref0 (icon_theme); -#line 333 "image.c" - goto __catch4_g_error; - } -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp2_; -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = NULL; -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - _g_object_unref0 (pixbuf); -#line 148 "/home/jens/Source/shotwell/src/util/image.vala" - pixbuf = _tmp4_; -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - _g_object_unref0 (_tmp2_); -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - _g_object_unref0 (icon_theme); -#line 348 "image.c" - } - goto __finally4; - __catch4_g_error: - { - GError* _error_ = NULL; - GdkPixbuf* _tmp5_; - GError* _tmp6_; - const gchar* _tmp7_; -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - _error_ = _inner_error_; -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - _inner_error_ = NULL; -#line 151 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = gdk_pixbuf_new_from_xpm_data (fallback_image_missing); -#line 151 "/home/jens/Source/shotwell/src/util/image.vala" - _g_object_unref0 (pixbuf); -#line 151 "/home/jens/Source/shotwell/src/util/image.vala" - pixbuf = _tmp5_; -#line 152 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _error_; -#line 152 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = _tmp6_->message; -#line 152 "/home/jens/Source/shotwell/src/util/image.vala" - g_warning ("image.vala:152: Could not load icon from theme: %s", _tmp7_); -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - _g_error_free0 (_error_); -#line 375 "image.c" - } - __finally4: -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - _g_object_unref0 (pixbuf); -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - g_clear_error (&_inner_error_); -#line 146 "/home/jens/Source/shotwell/src/util/image.vala" - return NULL; -#line 388 "image.c" - } -#line 155 "/home/jens/Source/shotwell/src/util/image.vala" - result = pixbuf; -#line 155 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 394 "image.c" -} - - -GdkPixbuf* -scale_pixbuf (GdkPixbuf* pixbuf, - gint scale, - GdkInterpType interp, - gboolean scale_up) -{ - GdkPixbuf* result = NULL; - Dimensions original = {0}; - Dimensions _tmp0_ = {0}; - Dimensions scaled = {0}; - Dimensions _tmp1_ = {0}; - gboolean _tmp2_ = FALSE; - Dimensions _tmp3_; - gint _tmp4_; - Dimensions _tmp5_; - gint _tmp6_; - Dimensions _tmp12_ = {0}; - Dimensions _tmp13_; - gint _tmp14_; - Dimensions _tmp15_; - gint _tmp16_; - GdkPixbuf* _tmp17_; -#line 158 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); -#line 159 "/home/jens/Source/shotwell/src/util/image.vala" - dimensions_for_pixbuf (pixbuf, &_tmp0_); -#line 159 "/home/jens/Source/shotwell/src/util/image.vala" - original = _tmp0_; -#line 160 "/home/jens/Source/shotwell/src/util/image.vala" - dimensions_get_scaled (&original, scale, scale_up, &_tmp1_); -#line 160 "/home/jens/Source/shotwell/src/util/image.vala" - scaled = _tmp1_; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = original; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_.width; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = scaled; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_.width; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp4_ == _tmp6_) { -#line 440 "image.c" - Dimensions _tmp7_; - gint _tmp8_; - Dimensions _tmp9_; - gint _tmp10_; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = original; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = _tmp7_.height; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = scaled; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = _tmp9_.height; -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp8_ == _tmp10_; -#line 455 "image.c" - } else { -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = FALSE; -#line 459 "image.c" - } -#line 161 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp2_) { -#line 463 "image.c" - GdkPixbuf* _tmp11_; -#line 162 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = _g_object_ref0 (pixbuf); -#line 162 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp11_; -#line 162 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 471 "image.c" - } -#line 165 "/home/jens/Source/shotwell/src/util/image.vala" - dimensions_with_min (&scaled, MIN_SCALED_WIDTH, MIN_SCALED_HEIGHT, &_tmp12_); -#line 165 "/home/jens/Source/shotwell/src/util/image.vala" - scaled = _tmp12_; -#line 167 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = scaled; -#line 167 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = _tmp13_.width; -#line 167 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = scaled; -#line 167 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_ = _tmp15_.height; -#line 167 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp17_ = gdk_pixbuf_scale_simple (pixbuf, _tmp14_, _tmp16_, interp); -#line 167 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp17_; -#line 167 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 491 "image.c" -} - - -GdkPixbuf* -resize_pixbuf (GdkPixbuf* pixbuf, - Dimensions* resized, - GdkInterpType interp) -{ - GdkPixbuf* result = NULL; - Dimensions original = {0}; - Dimensions _tmp0_ = {0}; - gboolean _tmp1_ = FALSE; - Dimensions _tmp2_; - gint _tmp3_; - Dimensions _tmp4_; - gint _tmp5_; - Dimensions _tmp11_ = {0}; - Dimensions _tmp12_; - gint _tmp13_; - Dimensions _tmp14_; - gint _tmp15_; - GdkPixbuf* _tmp16_; -#line 170 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); -#line 170 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (resized != NULL, NULL); -#line 171 "/home/jens/Source/shotwell/src/util/image.vala" - dimensions_for_pixbuf (pixbuf, &_tmp0_); -#line 171 "/home/jens/Source/shotwell/src/util/image.vala" - original = _tmp0_; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = original; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = _tmp2_.width; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = *resized; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = _tmp4_.width; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp3_ == _tmp5_) { -#line 532 "image.c" - Dimensions _tmp6_; - gint _tmp7_; - Dimensions _tmp8_; - gint _tmp9_; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = original; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = _tmp6_.height; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = *resized; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = _tmp8_.height; -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp7_ == _tmp9_; -#line 547 "image.c" - } else { -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = FALSE; -#line 551 "image.c" - } -#line 172 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp1_) { -#line 555 "image.c" - GdkPixbuf* _tmp10_; -#line 173 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = _g_object_ref0 (pixbuf); -#line 173 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp10_; -#line 173 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 563 "image.c" - } -#line 176 "/home/jens/Source/shotwell/src/util/image.vala" - dimensions_with_min (resized, MIN_SCALED_WIDTH, MIN_SCALED_HEIGHT, &_tmp11_); -#line 176 "/home/jens/Source/shotwell/src/util/image.vala" - *resized = _tmp11_; -#line 178 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = *resized; -#line 178 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = _tmp12_.width; -#line 178 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = *resized; -#line 178 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = _tmp14_.height; -#line 178 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_ = gdk_pixbuf_scale_simple (pixbuf, _tmp13_, _tmp15_, interp); -#line 178 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp16_; -#line 178 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 583 "image.c" -} - - -void -draw_rounded_corners_filled (cairo_t* ctx, - Dimensions* dim, - GdkPoint* origin, - gdouble radius_proportion) -{ - Dimensions _tmp0_; - GdkPoint _tmp1_; -#line 183 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (ctx != NULL); -#line 183 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (dim != NULL); -#line 183 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (origin != NULL); -#line 185 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = *dim; -#line 185 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = *origin; -#line 185 "/home/jens/Source/shotwell/src/util/image.vala" - context_rounded_corners (ctx, &_tmp0_, &_tmp1_, radius_proportion); -#line 186 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_paint (ctx); -#line 609 "image.c" -} - - -void -context_rounded_corners (cairo_t* cx, - Dimensions* dim, - GdkPoint* origin, - gdouble radius_proportion) -{ - gdouble left = 0.0; - GdkPoint _tmp0_; - gint _tmp1_; - gdouble top = 0.0; - GdkPoint _tmp2_; - gint _tmp3_; - gdouble right = 0.0; - GdkPoint _tmp4_; - gint _tmp5_; - Dimensions _tmp6_; - gint _tmp7_; - gdouble bottom = 0.0; - GdkPoint _tmp8_; - gint _tmp9_; - Dimensions _tmp10_; - gint _tmp11_; - gdouble radius = 0.0; -#line 189 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (cx != NULL); -#line 189 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (dim != NULL); -#line 189 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (origin != NULL); -#line 192 "/home/jens/Source/shotwell/src/util/image.vala" - radius_proportion = CLAMP (radius_proportion, 2.0, 100.0); -#line 194 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = *origin; -#line 194 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp0_.x; -#line 194 "/home/jens/Source/shotwell/src/util/image.vala" - left = (gdouble) _tmp1_; -#line 195 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = *origin; -#line 195 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = _tmp2_.y; -#line 195 "/home/jens/Source/shotwell/src/util/image.vala" - top = (gdouble) _tmp3_; -#line 196 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = *origin; -#line 196 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = _tmp4_.x; -#line 196 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = *dim; -#line 196 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = _tmp6_.width; -#line 196 "/home/jens/Source/shotwell/src/util/image.vala" - right = (gdouble) (_tmp5_ + _tmp7_); -#line 197 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = *origin; -#line 197 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = _tmp8_.y; -#line 197 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = *dim; -#line 197 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = _tmp10_.height; -#line 197 "/home/jens/Source/shotwell/src/util/image.vala" - bottom = (gdouble) (_tmp9_ + _tmp11_); -#line 200 "/home/jens/Source/shotwell/src/util/image.vala" - radius = ((gdouble) dimensions_minor_axis (dim)) / radius_proportion; -#line 204 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_move_to (cx, left, top); -#line 205 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_arc (cx, right - radius, top + radius, radius, -90 * DEGREE, 0 * DEGREE); -#line 206 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_arc (cx, right - radius, bottom - radius, radius, 0 * DEGREE, 90 * DEGREE); -#line 207 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_arc (cx, left + radius, bottom - radius, radius, 90 * DEGREE, 180 * DEGREE); -#line 208 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_arc (cx, left + radius, top + radius, radius, 180 * DEGREE, 270 * DEGREE); -#line 209 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_clip (cx); -#line 690 "image.c" -} - - -inline guchar -shift_color_byte (gint b, - gint shift) -{ - guchar result = '\0'; -#line 213 "/home/jens/Source/shotwell/src/util/image.vala" - result = (guchar) CLAMP (b + shift, 0, 255); -#line 213 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 703 "image.c" -} - - -void -shift_colors (GdkPixbuf* pixbuf, - gint red, - gint green, - gint blue, - gint alpha) -{ - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - gboolean _tmp3_ = FALSE; - gint width = 0; - gint height = 0; - gint rowstride = 0; - gint channels = 0; - guchar* pixels = NULL; - guint8* _tmp4_; - gint _tmp5_; -#line 216 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); -#line 217 "/home/jens/Source/shotwell/src/util/image.vala" - if (red >= -255) { -#line 217 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = red <= 255; -#line 731 "image.c" - } else { -#line 217 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = FALSE; -#line 735 "image.c" - } -#line 217 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (_tmp0_, "red >= -255 && red <= 255"); -#line 218 "/home/jens/Source/shotwell/src/util/image.vala" - if (green >= -255) { -#line 218 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = green <= 255; -#line 743 "image.c" - } else { -#line 218 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = FALSE; -#line 747 "image.c" - } -#line 218 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (_tmp1_, "green >= -255 && green <= 255"); -#line 219 "/home/jens/Source/shotwell/src/util/image.vala" - if (blue >= -255) { -#line 219 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = blue <= 255; -#line 755 "image.c" - } else { -#line 219 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = FALSE; -#line 759 "image.c" - } -#line 219 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (_tmp2_, "blue >= -255 && blue <= 255"); -#line 220 "/home/jens/Source/shotwell/src/util/image.vala" - if (alpha >= -255) { -#line 220 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = alpha <= 255; -#line 767 "image.c" - } else { -#line 220 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = FALSE; -#line 771 "image.c" - } -#line 220 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (_tmp3_, "alpha >= -255 && alpha <= 255"); -#line 222 "/home/jens/Source/shotwell/src/util/image.vala" - width = gdk_pixbuf_get_width (pixbuf); -#line 223 "/home/jens/Source/shotwell/src/util/image.vala" - height = gdk_pixbuf_get_height (pixbuf); -#line 224 "/home/jens/Source/shotwell/src/util/image.vala" - rowstride = gdk_pixbuf_get_rowstride (pixbuf); -#line 225 "/home/jens/Source/shotwell/src/util/image.vala" - channels = gdk_pixbuf_get_n_channels (pixbuf); -#line 226 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = gdk_pixbuf_get_pixels (pixbuf); -#line 226 "/home/jens/Source/shotwell/src/util/image.vala" - pixels = _tmp4_; -#line 228 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = channels; -#line 228 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (_tmp5_ >= 3, "channels >= 3"); -#line 229 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB, "pixbuf.get_colorspace() == Gdk.Colorspace.RGB"); -#line 230 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8, "pixbuf.get_bits_per_sample() == 8"); -#line 795 "image.c" - { - gint y = 0; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - y = 0; -#line 800 "image.c" - { - gboolean _tmp6_ = FALSE; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = TRUE; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - while (TRUE) { -#line 807 "image.c" - gint _tmp8_; - gint _tmp9_; - gint y_offset = 0; - gint _tmp10_; - gint _tmp11_; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - if (!_tmp6_) { -#line 815 "image.c" - gint _tmp7_; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = y; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - y = _tmp7_ + 1; -#line 821 "image.c" - } -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = FALSE; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = y; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = height; -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - if (!(_tmp8_ < _tmp9_)) { -#line 232 "/home/jens/Source/shotwell/src/util/image.vala" - break; -#line 833 "image.c" - } -#line 233 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = y; -#line 233 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = rowstride; -#line 233 "/home/jens/Source/shotwell/src/util/image.vala" - y_offset = _tmp10_ * _tmp11_; -#line 841 "image.c" - { - gint x = 0; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - x = 0; -#line 846 "image.c" - { - gboolean _tmp12_ = FALSE; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = TRUE; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - while (TRUE) { -#line 853 "image.c" - gint _tmp14_; - gint _tmp15_; - gint offset = 0; - gint _tmp16_; - gint _tmp17_; - gint _tmp18_; - gboolean _tmp37_ = FALSE; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - if (!_tmp12_) { -#line 863 "image.c" - gint _tmp13_; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = x; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - x = _tmp13_ + 1; -#line 869 "image.c" - } -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = FALSE; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = x; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = width; -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - if (!(_tmp14_ < _tmp15_)) { -#line 235 "/home/jens/Source/shotwell/src/util/image.vala" - break; -#line 881 "image.c" - } -#line 236 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_ = y_offset; -#line 236 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp17_ = x; -#line 236 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp18_ = channels; -#line 236 "/home/jens/Source/shotwell/src/util/image.vala" - offset = _tmp16_ + (_tmp17_ * _tmp18_); -#line 238 "/home/jens/Source/shotwell/src/util/image.vala" - if (red != 0) { -#line 893 "image.c" - guchar* _tmp19_; - gint _tmp20_; - guchar* _tmp21_; - gint _tmp22_; - guchar _tmp23_; - guchar _tmp24_; -#line 239 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp19_ = pixels; -#line 239 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp20_ = offset; -#line 239 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp21_ = pixels; -#line 239 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp22_ = offset; -#line 239 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp23_ = _tmp21_[_tmp22_]; -#line 239 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp19_[_tmp20_] = shift_color_byte ((gint) _tmp23_, red); -#line 239 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp24_ = _tmp19_[_tmp20_]; -#line 914 "image.c" - } -#line 241 "/home/jens/Source/shotwell/src/util/image.vala" - if (green != 0) { -#line 918 "image.c" - guchar* _tmp25_; - gint _tmp26_; - guchar* _tmp27_; - gint _tmp28_; - guchar _tmp29_; - guchar _tmp30_; -#line 242 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp25_ = pixels; -#line 242 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp26_ = offset; -#line 242 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp27_ = pixels; -#line 242 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp28_ = offset; -#line 242 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp29_ = _tmp27_[_tmp28_ + 1]; -#line 242 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp25_[_tmp26_ + 1] = shift_color_byte ((gint) _tmp29_, green); -#line 242 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp30_ = _tmp25_[_tmp26_ + 1]; -#line 939 "image.c" - } -#line 244 "/home/jens/Source/shotwell/src/util/image.vala" - if (blue != 0) { -#line 943 "image.c" - guchar* _tmp31_; - gint _tmp32_; - guchar* _tmp33_; - gint _tmp34_; - guchar _tmp35_; - guchar _tmp36_; -#line 245 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp31_ = pixels; -#line 245 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp32_ = offset; -#line 245 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp33_ = pixels; -#line 245 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp34_ = offset; -#line 245 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp35_ = _tmp33_[_tmp34_ + 2]; -#line 245 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp31_[_tmp32_ + 2] = shift_color_byte ((gint) _tmp35_, blue); -#line 245 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp36_ = _tmp31_[_tmp32_ + 2]; -#line 964 "image.c" - } -#line 247 "/home/jens/Source/shotwell/src/util/image.vala" - if (alpha != 0) { -#line 968 "image.c" - gint _tmp38_; -#line 247 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp38_ = channels; -#line 247 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp37_ = _tmp38_ >= 4; -#line 974 "image.c" - } else { -#line 247 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp37_ = FALSE; -#line 978 "image.c" - } -#line 247 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp37_) { -#line 982 "image.c" - guchar* _tmp39_; - gint _tmp40_; - guchar* _tmp41_; - gint _tmp42_; - guchar _tmp43_; - guchar _tmp44_; -#line 248 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp39_ = pixels; -#line 248 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp40_ = offset; -#line 248 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp41_ = pixels; -#line 248 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp42_ = offset; -#line 248 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp43_ = _tmp41_[_tmp42_ + 3]; -#line 248 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp39_[_tmp40_ + 3] = shift_color_byte ((gint) _tmp43_, alpha); -#line 248 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp44_ = _tmp39_[_tmp40_ + 3]; -#line 1003 "image.c" - } - } - } - } - } - } - } -} - - -gboolean -coord_in_rectangle (gint x, - gint y, - GdkRectangle* rect) -{ - gboolean result = FALSE; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - GdkRectangle _tmp3_; - gint _tmp4_; -#line 253 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (rect != NULL, FALSE); -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = *rect; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_.x; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - if (x >= _tmp4_) { -#line 1033 "image.c" - GdkRectangle _tmp5_; - gint _tmp6_; - GdkRectangle _tmp7_; - gint _tmp8_; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = *rect; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_.x; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = *rect; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = _tmp7_.width; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = x < (_tmp6_ + _tmp8_); -#line 1048 "image.c" - } else { -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = FALSE; -#line 1052 "image.c" - } -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp2_) { -#line 1056 "image.c" - GdkRectangle _tmp9_; - gint _tmp10_; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = *rect; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = _tmp9_.y; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = y >= _tmp10_; -#line 1065 "image.c" - } else { -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = FALSE; -#line 1069 "image.c" - } -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp1_) { -#line 1073 "image.c" - GdkRectangle _tmp11_; - gint _tmp12_; - GdkRectangle _tmp13_; - gint _tmp14_; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = *rect; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = _tmp11_.y; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = *rect; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = _tmp13_.height; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = y <= (_tmp12_ + _tmp14_); -#line 1088 "image.c" - } else { -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = FALSE; -#line 1092 "image.c" - } -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp0_; -#line 254 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 1098 "image.c" -} - - -gboolean -rectangles_equal (GdkRectangle* a, - GdkRectangle* b) -{ - gboolean result = FALSE; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - GdkRectangle _tmp3_; - gint _tmp4_; - GdkRectangle _tmp5_; - gint _tmp6_; -#line 257 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (a != NULL, FALSE); -#line 257 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (b != NULL, FALSE); -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = *a; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_.x; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = *b; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_.x; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp4_ == _tmp6_) { -#line 1128 "image.c" - GdkRectangle _tmp7_; - gint _tmp8_; - GdkRectangle _tmp9_; - gint _tmp10_; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = *a; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = _tmp7_.y; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = *b; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = _tmp9_.y; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp8_ == _tmp10_; -#line 1143 "image.c" - } else { -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = FALSE; -#line 1147 "image.c" - } -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp2_) { -#line 1151 "image.c" - GdkRectangle _tmp11_; - gint _tmp12_; - GdkRectangle _tmp13_; - gint _tmp14_; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = *a; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = _tmp11_.width; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = *b; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = _tmp13_.width; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp12_ == _tmp14_; -#line 1166 "image.c" - } else { -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = FALSE; -#line 1170 "image.c" - } -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp1_) { -#line 1174 "image.c" - GdkRectangle _tmp15_; - gint _tmp16_; - GdkRectangle _tmp17_; - gint _tmp18_; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = *a; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_ = _tmp15_.height; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp17_ = *b; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp18_ = _tmp17_.height; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = _tmp16_ == _tmp18_; -#line 1189 "image.c" - } else { -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = FALSE; -#line 1193 "image.c" - } -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp0_; -#line 258 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 1199 "image.c" -} - - -gchar* -rectangle_to_string (GdkRectangle* rect) -{ - gchar* result = NULL; - GdkRectangle _tmp0_; - gint _tmp1_; - GdkRectangle _tmp2_; - gint _tmp3_; - GdkRectangle _tmp4_; - gint _tmp5_; - GdkRectangle _tmp6_; - gint _tmp7_; - gchar* _tmp8_; -#line 261 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (rect != NULL, NULL); -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = *rect; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp0_.x; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = *rect; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = _tmp2_.y; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = *rect; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = _tmp4_.width; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = *rect; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = _tmp6_.height; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = g_strdup_printf ("%d,%d %dx%d", _tmp1_, _tmp3_, _tmp5_, _tmp7_); -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp8_; -#line 262 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 1240 "image.c" -} - - -void -clamp_rectangle (GdkRectangle* original, - Dimensions* max, - GdkRectangle* result) -{ - GdkRectangle rect = {0}; - GdkRectangle _tmp0_; - gint _tmp1_; - Dimensions _tmp2_; - gint _tmp3_; - GdkRectangle _tmp4_; - gint _tmp5_; - Dimensions _tmp6_; - gint _tmp7_; - GdkRectangle _tmp8_; - gint _tmp9_; - Dimensions _tmp10_; - gint _tmp11_; - GdkRectangle _tmp12_; - gint _tmp13_; - Dimensions _tmp14_; - gint _tmp15_; -#line 265 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (original != NULL); -#line 265 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (max != NULL); -#line 266 "/home/jens/Source/shotwell/src/util/image.vala" - memset (&rect, 0, sizeof (GdkRectangle)); -#line 267 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = *original; -#line 267 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp0_.x; -#line 267 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = *max; -#line 267 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = _tmp2_.width; -#line 267 "/home/jens/Source/shotwell/src/util/image.vala" - rect.x = CLAMP (_tmp1_, 0, _tmp3_); -#line 268 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = *original; -#line 268 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = _tmp4_.y; -#line 268 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = *max; -#line 268 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = _tmp6_.height; -#line 268 "/home/jens/Source/shotwell/src/util/image.vala" - rect.y = CLAMP (_tmp5_, 0, _tmp7_); -#line 269 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = *original; -#line 269 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = _tmp8_.width; -#line 269 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = *max; -#line 269 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = _tmp10_.width; -#line 269 "/home/jens/Source/shotwell/src/util/image.vala" - rect.width = CLAMP (_tmp9_, 0, _tmp11_); -#line 270 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = *original; -#line 270 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = _tmp12_.height; -#line 270 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = *max; -#line 270 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = _tmp14_.height; -#line 270 "/home/jens/Source/shotwell/src/util/image.vala" - rect.height = CLAMP (_tmp13_, 0, _tmp15_); -#line 272 "/home/jens/Source/shotwell/src/util/image.vala" - *result = rect; -#line 272 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 1316 "image.c" -} - - -void -scale_point (GdkPoint* p, - gdouble factor, - GdkPoint* result) -{ - GdkPoint _result_ = {0}; - GdkPoint _tmp0_ = {0}; - GdkPoint _tmp1_; - gint _tmp2_; - GdkPoint _tmp3_; - gint _tmp4_; -#line 275 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (p != NULL); -#line 276 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_.x = 0; -#line 276 "/home/jens/Source/shotwell/src/util/image.vala" - _result_ = _tmp0_; -#line 277 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = *p; -#line 277 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp1_.x; -#line 277 "/home/jens/Source/shotwell/src/util/image.vala" - _result_.x = (gint) ((factor * _tmp2_) + 0.5); -#line 278 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = *p; -#line 278 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_.y; -#line 278 "/home/jens/Source/shotwell/src/util/image.vala" - _result_.y = (gint) ((factor * _tmp4_) + 0.5); -#line 280 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _result_; -#line 280 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 1353 "image.c" -} - - -void -add_points (GdkPoint* p1, - GdkPoint* p2, - GdkPoint* result) -{ - GdkPoint _result_ = {0}; - GdkPoint _tmp0_ = {0}; - GdkPoint _tmp1_; - gint _tmp2_; - GdkPoint _tmp3_; - gint _tmp4_; - GdkPoint _tmp5_; - gint _tmp6_; - GdkPoint _tmp7_; - gint _tmp8_; -#line 283 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (p1 != NULL); -#line 283 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (p2 != NULL); -#line 284 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_.x = 0; -#line 284 "/home/jens/Source/shotwell/src/util/image.vala" - _result_ = _tmp0_; -#line 285 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = *p1; -#line 285 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp1_.x; -#line 285 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = *p2; -#line 285 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_.x; -#line 285 "/home/jens/Source/shotwell/src/util/image.vala" - _result_.x = _tmp2_ + _tmp4_; -#line 286 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = *p1; -#line 286 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_.y; -#line 286 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = *p2; -#line 286 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = _tmp7_.y; -#line 286 "/home/jens/Source/shotwell/src/util/image.vala" - _result_.y = _tmp6_ + _tmp8_; -#line 288 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _result_; -#line 288 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 1404 "image.c" -} - - -void -subtract_points (GdkPoint* p1, - GdkPoint* p2, - GdkPoint* result) -{ - GdkPoint _result_ = {0}; - GdkPoint _tmp0_ = {0}; - GdkPoint _tmp1_; - gint _tmp2_; - GdkPoint _tmp3_; - gint _tmp4_; - GdkPoint _tmp5_; - gint _tmp6_; - GdkPoint _tmp7_; - gint _tmp8_; -#line 291 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (p1 != NULL); -#line 291 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (p2 != NULL); -#line 292 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_.x = 0; -#line 292 "/home/jens/Source/shotwell/src/util/image.vala" - _result_ = _tmp0_; -#line 293 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = *p1; -#line 293 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp1_.x; -#line 293 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = *p2; -#line 293 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_.x; -#line 293 "/home/jens/Source/shotwell/src/util/image.vala" - _result_.x = _tmp2_ - _tmp4_; -#line 294 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = *p1; -#line 294 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_.y; -#line 294 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = *p2; -#line 294 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = _tmp7_.y; -#line 294 "/home/jens/Source/shotwell/src/util/image.vala" - _result_.y = _tmp6_ - _tmp8_; -#line 296 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _result_; -#line 296 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 1455 "image.c" -} - - -void -fix_cairo_pixbuf (GdkPixbuf* pixbuf) -{ - guchar* gdk_pixels = NULL; - void* _tmp0_; - void* _tmp1_; -#line 300 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); -#line 301 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = gdk_pixbuf_get_pixels (pixbuf); -#line 301 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp0_; -#line 301 "/home/jens/Source/shotwell/src/util/image.vala" - gdk_pixels = _tmp1_; -#line 1473 "image.c" - { - gint j = 0; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - j = 0; -#line 1478 "image.c" - { - gboolean _tmp2_ = FALSE; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = TRUE; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - while (TRUE) { -#line 1485 "image.c" - gint _tmp4_; - gint _tmp5_; - gint _tmp6_; - guchar* p = NULL; - guchar* _tmp7_; - guchar* end = NULL; - guchar* _tmp8_; - gint _tmp9_; - gint _tmp10_; - guchar* _tmp23_; - gint _tmp24_; - gint _tmp25_; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - if (!_tmp2_) { -#line 1500 "image.c" - gint _tmp3_; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = j; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - j = _tmp3_ + 1; -#line 1506 "image.c" - } -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = FALSE; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = j; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = gdk_pixbuf_get_height (pixbuf); -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_; -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - if (!(_tmp4_ < _tmp6_)) { -#line 302 "/home/jens/Source/shotwell/src/util/image.vala" - break; -#line 1520 "image.c" - } -#line 303 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = gdk_pixels; -#line 303 "/home/jens/Source/shotwell/src/util/image.vala" - p = _tmp7_; -#line 304 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = p; -#line 304 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = gdk_pixbuf_get_width (pixbuf); -#line 304 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = _tmp9_; -#line 304 "/home/jens/Source/shotwell/src/util/image.vala" - end = _tmp8_ + (4 * _tmp10_); -#line 306 "/home/jens/Source/shotwell/src/util/image.vala" - while (TRUE) { -#line 1536 "image.c" - guchar* _tmp11_; - guchar* _tmp12_; - guchar tmp = '\0'; - guchar* _tmp13_; - guchar _tmp14_; - guchar* _tmp15_; - guchar* _tmp16_; - guchar _tmp17_; - guchar _tmp18_; - guchar* _tmp19_; - guchar _tmp20_; - guchar _tmp21_; - guchar* _tmp22_; -#line 306 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = p; -#line 306 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = end; -#line 306 "/home/jens/Source/shotwell/src/util/image.vala" - if (!(_tmp11_ < _tmp12_)) { -#line 306 "/home/jens/Source/shotwell/src/util/image.vala" - break; -#line 1558 "image.c" - } -#line 307 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = p; -#line 307 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = _tmp13_[0]; -#line 307 "/home/jens/Source/shotwell/src/util/image.vala" - tmp = _tmp14_; -#line 309 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = p; -#line 309 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_ = p; -#line 309 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp17_ = _tmp16_[2]; -#line 309 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_[0] = _tmp17_; -#line 309 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp18_ = _tmp15_[0]; -#line 310 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp19_ = p; -#line 310 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp20_ = tmp; -#line 310 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp19_[2] = _tmp20_; -#line 310 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp21_ = _tmp19_[2]; -#line 317 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp22_ = p; -#line 317 "/home/jens/Source/shotwell/src/util/image.vala" - p = _tmp22_ + 4; -#line 1588 "image.c" - } -#line 320 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp23_ = gdk_pixels; -#line 320 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp24_ = gdk_pixbuf_get_rowstride (pixbuf); -#line 320 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp25_ = _tmp24_; -#line 320 "/home/jens/Source/shotwell/src/util/image.vala" - gdk_pixels = _tmp23_ + _tmp25_; -#line 1598 "image.c" - } - } - } -} - - -/** - * Finds the size of the smallest axially-aligned rectangle that could contain - * a rectangle src_width by src_height, rotated by angle. - * - * @param src_width The width of the incoming rectangle. - * @param src_height The height of the incoming rectangle. - * @param angle The amount to rotate by, given in degrees. - * @param dest_width The width of the computed rectangle. - * @param dest_height The height of the computed rectangle. - */ -void -compute_arb_rotated_size (gdouble src_width, - gdouble src_height, - gdouble angle, - gdouble* dest_width, - gdouble* dest_height) -{ - gdouble _vala_dest_width = 0.0; - gdouble _vala_dest_height = 0.0; -#line 337 "/home/jens/Source/shotwell/src/util/image.vala" - angle = fabs (degrees_to_radians (angle)); -#line 338 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (angle <= G_PI_2, "angle <= Math.PI_2"); -#line 339 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_dest_width = (src_width * cos (angle)) + (src_height * sin (angle)); -#line 340 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_dest_height = (src_height * cos (angle)) + (src_width * sin (angle)); -#line 334 "/home/jens/Source/shotwell/src/util/image.vala" - if (dest_width) { -#line 334 "/home/jens/Source/shotwell/src/util/image.vala" - *dest_width = _vala_dest_width; -#line 1636 "image.c" - } -#line 334 "/home/jens/Source/shotwell/src/util/image.vala" - if (dest_height) { -#line 334 "/home/jens/Source/shotwell/src/util/image.vala" - *dest_height = _vala_dest_height; -#line 1642 "image.c" - } -} - - -/** - * @brief Rotates a pixbuf to an arbitrary angle, given in degrees, and returns the rotated pixbuf. - * - * @param source_pixbuf The source image that needs to be angled. - * @param angle The angle the source image should be rotated by. - */ -GdkPixbuf* -rotate_arb (GdkPixbuf* source_pixbuf, - gdouble angle) -{ - GdkPixbuf* result = NULL; - gdouble x_tmp = 0.0; - gdouble y_tmp = 0.0; - gint _tmp1_; - gint _tmp2_; - gint _tmp3_; - gint _tmp4_; - gdouble _tmp5_ = 0.0; - gdouble _tmp6_ = 0.0; - GdkPixbuf* dest_pixbuf = NULL; - gdouble _tmp7_; - gdouble _tmp8_; - GdkPixbuf* _tmp9_; - cairo_format_t _tmp10_ = 0; - gboolean _tmp11_; - gboolean _tmp12_; - cairo_surface_t* surface = NULL; - GdkPixbuf* _tmp13_; - void* _tmp14_; - void* _tmp15_; - GdkPixbuf* _tmp16_; - gint _tmp17_; - gint _tmp18_; - GdkPixbuf* _tmp19_; - gint _tmp20_; - gint _tmp21_; - GdkPixbuf* _tmp22_; - gint _tmp23_; - gint _tmp24_; - cairo_surface_t* _tmp25_; - cairo_t* context = NULL; - cairo_surface_t* _tmp26_; - cairo_t* _tmp27_; - cairo_t* _tmp28_; - cairo_t* _tmp29_; - GdkPixbuf* _tmp30_; - gint _tmp31_; - gint _tmp32_; - GdkPixbuf* _tmp33_; - gint _tmp34_; - gint _tmp35_; - cairo_t* _tmp36_; - cairo_t* _tmp37_; - GdkPixbuf* _tmp38_; - gint _tmp39_; - gint _tmp40_; - GdkPixbuf* _tmp41_; - gint _tmp42_; - gint _tmp43_; - cairo_t* _tmp44_; - cairo_t* _tmp45_; - gint _tmp46_; - gint _tmp47_; - gint _tmp48_; - gint _tmp49_; - cairo_t* _tmp50_; - cairo_t* _tmp51_; - cairo_pattern_t* _tmp52_; - cairo_t* _tmp53_; - GdkPixbuf* _tmp54_; -#line 349 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_val_if_fail (GDK_IS_PIXBUF (source_pixbuf), NULL); -#line 353 "/home/jens/Source/shotwell/src/util/image.vala" - if (angle == 0.0) { -#line 1721 "image.c" - GdkPixbuf* _tmp0_; -#line 354 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = _g_object_ref0 (source_pixbuf); -#line 354 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp0_; -#line 354 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 1729 "image.c" - } -#line 361 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = gdk_pixbuf_get_width (source_pixbuf); -#line 361 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = _tmp1_; -#line 361 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = gdk_pixbuf_get_height (source_pixbuf); -#line 361 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_; -#line 361 "/home/jens/Source/shotwell/src/util/image.vala" - compute_arb_rotated_size ((gdouble) _tmp2_, (gdouble) _tmp4_, angle, &_tmp5_, &_tmp6_); -#line 361 "/home/jens/Source/shotwell/src/util/image.vala" - x_tmp = _tmp5_; -#line 361 "/home/jens/Source/shotwell/src/util/image.vala" - y_tmp = _tmp6_; -#line 364 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = x_tmp; -#line 364 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = y_tmp; -#line 364 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, (gint) round (_tmp7_), (gint) round (_tmp8_)); -#line 364 "/home/jens/Source/shotwell/src/util/image.vala" - dest_pixbuf = _tmp9_; -#line 369 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = gdk_pixbuf_get_has_alpha (source_pixbuf); -#line 369 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = _tmp11_; -#line 369 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp12_) { -#line 369 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = CAIRO_FORMAT_ARGB32; -#line 1761 "image.c" - } else { -#line 369 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = CAIRO_FORMAT_RGB24; -#line 1765 "image.c" - } -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = dest_pixbuf; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = gdk_pixbuf_get_pixels (_tmp13_); -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = _tmp14_; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_ = dest_pixbuf; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp17_ = gdk_pixbuf_get_width (_tmp16_); -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp18_ = _tmp17_; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp19_ = dest_pixbuf; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp20_ = gdk_pixbuf_get_height (_tmp19_); -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp21_ = _tmp20_; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp22_ = dest_pixbuf; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp23_ = gdk_pixbuf_get_rowstride (_tmp22_); -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp24_ = _tmp23_; -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp25_ = cairo_image_surface_create_for_data ((guchar*) _tmp15_, _tmp10_, _tmp18_, _tmp21_, _tmp24_); -#line 367 "/home/jens/Source/shotwell/src/util/image.vala" - surface = _tmp25_; -#line 372 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp26_ = surface; -#line 372 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp27_ = cairo_create (_tmp26_); -#line 372 "/home/jens/Source/shotwell/src/util/image.vala" - context = _tmp27_; -#line 374 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp28_ = context; -#line 374 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_set_source_rgb (_tmp28_, (gdouble) 0, (gdouble) 0, (gdouble) 0); -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp29_ = context; -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp30_ = dest_pixbuf; -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp31_ = gdk_pixbuf_get_width (_tmp30_); -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp32_ = _tmp31_; -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp33_ = dest_pixbuf; -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp34_ = gdk_pixbuf_get_height (_tmp33_); -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp35_ = _tmp34_; -#line 375 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_rectangle (_tmp29_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp32_, (gdouble) _tmp35_); -#line 376 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp36_ = context; -#line 376 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_fill (_tmp36_); -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp37_ = context; -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp38_ = dest_pixbuf; -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp39_ = gdk_pixbuf_get_width (_tmp38_); -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp40_ = _tmp39_; -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp41_ = dest_pixbuf; -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp42_ = gdk_pixbuf_get_height (_tmp41_); -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp43_ = _tmp42_; -#line 378 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_translate (_tmp37_, (gdouble) (_tmp40_ / 2), (gdouble) (_tmp43_ / 2)); -#line 379 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp44_ = context; -#line 379 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_rotate (_tmp44_, degrees_to_radians (angle)); -#line 380 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp45_ = context; -#line 380 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp46_ = gdk_pixbuf_get_width (source_pixbuf); -#line 380 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp47_ = _tmp46_; -#line 380 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp48_ = gdk_pixbuf_get_height (source_pixbuf); -#line 380 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp49_ = _tmp48_; -#line 380 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_translate (_tmp45_, (gdouble) ((-_tmp47_) / 2), (gdouble) ((-_tmp49_) / 2)); -#line 382 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp50_ = context; -#line 382 "/home/jens/Source/shotwell/src/util/image.vala" - gdk_cairo_set_source_pixbuf (_tmp50_, source_pixbuf, (gdouble) 0, (gdouble) 0); -#line 383 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp51_ = context; -#line 383 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp52_ = cairo_get_source (_tmp51_); -#line 383 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_pattern_set_filter (_tmp52_, CAIRO_FILTER_BEST); -#line 384 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp53_ = context; -#line 384 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_paint (_tmp53_); -#line 388 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp54_ = dest_pixbuf; -#line 388 "/home/jens/Source/shotwell/src/util/image.vala" - fix_cairo_pixbuf (_tmp54_); -#line 390 "/home/jens/Source/shotwell/src/util/image.vala" - result = dest_pixbuf; -#line 390 "/home/jens/Source/shotwell/src/util/image.vala" - _cairo_destroy0 (context); -#line 390 "/home/jens/Source/shotwell/src/util/image.vala" - _cairo_surface_destroy0 (surface); -#line 390 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 1883 "image.c" -} - - -/** - * @brief Rotates a point around the upper left corner of an image to an arbitrary angle, - * given in degrees, and returns the rotated point, translated such that it, along with its attendant - * image, are in positive x, positive y. - * - * @note May be subject to slight inaccuracy as Gdk points' coordinates may only be in whole pixels, - * so the fractional component is lost. - * - * @param source_point The point to be rotated and scaled. - * @param img_w The width of the source image (unrotated). - * @param img_h The height of the source image (unrotated). - * @param angle The angle the source image is to be rotated by to straighten it. - */ -void -rotate_point_arb (GdkPoint* source_point, - gint img_w, - gint img_h, - gdouble angle, - gboolean invert, - GdkPoint* result) -{ - gdouble dest_width = 0.0; - gdouble dest_height = 0.0; - gdouble _tmp1_ = 0.0; - gdouble _tmp2_ = 0.0; - cairo_matrix_t matrix = {0}; - gdouble _tmp3_; - gdouble _tmp4_; - gdouble dest_x = 0.0; - GdkPoint _tmp5_; - gint _tmp6_; - gdouble dest_y = 0.0; - GdkPoint _tmp7_; - gint _tmp8_; - gdouble _tmp9_; - gdouble _tmp10_; - GdkPoint _tmp11_ = {0}; -#line 406 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (source_point != NULL); -#line 409 "/home/jens/Source/shotwell/src/util/image.vala" - if (angle == 0.0) { -#line 1928 "image.c" - GdkPoint _tmp0_; -#line 411 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = *source_point; -#line 411 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _tmp0_; -#line 411 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 1936 "image.c" - } -#line 416 "/home/jens/Source/shotwell/src/util/image.vala" - compute_arb_rotated_size ((gdouble) img_w, (gdouble) img_h, angle, &_tmp1_, &_tmp2_); -#line 416 "/home/jens/Source/shotwell/src/util/image.vala" - dest_width = _tmp1_; -#line 416 "/home/jens/Source/shotwell/src/util/image.vala" - dest_height = _tmp2_; -#line 418 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_matrix_init_identity (&matrix); -#line 419 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = dest_width; -#line 419 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = dest_height; -#line 419 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_matrix_translate (&matrix, _tmp3_ / 2, _tmp4_ / 2); -#line 420 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_matrix_rotate (&matrix, degrees_to_radians (angle)); -#line 421 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_matrix_translate (&matrix, (gdouble) ((-img_w) / 2), (gdouble) ((-img_h) / 2)); -#line 422 "/home/jens/Source/shotwell/src/util/image.vala" - if (invert) { -#line 423 "/home/jens/Source/shotwell/src/util/image.vala" - _vala_assert (cairo_matrix_invert (&matrix) == CAIRO_STATUS_SUCCESS, "matrix.invert() == Cairo.Status.SUCCESS"); -#line 1960 "image.c" - } -#line 425 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = *source_point; -#line 425 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_.x; -#line 425 "/home/jens/Source/shotwell/src/util/image.vala" - dest_x = (gdouble) _tmp6_; -#line 426 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = *source_point; -#line 426 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = _tmp7_.y; -#line 426 "/home/jens/Source/shotwell/src/util/image.vala" - dest_y = (gdouble) _tmp8_; -#line 427 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_matrix_transform_point (&matrix, &dest_x, &dest_y); -#line 429 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = dest_x; -#line 429 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = dest_y; -#line 429 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_.x = (gint) _tmp9_; -#line 429 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_.y = (gint) _tmp10_; -#line 429 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _tmp11_; -#line 429 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 1988 "image.c" -} - - -/** - * @brief <u>De</u>rotates a point around the upper left corner of an image from an arbitrary angle, - * given in degrees, and returns the de-rotated point, taking into account any translation necessary - * to make sure all of the rotated image stays in positive x, positive y. - * - * @note May be subject to slight inaccuracy as Gdk points' coordinates may only be in whole pixels, - * so the fractional component is lost. - * - * @param source_point The point to be de-rotated. - * @param img_w The width of the source image (unrotated). - * @param img_h The height of the source image (unrotated). - * @param angle The angle the source image is to be rotated by to straighten it. - */ -void -derotate_point_arb (GdkPoint* source_point, - gint img_w, - gint img_h, - gdouble angle, - GdkPoint* result) -{ - GdkPoint _tmp0_; - GdkPoint _tmp1_ = {0}; -#line 445 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (source_point != NULL); -#line 446 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = *source_point; -#line 446 "/home/jens/Source/shotwell/src/util/image.vala" - rotate_point_arb (&_tmp0_, img_w, img_h, angle, TRUE, &_tmp1_); -#line 446 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _tmp1_; -#line 446 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 2024 "image.c" -} - - -static gpointer -_cairo_surface_reference0 (gpointer self) -{ -#line 484 "/home/jens/Source/shotwell/src/util/image.vala" - return self ? cairo_surface_reference (self) : NULL; -#line 2033 "image.c" -} - - -cairo_surface_t* -get_background_surface (void) -{ - cairo_surface_t* result = NULL; - cairo_surface_t* _tmp0_; - cairo_surface_t* _tmp31_; - cairo_surface_t* _tmp32_; -#line 452 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = background_surface; -#line 452 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp0_ == NULL) { -#line 2048 "image.c" - gchar* color_a = NULL; - gchar* color_b = NULL; - ConfigFacade* config = NULL; - ConfigFacade* _tmp1_; - gchar* type = NULL; - ConfigFacade* _tmp2_; - gchar* _tmp3_; - const gchar* _tmp4_; - const gchar* _tmp5_; - GQuark _tmp7_ = 0U; -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - static GQuark _tmp6_label0 = 0; -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - static GQuark _tmp6_label1 = 0; -#line 2063 "image.c" - cairo_surface_t* _tmp17_; - cairo_t* ctx = NULL; - cairo_surface_t* _tmp18_; - cairo_t* _tmp19_; - cairo_t* _tmp20_; - cairo_t* _tmp21_; - const gchar* _tmp22_; - cairo_t* _tmp23_; - cairo_t* _tmp24_; - cairo_t* _tmp25_; - cairo_t* _tmp26_; - const gchar* _tmp27_; - cairo_t* _tmp28_; - cairo_t* _tmp29_; - cairo_t* _tmp30_; -#line 455 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = config_facade_get_instance (); -#line 455 "/home/jens/Source/shotwell/src/util/image.vala" - config = _tmp1_; -#line 457 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = config; -#line 457 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = configuration_facade_get_transparent_background_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_CONFIGURATION_FACADE, ConfigurationFacade)); -#line 457 "/home/jens/Source/shotwell/src/util/image.vala" - type = _tmp3_; -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = type; -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = _tmp4_; -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = (NULL == _tmp5_) ? 0 : g_quark_from_string (_tmp5_); -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp7_ == ((0 != _tmp6_label0) ? _tmp6_label0 : (_tmp6_label0 = g_quark_from_static_string ("checkered")))) { -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - switch (0) { -#line 2099 "image.c" - default: - { - gchar* _tmp8_; - gchar* _tmp9_; -#line 460 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = g_strdup ("#808080"); -#line 460 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_a); -#line 460 "/home/jens/Source/shotwell/src/util/image.vala" - color_a = _tmp8_; -#line 461 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = g_strdup ("#ccc"); -#line 461 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_b); -#line 461 "/home/jens/Source/shotwell/src/util/image.vala" - color_b = _tmp9_; -#line 462 "/home/jens/Source/shotwell/src/util/image.vala" - break; -#line 2118 "image.c" - } - } - } else if (_tmp7_ == ((0 != _tmp6_label1) ? _tmp6_label1 : (_tmp6_label1 = g_quark_from_static_string ("solid")))) { -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - switch (0) { -#line 2124 "image.c" - default: - { - ConfigFacade* _tmp10_; - gchar* _tmp11_; - const gchar* _tmp12_; - gchar* _tmp13_; -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_ = config; -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp11_ = configuration_facade_get_transparent_background_color (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, TYPE_CONFIGURATION_FACADE, ConfigurationFacade)); -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_b); -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - color_b = _tmp11_; -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = color_b; -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = g_strdup (_tmp12_); -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_a); -#line 464 "/home/jens/Source/shotwell/src/util/image.vala" - color_a = _tmp13_; -#line 465 "/home/jens/Source/shotwell/src/util/image.vala" - break; -#line 2149 "image.c" - } - } - } else { -#line 458 "/home/jens/Source/shotwell/src/util/image.vala" - switch (0) { -#line 2155 "image.c" - default: - { - gchar* _tmp14_; - const gchar* _tmp15_; - gchar* _tmp16_; -#line 467 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = g_strdup ("#000"); -#line 467 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_b); -#line 467 "/home/jens/Source/shotwell/src/util/image.vala" - color_b = _tmp14_; -#line 467 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = color_b; -#line 467 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_ = g_strdup (_tmp15_); -#line 467 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_a); -#line 467 "/home/jens/Source/shotwell/src/util/image.vala" - color_a = _tmp16_; -#line 468 "/home/jens/Source/shotwell/src/util/image.vala" - break; -#line 2177 "image.c" - } - } - } -#line 471 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp17_ = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 16, 16); -#line 471 "/home/jens/Source/shotwell/src/util/image.vala" - _cairo_surface_destroy0 (background_surface); -#line 471 "/home/jens/Source/shotwell/src/util/image.vala" - background_surface = _tmp17_; -#line 472 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp18_ = background_surface; -#line 472 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp19_ = cairo_create (_tmp18_); -#line 472 "/home/jens/Source/shotwell/src/util/image.vala" - ctx = _tmp19_; -#line 473 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp20_ = ctx; -#line 473 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_set_operator (_tmp20_, CAIRO_OPERATOR_SOURCE); -#line 474 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp21_ = ctx; -#line 474 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp22_ = color_a; -#line 474 "/home/jens/Source/shotwell/src/util/image.vala" - set_source_color_from_string (_tmp21_, _tmp22_); -#line 475 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp23_ = ctx; -#line 475 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_rectangle (_tmp23_, (gdouble) 0, (gdouble) 0, (gdouble) 8, (gdouble) 8); -#line 476 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp24_ = ctx; -#line 476 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_rectangle (_tmp24_, (gdouble) 8, (gdouble) 8, (gdouble) 8, (gdouble) 8); -#line 477 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp25_ = ctx; -#line 477 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_fill (_tmp25_); -#line 478 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp26_ = ctx; -#line 478 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp27_ = color_b; -#line 478 "/home/jens/Source/shotwell/src/util/image.vala" - set_source_color_from_string (_tmp26_, _tmp27_); -#line 479 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp28_ = ctx; -#line 479 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_rectangle (_tmp28_, (gdouble) 0, (gdouble) 8, (gdouble) 8, (gdouble) 8); -#line 480 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp29_ = ctx; -#line 480 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_rectangle (_tmp29_, (gdouble) 8, (gdouble) 0, (gdouble) 8, (gdouble) 8); -#line 481 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp30_ = ctx; -#line 481 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_fill (_tmp30_); -#line 452 "/home/jens/Source/shotwell/src/util/image.vala" - _cairo_destroy0 (ctx); -#line 452 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (type); -#line 452 "/home/jens/Source/shotwell/src/util/image.vala" - _g_object_unref0 (config); -#line 452 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_b); -#line 452 "/home/jens/Source/shotwell/src/util/image.vala" - _g_free0 (color_a); -#line 2243 "image.c" - } -#line 484 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp31_ = background_surface; -#line 484 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp32_ = _cairo_surface_reference0 (_tmp31_); -#line 484 "/home/jens/Source/shotwell/src/util/image.vala" - result = _tmp32_; -#line 484 "/home/jens/Source/shotwell/src/util/image.vala" - return result; -#line 2253 "image.c" -} - - -void -invalidate_transparent_background (void) -{ -#line 488 "/home/jens/Source/shotwell/src/util/image.vala" - _cairo_surface_destroy0 (background_surface); -#line 488 "/home/jens/Source/shotwell/src/util/image.vala" - background_surface = NULL; -#line 2264 "image.c" -} - - -void -paint_pixmap_with_background (cairo_t* ctx, - GdkPixbuf* pixbuf, - gint x, - gint y) -{ -#line 491 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (ctx != NULL); -#line 491 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); -#line 492 "/home/jens/Source/shotwell/src/util/image.vala" - if (gdk_pixbuf_get_has_alpha (pixbuf)) { -#line 2280 "image.c" - cairo_surface_t* _tmp0_; - cairo_surface_t* _tmp1_; - cairo_pattern_t* _tmp2_; - gint _tmp3_; - gint _tmp4_; - gint _tmp5_; - gint _tmp6_; -#line 493 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = get_background_surface (); -#line 493 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp0_; -#line 493 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_set_source_surface (ctx, _tmp1_, (gdouble) 0, (gdouble) 0); -#line 493 "/home/jens/Source/shotwell/src/util/image.vala" - _cairo_surface_destroy0 (_tmp1_); -#line 494 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = cairo_get_source (ctx); -#line 494 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_pattern_set_extend (_tmp2_, CAIRO_EXTEND_REPEAT); -#line 495 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = gdk_pixbuf_get_width (pixbuf); -#line 495 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_ = _tmp3_; -#line 495 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp5_ = gdk_pixbuf_get_height (pixbuf); -#line 495 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = _tmp5_; -#line 495 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_rectangle (ctx, (gdouble) x, (gdouble) y, (gdouble) _tmp4_, (gdouble) _tmp6_); -#line 496 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_fill (ctx); -#line 2312 "image.c" - } -#line 499 "/home/jens/Source/shotwell/src/util/image.vala" - gdk_cairo_set_source_pixbuf (ctx, pixbuf, (gdouble) x, (gdouble) y); -#line 500 "/home/jens/Source/shotwell/src/util/image.vala" - cairo_paint (ctx); -#line 2318 "image.c" -} - - -void -clamp_inside_rotated_image (Box* src, - gint img_w, - gint img_h, - gdouble angle_deg, - gboolean preserve_geom, - Box* result) -{ - GdkPoint top_left = {0}; - Box _tmp0_; - gint _tmp1_; - Box _tmp2_; - gint _tmp3_; - GdkPoint _tmp4_ = {0}; - GdkPoint _tmp5_ = {0}; - GdkPoint top_right = {0}; - Box _tmp6_; - gint _tmp7_; - Box _tmp8_; - gint _tmp9_; - GdkPoint _tmp10_ = {0}; - GdkPoint _tmp11_ = {0}; - GdkPoint bottom_left = {0}; - Box _tmp12_; - gint _tmp13_; - Box _tmp14_; - gint _tmp15_; - GdkPoint _tmp16_ = {0}; - GdkPoint _tmp17_ = {0}; - GdkPoint bottom_right = {0}; - Box _tmp18_; - gint _tmp19_; - Box _tmp20_; - gint _tmp21_; - GdkPoint _tmp22_ = {0}; - GdkPoint _tmp23_ = {0}; - gdouble angle = 0.0; - gint top_offset = 0; - gint bottom_offset = 0; - gint left_offset = 0; - gint right_offset = 0; - gint top = 0; - GdkPoint _tmp24_; - gint _tmp25_; - GdkPoint _tmp26_; - gint _tmp27_; - gint _tmp28_; - gint bottom = 0; - GdkPoint _tmp31_; - gint _tmp32_; - GdkPoint _tmp33_; - gint _tmp34_; - gint _tmp35_; - gint left = 0; - GdkPoint _tmp38_; - gint _tmp39_; - GdkPoint _tmp40_; - gint _tmp41_; - gint _tmp42_; - gint right = 0; - GdkPoint _tmp45_; - gint _tmp46_; - GdkPoint _tmp47_; - gint _tmp48_; - gint _tmp49_; - Box _tmp52_ = {0}; -#line 504 "/home/jens/Source/shotwell/src/util/image.vala" - g_return_if_fail (src != NULL); -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp0_ = *src; -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp1_ = _tmp0_.left; -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp2_ = *src; -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp3_ = _tmp2_.top; -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_.x = _tmp1_; -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp4_.y = _tmp3_; -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - derotate_point_arb (&_tmp4_, img_w, img_h, angle_deg, &_tmp5_); -#line 507 "/home/jens/Source/shotwell/src/util/image.vala" - top_left = _tmp5_; -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp6_ = *src; -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp7_ = _tmp6_.right; -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp8_ = *src; -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp9_ = _tmp8_.top; -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_.x = _tmp7_; -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp10_.y = _tmp9_; -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - derotate_point_arb (&_tmp10_, img_w, img_h, angle_deg, &_tmp11_); -#line 508 "/home/jens/Source/shotwell/src/util/image.vala" - top_right = _tmp11_; -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp12_ = *src; -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp13_ = _tmp12_.left; -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp14_ = *src; -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp15_ = _tmp14_.bottom; -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_.x = _tmp13_; -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp16_.y = _tmp15_; -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - derotate_point_arb (&_tmp16_, img_w, img_h, angle_deg, &_tmp17_); -#line 509 "/home/jens/Source/shotwell/src/util/image.vala" - bottom_left = _tmp17_; -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp18_ = *src; -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp19_ = _tmp18_.right; -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp20_ = *src; -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp21_ = _tmp20_.bottom; -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp22_.x = _tmp19_; -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp22_.y = _tmp21_; -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - derotate_point_arb (&_tmp22_, img_w, img_h, angle_deg, &_tmp23_); -#line 510 "/home/jens/Source/shotwell/src/util/image.vala" - bottom_right = _tmp23_; -#line 512 "/home/jens/Source/shotwell/src/util/image.vala" - angle = degrees_to_radians (angle_deg); -#line 513 "/home/jens/Source/shotwell/src/util/image.vala" - top_offset = 0; -#line 513 "/home/jens/Source/shotwell/src/util/image.vala" - bottom_offset = 0; -#line 513 "/home/jens/Source/shotwell/src/util/image.vala" - left_offset = 0; -#line 513 "/home/jens/Source/shotwell/src/util/image.vala" - right_offset = 0; -#line 515 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp24_ = top_left; -#line 515 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp25_ = _tmp24_.y; -#line 515 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp26_ = top_right; -#line 515 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp27_ = _tmp26_.y; -#line 515 "/home/jens/Source/shotwell/src/util/image.vala" - top = MIN (_tmp25_, _tmp27_); -#line 516 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp28_ = top; -#line 516 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp28_ < 0) { -#line 2478 "image.c" - gint _tmp29_; - gdouble _tmp30_; -#line 517 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp29_ = top; -#line 517 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp30_ = angle; -#line 517 "/home/jens/Source/shotwell/src/util/image.vala" - top_offset = (gint) ((0 - _tmp29_) * cos (_tmp30_)); -#line 2487 "image.c" - } -#line 519 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp31_ = bottom_left; -#line 519 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp32_ = _tmp31_.y; -#line 519 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp33_ = bottom_right; -#line 519 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp34_ = _tmp33_.y; -#line 519 "/home/jens/Source/shotwell/src/util/image.vala" - bottom = MAX (_tmp32_, _tmp34_); -#line 520 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp35_ = bottom; -#line 520 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp35_ > img_h) { -#line 2503 "image.c" - gint _tmp36_; - gdouble _tmp37_; -#line 521 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp36_ = bottom; -#line 521 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp37_ = angle; -#line 521 "/home/jens/Source/shotwell/src/util/image.vala" - bottom_offset = (gint) ((img_h - _tmp36_) * cos (_tmp37_)); -#line 2512 "image.c" - } -#line 523 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp38_ = top_left; -#line 523 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp39_ = _tmp38_.x; -#line 523 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp40_ = bottom_left; -#line 523 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp41_ = _tmp40_.x; -#line 523 "/home/jens/Source/shotwell/src/util/image.vala" - left = MIN (_tmp39_, _tmp41_); -#line 524 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp42_ = left; -#line 524 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp42_ < 0) { -#line 2528 "image.c" - gint _tmp43_; - gdouble _tmp44_; -#line 525 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp43_ = left; -#line 525 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp44_ = angle; -#line 525 "/home/jens/Source/shotwell/src/util/image.vala" - left_offset = (gint) ((0 - _tmp43_) * cos (_tmp44_)); -#line 2537 "image.c" - } -#line 527 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp45_ = top_right; -#line 527 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp46_ = _tmp45_.x; -#line 527 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp47_ = bottom_right; -#line 527 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp48_ = _tmp47_.x; -#line 527 "/home/jens/Source/shotwell/src/util/image.vala" - right = MAX (_tmp46_, _tmp48_); -#line 528 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp49_ = right; -#line 528 "/home/jens/Source/shotwell/src/util/image.vala" - if (_tmp49_ > img_w) { -#line 2553 "image.c" - gint _tmp50_; - gdouble _tmp51_; -#line 529 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp50_ = right; -#line 529 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp51_ = angle; -#line 529 "/home/jens/Source/shotwell/src/util/image.vala" - right_offset = (gint) ((img_w - _tmp50_) * cos (_tmp51_)); -#line 2562 "image.c" - } -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - if (preserve_geom) { -#line 2566 "image.c" - gint _tmp53_; - gint _tmp54_; - gint _tmp55_; - gint _tmp56_; - Box _tmp57_ = {0}; -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp53_ = left_offset; -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp54_ = right_offset; -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp55_ = top_offset; -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp56_ = bottom_offset; -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - box_get_offset (src, _tmp53_ + _tmp54_, _tmp55_ + _tmp56_, &_tmp57_); -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp52_ = _tmp57_; -#line 2584 "image.c" - } else { - Box _tmp58_; - gint _tmp59_; - gint _tmp60_; - Box _tmp61_; - gint _tmp62_; - gint _tmp63_; - Box _tmp64_; - gint _tmp65_; - gint _tmp66_; - Box _tmp67_; - gint _tmp68_; - gint _tmp69_; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp58_ = *src; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp59_ = _tmp58_.left; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp60_ = left_offset; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp61_ = *src; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp62_ = _tmp61_.top; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp63_ = top_offset; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp64_ = *src; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp65_ = _tmp64_.right; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp66_ = right_offset; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp67_ = *src; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp68_ = _tmp67_.bottom; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - _tmp69_ = bottom_offset; -#line 532 "/home/jens/Source/shotwell/src/util/image.vala" - box_init (&_tmp52_, _tmp59_ + _tmp60_, _tmp62_ + _tmp63_, _tmp65_ + _tmp66_, _tmp68_ + _tmp69_); -#line 2624 "image.c" - } -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - *result = _tmp52_; -#line 531 "/home/jens/Source/shotwell/src/util/image.vala" - return; -#line 2630 "image.c" -} - - - diff --git a/src/util/image.vala b/src/util/image.vala index f8646e2..0a30339 100644 --- a/src/util/image.vala +++ b/src/util/image.vala @@ -4,121 +4,6 @@ * See the COPYING file in this distribution. */ - -/* XPM */ -private const string fallback_image_missing[] = { -/* columns rows colors chars-per-pixel */ -"48 48 54 1 ", -" c #6A6D67", -". c #6C6E69", -"X c #72746F", -"o c #747672", -"O c #777974", -"+ c #797B77", -"@ c #7C7E7A", -"# c #7F817C", -"$ c #81837F", -"% c #848682", -"& c #878984", -"* c #888A86", -"= c #8C8D8A", -"- c #8F908C", -"; c #90928E", -": c #949591", -"> c #969894", -", c #999B96", -"< c #9C9E9A", -"1 c #9FA09C", -"2 c #A1A39E", -"3 c #A4A6A2", -"4 c #A6A9A4", -"5 c #A9ABA6", -"6 c #ACADA9", -"7 c #AEB1AB", -"8 c #B1B2AF", -"9 c #B3B4B1", -"0 c #B6B9B3", -"q c #B9BCB6", -"w c #BDBEBA", -"e c #BEC2BB", -"r c #C1C4BE", -"t c #C5C5C2", -"y c #C6C9C3", -"u c #C9CCC6", -"i c #CCCDCB", -"p c #CED2CA", -"a c #D2D6CE", -"s c #D5D5D3", -"d c #D7D8D5", -"f c #D9D9D6", -"g c #DCDCDA", -"h c #DFE0DD", -"j c #E0E0DE", -"k c #E4E4E2", -"l c #E7E8E5", -"z c #E9E9E7", -"x c #EDEDEC", -"c c #EFF0EE", -"v c #F1F1EF", -"b c #F2F2F1", -"n c #FFFFFF", -"m c None", -/* pixels */ -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmaaaaaaaaaasaisaaaaaaaaaaaaaaaaaaapppiipuuuuumm", -"mannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnym", -"manbbbbbbbbbvbbvvvvxvvvbvvvvvvvvccccccxxvxvxxnym", -"manbt89898888988888888888999999999999999999txnrm", -"manb6======================-;;=;;;;;;;;;;=:7znrm", -"manv6&%%**%*%%%%*%%****=======;==;;;;=;=;==7znem", -"manv4%%%%$%%%%%%%%%%%=****=======;==-======6znwm", -"manx3%%#$$$$##%#$%%%*%**==========-=--=====6znqm", -"manx1$@%#$@$###%%%%=****=*===--;;----====*=5lnqm", -"manx<@@@@@@@@##%$%%%%****========-==-======5kn0m", -"manz<@@@+@+@@@#$%%%%%=%=%===;=:=--------=-*4kn8m", -"manz>O+O+O+@@@#$$%%%%========;;=--------=*=3kn9m", -"mpnl:OOOOO+@@$##%%%%%=%=====;=;;--;-----===3kn8m", -"munl;OooOOO@@@#$%%%%%======;;;;;:;;;;;---==1hn7m", -"munl;oXoOO+@###$%%=%=======;::;::::;;---&#+-gn7m", -"mynk*XXooOO+$$#$%%%%=%===;;:;:::::;:-$#XooX-fn5m", -"mynk*XXOOO@@$$$$%%=%====;::::>::;*#OXXXXXXX*dn5m", -"mrnk*oOO@@@#$$$$%=====::::>>>=%@OXOooXXXooo&dn3m", -"mrnj*++@$$$$**$===-;;::>>:=@Ooo@XOOoo#o#OOO=fn3m", -"menj*@#$$$$$**===;;:::=%@@@@@@O@#O#Oo#o#++@;gn2m", -"menj*$$$$&**===;:;=*#@@@@@@@@@@@#######o##%>gn2m", -"menh*$$%**===;=*%###########%@@@###$####$%=,gn1m", -"m0nj=%***=**&$$$%$$$%$$%$$$$%$$$$$$$$$$%*;:2hn<m", -"m0nj****&&&$$&&$%%%%%%%%%%%%%%%%$$*$%%%*;>13gn,m", -"m0ng****&&&&&&&&&&&&*%*%*%%*%******%**-:,136kz;m", -"m0nh***$&&&&&&&&&&&&%**********%*$***;:,1358r7*m", -"m8ng*&&&&&&&&&*$&*&&&&$=$=$=&&&&&&**=:,<11>$65mm", -"m7ng*&&&&&&&&&**&&&&&&**=$-$&&&&&&*-:,1..&1wi:mm", -"m7ng&&&&&&&&=$*$&&&&&***$$$$&&&***=>,1<onxsi6*mm", -"m6nf*&&&&&*&$***&&&&*$*$--$-&&&%*=;,13,:ztw9%mmm", -"m5nf*%&&&&&&=$=$%*&&**%*$$&&&&**=>,225;5srw%mmmm", -"m4nf3*&&**&&$-$-*******%$;&&*&*->,2365+ui7$mmmmm", -"m3nsfffdddsddaffssssdassgaaaassddfgjg4wu;ommmmmm", -"m3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnvq3<$.mmmmmmm", -"mm2211111,<,,,,,,>>>>:::;::;----=====@mmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", -"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm" -}; - -bool is_color_parsable(string spec) { - var color = Gdk.RGBA (); - return color.parse(spec); -} - Gdk.RGBA parse_color(string spec) { return fetch_color(spec); } @@ -148,7 +33,11 @@ Gdk.Pixbuf get_placeholder_pixbuf () { pixbuf = icon_theme.load_icon("image-missing", Gtk.IconSize.DIALOG, 0); } catch (Error error) { - pixbuf = new Gdk.Pixbuf.from_xpm_data(fallback_image_missing); + try { + pixbuf = new Gdk.Pixbuf.from_resource("/org/gnome/Shotwell/icons/image-missing.png"); + } catch (Error err) { + warning("Could not load fall-back icon: %s", err.message); + } warning("Could not load icon from theme: %s", error.message); } diff --git a/src/util/misc.c b/src/util/misc.c deleted file mode 100644 index cfc0b70..0000000 --- a/src/util/misc.c +++ /dev/null @@ -1,3020 +0,0 @@ -/* misc.c generated by valac 0.40.4, the Vala compiler - * generated from misc.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU LGPL (version 2.1 or later). - * See the COPYING file in this distribution. - */ - - -#include <glib.h> -#include <glib-object.h> -#include <time.h> -#include <gio/gio.h> -#include <stdlib.h> -#include <string.h> -#include <gee.h> -#include <gdk/gdk.h> -#include <float.h> -#include <math.h> -#include <gobject/gvaluecollector.h> - -#define _g_checksum_free0(var) ((var == NULL) ? NULL : (var = (g_checksum_free (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -#define TYPE_DATA_OBJECT (data_object_get_type ()) -#define DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_OBJECT, DataObject)) -#define DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_OBJECT, DataObjectClass)) -#define IS_DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_OBJECT)) -#define IS_DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_OBJECT)) -#define DATA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_OBJECT, DataObjectClass)) - -typedef struct _DataObject DataObject; -typedef struct _DataObjectClass DataObjectClass; - -#define TYPE_DATA_SOURCE (data_source_get_type ()) -#define DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_SOURCE, DataSource)) -#define DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_SOURCE, DataSourceClass)) -#define IS_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_SOURCE)) -#define IS_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_SOURCE)) -#define DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_SOURCE, DataSourceClass)) - -typedef struct _DataSource DataSource; -typedef struct _DataSourceClass DataSourceClass; - -#define TYPE_THUMBNAIL_SOURCE (thumbnail_source_get_type ()) -#define THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSource)) -#define THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass)) -#define IS_THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAIL_SOURCE)) -#define IS_THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAIL_SOURCE)) -#define THUMBNAIL_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass)) - -typedef struct _ThumbnailSource ThumbnailSource; -typedef struct _ThumbnailSourceClass ThumbnailSourceClass; - -#define TYPE_MEDIA_SOURCE (media_source_get_type ()) -#define MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_SOURCE, MediaSource)) -#define MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_SOURCE, MediaSourceClass)) -#define IS_MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_SOURCE)) -#define IS_MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_SOURCE)) -#define MEDIA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_SOURCE, MediaSourceClass)) - -typedef struct _MediaSource MediaSource; -typedef struct _MediaSourceClass MediaSourceClass; - -#define TYPE_PHOTO_SOURCE (photo_source_get_type ()) -#define PHOTO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_SOURCE, PhotoSource)) -#define PHOTO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_SOURCE, PhotoSourceClass)) -#define IS_PHOTO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_SOURCE)) -#define IS_PHOTO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_SOURCE)) -#define PHOTO_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_SOURCE, PhotoSourceClass)) - -typedef struct _PhotoSource PhotoSource; -typedef struct _PhotoSourceClass PhotoSourceClass; - -#define TYPE_PHOTO (photo_get_type ()) -#define PHOTO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO, Photo)) -#define PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO, PhotoClass)) -#define IS_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO)) -#define IS_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO)) -#define PHOTO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO, PhotoClass)) - -typedef struct _Photo Photo; -typedef struct _PhotoClass PhotoClass; - -#define TYPE_PHOTO_ID (photo_id_get_type ()) -typedef struct _PhotoID PhotoID; - -#define TYPE_MEDIA_COLLECTION_REGISTRY (media_collection_registry_get_type ()) -#define MEDIA_COLLECTION_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistry)) -#define MEDIA_COLLECTION_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistryClass)) -#define IS_MEDIA_COLLECTION_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_COLLECTION_REGISTRY)) -#define IS_MEDIA_COLLECTION_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_COLLECTION_REGISTRY)) -#define MEDIA_COLLECTION_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistryClass)) - -typedef struct _MediaCollectionRegistry MediaCollectionRegistry; -typedef struct _MediaCollectionRegistryClass MediaCollectionRegistryClass; -#define _media_collection_registry_unref0(var) ((var == NULL) ? NULL : (var = (media_collection_registry_unref (var), NULL))) - -#define TYPE_ONE_SHOT_SCHEDULER (one_shot_scheduler_get_type ()) -#define ONE_SHOT_SCHEDULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ONE_SHOT_SCHEDULER, OneShotScheduler)) -#define ONE_SHOT_SCHEDULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ONE_SHOT_SCHEDULER, OneShotSchedulerClass)) -#define IS_ONE_SHOT_SCHEDULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ONE_SHOT_SCHEDULER)) -#define IS_ONE_SHOT_SCHEDULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ONE_SHOT_SCHEDULER)) -#define ONE_SHOT_SCHEDULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ONE_SHOT_SCHEDULER, OneShotSchedulerClass)) - -typedef struct _OneShotScheduler OneShotScheduler; -typedef struct _OneShotSchedulerClass OneShotSchedulerClass; -typedef struct _OneShotSchedulerPrivate OneShotSchedulerPrivate; -typedef struct _ParamSpecOneShotScheduler ParamSpecOneShotScheduler; - -#define TYPE_OP_TIMER (op_timer_get_type ()) -#define OP_TIMER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_OP_TIMER, OpTimer)) -#define OP_TIMER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_OP_TIMER, OpTimerClass)) -#define IS_OP_TIMER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_OP_TIMER)) -#define IS_OP_TIMER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_OP_TIMER)) -#define OP_TIMER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_OP_TIMER, OpTimerClass)) - -typedef struct _OpTimer OpTimer; -typedef struct _OpTimerClass OpTimerClass; -typedef struct _OpTimerPrivate OpTimerPrivate; -#define _g_timer_destroy0(var) ((var == NULL) ? NULL : (var = (g_timer_destroy (var), NULL))) -typedef struct _ParamSpecOpTimer ParamSpecOpTimer; -#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); -#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } -#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } -#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); - -typedef gboolean (*ValueEqualFunc) (GValue* a, GValue* b, void* user_data); -struct _PhotoID { - gint64 id; -}; - -typedef void (*OneShotCallback) (void* user_data); -struct _OneShotScheduler { - GTypeInstance parent_instance; - volatile int ref_count; - OneShotSchedulerPrivate * priv; -}; - -struct _OneShotSchedulerClass { - GTypeClass parent_class; - void (*finalize) (OneShotScheduler *self); -}; - -struct _OneShotSchedulerPrivate { - gchar* name; - OneShotCallback callback; - gpointer callback_target; - guint scheduled; -}; - -struct _ParamSpecOneShotScheduler { - GParamSpec parent_instance; -}; - -struct _OpTimer { - GTypeInstance parent_instance; - volatile int ref_count; - OpTimerPrivate * priv; -}; - -struct _OpTimerClass { - GTypeClass parent_class; - void (*finalize) (OpTimer *self); -}; - -struct _OpTimerPrivate { - gchar* name; - GTimer* timer; - glong count; - gdouble elapsed; - gdouble shortest; - gdouble longest; -}; - -struct _ParamSpecOpTimer { - GParamSpec parent_instance; -}; - - -static gpointer one_shot_scheduler_parent_class = NULL; -static gpointer op_timer_parent_class = NULL; - -guint int64_hash (gint64* n); -gboolean int64_equal (gint64* a, - gint64* b); -gint int64_compare (gint64* a, - gint64* b); -gint uint64_compare (guint64* a, - guint64* b); -gboolean bool_value_equals (GValue* a, - GValue* b); -gboolean int_value_equals (GValue* a, - GValue* b); -gulong timeval_to_ms (GTimeVal* time_val); -gulong now_ms (void); -gulong now_sec (void); -time_t now_time_t (void); -gchar* md5_file (GFile* file, - GError** error); -gboolean equal_sets (GeeSet* a, - GeeSet* b); -GeeSet* intersection_of_sets (GeeSet* a, - GeeSet* b, - GeeSet* excluded); -GType data_object_get_type (void) G_GNUC_CONST; -GType data_source_get_type (void) G_GNUC_CONST; -GType thumbnail_source_get_type (void) G_GNUC_CONST; -GType media_source_get_type (void) G_GNUC_CONST; -GType photo_source_get_type (void) G_GNUC_CONST; -GType photo_get_type (void) G_GNUC_CONST; -guchar* serialize_photo_ids (GeeCollection* photos, - int* result_length1); -GType photo_id_get_type (void) G_GNUC_CONST; -PhotoID* photo_id_dup (const PhotoID* self); -void photo_id_free (PhotoID* self); -void photo_get_photo_id (Photo* self, - PhotoID* result); -GeeList* unserialize_photo_ids (guchar* serialized, - gint size); -void photo_id_init (PhotoID *self, - gint64 id); -guchar* serialize_media_sources (GeeCollection* media, - int* result_length1); -gchar* data_source_get_source_id (DataSource* self); -GeeList* unserialize_media_sources (guchar* serialized, - gint size); -gpointer media_collection_registry_ref (gpointer instance); -void media_collection_registry_unref (gpointer instance); -GParamSpec* param_spec_media_collection_registry (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags); -void value_set_media_collection_registry (GValue* value, - gpointer v_object); -void value_take_media_collection_registry (GValue* value, - gpointer v_object); -gpointer value_get_media_collection_registry (const GValue* value); -GType media_collection_registry_get_type (void) G_GNUC_CONST; -MediaCollectionRegistry* media_collection_registry_get_instance (void); -MediaSource* media_collection_registry_fetch_media (MediaCollectionRegistry* self, - const gchar* source_id); -gchar* format_local_datespan (struct tm* from_date, - struct tm* to_date); -gchar* resources_get_start_multiday_span_format_string (void); -gchar* resources_get_end_multiday_span_format_string (void); -gchar* resources_get_start_multimonth_span_format_string (void); -gchar* resources_get_end_multimonth_span_format_string (void); -gchar* resources_get_long_date_format_string (void); -gchar* string_strip_leading_zeroes (const gchar* str); -gchar* format_local_date (struct tm* date); -gpointer one_shot_scheduler_ref (gpointer instance); -void one_shot_scheduler_unref (gpointer instance); -GParamSpec* param_spec_one_shot_scheduler (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags); -void value_set_one_shot_scheduler (GValue* value, - gpointer v_object); -void value_take_one_shot_scheduler (GValue* value, - gpointer v_object); -gpointer value_get_one_shot_scheduler (const GValue* value); -GType one_shot_scheduler_get_type (void) G_GNUC_CONST; -#define ONE_SHOT_SCHEDULER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_ONE_SHOT_SCHEDULER, OneShotSchedulerPrivate)) -void one_shot_scheduler_cancel (OneShotScheduler* self); -OneShotScheduler* one_shot_scheduler_new (const gchar* name, - OneShotCallback callback, - void* callback_target); -OneShotScheduler* one_shot_scheduler_construct (GType object_type, - const gchar* name, - OneShotCallback callback, - void* callback_target); -gboolean one_shot_scheduler_is_scheduled (OneShotScheduler* self); -void one_shot_scheduler_at_idle (OneShotScheduler* self); -void one_shot_scheduler_at_priority_idle (OneShotScheduler* self, - gint priority); -static gboolean one_shot_scheduler_callback_wrapper (OneShotScheduler* self); -static gboolean _one_shot_scheduler_callback_wrapper_gsource_func (gpointer self); -void one_shot_scheduler_after_timeout (OneShotScheduler* self, - guint msec, - gboolean reschedule); -void one_shot_scheduler_priority_after_timeout (OneShotScheduler* self, - gint priority, - guint msec, - gboolean reschedule); -static void one_shot_scheduler_finalize (OneShotScheduler * obj); -gpointer op_timer_ref (gpointer instance); -void op_timer_unref (gpointer instance); -GParamSpec* param_spec_op_timer (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags); -void value_set_op_timer (GValue* value, - gpointer v_object); -void value_take_op_timer (GValue* value, - gpointer v_object); -gpointer value_get_op_timer (const GValue* value); -GType op_timer_get_type (void) G_GNUC_CONST; -#define OP_TIMER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_OP_TIMER, OpTimerPrivate)) -OpTimer* op_timer_new (const gchar* name); -OpTimer* op_timer_construct (GType object_type, - const gchar* name); -void op_timer_start (OpTimer* self); -void op_timer_stop (OpTimer* self); -gchar* op_timer_to_string (OpTimer* self); -static void op_timer_finalize (OpTimer * obj); - - -guint -int64_hash (gint64* n) -{ - guint result = 0U; - guint8* u8 = NULL; - guint hash = 0U; -#line 9 "/home/jens/Source/shotwell/src/util/misc.vala" - u8 = (guint8*) n; -#line 10 "/home/jens/Source/shotwell/src/util/misc.vala" - hash = (guint) 0; -#line 326 "misc.c" - { - gint ctr = 0; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - ctr = 0; -#line 331 "misc.c" - { - gboolean _tmp0_ = FALSE; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = TRUE; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - while (TRUE) { -#line 338 "misc.c" - gint _tmp2_; - guint _tmp3_; - guint _tmp4_; - guint8* _tmp5_; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!_tmp0_) { -#line 345 "misc.c" - gint _tmp1_; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = ctr; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - ctr = _tmp1_ + 1; -#line 351 "misc.c" - } -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = FALSE; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = ctr; -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!(((gulong) _tmp2_) < (sizeof (gint64) / sizeof (guint8)))) { -#line 11 "/home/jens/Source/shotwell/src/util/misc.vala" - break; -#line 361 "misc.c" - } -#line 12 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = hash; -#line 12 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = hash; -#line 12 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = u8; -#line 12 "/home/jens/Source/shotwell/src/util/misc.vala" - u8 = _tmp5_ + 1; -#line 12 "/home/jens/Source/shotwell/src/util/misc.vala" - hash = ((_tmp3_ << 4) ^ (_tmp4_ >> 28)) ^ (*_tmp5_); -#line 373 "misc.c" - } - } - } -#line 15 "/home/jens/Source/shotwell/src/util/misc.vala" - result = hash; -#line 15 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 381 "misc.c" -} - - -gboolean -int64_equal (gint64* a, - gint64* b) -{ - gboolean result = FALSE; - gint64* bia = NULL; - gint64* bib = NULL; -#line 19 "/home/jens/Source/shotwell/src/util/misc.vala" - bia = (gint64*) a; -#line 20 "/home/jens/Source/shotwell/src/util/misc.vala" - bib = (gint64*) b; -#line 22 "/home/jens/Source/shotwell/src/util/misc.vala" - result = (*bia) == (*bib); -#line 22 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 400 "misc.c" -} - - -gint -int64_compare (gint64* a, - gint64* b) -{ - gint result = 0; - gint64 diff = 0LL; - gint64 _tmp0_; -#line 26 "/home/jens/Source/shotwell/src/util/misc.vala" - diff = (*((gint64*) a)) - (*((gint64*) b)); -#line 27 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = diff; -#line 27 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_ < ((gint64) 0)) { -#line 28 "/home/jens/Source/shotwell/src/util/misc.vala" - result = -1; -#line 28 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 421 "misc.c" - } else { - gint64 _tmp1_; -#line 29 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = diff; -#line 29 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp1_ > ((gint64) 0)) { -#line 30 "/home/jens/Source/shotwell/src/util/misc.vala" - result = 1; -#line 30 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 432 "misc.c" - } else { -#line 32 "/home/jens/Source/shotwell/src/util/misc.vala" - result = 0; -#line 32 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 438 "misc.c" - } - } -} - - -gint -uint64_compare (guint64* a, - guint64* b) -{ - gint result = 0; - guint64 a64 = 0ULL; - guint64 b64 = 0ULL; - guint64 _tmp0_; - guint64 _tmp1_; -#line 36 "/home/jens/Source/shotwell/src/util/misc.vala" - a64 = *((guint64*) a); -#line 37 "/home/jens/Source/shotwell/src/util/misc.vala" - b64 = *((guint64*) b); -#line 39 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = a64; -#line 39 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = b64; -#line 39 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_ < _tmp1_) { -#line 40 "/home/jens/Source/shotwell/src/util/misc.vala" - result = -1; -#line 40 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 467 "misc.c" - } else { - guint64 _tmp2_; - guint64 _tmp3_; -#line 41 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = a64; -#line 41 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = b64; -#line 41 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp2_ > _tmp3_) { -#line 42 "/home/jens/Source/shotwell/src/util/misc.vala" - result = 1; -#line 42 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 481 "misc.c" - } else { -#line 44 "/home/jens/Source/shotwell/src/util/misc.vala" - result = 0; -#line 44 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 487 "misc.c" - } - } -} - - -gboolean -bool_value_equals (GValue* a, - GValue* b) -{ - gboolean result = FALSE; - GValue _tmp0_; - GValue _tmp1_; -#line 49 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (a != NULL, FALSE); -#line 49 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (b != NULL, FALSE); -#line 50 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = *a; -#line 50 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = *b; -#line 50 "/home/jens/Source/shotwell/src/util/misc.vala" - result = g_value_get_boolean (&_tmp0_) == g_value_get_boolean (&_tmp1_); -#line 50 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 512 "misc.c" -} - - -gboolean -int_value_equals (GValue* a, - GValue* b) -{ - gboolean result = FALSE; - GValue _tmp0_; - GValue _tmp1_; -#line 53 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (a != NULL, FALSE); -#line 53 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (b != NULL, FALSE); -#line 54 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = *a; -#line 54 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = *b; -#line 54 "/home/jens/Source/shotwell/src/util/misc.vala" - result = g_value_get_int (&_tmp0_) == g_value_get_int (&_tmp1_); -#line 54 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 535 "misc.c" -} - - -gulong -timeval_to_ms (GTimeVal* time_val) -{ - gulong result = 0UL; - GTimeVal _tmp0_; - glong _tmp1_; - GTimeVal _tmp2_; - glong _tmp3_; -#line 57 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (time_val != NULL, 0UL); -#line 58 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = *time_val; -#line 58 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = _tmp0_.tv_sec; -#line 58 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = *time_val; -#line 58 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = _tmp2_.tv_usec; -#line 58 "/home/jens/Source/shotwell/src/util/misc.vala" - result = (((gulong) _tmp1_) * 1000) + (((gulong) _tmp3_) / 1000); -#line 58 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 561 "misc.c" -} - - -gulong -now_ms (void) -{ - gulong result = 0UL; - GTimeVal _tmp0_ = {0}; -#line 62 "/home/jens/Source/shotwell/src/util/misc.vala" - g_get_current_time (&_tmp0_); -#line 62 "/home/jens/Source/shotwell/src/util/misc.vala" - result = timeval_to_ms (&_tmp0_); -#line 62 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 576 "misc.c" -} - - -gulong -now_sec (void) -{ - gulong result = 0UL; - GTimeVal time_val = {0}; - GTimeVal _tmp0_; - glong _tmp1_; -#line 66 "/home/jens/Source/shotwell/src/util/misc.vala" - g_get_current_time (&time_val); -#line 68 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = time_val; -#line 68 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = _tmp0_.tv_sec; -#line 68 "/home/jens/Source/shotwell/src/util/misc.vala" - result = (gulong) _tmp1_; -#line 68 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 597 "misc.c" -} - - -inline time_t -now_time_t (void) -{ - time_t result = 0; -#line 72 "/home/jens/Source/shotwell/src/util/misc.vala" - result = (time_t) now_sec (); -#line 72 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 609 "misc.c" -} - - -gchar* -md5_file (GFile* file, - GError** error) -{ - gchar* result = NULL; - GChecksum* md5 = NULL; - GChecksum* _tmp0_; - guint8* buffer = NULL; - guint8* _tmp1_; - gint buffer_length1; - gint _buffer_size_; - GFileInputStream* fins = NULL; - GFileInputStream* _tmp2_; - GChecksum* _tmp15_; - const gchar* _tmp16_; - gchar* _tmp17_; - GError * _inner_error_ = NULL; -#line 75 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (G_IS_FILE (file), NULL); -#line 76 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = g_checksum_new (G_CHECKSUM_MD5); -#line 76 "/home/jens/Source/shotwell/src/util/misc.vala" - md5 = _tmp0_; -#line 77 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = g_new0 (guint8, 64 * 1024); -#line 77 "/home/jens/Source/shotwell/src/util/misc.vala" - buffer = _tmp1_; -#line 77 "/home/jens/Source/shotwell/src/util/misc.vala" - buffer_length1 = 64 * 1024; -#line 77 "/home/jens/Source/shotwell/src/util/misc.vala" - _buffer_size_ = buffer_length1; -#line 79 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = g_file_read (file, NULL, &_inner_error_); -#line 79 "/home/jens/Source/shotwell/src/util/misc.vala" - fins = _tmp2_; -#line 79 "/home/jens/Source/shotwell/src/util/misc.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 79 "/home/jens/Source/shotwell/src/util/misc.vala" - g_propagate_error (error, _inner_error_); -#line 79 "/home/jens/Source/shotwell/src/util/misc.vala" - buffer = (g_free (buffer), NULL); -#line 79 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_checksum_free0 (md5); -#line 79 "/home/jens/Source/shotwell/src/util/misc.vala" - return NULL; -#line 658 "misc.c" - } - { - gboolean _tmp3_ = FALSE; -#line 80 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = TRUE; -#line 80 "/home/jens/Source/shotwell/src/util/misc.vala" - while (TRUE) { -#line 666 "misc.c" - gsize bytes_read = 0UL; - GFileInputStream* _tmp4_; - guint8* _tmp5_; - gint _tmp5__length1; - gsize _tmp6_; - GChecksum* _tmp7_; - guint8* _tmp8_; - gint _tmp8__length1; - gsize _tmp9_; -#line 80 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!_tmp3_) { -#line 678 "misc.c" - } -#line 80 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = FALSE; -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = fins; -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = buffer; -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5__length1 = buffer_length1; -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - bytes_read = (gsize) g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, g_input_stream_get_type (), GInputStream), _tmp5_, (gsize) _tmp5__length1, NULL, &_inner_error_); -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - g_propagate_error (error, _inner_error_); -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (fins); -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - buffer = (g_free (buffer), NULL); -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_checksum_free0 (md5); -#line 81 "/home/jens/Source/shotwell/src/util/misc.vala" - return NULL; -#line 702 "misc.c" - } -#line 82 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = bytes_read; -#line 82 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp6_ <= ((gsize) 0)) { -#line 83 "/home/jens/Source/shotwell/src/util/misc.vala" - break; -#line 710 "misc.c" - } -#line 85 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = md5; -#line 85 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = buffer; -#line 85 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8__length1 = buffer_length1; -#line 85 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = bytes_read; -#line 85 "/home/jens/Source/shotwell/src/util/misc.vala" - g_checksum_update (_tmp7_, (guchar*) _tmp8_, _tmp9_); -#line 722 "misc.c" - } - } - { - GFileInputStream* _tmp10_; -#line 89 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = fins; -#line 89 "/home/jens/Source/shotwell/src/util/misc.vala" - g_input_stream_close (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, g_input_stream_get_type (), GInputStream), NULL, &_inner_error_); -#line 89 "/home/jens/Source/shotwell/src/util/misc.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 733 "misc.c" - goto __catch5_g_error; - } - } - goto __finally5; - __catch5_g_error: - { - GError* err = NULL; - gchar* _tmp11_; - gchar* _tmp12_; - GError* _tmp13_; - const gchar* _tmp14_; -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - err = _inner_error_; -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - _inner_error_ = NULL; -#line 91 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = g_file_get_path (file); -#line 91 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp12_ = _tmp11_; -#line 91 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp13_ = err; -#line 91 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp14_ = _tmp13_->message; -#line 91 "/home/jens/Source/shotwell/src/util/misc.vala" - g_warning ("misc.vala:91: Unable to close MD5 input stream for %s: %s", _tmp12_, _tmp14_); -#line 91 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp12_); -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_error_free0 (err); -#line 763 "misc.c" - } - __finally5: -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - g_propagate_error (error, _inner_error_); -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (fins); -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - buffer = (g_free (buffer), NULL); -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_checksum_free0 (md5); -#line 88 "/home/jens/Source/shotwell/src/util/misc.vala" - return NULL; -#line 778 "misc.c" - } -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp15_ = md5; -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16_ = g_checksum_get_string (_tmp15_); -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17_ = g_strdup (_tmp16_); -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp17_; -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (fins); -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - buffer = (g_free (buffer), NULL); -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_checksum_free0 (md5); -#line 94 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 796 "misc.c" -} - - -gboolean -equal_sets (GeeSet* a, - GeeSet* b) -{ - gboolean result = FALSE; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp4_ = FALSE; - gboolean _tmp8_ = FALSE; - gboolean _tmp9_ = FALSE; - gboolean _tmp11_ = FALSE; - gint _tmp12_; - gint _tmp13_; - gint _tmp14_; - gint _tmp15_; -#line 98 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail ((a == NULL) || GEE_IS_SET (a), FALSE); -#line 98 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail ((b == NULL) || GEE_IS_SET (b), FALSE); -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - if (a != NULL) { -#line 821 "misc.c" - gint _tmp2_; - gint _tmp3_; -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (a, GEE_TYPE_COLLECTION, GeeCollection)); -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = _tmp2_; -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = _tmp3_ == 0; -#line 830 "misc.c" - } else { -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = FALSE; -#line 834 "misc.c" - } -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp1_) { -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = b == NULL; -#line 840 "misc.c" - } else { -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = FALSE; -#line 844 "misc.c" - } -#line 99 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_) { -#line 100 "/home/jens/Source/shotwell/src/util/misc.vala" - result = TRUE; -#line 100 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 852 "misc.c" - } -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - if (a == NULL) { -#line 856 "misc.c" - gboolean _tmp5_ = FALSE; -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - if (b != NULL) { -#line 860 "misc.c" - gint _tmp6_; - gint _tmp7_; -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (b, GEE_TYPE_COLLECTION, GeeCollection)); -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = _tmp6_; -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = _tmp7_ == 0; -#line 869 "misc.c" - } else { -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = FALSE; -#line 873 "misc.c" - } -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = _tmp5_; -#line 877 "misc.c" - } else { -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = FALSE; -#line 881 "misc.c" - } -#line 102 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp4_) { -#line 103 "/home/jens/Source/shotwell/src/util/misc.vala" - result = TRUE; -#line 103 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 889 "misc.c" - } -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - if (a == NULL) { -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = b != NULL; -#line 895 "misc.c" - } else { -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = FALSE; -#line 899 "misc.c" - } -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp9_) { -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = TRUE; -#line 905 "misc.c" - } else { - gboolean _tmp10_ = FALSE; -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - if (a != NULL) { -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = b == NULL; -#line 912 "misc.c" - } else { -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = FALSE; -#line 916 "misc.c" - } -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = _tmp10_; -#line 920 "misc.c" - } -#line 105 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp8_) { -#line 106 "/home/jens/Source/shotwell/src/util/misc.vala" - result = FALSE; -#line 106 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 928 "misc.c" - } -#line 108 "/home/jens/Source/shotwell/src/util/misc.vala" - if (a == NULL) { -#line 108 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = b == NULL; -#line 934 "misc.c" - } else { -#line 108 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = FALSE; -#line 938 "misc.c" - } -#line 108 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp11_) { -#line 109 "/home/jens/Source/shotwell/src/util/misc.vala" - result = TRUE; -#line 109 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 946 "misc.c" - } -#line 111 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp12_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (a, GEE_TYPE_COLLECTION, GeeCollection)); -#line 111 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp13_ = _tmp12_; -#line 111 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp14_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (b, GEE_TYPE_COLLECTION, GeeCollection)); -#line 111 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp15_ = _tmp14_; -#line 111 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp13_ != _tmp15_) { -#line 112 "/home/jens/Source/shotwell/src/util/misc.vala" - result = FALSE; -#line 112 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 962 "misc.c" - } - { - GeeIterator* _element_it = NULL; - GeeIterator* _tmp16_; -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (a, GEE_TYPE_ITERABLE, GeeIterable)); -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - _element_it = _tmp16_; -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - while (TRUE) { -#line 973 "misc.c" - GeeIterator* _tmp17_; - gchar* element = NULL; - GeeIterator* _tmp18_; - gpointer _tmp19_; - const gchar* _tmp20_; -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17_ = _element_it; -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!gee_iterator_next (_tmp17_)) { -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - break; -#line 985 "misc.c" - } -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp18_ = _element_it; -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp19_ = gee_iterator_get (_tmp18_); -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - element = (gchar*) _tmp19_; -#line 117 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp20_ = element; -#line 117 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!gee_collection_contains (G_TYPE_CHECK_INSTANCE_CAST (b, GEE_TYPE_COLLECTION, GeeCollection), _tmp20_)) { -#line 118 "/home/jens/Source/shotwell/src/util/misc.vala" - result = FALSE; -#line 118 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (element); -#line 118 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (_element_it); -#line 118 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1005 "misc.c" - } -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (element); -#line 1009 "misc.c" - } -#line 116 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (_element_it); -#line 1013 "misc.c" - } -#line 121 "/home/jens/Source/shotwell/src/util/misc.vala" - result = TRUE; -#line 121 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1019 "misc.c" -} - - -static gpointer -_g_object_ref0 (gpointer self) -{ -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - return self ? g_object_ref (self) : NULL; -#line 1028 "misc.c" -} - - -GeeSet* -intersection_of_sets (GeeSet* a, - GeeSet* b, - GeeSet* excluded) -{ - GeeSet* result = NULL; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - GeeSet* intersection = NULL; - GeeHashSet* _tmp2_; - GeeSet* _tmp19_ = NULL; - GeeSet* _tmp20_; - gint _tmp21_; - gint _tmp22_; - GeeSet* _tmp24_; -#line 125 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail ((a == NULL) || GEE_IS_SET (a), NULL); -#line 125 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail ((b == NULL) || GEE_IS_SET (b), NULL); -#line 125 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail ((excluded == NULL) || GEE_IS_SET (excluded), NULL); -#line 127 "/home/jens/Source/shotwell/src/util/misc.vala" - if (a != NULL) { -#line 127 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = b == NULL; -#line 1057 "misc.c" - } else { -#line 127 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = FALSE; -#line 1061 "misc.c" - } -#line 127 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_) { -#line 128 "/home/jens/Source/shotwell/src/util/misc.vala" - if (excluded != NULL) { -#line 129 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_collection_add_all (G_TYPE_CHECK_INSTANCE_CAST (excluded, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (a, GEE_TYPE_COLLECTION, GeeCollection)); -#line 1069 "misc.c" - } -#line 131 "/home/jens/Source/shotwell/src/util/misc.vala" - result = NULL; -#line 131 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1075 "misc.c" - } -#line 134 "/home/jens/Source/shotwell/src/util/misc.vala" - if (a == NULL) { -#line 134 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = b != NULL; -#line 1081 "misc.c" - } else { -#line 134 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = FALSE; -#line 1085 "misc.c" - } -#line 134 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp1_) { -#line 135 "/home/jens/Source/shotwell/src/util/misc.vala" - if (excluded != NULL) { -#line 136 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_collection_add_all (G_TYPE_CHECK_INSTANCE_CAST (excluded, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (b, GEE_TYPE_COLLECTION, GeeCollection)); -#line 1093 "misc.c" - } -#line 138 "/home/jens/Source/shotwell/src/util/misc.vala" - result = NULL; -#line 138 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1099 "misc.c" - } -#line 141 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL); -#line 141 "/home/jens/Source/shotwell/src/util/misc.vala" - intersection = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_SET, GeeSet); -#line 1105 "misc.c" - { - GeeIterator* _element_it = NULL; - GeeIterator* _tmp3_; -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (a, GEE_TYPE_ITERABLE, GeeIterable)); -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - _element_it = _tmp3_; -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - while (TRUE) { -#line 1115 "misc.c" - GeeIterator* _tmp4_; - gchar* element = NULL; - GeeIterator* _tmp5_; - gpointer _tmp6_; - const gchar* _tmp7_; -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = _element_it; -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!gee_iterator_next (_tmp4_)) { -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - break; -#line 1127 "misc.c" - } -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = _element_it; -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = gee_iterator_get (_tmp5_); -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - element = (gchar*) _tmp6_; -#line 144 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = element; -#line 144 "/home/jens/Source/shotwell/src/util/misc.vala" - if (gee_collection_contains (G_TYPE_CHECK_INSTANCE_CAST (b, GEE_TYPE_COLLECTION, GeeCollection), _tmp7_)) { -#line 1139 "misc.c" - GeeSet* _tmp8_; - const gchar* _tmp9_; -#line 145 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = intersection; -#line 145 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = element; -#line 145 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GEE_TYPE_COLLECTION, GeeCollection), _tmp9_); -#line 1148 "misc.c" - } else { -#line 146 "/home/jens/Source/shotwell/src/util/misc.vala" - if (excluded != NULL) { -#line 1152 "misc.c" - const gchar* _tmp10_; -#line 147 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = element; -#line 147 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (excluded, GEE_TYPE_COLLECTION, GeeCollection), _tmp10_); -#line 1158 "misc.c" - } - } -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (element); -#line 1163 "misc.c" - } -#line 143 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (_element_it); -#line 1167 "misc.c" - } - { - GeeIterator* _element_it = NULL; - GeeIterator* _tmp11_; -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (b, GEE_TYPE_ITERABLE, GeeIterable)); -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - _element_it = _tmp11_; -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - while (TRUE) { -#line 1178 "misc.c" - GeeIterator* _tmp12_; - gchar* element = NULL; - GeeIterator* _tmp13_; - gpointer _tmp14_; - const gchar* _tmp15_; -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp12_ = _element_it; -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!gee_iterator_next (_tmp12_)) { -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - break; -#line 1190 "misc.c" - } -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp13_ = _element_it; -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp14_ = gee_iterator_get (_tmp13_); -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - element = (gchar*) _tmp14_; -#line 151 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp15_ = element; -#line 151 "/home/jens/Source/shotwell/src/util/misc.vala" - if (gee_collection_contains (G_TYPE_CHECK_INSTANCE_CAST (a, GEE_TYPE_COLLECTION, GeeCollection), _tmp15_)) { -#line 1202 "misc.c" - GeeSet* _tmp16_; - const gchar* _tmp17_; -#line 152 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16_ = intersection; -#line 152 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17_ = element; -#line 152 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, GEE_TYPE_COLLECTION, GeeCollection), _tmp17_); -#line 1211 "misc.c" - } else { -#line 153 "/home/jens/Source/shotwell/src/util/misc.vala" - if (excluded != NULL) { -#line 1215 "misc.c" - const gchar* _tmp18_; -#line 154 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp18_ = element; -#line 154 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (excluded, GEE_TYPE_COLLECTION, GeeCollection), _tmp18_); -#line 1221 "misc.c" - } - } -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (element); -#line 1226 "misc.c" - } -#line 150 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (_element_it); -#line 1230 "misc.c" - } -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp20_ = intersection; -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp21_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, GEE_TYPE_COLLECTION, GeeCollection)); -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp22_ = _tmp21_; -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp22_ > 0) { -#line 1240 "misc.c" - GeeSet* _tmp23_; -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp23_ = intersection; -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp19_ = _tmp23_; -#line 1246 "misc.c" - } else { -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp19_ = NULL; -#line 1250 "misc.c" - } -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp24_ = _g_object_ref0 (_tmp19_); -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp24_; -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (intersection); -#line 157 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1260 "misc.c" -} - - -guchar* -serialize_photo_ids (GeeCollection* photos, - int* result_length1) -{ - guchar* result = NULL; - gint64* ids = NULL; - gint _tmp0_; - gint _tmp1_; - gint64* _tmp2_; - gint ids_length1; - gint _ids_size_; - gint ctr = 0; - gsize bytes = 0UL; - gint _tmp13_; - gint _tmp14_; - guchar* serialized = NULL; - guchar* _tmp15_; - gint serialized_length1; - gint _serialized_size_; - gint64* _tmp16_; - gint _tmp16__length1; - guchar* _tmp17_; - gint _tmp17__length1; -#line 160 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (GEE_IS_COLLECTION (photos), NULL); -#line 161 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = gee_collection_get_size (photos); -#line 161 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = _tmp0_; -#line 161 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = g_new0 (gint64, _tmp1_); -#line 161 "/home/jens/Source/shotwell/src/util/misc.vala" - ids = _tmp2_; -#line 161 "/home/jens/Source/shotwell/src/util/misc.vala" - ids_length1 = _tmp1_; -#line 161 "/home/jens/Source/shotwell/src/util/misc.vala" - _ids_size_ = ids_length1; -#line 162 "/home/jens/Source/shotwell/src/util/misc.vala" - ctr = 0; -#line 1303 "misc.c" - { - GeeIterator* _photo_it = NULL; - GeeIterator* _tmp3_; -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (photos, GEE_TYPE_ITERABLE, GeeIterable)); -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - _photo_it = _tmp3_; -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - while (TRUE) { -#line 1313 "misc.c" - GeeIterator* _tmp4_; - Photo* photo = NULL; - GeeIterator* _tmp5_; - gpointer _tmp6_; - gint64* _tmp7_; - gint _tmp7__length1; - gint _tmp8_; - Photo* _tmp9_; - PhotoID _tmp10_ = {0}; - gint64 _tmp11_; - gint64 _tmp12_; -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = _photo_it; -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!gee_iterator_next (_tmp4_)) { -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - break; -#line 1331 "misc.c" - } -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = _photo_it; -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = gee_iterator_get (_tmp5_); -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - photo = (Photo*) _tmp6_; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = ids; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7__length1 = ids_length1; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = ctr; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - ctr = _tmp8_ + 1; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = photo; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - photo_get_photo_id (_tmp9_, &_tmp10_); -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = _tmp10_.id; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_[_tmp8_] = _tmp11_; -#line 164 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp12_ = _tmp7_[_tmp8_]; -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (photo); -#line 1359 "misc.c" - } -#line 163 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (_photo_it); -#line 1363 "misc.c" - } -#line 166 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp13_ = gee_collection_get_size (photos); -#line 166 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp14_ = _tmp13_; -#line 166 "/home/jens/Source/shotwell/src/util/misc.vala" - bytes = (gsize) (_tmp14_ * sizeof (gint64)); -#line 167 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp15_ = g_new0 (guchar, bytes); -#line 167 "/home/jens/Source/shotwell/src/util/misc.vala" - serialized = _tmp15_; -#line 167 "/home/jens/Source/shotwell/src/util/misc.vala" - serialized_length1 = bytes; -#line 167 "/home/jens/Source/shotwell/src/util/misc.vala" - _serialized_size_ = serialized_length1; -#line 168 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16_ = ids; -#line 168 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16__length1 = ids_length1; -#line 168 "/home/jens/Source/shotwell/src/util/misc.vala" - memcpy (serialized, _tmp16_, bytes); -#line 170 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17_ = serialized; -#line 170 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17__length1 = serialized_length1; -#line 170 "/home/jens/Source/shotwell/src/util/misc.vala" - if (result_length1) { -#line 170 "/home/jens/Source/shotwell/src/util/misc.vala" - *result_length1 = _tmp17__length1; -#line 1393 "misc.c" - } -#line 170 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp17_; -#line 170 "/home/jens/Source/shotwell/src/util/misc.vala" - ids = (g_free (ids), NULL); -#line 170 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1401 "misc.c" -} - - -GeeList* -unserialize_photo_ids (guchar* serialized, - gint size) -{ - GeeList* result = NULL; - gsize count = 0UL; - gboolean _tmp0_ = FALSE; - gsize _tmp1_; - gint64* ids = NULL; - gsize _tmp2_; - gint64* _tmp3_; - gint ids_length1; - gint _ids_size_; - gint64* _tmp4_; - gint _tmp4__length1; - GeeArrayList* list = NULL; - GeeArrayList* _tmp5_; - gint64* _tmp6_; - gint _tmp6__length1; -#line 174 "/home/jens/Source/shotwell/src/util/misc.vala" - count = (gsize) (size / sizeof (gint64)); -#line 175 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = count; -#line 175 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp1_ <= ((gsize) 0)) { -#line 175 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = TRUE; -#line 1432 "misc.c" - } else { -#line 175 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = serialized == NULL; -#line 1436 "misc.c" - } -#line 175 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_) { -#line 176 "/home/jens/Source/shotwell/src/util/misc.vala" - result = NULL; -#line 176 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1444 "misc.c" - } -#line 178 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = count; -#line 178 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = g_new0 (gint64, _tmp2_); -#line 178 "/home/jens/Source/shotwell/src/util/misc.vala" - ids = _tmp3_; -#line 178 "/home/jens/Source/shotwell/src/util/misc.vala" - ids_length1 = _tmp2_; -#line 178 "/home/jens/Source/shotwell/src/util/misc.vala" - _ids_size_ = ids_length1; -#line 179 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = ids; -#line 179 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4__length1 = ids_length1; -#line 179 "/home/jens/Source/shotwell/src/util/misc.vala" - memcpy (_tmp4_, serialized, (gsize) size); -#line 181 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = gee_array_list_new (TYPE_PHOTO_ID, (GBoxedCopyFunc) photo_id_dup, (GDestroyNotify) photo_id_free, NULL, NULL, NULL); -#line 181 "/home/jens/Source/shotwell/src/util/misc.vala" - list = _tmp5_; -#line 182 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = ids; -#line 182 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6__length1 = ids_length1; -#line 1470 "misc.c" - { - gint64* id_collection = NULL; - gint id_collection_length1 = 0; - gint _id_collection_size_ = 0; - gint id_it = 0; -#line 182 "/home/jens/Source/shotwell/src/util/misc.vala" - id_collection = _tmp6_; -#line 182 "/home/jens/Source/shotwell/src/util/misc.vala" - id_collection_length1 = _tmp6__length1; -#line 182 "/home/jens/Source/shotwell/src/util/misc.vala" - for (id_it = 0; id_it < _tmp6__length1; id_it = id_it + 1) { -#line 1482 "misc.c" - gint64 id = 0LL; -#line 182 "/home/jens/Source/shotwell/src/util/misc.vala" - id = id_collection[id_it]; -#line 1486 "misc.c" - { - GeeArrayList* _tmp7_; - gint64 _tmp8_; - PhotoID _tmp9_ = {0}; -#line 183 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = list; -#line 183 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = id; -#line 183 "/home/jens/Source/shotwell/src/util/misc.vala" - photo_id_init (&_tmp9_, _tmp8_); -#line 183 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), &_tmp9_); -#line 1499 "misc.c" - } - } - } -#line 185 "/home/jens/Source/shotwell/src/util/misc.vala" - result = G_TYPE_CHECK_INSTANCE_CAST (list, GEE_TYPE_LIST, GeeList); -#line 185 "/home/jens/Source/shotwell/src/util/misc.vala" - ids = (g_free (ids), NULL); -#line 185 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1509 "misc.c" -} - - -guchar* -serialize_media_sources (GeeCollection* media, - int* result_length1) -{ - guchar* result = NULL; - GdkAtom* atoms = NULL; - gint _tmp0_; - gint _tmp1_; - GdkAtom* _tmp2_; - gint atoms_length1; - gint _atoms_size_; - gint ctr = 0; - gsize bytes = 0UL; - gint _tmp13_; - gint _tmp14_; - guchar* serialized = NULL; - guchar* _tmp15_; - gint serialized_length1; - gint _serialized_size_; - GdkAtom* _tmp16_; - gint _tmp16__length1; - guchar* _tmp17_; - gint _tmp17__length1; -#line 188 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (GEE_IS_COLLECTION (media), NULL); -#line 189 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = gee_collection_get_size (media); -#line 189 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = _tmp0_; -#line 189 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = g_new0 (GdkAtom, _tmp1_); -#line 189 "/home/jens/Source/shotwell/src/util/misc.vala" - atoms = _tmp2_; -#line 189 "/home/jens/Source/shotwell/src/util/misc.vala" - atoms_length1 = _tmp1_; -#line 189 "/home/jens/Source/shotwell/src/util/misc.vala" - _atoms_size_ = atoms_length1; -#line 190 "/home/jens/Source/shotwell/src/util/misc.vala" - ctr = 0; -#line 1552 "misc.c" - { - GeeIterator* _current_media_it = NULL; - GeeIterator* _tmp3_; -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (media, GEE_TYPE_ITERABLE, GeeIterable)); -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - _current_media_it = _tmp3_; -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - while (TRUE) { -#line 1562 "misc.c" - GeeIterator* _tmp4_; - MediaSource* current_media = NULL; - GeeIterator* _tmp5_; - gpointer _tmp6_; - GdkAtom* _tmp7_; - gint _tmp7__length1; - gint _tmp8_; - MediaSource* _tmp9_; - gchar* _tmp10_; - gchar* _tmp11_; - GdkAtom _tmp12_; -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = _current_media_it; -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!gee_iterator_next (_tmp4_)) { -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - break; -#line 1580 "misc.c" - } -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = _current_media_it; -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = gee_iterator_get (_tmp5_); -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - current_media = (MediaSource*) _tmp6_; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = atoms; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7__length1 = atoms_length1; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = ctr; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - ctr = _tmp8_ + 1; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = current_media; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, TYPE_DATA_SOURCE, DataSource)); -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = _tmp10_; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_[_tmp8_] = gdk_atom_intern (_tmp11_, FALSE); -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp12_ = _tmp7_[_tmp8_]; -#line 192 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp11_); -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (current_media); -#line 1610 "misc.c" - } -#line 191 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (_current_media_it); -#line 1614 "misc.c" - } -#line 194 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp13_ = gee_collection_get_size (media); -#line 194 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp14_ = _tmp13_; -#line 194 "/home/jens/Source/shotwell/src/util/misc.vala" - bytes = (gsize) (_tmp14_ * sizeof (GdkAtom)); -#line 195 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp15_ = g_new0 (guchar, bytes); -#line 195 "/home/jens/Source/shotwell/src/util/misc.vala" - serialized = _tmp15_; -#line 195 "/home/jens/Source/shotwell/src/util/misc.vala" - serialized_length1 = bytes; -#line 195 "/home/jens/Source/shotwell/src/util/misc.vala" - _serialized_size_ = serialized_length1; -#line 196 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16_ = atoms; -#line 196 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16__length1 = atoms_length1; -#line 196 "/home/jens/Source/shotwell/src/util/misc.vala" - memcpy (serialized, _tmp16_, bytes); -#line 198 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17_ = serialized; -#line 198 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17__length1 = serialized_length1; -#line 198 "/home/jens/Source/shotwell/src/util/misc.vala" - if (result_length1) { -#line 198 "/home/jens/Source/shotwell/src/util/misc.vala" - *result_length1 = _tmp17__length1; -#line 1644 "misc.c" - } -#line 198 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp17_; -#line 198 "/home/jens/Source/shotwell/src/util/misc.vala" - atoms = (g_free (atoms), NULL); -#line 198 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1652 "misc.c" -} - - -GeeList* -unserialize_media_sources (guchar* serialized, - gint size) -{ - GeeList* result = NULL; - gsize count = 0UL; - gboolean _tmp0_ = FALSE; - gsize _tmp1_; - GdkAtom* atoms = NULL; - gsize _tmp2_; - GdkAtom* _tmp3_; - gint atoms_length1; - gint _atoms_size_; - GdkAtom* _tmp4_; - gint _tmp4__length1; - GeeArrayList* list = NULL; - GeeArrayList* _tmp5_; - GdkAtom* _tmp6_; - gint _tmp6__length1; -#line 202 "/home/jens/Source/shotwell/src/util/misc.vala" - count = (gsize) (size / sizeof (GdkAtom)); -#line 203 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = count; -#line 203 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp1_ <= ((gsize) 0)) { -#line 203 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = TRUE; -#line 1683 "misc.c" - } else { -#line 203 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = serialized == NULL; -#line 1687 "misc.c" - } -#line 203 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_) { -#line 204 "/home/jens/Source/shotwell/src/util/misc.vala" - result = NULL; -#line 204 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1695 "misc.c" - } -#line 206 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = count; -#line 206 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = g_new0 (GdkAtom, _tmp2_); -#line 206 "/home/jens/Source/shotwell/src/util/misc.vala" - atoms = _tmp3_; -#line 206 "/home/jens/Source/shotwell/src/util/misc.vala" - atoms_length1 = _tmp2_; -#line 206 "/home/jens/Source/shotwell/src/util/misc.vala" - _atoms_size_ = atoms_length1; -#line 207 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = atoms; -#line 207 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4__length1 = atoms_length1; -#line 207 "/home/jens/Source/shotwell/src/util/misc.vala" - memcpy (_tmp4_, serialized, (gsize) size); -#line 209 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = gee_array_list_new (TYPE_MEDIA_SOURCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL); -#line 209 "/home/jens/Source/shotwell/src/util/misc.vala" - list = _tmp5_; -#line 210 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = atoms; -#line 210 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6__length1 = atoms_length1; -#line 1721 "misc.c" - { - GdkAtom* current_atom_collection = NULL; - gint current_atom_collection_length1 = 0; - gint _current_atom_collection_size_ = 0; - gint current_atom_it = 0; -#line 210 "/home/jens/Source/shotwell/src/util/misc.vala" - current_atom_collection = _tmp6_; -#line 210 "/home/jens/Source/shotwell/src/util/misc.vala" - current_atom_collection_length1 = _tmp6__length1; -#line 210 "/home/jens/Source/shotwell/src/util/misc.vala" - for (current_atom_it = 0; current_atom_it < _tmp6__length1; current_atom_it = current_atom_it + 1) { -#line 1733 "misc.c" - GdkAtom current_atom = 0U; -#line 210 "/home/jens/Source/shotwell/src/util/misc.vala" - current_atom = current_atom_collection[current_atom_it]; -#line 1737 "misc.c" - { - MediaSource* media = NULL; - MediaCollectionRegistry* _tmp7_; - MediaCollectionRegistry* _tmp8_; - GdkAtom _tmp9_; - gchar* _tmp10_; - gchar* _tmp11_; - MediaSource* _tmp12_; - MediaSource* _tmp13_; - MediaSource* _tmp14_; - GeeArrayList* _tmp15_; - MediaSource* _tmp16_; -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = media_collection_registry_get_instance (); -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = _tmp7_; -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = current_atom; -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = gdk_atom_name (_tmp9_); -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = _tmp10_; -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp12_ = media_collection_registry_fetch_media (_tmp8_, _tmp11_); -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp13_ = _tmp12_; -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp11_); -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - _media_collection_registry_unref0 (_tmp8_); -#line 211 "/home/jens/Source/shotwell/src/util/misc.vala" - media = _tmp13_; -#line 212 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp14_ = media; -#line 212 "/home/jens/Source/shotwell/src/util/misc.vala" - _vala_assert (_tmp14_ != NULL, "media != null"); -#line 213 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp15_ = list; -#line 213 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16_ = media; -#line 213 "/home/jens/Source/shotwell/src/util/misc.vala" - gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp16_); -#line 210 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_object_unref0 (media); -#line 1782 "misc.c" - } - } - } -#line 216 "/home/jens/Source/shotwell/src/util/misc.vala" - result = G_TYPE_CHECK_INSTANCE_CAST (list, GEE_TYPE_LIST, GeeList); -#line 216 "/home/jens/Source/shotwell/src/util/misc.vala" - atoms = (g_free (atoms), NULL); -#line 216 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 1792 "misc.c" -} - - -static gchar* -g_time_format (struct tm *self, - const gchar* format) -{ - gchar* result = NULL; - gchar* buffer = NULL; - gchar* _tmp0_; - gint buffer_length1; - gint _buffer_size_; - gchar* _tmp1_; - gint _tmp1__length1; - gchar* _tmp2_; - gint _tmp2__length1; - gchar* _tmp3_; -#line 2874 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (format != NULL, NULL); -#line 2875 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_new0 (gchar, 64); -#line 2875 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - buffer = _tmp0_; -#line 2875 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - buffer_length1 = 64; -#line 2875 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _buffer_size_ = buffer_length1; -#line 2876 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = buffer; -#line 2876 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1__length1 = buffer_length1; -#line 2876 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - strftime (_tmp1_, _tmp1__length1, format, &(*self)); -#line 2877 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = buffer; -#line 2877 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2__length1 = buffer_length1; -#line 2877 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp3_ = g_strdup ((const gchar*) _tmp2_); -#line 2877 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp3_; -#line 2877 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - buffer = (g_free (buffer), NULL); -#line 2877 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1838 "misc.c" -} - - -gchar* -format_local_datespan (struct tm* from_date, - struct tm* to_date) -{ - gchar* result = NULL; - gchar* from_format = NULL; - gchar* to_format = NULL; - struct tm _tmp0_; - gint _tmp1_; - struct tm _tmp2_; - gint _tmp3_; - const gchar* _tmp19_; - gchar* _tmp20_; - gchar* _tmp21_; - const gchar* _tmp22_; - gchar* _tmp23_; - gchar* _tmp24_; - gchar* _tmp25_; - gchar* _tmp26_; - gchar* _tmp27_; - gchar* _tmp28_; -#line 219 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (from_date != NULL, NULL); -#line 219 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (to_date != NULL, NULL); -#line 224 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = *from_date; -#line 224 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = _tmp0_.tm_year; -#line 224 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = *to_date; -#line 224 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = _tmp2_.tm_year; -#line 224 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp1_ == _tmp3_) { -#line 1877 "misc.c" - gboolean _tmp4_ = FALSE; - struct tm _tmp5_; - gint _tmp6_; - struct tm _tmp7_; - gint _tmp8_; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = *from_date; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = _tmp5_.tm_mon; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = *to_date; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = _tmp7_.tm_mon; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp6_ == _tmp8_) { -#line 1893 "misc.c" - struct tm _tmp9_; - gint _tmp10_; - struct tm _tmp11_; - gint _tmp12_; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = *from_date; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = _tmp9_.tm_mday; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp11_ = *to_date; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp12_ = _tmp11_.tm_mday; -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = _tmp10_ == (_tmp12_ - 1); -#line 1908 "misc.c" - } else { -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = FALSE; -#line 1912 "misc.c" - } -#line 226 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp4_) { -#line 1916 "misc.c" - gchar* _tmp13_; - gchar* _tmp14_; -#line 228 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp13_ = resources_get_start_multiday_span_format_string (); -#line 228 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (from_format); -#line 228 "/home/jens/Source/shotwell/src/util/misc.vala" - from_format = _tmp13_; -#line 229 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp14_ = resources_get_end_multiday_span_format_string (); -#line 229 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (to_format); -#line 229 "/home/jens/Source/shotwell/src/util/misc.vala" - to_format = _tmp14_; -#line 1931 "misc.c" - } else { - gchar* _tmp15_; - gchar* _tmp16_; -#line 233 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp15_ = resources_get_start_multimonth_span_format_string (); -#line 233 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (from_format); -#line 233 "/home/jens/Source/shotwell/src/util/misc.vala" - from_format = _tmp15_; -#line 234 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp16_ = resources_get_end_multimonth_span_format_string (); -#line 234 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (to_format); -#line 234 "/home/jens/Source/shotwell/src/util/misc.vala" - to_format = _tmp16_; -#line 1947 "misc.c" - } - } else { - gchar* _tmp17_; - gchar* _tmp18_; -#line 239 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp17_ = resources_get_long_date_format_string (); -#line 239 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (from_format); -#line 239 "/home/jens/Source/shotwell/src/util/misc.vala" - from_format = _tmp17_; -#line 240 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp18_ = resources_get_long_date_format_string (); -#line 240 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (to_format); -#line 240 "/home/jens/Source/shotwell/src/util/misc.vala" - to_format = _tmp18_; -#line 1964 "misc.c" - } -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp19_ = from_format; -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp20_ = g_time_format (from_date, _tmp19_); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp21_ = _tmp20_; -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp22_ = to_format; -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp23_ = g_time_format (to_date, _tmp22_); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp24_ = _tmp23_; -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp25_ = g_strdup_printf ("%s - %s", _tmp21_, _tmp24_); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp26_ = _tmp25_; -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp27_ = string_strip_leading_zeroes (_tmp26_); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp28_ = _tmp27_; -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp26_); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp24_); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp21_); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp28_; -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (to_format); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (from_format); -#line 243 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 2000 "misc.c" -} - - -gchar* -format_local_date (struct tm* date) -{ - gchar* result = NULL; - gchar* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_; - gchar* _tmp3_; - gchar* _tmp4_; - gchar* _tmp5_; -#line 247 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (date != NULL, NULL); -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = resources_get_long_date_format_string (); -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = _tmp0_; -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = g_time_format (date, _tmp1_); -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = _tmp2_; -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = string_strip_leading_zeroes (_tmp3_); -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = _tmp4_; -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp3_); -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (_tmp1_); -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp5_; -#line 248 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 2036 "misc.c" -} - - -OneShotScheduler* -one_shot_scheduler_construct (GType object_type, - const gchar* name, - OneShotCallback callback, - void* callback_target) -{ - OneShotScheduler* self = NULL; - gchar* _tmp0_; -#line 258 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (name != NULL, NULL); -#line 258 "/home/jens/Source/shotwell/src/util/misc.vala" - self = (OneShotScheduler*) g_type_create_instance (object_type); -#line 259 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = g_strdup (name); -#line 259 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (self->priv->name); -#line 259 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->name = _tmp0_; -#line 260 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->callback = callback; -#line 260 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->callback_target = callback_target; -#line 258 "/home/jens/Source/shotwell/src/util/misc.vala" - return self; -#line 2064 "misc.c" -} - - -OneShotScheduler* -one_shot_scheduler_new (const gchar* name, - OneShotCallback callback, - void* callback_target) -{ -#line 258 "/home/jens/Source/shotwell/src/util/misc.vala" - return one_shot_scheduler_construct (TYPE_ONE_SHOT_SCHEDULER, name, callback, callback_target); -#line 2075 "misc.c" -} - - -gboolean -one_shot_scheduler_is_scheduled (OneShotScheduler* self) -{ - gboolean result = FALSE; - guint _tmp0_; -#line 271 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (IS_ONE_SHOT_SCHEDULER (self), FALSE); -#line 272 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = self->priv->scheduled; -#line 272 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp0_ != ((guint) 0); -#line 272 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 2092 "misc.c" -} - - -void -one_shot_scheduler_at_idle (OneShotScheduler* self) -{ -#line 275 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (IS_ONE_SHOT_SCHEDULER (self)); -#line 276 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_at_priority_idle (self, G_PRIORITY_DEFAULT_IDLE); -#line 2103 "misc.c" -} - - -static gboolean -_one_shot_scheduler_callback_wrapper_gsource_func (gpointer self) -{ - gboolean result; - result = one_shot_scheduler_callback_wrapper ((OneShotScheduler*) self); -#line 281 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 2114 "misc.c" -} - - -void -one_shot_scheduler_at_priority_idle (OneShotScheduler* self, - gint priority) -{ - guint _tmp0_; -#line 279 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (IS_ONE_SHOT_SCHEDULER (self)); -#line 280 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = self->priv->scheduled; -#line 280 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_ == ((guint) 0)) { -#line 281 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->scheduled = g_idle_add_full (priority, _one_shot_scheduler_callback_wrapper_gsource_func, one_shot_scheduler_ref (self), one_shot_scheduler_unref); -#line 2131 "misc.c" - } -} - - -void -one_shot_scheduler_after_timeout (OneShotScheduler* self, - guint msec, - gboolean reschedule) -{ -#line 284 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (IS_ONE_SHOT_SCHEDULER (self)); -#line 285 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_priority_after_timeout (self, G_PRIORITY_DEFAULT, msec, reschedule); -#line 2145 "misc.c" -} - - -void -one_shot_scheduler_priority_after_timeout (OneShotScheduler* self, - gint priority, - guint msec, - gboolean reschedule) -{ - gboolean _tmp0_ = FALSE; - guint _tmp1_; - guint _tmp2_; -#line 288 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (IS_ONE_SHOT_SCHEDULER (self)); -#line 289 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = self->priv->scheduled; -#line 289 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp1_ != ((guint) 0)) { -#line 289 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = !reschedule; -#line 2166 "misc.c" - } else { -#line 289 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = FALSE; -#line 2170 "misc.c" - } -#line 289 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_) { -#line 290 "/home/jens/Source/shotwell/src/util/misc.vala" - return; -#line 2176 "misc.c" - } -#line 292 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = self->priv->scheduled; -#line 292 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp2_ != ((guint) 0)) { -#line 2182 "misc.c" - guint _tmp3_; -#line 293 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = self->priv->scheduled; -#line 293 "/home/jens/Source/shotwell/src/util/misc.vala" - g_source_remove (_tmp3_); -#line 2188 "misc.c" - } -#line 295 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->scheduled = g_timeout_add_full (priority, msec, _one_shot_scheduler_callback_wrapper_gsource_func, one_shot_scheduler_ref (self), one_shot_scheduler_unref); -#line 2192 "misc.c" -} - - -void -one_shot_scheduler_cancel (OneShotScheduler* self) -{ - guint _tmp0_; - guint _tmp1_; -#line 298 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (IS_ONE_SHOT_SCHEDULER (self)); -#line 299 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = self->priv->scheduled; -#line 299 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_ == ((guint) 0)) { -#line 300 "/home/jens/Source/shotwell/src/util/misc.vala" - return; -#line 2209 "misc.c" - } -#line 302 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = self->priv->scheduled; -#line 302 "/home/jens/Source/shotwell/src/util/misc.vala" - g_source_remove (_tmp1_); -#line 303 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->scheduled = (guint) 0; -#line 2217 "misc.c" -} - - -static gboolean -one_shot_scheduler_callback_wrapper (OneShotScheduler* self) -{ - gboolean result = FALSE; - OneShotCallback _tmp0_; - void* _tmp0__target; -#line 306 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (IS_ONE_SHOT_SCHEDULER (self), FALSE); -#line 307 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->scheduled = (guint) 0; -#line 308 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = self->priv->callback; -#line 308 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0__target = self->priv->callback_target; -#line 308 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ (_tmp0__target); -#line 310 "/home/jens/Source/shotwell/src/util/misc.vala" - result = FALSE; -#line 310 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 2241 "misc.c" -} - - -static void -value_one_shot_scheduler_init (GValue* value) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2250 "misc.c" -} - - -static void -value_one_shot_scheduler_free_value (GValue* value) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (value->data[0].v_pointer) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_unref (value->data[0].v_pointer); -#line 2261 "misc.c" - } -} - - -static void -value_one_shot_scheduler_copy_value (const GValue* src_value, - GValue* dest_value) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (src_value->data[0].v_pointer) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - dest_value->data[0].v_pointer = one_shot_scheduler_ref (src_value->data[0].v_pointer); -#line 2274 "misc.c" - } else { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - dest_value->data[0].v_pointer = NULL; -#line 2278 "misc.c" - } -} - - -static gpointer -value_one_shot_scheduler_peek_pointer (const GValue* value) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return value->data[0].v_pointer; -#line 2288 "misc.c" -} - - -static gchar* -value_one_shot_scheduler_collect_value (GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (collect_values[0].v_pointer) { -#line 2300 "misc.c" - OneShotScheduler * object; - object = collect_values[0].v_pointer; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (object->parent_instance.g_class == NULL) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); -#line 2307 "misc.c" - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); -#line 2311 "misc.c" - } -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = one_shot_scheduler_ref (object); -#line 2315 "misc.c" - } else { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2319 "misc.c" - } -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return NULL; -#line 2323 "misc.c" -} - - -static gchar* -value_one_shot_scheduler_lcopy_value (const GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ - OneShotScheduler ** object_p; - object_p = collect_values[0].v_pointer; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!object_p) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); -#line 2339 "misc.c" - } -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!value->data[0].v_pointer) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - *object_p = NULL; -#line 2345 "misc.c" - } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - *object_p = value->data[0].v_pointer; -#line 2349 "misc.c" - } else { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - *object_p = one_shot_scheduler_ref (value->data[0].v_pointer); -#line 2353 "misc.c" - } -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return NULL; -#line 2357 "misc.c" -} - - -GParamSpec* -param_spec_one_shot_scheduler (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags) -{ - ParamSpecOneShotScheduler* spec; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (g_type_is_a (object_type, TYPE_ONE_SHOT_SCHEDULER), NULL); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - G_PARAM_SPEC (spec)->value_type = object_type; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return G_PARAM_SPEC (spec); -#line 2377 "misc.c" -} - - -gpointer -value_get_one_shot_scheduler (const GValue* value) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ONE_SHOT_SCHEDULER), NULL); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return value->data[0].v_pointer; -#line 2388 "misc.c" -} - - -void -value_set_one_shot_scheduler (GValue* value, - gpointer v_object) -{ - OneShotScheduler * old; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ONE_SHOT_SCHEDULER)); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - old = value->data[0].v_pointer; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (v_object) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ONE_SHOT_SCHEDULER)); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = v_object; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_ref (value->data[0].v_pointer); -#line 2411 "misc.c" - } else { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2415 "misc.c" - } -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (old) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_unref (old); -#line 2421 "misc.c" - } -} - - -void -value_take_one_shot_scheduler (GValue* value, - gpointer v_object) -{ - OneShotScheduler * old; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ONE_SHOT_SCHEDULER)); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - old = value->data[0].v_pointer; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (v_object) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ONE_SHOT_SCHEDULER)); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = v_object; -#line 2443 "misc.c" - } else { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2447 "misc.c" - } -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (old) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_unref (old); -#line 2453 "misc.c" - } -} - - -static void -one_shot_scheduler_class_init (OneShotSchedulerClass * klass) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_parent_class = g_type_class_peek_parent (klass); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - ((OneShotSchedulerClass *) klass)->finalize = one_shot_scheduler_finalize; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_type_class_add_private (klass, sizeof (OneShotSchedulerPrivate)); -#line 2467 "misc.c" -} - - -static void -one_shot_scheduler_instance_init (OneShotScheduler * self) -{ -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv = ONE_SHOT_SCHEDULER_GET_PRIVATE (self); -#line 256 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->scheduled = (guint) 0; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - self->ref_count = 1; -#line 2480 "misc.c" -} - - -static void -one_shot_scheduler_finalize (OneShotScheduler * obj) -{ - OneShotScheduler * self; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ONE_SHOT_SCHEDULER, OneShotScheduler); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_signal_handlers_destroy (self); -#line 268 "/home/jens/Source/shotwell/src/util/misc.vala" - one_shot_scheduler_cancel (self); -#line 254 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (self->priv->name); -#line 2496 "misc.c" -} - - -GType -one_shot_scheduler_get_type (void) -{ - static volatile gsize one_shot_scheduler_type_id__volatile = 0; - if (g_once_init_enter (&one_shot_scheduler_type_id__volatile)) { - static const GTypeValueTable g_define_type_value_table = { value_one_shot_scheduler_init, value_one_shot_scheduler_free_value, value_one_shot_scheduler_copy_value, value_one_shot_scheduler_peek_pointer, "p", value_one_shot_scheduler_collect_value, "p", value_one_shot_scheduler_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (OneShotSchedulerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) one_shot_scheduler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OneShotScheduler), 0, (GInstanceInitFunc) one_shot_scheduler_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - GType one_shot_scheduler_type_id; - one_shot_scheduler_type_id = g_type_register_fundamental (g_type_fundamental_next (), "OneShotScheduler", &g_define_type_info, &g_define_type_fundamental_info, 0); - g_once_init_leave (&one_shot_scheduler_type_id__volatile, one_shot_scheduler_type_id); - } - return one_shot_scheduler_type_id__volatile; -} - - -gpointer -one_shot_scheduler_ref (gpointer instance) -{ - OneShotScheduler * self; - self = instance; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_atomic_int_inc (&self->ref_count); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - return instance; -#line 2525 "misc.c" -} - - -void -one_shot_scheduler_unref (gpointer instance) -{ - OneShotScheduler * self; - self = instance; -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - if (g_atomic_int_dec_and_test (&self->ref_count)) { -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - ONE_SHOT_SCHEDULER_GET_CLASS (self)->finalize (self); -#line 253 "/home/jens/Source/shotwell/src/util/misc.vala" - g_type_free_instance ((GTypeInstance *) self); -#line 2540 "misc.c" - } -} - - -OpTimer* -op_timer_construct (GType object_type, - const gchar* name) -{ - OpTimer* self = NULL; - gchar* _tmp0_; -#line 322 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (name != NULL, NULL); -#line 322 "/home/jens/Source/shotwell/src/util/misc.vala" - self = (OpTimer*) g_type_create_instance (object_type); -#line 323 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = g_strdup (name); -#line 323 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (self->priv->name); -#line 323 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->name = _tmp0_; -#line 322 "/home/jens/Source/shotwell/src/util/misc.vala" - return self; -#line 2563 "misc.c" -} - - -OpTimer* -op_timer_new (const gchar* name) -{ -#line 322 "/home/jens/Source/shotwell/src/util/misc.vala" - return op_timer_construct (TYPE_OP_TIMER, name); -#line 2572 "misc.c" -} - - -void -op_timer_start (OpTimer* self) -{ - GTimer* _tmp0_; -#line 326 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (IS_OP_TIMER (self)); -#line 327 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = self->priv->timer; -#line 327 "/home/jens/Source/shotwell/src/util/misc.vala" - g_timer_start (_tmp0_); -#line 2586 "misc.c" -} - - -void -op_timer_stop (OpTimer* self) -{ - gdouble time = 0.0; - GTimer* _tmp0_; - gdouble _tmp1_; - gdouble _tmp2_; - gdouble _tmp3_; - gdouble _tmp4_; - gdouble _tmp5_; - gdouble _tmp7_; - gdouble _tmp8_; - glong _tmp10_; -#line 330 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (IS_OP_TIMER (self)); -#line 331 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = self->priv->timer; -#line 331 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = g_timer_elapsed (_tmp0_, NULL); -#line 331 "/home/jens/Source/shotwell/src/util/misc.vala" - time = _tmp1_; -#line 333 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = self->priv->elapsed; -#line 333 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = time; -#line 333 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->elapsed = _tmp2_ + _tmp3_; -#line 335 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = time; -#line 335 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = self->priv->shortest; -#line 335 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp4_ < _tmp5_) { -#line 2623 "misc.c" - gdouble _tmp6_; -#line 336 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = time; -#line 336 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->shortest = _tmp6_; -#line 2629 "misc.c" - } -#line 338 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = time; -#line 338 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = self->priv->longest; -#line 338 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp7_ > _tmp8_) { -#line 2637 "misc.c" - gdouble _tmp9_; -#line 339 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = time; -#line 339 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->longest = _tmp9_; -#line 2643 "misc.c" - } -#line 341 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = self->priv->count; -#line 341 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->count = _tmp10_ + 1; -#line 2649 "misc.c" -} - - -gchar* -op_timer_to_string (OpTimer* self) -{ - gchar* result = NULL; - glong _tmp0_; -#line 344 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (IS_OP_TIMER (self), NULL); -#line 345 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = self->priv->count; -#line 345 "/home/jens/Source/shotwell/src/util/misc.vala" - if (_tmp0_ > ((glong) 0)) { -#line 2664 "misc.c" - const gchar* _tmp1_; - glong _tmp2_; - gdouble _tmp3_; - gdouble _tmp4_; - gdouble _tmp5_; - glong _tmp6_; - gdouble _tmp7_; - gchar* _tmp8_; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp1_ = self->priv->name; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp2_ = self->priv->count; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp3_ = self->priv->elapsed; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp4_ = self->priv->shortest; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp5_ = self->priv->elapsed; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp6_ = self->priv->count; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp7_ = self->priv->longest; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp8_ = g_strdup_printf ("%s: count=%ld elapsed=%.03lfs min/avg/max=%.03lf/%.03lf/%.03lf", _tmp1_, _tmp2_, _tmp3_, _tmp4_, _tmp5_ / ((gdouble) _tmp6_), _tmp7_); -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp8_; -#line 346 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 2693 "misc.c" - } else { - const gchar* _tmp9_; - gchar* _tmp10_; -#line 349 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp9_ = self->priv->name; -#line 349 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp10_ = g_strdup_printf ("%s: no operations", _tmp9_); -#line 349 "/home/jens/Source/shotwell/src/util/misc.vala" - result = _tmp10_; -#line 349 "/home/jens/Source/shotwell/src/util/misc.vala" - return result; -#line 2705 "misc.c" - } -} - - -static void -value_op_timer_init (GValue* value) -{ -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2715 "misc.c" -} - - -static void -value_op_timer_free_value (GValue* value) -{ -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (value->data[0].v_pointer) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - op_timer_unref (value->data[0].v_pointer); -#line 2726 "misc.c" - } -} - - -static void -value_op_timer_copy_value (const GValue* src_value, - GValue* dest_value) -{ -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (src_value->data[0].v_pointer) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - dest_value->data[0].v_pointer = op_timer_ref (src_value->data[0].v_pointer); -#line 2739 "misc.c" - } else { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - dest_value->data[0].v_pointer = NULL; -#line 2743 "misc.c" - } -} - - -static gpointer -value_op_timer_peek_pointer (const GValue* value) -{ -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return value->data[0].v_pointer; -#line 2753 "misc.c" -} - - -static gchar* -value_op_timer_collect_value (GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (collect_values[0].v_pointer) { -#line 2765 "misc.c" - OpTimer * object; - object = collect_values[0].v_pointer; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (object->parent_instance.g_class == NULL) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); -#line 2772 "misc.c" - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); -#line 2776 "misc.c" - } -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = op_timer_ref (object); -#line 2780 "misc.c" - } else { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2784 "misc.c" - } -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return NULL; -#line 2788 "misc.c" -} - - -static gchar* -value_op_timer_lcopy_value (const GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ - OpTimer ** object_p; - object_p = collect_values[0].v_pointer; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!object_p) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); -#line 2804 "misc.c" - } -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (!value->data[0].v_pointer) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - *object_p = NULL; -#line 2810 "misc.c" - } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - *object_p = value->data[0].v_pointer; -#line 2814 "misc.c" - } else { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - *object_p = op_timer_ref (value->data[0].v_pointer); -#line 2818 "misc.c" - } -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return NULL; -#line 2822 "misc.c" -} - - -GParamSpec* -param_spec_op_timer (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags) -{ - ParamSpecOpTimer* spec; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (g_type_is_a (object_type, TYPE_OP_TIMER), NULL); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - G_PARAM_SPEC (spec)->value_type = object_type; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return G_PARAM_SPEC (spec); -#line 2842 "misc.c" -} - - -gpointer -value_get_op_timer (const GValue* value) -{ -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_OP_TIMER), NULL); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return value->data[0].v_pointer; -#line 2853 "misc.c" -} - - -void -value_set_op_timer (GValue* value, - gpointer v_object) -{ - OpTimer * old; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_OP_TIMER)); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - old = value->data[0].v_pointer; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (v_object) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_OP_TIMER)); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = v_object; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - op_timer_ref (value->data[0].v_pointer); -#line 2876 "misc.c" - } else { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2880 "misc.c" - } -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (old) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - op_timer_unref (old); -#line 2886 "misc.c" - } -} - - -void -value_take_op_timer (GValue* value, - gpointer v_object) -{ - OpTimer * old; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_OP_TIMER)); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - old = value->data[0].v_pointer; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (v_object) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_OP_TIMER)); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = v_object; -#line 2908 "misc.c" - } else { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - value->data[0].v_pointer = NULL; -#line 2912 "misc.c" - } -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (old) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - op_timer_unref (old); -#line 2918 "misc.c" - } -} - - -static void -op_timer_class_init (OpTimerClass * klass) -{ -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - op_timer_parent_class = g_type_class_peek_parent (klass); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - ((OpTimerClass *) klass)->finalize = op_timer_finalize; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_type_class_add_private (klass, sizeof (OpTimerPrivate)); -#line 2932 "misc.c" -} - - -static void -op_timer_instance_init (OpTimer * self) -{ - GTimer* _tmp0_; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv = OP_TIMER_GET_PRIVATE (self); -#line 316 "/home/jens/Source/shotwell/src/util/misc.vala" - _tmp0_ = g_timer_new (); -#line 316 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->timer = _tmp0_; -#line 317 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->count = (glong) 0; -#line 318 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->elapsed = (gdouble) 0; -#line 319 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->shortest = DBL_MAX; -#line 320 "/home/jens/Source/shotwell/src/util/misc.vala" - self->priv->longest = DBL_MIN; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - self->ref_count = 1; -#line 2956 "misc.c" -} - - -static void -op_timer_finalize (OpTimer * obj) -{ - OpTimer * self; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_OP_TIMER, OpTimer); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_signal_handlers_destroy (self); -#line 315 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_free0 (self->priv->name); -#line 316 "/home/jens/Source/shotwell/src/util/misc.vala" - _g_timer_destroy0 (self->priv->timer); -#line 2972 "misc.c" -} - - -GType -op_timer_get_type (void) -{ - static volatile gsize op_timer_type_id__volatile = 0; - if (g_once_init_enter (&op_timer_type_id__volatile)) { - static const GTypeValueTable g_define_type_value_table = { value_op_timer_init, value_op_timer_free_value, value_op_timer_copy_value, value_op_timer_peek_pointer, "p", value_op_timer_collect_value, "p", value_op_timer_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (OpTimerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) op_timer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OpTimer), 0, (GInstanceInitFunc) op_timer_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - GType op_timer_type_id; - op_timer_type_id = g_type_register_fundamental (g_type_fundamental_next (), "OpTimer", &g_define_type_info, &g_define_type_fundamental_info, 0); - g_once_init_leave (&op_timer_type_id__volatile, op_timer_type_id); - } - return op_timer_type_id__volatile; -} - - -gpointer -op_timer_ref (gpointer instance) -{ - OpTimer * self; - self = instance; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_atomic_int_inc (&self->ref_count); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - return instance; -#line 3001 "misc.c" -} - - -void -op_timer_unref (gpointer instance) -{ - OpTimer * self; - self = instance; -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - if (g_atomic_int_dec_and_test (&self->ref_count)) { -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - OP_TIMER_GET_CLASS (self)->finalize (self); -#line 314 "/home/jens/Source/shotwell/src/util/misc.vala" - g_type_free_instance ((GTypeInstance *) self); -#line 3016 "misc.c" - } -} - - - diff --git a/src/util/string.c b/src/util/string.c deleted file mode 100644 index 0b503fb..0000000 --- a/src/util/string.c +++ /dev/null @@ -1,2033 +0,0 @@ -/* string.c generated by valac 0.40.4, the Vala compiler - * generated from string.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ - - -#include <glib.h> -#include <glib-object.h> -#include <stdlib.h> -#include <string.h> - -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL))) - -#define TYPE_PREPARE_INPUT_TEXT_OPTIONS (prepare_input_text_options_get_type ()) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -typedef enum { - PREPARE_INPUT_TEXT_OPTIONS_EMPTY_IS_NULL = 1 << 0, - PREPARE_INPUT_TEXT_OPTIONS_VALIDATE = 1 << 1, - PREPARE_INPUT_TEXT_OPTIONS_INVALID_IS_NULL = 1 << 2, - PREPARE_INPUT_TEXT_OPTIONS_STRIP = 1 << 3, - PREPARE_INPUT_TEXT_OPTIONS_STRIP_CRLF = 1 << 4, - PREPARE_INPUT_TEXT_OPTIONS_NORMALIZE = 1 << 5, - PREPARE_INPUT_TEXT_OPTIONS_DEFAULT = ((((PREPARE_INPUT_TEXT_OPTIONS_EMPTY_IS_NULL | PREPARE_INPUT_TEXT_OPTIONS_VALIDATE) | PREPARE_INPUT_TEXT_OPTIONS_INVALID_IS_NULL) | PREPARE_INPUT_TEXT_OPTIONS_STRIP_CRLF) | PREPARE_INPUT_TEXT_OPTIONS_STRIP) | PREPARE_INPUT_TEXT_OPTIONS_NORMALIZE -} PrepareInputTextOptions; - - - -gint64 g_ascii_strtoll (const gchar* str, - gchar** endptr, - guint num_base); -#define DEFAULT_USER_TEXT_INPUT_LENGTH 1024 -gboolean is_string_empty (const gchar* s); -gint utf8_cs_compare (void* a, - void* b); -gint utf8_ci_compare (void* a, - void* b); -gchar* uchar_array_to_string (guchar* data, - int data_length1, - gint length); -guchar* string_to_uchar_array (const gchar* str, - int* result_length1); -static void _vala_array_add1 (guchar* * array, - int* length, - int* size, - guchar value); -gchar* guarded_markup_escape_text (const gchar* plain); -glong find_last_offset (const gchar* str, - gchar c); -gboolean is_in_ci_array (const gchar* str, - gchar** strings, - int strings_length1); -GType prepare_input_text_options_get_type (void) G_GNUC_CONST; -gchar* guess_convert (const gchar* text); -gchar* prepare_input_text (const gchar* text, - PrepareInputTextOptions options, - gint dest_length); -gint64 parse_int64 (const gchar* str, - gint num_base); -gboolean string_contains_char (const gchar* haystack, - gunichar needle); -gboolean string_contains_str (const gchar* haystack, - const gchar* needle); -gchar* string_sliced_at (const gchar* str, - gint index); -gchar* string_sliced_at_first_str (const gchar* haystack, - const gchar* needle, - gint start_index); -gchar* string_sliced_at_last_str (const gchar* haystack, - const gchar* needle, - gint start_index); -gchar* string_sliced_at_first_char (const gchar* haystack, - gunichar ch, - gint start_index); -gchar* string_sliced_at_last_char (const gchar* haystack, - gunichar ch, - gint start_index); -gchar* string_strip_leading_zeroes (const gchar* str); -gchar* string_remove_diacritics (const gchar* istring); -gchar* string_to_hex_string (const gchar* str); -guint string_collated_hash (void* ptr); -guint string_precollated_hash (void* ptr); -gint string_collated_compare (void* a, - void* b); -gint string_precollated_compare (const gchar* astr, - const gchar* akey, - const gchar* bstr, - const gchar* bkey); -gboolean string_collated_equals (void* a, - void* b); -gboolean string_precollated_equals (const gchar* astr, - const gchar* akey, - const gchar* bstr, - const gchar* bkey); - - -static gchar -string_get (const gchar* self, - glong index) -{ - gchar result = '\0'; - gchar _tmp0_; -#line 1124 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, '\0'); -#line 1125 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = ((gchar*) self)[index]; -#line 1125 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp0_; -#line 1125 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 117 "string.c" -} - - -inline gboolean -is_string_empty (const gchar* s) -{ - gboolean result = FALSE; - gboolean _tmp0_ = FALSE; -#line 12 "/home/jens/Source/shotwell/src/util/string.vala" - if (s == NULL) { -#line 12 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = TRUE; -#line 130 "string.c" - } else { -#line 12 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = string_get (s, (glong) 0) == '\0'; -#line 134 "string.c" - } -#line 12 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 12 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 140 "string.c" -} - - -gint -utf8_cs_compare (void* a, - void* b) -{ - gint result = 0; -#line 17 "/home/jens/Source/shotwell/src/util/string.vala" - result = g_utf8_collate ((const gchar*) a, (const gchar*) b); -#line 17 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 153 "string.c" -} - - -gint -utf8_ci_compare (void* a, - void* b) -{ - gint result = 0; - gchar* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_; - gchar* _tmp3_; - gint _tmp4_; -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_utf8_strdown ((const gchar*) a, (gssize) -1); -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = _tmp0_; -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = g_utf8_strdown ((const gchar*) b, (gssize) -1); -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = _tmp2_; -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = g_utf8_collate (_tmp1_, _tmp3_); -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp3_); -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp1_); -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp4_; -#line 22 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 185 "string.c" -} - - -gchar* -uchar_array_to_string (guchar* data, - int data_length1, - gint length) -{ - gchar* result = NULL; - GString* builder = NULL; - GString* _tmp0_; - GString* _tmp9_; - const gchar* _tmp10_; - gchar* _tmp11_; -#line 27 "/home/jens/Source/shotwell/src/util/string.vala" - if (length < 0) { -#line 28 "/home/jens/Source/shotwell/src/util/string.vala" - length = data_length1; -#line 204 "string.c" - } -#line 30 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_string_new (""); -#line 30 "/home/jens/Source/shotwell/src/util/string.vala" - builder = _tmp0_; -#line 210 "string.c" - { - gint ctr = 0; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - ctr = 0; -#line 215 "string.c" - { - gboolean _tmp1_ = FALSE; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = TRUE; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - while (TRUE) { -#line 222 "string.c" - gint _tmp3_; - gint _tmp4_; - guchar _tmp5_; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - if (!_tmp1_) { -#line 228 "string.c" - gint _tmp2_; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = ctr; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - ctr = _tmp2_ + 1; -#line 234 "string.c" - } -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = FALSE; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = ctr; -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - if (!(_tmp3_ < length)) { -#line 31 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 244 "string.c" - } -#line 32 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = ctr; -#line 32 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = data[_tmp4_]; -#line 32 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp5_ != ((guchar) '\0')) { -#line 252 "string.c" - GString* _tmp6_; - gint _tmp7_; - guchar _tmp8_; -#line 33 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = builder; -#line 33 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = ctr; -#line 33 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = data[_tmp7_]; -#line 33 "/home/jens/Source/shotwell/src/util/string.vala" - g_string_append_c (_tmp6_, (gchar) _tmp8_); -#line 264 "string.c" - } else { -#line 35 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 268 "string.c" - } - } - } - } -#line 38 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp9_ = builder; -#line 38 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp10_ = _tmp9_->str; -#line 38 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp11_ = g_strdup (_tmp10_); -#line 38 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp11_; -#line 38 "/home/jens/Source/shotwell/src/util/string.vala" - _g_string_free0 (builder); -#line 38 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 285 "string.c" -} - - -static void -_vala_array_add1 (guchar* * array, - int* length, - int* size, - guchar value) -{ -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - if ((*length) == (*size)) { -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - *size = (*size) ? (2 * (*size)) : 4; -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - *array = g_renew (guchar, *array, *size); -#line 301 "string.c" - } -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - (*array)[(*length)++] = value; -#line 305 "string.c" -} - - -guchar* -string_to_uchar_array (const gchar* str, - int* result_length1) -{ - guchar* result = NULL; - guchar* data = NULL; - guchar* _tmp0_; - gint data_length1; - gint _data_size_; - guchar* _tmp8_; - gint _tmp8__length1; -#line 42 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (str != NULL, NULL); -#line 43 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_new0 (guchar, 0); -#line 43 "/home/jens/Source/shotwell/src/util/string.vala" - data = _tmp0_; -#line 43 "/home/jens/Source/shotwell/src/util/string.vala" - data_length1 = 0; -#line 43 "/home/jens/Source/shotwell/src/util/string.vala" - _data_size_ = data_length1; -#line 330 "string.c" - { - gint ctr = 0; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - ctr = 0; -#line 335 "string.c" - { - gboolean _tmp1_ = FALSE; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = TRUE; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - while (TRUE) { -#line 342 "string.c" - gint _tmp3_; - gint _tmp4_; - gint _tmp5_; - guchar* _tmp6_; - gint _tmp6__length1; - gint _tmp7_; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - if (!_tmp1_) { -#line 351 "string.c" - gint _tmp2_; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = ctr; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - ctr = _tmp2_ + 1; -#line 357 "string.c" - } -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = FALSE; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = ctr; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = strlen (str); -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = _tmp4_; -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - if (!(_tmp3_ < _tmp5_)) { -#line 44 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 371 "string.c" - } -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = data; -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6__length1 = data_length1; -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = ctr; -#line 45 "/home/jens/Source/shotwell/src/util/string.vala" - _vala_array_add1 (&data, &data_length1, &_data_size_, (guchar) string_get (str, (glong) _tmp7_)); -#line 381 "string.c" - } - } - } -#line 47 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = data; -#line 47 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8__length1 = data_length1; -#line 47 "/home/jens/Source/shotwell/src/util/string.vala" - if (result_length1) { -#line 47 "/home/jens/Source/shotwell/src/util/string.vala" - *result_length1 = _tmp8__length1; -#line 393 "string.c" - } -#line 47 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp8_; -#line 47 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 399 "string.c" -} - - -inline gchar* -guarded_markup_escape_text (const gchar* plain) -{ - gchar* result = NULL; - gchar* _tmp0_ = NULL; - gboolean _tmp1_ = FALSE; -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - if (!is_string_empty (plain)) { -#line 411 "string.c" - gboolean _tmp2_; -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = g_utf8_validate (plain, (gssize) -1, NULL); -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = _tmp2_; -#line 417 "string.c" - } else { -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = FALSE; -#line 421 "string.c" - } -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp1_) { -#line 425 "string.c" - gchar* _tmp3_; -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = g_markup_escape_text (plain, (gssize) -1); -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp0_); -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = _tmp3_; -#line 433 "string.c" - } else { - gchar* _tmp4_; -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = g_strdup (""); -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp0_); -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = _tmp4_; -#line 442 "string.c" - } -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 58 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 448 "string.c" -} - - -glong -find_last_offset (const gchar* str, - gchar c) -{ - glong result = 0L; - glong offset = 0L; - gint _tmp0_; - gint _tmp1_; -#line 61 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (str != NULL, 0L); -#line 62 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = strlen (str); -#line 62 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = _tmp0_; -#line 62 "/home/jens/Source/shotwell/src/util/string.vala" - offset = (glong) _tmp1_; -#line 63 "/home/jens/Source/shotwell/src/util/string.vala" - while (TRUE) { -#line 470 "string.c" - glong _tmp2_; - glong _tmp3_; - glong _tmp4_; -#line 63 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = offset; -#line 63 "/home/jens/Source/shotwell/src/util/string.vala" - offset = _tmp2_ - 1; -#line 63 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = offset; -#line 63 "/home/jens/Source/shotwell/src/util/string.vala" - if (!(_tmp3_ >= ((glong) 0))) { -#line 63 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 484 "string.c" - } -#line 64 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = offset; -#line 64 "/home/jens/Source/shotwell/src/util/string.vala" - if (string_get (str, _tmp4_) == c) { -#line 65 "/home/jens/Source/shotwell/src/util/string.vala" - result = offset; -#line 65 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 494 "string.c" - } - } -#line 68 "/home/jens/Source/shotwell/src/util/string.vala" - result = (glong) -1; -#line 68 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 501 "string.c" -} - - -gboolean -is_in_ci_array (const gchar* str, - gchar** strings, - int strings_length1) -{ - gboolean result = FALSE; - gchar* strdown = NULL; - gchar* _tmp0_; -#line 73 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (str != NULL, FALSE); -#line 74 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_utf8_strdown (str, (gssize) -1); -#line 74 "/home/jens/Source/shotwell/src/util/string.vala" - strdown = _tmp0_; -#line 519 "string.c" - { - gchar** str_element_collection = NULL; - gint str_element_collection_length1 = 0; - gint _str_element_collection_size_ = 0; - gint str_element_it = 0; -#line 75 "/home/jens/Source/shotwell/src/util/string.vala" - str_element_collection = strings; -#line 75 "/home/jens/Source/shotwell/src/util/string.vala" - str_element_collection_length1 = strings_length1; -#line 75 "/home/jens/Source/shotwell/src/util/string.vala" - for (str_element_it = 0; str_element_it < strings_length1; str_element_it = str_element_it + 1) { -#line 531 "string.c" - gchar* _tmp1_; - gchar* str_element = NULL; -#line 75 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = g_strdup (str_element_collection[str_element_it]); -#line 75 "/home/jens/Source/shotwell/src/util/string.vala" - str_element = _tmp1_; -#line 538 "string.c" - { - const gchar* _tmp2_; - const gchar* _tmp3_; -#line 76 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = strdown; -#line 76 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = str_element; -#line 76 "/home/jens/Source/shotwell/src/util/string.vala" - if (g_strcmp0 (_tmp2_, _tmp3_) == 0) { -#line 77 "/home/jens/Source/shotwell/src/util/string.vala" - result = TRUE; -#line 77 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (str_element); -#line 77 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (strdown); -#line 77 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 556 "string.c" - } -#line 75 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (str_element); -#line 560 "string.c" - } - } - } -#line 80 "/home/jens/Source/shotwell/src/util/string.vala" - result = FALSE; -#line 80 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (strdown); -#line 80 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 570 "string.c" -} - - -GType -prepare_input_text_options_get_type (void) -{ - static volatile gsize prepare_input_text_options_type_id__volatile = 0; - if (g_once_init_enter (&prepare_input_text_options_type_id__volatile)) { - static const GFlagsValue values[] = {{PREPARE_INPUT_TEXT_OPTIONS_EMPTY_IS_NULL, "PREPARE_INPUT_TEXT_OPTIONS_EMPTY_IS_NULL", "empty-is-null"}, {PREPARE_INPUT_TEXT_OPTIONS_VALIDATE, "PREPARE_INPUT_TEXT_OPTIONS_VALIDATE", "validate"}, {PREPARE_INPUT_TEXT_OPTIONS_INVALID_IS_NULL, "PREPARE_INPUT_TEXT_OPTIONS_INVALID_IS_NULL", "invalid-is-null"}, {PREPARE_INPUT_TEXT_OPTIONS_STRIP, "PREPARE_INPUT_TEXT_OPTIONS_STRIP", "strip"}, {PREPARE_INPUT_TEXT_OPTIONS_STRIP_CRLF, "PREPARE_INPUT_TEXT_OPTIONS_STRIP_CRLF", "strip-crlf"}, {PREPARE_INPUT_TEXT_OPTIONS_NORMALIZE, "PREPARE_INPUT_TEXT_OPTIONS_NORMALIZE", "normalize"}, {PREPARE_INPUT_TEXT_OPTIONS_DEFAULT, "PREPARE_INPUT_TEXT_OPTIONS_DEFAULT", "default"}, {0, NULL, NULL}}; - GType prepare_input_text_options_type_id; - prepare_input_text_options_type_id = g_flags_register_static ("PrepareInputTextOptions", values); - g_once_init_leave (&prepare_input_text_options_type_id__volatile, prepare_input_text_options_type_id); - } - return prepare_input_text_options_type_id__volatile; -} - - -gchar* -guess_convert (const gchar* text) -{ - gchar* result = NULL; - gchar* output = NULL; - gsize bytes_read = 0UL; - const gchar* charset = NULL; - const gchar* _tmp0_ = NULL; - gboolean _tmp1_; - gsize _tmp23_; - gint _tmp24_; - gint _tmp25_; - GError * _inner_error_ = NULL; -#line 94 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (text != NULL, NULL); -#line 95 "/home/jens/Source/shotwell/src/util/string.vala" - output = NULL; -#line 96 "/home/jens/Source/shotwell/src/util/string.vala" - bytes_read = (gsize) 0; -#line 97 "/home/jens/Source/shotwell/src/util/string.vala" - charset = NULL; -#line 98 "/home/jens/Source/shotwell/src/util/string.vala" - g_debug ("string.vala:98: CONVERT: Text did not validate as UTF-8, trying conver" \ -"sion"); -#line 101 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = g_get_charset (&_tmp0_); -#line 101 "/home/jens/Source/shotwell/src/util/string.vala" - charset = _tmp0_; -#line 101 "/home/jens/Source/shotwell/src/util/string.vala" - if (!_tmp1_) { -#line 617 "string.c" - gint _tmp2_; - gint _tmp3_; - gsize _tmp4_ = 0UL; - gchar* _tmp5_; - gsize _tmp6_; - gint _tmp7_; - gint _tmp8_; -#line 102 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = strlen (text); -#line 102 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = _tmp2_; -#line 102 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = g_locale_to_utf8 (text, (gssize) _tmp3_, &_tmp4_, NULL, NULL); -#line 102 "/home/jens/Source/shotwell/src/util/string.vala" - bytes_read = _tmp4_; -#line 102 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (output); -#line 102 "/home/jens/Source/shotwell/src/util/string.vala" - output = _tmp5_; -#line 103 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = bytes_read; -#line 103 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = strlen (text); -#line 103 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = _tmp7_; -#line 103 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp6_ == ((gsize) _tmp8_)) { -#line 645 "string.c" - const gchar* _tmp9_; -#line 104 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp9_ = charset; -#line 104 "/home/jens/Source/shotwell/src/util/string.vala" - g_debug ("string.vala:104: CONVERT: Locale is not UTF-8, convert from %s", _tmp9_); -#line 105 "/home/jens/Source/shotwell/src/util/string.vala" - result = output; -#line 105 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 655 "string.c" - } - } - { - gchar* _tmp10_ = NULL; - gint _tmp11_; - gint _tmp12_; - gsize _tmp13_ = 0UL; - gchar* _tmp14_; - gchar* _tmp15_; -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp11_ = strlen (text); -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp12_ = _tmp11_; -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp14_ = g_convert (text, (gssize) _tmp12_, "UTF-8", "WINDOWS-1252", &_tmp13_, NULL, &_inner_error_); -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - bytes_read = _tmp13_; -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp10_ = _tmp14_; -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - if (_inner_error_->domain == G_CONVERT_ERROR) { -#line 679 "string.c" - goto __catch6_g_convert_error; - } -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (output); -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - g_clear_error (&_inner_error_); -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - return NULL; -#line 690 "string.c" - } -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp15_ = _tmp10_; -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp10_ = NULL; -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (output); -#line 110 "/home/jens/Source/shotwell/src/util/string.vala" - output = _tmp15_; -#line 111 "/home/jens/Source/shotwell/src/util/string.vala" - charset = "WINDOWS-1252"; -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp10_); -#line 704 "string.c" - } - goto __finally6; - __catch6_g_convert_error: - { - GError* _error_ = NULL; - GError* _tmp16_; -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - _error_ = _inner_error_; -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - _inner_error_ = NULL; -#line 113 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp16_ = _error_; -#line 113 "/home/jens/Source/shotwell/src/util/string.vala" - if (g_error_matches (_tmp16_, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_CONVERSION)) { -#line 719 "string.c" - { - gchar* _tmp17_ = NULL; - gint _tmp18_; - gint _tmp19_; - gsize _tmp20_ = 0UL; - gchar* _tmp21_; - gchar* _tmp22_; -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp18_ = strlen (text); -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp19_ = _tmp18_; -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp21_ = g_convert (text, (gssize) _tmp19_, "UTF-8", "ISO-8859-1", &_tmp20_, NULL, &_inner_error_); -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - bytes_read = _tmp20_; -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp17_ = _tmp21_; -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 739 "string.c" - goto __catch7_g_error; - } -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp22_ = _tmp17_; -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp17_ = NULL; -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (output); -#line 115 "/home/jens/Source/shotwell/src/util/string.vala" - output = _tmp22_; -#line 116 "/home/jens/Source/shotwell/src/util/string.vala" - charset = "ISO-8859-1"; -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp17_); -#line 754 "string.c" - } - goto __finally7; - __catch7_g_error: - { - GError* _error_ = NULL; -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - _error_ = _inner_error_; -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - _inner_error_ = NULL; -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - _g_error_free0 (_error_); -#line 766 "string.c" - } - __finally7: -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - _g_error_free0 (_error_); -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - _g_error_free0 (_error_); -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (output); -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - g_clear_error (&_inner_error_); -#line 114 "/home/jens/Source/shotwell/src/util/string.vala" - return NULL; -#line 783 "string.c" - } - } -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - _g_error_free0 (_error_); -#line 788 "string.c" - } - __finally6: -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (output); -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - g_clear_error (&_inner_error_); -#line 109 "/home/jens/Source/shotwell/src/util/string.vala" - return NULL; -#line 801 "string.c" - } -#line 121 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp23_ = bytes_read; -#line 121 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp24_ = strlen (text); -#line 121 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp25_ = _tmp24_; -#line 121 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp23_ == ((gsize) _tmp25_)) { -#line 811 "string.c" - const gchar* _tmp26_; -#line 122 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp26_ = charset; -#line 122 "/home/jens/Source/shotwell/src/util/string.vala" - g_debug ("string.vala:122: CONVERT: Guessed conversion from %s", _tmp26_); -#line 124 "/home/jens/Source/shotwell/src/util/string.vala" - result = output; -#line 124 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 821 "string.c" - } -#line 127 "/home/jens/Source/shotwell/src/util/string.vala" - result = NULL; -#line 127 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (output); -#line 127 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 829 "string.c" -} - - -static gchar* -string_strip (const gchar* self) -{ - gchar* result = NULL; - gchar* _result_ = NULL; - gchar* _tmp0_; - const gchar* _tmp1_; -#line 1248 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, NULL); -#line 1249 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_strdup (self); -#line 1249 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _result_ = _tmp0_; -#line 1250 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _result_; -#line 1250 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_strstrip (_tmp1_); -#line 1251 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _result_; -#line 1251 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 854 "string.c" -} - - -static gchar* -string_delimit (const gchar* self, - const gchar* delimiters, - gchar new_delimiter) -{ - gchar* result = NULL; - gchar* _result_ = NULL; - gchar* _tmp0_; - const gchar* _tmp1_; -#line 1256 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, NULL); -#line 1256 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (delimiters != NULL, NULL); -#line 1257 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_strdup (self); -#line 1257 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _result_ = _tmp0_; -#line 1258 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _result_; -#line 1258 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_strdelimit (_tmp1_, delimiters, new_delimiter); -#line 1259 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _result_; -#line 1259 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 883 "string.c" -} - - -gchar* -prepare_input_text (const gchar* text, - PrepareInputTextOptions options, - gint dest_length) -{ - gchar* result = NULL; - gchar* prepped = NULL; - gchar* _tmp0_; - gboolean _tmp12_ = FALSE; -#line 131 "/home/jens/Source/shotwell/src/util/string.vala" - if (text == NULL) { -#line 132 "/home/jens/Source/shotwell/src/util/string.vala" - result = NULL; -#line 132 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 902 "string.c" - } -#line 134 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_strdup (text); -#line 134 "/home/jens/Source/shotwell/src/util/string.vala" - prepped = _tmp0_; -#line 135 "/home/jens/Source/shotwell/src/util/string.vala" - if ((options & PREPARE_INPUT_TEXT_OPTIONS_VALIDATE) == PREPARE_INPUT_TEXT_OPTIONS_VALIDATE) { -#line 910 "string.c" - gboolean _tmp1_; -#line 136 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = g_utf8_validate (text, (gssize) -1, NULL); -#line 136 "/home/jens/Source/shotwell/src/util/string.vala" - if (!_tmp1_) { -#line 916 "string.c" - gchar* _tmp2_; - const gchar* _tmp3_; -#line 137 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = guess_convert (text); -#line 137 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (prepped); -#line 137 "/home/jens/Source/shotwell/src/util/string.vala" - prepped = _tmp2_; -#line 139 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = prepped; -#line 139 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp3_ == NULL) { -#line 929 "string.c" - const gchar* _tmp4_ = NULL; - gchar* _tmp5_; -#line 140 "/home/jens/Source/shotwell/src/util/string.vala" - if ((options & PREPARE_INPUT_TEXT_OPTIONS_INVALID_IS_NULL) != 0) { -#line 140 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = NULL; -#line 936 "string.c" - } else { -#line 140 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = ""; -#line 940 "string.c" - } -#line 140 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = g_strdup (_tmp4_); -#line 140 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp5_; -#line 140 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (prepped); -#line 140 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 950 "string.c" - } - } - } -#line 149 "/home/jens/Source/shotwell/src/util/string.vala" - if ((options & PREPARE_INPUT_TEXT_OPTIONS_NORMALIZE) != 0) { -#line 956 "string.c" - const gchar* _tmp6_; - gchar* _tmp7_; -#line 150 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = prepped; -#line 150 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = g_utf8_normalize (_tmp6_, (gssize) -1, G_NORMALIZE_NFC); -#line 150 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (prepped); -#line 150 "/home/jens/Source/shotwell/src/util/string.vala" - prepped = _tmp7_; -#line 967 "string.c" - } -#line 152 "/home/jens/Source/shotwell/src/util/string.vala" - if ((options & PREPARE_INPUT_TEXT_OPTIONS_STRIP) != 0) { -#line 971 "string.c" - const gchar* _tmp8_; - gchar* _tmp9_; -#line 153 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = prepped; -#line 153 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp9_ = string_strip (_tmp8_); -#line 153 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (prepped); -#line 153 "/home/jens/Source/shotwell/src/util/string.vala" - prepped = _tmp9_; -#line 982 "string.c" - } -#line 157 "/home/jens/Source/shotwell/src/util/string.vala" - if ((options & PREPARE_INPUT_TEXT_OPTIONS_STRIP_CRLF) != 0) { -#line 986 "string.c" - const gchar* _tmp10_; - gchar* _tmp11_; -#line 158 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp10_ = prepped; -#line 158 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp11_ = string_delimit (_tmp10_, "\n\r", ' '); -#line 158 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (prepped); -#line 158 "/home/jens/Source/shotwell/src/util/string.vala" - prepped = _tmp11_; -#line 997 "string.c" - } -#line 160 "/home/jens/Source/shotwell/src/util/string.vala" - if ((options & PREPARE_INPUT_TEXT_OPTIONS_EMPTY_IS_NULL) != 0) { -#line 1001 "string.c" - const gchar* _tmp13_; -#line 160 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp13_ = prepped; -#line 160 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp12_ = is_string_empty (_tmp13_); -#line 1007 "string.c" - } else { -#line 160 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp12_ = FALSE; -#line 1011 "string.c" - } -#line 160 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp12_) { -#line 161 "/home/jens/Source/shotwell/src/util/string.vala" - result = NULL; -#line 161 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (prepped); -#line 161 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1021 "string.c" - } -#line 166 "/home/jens/Source/shotwell/src/util/string.vala" - if (dest_length >= 0) { -#line 1025 "string.c" - GString* sb = NULL; - const gchar* _tmp14_; - GString* _tmp15_; - GString* _tmp16_; - GString* _tmp17_; - const gchar* _tmp18_; - gchar* _tmp19_; -#line 167 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp14_ = prepped; -#line 167 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp15_ = g_string_new (_tmp14_); -#line 167 "/home/jens/Source/shotwell/src/util/string.vala" - sb = _tmp15_; -#line 168 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp16_ = sb; -#line 168 "/home/jens/Source/shotwell/src/util/string.vala" - g_string_truncate (_tmp16_, (gsize) dest_length); -#line 169 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp17_ = sb; -#line 169 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp18_ = _tmp17_->str; -#line 169 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp19_ = g_strdup (_tmp18_); -#line 169 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp19_; -#line 169 "/home/jens/Source/shotwell/src/util/string.vala" - _g_string_free0 (sb); -#line 169 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (prepped); -#line 169 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1057 "string.c" - } -#line 173 "/home/jens/Source/shotwell/src/util/string.vala" - result = prepped; -#line 173 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1063 "string.c" -} - - -gint64 -parse_int64 (const gchar* str, - gint num_base) -{ - gint64 result = 0LL; - gint64 _tmp0_; -#line 176 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (str != NULL, 0LL); -#line 177 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_ascii_strtoll (str, NULL, (guint) num_base); -#line 177 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 177 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1081 "string.c" -} - - -static gint -string_index_of_char (const gchar* self, - gunichar c, - gint start_index) -{ - gint result = 0; - gchar* _result_ = NULL; - gchar* _tmp0_; - gchar* _tmp1_; -#line 1045 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, 0); -#line 1046 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_utf8_strchr (((gchar*) self) + start_index, (gssize) -1, c); -#line 1046 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _result_ = _tmp0_; -#line 1048 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _result_; -#line 1048 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (_tmp1_ != NULL) { -#line 1104 "string.c" - gchar* _tmp2_; -#line 1049 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = _result_; -#line 1049 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = (gint) (_tmp2_ - ((gchar*) self)); -#line 1049 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1112 "string.c" - } else { -#line 1051 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = -1; -#line 1051 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1118 "string.c" - } -} - - -inline gboolean -string_contains_char (const gchar* haystack, - gunichar needle) -{ - gboolean result = FALSE; -#line 182 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (haystack != NULL, FALSE); -#line 183 "/home/jens/Source/shotwell/src/util/string.vala" - result = string_index_of_char (haystack, needle, 0) >= 0; -#line 183 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1134 "string.c" -} - - -static gint -string_index_of (const gchar* self, - const gchar* needle, - gint start_index) -{ - gint result = 0; - gchar* _result_ = NULL; - gchar* _tmp0_; - gchar* _tmp1_; -#line 1025 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, 0); -#line 1025 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (needle != NULL, 0); -#line 1026 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle); -#line 1026 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _result_ = _tmp0_; -#line 1028 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _result_; -#line 1028 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (_tmp1_ != NULL) { -#line 1159 "string.c" - gchar* _tmp2_; -#line 1029 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = _result_; -#line 1029 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = (gint) (_tmp2_ - ((gchar*) self)); -#line 1029 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1167 "string.c" - } else { -#line 1031 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = -1; -#line 1031 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1173 "string.c" - } -} - - -inline gboolean -string_contains_str (const gchar* haystack, - const gchar* needle) -{ - gboolean result = FALSE; -#line 186 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (haystack != NULL, FALSE); -#line 186 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (needle != NULL, FALSE); -#line 187 "/home/jens/Source/shotwell/src/util/string.vala" - result = string_index_of (haystack, needle, 0) >= 0; -#line 187 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1191 "string.c" -} - - -static gchar* -string_slice (const gchar* self, - glong start, - glong end) -{ - gchar* result = NULL; - glong string_length = 0L; - gint _tmp0_; - gint _tmp1_; - gboolean _tmp4_ = FALSE; - gboolean _tmp6_ = FALSE; - gchar* _tmp8_; -#line 1369 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, NULL); -#line 1370 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = strlen (self); -#line 1370 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _tmp0_; -#line 1370 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - string_length = (glong) _tmp1_; -#line 1371 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (start < ((glong) 0)) { -#line 1217 "string.c" - glong _tmp2_; -#line 1372 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = string_length; -#line 1372 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - start = _tmp2_ + start; -#line 1223 "string.c" - } -#line 1374 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (end < ((glong) 0)) { -#line 1227 "string.c" - glong _tmp3_; -#line 1375 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp3_ = string_length; -#line 1375 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - end = _tmp3_ + end; -#line 1233 "string.c" - } -#line 1377 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (start >= ((glong) 0)) { -#line 1237 "string.c" - glong _tmp5_; -#line 1377 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp5_ = string_length; -#line 1377 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp4_ = start <= _tmp5_; -#line 1243 "string.c" - } else { -#line 1377 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp4_ = FALSE; -#line 1247 "string.c" - } -#line 1377 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (_tmp4_, NULL); -#line 1378 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (end >= ((glong) 0)) { -#line 1253 "string.c" - glong _tmp7_; -#line 1378 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp7_ = string_length; -#line 1378 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp6_ = end <= _tmp7_; -#line 1259 "string.c" - } else { -#line 1378 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp6_ = FALSE; -#line 1263 "string.c" - } -#line 1378 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (_tmp6_, NULL); -#line 1379 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (start <= end, NULL); -#line 1380 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp8_ = g_strndup (((gchar*) self) + start, (gsize) (end - start)); -#line 1380 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = _tmp8_; -#line 1380 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1275 "string.c" -} - - -inline gchar* -string_sliced_at (const gchar* str, - gint index) -{ - gchar* result = NULL; - gchar* _tmp0_ = NULL; -#line 190 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (str != NULL, NULL); -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - if (index >= 0) { -#line 1289 "string.c" - gint _tmp1_; - gint _tmp2_; - gchar* _tmp3_; -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = strlen (str); -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = _tmp1_; -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = string_slice (str, (glong) index, (glong) _tmp2_); -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp0_); -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = _tmp3_; -#line 1303 "string.c" - } else { -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp0_); -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = NULL; -#line 1309 "string.c" - } -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 191 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1315 "string.c" -} - - -inline gchar* -string_sliced_at_first_str (const gchar* haystack, - const gchar* needle, - gint start_index) -{ - gchar* result = NULL; - gchar* _tmp0_; -#line 194 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (haystack != NULL, NULL); -#line 194 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (needle != NULL, NULL); -#line 195 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = string_sliced_at (haystack, string_index_of (haystack, needle, start_index)); -#line 195 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 195 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1336 "string.c" -} - - -static gint -string_last_index_of (const gchar* self, - const gchar* needle, - gint start_index) -{ - gint result = 0; - gchar* _result_ = NULL; - gchar* _tmp0_; - gchar* _tmp1_; -#line 1035 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, 0); -#line 1035 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (needle != NULL, 0); -#line 1036 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_strrstr (((gchar*) self) + start_index, (gchar*) needle); -#line 1036 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _result_ = _tmp0_; -#line 1038 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _result_; -#line 1038 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (_tmp1_ != NULL) { -#line 1361 "string.c" - gchar* _tmp2_; -#line 1039 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = _result_; -#line 1039 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = (gint) (_tmp2_ - ((gchar*) self)); -#line 1039 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1369 "string.c" - } else { -#line 1041 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = -1; -#line 1041 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1375 "string.c" - } -} - - -inline gchar* -string_sliced_at_last_str (const gchar* haystack, - const gchar* needle, - gint start_index) -{ - gchar* result = NULL; - gchar* _tmp0_; -#line 198 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (haystack != NULL, NULL); -#line 198 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (needle != NULL, NULL); -#line 199 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = string_sliced_at (haystack, string_last_index_of (haystack, needle, start_index)); -#line 199 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 199 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1397 "string.c" -} - - -inline gchar* -string_sliced_at_first_char (const gchar* haystack, - gunichar ch, - gint start_index) -{ - gchar* result = NULL; - gchar* _tmp0_; -#line 202 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (haystack != NULL, NULL); -#line 203 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = string_sliced_at (haystack, string_index_of_char (haystack, ch, start_index)); -#line 203 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 203 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1416 "string.c" -} - - -static gint -string_last_index_of_char (const gchar* self, - gunichar c, - gint start_index) -{ - gint result = 0; - gchar* _result_ = NULL; - gchar* _tmp0_; - gchar* _tmp1_; -#line 1055 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, 0); -#line 1056 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = g_utf8_strrchr (((gchar*) self) + start_index, (gssize) -1, c); -#line 1056 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _result_ = _tmp0_; -#line 1058 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = _result_; -#line 1058 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (_tmp1_ != NULL) { -#line 1439 "string.c" - gchar* _tmp2_; -#line 1059 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp2_ = _result_; -#line 1059 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = (gint) (_tmp2_ - ((gchar*) self)); -#line 1059 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1447 "string.c" - } else { -#line 1061 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = -1; -#line 1061 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1453 "string.c" - } -} - - -inline gchar* -string_sliced_at_last_char (const gchar* haystack, - gunichar ch, - gint start_index) -{ - gchar* result = NULL; - gchar* _tmp0_; -#line 206 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (haystack != NULL, NULL); -#line 207 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = string_sliced_at (haystack, string_last_index_of_char (haystack, ch, start_index)); -#line 207 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_; -#line 207 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1473 "string.c" -} - - -static gunichar -string_get_char (const gchar* self, - glong index) -{ - gunichar result = 0U; -#line 1154 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, 0U); -#line 1155 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = g_utf8_get_char (((gchar*) self) + index); -#line 1155 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1488 "string.c" -} - - -gchar* -string_strip_leading_zeroes (const gchar* str) -{ - gchar* result = NULL; - GString* stripped = NULL; - GString* _tmp0_; - gboolean prev_is_space = FALSE; - GString* _tmp12_; - const gchar* _tmp13_; - gchar* _tmp14_; -#line 211 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (str != NULL, NULL); -#line 212 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_string_new (""); -#line 212 "/home/jens/Source/shotwell/src/util/string.vala" - stripped = _tmp0_; -#line 213 "/home/jens/Source/shotwell/src/util/string.vala" - prev_is_space = TRUE; -#line 1510 "string.c" - { - const gchar* iter = NULL; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - iter = str; -#line 1515 "string.c" - { - gboolean _tmp1_ = FALSE; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = TRUE; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - while (TRUE) { -#line 1522 "string.c" - const gchar* _tmp4_; - gunichar ch = 0U; - const gchar* _tmp5_; - gboolean _tmp6_ = FALSE; - gboolean _tmp7_; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - if (!_tmp1_) { -#line 1530 "string.c" - const gchar* _tmp2_; - const gchar* _tmp3_; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = iter; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = g_utf8_next_char (_tmp2_); -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - iter = _tmp3_; -#line 1539 "string.c" - } -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = FALSE; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = iter; -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - if (!(string_get_char (_tmp4_, (glong) 0) != ((gunichar) 0))) { -#line 214 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 1549 "string.c" - } -#line 215 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = iter; -#line 215 "/home/jens/Source/shotwell/src/util/string.vala" - ch = string_get_char (_tmp5_, (glong) 0); -#line 217 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = prev_is_space; -#line 217 "/home/jens/Source/shotwell/src/util/string.vala" - if (!_tmp7_) { -#line 217 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = TRUE; -#line 1561 "string.c" - } else { - gunichar _tmp8_; -#line 217 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = ch; -#line 217 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = _tmp8_ != ((gunichar) '0'); -#line 1568 "string.c" - } -#line 217 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp6_) { -#line 1572 "string.c" - GString* _tmp9_; - gunichar _tmp10_; - gunichar _tmp11_; -#line 218 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp9_ = stripped; -#line 218 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp10_ = ch; -#line 218 "/home/jens/Source/shotwell/src/util/string.vala" - g_string_append_unichar (_tmp9_, _tmp10_); -#line 219 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp11_ = ch; -#line 219 "/home/jens/Source/shotwell/src/util/string.vala" - prev_is_space = g_unichar_isspace (_tmp11_); -#line 1586 "string.c" - } - } - } - } -#line 223 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp12_ = stripped; -#line 223 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp13_ = _tmp12_->str; -#line 223 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp14_ = g_strdup (_tmp13_); -#line 223 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp14_; -#line 223 "/home/jens/Source/shotwell/src/util/string.vala" - _g_string_free0 (stripped); -#line 223 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1603 "string.c" -} - - -static gboolean -string_get_next_char (const gchar* self, - gint* index, - gunichar* c) -{ - gunichar _vala_c = 0U; - gboolean result = FALSE; - gunichar _tmp0_; -#line 1143 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - g_return_val_if_fail (self != NULL, FALSE); -#line 1144 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _vala_c = g_utf8_get_char (((gchar*) self) + (*index)); -#line 1145 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp0_ = _vala_c; -#line 1145 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (_tmp0_ != ((gunichar) 0)) { -#line 1623 "string.c" - gchar* _tmp1_; -#line 1146 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - _tmp1_ = g_utf8_next_char (((gchar*) self) + (*index)); -#line 1146 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - *index = (gint) (_tmp1_ - ((gchar*) self)); -#line 1147 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = TRUE; -#line 1147 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (c) { -#line 1147 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - *c = _vala_c; -#line 1635 "string.c" - } -#line 1147 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1639 "string.c" - } else { -#line 1149 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - result = FALSE; -#line 1149 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (c) { -#line 1149 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - *c = _vala_c; -#line 1647 "string.c" - } -#line 1149 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - return result; -#line 1651 "string.c" - } -#line 1143 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - if (c) { -#line 1143 "/usr/share/vala-0.40/vapi/glib-2.0.vapi" - *c = _vala_c; -#line 1657 "string.c" - } -} - - -gchar* -string_remove_diacritics (const gchar* istring) -{ - gchar* result = NULL; - GString* builder = NULL; - GString* _tmp0_; - gunichar ch = 0U; - gint i = 0; - GString* _tmp9_; - const gchar* _tmp10_; - gchar* _tmp11_; -#line 226 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (istring != NULL, NULL); -#line 227 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_string_new (""); -#line 227 "/home/jens/Source/shotwell/src/util/string.vala" - builder = _tmp0_; -#line 229 "/home/jens/Source/shotwell/src/util/string.vala" - i = 0; -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - while (TRUE) { -#line 1683 "string.c" - gchar* _tmp1_; - gchar* _tmp2_; - gunichar _tmp3_ = 0U; - gboolean _tmp4_; - gboolean _tmp5_; - gunichar _tmp6_; - GString* _tmp7_; - gunichar _tmp8_; -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = g_utf8_normalize (istring, (gssize) -1, G_NORMALIZE_DEFAULT); -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = _tmp1_; -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = string_get_next_char (_tmp2_, &i, &_tmp3_); -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - ch = _tmp3_; -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = !_tmp4_; -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp2_); -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp5_) { -#line 230 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 1708 "string.c" - } -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = ch; -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - switch (g_unichar_type (_tmp6_)) { -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - case G_UNICODE_CONTROL: -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - case G_UNICODE_FORMAT: -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - case G_UNICODE_UNASSIGNED: -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - case G_UNICODE_NON_SPACING_MARK: -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - case G_UNICODE_COMBINING_MARK: -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - case G_UNICODE_ENCLOSING_MARK: -#line 1726 "string.c" - { -#line 239 "/home/jens/Source/shotwell/src/util/string.vala" - continue; -#line 1730 "string.c" - } - default: -#line 231 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 1735 "string.c" - } -#line 241 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = builder; -#line 241 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = ch; -#line 241 "/home/jens/Source/shotwell/src/util/string.vala" - g_string_append_unichar (_tmp7_, _tmp8_); -#line 1743 "string.c" - } -#line 243 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp9_ = builder; -#line 243 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp10_ = _tmp9_->str; -#line 243 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp11_ = g_strdup (_tmp10_); -#line 243 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp11_; -#line 243 "/home/jens/Source/shotwell/src/util/string.vala" - _g_string_free0 (builder); -#line 243 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1757 "string.c" -} - - -gchar* -string_to_hex_string (const gchar* str) -{ - gchar* result = NULL; - GString* builder = NULL; - GString* _tmp0_; - guint8* data = NULL; - GString* _tmp6_; - const gchar* _tmp7_; - gchar* _tmp8_; -#line 246 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (str != NULL, NULL); -#line 247 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_string_new (""); -#line 247 "/home/jens/Source/shotwell/src/util/string.vala" - builder = _tmp0_; -#line 249 "/home/jens/Source/shotwell/src/util/string.vala" - data = (guint8*) str; -#line 250 "/home/jens/Source/shotwell/src/util/string.vala" - while (TRUE) { -#line 1781 "string.c" - guint8* _tmp1_; - const gchar* _tmp2_ = NULL; - guint8* _tmp3_; - GString* _tmp4_; - guint8* _tmp5_; -#line 250 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = data; -#line 250 "/home/jens/Source/shotwell/src/util/string.vala" - if (!(((gint) (*_tmp1_)) != 0)) { -#line 250 "/home/jens/Source/shotwell/src/util/string.vala" - break; -#line 1793 "string.c" - } -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = data; -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - if (((gint) (*_tmp3_)) != 0) { -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = " "; -#line 1801 "string.c" - } else { -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = ""; -#line 1805 "string.c" - } -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = builder; -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = data; -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - data = _tmp5_ + 1; -#line 251 "/home/jens/Source/shotwell/src/util/string.vala" - g_string_append_printf (_tmp4_, "%02Xh%s", (guint) (*_tmp5_), _tmp2_); -#line 1815 "string.c" - } -#line 253 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = builder; -#line 253 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = _tmp6_->str; -#line 253 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = g_strdup (_tmp7_); -#line 253 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp8_; -#line 253 "/home/jens/Source/shotwell/src/util/string.vala" - _g_string_free0 (builder); -#line 253 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1829 "string.c" -} - - -guint -string_collated_hash (void* ptr) -{ - guint result = 0U; - gchar* str = NULL; - gchar* _tmp0_; - GHashFunc _tmp1_; - gchar* _tmp2_; - gchar* _tmp3_; - guint _tmp4_; -#line 273 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_strdup ((const gchar*) ptr); -#line 273 "/home/jens/Source/shotwell/src/util/string.vala" - str = _tmp0_; -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = g_str_hash; -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = g_utf8_collate_key (str, (gssize) -1); -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = _tmp2_; -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = _tmp1_ (_tmp3_); -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (_tmp3_); -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp4_; -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (str); -#line 275 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1863 "string.c" -} - - -guint -string_precollated_hash (void* ptr) -{ - guint result = 0U; - GHashFunc _tmp0_; -#line 280 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_str_hash; -#line 280 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp0_ ((const gchar*) ptr); -#line 280 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1878 "string.c" -} - - -gint -string_collated_compare (void* a, - void* b) -{ - gint result = 0; - gchar* astr = NULL; - gchar* _tmp0_; - gchar* bstr = NULL; - gchar* _tmp1_; - gint _result_ = 0; - const gchar* _tmp2_; - const gchar* _tmp3_; - gint _tmp4_ = 0; - gint _tmp5_; -#line 285 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_strdup ((const gchar*) a); -#line 285 "/home/jens/Source/shotwell/src/util/string.vala" - astr = _tmp0_; -#line 286 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = g_strdup ((const gchar*) b); -#line 286 "/home/jens/Source/shotwell/src/util/string.vala" - bstr = _tmp1_; -#line 288 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = astr; -#line 288 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = bstr; -#line 288 "/home/jens/Source/shotwell/src/util/string.vala" - _result_ = g_utf8_collate (_tmp2_, _tmp3_); -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp5_ = _result_; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp5_ != 0) { -#line 1914 "string.c" - gint _tmp6_; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp6_ = _result_; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = _tmp6_; -#line 1920 "string.c" - } else { - GCompareFunc _tmp7_; - const gchar* _tmp8_; - const gchar* _tmp9_; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp7_ = g_strcmp0; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp8_ = astr; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp9_ = bstr; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = _tmp7_ (_tmp8_, _tmp9_); -#line 1933 "string.c" - } -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp4_; -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (bstr); -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - _g_free0 (astr); -#line 290 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1943 "string.c" -} - - -gint -string_precollated_compare (const gchar* astr, - const gchar* akey, - const gchar* bstr, - const gchar* bkey) -{ - gint result = 0; - gint _result_ = 0; - GCompareFunc _tmp0_; - gint _tmp1_ = 0; - gint _tmp2_; -#line 294 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (astr != NULL, 0); -#line 294 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (akey != NULL, 0); -#line 294 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (bstr != NULL, 0); -#line 294 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (bkey != NULL, 0); -#line 295 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp0_ = g_strcmp0; -#line 295 "/home/jens/Source/shotwell/src/util/string.vala" - _result_ = _tmp0_ (akey, bkey); -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp2_ = _result_; -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - if (_tmp2_ != 0) { -#line 1974 "string.c" - gint _tmp3_; -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp3_ = _result_; -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = _tmp3_; -#line 1980 "string.c" - } else { - GCompareFunc _tmp4_; -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp4_ = g_strcmp0; -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - _tmp1_ = _tmp4_ (astr, bstr); -#line 1987 "string.c" - } -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - result = _tmp1_; -#line 297 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 1993 "string.c" -} - - -gboolean -string_collated_equals (void* a, - void* b) -{ - gboolean result = FALSE; -#line 302 "/home/jens/Source/shotwell/src/util/string.vala" - result = string_collated_compare (a, b) == 0; -#line 302 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 2006 "string.c" -} - - -gboolean -string_precollated_equals (const gchar* astr, - const gchar* akey, - const gchar* bstr, - const gchar* bkey) -{ - gboolean result = FALSE; -#line 306 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (astr != NULL, FALSE); -#line 306 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (akey != NULL, FALSE); -#line 306 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (bstr != NULL, FALSE); -#line 306 "/home/jens/Source/shotwell/src/util/string.vala" - g_return_val_if_fail (bkey != NULL, FALSE); -#line 307 "/home/jens/Source/shotwell/src/util/string.vala" - result = string_precollated_compare (astr, akey, bstr, bkey) == 0; -#line 307 "/home/jens/Source/shotwell/src/util/string.vala" - return result; -#line 2029 "string.c" -} - - - diff --git a/src/util/system.c b/src/util/system.c deleted file mode 100644 index 958256c..0000000 --- a/src/util/system.c +++ /dev/null @@ -1,189 +0,0 @@ -/* system.c generated by valac 0.40.4, the Vala compiler - * generated from system.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU LGPL (version 2.1 or later). - * See the COPYING file in this distribution. - */ -/* Return the directory in which Shotwell is installed, or null if uninstalled.*/ - - -#include <glib.h> -#include <glib-object.h> -#include <gio/gio.h> -#include <glib/gstdio.h> -#include <stdlib.h> -#include <string.h> -#include <gdk/gdk.h> -#include <gtk/gtk.h> - -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - - - -GFile* get_sys_install_dir (GFile* exec_dir); -#define RESOURCES_PREFIX _PREFIX -gchar* get_nautilus_install_location (void); -void sys_show_uri (GdkScreen* screen, - const gchar* uri, - GError** error); -void show_file_in_nautilus (const gchar* filename, - GError** error); - - -GFile* -get_sys_install_dir (GFile* exec_dir) -{ - GFile* result = NULL; - GFile* child = NULL; - GFile* _tmp0_; - GFile* _tmp1_; - gchar* _tmp2_; - gchar* _tmp3_; - gboolean _tmp4_; -#line 8 "/home/jens/Source/shotwell/src/util/system.vala" - g_return_val_if_fail (G_IS_FILE (exec_dir), NULL); -#line 10 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp0_ = g_file_get_child (exec_dir, "ui"); -#line 10 "/home/jens/Source/shotwell/src/util/system.vala" - child = _tmp0_; -#line 12 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp1_ = child; -#line 12 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp2_ = g_file_get_path (_tmp1_); -#line 12 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp3_ = _tmp2_; -#line 12 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp4_ = !g_file_test (_tmp3_, G_FILE_TEST_IS_DIR | G_FILE_TEST_EXISTS); -#line 12 "/home/jens/Source/shotwell/src/util/system.vala" - _g_free0 (_tmp3_); -#line 12 "/home/jens/Source/shotwell/src/util/system.vala" - if (_tmp4_) { -#line 65 "system.c" - gchar* _tmp5_; - gchar* _tmp6_; - gboolean _tmp7_; - GFile* _tmp8_; -#line 14 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp5_ = g_file_get_basename (exec_dir); -#line 14 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp6_ = _tmp5_; -#line 14 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp7_ = g_strcmp0 (_tmp6_, "src") == 0; -#line 14 "/home/jens/Source/shotwell/src/util/system.vala" - _g_free0 (_tmp6_); -#line 14 "/home/jens/Source/shotwell/src/util/system.vala" - if (_tmp7_) { -#line 15 "/home/jens/Source/shotwell/src/util/system.vala" - result = NULL; -#line 15 "/home/jens/Source/shotwell/src/util/system.vala" - _g_object_unref0 (child); -#line 15 "/home/jens/Source/shotwell/src/util/system.vala" - return result; -#line 86 "system.c" - } -#line 18 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp8_ = g_file_new_for_path (RESOURCES_PREFIX); -#line 18 "/home/jens/Source/shotwell/src/util/system.vala" - result = _tmp8_; -#line 18 "/home/jens/Source/shotwell/src/util/system.vala" - _g_object_unref0 (child); -#line 18 "/home/jens/Source/shotwell/src/util/system.vala" - return result; -#line 96 "system.c" - } -#line 21 "/home/jens/Source/shotwell/src/util/system.vala" - result = NULL; -#line 21 "/home/jens/Source/shotwell/src/util/system.vala" - _g_object_unref0 (child); -#line 21 "/home/jens/Source/shotwell/src/util/system.vala" - return result; -#line 104 "system.c" -} - - -gchar* -get_nautilus_install_location (void) -{ - gchar* result = NULL; - gchar* _tmp0_; -#line 25 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp0_ = g_find_program_in_path ("nautilus"); -#line 25 "/home/jens/Source/shotwell/src/util/system.vala" - result = _tmp0_; -#line 25 "/home/jens/Source/shotwell/src/util/system.vala" - return result; -#line 119 "system.c" -} - - -void -sys_show_uri (GdkScreen* screen, - const gchar* uri, - GError** error) -{ - GError * _inner_error_ = NULL; -#line 28 "/home/jens/Source/shotwell/src/util/system.vala" - g_return_if_fail (GDK_IS_SCREEN (screen)); -#line 28 "/home/jens/Source/shotwell/src/util/system.vala" - g_return_if_fail (uri != NULL); -#line 29 "/home/jens/Source/shotwell/src/util/system.vala" - gtk_show_uri (screen, uri, (guint32) GDK_CURRENT_TIME, &_inner_error_); -#line 29 "/home/jens/Source/shotwell/src/util/system.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 29 "/home/jens/Source/shotwell/src/util/system.vala" - g_propagate_error (error, _inner_error_); -#line 29 "/home/jens/Source/shotwell/src/util/system.vala" - return; -#line 141 "system.c" - } -} - - -void -show_file_in_nautilus (const gchar* filename, - GError** error) -{ - gchar* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_; - gchar* _tmp3_; - gchar* _tmp4_; - gchar* _tmp5_; - GError * _inner_error_ = NULL; -#line 32 "/home/jens/Source/shotwell/src/util/system.vala" - g_return_if_fail (filename != NULL); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp0_ = get_nautilus_install_location (); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp1_ = _tmp0_; -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp2_ = g_strconcat (_tmp1_, " ", NULL); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp3_ = _tmp2_; -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp4_ = g_strconcat (_tmp3_, filename, NULL); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _tmp5_ = _tmp4_; -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - g_spawn_command_line_async (_tmp5_, &_inner_error_); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _g_free0 (_tmp5_); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _g_free0 (_tmp3_); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - _g_free0 (_tmp1_); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - if (G_UNLIKELY (_inner_error_ != NULL)) { -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - g_propagate_error (error, _inner_error_); -#line 33 "/home/jens/Source/shotwell/src/util/system.vala" - return; -#line 185 "system.c" - } -} - - - diff --git a/src/util/system.vala b/src/util/system.vala index 38abf1e..1e69304 100644 --- a/src/util/system.vala +++ b/src/util/system.vala @@ -21,15 +21,29 @@ File? get_sys_install_dir(File exec_dir) { return null; } -string get_nautilus_install_location() { - return Environment.find_program_in_path("nautilus"); +[DBus (name = "org.freedesktop.FileManager1")] +public interface org.freedesktop.FileManager1 : Object { + public const string NAME = "org.freedesktop.FileManager1"; + public const string PATH = "/org/freedesktop/FileManager1"; + + public abstract async void show_folders(string[] uris, string startup_id) throws IOError, DBusError; + public abstract async void show_items(string[] uris, string startup_id) throws IOError, DBusError; + public abstract async void show_item_properties(string[] uris, string startup_id) throws IOError, DBusError; } -void sys_show_uri(Gdk.Screen screen, string uri) throws Error { - Gtk.show_uri(screen, uri, Gdk.CURRENT_TIME); -} - -void show_file_in_nautilus(string filename) throws Error { - GLib.Process.spawn_command_line_async(get_nautilus_install_location() + " " + filename); +async void show_file_in_filemanager(File file) throws Error { + try { + org.freedesktop.FileManager1? manager = yield Bus.get_proxy (BusType.SESSION, + org.freedesktop.FileManager1.NAME, + org.freedesktop.FileManager1.PATH, + DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | + DBusProxyFlags.DO_NOT_CONNECT_SIGNALS); + var id = "%s_%s_%d_%s".printf(Environment.get_prgname(), Environment.get_host_name(), + Posix.getpid(), TimeVal().to_iso8601()); + yield manager.show_items({file.get_uri()}, id); + } catch (Error e) { + warning("Failed to launch file manager using DBus, using fall-back: %s", e.message); + Gtk.show_uri_on_window(AppWindow.get_instance(), file.get_parent().get_uri(), Gdk.CURRENT_TIME); + } } diff --git a/src/util/ui.c b/src/util/ui.c deleted file mode 100644 index 98f35de..0000000 --- a/src/util/ui.c +++ /dev/null @@ -1,234 +0,0 @@ -/* ui.c generated by valac 0.40.4, the Vala compiler - * generated from ui.vala, do not modify */ - -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ - - -#include <glib.h> -#include <glib-object.h> -#include "shotwell-plugin-dev-1.0.h" -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> -#include <gdk/gdk.h> - - -#define TYPE_ADJUSTMENT_RELATION (adjustment_relation_get_type ()) - -#define TYPE_COMPASS_POINT (compass_point_get_type ()) - -#define TYPE_DIRECTION (direction_get_type ()) - -typedef enum { - ADJUSTMENT_RELATION_BELOW, - ADJUSTMENT_RELATION_IN_RANGE, - ADJUSTMENT_RELATION_ABOVE -} AdjustmentRelation; - -typedef enum { - COMPASS_POINT_NORTH, - COMPASS_POINT_SOUTH, - COMPASS_POINT_EAST, - COMPASS_POINT_WEST -} CompassPoint; - -typedef enum { - DIRECTION_FORWARD, - DIRECTION_BACKWARD -} Direction; - - - -GType adjustment_relation_get_type (void) G_GNUC_CONST; -GType compass_point_get_type (void) G_GNUC_CONST; -GType direction_get_type (void) G_GNUC_CONST; -SpitTransitionsDirection direction_to_transition_direction (Direction self); -const gchar* direction_to_string (Direction self); -void spin_event_loop (void); -AdjustmentRelation get_adjustment_relation (GtkAdjustment* adjustment, - gint value); -void get_adjustment_page (GtkAdjustment* hadj, - GtkAdjustment* vadj, - GdkRectangle* result); -gboolean has_only_key_modifier (GdkModifierType field, - GdkModifierType mask); - - -GType -adjustment_relation_get_type (void) -{ - static volatile gsize adjustment_relation_type_id__volatile = 0; - if (g_once_init_enter (&adjustment_relation_type_id__volatile)) { - static const GEnumValue values[] = {{ADJUSTMENT_RELATION_BELOW, "ADJUSTMENT_RELATION_BELOW", "below"}, {ADJUSTMENT_RELATION_IN_RANGE, "ADJUSTMENT_RELATION_IN_RANGE", "in-range"}, {ADJUSTMENT_RELATION_ABOVE, "ADJUSTMENT_RELATION_ABOVE", "above"}, {0, NULL, NULL}}; - GType adjustment_relation_type_id; - adjustment_relation_type_id = g_enum_register_static ("AdjustmentRelation", values); - g_once_init_leave (&adjustment_relation_type_id__volatile, adjustment_relation_type_id); - } - return adjustment_relation_type_id__volatile; -} - - -GType -compass_point_get_type (void) -{ - static volatile gsize compass_point_type_id__volatile = 0; - if (g_once_init_enter (&compass_point_type_id__volatile)) { - static const GEnumValue values[] = {{COMPASS_POINT_NORTH, "COMPASS_POINT_NORTH", "north"}, {COMPASS_POINT_SOUTH, "COMPASS_POINT_SOUTH", "south"}, {COMPASS_POINT_EAST, "COMPASS_POINT_EAST", "east"}, {COMPASS_POINT_WEST, "COMPASS_POINT_WEST", "west"}, {0, NULL, NULL}}; - GType compass_point_type_id; - compass_point_type_id = g_enum_register_static ("CompassPoint", values); - g_once_init_leave (&compass_point_type_id__volatile, compass_point_type_id); - } - return compass_point_type_id__volatile; -} - - -SpitTransitionsDirection -direction_to_transition_direction (Direction self) -{ - SpitTransitionsDirection result = 0; -#line 25 "/home/jens/Source/shotwell/src/util/ui.vala" - switch (self) { -#line 25 "/home/jens/Source/shotwell/src/util/ui.vala" - case DIRECTION_FORWARD: -#line 98 "ui.c" - { -#line 27 "/home/jens/Source/shotwell/src/util/ui.vala" - result = SPIT_TRANSITIONS_DIRECTION_FORWARD; -#line 27 "/home/jens/Source/shotwell/src/util/ui.vala" - return result; -#line 104 "ui.c" - } -#line 25 "/home/jens/Source/shotwell/src/util/ui.vala" - case DIRECTION_BACKWARD: -#line 108 "ui.c" - { -#line 30 "/home/jens/Source/shotwell/src/util/ui.vala" - result = SPIT_TRANSITIONS_DIRECTION_BACKWARD; -#line 30 "/home/jens/Source/shotwell/src/util/ui.vala" - return result; -#line 114 "ui.c" - } - default: - { - GEnumValue* _tmp0_; -#line 33 "/home/jens/Source/shotwell/src/util/ui.vala" - _tmp0_ = g_enum_get_value (g_type_class_ref (TYPE_DIRECTION), self); -#line 33 "/home/jens/Source/shotwell/src/util/ui.vala" - g_error ("ui.vala:33: Unknown Direction %s", (_tmp0_ != NULL) ? _tmp0_->value_name : NULL); -#line 123 "ui.c" - } - } -} - - -GType -direction_get_type (void) -{ - static volatile gsize direction_type_id__volatile = 0; - if (g_once_init_enter (&direction_type_id__volatile)) { - static const GEnumValue values[] = {{DIRECTION_FORWARD, "DIRECTION_FORWARD", "forward"}, {DIRECTION_BACKWARD, "DIRECTION_BACKWARD", "backward"}, {0, NULL, NULL}}; - GType direction_type_id; - direction_type_id = g_enum_register_static ("Direction", values); - g_once_init_leave (&direction_type_id__volatile, direction_type_id); - } - return direction_type_id__volatile; -} - - -void -spin_event_loop (void) -{ -#line 39 "/home/jens/Source/shotwell/src/util/ui.vala" - while (TRUE) { -#line 39 "/home/jens/Source/shotwell/src/util/ui.vala" - if (!gtk_events_pending ()) { -#line 39 "/home/jens/Source/shotwell/src/util/ui.vala" - break; -#line 152 "ui.c" - } -#line 40 "/home/jens/Source/shotwell/src/util/ui.vala" - gtk_main_iteration (); -#line 156 "ui.c" - } -} - - -AdjustmentRelation -get_adjustment_relation (GtkAdjustment* adjustment, - gint value) -{ - AdjustmentRelation result = 0; -#line 43 "/home/jens/Source/shotwell/src/util/ui.vala" - g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), 0); -#line 44 "/home/jens/Source/shotwell/src/util/ui.vala" - if (value < ((gint) gtk_adjustment_get_value (adjustment))) { -#line 45 "/home/jens/Source/shotwell/src/util/ui.vala" - result = ADJUSTMENT_RELATION_BELOW; -#line 45 "/home/jens/Source/shotwell/src/util/ui.vala" - return result; -#line 174 "ui.c" - } else { -#line 46 "/home/jens/Source/shotwell/src/util/ui.vala" - if (value > ((gint) (gtk_adjustment_get_value (adjustment) + gtk_adjustment_get_page_size (adjustment)))) { -#line 47 "/home/jens/Source/shotwell/src/util/ui.vala" - result = ADJUSTMENT_RELATION_ABOVE; -#line 47 "/home/jens/Source/shotwell/src/util/ui.vala" - return result; -#line 182 "ui.c" - } else { -#line 49 "/home/jens/Source/shotwell/src/util/ui.vala" - result = ADJUSTMENT_RELATION_IN_RANGE; -#line 49 "/home/jens/Source/shotwell/src/util/ui.vala" - return result; -#line 188 "ui.c" - } - } -} - - -void -get_adjustment_page (GtkAdjustment* hadj, - GtkAdjustment* vadj, - GdkRectangle* result) -{ - GdkRectangle rect = {0}; -#line 52 "/home/jens/Source/shotwell/src/util/ui.vala" - g_return_if_fail (GTK_IS_ADJUSTMENT (hadj)); -#line 52 "/home/jens/Source/shotwell/src/util/ui.vala" - g_return_if_fail (GTK_IS_ADJUSTMENT (vadj)); -#line 53 "/home/jens/Source/shotwell/src/util/ui.vala" - memset (&rect, 0, sizeof (GdkRectangle)); -#line 54 "/home/jens/Source/shotwell/src/util/ui.vala" - rect.x = (gint) gtk_adjustment_get_value (hadj); -#line 55 "/home/jens/Source/shotwell/src/util/ui.vala" - rect.y = (gint) gtk_adjustment_get_value (vadj); -#line 56 "/home/jens/Source/shotwell/src/util/ui.vala" - rect.width = (gint) gtk_adjustment_get_page_size (hadj); -#line 57 "/home/jens/Source/shotwell/src/util/ui.vala" - rect.height = (gint) gtk_adjustment_get_page_size (vadj); -#line 59 "/home/jens/Source/shotwell/src/util/ui.vala" - *result = rect; -#line 59 "/home/jens/Source/shotwell/src/util/ui.vala" - return; -#line 218 "ui.c" -} - - -gboolean -has_only_key_modifier (GdkModifierType field, - GdkModifierType mask) -{ - gboolean result = FALSE; -#line 77 "/home/jens/Source/shotwell/src/util/ui.vala" - result = (field & ((((((((GDK_SHIFT_MASK | GDK_CONTROL_MASK) | GDK_MOD1_MASK) | GDK_MOD3_MASK) | GDK_MOD4_MASK) | GDK_MOD5_MASK) | GDK_SUPER_MASK) | GDK_HYPER_MASK) | GDK_META_MASK)) == mask; -#line 77 "/home/jens/Source/shotwell/src/util/ui.vala" - return result; -#line 231 "ui.c" -} - - - diff --git a/src/util/ui.vala b/src/util/ui.vala index e1c22f1..7e7348f 100644 --- a/src/util/ui.vala +++ b/src/util/ui.vala @@ -86,3 +86,20 @@ public bool has_only_key_modifier(Gdk.ModifierType field, Gdk.ModifierType mask) | Gdk.ModifierType.META_MASK)) == mask; } +#if ENABLE_FACES +bool is_pointer_over(Gdk.Window window) { + Gdk.DeviceManager? devmgr = window.get_display().get_device_manager(); + if (devmgr == null) { + debug("No device for display"); + + return false; + } + + int x, y; + devmgr.get_client_pointer().get_position(null, out x, out y); + //gdk_device_get_position(devmgr.get_client_pointer(), null, out x, out y); + + return x >= 0 && y >= 0 && x < window.get_width() && y < window.get_height(); +} +#endif + |