~ubuntu-branches/ubuntu/utopic/evolution-data-server/utopic-proposed

« back to all changes in this revision

Viewing changes to libedataserver/e-data-server-util.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-06-13 12:02:14 UTC
  • mfrom: (1.1.116) (1.2.35 sid)
  • Revision ID: package-import@ubuntu.com-20140613120214-1zx93d8jxwt093aw
Tags: 3.12.2-1ubuntu1
* Merge with Debian, remaining changes:
  - debian/control: build depend on hardening-wrapper
  - Add build-depends and pass configure flag to enable Ubuntu Online
    Accounts support.
  - Filter out -Bsymbolic-functions from LDFLAGS (for future people
    wondering about this change, see e.g. BGO #594473 and duplicates).
  - Enable Ubuntu Online Accounts and split it and GOA into a separate
    package

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
4
4
 * Copyright (C) 2012 Intel Corporation
5
5
 *
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of version 2 of the GNU Lesser General Public
8
 
 * License as published by the Free Software Foundation.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the
17
 
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 
 * Boston, MA 02110-1301, USA.
 
6
 * This library is free software; you can redistribute it and/or modify it
 
7
 * under the terms of the GNU Lesser General Public License as published by
 
8
 * the Free Software Foundation.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful, but
 
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
12
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
13
 * for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public License
 
16
 * along with this library; if not, see <http://www.gnu.org/licenses/>.
19
17
 *
20
18
 * Authors:
21
19
 *    Rodrigo Moya <rodrigo@ximian.com>
119
117
}
120
118
 
121
119
/**
 
120
 * e_util_strv_equal:
 
121
 * @v1: (allow-none): a %NULL-terminated string array, or %NULL
 
122
 * @v2: (allow-none): another %NULL-terminated string array, or %NULL
 
123
 *
 
124
 * Compares @v1 and @v2 for equality, handling %NULL gracefully.
 
125
 *
 
126
 * The arguments types are generic for compatibility with #GEqualFunc.
 
127
 *
 
128
 * Returns: whether @v1 and @v2 are identical
 
129
 *
 
130
 * Since: 3.12
 
131
 **/
 
132
gboolean
 
133
e_util_strv_equal (gconstpointer v1,
 
134
                   gconstpointer v2)
 
135
{
 
136
        gchar **strv1 = (gchar **) v1;
 
137
        gchar **strv2 = (gchar **) v2;
 
138
        guint length1, length2, ii;
 
139
 
 
140
        if (strv1 == strv2)
 
141
                return TRUE;
 
142
 
 
143
        if (strv1 == NULL || strv2 == NULL)
 
144
                return FALSE;
 
145
 
 
146
        length1 = g_strv_length (strv1);
 
147
        length2 = g_strv_length (strv2);
 
148
 
 
149
        if (length1 != length2)
 
150
                return FALSE;
 
151
 
 
152
        for (ii = 0; ii < length1; ii++) {
 
153
                if (!g_str_equal (strv1[ii], strv2[ii]))
 
154
                        return FALSE;
 
155
        }
 
156
 
 
157
        return TRUE;
 
158
}
 
159
 
 
160
/**
122
161
 * e_util_strdup_strip:
123
162
 * @string: (allow-none): a string value, or %NULL
124
163
 *
2066
2105
        e_named_parameters,
2067
2106
        e_named_parameters_ref,
2068
2107
        e_named_parameters_unref);
 
2108
 
 
2109
/**
 
2110
 * e_named_timeout_add:
 
2111
 * @interval: the time between calls to the function, in milliseconds
 
2112
 *            (1/1000ths of a second)
 
2113
 * @function: function to call
 
2114
 * @data: data to pass to @function
 
2115
 *
 
2116
 * Similar to g_timeout_add(), but also names the #GSource for use in
 
2117
 * debugging and profiling.  The name is formed from @function and the
 
2118
 * <literal>PACKAGE</literal> definintion from a &lt;config.h&gt; file.
 
2119
 *
 
2120
 * Returns: the ID (greater than 0) of the event source
 
2121
 *
 
2122
 * Since: 3.12
 
2123
 **/
 
2124
 
 
2125
/**
 
2126
 * e_named_timeout_add_full:
 
2127
 * @priority: the priority of the timeout source, typically in the
 
2128
 *            range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH
 
2129
 * @interval: the time between calls to the function, in milliseconds
 
2130
 *            (1/1000ths of a second)
 
2131
 * @function: function to call
 
2132
 * @data: data to pass to @function
 
2133
 * @notify: function to call when the timeout is removed, or %NULL
 
2134
 *
 
2135
 * Similar to g_timeout_add_full(), but also names the #GSource for use
 
2136
 * in debugging and profiling.  The name is formed from @function and the
 
2137
 * <literal>PACKAGE</literal> definition from a &lt;config.h&gt; file.
 
2138
 *
 
2139
 * Returns: the ID (greater than 0) of the event source
 
2140
 *
 
2141
 * Since: 3.12
 
2142
 **/
 
