[gnome-todo] task-list-view: use an early return to lower indent
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] task-list-view: use an early return to lower indent
- Date: Thu, 1 Dec 2016 02:16:07 +0000 (UTC)
commit 445d4e8adec330e880c13ba93e43d3ea2d3ce43c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Dec 1 00:09:57 2016 -0200
task-list-view: use an early return to lower indent
src/gtd-task-list-view.c | 111 +++++++++++++++++++++++-----------------------
1 files changed, 55 insertions(+), 56 deletions(-)
---
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index 0a7e854..8c5f799 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -1753,77 +1753,76 @@ gtd_task_list_view_set_task_list (GtdTaskListView *view,
GtdTaskList *list)
{
GtdTaskListViewPrivate *priv = view->priv;
+ GdkRGBA *color;
+ gchar *color_str;
+ gchar *parsed_css;
+ GList *task_list;
g_return_if_fail (GTD_IS_TASK_LIST_VIEW (view));
g_return_if_fail (GTD_IS_TASK_LIST (list));
- if (priv->task_list != list)
- {
- GdkRGBA *color;
- gchar *color_str;
- gchar *parsed_css;
- GList *task_list;
-
- /*
- * Disconnect the old GtdTaskList signals.
- */
- if (priv->task_list)
- {
- g_signal_handlers_disconnect_by_func (priv->task_list,
- gtd_task_list_view__task_added,
- view);
- g_signal_handlers_disconnect_by_func (priv->task_list,
- gtd_task_list_view__color_changed,
- view);
- }
+ if (priv->task_list == list)
+ return;
- /* Add the color to provider */
- color = gtd_task_list_get_color (list);
- color_str = gdk_rgba_to_string (color);
+ /*
+ * Disconnect the old GtdTaskList signals.
+ */
+ if (priv->task_list)
+ {
+ g_signal_handlers_disconnect_by_func (priv->task_list,
+ gtd_task_list_view__task_added,
+ view);
+ g_signal_handlers_disconnect_by_func (priv->task_list,
+ gtd_task_list_view__color_changed,
+ view);
+ }
- parsed_css = g_strdup_printf (COLOR_TEMPLATE, color_str);
+ /* Add the color to provider */
+ color = gtd_task_list_get_color (list);
+ color_str = gdk_rgba_to_string (color);
- g_debug ("setting style for provider: %s", parsed_css);
+ parsed_css = g_strdup_printf (COLOR_TEMPLATE, color_str);
- gtk_css_provider_load_from_data (priv->color_provider,
- parsed_css,
- -1,
- NULL);
+ g_debug ("setting style for provider: %s", parsed_css);
- g_free (parsed_css);
- gdk_rgba_free (color);
- g_free (color_str);
+ gtk_css_provider_load_from_data (priv->color_provider,
+ parsed_css,
+ -1,
+ NULL);
- /* Load task */
- priv->task_list = list;
+ g_free (parsed_css);
+ gdk_rgba_free (color);
+ g_free (color_str);
- update_font_color (view);
+ /* Load task */
+ priv->task_list = list;
- /* Add the tasks from the list */
- task_list = gtd_task_list_get_tasks (list);
+ update_font_color (view);
- gtd_task_list_view_set_list (view, task_list);
- gtd_edit_pane_set_task (priv->edit_pane, NULL);
+ /* Add the tasks from the list */
+ task_list = gtd_task_list_get_tasks (list);
- g_list_free (task_list);
+ gtd_task_list_view_set_list (view, task_list);
+ gtd_edit_pane_set_task (priv->edit_pane, NULL);
- g_signal_connect (list,
- "task-added",
- G_CALLBACK (gtd_task_list_view__task_added),
- view);
- g_signal_connect_swapped (list,
- "task-removed",
- G_CALLBACK (gtd_task_list_view__remove_task),
- view);
- g_signal_connect_swapped (list,
- "notify::color",
- G_CALLBACK (gtd_task_list_view__color_changed),
- view);
- g_signal_connect_swapped (list,
- "task-updated",
- G_CALLBACK (gtk_list_box_invalidate_sort),
- priv->listbox);
- }
+ g_list_free (task_list);
+
+ g_signal_connect (list,
+ "task-added",
+ G_CALLBACK (gtd_task_list_view__task_added),
+ view);
+ g_signal_connect_swapped (list,
+ "task-removed",
+ G_CALLBACK (gtd_task_list_view__remove_task),
+ view);
+ g_signal_connect_swapped (list,
+ "notify::color",
+ G_CALLBACK (gtd_task_list_view__color_changed),
+ view);
+ g_signal_connect_swapped (list,
+ "task-updated",
+ G_CALLBACK (gtk_list_box_invalidate_sort),
+ priv->listbox);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]