[evolution] Bug #700812 - Search in Calendar view is broken



commit ef5795c3fd5186f42f54a2695db8d6c1bd46f489
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 30 17:48:11 2013 +0200

    Bug #700812 - Search in Calendar view is broken

 modules/calendar/e-cal-shell-view-private.c |   10 +++++++-
 modules/calendar/e-cal-shell-view.c         |   29 ++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 8cafe21..f8d455e 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -1458,6 +1458,8 @@ cal_iterate_searching (ECalShellView *cal_shell_view)
                        priv->searching_activity = NULL;
                }
 
+               e_shell_view_update_actions (E_SHELL_VIEW (cal_shell_view));
+
                return;
        }
 
@@ -1564,7 +1566,7 @@ cal_iterate_searching (ECalShellView *cal_shell_view)
        priv->search_time = new_time;
 
        for (link = list; link != NULL; link = g_list_next (link)) {
-               ECalClient *client = E_CAL_CLIENT (link);
+               ECalClient *client = E_CAL_CLIENT (link->data);
 
                e_cal_client_get_object_list (
                        client, sexp, cancellable,
@@ -1573,6 +1575,8 @@ cal_iterate_searching (ECalShellView *cal_shell_view)
 
        g_list_free_full (list, (GDestroyNotify) g_object_unref);
        g_free (sexp);
+
+       e_shell_view_update_actions (E_SHELL_VIEW (cal_shell_view));
 }
 
 void
@@ -1621,8 +1625,10 @@ e_cal_shell_view_search_events (ECalShellView *cal_shell_view,
 
        priv->search_direction = search_forward ? +30 : -30;
 
-       if (cal_searching_check_candidates (cal_shell_view))
+       if (cal_searching_check_candidates (cal_shell_view)) {
+               e_shell_view_update_actions (E_SHELL_VIEW (cal_shell_view));
                return;
+       }
 
        range_years = cal_searching_get_search_range_years (cal_shell_view);
 
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 312f28f..dbcebf9 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -47,6 +47,18 @@ cal_shell_view_finalize (GObject *object)
 }
 
 static void
+cal_shell_view_prepare_for_quit_cb (EShell *shell,
+                                   EActivity *activity,
+                                   ECalShellView *cal_shell_view)
+{
+       g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+
+       /* stop running searches, if any; the activity tight
+          on the search prevents application to quit */
+       e_cal_shell_view_search_stop (cal_shell_view);
+}
+
+static void
 cal_shell_view_add_action_button (GtkBox *box,
                                   GtkAction *action)
 {
@@ -83,6 +95,8 @@ cal_shell_view_add_action_button (GtkBox *box,
 static void
 cal_shell_view_constructed (GObject *object)
 {
+       EShell *shell;
+       EShellView *shell_view;
        EShellContent *shell_content;
        EShellWindow *shell_window;
        EShellSearchbar *searchbar;
@@ -91,10 +105,12 @@ cal_shell_view_constructed (GObject *object)
        /* Chain up to parent's constructed() method. */
        G_OBJECT_CLASS (parent_class)->constructed (object);
 
-       e_cal_shell_view_private_constructed (E_CAL_SHELL_VIEW (object));
+       shell_view = E_SHELL_VIEW (object);
 
-       shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (object));
-       shell_content = e_shell_view_get_shell_content (E_SHELL_VIEW (object));
+       e_cal_shell_view_private_constructed (E_CAL_SHELL_VIEW (shell_view));
+
+       shell_window = e_shell_view_get_shell_window (shell_view);
+       shell_content = e_shell_view_get_shell_content (shell_view);
        searchbar = e_cal_shell_content_get_searchbar (E_CAL_SHELL_CONTENT (shell_content));
 
        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -106,6 +122,13 @@ cal_shell_view_constructed (GObject *object)
        gtk_widget_show_all (box);
 
        gtk_container_add (GTK_CONTAINER (e_shell_searchbar_get_search_box (searchbar)), box);
+
+       shell = e_shell_backend_get_shell (e_shell_view_get_shell_backend (shell_view));
+
+       g_signal_connect (
+               shell, "prepare-for-quit",
+               G_CALLBACK (cal_shell_view_prepare_for_quit_cb),
+               object);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]