2143
 
 
2144
/**
 
2145
 * e_named_timeout_add_seconds:
 
2146
 * @interval: the time between calls to the function, in seconds
 
2147
 * @function: function to call
 
2148
 * @data: data to pass to @function
 
2149
 *
 
2150
 * Similar to g_timeout_add_seconds(), but also names the #GSource for use
 
2151
 * in debugging and profiling.  The name is formed from @function and the
 
2152
 * <literal>PACKAGE</literal> definition from a &lt;config.h&gt; file.
 
2153
 *
 
2154
 * Returns: the ID (greater than 0) of the event source
 
2155
 *
 
2156
 * Since: 3.12
 
2157
 **/
 
2158
 
 
2159
/**
 
2160
 * e_named_timeout_add_seconds_full:
 
2161
 * @priority: the priority of the timeout source, typically in the
 
2162
 *            range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH
 
2163
 * @interval: the time between calls to the function, in seconds
 
2164
 * @function: function to call
 
2165
 * @data: data to pass to @function
 
2166
 * @notify: function to call when the timeout is removed, or %NULL
 
2167
 *
 
2168
 * Similar to g_timeout_add_seconds_full(), but also names the #GSource for
 
2169
 * use in debugging and profiling.  The name is formed from @function and the
 
2170
 * <literal>PACKAGE</literal> definition from a &lt;config.h&gt; file.
 
2171
 *
 
2172
 * Returns: the ID (greater than 0) of the event source
 
2173
 *
 
2174
 * Since: 3.12
 
2175
 **/
 
2176
 
 
2177
/**
 
2178
 * e_timeout_add_with_name:
 
2179
 * @priority: the priority of the timeout source, typically in the
 
2180
 *            range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH
 
2181
 * @interval: the time between calls to the function, in milliseconds
 
2182
 *            (1/1000ths of a second)
 
2183
 * @name: (allow-none): debug name for the source
 
2184
 * @function: function to call
 
2185
 * @data: data to pass to @function
 
2186
 * @notify: (allow-none): function to call when the timeout is removed,
 
2187
 *          or %NULL
 
2188
 *
 
2189
 * Similar to g_timeout_add_full(), but also names the #GSource as @name.
 
2190
 *
 
2191
 * You might find e_named_timeout_add() or e_named_timeout_add_full() more
 
2192
 * convenient.  Those macros name the #GSource implicitly.
 
2193
 *
 
2194
 * Returns: the ID (greather than 0) of the event source
 
2195
 *
 
2196
 * Since: 3.12
 
2197
 **/
 
2198
guint
 
2199
e_timeout_add_with_name (gint priority,
 
2200
                         guint interval,
 
2201
                         const gchar *name,
 
2202
                         GSourceFunc function,
 
2203
                         gpointer data,
 
2204
                         GDestroyNotify notify)
 
2205
{
 
2206
        guint tag;
 
2207
 
 
2208
        g_return_val_if_fail (function != NULL, 0);
 
2209
 
 
2210
        tag = g_timeout_add_full (
 
2211
                priority, interval, function, data, notify);
 
2212
        g_source_set_name_by_id (tag, name);
 
2213
 
 
2214
        return tag;
 
2215
}
 
2216
 
 
2217
/**
 
2218
 * e_timeout_add_seconds_with_name:
 
2219
 * @priority: the priority of the timeout source, typically in the
 
2220
 *            range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH
 
2221
 * @interval: the time between calls to the function, in seconds
 
2222
 * @name: (allow-none): debug name for the source
 
2223
 * @function: function to call
 
2224
 * @data: data to pass to @function
 
2225
 * @notify: (allow-none): function to call when the timeout is removed,
 
2226
 *          or %NULL
 
2227
 *
 
2228
 * Similar to g_timeout_add_seconds_full(), but also names the #GSource as
 
2229
 * %name.
 
2230
 *
 
2231
 * You might find e_named_timeout_add_seconds() or
 
2232
 * e_named_timeout_add_seconds_full() more convenient.  Those macros name
 
2233
 * the #GSource implicitly.
 
2234
 *
 
2235
 * Returns: the ID (greater than 0) of the event source
 
2236
 *
 
2237
 * Since: 3.12
 
2238
 **/
 
2239
guint
 
2240
e_timeout_add_seconds_with_name (gint priority,
 
2241
                                 guint interval,
 
2242
                                 const gchar *name,
 
2243
                                 GSourceFunc function,
 
2244
                                 gpointer data,
 
2245
                                 GDestroyNotify notify)
 
2246
{
 
2247
        guint tag;
 
2248
 
 
2249
        g_return_val_if_fail (function != NULL, 0);
 
2250
 
 
2251
        tag = g_timeout_add_seconds_full (
 
2252
                priority, interval, function, data, notify);
 
2253
        g_source_set_name_by_id (tag, name);
 
2254
 
 
2255
        return tag;
 
2256
}
 
2257