From: Matthew Barnes Date: Thu, 26 May 2011 15:21:37 +0000 (-0400) Subject: Reduce diff noise with account-mgmt branch. X-Git-Tag: upstream/3.7.4~2021 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=131e00918a1df38c93cd79dbf379c19bbe426127;p=platform%2Fupstream%2Fevolution-data-server.git Reduce diff noise with account-mgmt branch. Mostly silly code cleanup type stuff, so I can see the important changes more easily. --- diff --git a/addressbook/backends/ldap/e-book-backend-ldap-factory.c b/addressbook/backends/ldap/e-book-backend-ldap-factory.c index 73da037..ae9e014 100644 --- a/addressbook/backends/ldap/e-book-backend-ldap-factory.c +++ b/addressbook/backends/ldap/e-book-backend-ldap-factory.c @@ -34,13 +34,13 @@ E_BOOK_BACKEND_FACTORY_SIMPLE (ldap, LDAP, e_book_backend_ldap_new) static GType ldap_type; void -eds_module_initialize (GTypeModule *module) +eds_module_initialize (GTypeModule *type_module) { - ldap_type = _ldap_factory_get_type (module); + ldap_type = _ldap_factory_get_type (type_module); } void -eds_module_shutdown (void) +eds_module_shutdown (void) { } diff --git a/addressbook/backends/vcf/e-book-backend-vcf-factory.c b/addressbook/backends/vcf/e-book-backend-vcf-factory.c index cc3e716..e7aeffd 100644 --- a/addressbook/backends/vcf/e-book-backend-vcf-factory.c +++ b/addressbook/backends/vcf/e-book-backend-vcf-factory.c @@ -34,13 +34,13 @@ E_BOOK_BACKEND_FACTORY_SIMPLE (vcf, VCF, e_book_backend_vcf_new) static GType vcf_type; void -eds_module_initialize (GTypeModule *module) +eds_module_initialize (GTypeModule *type_module) { - vcf_type = _vcf_factory_get_type (module); + vcf_type = _vcf_factory_get_type (type_module); } void -eds_module_shutdown (void) +eds_module_shutdown (void) { } diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c index 53033a8..c782ae3 100644 --- a/addressbook/backends/webdav/e-book-backend-webdav.c +++ b/addressbook/backends/webdav/e-book-backend-webdav.c @@ -189,7 +189,7 @@ download_contact (EBookBackendWebdav *webdav, const gchar *uri) static guint upload_contact (EBookBackendWebdav *webdav, EContact *contact, gchar **reason) { - ESource *source = e_book_backend_get_source (E_BOOK_BACKEND (webdav)); + ESource *source; SoupMessage *message; gchar *uri; gchar *etag; @@ -199,6 +199,8 @@ upload_contact (EBookBackendWebdav *webdav, EContact *contact, gchar **reason) const gchar *property; gboolean avoid_ifmatch; + source = e_book_backend_get_source (E_BOOK_BACKEND (webdav)); + uri = e_contact_get (contact, E_CONTACT_UID); if (uri == NULL) { g_warning("can't upload contact without UID"); @@ -1159,7 +1161,7 @@ e_book_backend_webdav_open (EBookBackend *backend, EDataBook *book, guint opid, { EBookBackendWebdav *webdav = E_BOOK_BACKEND_WEBDAV (backend); EBookBackendWebdavPrivate *priv = webdav->priv; - ESource *source = e_book_backend_get_source (backend); + ESource *source; gchar *uri; const gchar *cache_dir; const gchar *offline; @@ -1172,6 +1174,7 @@ e_book_backend_webdav_open (EBookBackend *backend, EDataBook *book, guint opid, /* will try fetch ctag for the first time, if it fails then sets this to FALSE */ priv->supports_getctag = TRUE; + source = e_book_backend_get_source (backend); cache_dir = e_book_backend_get_cache_dir (backend); uri = e_source_get_uri (source); diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c index 009e406..a2a06c8 100644 --- a/addressbook/libebook/e-book.c +++ b/addressbook/libebook/e-book.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "e-book.h" #include "e-error.h" @@ -3210,10 +3211,10 @@ e_book_set_default_addressbook (EBook *book, GError **error) /** * e_book_set_default_source: - * @source: An #ESource pointer - * @error: A #GError pointer + * @source: an #ESource + * @error: return location for a #GError, or %NULL * - * sets @source as the "default" addressbook. This is the source that + * Sets @source as the default address book. This is the source that * will be loaded in the e_book_get_default_addressbook call. * * Returns: %TRUE if the setting was stored in libebook's ESourceList, otherwise %FALSE. @@ -3221,7 +3222,8 @@ e_book_set_default_addressbook (EBook *book, GError **error) * Deprecated: 3.2: Use e_book_client_set_default_source() instead. */ gboolean -e_book_set_default_source (ESource *source, GError **error) +e_book_set_default_source (ESource *source, + GError **error) { ESourceList *sources; const gchar *uid; @@ -3303,10 +3305,10 @@ e_book_get_addressbooks (ESourceList **addressbook_sources, GError **error) /** * e_book_new: - * @source: An #ESource pointer - * @error: A #GError pointer + * @source: an #ESource + * @error: return location for a #GError, or %NULL * - * Creates a new #EBook corresponding to the given source. There are + * Creates a new #EBook corresponding to the given @source. There are * only two operations that are valid on this book at this point: * e_book_open(), and e_book_remove(). * @@ -3315,11 +3317,13 @@ e_book_get_addressbooks (ESourceList **addressbook_sources, GError **error) * Deprecated: 3.2: Use e_book_client_new() instead. */ EBook * -e_book_new (ESource *source, GError **error) +e_book_new (ESource *source, + GError **error) { GError *err = NULL; EBook *book; - gchar *path = NULL, *xml, *gdbus_xml = NULL; + gchar *path = NULL; + gchar *xml, *gdbus_xml = NULL; GDBusConnection *connection; g_return_val_if_fail (E_IS_SOURCE (source), NULL); @@ -3533,9 +3537,8 @@ check_system (ESource *source, gpointer data) * e_book_new_system_addressbook: * @error: A #GError pointer * - * Creates a new #EBook corresponding to the user's system - * addressbook. See the documentation for e_book_new for further - * information. + * Creates a new #EBook corresponding to the user's system address book. + * See the documentation for e_book_new() for further information. * * Returns: a new but unopened #EBook. * @@ -3588,9 +3591,8 @@ e_book_new_system_addressbook (GError **error) * e_book_new_default_addressbook: * @error: return location for a #GError, or %NULL * - * Creates a new #EBook corresponding to the user's default - * address book. See the documentation for e_book_new() for - * further information. + * Creates a new #EBook corresponding to the user's default address book. + * See the documentation for e_book_new() for further information. * * Returns: a new but unopened #EBook * diff --git a/addressbook/libebook/e-destination.c b/addressbook/libebook/e-destination.c index 8d9fe24..b219943 100644 --- a/addressbook/libebook/e-destination.c +++ b/addressbook/libebook/e-destination.c @@ -456,15 +456,18 @@ void e_destination_set_book (EDestination *dest, EBook *book) { ESource *source; + const gchar *uid; g_return_if_fail (dest && E_IS_DESTINATION (dest)); g_return_if_fail (book && E_IS_BOOK (book)); source = e_book_get_source (book); + uid = e_source_peek_uid (source); + g_return_if_fail (uid != NULL); - if (!dest->priv->source_uid || strcmp (e_source_peek_uid (source), dest->priv->source_uid)) { + if (!dest->priv->source_uid || strcmp (uid, dest->priv->source_uid)) { e_destination_clear (dest); - dest->priv->source_uid = g_strdup (e_source_peek_uid (source)); + dest->priv->source_uid = g_strdup (uid); g_signal_emit (dest, signals[CHANGED], 0); } diff --git a/addressbook/libedata-book/e-book-backend-db-cache.c b/addressbook/libedata-book/e-book-backend-db-cache.c index b846696..d060a4e 100644 --- a/addressbook/libedata-book/e-book-backend-db-cache.c +++ b/addressbook/libedata-book/e-book-backend-db-cache.c @@ -19,11 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include -#endif - +#include #include + #include #include "e-book-backend-db-cache.h" #include "e-book-backend.h" diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c index 204e53a..72cfd01 100644 --- a/addressbook/libedata-book/e-book-backend.c +++ b/addressbook/libedata-book/e-book-backend.c @@ -56,9 +56,7 @@ book_backend_set_default_cache_dir (EBookBackend *backend) gchar *filename; user_cache_dir = e_get_user_cache_dir (); - source = e_book_backend_get_source (backend); - g_return_if_fail (source != NULL); /* Mangle the URI to not contain invalid characters. */ mangled_uri = g_strdelimit (e_source_get_uri (source), ":/", '_'); diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c index e74a108..a70e5bf 100644 --- a/addressbook/libedata-book/e-data-book-factory.c +++ b/addressbook/libedata-book/e-data-book-factory.c @@ -300,13 +300,17 @@ last_client_gone_cb (EBookBackend *backend, EDataBookFactory *factory) } static gboolean -impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invocation, const gchar *in_source, EDataBookFactory *factory) +impl_BookFactory_getBook (EGdbusBookFactory *object, + GDBusMethodInvocation *invocation, + const gchar *in_source, + EDataBookFactory *factory) { EDataBook *book; EBookBackend *backend; EDataBookFactoryPrivate *priv = factory->priv; ESource *source; - gchar *uri, *path; + gchar *path; + gchar *uri; const gchar *sender; GList *list; GError *error = NULL; @@ -358,12 +362,14 @@ impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invo backend = e_book_backend_factory_new_backend (backend_factory); if (backend != NULL) { - gchar *uri_key = g_strdup (uri); - g_hash_table_insert ( - priv->backends, uri_key, backend); - g_object_weak_ref (G_OBJECT (backend), (GWeakNotify) backend_gone_cb, factory); - g_signal_connect (backend, "last-client-gone", G_CALLBACK (last_client_gone_cb), factory); + priv->backends, g_strdup (uri), backend); + g_object_weak_ref ( + G_OBJECT (backend), (GWeakNotify) + backend_gone_cb, factory); + g_signal_connect ( + backend, "last-client-gone", + G_CALLBACK (last_client_gone_cb), factory); e_book_backend_set_online (backend, priv->is_online); } } @@ -375,7 +381,10 @@ impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invo g_mutex_unlock (priv->books_lock); g_mutex_unlock (priv->backends_lock); - error = g_error_new (E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_NO_SUCH_BOOK, _("Invalid source")); + error = g_error_new ( + E_DATA_BOOK_ERROR, + E_DATA_BOOK_STATUS_NO_SUCH_BOOK, + _("Invalid source")); g_dbus_method_invocation_return_gerror (invocation, error); g_error_free (error); @@ -665,7 +674,8 @@ main (gint argc, gchar **argv) eol, "changed", G_CALLBACK (offline_state_changed_cb), factory); - owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, + owner_id = g_bus_own_name ( + G_BUS_TYPE_SESSION, ADDRESS_BOOK_DBUS_SERVICE_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c index b99491e..8ccffa2 100644 --- a/calendar/backends/caldav/e-cal-backend-caldav.c +++ b/calendar/backends/caldav/e-cal-backend-caldav.c @@ -114,7 +114,7 @@ struct _ECalBackendCalDAVPrivate { /* Authentication info */ ECredentials *credentials; - gboolean need_auth; + gboolean auth_required; /* object cleanup */ gboolean disposed; @@ -531,7 +531,7 @@ status_code_to_result (SoupMessage *message, ECalBackendCalDAVPrivate *priv, GE break; case 401: - if (priv && priv->need_auth) + if (priv && priv->auth_required) g_propagate_error (perror, EDC_ERROR (AuthenticationFailed)); else g_propagate_error (perror, EDC_ERROR (AuthenticationRequired)); @@ -2289,7 +2289,7 @@ initialize_backend (ECalBackendCalDAV *cbdav, GError **perror) } os_val = e_source_get_property (source, "auth"); - priv->need_auth = os_val != NULL; + priv->auth_required = os_val != NULL; os_val = e_source_get_property(source, "ssl"); uri = e_cal_backend_get_uri (backend); diff --git a/calendar/backends/contacts/e-cal-backend-contacts-factory.c b/calendar/backends/contacts/e-cal-backend-contacts-factory.c index 6c75b53..7929c74 100644 --- a/calendar/backends/contacts/e-cal-backend-contacts-factory.c +++ b/calendar/backends/contacts/e-cal-backend-contacts-factory.c @@ -16,18 +16,16 @@ #include "e-cal-backend-contacts-factory.h" #include "e-cal-backend-contacts.h" -typedef struct { - ECalBackendFactory parent_object; -} ECalBackendContactsFactory; +typedef ECalBackendFactory ECalBackendContactsEventsFactory; +typedef ECalBackendFactoryClass ECalBackendContactsEventsFactoryClass; -typedef struct { - ECalBackendFactoryClass parent_class; -} ECalBackendContactsFactoryClass; +/* Forward Declarations */ +GType e_cal_backend_contacts_events_factory_get_type (void); -static void -e_cal_backend_contacts_factory_instance_init (ECalBackendContactsFactory *factory) -{ -} +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendContactsEventsFactory, + e_cal_backend_contacts_events_factory, + E_TYPE_CAL_BACKEND_FACTORY) static const gchar * _get_protocol (ECalBackendFactory *factory) @@ -35,13 +33,14 @@ _get_protocol (ECalBackendFactory *factory) return "contacts"; } -static ECalBackend* -_events_new_backend (ECalBackendFactory *factory, ESource *source) +static ECalBackend * +_events_new_backend (ECalBackendFactory *factory, + ESource *source) { - return g_object_new (e_cal_backend_contacts_get_type (), - "source", source, - "kind", ICAL_VEVENT_COMPONENT, - NULL); + return g_object_new ( + e_cal_backend_contacts_get_type (), + "kind", ICAL_VEVENT_COMPONENT, + "source", source, NULL); } static icalcomponent_kind @@ -51,56 +50,41 @@ _events_get_kind (ECalBackendFactory *factory) } static void -events_backend_factory_class_init (ECalBackendContactsFactoryClass *klass) +e_cal_backend_contacts_events_factory_class_init (ECalBackendFactoryClass *class) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _events_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _events_new_backend; + class->get_protocol = _get_protocol; + class->get_kind = _events_get_kind; + class->new_backend = _events_new_backend; } -static GType -events_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_contacts_events_factory_class_finalize (ECalBackendFactoryClass *class) { - GType type; - - GTypeInfo info = { - sizeof (ECalBackendContactsFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) events_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_contacts_factory_instance_init - }; - - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendContactsEventsFactory", - &info, 0); - - return type; } - - -static GType contacts_types[1]; +static void +e_cal_backend_contacts_events_factory_init (ECalBackendFactory *factory) +{ +} void -eds_module_initialize (GTypeModule *module) +eds_module_initialize (GTypeModule *type_module) { - contacts_types[0] = events_backend_factory_get_type (module); + e_cal_backend_contacts_events_factory_register_type (type_module); } void -eds_module_shutdown (void) +eds_module_shutdown (void) { } void eds_module_list_types (const GType **types, gint *num_types) { + static GType contacts_types[1]; + + contacts_types[0] = e_cal_backend_contacts_events_factory_get_type (); + *types = contacts_types; - *num_types = 1; + *num_types = G_N_ELEMENTS (contacts_types); } diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c index 89f7bfb..1aff087 100644 --- a/calendar/backends/contacts/e-cal-backend-contacts.c +++ b/calendar/backends/contacts/e-cal-backend-contacts.c @@ -32,16 +32,15 @@ #include #include -#include "libedataserver/e-xml-hash-utils.h" -#include "libedataserver/e-flag.h" +#include +#include +#include #include #include #include #include - #include -#include "libedataserver/e-source-list.h" #define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL) @@ -60,11 +59,11 @@ typedef enum struct _ECalBackendContactsPrivate { ESourceList *addressbook_sources; - GHashTable *addressbooks; /* UID -> BookRecord */ - gboolean addressbook_loaded; + GHashTable *addressbooks; /* UID -> BookRecord */ + gboolean addressbook_loaded; - EBookView *book_view; - GHashTable *tracked_contacts; /* UID -> ContactRecord */ + EBookView *book_view; + GHashTable *tracked_contacts; /* UID -> ContactRecord */ GHashTable *zones; @@ -83,15 +82,15 @@ struct _ECalBackendContactsPrivate { typedef struct _BookRecord { ECalBackendContacts *cbc; - EBook *book; - EBookView *book_view; + EBook *book; + EBookView *book_view; } BookRecord; typedef struct _ContactRecord { - ECalBackendContacts *cbc; - EBook *book; /* where it comes from */ - EContact *contact; - ECalComponent *comp_birthday, *comp_anniversary; + ECalBackendContacts *cbc; + EBook *book; /* where it comes from */ + EContact *contact; + ECalComponent *comp_birthday, *comp_anniversary; } ContactRecord; #define d(x) @@ -121,19 +120,20 @@ book_record_new (ECalBackendContacts *cbc, ESource *source) book = e_book_new (source, &error); if (!book || !e_book_open (book, TRUE, &error) || error) { - g_warning ("%s: Failed to open book '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); if (book) g_object_unref (book); - if (error) + if (error) { + g_warning ("%s: Failed to open book: %s", G_STRFUNC, error->message); g_error_free (error); + } return NULL; } - /* Create book view */ + /* Create book view */ fields = g_list_append (fields, (gchar *) e_contact_field_name (E_CONTACT_FILE_AS)); fields = g_list_append (fields, (gchar *) e_contact_field_name (E_CONTACT_BIRTH_DATE)); fields = g_list_append (fields, (gchar *) e_contact_field_name (E_CONTACT_ANNIVERSARY)); - query = e_book_query_any_field_contains (""); + query = e_book_query_any_field_contains (""); if (!e_book_get_book_view (book, query, fields, -1, &book_view, &error)) { g_warning ("%s: Failed to get book view on '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); @@ -150,9 +150,9 @@ book_record_new (ECalBackendContacts *cbc, ESource *source) e_book_query_unref (query); g_list_free (fields); - g_signal_connect (book_view, "contacts_added", G_CALLBACK (contacts_added_cb), cbc); - g_signal_connect (book_view, "contacts_removed", G_CALLBACK (contacts_removed_cb), cbc); - g_signal_connect (book_view, "contacts_changed", G_CALLBACK (contacts_changed_cb), cbc); + g_signal_connect (book_view, "contacts_added", G_CALLBACK (contacts_added_cb), cbc); + g_signal_connect (book_view, "contacts_removed", G_CALLBACK (contacts_removed_cb), cbc); + g_signal_connect (book_view, "contacts_changed", G_CALLBACK (contacts_changed_cb), cbc); e_book_view_start (book_view); @@ -433,7 +433,7 @@ contacts_changed_cb (EBookView *book_view, const GList *contacts, gpointer user_ const gchar *uid = e_contact_get_const (contact, E_CONTACT_UID); EContactDate *birthday, *anniversary; - /* Because this is a change of contact, then always remove old tracked data + /* Because this is a change of contact, then always remove old tracked data and if possible, add with (possibly) new values. */ g_hash_table_remove (cbc->priv->tracked_contacts, (gchar *) uid); @@ -458,7 +458,7 @@ contacts_added_cb (EBookView *book_view, const GList *contacts, gpointer user_da EBook *book = e_book_view_get_book (book_view); const GList *i; - /* See if any new contacts have BIRTHDAY or ANNIVERSARY fields */ + /* See if any new contacts have BIRTHDAY or ANNIVERSARY fields */ for (i = contacts; i; i = i->next) { EContact *contact = E_CONTACT (i->data); @@ -485,7 +485,7 @@ contacts_removed_cb (EBookView *book_view, const GList *contact_ids, gpointer us ECalBackendContacts *cbc = E_CAL_BACKEND_CONTACTS (user_data); const GList *i; - /* Stop tracking these */ + /* Stop tracking these */ for (i = contact_ids; i; i = i->next) g_hash_table_remove (cbc->priv->tracked_contacts, i->data); } @@ -683,7 +683,7 @@ create_component (ECalBackendContacts *cbc, const gchar *uid, EContactDate *cdat ical_comp = icalcomponent_new (ICAL_VEVENT_COMPONENT); - /* Create the event object */ + /* Create the event object */ cal_comp = e_cal_component_new (); e_cal_component_set_icalcomponent (cal_comp, ical_comp); @@ -691,7 +691,7 @@ create_component (ECalBackendContacts *cbc, const gchar *uid, EContactDate *cdat d(g_message ("Creating UID: %s", uid)); e_cal_component_set_uid (cal_comp, uid); - /* Set all-day event's date from contact data */ + /* Set all-day event's date from contact data */ itt = cdate_to_icaltime (cdate); dt.value = &itt; dt.tzid = NULL; @@ -704,7 +704,7 @@ create_component (ECalBackendContacts *cbc, const gchar *uid, EContactDate *cdat /* We have to add 1 day to DTEND, as it is not inclusive. */ e_cal_component_set_dtend (cal_comp, &dt); - /* Create yearly recurrence */ + /* Create yearly recurrence */ icalrecurrencetype_clear (&r); r.freq = ICAL_YEARLY_RECURRENCE; r.interval = 1; @@ -712,7 +712,7 @@ create_component (ECalBackendContacts *cbc, const gchar *uid, EContactDate *cdat recur_list.next = NULL; e_cal_component_set_rrule_list (cal_comp, &recur_list); - /* Create summary */ + /* Create summary */ comp_summary.value = summary; comp_summary.altrep = NULL; e_cal_component_set_summary (cal_comp, &comp_summary); @@ -731,7 +731,7 @@ create_component (ECalBackendContacts *cbc, const gchar *uid, EContactDate *cdat /* setup alarms if required */ setup_alarm (cbc, cal_comp); - /* Don't forget to call commit()! */ + /* Don't forget to call commit()! */ e_cal_component_commit_sequence (cal_comp); return cal_comp; @@ -750,7 +750,7 @@ create_birthday (ECalBackendContacts *cbc, EContact *contact) name = e_contact_get_const (contact, E_CONTACT_FILE_AS); uid = g_strdup_printf ("%s%s", (gchar *) e_contact_get_const (contact, E_CONTACT_UID), BIRTHDAY_UID_EXT); - summary = g_strdup_printf (_("Birthday: %s"), name); + summary = g_strdup_printf (_("Birthday: %s"), name); cal_comp = create_component (cbc, uid, cdate, summary); @@ -774,7 +774,7 @@ create_anniversary (ECalBackendContacts *cbc, EContact *contact) name = e_contact_get_const (contact, E_CONTACT_FILE_AS); uid = g_strdup_printf ("%s%s", (gchar *) e_contact_get_const (contact, E_CONTACT_UID), ANNIVERSARY_UID_EXT); - summary = g_strdup_printf (_("Anniversary: %s"), name); + summary = g_strdup_printf (_("Anniversary: %s"), name); cal_comp = create_component (cbc, uid, cdate, summary); @@ -853,14 +853,14 @@ e_cal_backend_contacts_get_object (ECalBackendSync *backend, EDataCal *cal, GCan } if (record->comp_birthday && g_str_has_suffix (uid, BIRTHDAY_UID_EXT)) { - *object = e_cal_component_get_as_string (record->comp_birthday); + *object = e_cal_component_get_as_string (record->comp_birthday); d(g_message ("Return birthday: %s", *object)); return; } if (record->comp_anniversary && g_str_has_suffix (uid, ANNIVERSARY_UID_EXT)) { - *object = e_cal_component_get_as_string (record->comp_anniversary); + *object = e_cal_component_get_as_string (record->comp_anniversary); d(g_message ("Return anniversary: %s", *object)); return; diff --git a/calendar/backends/file/e-cal-backend-file-factory.c b/calendar/backends/file/e-cal-backend-file-factory.c index 00fbe4f..fb8578e 100644 --- a/calendar/backends/file/e-cal-backend-file-factory.c +++ b/calendar/backends/file/e-cal-backend-file-factory.c @@ -18,18 +18,34 @@ #include "e-cal-backend-file-journal.h" #include "e-cal-backend-file-todos.h" -typedef struct { - ECalBackendFactory parent_object; -} ECalBackendFileFactory; +typedef ECalBackendFactory ECalBackendFileEventsFactory; +typedef ECalBackendFactoryClass ECalBackendFileEventsFactoryClass; -typedef struct { - ECalBackendFactoryClass parent_class; -} ECalBackendFileFactoryClass; +typedef ECalBackendFactory ECalBackendFileJournalFactory; +typedef ECalBackendFactoryClass ECalBackendFileJournalFactoryClass; -static void -e_cal_backend_file_factory_instance_init (ECalBackendFileFactory *factory) -{ -} +typedef ECalBackendFactory ECalBackendFileTodosFactory; +typedef ECalBackendFactoryClass ECalBackendFileTodosFactoryClass; + +/* Forward Declarations */ +GType e_cal_backend_file_events_factory_get_type (void); +GType e_cal_backend_file_journal_factory_get_type (void); +GType e_cal_backend_file_todos_factory_get_type (void); + +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendFileEventsFactory, + e_cal_backend_file_events_factory, + E_TYPE_CAL_BACKEND_FACTORY) + +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendFileJournalFactory, + e_cal_backend_file_journal_factory, + E_TYPE_CAL_BACKEND_FACTORY) + +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendFileTodosFactory, + e_cal_backend_file_todos_factory, + E_TYPE_CAL_BACKEND_FACTORY) static const gchar * _get_protocol (ECalBackendFactory *factory) @@ -37,28 +53,20 @@ _get_protocol (ECalBackendFactory *factory) return "local"; } -static ECalBackend* -_todos_new_backend (ECalBackendFactory *factory, ESource *source) -{ - return g_object_new (e_cal_backend_file_todos_get_type (), - "source", source, - "kind", ICAL_VTODO_COMPONENT, - NULL); -} - static icalcomponent_kind -_todos_get_kind (ECalBackendFactory *factory) +_events_get_kind (ECalBackendFactory *factory) { - return ICAL_VTODO_COMPONENT; + return ICAL_VEVENT_COMPONENT; } -static ECalBackend* -_journal_new_backend (ECalBackendFactory *factory, ESource *source) +static ECalBackend * +_events_new_backend (ECalBackendFactory *factory, + ESource *source) { - return g_object_new (e_cal_backend_file_journal_get_type (), - "source", source, - "kind", ICAL_VJOURNAL_COMPONENT, - NULL); + return g_object_new ( + e_cal_backend_file_events_get_type (), + "kind", ICAL_VEVENT_COMPONENT, + "source", source, NULL); } static icalcomponent_kind @@ -67,140 +75,108 @@ _journal_get_kind (ECalBackendFactory *factory) return ICAL_VJOURNAL_COMPONENT; } -static ECalBackend* -_events_new_backend (ECalBackendFactory *factory, ESource *source) +static ECalBackend * +_journal_new_backend (ECalBackendFactory *factory, + ESource *source) { - return g_object_new (e_cal_backend_file_events_get_type (), - "source", source, - "kind", ICAL_VEVENT_COMPONENT, - NULL); + return g_object_new ( + e_cal_backend_file_journal_get_type (), + "kind", ICAL_VJOURNAL_COMPONENT, + "source", source, NULL); } static icalcomponent_kind -_events_get_kind (ECalBackendFactory *factory) +_todos_get_kind (ECalBackendFactory *factory) { - return ICAL_VEVENT_COMPONENT; + return ICAL_VTODO_COMPONENT; } -static void -todos_backend_factory_class_init (ECalBackendFileFactoryClass *klass) +static ECalBackend * +_todos_new_backend (ECalBackendFactory *factory, + ESource *source) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _todos_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _todos_new_backend; + return g_object_new ( + e_cal_backend_file_todos_get_type (), + "kind", ICAL_VTODO_COMPONENT, + "source", source, NULL); } static void -journal_backend_factory_class_init (ECalBackendFileFactoryClass *klass) +e_cal_backend_file_events_factory_class_init (ECalBackendFactoryClass *class) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _journal_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _journal_new_backend; + class->get_protocol = _get_protocol; + class->get_kind = _events_get_kind; + class->new_backend = _events_new_backend; } static void -events_backend_factory_class_init (ECalBackendFileFactoryClass *klass) +e_cal_backend_file_events_factory_class_finalize (ECalBackendFactoryClass *class) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _events_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _events_new_backend; } -static GType -events_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_file_events_factory_init (ECalBackendFactory *factory) { - GType type; - - GTypeInfo info = { - sizeof (ECalBackendFileFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) events_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_file_factory_instance_init - }; - - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendFileEventsFactory", - &info, 0); - - return type; } -static GType -journal_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_file_journal_factory_class_init (ECalBackendFactoryClass *class) { - GType type; - - GTypeInfo info = { - sizeof (ECalBackendFileFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) journal_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_file_factory_instance_init - }; - - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendFileJournalFactory", - &info, 0); - - return type; + class->get_protocol = _get_protocol; + class->get_kind = _journal_get_kind; + class->new_backend = _journal_new_backend; } -static GType -todos_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_file_journal_factory_class_finalize (ECalBackendFactoryClass *class) { - GType type; - - GTypeInfo info = { - sizeof (ECalBackendFileFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) todos_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_file_factory_instance_init - }; +} - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendFileTodosFactory", - &info, 0); +static void +e_cal_backend_file_journal_factory_init (ECalBackendFactory *factory) +{ +} - return type; +static void +e_cal_backend_file_todos_factory_class_init (ECalBackendFactoryClass *class) +{ + class->get_protocol = _get_protocol; + class->get_kind = _todos_get_kind; + class->new_backend = _todos_new_backend; } - +static void +e_cal_backend_file_todos_factory_class_finalize (ECalBackendFactoryClass *class) +{ +} -static GType file_types[3]; +static void +e_cal_backend_file_todos_factory_init (ECalBackendFactory *factory) +{ +} void -eds_module_initialize (GTypeModule *module) +eds_module_initialize (GTypeModule *type_module) { - file_types[0] = todos_backend_factory_get_type (module); - file_types[1] = events_backend_factory_get_type (module); - file_types[2] = journal_backend_factory_get_type (module); + e_cal_backend_file_events_factory_register_type (type_module); + e_cal_backend_file_journal_factory_register_type (type_module); + e_cal_backend_file_todos_factory_register_type (type_module); } void -eds_module_shutdown (void) +eds_module_shutdown (void) { } void eds_module_list_types (const GType **types, gint *num_types) { + static GType file_types[3]; + + file_types[0] = e_cal_backend_file_events_factory_get_type (); + file_types[1] = e_cal_backend_file_journal_factory_get_type (); + file_types[2] = e_cal_backend_file_todos_factory_get_type (); + *types = file_types; - *num_types = 3; + *num_types = G_N_ELEMENTS (file_types); } diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c index e7c1958..553233d 100644 --- a/calendar/backends/file/e-cal-backend-file.c +++ b/calendar/backends/file/e-cal-backend-file.c @@ -1265,14 +1265,16 @@ e_cal_backend_file_open (ECalBackendSync *backend, EDataCal *cal, GCancellable * if (!err) { if (!priv->read_only) { - ESource *source = e_cal_backend_get_source (E_CAL_BACKEND (backend)); + ESource *source; - if (source) { - g_signal_connect (source, "changed", G_CALLBACK (source_changed_cb), backend); + source = e_cal_backend_get_source (E_CAL_BACKEND (backend)); - if (e_source_get_property (source, "custom-file-readonly") && g_str_equal (e_source_get_property (source, "custom-file-readonly"), "1")) - priv->read_only = TRUE; - } + g_signal_connect ( + source, "changed", + G_CALLBACK (source_changed_cb), backend); + + if (e_source_get_property (source, "custom-file-readonly") && g_str_equal (e_source_get_property (source, "custom-file-readonly"), "1")) + priv->read_only = TRUE; } } @@ -1298,7 +1300,8 @@ e_cal_backend_file_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable gchar *full_path = NULL; const gchar *fname; GDir *dir = NULL; - GError *error = NULL, *err = NULL; + GError *local_error = NULL; + GError *err = NULL; cbfile = E_CAL_BACKEND_FILE (backend); priv = cbfile->priv; @@ -1317,9 +1320,10 @@ e_cal_backend_file_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable /* remove all files in the directory */ dirname = g_path_get_dirname (str_uri); - dir = g_dir_open (dirname, 0, &error); + dir = g_dir_open (dirname, 0, &local_error); if (!dir) { - err = e_data_cal_create_error (PermissionDenied, error ? error->message : NULL); + err = e_data_cal_create_error ( + PermissionDenied, local_error->message); goto done; } @@ -1362,8 +1366,8 @@ e_cal_backend_file_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable g_static_rec_mutex_unlock (&priv->idle_save_rmutex); - if (error) - g_error_free (error); + if (local_error) + g_error_free (local_error); } /* Set_mode handler for the file backend */ @@ -3152,9 +3156,11 @@ e_cal_backend_file_reload (ECalBackendFile *cbfile, GError **perror) g_free (str_uri); if (!err && !priv->read_only) { - ESource *source = e_cal_backend_get_source (E_CAL_BACKEND (cbfile)); + ESource *source; + + source = e_cal_backend_get_source (E_CAL_BACKEND (cbfile)); - if (source && e_source_get_property (source, "custom-file-readonly") && g_str_equal (e_source_get_property (source, "custom-file-readonly"), "1")) + if (e_source_get_property (source, "custom-file-readonly") && g_str_equal (e_source_get_property (source, "custom-file-readonly"), "1")) priv->read_only = TRUE; } done: diff --git a/calendar/backends/http/e-cal-backend-http-factory.c b/calendar/backends/http/e-cal-backend-http-factory.c index 840762f..33a4f35 100644 --- a/calendar/backends/http/e-cal-backend-http-factory.c +++ b/calendar/backends/http/e-cal-backend-http-factory.c @@ -16,18 +16,34 @@ #include "e-cal-backend-http-factory.h" #include "e-cal-backend-http.h" -typedef struct { - ECalBackendFactory parent_object; -} ECalBackendHttpFactory; +typedef ECalBackendFactory ECalBackendHttpEventsFactory; +typedef ECalBackendFactoryClass ECalBackendHttpEventsFactoryClass; -typedef struct { - ECalBackendFactoryClass parent_class; -} ECalBackendHttpFactoryClass; +typedef ECalBackendFactory ECalBackendHttpJournalFactory; +typedef ECalBackendFactoryClass ECalBackendHttpJournalFactoryClass; -static void -e_cal_backend_http_factory_instance_init (ECalBackendHttpFactory *factory) -{ -} +typedef ECalBackendFactory ECalBackendHttpTodosFactory; +typedef ECalBackendFactoryClass ECalBackendHttpTodosFactoryClass; + +/* Forward Declarations */ +GType e_cal_backend_http_events_factory_get_type (void); +GType e_cal_backend_http_journal_factory_get_type (void); +GType e_cal_backend_http_todos_factory_get_type (void); + +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendHttpEventsFactory, + e_cal_backend_http_events_factory, + E_TYPE_CAL_BACKEND_FACTORY) + +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendHttpJournalFactory, + e_cal_backend_http_journal_factory, + E_TYPE_CAL_BACKEND_FACTORY) + +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendHttpTodosFactory, + e_cal_backend_http_todos_factory, + E_TYPE_CAL_BACKEND_FACTORY) static const gchar * _get_protocol (ECalBackendFactory *factory) @@ -35,170 +51,130 @@ _get_protocol (ECalBackendFactory *factory) return "webcal"; } -static ECalBackend* -_todos_new_backend (ECalBackendFactory *factory, ESource *source) +static icalcomponent_kind +_events_get_kind (ECalBackendFactory *factory) +{ + return ICAL_VEVENT_COMPONENT; +} + +static ECalBackend * +_events_new_backend (ECalBackendFactory *factory, + ESource *source) { - return g_object_new (e_cal_backend_http_get_type (), - "source", source, - "kind", ICAL_VTODO_COMPONENT, - NULL); + return g_object_new ( + e_cal_backend_http_get_type (), + "kind", ICAL_VEVENT_COMPONENT, + "source", source, NULL); } static icalcomponent_kind -_todos_get_kind (ECalBackendFactory *factory) +_journal_get_kind (ECalBackendFactory *factory) { - return ICAL_VTODO_COMPONENT; + return ICAL_VJOURNAL_COMPONENT; } -static ECalBackend* -_events_new_backend (ECalBackendFactory *factory, ESource *source) +static ECalBackend * +_journal_new_backend (ECalBackendFactory *factory, + ESource *source) { - return g_object_new (e_cal_backend_http_get_type (), - "source", source, - "kind", ICAL_VEVENT_COMPONENT, - NULL); + return g_object_new ( + e_cal_backend_http_get_type (), + "kind", ICAL_VJOURNAL_COMPONENT, + "source", source, NULL); } static icalcomponent_kind -_events_get_kind (ECalBackendFactory *factory) +_todos_get_kind (ECalBackendFactory *factory) { - return ICAL_VEVENT_COMPONENT; + return ICAL_VTODO_COMPONENT; } -static ECalBackend* -_memos_new_backend (ECalBackendFactory *factory, ESource *source) +static ECalBackend * +_todos_new_backend (ECalBackendFactory *factory, + ESource *source) { - return g_object_new (e_cal_backend_http_get_type (), - "source", source, - "kind", ICAL_VJOURNAL_COMPONENT, - NULL); + return g_object_new ( + e_cal_backend_http_get_type (), + "kind", ICAL_VTODO_COMPONENT, + "source", source, NULL); } -static icalcomponent_kind -_memos_get_kind (ECalBackendFactory *factory) +static void +e_cal_backend_http_events_factory_class_init (ECalBackendFactoryClass *class) { - return ICAL_VJOURNAL_COMPONENT; + class->get_protocol = _get_protocol; + class->get_kind = _events_get_kind; + class->new_backend = _events_new_backend; } static void -todos_backend_factory_class_init (ECalBackendHttpFactoryClass *klass) +e_cal_backend_http_events_factory_class_finalize (ECalBackendFactoryClass *class) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _todos_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _todos_new_backend; } static void -events_backend_factory_class_init (ECalBackendHttpFactoryClass *klass) +e_cal_backend_http_events_factory_init (ECalBackendFactory *factory) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _events_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _events_new_backend; } static void -memos_backend_factory_class_init (ECalBackendHttpFactoryClass *klass) +e_cal_backend_http_journal_factory_class_init (ECalBackendFactoryClass *class) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _memos_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _memos_new_backend; + class->get_protocol = _get_protocol; + class->get_kind = _journal_get_kind; + class->new_backend = _journal_new_backend; } -static GType -events_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_http_journal_factory_class_finalize (ECalBackendFactoryClass *class) { - GType type; - - GTypeInfo info = { - sizeof (ECalBackendHttpFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) events_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_http_factory_instance_init - }; - - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendHttpEventsFactory", - &info, 0); - - return type; } -static GType -todos_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_http_journal_factory_init (ECalBackendFactory *factory) { - GType type; - - GTypeInfo info = { - sizeof (ECalBackendHttpFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) todos_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_http_factory_instance_init - }; - - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendHttpTodosFactory", - &info, 0); - - return type; } -static GType -memos_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_http_todos_factory_class_init (ECalBackendFactoryClass *class) { - GType type; - - GTypeInfo info = { - sizeof (ECalBackendHttpFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) memos_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_http_factory_instance_init - }; - - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendHttpMemosFactory", - &info, 0); - - return type; + class->get_protocol = _get_protocol; + class->get_kind = _todos_get_kind; + class->new_backend = _todos_new_backend; } - +static void +e_cal_backend_http_todos_factory_class_finalize (ECalBackendFactoryClass *class) +{ +} -static GType http_types[3]; +static void +e_cal_backend_http_todos_factory_init (ECalBackendFactory *factory) +{ +} void -eds_module_initialize (GTypeModule *module) +eds_module_initialize (GTypeModule *type_module) { - http_types[0] = todos_backend_factory_get_type (module); - http_types[1] = events_backend_factory_get_type (module); - http_types[2] = memos_backend_factory_get_type (module); + e_cal_backend_http_events_factory_register_type (type_module); + e_cal_backend_http_journal_factory_register_type (type_module); + e_cal_backend_http_todos_factory_register_type (type_module); } void -eds_module_shutdown (void) +eds_module_shutdown (void) { } void eds_module_list_types (const GType **types, gint *num_types) { + static GType http_types[3]; + + http_types[0] = e_cal_backend_http_events_factory_get_type (); + http_types[1] = e_cal_backend_http_journal_factory_get_type (); + http_types[2] = e_cal_backend_http_todos_factory_get_type (); + *types = http_types; - *num_types = 3; + *num_types = G_N_ELEMENTS (http_types); } diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c index e468a39..97a8fc6 100644 --- a/calendar/backends/http/e-cal-backend-http.c +++ b/calendar/backends/http/e-cal-backend-http.c @@ -697,12 +697,16 @@ source_changed_cb (ESource *source, ECalBackendHttp *cbhttp) priv = cbhttp->priv; if (priv->uri) { - ESource *source = e_cal_backend_get_source (E_CAL_BACKEND (cbhttp)); - const gchar *secure_prop = e_source_get_property (source, "use_ssl"); + ESource *source; + const gchar *secure_prop; gchar *new_uri; - new_uri = webcal_to_http_method (e_cal_backend_get_uri (E_CAL_BACKEND (cbhttp)), - (secure_prop && g_str_equal(secure_prop, "1"))); + source = e_cal_backend_get_source (E_CAL_BACKEND (cbhttp)); + secure_prop = e_source_get_property (source, "use_ssl"); + + new_uri = webcal_to_http_method ( + e_cal_backend_get_uri (E_CAL_BACKEND (cbhttp)), + (secure_prop && g_str_equal(secure_prop, "1"))); if (new_uri && !g_str_equal (priv->uri, new_uri)) { /* uri changed, do reload some time soon */ diff --git a/calendar/backends/weather/e-cal-backend-weather-factory.c b/calendar/backends/weather/e-cal-backend-weather-factory.c index 6059375..8b0cda8 100644 --- a/calendar/backends/weather/e-cal-backend-weather-factory.c +++ b/calendar/backends/weather/e-cal-backend-weather-factory.c @@ -27,18 +27,16 @@ #include "e-cal-backend-weather-factory.h" #include "e-cal-backend-weather.h" -typedef struct { - ECalBackendFactory parent_object; -} ECalBackendWeatherFactory; +typedef ECalBackendFactory ECalBackendWeatherEventsFactory; +typedef ECalBackendFactoryClass ECalBackendWeatherEventsFactoryClass; -typedef struct { - ECalBackendWeatherClass parent_class; -} ECalBackendWeatherFactoryClass; +/* Forward Declarations */ +GType e_cal_backend_weather_events_factory_get_type (void); -static void -e_cal_backend_weather_factory_instance_init (ECalBackendWeatherFactory *factory) -{ -} +G_DEFINE_DYNAMIC_TYPE ( + ECalBackendWeatherEventsFactory, + e_cal_backend_weather_events_factory, + E_TYPE_CAL_BACKEND_FACTORY) static const gchar * _get_protocol (ECalBackendFactory *factory) @@ -46,58 +44,44 @@ _get_protocol (ECalBackendFactory *factory) return "weather"; } -static ECalBackend* -_events_new_backend (ECalBackendFactory *factory, ESource *source) -{ - return g_object_new (e_cal_backend_weather_get_type (), - "source", source, - "kind", ICAL_VEVENT_COMPONENT, - NULL); -} - static icalcomponent_kind _events_get_kind (ECalBackendFactory *factory) { return ICAL_VEVENT_COMPONENT; } +static ECalBackend * +_events_new_backend (ECalBackendFactory *factory, + ESource *source) +{ + return g_object_new ( + e_cal_backend_weather_get_type (), + "kind", ICAL_VEVENT_COMPONENT, + "source", source, NULL); +} + static void -events_backend_factory_class_init (ECalBackendWeatherFactoryClass *klass) +e_cal_backend_weather_events_factory_class_init (ECalBackendFactoryClass *class) { - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; - E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _events_get_kind; - E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _events_new_backend; + class->get_protocol = _get_protocol; + class->get_kind = _events_get_kind; + class->new_backend = _events_new_backend; } -static GType -events_backend_factory_get_type (GTypeModule *module) +static void +e_cal_backend_weather_events_factory_class_finalize (ECalBackendFactoryClass *class) { - GType type; - GTypeInfo info = { - sizeof (ECalBackendWeatherFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) events_backend_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECalBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cal_backend_weather_factory_instance_init - }; - type = g_type_module_register_type (module, - E_TYPE_CAL_BACKEND_FACTORY, - "ECalBackendWeatherEventsFactory", - &info, 0); - - return type; } -static GType weather_type[1]; +static void +e_cal_backend_weather_events_factory_init (ECalBackendFactory *factory) +{ +} void -eds_module_initialize (GTypeModule *module) +eds_module_initialize (GTypeModule *type_module) { - weather_type[0] = events_backend_factory_get_type (module); + e_cal_backend_weather_events_factory_register_type (type_module); } void @@ -108,6 +92,10 @@ eds_module_shutdown (void) void eds_module_list_types (const GType **types, gint *num_types) { - *types = weather_type; - *num_types = 1; + static GType weather_types[1]; + + weather_types[0] = e_cal_backend_weather_events_factory_get_type (); + + *types = weather_types; + *num_types = G_N_ELEMENTS (weather_types); } diff --git a/calendar/backends/weather/e-cal-backend-weather.c b/calendar/backends/weather/e-cal-backend-weather.c index cb2503b..d1f7d9c 100644 --- a/calendar/backends/weather/e-cal-backend-weather.c +++ b/calendar/backends/weather/e-cal-backend-weather.c @@ -268,7 +268,9 @@ begin_retrieval_cb (ECalBackendWeather *cbw) priv->is_loading = TRUE; - e_weather_source_parse (priv->source, (EWeatherSourceFinished) finished_retrieval_cb, cbw); + e_weather_source_parse ( + priv->source, (EWeatherSourceFinished) + finished_retrieval_cb, cbw); return FALSE; } diff --git a/calendar/backends/weather/e-weather-source-ccf.c b/calendar/backends/weather/e-weather-source-ccf.c index f8735ec..e1924a5 100644 --- a/calendar/backends/weather/e-weather-source-ccf.c +++ b/calendar/backends/weather/e-weather-source-ccf.c @@ -416,7 +416,9 @@ parse_done (WeatherInfo *info, gpointer data) } static void -e_weather_source_ccf_parse (EWeatherSource *source, EWeatherSourceFinished done, gpointer data) +e_weather_source_ccf_parse (EWeatherSource *source, + EWeatherSourceFinished done, + gpointer data) { EWeatherSourceCCF *ccfsource = (EWeatherSourceCCF*) source; WeatherPrefs prefs; @@ -446,8 +448,7 @@ e_weather_source_ccf_class_init (EWeatherSourceCCFClass *class) { EWeatherSourceClass *source_class; - source_class = (EWeatherSourceClass *) class; - + source_class = E_WEATHER_SOURCE_CLASS (class); source_class->parse = e_weather_source_ccf_parse; } diff --git a/calendar/backends/weather/e-weather-source-ccf.h b/calendar/backends/weather/e-weather-source-ccf.h index ad697f8..1832b72 100644 --- a/calendar/backends/weather/e-weather-source-ccf.h +++ b/calendar/backends/weather/e-weather-source-ccf.h @@ -30,13 +30,26 @@ #include #undef GWEATHER_I_KNOW_THIS_IS_UNSTABLE -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_WEATHER_SOURCE_CCF \ + (e_weather_source_ccf_get_type ()) +#define E_WEATHER_SOURCE_CCF(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_WEATHER_SOURCE_CCF, EWeatherSourceCCF)) +#define E_WEATHER_SOURCE_CCF_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_WEATHER_SOURCE_CCF, EWeatherSourceCCF)) +#define E_IS_WEATHER_SOURCE_CCF(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_WEATHER_SOURCE_CCF)) +#define E_IS_WEATHER_SOURCE_CCF_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_WEATHER_SOURCE_CCF)) +#define E_WEATHER_SOURCE_CCF_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_WEATHER_SOURCE_CCF, EWeatherSourceCCF)) -#define E_TYPE_WEATHER_SOURCE_CCF (e_weather_source_ccf_get_type ()) -#define E_WEATHER_SOURCE_CCF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_WEATHER_SOURCE_CCF, EWeatherSourceCCF)) -#define E_WEATHER_SOURCE_CCF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_WEATHER_SOURCE_CCF, EWeatherSourceCCF)) -#define E_IS_WEATHER_SOURCE_CCF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_WEATHER_SOURCE_CCF)) -#define E_IS_WEATHER_SOURCE_CCF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_WEATHER_SOURCE_CCF)) +G_BEGIN_DECLS typedef struct _EWeatherSourceCCF EWeatherSourceCCF; typedef struct _EWeatherSourceCCFClass EWeatherSourceCCFClass; @@ -55,9 +68,9 @@ struct _EWeatherSourceCCFClass { EWeatherSourceClass parent_class; }; -EWeatherSource* e_weather_source_ccf_new (const gchar *uri); -GType e_weather_source_ccf_get_type (void); +GType e_weather_source_ccf_get_type (void); +EWeatherSource *e_weather_source_ccf_new (const gchar *uri); G_END_DECLS -#endif +#endif /* E_WEATHER_SOURCE_CCF_H */ diff --git a/calendar/backends/weather/e-weather-source.c b/calendar/backends/weather/e-weather-source.c index 539390a..74ea669 100644 --- a/calendar/backends/weather/e-weather-source.c +++ b/calendar/backends/weather/e-weather-source.c @@ -26,11 +26,17 @@ G_DEFINE_TYPE (EWeatherSource, e_weather_source, G_TYPE_OBJECT) void -e_weather_source_parse (EWeatherSource *source, EWeatherSourceFinished done, gpointer data) +e_weather_source_parse (EWeatherSource *source, + EWeatherSourceFinished done, + gpointer data) { EWeatherSourceClass *class; + g_return_if_fail (source != NULL); - class = (EWeatherSourceClass*) G_OBJECT_GET_CLASS (source); + + class = E_WEATHER_SOURCE_GET_CLASS (source); + g_return_if_fail (class->parse != NULL); + class->parse (source, done, data); } @@ -46,7 +52,8 @@ e_weather_source_init (EWeatherSource *source) /* nothing to do here */ } -EWeatherSource* e_weather_source_new (const gchar *uri) +EWeatherSource * +e_weather_source_new (const gchar *uri) { const gchar *base = uri + 10; /* skip weather:// */ diff --git a/calendar/backends/weather/e-weather-source.h b/calendar/backends/weather/e-weather-source.h index 175d9fa..e5e94cc 100644 --- a/calendar/backends/weather/e-weather-source.h +++ b/calendar/backends/weather/e-weather-source.h @@ -28,6 +28,25 @@ #include #undef GWEATHER_I_KNOW_THIS_IS_UNSTABLE +/* Standard GObject macros */ +#define E_TYPE_WEATHER_SOURCE \ + (e_weather_source_get_type ()) +#define E_WEATHER_SOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_WEATHER_SOURCE, EWeatherSource)) +#define E_WEATHER_SOURCE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_WEATHER_SOURCE, EWeatherSourceClass)) +#define E_IS_WEATHER_SOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_WEATHER_SOURCE)) +#define E_IS_WEATHER_SOURCE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_WEATHER_SOURCE)) +#define E_WEATHER_SOURCE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_WEATHER_SOURCE, EWeatherSourceClass)) + G_BEGIN_DECLS typedef enum { @@ -60,12 +79,6 @@ typedef enum { typedef void (*EWeatherSourceFinished)(WeatherInfo *result, gpointer data); -#define E_TYPE_WEATHER_SOURCE (e_weather_source_get_type ()) -#define E_WEATHER_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_WEATHER_SOURCE, EWeatherSource)) -#define E_WEATHER_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_WEATHER_SOURCE, EWeatherSource)) -#define E_IS_WEATHER_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_WEATHER_SOURCE)) -#define E_IS_WEATHER_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_WEATHER_SOURCE)) - typedef struct _EWeatherSource EWeatherSource; typedef struct _EWeatherSourceClass EWeatherSourceClass; @@ -73,7 +86,7 @@ typedef struct _EWeatherSourceClass EWeatherSourceClass; * All the URL fetching is handled outside of this, and all this has * to know how to do is parse the specific format. */ struct _EWeatherSource { - GObject object; + GObject parent; }; struct _EWeatherSourceClass { @@ -81,13 +94,17 @@ struct _EWeatherSourceClass { /* Returns a list of WeatherForecast objects containing the * data for the forecast. */ - void (*parse) (EWeatherSource *source, EWeatherSourceFinished done, gpointer data); + void (*parse) (EWeatherSource *source, + EWeatherSourceFinished done, + gpointer data); }; -EWeatherSource* e_weather_source_new (const gchar *uri); -GType e_weather_source_get_type (void); -void e_weather_source_parse (EWeatherSource *source, EWeatherSourceFinished done, gpointer data); +GType e_weather_source_get_type (void); +EWeatherSource *e_weather_source_new (const gchar *uri); +void e_weather_source_parse (EWeatherSource *source, + EWeatherSourceFinished done, + gpointer data); G_END_DECLS -#endif +#endif /* E_WEATHER_SOURCE_H */ diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index 0dd0e10..2cfa75e 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -1114,7 +1114,9 @@ e_cal_new (ESource *source, ECalSourceType type) { ECal *ecal; ECalPrivate *priv; - gchar *path, *xml, **strv; + gchar *path; + gchar *xml; + gchar **strv; GError *error = NULL; GDBusConnection *connection; @@ -4463,12 +4465,14 @@ e_cal_open_default (ECal **ecal, return FALSE; } - /* XXX This can fail but doesn't take a GError!? */ + /* XXX So this can fail, but doesn't take a GError!? */ client = e_cal_new (source, type); - if (!client) { - g_set_error_literal (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_OTHER_ERROR, - e_cal_get_error_message (E_CALENDAR_STATUS_OTHER_ERROR)); + + if (client == NULL) { + g_set_error_literal ( + error, E_CALENDAR_ERROR, + E_CALENDAR_STATUS_OTHER_ERROR, + e_cal_get_error_message (E_CALENDAR_STATUS_OTHER_ERROR)); g_object_unref (source_list); return FALSE; } @@ -4489,10 +4493,10 @@ e_cal_open_default (ECal **ecal, /** * e_cal_set_default: - * @ecal: A calendar client. - * @error: Placeholder for error information. + * @ecal: an #ECal + * @error: return location for a #GError, or %NULL * - * Sets a calendar as the default one. + * Sets the #ESource in @ecal as default. * * Returns: TRUE if the operation was successful, FALSE otherwise. * @@ -4502,18 +4506,14 @@ gboolean e_cal_set_default (ECal *ecal, GError **error) { ESource *source; + ECalSourceType source_type; - e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG); + g_return_val_if_fail (E_IS_CAL (ecal), FALSE); source = e_cal_get_source (ecal); - if (!source) { - g_set_error_literal (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_NO_SUCH_CALENDAR, - e_cal_get_error_message (E_CALENDAR_STATUS_NO_SUCH_CALENDAR)); - return FALSE; - } + source_type = e_cal_get_source_type (ecal); - return e_cal_set_default_source (source, ecal->priv->type, error); + return e_cal_set_default_source (source, source_type, error); } static gboolean @@ -4559,18 +4559,20 @@ set_default_source (ESourceList *sources, ESource *source, GError **error) /** * e_cal_set_default_source: - * @source: An #ESource. - * @type: Type of the source. - * @error: Placeholder for error information. + * @source: an #ESource + * @type: type of the source + * @error: return location for a #GError, or %NULL * - * Sets the default source for the specified @type. + * Sets @source as the default source for the specified @type. * * Returns: TRUE if the operation was successful, FALSE otherwise. * * Deprecated: 3.2: Use e_cal_client_set_default_source() instead. */ gboolean -e_cal_set_default_source (ESource *source, ECalSourceType type, GError **error) +e_cal_set_default_source (ESource *source, + ECalSourceType type, + GError **error) { ESourceList *sources; GError *err = NULL; diff --git a/calendar/libecal/e-cal.h b/calendar/libecal/e-cal.h index a1dc014..ae003e7 100644 --- a/calendar/libecal/e-cal.h +++ b/calendar/libecal/e-cal.h @@ -24,9 +24,8 @@ #ifndef E_CAL_DISABLE_DEPRECATED -#include -#include "libedataserver/e-source-list.h" -#include "libedataserver/e-source.h" +#include +#include #include #include #include diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c index a65051f..2fcb4de 100644 --- a/calendar/libedata-cal/e-cal-backend.c +++ b/calendar/libedata-cal/e-cal-backend.c @@ -117,7 +117,6 @@ cal_backend_set_default_cache_dir (ECalBackend *backend) kind = e_cal_backend_get_kind (backend); source = e_cal_backend_get_source (backend); - g_return_if_fail (source != NULL); switch (kind) { case ICAL_VEVENT_COMPONENT: diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c index 8e64ffb..4dc83f0 100644 --- a/calendar/libedata-cal/e-data-cal-factory.c +++ b/calendar/libedata-cal/e-data-cal-factory.c @@ -36,12 +36,11 @@ #endif #endif -#include "libedataserver/e-url.h" -#include "libedataserver/e-source.h" -#include "libedataserver/e-source-list.h" -#include "libebackend/e-data-server-module.h" +#include +#include +#include #include -#include "libecal/e-cal.h" +#include #include "e-cal-backend.h" #include "e-cal-backend-factory.h" #include "e-data-cal.h" @@ -341,12 +340,15 @@ find_backend_cb (gpointer key, gpointer value, gpointer data) } static gboolean -impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocation, const gchar * const *in_source_type, EDataCalFactory *factory) +impl_CalFactory_getCal (EGdbusCalFactory *object, + GDBusMethodInvocation *invocation, + const gchar * const *in_source_type, + EDataCalFactory *factory) { EDataCal *calendar; + ECalBackend *backend; EDataCalFactoryPrivate *priv = factory->priv; ECalBackendFactory *backend_factory; - ECalBackend *backend; ESource *source; gchar *str_uri; EUri *uri; @@ -489,7 +491,9 @@ impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocat g_hash_table_insert ( priv->backends, g_strdup (uid_type_string), backend); - g_signal_connect (backend, "last-client-gone", G_CALLBACK (last_client_gone_cb), factory); + g_signal_connect ( + backend, "last-client-gone", + G_CALLBACK (last_client_gone_cb), factory); e_cal_backend_set_online (backend, priv->is_online); } else if (!e_source_equal (source, e_cal_backend_get_source (backend))) { /* source changed, update it in a backend */ @@ -1009,7 +1013,8 @@ main (gint argc, gchar **argv) eol, "changed", G_CALLBACK (offline_state_changed_cb), factory); - owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, + owner_id = g_bus_own_name ( + G_BUS_TYPE_SESSION, CALENDAR_DBUS_SERVICE_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, diff --git a/configure.ac b/configure.ac index 5c85b29..06bd94a 100644 --- a/configure.ac +++ b/configure.ac @@ -319,7 +319,6 @@ PKG_CHECK_MODULES(GNOME_PLATFORM, libsoup-2.4 >= libsoup_minimum_version libgdata >= libgdata_minimum_version]) - if test x$os_win32 = xno; then dnl *********************************** dnl Check for GNOME Keyring. diff --git a/libedataserverui/e-book-auth-util.c b/libedataserverui/e-book-auth-util.c index 822860e..c2db5fc 100644 --- a/libedataserverui/e-book-auth-util.c +++ b/libedataserverui/e-book-auth-util.c @@ -29,7 +29,7 @@ #include #include #include -#include "libedataserver/e-url.h" +#include #include "e-book-auth-util.h" static void addressbook_authenticate (EBook *book, gboolean previous_failure, diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c index bd66153..16558b9 100644 --- a/libedataserverui/e-name-selector-dialog.c +++ b/libedataserverui/e-name-selector-dialog.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/libedataserverui/e-name-selector-entry.c b/libedataserverui/e-name-selector-entry.c index fbb2149..18be4cd 100644 --- a/libedataserverui/e-name-selector-entry.c +++ b/libedataserverui/e-name-selector-entry.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/libedataserverui/e-name-selector.h b/libedataserverui/e-name-selector.h index 2416661..8f5233a 100644 --- a/libedataserverui/e-name-selector.h +++ b/libedataserverui/e-name-selector.h @@ -25,7 +25,7 @@ #include -#include "libedataserver/e-source-list.h" +#include #include #include #include diff --git a/libedataserverui/e-source-combo-box.c b/libedataserverui/e-source-combo-box.c index 6086b44..d66f4a0 100644 --- a/libedataserverui/e-source-combo-box.c +++ b/libedataserverui/e-source-combo-box.c @@ -350,26 +350,26 @@ e_source_combo_box_new (ESourceList *source_list) /** * e_source_combo_box_get_source_list: - * @source_combo_box: an #ESourceComboBox + * @combo_box: an #ESourceComboBox * * Returns the #ESourceList which is acting as a data source for - * @source_combo_box. + * @combo_box. * * Returns: an #ESourceList * * Since: 2.22 **/ ESourceList * -e_source_combo_box_get_source_list (ESourceComboBox *source_combo_box) +e_source_combo_box_get_source_list (ESourceComboBox *combo_box) { - g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box), NULL); + g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (combo_box), NULL); - return source_combo_box->priv->source_list; + return combo_box->priv->source_list; } /** * e_source_combo_box_set_source_list: - * @source_combo_box: an #ESourceComboBox + * @combo_box: an #ESourceComboBox * @source_list: an #ESourceList * * Sets the source list used by @source_combo_box to be @source_list. This @@ -378,44 +378,44 @@ e_source_combo_box_get_source_list (ESourceComboBox *source_combo_box) * Since: 2.22 **/ void -e_source_combo_box_set_source_list (ESourceComboBox *source_combo_box, +e_source_combo_box_set_source_list (ESourceComboBox *combo_box, ESourceList *source_list) { - g_return_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box)); + g_return_if_fail (E_IS_SOURCE_COMBO_BOX (combo_box)); if (source_list != NULL) { g_return_if_fail (E_IS_SOURCE_LIST (source_list)); g_object_ref (source_list); } - if (source_combo_box->priv->source_list != NULL) { + if (combo_box->priv->source_list != NULL) { g_signal_handler_disconnect ( - source_combo_box->priv->source_list, - source_combo_box->priv->handler_id); - g_object_unref (source_combo_box->priv->source_list); - source_combo_box->priv->handler_id = 0; + combo_box->priv->source_list, + combo_box->priv->handler_id); + g_object_unref (combo_box->priv->source_list); + combo_box->priv->handler_id = 0; } - source_combo_box->priv->source_list = source_list; + combo_box->priv->source_list = source_list; /* Reset the tree store. */ - source_list_changed_cb (source_list, source_combo_box); + source_list_changed_cb (source_list, combo_box); /* Watch for source list changes. */ if (source_list != NULL) { - source_combo_box->priv->handler_id = + combo_box->priv->handler_id = g_signal_connect_object ( source_list, "changed", G_CALLBACK (source_list_changed_cb), - source_combo_box, 0); + combo_box, 0); } - g_object_notify (G_OBJECT (source_combo_box), "source-list"); + g_object_notify (G_OBJECT (combo_box), "source-list"); } /** * e_source_combo_box_get_active: - * @source_combo_box: an #ESourceComboBox + * @combo_box: an #ESourceComboBox * * Returns the #ESource corresponding to the currently active item, or %NULL * if there is no active item. @@ -425,21 +425,21 @@ e_source_combo_box_set_source_list (ESourceComboBox *source_combo_box, * Since: 2.22 **/ ESource * -e_source_combo_box_get_active (ESourceComboBox *source_combo_box) +e_source_combo_box_get_active (ESourceComboBox *combo_box) { - GtkComboBox *combo_box; + GtkComboBox *gtk_combo_box; GtkTreeIter iter; ESource *source; - g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box), NULL); + g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (combo_box), NULL); - combo_box = GTK_COMBO_BOX (source_combo_box); + gtk_combo_box = GTK_COMBO_BOX (combo_box); - if (!gtk_combo_box_get_active_iter (combo_box, &iter)) + if (!gtk_combo_box_get_active_iter (gtk_combo_box, &iter)) return NULL; gtk_tree_model_get ( - gtk_combo_box_get_model (combo_box), + gtk_combo_box_get_model (gtk_combo_box), &iter, COLUMN_SOURCE, &source, -1); return source; @@ -447,7 +447,7 @@ e_source_combo_box_get_active (ESourceComboBox *source_combo_box) /** * e_source_combo_box_set_active: - * @source_combo_box: an #ESourceComboBox + * @combo_box: an #ESourceComboBox * @source: an #ESource * * Sets the active item to the one corresponding to @source. @@ -455,19 +455,19 @@ e_source_combo_box_get_active (ESourceComboBox *source_combo_box) * Since: 2.22 **/ void -e_source_combo_box_set_active (ESourceComboBox *source_combo_box, +e_source_combo_box_set_active (ESourceComboBox *combo_box, ESource *source) { - g_return_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box)); + g_return_if_fail (E_IS_SOURCE_COMBO_BOX (combo_box)); g_return_if_fail (E_IS_SOURCE (source)); e_source_combo_box_set_active_uid ( - source_combo_box, e_source_peek_uid (source)); + combo_box, e_source_peek_uid (source)); } /** * e_source_combo_box_get_active_uid: - * @source_combo_box: an #ESourceComboBox + * @combo_box: an #ESourceComboBox * * Returns the unique ID of the #ESource corresponding to the currently * active item, or %NULL if there is no active item. @@ -477,13 +477,13 @@ e_source_combo_box_set_active (ESourceComboBox *source_combo_box, * Since: 2.22 **/ const gchar * -e_source_combo_box_get_active_uid (ESourceComboBox *source_combo_box) +e_source_combo_box_get_active_uid (ESourceComboBox *combo_box) { ESource *source; - g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box), NULL); + g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (combo_box), NULL); - source = e_source_combo_box_get_active (source_combo_box); + source = e_source_combo_box_get_active (combo_box); if (source == NULL) return NULL; @@ -492,7 +492,7 @@ e_source_combo_box_get_active_uid (ESourceComboBox *source_combo_box) /** * e_source_combo_box_set_active_uid: - * @source_combo_box: an #ESourceComboBox + * @combo_box: an #ESourceComboBox * @uid: a unique ID of an #ESource * * Sets the active item to the one corresponding to @uid. @@ -502,20 +502,20 @@ e_source_combo_box_get_active_uid (ESourceComboBox *source_combo_box) * Since: 2.22 **/ gboolean -e_source_combo_box_set_active_uid (ESourceComboBox *source_combo_box, +e_source_combo_box_set_active_uid (ESourceComboBox *combo_box, const gchar *uid) { ESourceComboBoxPrivate *priv; GtkTreeRowReference *reference; - GtkComboBox *combo_box; + GtkComboBox *gtk_combo_box; GtkTreeIter iter; gboolean iter_was_set; - g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box), FALSE); + g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (combo_box), FALSE); g_return_val_if_fail (uid != NULL, FALSE); - priv = source_combo_box->priv; - combo_box = GTK_COMBO_BOX (source_combo_box); + priv = combo_box->priv; + gtk_combo_box = GTK_COMBO_BOX (combo_box); reference = g_hash_table_lookup (priv->uid_index, uid); if (!reference) @@ -524,11 +524,11 @@ e_source_combo_box_set_active_uid (ESourceComboBox *source_combo_box, g_return_val_if_fail (gtk_tree_row_reference_valid (reference), FALSE); iter_was_set = gtk_tree_model_get_iter ( - gtk_combo_box_get_model (combo_box), &iter, + gtk_combo_box_get_model (gtk_combo_box), &iter, gtk_tree_row_reference_get_path (reference)); g_return_val_if_fail (iter_was_set, FALSE); - gtk_combo_box_set_active_iter (combo_box, &iter); + gtk_combo_box_set_active_iter (gtk_combo_box, &iter); return TRUE; } diff --git a/libedataserverui/e-source-combo-box.h b/libedataserverui/e-source-combo-box.h index a4413a8..193732b 100644 --- a/libedataserverui/e-source-combo-box.h +++ b/libedataserverui/e-source-combo-box.h @@ -63,19 +63,19 @@ struct _ESourceComboBoxClass { GType e_source_combo_box_get_type (void); GtkWidget * e_source_combo_box_new (ESourceList *source_list); ESourceList * e_source_combo_box_get_source_list - (ESourceComboBox *source_combo_box); + (ESourceComboBox *combo_box); void e_source_combo_box_set_source_list - (ESourceComboBox *source_combo_box, + (ESourceComboBox *combo_box, ESourceList *source_list); ESource * e_source_combo_box_get_active - (ESourceComboBox *source_combo_box); + (ESourceComboBox *combo_box); void e_source_combo_box_set_active - (ESourceComboBox *source_combo_box, + (ESourceComboBox *combo_box, ESource *source); const gchar * e_source_combo_box_get_active_uid - (ESourceComboBox *source_combo_box); + (ESourceComboBox *combo_box); gboolean e_source_combo_box_set_active_uid - (ESourceComboBox *source_combo_box, + (ESourceComboBox *combo_box, const gchar *uid); G_END_DECLS diff --git a/libedataserverui/e-source-selector-dialog.c b/libedataserverui/e-source-selector-dialog.c index 71aef27..73cb79d 100644 --- a/libedataserverui/e-source-selector-dialog.c +++ b/libedataserverui/e-source-selector-dialog.c @@ -207,15 +207,16 @@ setup_dialog (GtkWindow *parent, ESourceSelectorDialog *dialog, ESourceList *sou /** * e_source_selector_dialog_new: - * @parent: Parent window. - * @source_list: A source list. + * @parent: a parent window + * @source_list: an #ESourceList * * Create a new source selector dialog for the given @list. * - * Returns: The newly created widget. - */ + * Returns: a new #ESourceSelectorDialog + **/ GtkWidget * -e_source_selector_dialog_new (GtkWindow *parent, ESourceList *source_list) +e_source_selector_dialog_new (GtkWindow *parent, + ESourceList *source_list) { ESourceSelectorDialog *dialog; @@ -228,11 +229,11 @@ e_source_selector_dialog_new (GtkWindow *parent, ESourceList *source_list) /** * e_source_selector_dialog_select_default_source: - * @dialog: An #ESourceSelectorDialog widget. + * @dialog: an #ESourceSelectorDialog * - * Selects default source in the dialog. + * Selects the default source in the dialog. * - * Returns: Whether found any default source. + * Returns: %TRUE if a default source was selected * * Since: 2.28 **/ @@ -276,19 +277,16 @@ e_source_selector_dialog_select_default_source (ESourceSelectorDialog *dialog) /** * e_source_selector_dialog_peek_primary_selection: - * @dialog: An #ESourceSelectorDialog widget. + * @dialog: an #ESourceSelectorDialog * * Peek the currently selected source in the given @dialog. * - * Returns: the selected ESource. + * Returns: the selected #ESource */ ESource * e_source_selector_dialog_peek_primary_selection (ESourceSelectorDialog *dialog) { - ESourceSelectorDialogPrivate *priv; - g_return_val_if_fail (E_IS_SOURCE_SELECTOR_DIALOG (dialog), NULL); - priv = dialog->priv; - return priv->selected_source; + return dialog->priv->selected_source; } diff --git a/libedataserverui/e-source-selector-dialog.h b/libedataserverui/e-source-selector-dialog.h index b7455a7..66b8cf1 100644 --- a/libedataserverui/e-source-selector-dialog.h +++ b/libedataserverui/e-source-selector-dialog.h @@ -25,7 +25,7 @@ #define E_SOURCE_SELECTOR_DIALOG_H #include -#include "libedataserver/e-source-list.h" +#include /* Standard GObject macros */ #define E_TYPE_SOURCE_SELECTOR_DIALOG \ diff --git a/libedataserverui/e-source-selector.c b/libedataserverui/e-source-selector.c index 28b90fd..d8f8333 100644 --- a/libedataserverui/e-source-selector.c +++ b/libedataserverui/e-source-selector.c @@ -1366,8 +1366,6 @@ e_source_selector_init (ESourceSelector *selector) gtk_tree_view_set_headers_visible (tree_view, FALSE); } -/* Public API. */ - /** * e_source_selector_new: * @list: A source list. diff --git a/libedataserverui/e-source-selector.h b/libedataserverui/e-source-selector.h index 73a19a2..fb1dc3e 100644 --- a/libedataserverui/e-source-selector.h +++ b/libedataserverui/e-source-selector.h @@ -25,7 +25,7 @@ #define E_SOURCE_SELECTOR_H #include -#include "libedataserver/e-source-list.h" +#include /* Standard GObject macros */ #define E_TYPE_SOURCE_SELECTOR \ @@ -93,12 +93,15 @@ gboolean e_source_selector_source_is_selected (ESourceSelector *selector, ESource *source); GSList * e_source_selector_get_selection (ESourceSelector *selector); -void e_source_selector_free_selection (GSList *list); -void e_source_selector_show_selection (ESourceSelector *selector, +void e_source_selector_free_selection + (GSList *list); +void e_source_selector_show_selection + (ESourceSelector *selector, gboolean show); gboolean e_source_selector_selection_shown (ESourceSelector *selector); -void e_source_selector_set_select_new (ESourceSelector *selector, +void e_source_selector_set_select_new + (ESourceSelector *selector, gboolean state); void e_source_selector_edit_primary_selection (ESourceSelector *selector);