[tasks] If we are just starting up wait for the store to load and then try to edit the task specified



commit f9db1b8d0a6e0c11bf3d75f6bf54e07751b8c1ac
Author: Ross Burton <ross linux intel com>
Date:   Fri Mar 27 17:45:44 2009 +0000

    If we are just starting up wait for the store to load and then try to edit the task specified
---
 src/gtk/main.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/gtk/main.c b/src/gtk/main.c
index c6966ea..c4294d5 100644
--- a/src/gtk/main.c
+++ b/src/gtk/main.c
@@ -498,6 +498,25 @@ static const GtkToggleActionEntry task_toggle_actions[] =
   { "CompleteTask", NULL, N_("_Mark Complete"), "<control>d", NULL, G_CALLBACK (on_complete_task_action), FALSE},
 };
 
+/*
+ * Callback when the store has loaded if we have been asked to edit a task.
+ */
+static void
+edit_loaded (KotoTaskStore *store, gpointer user_data)
+{
+  GtkTreeIter iter;
+  KotoTask *task = NULL;
+  const char *edit_uid = user_data;
+
+  if (koto_task_store_get_iter_for_uid (store, edit_uid, &iter)) {
+    gtk_tree_model_get ((GtkTreeModel*)store, &iter, COLUMN_TASK, &task, -1);
+    edit_task (task);
+    koto_task_unref (task);
+  }
+
+  g_signal_handlers_disconnect_by_func (store, edit_loaded, user_data);
+}
+
 void
 koto_platform_open_url (const char *url)
 {
@@ -768,6 +787,12 @@ main (int argc, char **argv)
                           GTK_TREE_MODEL (filter),
                           _("Tasks (%d)"));
 
+  /* If an edit UID was specified, connect a signal to open a dialog when we
+     find it */
+  if (edit_uid) {
+    g_signal_connect (task_store, "loaded", G_CALLBACK (edit_loaded), edit_uid);
+  }
+
   e_cal_view_start (cal_view);
 
   gtk_widget_show_all (window);



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