diff options
author | Milan Crha <mcrha@redhat.com> | 2012-11-06 23:20:46 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-11-06 23:21:37 +0800 |
commit | 704b78d23bf8d707707411608a3453250f2637a1 (patch) | |
tree | 6bea89936534973c9b467503d198245f5035bc77 /calendar | |
parent | b6fddaaa0efb8013c526f00926830b9cdcbe0d60 (diff) | |
download | gsoc2013-evolution-704b78d23bf8d707707411608a3453250f2637a1.tar.gz gsoc2013-evolution-704b78d23bf8d707707411608a3453250f2637a1.tar.zst gsoc2013-evolution-704b78d23bf8d707707411608a3453250f2637a1.zip |
Replace deprecated GLib symbols (as of GLib 2.34.x)
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/alarm-notify/config-data.c | 26 | ||||
-rw-r--r-- | calendar/alarm-notify/config-data.h | 2 | ||||
-rw-r--r-- | calendar/alarm-notify/notify-main.c | 2 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 6 | ||||
-rw-r--r-- | calendar/gui/e-cal-model.c | 18 | ||||
-rw-r--r-- | calendar/gui/e-meeting-store.c | 30 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 24 |
7 files changed, 56 insertions, 52 deletions
diff --git a/calendar/alarm-notify/config-data.c b/calendar/alarm-notify/config-data.c index a2f9a2d448..b9f9b7a07d 100644 --- a/calendar/alarm-notify/config-data.c +++ b/calendar/alarm-notify/config-data.c @@ -31,7 +31,6 @@ /* Whether we have initied ourselves by reading * the data from the configuration engine. */ -static gboolean inited = FALSE; static GSettings *calendar_settings = NULL; /* Copied from ../calendar-config.c; returns whether the locale has 'am' and @@ -47,27 +46,22 @@ locale_supports_12_hour_format (void) return s[0] != '\0'; } -static void -do_cleanup (void) +void +config_data_cleanup (void) { - g_object_unref (calendar_settings); - calendar_settings = FALSE; - - inited = FALSE; + if (calendar_settings) + g_object_unref (calendar_settings); + calendar_settings = NULL; } /* Ensures that the configuration values have been read */ static void ensure_inited (void) { - if (inited) + if (calendar_settings) return; - inited = TRUE; - calendar_settings = g_settings_new ("org.gnome.evolution.calendar"); - - g_atexit ((GVoidFunc) do_cleanup); } icaltimezone * @@ -287,7 +281,7 @@ config_data_is_blessed_program (const gchar *program) } static gboolean can_debug = FALSE; -static GStaticRecMutex rec_mutex = G_STATIC_REC_MUTEX_INIT; +static GRecMutex rec_mutex; void config_data_init_debugging (void) @@ -301,12 +295,12 @@ config_data_init_debugging (void) gboolean config_data_start_debugging (void) { - g_static_rec_mutex_lock (&rec_mutex); + g_rec_mutex_lock (&rec_mutex); if (can_debug) return TRUE; - g_static_rec_mutex_unlock (&rec_mutex); + g_rec_mutex_unlock (&rec_mutex); return FALSE; } @@ -314,5 +308,5 @@ config_data_start_debugging (void) void config_data_stop_debugging (void) { - g_static_rec_mutex_unlock (&rec_mutex); + g_rec_mutex_unlock (&rec_mutex); } diff --git a/calendar/alarm-notify/config-data.h b/calendar/alarm-notify/config-data.h index c97c0f7415..d30781c693 100644 --- a/calendar/alarm-notify/config-data.h +++ b/calendar/alarm-notify/config-data.h @@ -29,6 +29,8 @@ #include <libical/ical.h> #include <libecal/libecal.h> +void config_data_cleanup (void); + icaltimezone * config_data_get_timezone (void); gboolean config_data_get_24_hour_format (void); gboolean config_data_get_notify_with_tray diff --git a/calendar/alarm-notify/notify-main.c b/calendar/alarm-notify/notify-main.c index c112331a3d..3643ae65e7 100644 --- a/calendar/alarm-notify/notify-main.c +++ b/calendar/alarm-notify/notify-main.c @@ -31,6 +31,7 @@ #include <glib/gi18n.h> #include "alarm-notify.h" +#include "config-data.h" #ifdef G_OS_WIN32 #include <windows.h> @@ -117,6 +118,7 @@ main (gint argc, G_APPLICATION (alarm_notify_service), argc, argv); g_object_unref (alarm_notify_service); + config_data_cleanup (); return exit_status; } diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 50b370fd0f..b7822da165 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -55,7 +55,11 @@ calendar_config_init (void) return; config = g_settings_new ("org.gnome.evolution.calendar"); - g_atexit ((GVoidFunc) do_cleanup); + + /* will be freed together with EShell */ + g_object_set_data_full (G_OBJECT (e_shell_get_default ()), + "calendar-config-config-cleanup", (gpointer) "1", + (GDestroyNotify) do_cleanup); } void diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 8de4244902..3020a70300 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -123,7 +123,7 @@ struct _ECalModelPrivate { GHashTable *notify_modified; GHashTable *notify_removed; - GMutex *notify_lock; + GMutex notify_lock; GCancellable *loading_clients; }; @@ -484,7 +484,7 @@ cal_model_finalize (GObject *object) } g_ptr_array_free (priv->objects, FALSE); - g_mutex_free (priv->notify_lock); + g_mutex_clear (&priv->notify_lock); g_hash_table_destroy (priv->notify_added); g_hash_table_destroy (priv->notify_modified); @@ -767,7 +767,7 @@ e_cal_model_init (ECalModel *model) model->priv->notify_added = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); model->priv->notify_modified = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); model->priv->notify_removed = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); - model->priv->notify_lock = g_mutex_new (); + g_mutex_init (&model->priv->notify_lock); model->priv->loading_clients = g_cancellable_new (); } @@ -2652,7 +2652,7 @@ process_event (ECalClientView *view, g_return_if_fail (save_hash != NULL); - g_mutex_lock (model->priv->notify_lock); + g_mutex_lock (&model->priv->notify_lock); if (*in) { GSList *save_list = g_hash_table_lookup (save_hash, view); @@ -2667,7 +2667,7 @@ process_event (ECalClientView *view, *in = TRUE; } - g_mutex_unlock (model->priv->notify_lock); + g_mutex_unlock (&model->priv->notify_lock); if (skip) return; @@ -2675,7 +2675,7 @@ process_event (ECalClientView *view, /* do it */ process_fn (view, objects, model); - g_mutex_lock (model->priv->notify_lock); + g_mutex_lock (&model->priv->notify_lock); while (g_hash_table_size (save_hash)) { gpointer key = NULL, value = NULL; GHashTableIter iter; @@ -2692,7 +2692,7 @@ process_event (ECalClientView *view, g_hash_table_remove (save_hash, view); - g_mutex_unlock (model->priv->notify_lock); + g_mutex_unlock (&model->priv->notify_lock); /* do it */ process_fn (view, save_list, model); @@ -2705,11 +2705,11 @@ process_event (ECalClientView *view, g_slist_free (save_list); g_object_unref (view); - g_mutex_lock (model->priv->notify_lock); + g_mutex_lock (&model->priv->notify_lock); } *in = FALSE; - g_mutex_unlock (model->priv->notify_lock); + g_mutex_unlock (&model->priv->notify_lock); } static void diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 0aaf8fed80..3449d5e0cb 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -64,7 +64,7 @@ struct _EMeetingStorePrivate { GPtrArray *refresh_queue; GHashTable *refresh_data; - GMutex *mutex; + GMutex mutex; guint refresh_idle_id; guint num_threads; @@ -617,11 +617,11 @@ refresh_queue_remove (EMeetingStore *store, } if (qdata) { - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); g_hash_table_remove ( priv->refresh_data, itip_strip_mailto ( e_meeting_attendee_get_address (attendee))); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); g_ptr_array_free (qdata->call_backs, TRUE); g_ptr_array_free (qdata->data, TRUE); g_free (qdata); @@ -759,7 +759,7 @@ meeting_store_finalize (GObject *object) g_free (priv->fb_uri); - g_mutex_free (priv->mutex); + g_mutex_clear (&priv->mutex); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (e_meeting_store_parent_class)->finalize (object); @@ -852,7 +852,7 @@ e_meeting_store_init (EMeetingStore *store) store->priv->refresh_data = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, NULL); - store->priv->mutex = g_mutex_new (); + g_mutex_init (&store->priv->mutex); store->priv->num_queries = 0; @@ -1331,9 +1331,9 @@ process_callbacks (EMeetingStoreQueueData *qdata) g_idle_add ((GSourceFunc) call_back, data); } - g_mutex_lock (store->priv->mutex); + g_mutex_lock (&store->priv->mutex); store->priv->num_threads--; - g_mutex_unlock (store->priv->mutex); + g_mutex_unlock (&store->priv->mutex); refresh_queue_remove (qdata->store, qdata->attendee); g_object_unref (store); @@ -1710,11 +1710,11 @@ refresh_busy_periods (gpointer data) } - g_mutex_lock (store->priv->mutex); + g_mutex_lock (&store->priv->mutex); store->priv->num_threads++; - g_mutex_unlock (store->priv->mutex); + g_mutex_unlock (&store->priv->mutex); - thread = g_thread_create ((GThreadFunc) freebusy_async, fbd, FALSE, &error); + thread = g_thread_try_new (NULL, (GThreadFunc) freebusy_async, fbd, &error); if (!thread) { /* do clean up stuff here */ g_slist_foreach (fbd->users, (GFunc) g_free, NULL); @@ -1722,13 +1722,15 @@ refresh_busy_periods (gpointer data) g_free (fbd->email); priv->refresh_idle_id = 0; - g_mutex_lock (store->priv->mutex); + g_mutex_lock (&store->priv->mutex); store->priv->num_threads--; - g_mutex_unlock (store->priv->mutex); + g_mutex_unlock (&store->priv->mutex); return FALSE; } + g_thread_unref (thread); + return TRUE; } @@ -1763,7 +1765,7 @@ refresh_queue_add (EMeetingStore *store, return; } - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); qdata = g_hash_table_lookup ( priv->refresh_data, itip_strip_mailto ( e_meeting_attendee_get_address (attendee))); @@ -1795,7 +1797,7 @@ refresh_queue_add (EMeetingStore *store, g_ptr_array_add (qdata->call_backs, call_back); g_ptr_array_add (qdata->data, data); } - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); g_object_ref (attendee); g_ptr_array_add (priv->refresh_queue, attendee); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 4a37108fb0..b98857e717 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -89,7 +89,7 @@ struct _GnomeCalendarPrivate { GtkWidget *task_table; /* ETaskTable, but can be NULL */ /* Calendar query for the date navigator */ - GMutex *dn_query_lock; + GMutex dn_query_lock; GList *dn_queries; /* list of CalQueries */ gchar *sexp; gchar *todo_sexp; @@ -128,7 +128,7 @@ struct _GnomeCalendarPrivate { /* Used in update_todo_view, to prevent interleaving when * called in separate thread. */ - GMutex *todo_update_lock; + GMutex todo_update_lock; GCancellable *cancellable; }; @@ -1118,7 +1118,7 @@ free_dn_queries (GnomeCalendar *gcal) priv = gcal->priv; - g_mutex_lock (priv->dn_query_lock); + g_mutex_lock (&priv->dn_query_lock); for (l = priv->dn_queries; l != NULL; l = l->next) { if (!l->data) @@ -1131,7 +1131,7 @@ free_dn_queries (GnomeCalendar *gcal) g_list_free (priv->dn_queries); priv->dn_queries = NULL; - g_mutex_unlock (priv->dn_query_lock); + g_mutex_unlock (&priv->dn_query_lock); } static void @@ -1200,7 +1200,7 @@ update_query_async (struct _date_query_msg *msg) new_view, "complete", G_CALLBACK (dn_client_view_complete_cb), gcal); - g_mutex_lock (priv->dn_query_lock); + g_mutex_lock (&priv->dn_query_lock); priv->dn_queries = g_list_append (priv->dn_queries, new_view); e_cal_client_view_start (new_view, &error); if (error != NULL) { @@ -1209,7 +1209,7 @@ update_query_async (struct _date_query_msg *msg) G_STRFUNC, error->message); g_clear_error (&error); } - g_mutex_unlock (priv->dn_query_lock); + g_mutex_unlock (&priv->dn_query_lock); } g_list_foreach (list, (GFunc) g_object_unref, NULL); @@ -1315,7 +1315,7 @@ update_todo_view_async (struct _mupdate_todo_msg *msg) g_return_if_fail (priv->task_table != NULL); - g_mutex_lock (priv->todo_update_lock); + g_mutex_lock (&priv->todo_update_lock); /* Set the query on the task pad */ if (priv->todo_sexp) { @@ -1337,7 +1337,7 @@ update_todo_view_async (struct _mupdate_todo_msg *msg) update_memo_view (msg->gcal); - g_mutex_unlock (priv->todo_update_lock); + g_mutex_unlock (&priv->todo_update_lock); } static gboolean @@ -1494,8 +1494,8 @@ gnome_calendar_init (GnomeCalendar *gcal) { gcal->priv = GNOME_CALENDAR_GET_PRIVATE (gcal); - gcal->priv->todo_update_lock = g_mutex_new (); - gcal->priv->dn_query_lock = g_mutex_new (); + g_mutex_init (&gcal->priv->todo_update_lock); + g_mutex_init (&gcal->priv->dn_query_lock); gcal->priv->current_view_type = GNOME_CAL_WORK_WEEK_VIEW; gcal->priv->range_selected = FALSE; @@ -1578,8 +1578,8 @@ gnome_calendar_finalize (GObject *object) priv = GNOME_CALENDAR_GET_PRIVATE (object); - g_mutex_free (priv->todo_update_lock); - g_mutex_free (priv->dn_query_lock); + g_mutex_clear (&priv->todo_update_lock); + g_mutex_clear (&priv->dn_query_lock); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (gnome_calendar_parent_class)->finalize (object); |