diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-11-24 13:14:44 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-11-24 13:14:44 +0800 |
commit | 4f4615a46d5ba518c1e6a0c2412b1edf1e268d99 (patch) | |
tree | 828acaa7b76aa12a490a3238b0ec4a7086b8be16 /calendar/gui/tasks-component.c | |
parent | 076b7c45131482b87d18963d34d035435491ee8d (diff) | |
download | gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.gz gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.zst gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.zip |
Merge revisions 36737:36810 from trunk.
svn path=/branches/kill-bonobo/; revision=36811
Diffstat (limited to 'calendar/gui/tasks-component.c')
-rw-r--r-- | calendar/gui/tasks-component.c | 63 |
1 files changed, 24 insertions, 39 deletions
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index c2ad3a45ef..d2424ed158 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -238,6 +238,16 @@ new_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data) } static void +rename_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + TasksComponentView *component_view = data; + ESourceSelector *selector; + + selector = E_SOURCE_SELECTOR (component_view->source_selector); + e_source_selector_edit_primary_selection (selector); +} + +static void edit_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data) { TasksComponentView *component_view = data; @@ -278,6 +288,7 @@ mark_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) static EPopupItem etc_source_popups[] = { { E_POPUP_ITEM, "10.new", N_("_New Task List"), new_task_list_cb, NULL, "stock_todo", 0, 0 }, { E_POPUP_ITEM, "15.copy", N_("_Copy..."), copy_task_list_cb, NULL, "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY }, + { E_POPUP_ITEM, "18.rename", N_("_Rename..."), rename_task_list_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY }, { E_POPUP_BAR, "20.bar" }, { E_POPUP_ITEM, "20.delete", N_("_Delete"), delete_task_list_cb, NULL, "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY }, @@ -397,43 +408,21 @@ update_objects (ECal *client, icalcomponent *icalcomp) return TRUE; } -static void -selector_tree_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint time, - gpointer user_data) -{ - GtkTreePath *path = NULL; - GtkTreeViewDropPosition pos; - gpointer source = NULL; - GtkTreeModel *model; - GtkTreeIter iter; +static gboolean +selector_tree_data_dropped (ESourceSelector *selector, + GtkSelectionData *data, + ESource *destination, + GdkDragAction action, + guint info, + TasksComponent *component) +{ gboolean success = FALSE; icalcomponent *icalcomp = NULL; ECal *client = NULL; GSList *components, *p; - TasksComponent *component = TASKS_COMPONENT (user_data); - - if (!gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), - x, y, &path, &pos)) - goto finish; - - model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); - - if (!gtk_tree_model_get_iter (model, &iter, path)) - goto finish; - - - gtk_tree_model_get (model, &iter, 0, &source, -1); - - if (E_IS_SOURCE_GROUP (source) || e_source_get_readonly (source) || !data->data) - goto finish; - client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO); + client = auth_new_cal_from_source ( + destination, E_CAL_SOURCE_TYPE_TODO); if (!client || !e_cal_open (client, TRUE, NULL)) goto finish; @@ -459,7 +448,7 @@ selector_tree_drag_data_received (GtkWidget *widget, continue; /* FIXME deal with GDK_ACTION_ASK */ - if (context->action == GDK_ACTION_COPY) { + if (action == GDK_ACTION_COPY) { old_uid = g_strdup (icalcomponent_get_uid (icalcomp)); uid = e_cal_component_gen_uid (); icalcomponent_set_uid (icalcomp, uid); @@ -476,7 +465,7 @@ selector_tree_drag_data_received (GtkWidget *widget, /* this will report success by last item, but we don't care */ success = update_objects (client, icalcomp); - if (success && context->action == GDK_ACTION_MOVE) { + if (success && action == GDK_ACTION_MOVE) { /* remove components rather here, because we know which has been moved */ ESource *source_source; ECal *source_client; @@ -516,12 +505,8 @@ selector_tree_drag_data_received (GtkWidget *widget, finish: if (client) g_object_unref (client); - if (source) - g_object_unref (source); - if (path) - gtk_tree_path_free (path); - gtk_drag_finish (context, success, context->action == GDK_ACTION_MOVE, time); + return success; } static void |