~ubuntu-branches/ubuntu/quantal/evolution-data-server/quantal

« back to all changes in this revision

Viewing changes to libebackend/e-backend.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-07-03 22:41:23 UTC
  • mfrom: (1.1.100)
  • Revision ID: package-import@ubuntu.com-20120703224123-90dydkyfyvff8s0s
Tags: 3.5.3.1-0ubuntu1
* New upstream release 3.5.3.1.
* debian/control:
  - Drop libgconf2-dev from Build-Depends.
  - Bump versions for glib, goa, and libsoup in Build-Depends.
  - Add a Build-Depends on libgcr-3-dev (>= 3.4)
  - Rename packages following upstream SONAME changes.
  - Add Depends on libgnome-keyring-dev to libedataserver1.2-dev.
* debian/rules:
  - Update mkshlibs arguments for libcamel-1.2-38 instead of -33; as it was
    renamed in control due to the soname change.
  - Strip out -Bsymbolic-functions from LDFLAGS.
* Renamed install files in debian/:
  - libcamel-1.2-33.install => libcamel-1.2-38.install
  - libebackend-1.2-2.install => libebackend-1.2-4.install
  - libebook-1.2-13.install => libebook-1.2-17.install
  - libecal-1.2-11.install => libecal-1.2-15.install
  - libedata-book-1.2-13.install => libedata-book-1.2-15.install
  - libedata-cal-1.2-15.install => libedata-cal-1.2-18.install
  - libedataserver-1.2-16.install => libedataserver-1.2-17.install
  - libedataserverui-3.0-1.install => libedataserverui-3.0-4.install
* debian/patches/google_tests_fpic.patch: build tests with -fPIC; otherwise
  build fails.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
/**
20
20
 * SECTION: e-backend
21
 
 * @short_description: an abstract base class for backends
22
 
 * @include: libebackend/e-backend.h
 
21
 * @include: libebackend/libebackend.h
 
22
 * @short_description: An abstract base class for backends
23
23
 *
24
24
 * An #EBackend is paired with an #ESource to facilitate performing
25
25
 * actions on the local or remote resource described by the #ESource.
34
34
#include "e-backend.h"
35
35
 
36
36
#include <config.h>
 
37
#include <gio/gio.h>
37
38
 
38
39
#define E_BACKEND_GET_PRIVATE(obj) \
39
40
        (G_TYPE_INSTANCE_GET_PRIVATE \
50
51
        PROP_SOURCE
51
52
};
52
53
 
53
 
enum {
54
 
        LAST_CLIENT_GONE,
55
 
        LAST_SIGNAL
56
 
};
57
 
 
58
 
static guint signals[LAST_SIGNAL];
59
 
 
60
54
G_DEFINE_ABSTRACT_TYPE (EBackend, e_backend, G_TYPE_OBJECT)
61
55
 
62
56
static void
132
126
}
133
127
 
134
128
static void
 
129
backend_constructed (GObject *object)
 
130
{
 
131
        GNetworkMonitor *monitor;
 
132
 
 
133
        /* Chain up to parent's constructed() method. */
 
134
        G_OBJECT_CLASS (e_backend_parent_class)->constructed (object);
 
135
 
 
136
        /* Synchronize network monitoring. */
 
137
 
 
138
        monitor = g_network_monitor_get_default ();
 
139
 
 
140
        g_object_bind_property (
 
141
                monitor, "network-available",
 
142
                object, "online",
 
143
                G_BINDING_SYNC_CREATE);
 
144
}
 
145
 
 
146
static void
135
147
e_backend_class_init (EBackendClass *class)
136
148
{
137
149
        GObjectClass *object_class;
142
154
        object_class->set_property = backend_set_property;
143
155
        object_class->get_property = backend_get_property;
144
156
        object_class->dispose = backend_dispose;
 
157
        object_class->constructed = backend_constructed;
145
158
 
146
159
        g_object_class_install_property (
147
160
                object_class,
166
179
                        G_PARAM_READWRITE |
167
180
                        G_PARAM_CONSTRUCT_ONLY |
168
181
                        G_PARAM_STATIC_STRINGS));
169
 
 
170
 
        signals[LAST_CLIENT_GONE] = g_signal_new (
171
 
                "last-client-gone",
172
 
                G_OBJECT_CLASS_TYPE (object_class),
173
 
                G_SIGNAL_RUN_LAST,
174
 
                G_STRUCT_OFFSET (EBackendClass, last_client_gone),
175
 
                NULL, NULL,
176
 
                g_cclosure_marshal_VOID__VOID,
177
 
                G_TYPE_NONE, 0);
178
182
}
179
183
 
180
184
static void
221
225
        g_return_if_fail (E_IS_BACKEND (backend));
222
226
 
223
227
        /* Avoid unnecessary "notify" signals. */
224
 
        if (online == backend->priv->online)
 
228
        if ((online ? 1 : 0) == (backend->priv->online ? 1 : 0))
225
229
                return;
226
230
 
227
231
        backend->priv->online = online;
247
251
        return backend->priv->source;
248
252
}
249
253
 
250
 
/**
251
 
 * e_backend_last_client_gone:
252
 
 * @backend: an #EBackend
253
 
 *
254
 
 * Emits the #EBackend::last-client-gone signal to indicate the last
255
 
 * client connection to @backend has been closed.  The @backend may be
256
 
 * finalized after a short period to reclaim resources if no new client
257
 
 * connections are established.
258
 
 *
259
 
 * Since: 3.4
260
 
 **/
261
 
void
262
 
e_backend_last_client_gone (EBackend *backend)
263
 
{
264
 
        g_return_if_fail (E_IS_BACKEND (backend));
265
 
 
266
 
        g_signal_emit (backend, signals[LAST_CLIENT_GONE], 0);
267
 
}