[gnome-calendar/gnome-3-24] project: intrument functions
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/gnome-3-24] project: intrument functions
- Date: Thu, 23 Mar 2017 02:00:49 +0000 (UTC)
commit 5ff3e970c13ba7ef114b01f52accb01c00bbb34f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Mar 17 08:47:27 2017 -0300
project: intrument functions
Add the newly added macros to provide useful tracing
information.
src/gcal-application.c | 32 +++++--
src/gcal-edit-dialog.c | 27 +++++-
src/gcal-log.c | 3 +-
src/gcal-manager.c | 218 +++++++++++++++++++++++++++++++++++++++++-------
src/gcal-search-view.c | 54 +++++++-----
src/gcal-window.c | 59 ++++++++++---
6 files changed, 315 insertions(+), 78 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index af55a93..9d53c7b 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -23,10 +23,11 @@
#define G_LOG_DOMAIN "GcalApplication"
-#include "gcal-application.h"
#include "css-code.h"
-#include "gcal-window.h"
+#include "gcal-application.h"
+#include "gcal-debug.h"
#include "gcal-shell-search-provider.h"
+#include "gcal-window.h"
#include <glib.h>
#include <glib-object.h>
@@ -206,6 +207,8 @@ gcal_application_finalize (GObject *object)
{
GcalApplication *self = GCAL_APPLICATION (object);
+ GCAL_ENTRY;
+
g_free (self->uuid);
g_clear_pointer (&self->initial_date, g_free);
@@ -214,9 +217,11 @@ gcal_application_finalize (GObject *object)
g_clear_object (&self->settings);
g_clear_object (&self->manager);
+ g_clear_object (&self->search_provider);
G_OBJECT_CLASS (gcal_application_parent_class)->finalize (object);
- g_clear_object (&self->search_provider);
+
+ GCAL_EXIT;
}
static void
@@ -226,6 +231,8 @@ gcal_application_activate (GApplication *application)
GFile* css_file;
GError *error;
+ GCAL_ENTRY;
+
self = GCAL_APPLICATION (application);
if (self->provider == NULL)
@@ -277,17 +284,22 @@ gcal_application_activate (GApplication *application)
gtk_widget_show (self->window);
}
- g_clear_pointer (&self->initial_date, g_free);
- if (self->uuid != NULL)
- {
- gcal_window_open_event_by_uuid (GCAL_WINDOW (self->window), self->uuid);
- g_clear_pointer (&(self->uuid), g_free);
- }
+ g_clear_pointer (&self->initial_date, g_free);
+
+ if (self->uuid != NULL)
+ {
+ gcal_window_open_event_by_uuid (GCAL_WINDOW (self->window), self->uuid);
+ g_clear_pointer (&(self->uuid), g_free);
+ }
+
+ GCAL_EXIT;
}
static void
gcal_application_startup (GApplication *app)
{
+ GCAL_ENTRY;
+
/* add actions */
g_action_map_add_action_entries (G_ACTION_MAP (app),
gcal_app_entries,
@@ -299,6 +311,8 @@ gcal_application_startup (GApplication *app)
/* We're assuming the application is called as a service only by the shell search system */
if ((g_application_get_flags (app) & G_APPLICATION_IS_SERVICE) != 0)
g_application_set_inactivity_timeout (app, 3 * 60 * 1000);
+
+ GCAL_EXIT;
}
static gint
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index f32531a..f649455 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -20,9 +20,10 @@
#define G_LOG_DOMAIN "GcalEditDialog"
+#include "gcal-date-selector.h"
+#include "gcal-debug.h"
#include "gcal-edit-dialog.h"
#include "gcal-time-selector.h"
-#include "gcal-date-selector.h"
#include "gcal-utils.h"
#include <libecal/libecal.h>
@@ -199,6 +200,8 @@ on_calendar_selected (GSimpleAction *action,
GList *aux;
gchar *uid;
+ GCAL_ENTRY;
+
self = GCAL_EDIT_DIALOG (user_data);
list = gcal_manager_get_sources (self->manager);
@@ -232,6 +235,8 @@ on_calendar_selected (GSimpleAction *action,
g_free (uid);
g_list_free (list);
+
+ GCAL_EXIT;
}
static void
@@ -305,13 +310,15 @@ sync_datetimes (GcalEditDialog *self,
gboolean is_start;
gint hour_to_add;
+ GCAL_ENTRY;
+
is_start = (widget == self->start_time_selector || widget == self->start_date_selector);
start = gcal_edit_dialog_get_date_start (self);
end = gcal_edit_dialog_get_date_end (self);
/* The date is valid, no need to update the fields */
if (g_date_time_compare (end, start) >= 0)
- goto out;
+ GCAL_GOTO (out);
/*
* If the user is changing the start date or time, we change the end
@@ -348,6 +355,8 @@ sync_datetimes (GcalEditDialog *self,
out:
g_clear_pointer (&start, g_date_time_unref);
g_clear_pointer (&end, g_date_time_unref);
+
+ GCAL_EXIT;
}
static void
@@ -546,6 +555,8 @@ gcal_edit_dialog_finalize (GObject *object)
{
GcalEditDialog *dialog;
+ GCAL_ENTRY;
+
dialog = GCAL_EDIT_DIALOG (object);
g_clear_object (&dialog->action_group);
@@ -553,6 +564,8 @@ gcal_edit_dialog_finalize (GObject *object)
g_clear_object (&dialog->event);
G_OBJECT_CLASS (gcal_edit_dialog_parent_class)->finalize (object);
+
+ GCAL_EXIT;
}
static void
@@ -603,6 +616,8 @@ gcal_edit_dialog_action_button_clicked (GtkWidget *widget,
{
GcalEditDialog *dialog;
+ GCAL_ENTRY;
+
dialog = GCAL_EDIT_DIALOG (user_data);
if (widget == dialog->cancel_button || (widget == dialog->done_button && !dialog->writable))
@@ -694,7 +709,7 @@ gcal_edit_dialog_action_button_clicked (GtkWidget *widget,
dialog->event_is_new ? GCAL_RESPONSE_CREATE_EVENT : GCAL_RESPONSE_SAVE_EVENT);
}
- gcal_edit_dialog_set_event (dialog, NULL);
+ GCAL_EXIT;
}
static void
@@ -1039,6 +1054,8 @@ void
gcal_edit_dialog_set_event (GcalEditDialog *dialog,
GcalEvent *event)
{
+ GCAL_ENTRY;
+
g_return_if_fail (GCAL_IS_EDIT_DIALOG (dialog));
if (g_set_object (&dialog->event, event))
@@ -1054,7 +1071,7 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
/* If we just set the event to NULL, simply send a property notify */
if (!event)
- goto out;
+ GCAL_GOTO (out);
all_day = gcal_event_get_all_day (event);
source = gcal_event_get_source (event);
@@ -1139,6 +1156,8 @@ out:
dialog->setting_event = FALSE;
}
+
+ GCAL_EXIT;
}
void
diff --git a/src/gcal-log.c b/src/gcal-log.c
index e4fbaff..5d460d3 100644
--- a/src/gcal-log.c
+++ b/src/gcal-log.c
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+#include "gcal-debug.h"
#include "gcal-log.h"
#include <unistd.h>
@@ -37,6 +37,7 @@ log_level_str (GLogLevelFlags log_level)
case G_LOG_LEVEL_MESSAGE: return " \033[1;34mMESSAGE\033[0m";
case G_LOG_LEVEL_INFO: return " \033[1;32mINFO\033[0m";
case G_LOG_LEVEL_DEBUG: return " \033[1;32mDEBUG\033[0m";
+ case GCAL_LOG_LEVEL_TRACE: return " \033[1;36mTRACE\033[0m";
default:
return " UNKNOWN";
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 045e328..f8b74e9 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -19,6 +19,7 @@
#define G_LOG_DOMAIN "GcalManager"
+#include "gcal-debug.h"
#include "gcal-manager.h"
#include "gcal-utils.h"
@@ -300,11 +301,15 @@ static void
source_changed (GcalManager *manager,
ESource *source)
{
+ GCAL_ENTRY;
+
if (g_hash_table_lookup (manager->clients, source) != NULL &&
e_source_has_extension (source, E_SOURCE_EXTENSION_CALENDAR))
{
g_signal_emit (manager, signals[SOURCE_CHANGED], 0, source);
}
+
+ GCAL_EXIT;
}
/**
@@ -320,6 +325,8 @@ static void
load_source (GcalManager *manager,
ESource *source)
{
+ GCAL_ENTRY;
+
if (g_hash_table_lookup (manager->clients, source) == NULL &&
e_source_has_extension (source, E_SOURCE_EXTENSION_CALENDAR))
{
@@ -335,6 +342,8 @@ load_source (GcalManager *manager,
G_STRFUNC,
e_source_get_uid (source));
}
+
+ GCAL_EXIT;
}
static void
@@ -349,6 +358,8 @@ on_client_connected (GObject *source_object,
ESource *source;
GError *error;
+ GCAL_ENTRY;
+
manager = GCAL_MANAGER (user_data);
source = e_client_get_source (E_CLIENT (source_object));
@@ -418,6 +429,8 @@ on_client_connected (GObject *source_object,
g_signal_emit (GCAL_MANAGER (user_data), signals[SOURCE_ADDED], 0, source, unit->enabled);
g_clear_object (&client);
+
+ GCAL_EXIT;
}
static void
@@ -429,12 +442,16 @@ on_client_readonly_changed (EClient *client,
ESource *source;
GcalManagerUnit *unit;
+ GCAL_ENTRY;
+
manager = GCAL_MANAGER (user_data);
source = e_client_get_source (client);
unit = g_hash_table_lookup (manager->clients, source);
if (unit && unit->enabled)
source_changed (manager, source);
+
+ GCAL_EXIT;
}
@@ -443,9 +460,10 @@ on_client_refreshed (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- GError *error;
+ GError *error = NULL;
+
+ GCAL_ENTRY;
- error = NULL;
if (e_client_refresh_finish (E_CLIENT (source_object), result, &error))
{
ESource *source = e_client_get_source (E_CLIENT (source_object));
@@ -457,6 +475,8 @@ on_client_refreshed (GObject *source_object,
/* FIXME: do something when there was some error */
g_warning ("Error synchronizing client");
}
+
+ GCAL_EXIT;
}
static void
@@ -469,6 +489,8 @@ on_event_created (GObject *source_object,
gchar *new_uid;
GError *error;
+ GCAL_ENTRY;
+
data = (AsyncOpsData*) user_data;
client = E_CAL_CLIENT (source_object);
new_uid = NULL;
@@ -488,6 +510,8 @@ on_event_created (GObject *source_object,
g_free (new_uid);
free_async_ops_data (data);
+
+ GCAL_EXIT;
}
/**
@@ -505,9 +529,10 @@ on_event_updated (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- GError *error;
+ GError *error = NULL;
+
+ GCAL_ENTRY;
- error = NULL;
if (! e_cal_client_modify_object_finish (E_CAL_CLIENT (source_object),
result,
&error))
@@ -516,6 +541,8 @@ on_event_updated (GObject *source_object,
g_error_free (error);
}
g_object_unref (E_CAL_COMPONENT (user_data));
+
+ GCAL_EXIT;
}
/**
@@ -536,6 +563,8 @@ on_event_removed (GObject *source_object,
ECalClient *client;
GError *error;
+ GCAL_ENTRY;
+
client = E_CAL_CLIENT (source_object);
error = NULL;
@@ -549,6 +578,8 @@ on_event_removed (GObject *source_object,
}
g_object_unref (user_data);
+
+ GCAL_EXIT;
}
void
@@ -557,6 +588,8 @@ remove_source (GcalManager *manager,
{
GcalManagerUnit *unit;
+ GCAL_ENTRY;
+
g_return_if_fail (GCAL_IS_MANAGER (manager));
g_return_if_fail (E_IS_SOURCE (source));
@@ -571,6 +604,8 @@ remove_source (GcalManager *manager,
g_hash_table_remove (manager->clients, source);
g_signal_emit (manager, signals[SOURCE_REMOVED], 0, source);
+
+ GCAL_EXIT;
}
static void
@@ -582,12 +617,16 @@ model_state_changed (GcalManager *manager,
const GError *error,
ECalDataModel *data_model)
{
- gchar *filter = e_cal_data_model_dup_filter (data_model);
+ gchar *filter;
+
+ GCAL_ENTRY;
+
+ filter = e_cal_data_model_dup_filter (data_model);
if (state == E_CAL_DATA_MODEL_VIEW_STATE_START && g_strcmp0 (manager->search_view_data->query, filter) ==
0)
{
manager->search_view_data->passed_start = TRUE;
- goto out;
+ GCAL_GOTO (out);
}
if (manager->search_view_data->passed_start && state == E_CAL_DATA_MODEL_VIEW_STATE_COMPLETE &&
@@ -600,8 +639,9 @@ model_state_changed (GcalManager *manager,
}
out:
- g_free (filter);
- return;
+ g_free (filter);
+
+ GCAL_EXIT;
}
static void
@@ -625,12 +665,16 @@ source_invoke_authenticate_cb (GObject *source_object,
ESource *source = E_SOURCE (source_object);
GError *error = NULL;
+ GCAL_ENTRY;
+
if (!e_source_invoke_authenticate_finish (source, result, &error) &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
show_source_error (G_STRFUNC, "Failed to invoke authenticate", source, error);
}
g_clear_error (&error);
+
+ GCAL_EXIT;
}
static void
@@ -642,6 +686,8 @@ source_trust_prompt_done_cb (GObject *source_object,
ESource *source = E_SOURCE (source_object);
GError *error = NULL;
+ GCAL_ENTRY;
+
if (!e_trust_prompt_run_for_source_finish (source, result, &response, &error)) {
show_source_error (G_STRFUNC, "Failed to prompt for trust for", source, error);
} else if (response == E_TRUST_PROMPT_RESPONSE_ACCEPT || response ==
E_TRUST_PROMPT_RESPONSE_ACCEPT_TEMPORARILY) {
@@ -650,6 +696,8 @@ source_trust_prompt_done_cb (GObject *source_object,
}
g_clear_error (&error);
+
+ GCAL_EXIT;
}
static void
@@ -663,6 +711,8 @@ source_credentials_required_cb (ESourceRegistry *registry,
{
ECredentialsPrompter *credentials_prompter;
+ GCAL_ENTRY;
+
g_return_if_fail (GCAL_IS_MANAGER (manager));
credentials_prompter = manager->credentials_prompter;
@@ -677,6 +727,8 @@ source_credentials_required_cb (ESourceRegistry *registry,
} else if (reason == E_SOURCE_CREDENTIALS_REASON_ERROR && op_error) {
show_source_error (G_STRFUNC, "Failed to authenticate", source, op_error);
}
+
+ GCAL_EXIT;
}
static void
@@ -692,6 +744,8 @@ source_get_last_credentials_required_arguments_cb (GObject *source_object,
GError *op_error = NULL;
GError *error = NULL;
+ GCAL_ENTRY;
+
g_return_if_fail (E_IS_SOURCE (source_object));
source = E_SOURCE (source_object);
@@ -709,13 +763,15 @@ source_get_last_credentials_required_arguments_cb (GObject *source_object,
return;
}
- g_return_if_fail (GCAL_IS_MANAGER (manager));
+ g_return_if_fail (GCAL_IS_MANAGER (manager));
+
+ if (reason != E_SOURCE_CREDENTIALS_REASON_UNKNOWN)
+ source_credentials_required_cb (NULL, source, reason, certificate_pem, certificate_errors, op_error,
manager);
- if (reason != E_SOURCE_CREDENTIALS_REASON_UNKNOWN)
- source_credentials_required_cb (NULL, source, reason, certificate_pem, certificate_errors, op_error,
manager);
+ g_free (certificate_pem);
+ g_clear_error (&op_error);
- g_free (certificate_pem);
- g_clear_error (&op_error);
+ GCAL_EXIT;
}
static void
@@ -790,6 +846,8 @@ gcal_manager_client_ready_cb (GObject *source,
GcalManager *manager = GCAL_MANAGER (user_data);
GError *error = NULL;
+ GCAL_ENTRY;
+
manager->goa_client = goa_client_new_finish (result, &error);
manager->goa_client_ready = TRUE;
@@ -820,6 +878,8 @@ gcal_manager_constructed (GObject *object)
GError *error = NULL;
ESourceCredentialsProvider *credentials_provider;
+ GCAL_ENTRY;
+
G_OBJECT_CLASS (gcal_manager_parent_class)->constructed (object);
manager = GCAL_MANAGER (object);
@@ -922,6 +982,8 @@ gcal_manager_constructed (GObject *object)
for (l = sources; l != NULL; l = l->next)
load_source (GCAL_MANAGER (object), l->data);
g_list_free (sources);
+
+ GCAL_EXIT;
}
static void
@@ -929,6 +991,8 @@ gcal_manager_finalize (GObject *object)
{
GcalManager *manager =GCAL_MANAGER (object);
+ GCAL_ENTRY;
+
g_clear_object (&manager->settings);
g_clear_object (&manager->goa_client);
g_clear_object (&manager->e_data_model);
@@ -944,6 +1008,8 @@ gcal_manager_finalize (GObject *object)
}
g_hash_table_destroy (manager->clients);
+
+ GCAL_EXIT;
}
static void
@@ -954,6 +1020,8 @@ gcal_manager_set_property (GObject *object,
{
GcalManager *self = GCAL_MANAGER (object);
+ GCAL_ENTRY;
+
switch (property_id)
{
case PROP_DEFAULT_CALENDAR:
@@ -980,6 +1048,8 @@ gcal_manager_set_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
+
+ GCAL_EXIT;
}
static void
@@ -990,6 +1060,8 @@ gcal_manager_get_property (GObject *object,
{
GcalManager *self = GCAL_MANAGER (object);
+ GCAL_ENTRY;
+
switch (property_id)
{
case PROP_DEFAULT_CALENDAR:
@@ -1005,6 +1077,8 @@ gcal_manager_get_property (GObject *object,
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+
+ GCAL_EXIT;
}
/* Public API */
@@ -1054,6 +1128,8 @@ gcal_manager_get_sources (GcalManager *manager)
gpointer key, value;
GList *aux = NULL;
+ GCAL_ENTRY;
+
g_hash_table_iter_init (&iter, manager->clients);
while (g_hash_table_iter_next (&iter, &key, &value))
{
@@ -1062,7 +1138,7 @@ gcal_manager_get_sources (GcalManager *manager)
continue;
aux = g_list_append (aux, key);
}
- return aux;
+ GCAL_RETURN (aux);
}
/**
@@ -1139,6 +1215,8 @@ void
gcal_manager_set_shell_search_query (GcalManager *manager,
const gchar *query)
{
+ GCAL_ENTRY;
+
manager->search_view_data->passed_start = FALSE;
manager->search_view_data->search_done = FALSE;
manager->search_view_data->sources_left = g_hash_table_size (manager->clients) - g_strv_length
(manager->disabled_sources);
@@ -1156,7 +1234,11 @@ gcal_manager_set_shell_search_subscriber (GcalManager *manager,
time_t range_start,
time_t range_end)
{
+ GCAL_ENTRY;
+
e_cal_data_model_subscribe (manager->shell_search_data_model, subscriber, range_start, range_end);
+
+ GCAL_EXIT;
}
gboolean
@@ -1171,10 +1253,13 @@ gcal_manager_get_shell_search_events (GcalManager *manager)
time_t range_start, range_end;
GList *list = NULL;
+ GCAL_ENTRY;
+
e_cal_data_model_get_subscriber_range (manager->shell_search_data_model,
manager->search_view_data->subscriber,
&range_start, &range_end);
e_cal_data_model_foreach_component (manager->shell_search_data_model, range_start, range_end,
gather_events, &list);
- return list;
+
+ GCAL_RETURN (list);
}
void
@@ -1183,9 +1268,13 @@ gcal_manager_set_subscriber (GcalManager *manager,
time_t range_start,
time_t range_end)
{
+ GCAL_ENTRY;
+
e_cal_data_model_subscribe (manager->e_data_model,
subscriber,
range_start, range_end);
+
+ GCAL_EXIT;
}
void
@@ -1194,9 +1283,13 @@ gcal_manager_set_search_subscriber (GcalManager *manager,
time_t range_start,
time_t range_end)
{
+ GCAL_ENTRY;
+
e_cal_data_model_subscribe (manager->search_data_model,
subscriber,
range_start, range_end);
+
+ GCAL_EXIT;
}
/**
@@ -1212,8 +1305,12 @@ void
gcal_manager_set_query (GcalManager *manager,
const gchar *query)
{
+ GCAL_ENTRY;
+
e_cal_data_model_set_filter (manager->search_data_model,
query != NULL ? query : "#t");
+
+ GCAL_EXIT;
}
/**
@@ -1232,14 +1329,16 @@ gcal_manager_query_client_data (GcalManager *manager,
GcalManagerUnit *unit;
gchar *out;
+ GCAL_ENTRY;
+
unit = g_hash_table_lookup (manager->clients, source);
if (unit == NULL)
- return NULL;
+ GCAL_RETURN (NULL);
g_object_get (unit->client, field, &out, NULL);
- return out;
+ GCAL_RETURN (out);
}
/**
@@ -1267,6 +1366,8 @@ gcal_manager_add_source (GcalManager *manager,
ESourceCalendar *extension;
GError *error;
+ GCAL_ENTRY;
+
source = e_source_new (NULL, NULL, NULL);
extension = E_SOURCE_CALENDAR (e_source_get_extension (source,
E_SOURCE_EXTENSION_CALENDAR));
@@ -1289,11 +1390,13 @@ gcal_manager_add_source (GcalManager *manager,
error->message);
g_error_free (error);
g_object_unref (source);
- return NULL;
+
+ GCAL_RETURN (NULL);
}
load_source (manager, source);
- return e_source_dup_uid (source);
+
+ GCAL_RETURN (e_source_dup_uid (source));
}
/**
@@ -1311,10 +1414,16 @@ gcal_manager_enable_source (GcalManager *manager,
gchar **new_disabled_sources;
guint i;
+ GCAL_ENTRY;
+
unit = g_hash_table_lookup (manager->clients, source);
if (unit->enabled)
- return;
+ {
+ g_debug ("Source '%s' already enabled", e_source_get_uid (source));
+ GCAL_EXIT;
+ return;
+ }
unit->enabled = TRUE;
e_cal_data_model_add_client (manager->e_data_model, unit->client);
@@ -1337,6 +1446,8 @@ gcal_manager_enable_source (GcalManager *manager,
/* sync settings value */
g_settings_set_strv (manager->settings, "disabled-sources", (const gchar * const *)
manager->disabled_sources);
+
+ GCAL_EXIT;
}
/**
@@ -1355,10 +1466,16 @@ gcal_manager_disable_source (GcalManager *manager,
guint i;
const gchar *source_uid;
+ GCAL_ENTRY;
+
unit = g_hash_table_lookup (manager->clients, source);
if (!unit->enabled)
- return;
+ {
+ g_debug ("Source '%s' already disabled", e_source_get_uid (source));
+ GCAL_EXIT;
+ return;
+ }
source_uid = e_source_get_uid (source);
unit->enabled = FALSE;
@@ -1381,6 +1498,8 @@ gcal_manager_disable_source (GcalManager *manager,
/* sync settings value */
g_settings_set_strv (manager->settings, "disabled-sources", (const gchar * const *)
manager->disabled_sources);
+
+ GCAL_EXIT;
}
/**
@@ -1398,6 +1517,8 @@ gcal_manager_save_source (GcalManager *manager,
error = NULL;
+ GCAL_ENTRY;
+
e_source_registry_commit_source_sync (manager->source_registry, source, NULL, &error);
if (error != NULL)
@@ -1406,6 +1527,8 @@ gcal_manager_save_source (GcalManager *manager,
g_warning ("Error saving source: %s", error->message);
g_error_free (error);
}
+
+ GCAL_EXIT;
}
gboolean
@@ -1414,10 +1537,14 @@ gcal_manager_source_enabled (GcalManager *manager,
{
GcalManagerUnit *unit;
+ GCAL_ENTRY;
+
unit = g_hash_table_lookup (manager->clients, source);
+
if (unit == NULL)
- return FALSE;
- return unit->enabled;
+ GCAL_RETURN (FALSE);
+
+ GCAL_RETURN (unit->enabled);
}
void
@@ -1426,6 +1553,8 @@ gcal_manager_refresh (GcalManager *manager)
GList *clients;
GList *l;
+ GCAL_ENTRY;
+
clients = g_hash_table_get_values (manager->clients);
/* refresh clients */
@@ -1443,6 +1572,8 @@ gcal_manager_refresh (GcalManager *manager)
}
g_list_free (clients);
+
+ GCAL_EXIT;
}
gboolean
@@ -1451,12 +1582,14 @@ gcal_manager_is_client_writable (GcalManager *manager,
{
GcalManagerUnit *unit;
+ GCAL_ENTRY;
+
unit = g_hash_table_lookup (manager->clients, source);
if (unit == NULL)
- return FALSE;
+ GCAL_RETURN (FALSE);
- return unit->connected && !e_client_is_readonly (E_CLIENT (unit->client));
+ GCAL_RETURN (unit->connected && !e_client_is_readonly (E_CLIENT (unit->client)));
}
void
@@ -1469,6 +1602,8 @@ gcal_manager_create_event (GcalManager *manager,
AsyncOpsData *data;
ESource *source;
+ GCAL_ENTRY;
+
source = gcal_event_get_source (event);
component = gcal_event_get_component (event);
unit = g_hash_table_lookup (manager->clients, source);
@@ -1484,6 +1619,8 @@ gcal_manager_create_event (GcalManager *manager,
manager->async_ops,
on_event_created,
data);
+
+ GCAL_EXIT;
}
void
@@ -1493,6 +1630,8 @@ gcal_manager_update_event (GcalManager *manager,
GcalManagerUnit *unit;
ECalComponent *component;
+ GCAL_ENTRY;
+
unit = g_hash_table_lookup (manager->clients, gcal_event_get_source (event));
component = gcal_event_get_component (event);
@@ -1509,6 +1648,8 @@ gcal_manager_update_event (GcalManager *manager,
NULL,
on_event_updated,
component);
+
+ GCAL_EXIT;
}
void
@@ -1519,6 +1660,8 @@ gcal_manager_remove_event (GcalManager *manager,
ECalComponentId *id;
ECalComponent *component;
+ GCAL_ENTRY;
+
component = gcal_event_get_component (event);
unit = g_hash_table_lookup (manager->clients, gcal_event_get_source (event));
id = e_cal_component_get_id (component);
@@ -1539,6 +1682,8 @@ gcal_manager_remove_event (GcalManager *manager,
component);
e_cal_component_free_id (id);
+
+ GCAL_EXIT;
}
void
@@ -1553,6 +1698,8 @@ gcal_manager_move_event_to_source (GcalManager *manager,
ECalComponentId *id;
GError *error;
+ GCAL_ENTRY;
+
g_return_if_fail (GCAL_IS_MANAGER (manager));
error = NULL;
@@ -1574,6 +1721,7 @@ gcal_manager_move_event_to_source (GcalManager *manager,
{
g_warning ("Error moving source: %s", error->message);
g_clear_error (&error);
+ GCAL_EXIT;
return;
}
@@ -1597,10 +1745,13 @@ gcal_manager_move_event_to_source (GcalManager *manager,
{
g_warning ("Error moving source: %s", error->message);
g_clear_error (&error);
+ GCAL_EXIT;
return;
}
e_cal_component_free_id (id);
+
+ GCAL_EXIT;
}
/**
@@ -1619,11 +1770,14 @@ gcal_manager_get_events (GcalManager *manager,
time_t range_start, range_end;
GList *list = NULL;
+ GCAL_ENTRY;
+
range_start = icaltime_as_timet_with_zone (*start_date, manager->system_timezone);
range_end = icaltime_as_timet_with_zone (*end_date, manager->system_timezone);
e_cal_data_model_foreach_component (manager->e_data_model, range_start, range_end, gather_events, &list);
- return list;
+
+ GCAL_RETURN (list);
}
gboolean
@@ -1640,6 +1794,8 @@ gcal_manager_get_event_from_shell_search (GcalManager *manager,
GList *l, *list;
time_t range_start, range_end;
+ GCAL_ENTRY;
+
list = NULL;
new_event = NULL;
@@ -1662,7 +1818,7 @@ gcal_manager_get_event_from_shell_search (GcalManager *manager,
g_list_free (list);
- return new_event;
+ GCAL_RETURN (new_event);
}
gboolean
@@ -1670,7 +1826,9 @@ gcal_manager_is_goa_client_ready (GcalManager *manager)
{
g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
- return manager->goa_client_ready;
+ GCAL_ENTRY;
+
+ GCAL_RETURN (manager->goa_client_ready);
}
GoaClient*
@@ -1678,5 +1836,7 @@ gcal_manager_get_goa_client (GcalManager *manager)
{
g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
- return manager->goa_client;
+ GCAL_ENTRY;
+
+ GCAL_RETURN (manager->goa_client);
}
diff --git a/src/gcal-search-view.c b/src/gcal-search-view.c
index f5a3caa..8ef05fb 100644
--- a/src/gcal-search-view.c
+++ b/src/gcal-search-view.c
@@ -20,9 +20,9 @@
#define G_LOG_DOMAIN "GcalSearchView"
-#include "gcal-search-view.h"
-
+#include "gcal-debug.h"
#include "gcal-event.h"
+#include "gcal-search-view.h"
#include "gcal-utils.h"
#include <glib/gi18n.h>
@@ -414,10 +414,16 @@ make_row_for_event (GcalSearchView *view,
static void
update_view (GcalSearchView *view)
{
+ GCAL_ENTRY;
+
if (view->no_results_timeout_id != 0)
g_source_remove (view->no_results_timeout_id);
- view->no_results_timeout_id = g_timeout_add (NO_RESULT_TIMEOUT, (GSourceFunc) show_no_results_page, view);
+ view->no_results_timeout_id = g_timeout_add (NO_RESULT_TIMEOUT,
+ (GSourceFunc) show_no_results_page,
+ view);
+
+ GCAL_EXIT;
}
/**
@@ -435,6 +441,8 @@ gcal_search_view_do_search (gpointer user_data)
GcalSearchView *view;
gchar *search_query;
+ GCAL_ENTRY;
+
view = GCAL_SEARCH_VIEW (user_data);
search_query = g_strdup_printf ("(contains? \"%s\" \"%s\")",
@@ -442,31 +450,30 @@ gcal_search_view_do_search (gpointer user_data)
view->query ? view->query : "");
if (!view->subscribed)
- {
- g_autoptr (GDateTime) now, start, end;
-
- now = g_date_time_new_now_local ();
- start = g_date_time_add_years (now, -5);
- end = g_date_time_add_years (now, 5);
+ {
+ g_autoptr (GDateTime) now, start, end;
- gcal_manager_set_search_subscriber (view->manager, E_CAL_DATA_MODEL_SUBSCRIBER (view),
- g_date_time_to_unix (start),
- g_date_time_to_unix (end));
+ now = g_date_time_new_now_local ();
+ start = g_date_time_add_years (now, -5);
+ end = g_date_time_add_years (now, 5);
- /* Mark the view as subscribed */
- view->subscribed = TRUE;
- }
+ gcal_manager_set_search_subscriber (view->manager, E_CAL_DATA_MODEL_SUBSCRIBER (view),
+ g_date_time_to_unix (start),
+ g_date_time_to_unix (end));
- /* update internal current time_t */
- view->current_utc_date = time (NULL);
+ /* Mark the view as subscribed */
+ view->subscribed = TRUE;
+ }
- gcal_manager_set_query (view->manager, search_query);
+ /* update internal current time_t */
+ view->current_utc_date = time (NULL);
- view->search_timeout_id = 0;
- g_free (search_query);
+ gcal_manager_set_query (view->manager, search_query);
+ view->search_timeout_id = 0;
+ g_free (search_query);
- return G_SOURCE_REMOVE;
+ GCAL_RETURN (G_SOURCE_REMOVE);
}
static void
@@ -789,13 +796,14 @@ gcal_search_view_search (GcalSearchView *view,
const gchar *field,
const gchar *query)
{
+ GCAL_ENTRY;
+
g_clear_pointer (&view->query, g_free);
g_clear_pointer (&view->field, g_free);
if (view->search_timeout_id != 0)
g_source_remove (view->search_timeout_id);
-
/* Only perform search on valid non-empty strings */
if (query && g_utf8_strlen (query, -1) >= 3)
{
@@ -810,5 +818,7 @@ gcal_search_view_search (GcalSearchView *view,
}
update_view (view);
+
+ GCAL_EXIT;
}
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 847bd59..49edcf1 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -20,19 +20,19 @@
#define G_LOG_DOMAIN "GcalWindow"
-#include "gcal-window.h"
-
-#include "gcal-manager.h"
-#include "gcal-view.h"
-#include "gcal-week-view.h"
-#include "gcal-month-view.h"
-#include "gcal-year-view.h"
-#include "gcal-search-view.h"
-#include "gcal-event-widget.h"
+#include "gcal-debug.h"
#include "gcal-edit-dialog.h"
#include "gcal-enum-types.h"
+#include "gcal-event-widget.h"
+#include "gcal-manager.h"
+#include "gcal-month-view.h"
#include "gcal-quick-add-popover.h"
+#include "gcal-search-view.h"
#include "gcal-source-dialog.h"
+#include "gcal-view.h"
+#include "gcal-week-view.h"
+#include "gcal-window.h"
+#include "gcal-year-view.h"
#include <glib/gi18n.h>
@@ -369,6 +369,8 @@ update_active_date (GcalWindow *window,
icaltimetype *previous_date;
GDate old_week, new_week;
+ GCAL_ENTRY;
+
previous_date = window->active_date;
window->active_date = new_date;
g_object_notify (G_OBJECT (window), "active-date");
@@ -431,6 +433,8 @@ update_active_date (GcalWindow *window,
update_today_button_sensitive (window);
g_free (previous_date);
+
+ GCAL_EXIT;
}
static gboolean
@@ -438,6 +442,8 @@ update_current_date (GcalWindow *window)
{
guint seconds;
+ GCAL_ENTRY;
+
if (window->current_date == NULL)
window->current_date = g_new0 (icaltimetype, 1);
@@ -450,7 +456,8 @@ update_current_date (GcalWindow *window)
seconds = 24 * 60 * 60 - (icaltime_as_timet (*(window->current_date)) % (24 * 60 * 60));
g_timeout_add_seconds (seconds, (GSourceFunc) update_current_date, window);
- return FALSE;
+
+ GCAL_RETURN (FALSE);
}
static void
@@ -500,6 +507,8 @@ date_updated (GtkButton *button,
gboolean move_back, move_today;
gint factor;
+ GCAL_ENTRY;
+
factor = window->rtl ? - 1 : 1;
move_today = window->today_button == (GtkWidget*) button;
@@ -538,6 +547,8 @@ date_updated (GtkButton *button,
}
update_active_date (user_data, new_date);
+
+ GCAL_EXIT;
}
static void
@@ -576,6 +587,8 @@ load_geometry (GcalWindow *window)
const gint32 *size;
gsize n_elements;
+ GCAL_ENTRY;
+
app = GCAL_APPLICATION (gtk_window_get_application (GTK_WINDOW (window)));
settings = gcal_application_get_settings (app);
@@ -609,6 +622,8 @@ load_geometry (GcalWindow *window)
"window-maximized");
if (maximized)
gtk_window_maximize (GTK_WINDOW (window));
+
+ GCAL_EXIT;
}
static gboolean
@@ -625,6 +640,8 @@ save_geometry (gpointer user_data)
gint32 size[2];
gint32 position[2];
+ GCAL_ENTRY;
+
self = GTK_WINDOW (user_data);
window = GCAL_WINDOW (self);
win = gtk_widget_get_window (GTK_WIDGET (self));
@@ -643,7 +660,7 @@ save_geometry (gpointer user_data)
if (maximized)
{
window->save_geometry_timeout_id = 0;
- return FALSE;
+ GCAL_RETURN (G_SOURCE_REMOVE);
}
/* save window's size */
@@ -672,7 +689,7 @@ save_geometry (gpointer user_data)
window->save_geometry_timeout_id = 0;
- return FALSE;
+ GCAL_RETURN (G_SOURCE_REMOVE);
}
/**
@@ -722,10 +739,12 @@ static void
set_new_event_mode (GcalWindow *window,
gboolean enabled)
{
+ GCAL_ENTRY;
+
window->new_event_mode = enabled;
g_object_notify (G_OBJECT (window), "new-event-mode");
- if (! enabled && window->views[window->active_view] != NULL)
+ if (!enabled && window->views[window->active_view])
gcal_view_clear_marks (GCAL_VIEW (window->views[window->active_view]));
/* XXX: here we could disable clicks from the views, yet */
@@ -734,6 +753,8 @@ set_new_event_mode (GcalWindow *window,
{
gtk_widget_set_visible (window->quick_add_popover, FALSE);
}
+
+ GCAL_EXIT;
}
/* new-event interaction: second variant */
@@ -748,6 +769,8 @@ show_new_event_widget (GcalView *view,
GdkRectangle rect;
gint out_x, out_y;
+ GCAL_ENTRY;
+
/* 1st and 2nd steps */
set_new_event_mode (window, TRUE);
@@ -781,6 +804,8 @@ show_new_event_widget (GcalView *view,
gtk_popover_set_pointing_to (GTK_POPOVER (window->quick_add_popover), &rect);
gtk_widget_show (window->quick_add_popover);
+
+ GCAL_EXIT;
}
static void
@@ -1127,6 +1152,8 @@ edit_dialog_closed (GtkDialog *dialog,
GcalView *view;
GList *widgets;
+ GCAL_ENTRY;
+
window = GCAL_WINDOW (user_data);
edit_dialog = GCAL_EDIT_DIALOG (dialog);
event = gcal_edit_dialog_get_event (edit_dialog);
@@ -1180,6 +1207,8 @@ edit_dialog_closed (GtkDialog *dialog,
}
gcal_edit_dialog_set_event (edit_dialog, NULL);
+
+ GCAL_EXIT;
}
static void
@@ -1491,6 +1520,8 @@ gcal_window_finalize (GObject *object)
{
GcalWindow *window = GCAL_WINDOW (object);
+ GCAL_ENTRY;
+
if (window->save_geometry_timeout_id > 0)
{
g_source_remove (window->save_geometry_timeout_id);
@@ -1524,6 +1555,8 @@ gcal_window_finalize (GObject *object)
g_free (window->current_date);
G_OBJECT_CLASS (gcal_window_parent_class)->finalize (object);
+
+ GCAL_EXIT;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]