diff options
Diffstat (limited to 'calendar/modules')
-rw-r--r-- | calendar/modules/e-cal-shell-content.c | 1 | ||||
-rw-r--r-- | calendar/modules/e-memo-shell-content.c | 70 | ||||
-rw-r--r-- | calendar/modules/e-memo-shell-sidebar.c | 4 | ||||
-rw-r--r-- | calendar/modules/e-task-shell-content.c | 68 | ||||
-rw-r--r-- | calendar/modules/e-task-shell-sidebar.c | 4 |
5 files changed, 140 insertions, 7 deletions
diff --git a/calendar/modules/e-cal-shell-content.c b/calendar/modules/e-cal-shell-content.c index 80b989f64d..cc1f1ca879 100644 --- a/calendar/modules/e-cal-shell-content.c +++ b/calendar/modules/e-cal-shell-content.c @@ -21,6 +21,7 @@ #include "e-cal-shell-content.h" +#include <string.h> #include <glib/gi18n.h> #include "e-util/gconf-bridge.h" diff --git a/calendar/modules/e-memo-shell-content.c b/calendar/modules/e-memo-shell-content.c index 82495f836b..006e988c41 100644 --- a/calendar/modules/e-memo-shell-content.c +++ b/calendar/modules/e-memo-shell-content.c @@ -26,6 +26,7 @@ #include "e-util/gconf-bridge.h" #include "calendar/gui/calendar-config.h" +#include "calendar/gui/comp-util.h" #include "calendar/gui/e-cal-model-memos.h" #include "calendar/gui/e-memo-table.h" #include "calendar/gui/e-memo-table-config.h" @@ -91,6 +92,45 @@ memo_shell_content_display_view_cb (EMemoShellContent *memo_shell_content, } static void +memo_shell_content_table_foreach_cb (gint model_row, + gpointer user_data) +{ + ECalModelComponent *comp_data; + icalcomponent *clone; + icalcomponent *vcal; + gchar *string; + + struct { + ECalModel *model; + GSList *list; + } *foreach_data = user_data; + + comp_data = e_cal_model_get_component_at ( + foreach_data->model, model_row); + + vcal = e_cal_util_new_top_level (); + clone = icalcomponent_new_clone (comp_data->icalcomp); + e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp); + icalcomponent_add_component (vcal, clone); + + /* String is owned by libical; do not free. */ + string = icalcomponent_as_ical_string (vcal); + if (string != NULL) { + ESource *source; + const gchar *source_uid; + + source = e_cal_get_source (comp_data->client); + source_uid = e_source_peek_uid (source); + + foreach_data->list = g_slist_prepend ( + foreach_data->list, + g_strdup_printf ("%s\n%s", source_uid, string)); + } + + icalcomponent_free (vcal); +} + +static void memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content, gint row, gint col, @@ -99,7 +139,33 @@ memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content guint info, guint time) { - /* FIXME */ + EMemoTable *memo_table; + ETable *table; + + struct { + ECalModel *model; + GSList *list; + } foreach_data; + + if (info != TARGET_VCALENDAR) + return; + + memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); + table = e_memo_table_get_table (memo_table); + + foreach_data.model = e_memo_table_get_model (memo_table); + foreach_data.list = NULL; + + e_table_selected_row_foreach ( + table, memo_shell_content_table_foreach_cb, + &foreach_data); + + if (foreach_data.list != NULL) { + cal_comp_selection_set_string_list ( + selection_data, foreach_data.list); + g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL); + g_slist_free (foreach_data.list); + } } static void @@ -110,7 +176,7 @@ memo_shell_content_table_drag_data_delete_cb (EMemoShellContent *memo_shell_cont { /* Moved components are deleted from source immediately when moved, * because some of them can be part of destination source, and we - * don't want to delete not-moved tasks. There is no such information + * don't want to delete not-moved memos. There is no such information * which event has been moved and which not, so skip this method. */ } diff --git a/calendar/modules/e-memo-shell-sidebar.c b/calendar/modules/e-memo-shell-sidebar.c index d66f4881b1..d676a9bf58 100644 --- a/calendar/modules/e-memo-shell-sidebar.c +++ b/calendar/modules/e-memo-shell-sidebar.c @@ -29,7 +29,7 @@ #include "e-util/e-util.h" #include "calendar/common/authentication.h" #include "calendar/gui/calendar-config.h" -#include "calendar/gui/e-calendar-selector.h" +#include "calendar/gui/e-memo-list-selector.h" #include "calendar/gui/misc.h" #include "e-memo-shell-view.h" @@ -388,7 +388,7 @@ memo_shell_sidebar_constructed (GObject *object) container = GTK_CONTAINER (widget); - widget = e_calendar_selector_new (source_list); + widget = e_memo_list_selector_new (source_list); e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE); gtk_container_add (container, widget); a11y = gtk_widget_get_accessible (widget); diff --git a/calendar/modules/e-task-shell-content.c b/calendar/modules/e-task-shell-content.c index febd0c9ef2..5e98bf2f49 100644 --- a/calendar/modules/e-task-shell-content.c +++ b/calendar/modules/e-task-shell-content.c @@ -26,6 +26,7 @@ #include "e-util/gconf-bridge.h" #include "calendar/gui/calendar-config.h" +#include "calendar/gui/comp-util.h" #include "calendar/gui/e-cal-model-tasks.h" #include "calendar/gui/e-calendar-table.h" #include "calendar/gui/e-calendar-table-config.h" @@ -92,6 +93,45 @@ task_shell_content_display_view_cb (ETaskShellContent *task_shell_content, } static void +task_shell_content_table_foreach_cb (gint model_row, + gpointer user_data) +{ + ECalModelComponent *comp_data; + icalcomponent *clone; + icalcomponent *vcal; + gchar *string; + + struct { + ECalModel *model; + GSList *list; + } *foreach_data = user_data; + + comp_data = e_cal_model_get_component_at ( + foreach_data->model, model_row); + + vcal = e_cal_util_new_top_level (); + clone = icalcomponent_new_clone (comp_data->icalcomp); + e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp); + icalcomponent_add_component (vcal, clone); + + /* String is owned by libical; do not free. */ + string = icalcomponent_as_ical_string (vcal); + if (string != NULL) { + ESource *source; + const gchar *source_uid; + + source = e_cal_get_source (comp_data->client); + source_uid = e_source_peek_uid (source); + + foreach_data->list = g_slist_prepend ( + foreach_data->list, + g_strdup_printf ("%s\n%s", source_uid, string)); + } + + icalcomponent_free (vcal); +} + +static void task_shell_content_table_drag_data_get_cb (ETaskShellContent *task_shell_content, gint row, gint col, @@ -100,7 +140,33 @@ task_shell_content_table_drag_data_get_cb (ETaskShellContent *task_shell_content guint info, guint time) { - /* FIXME */ + ECalendarTable *task_table; + ETable *table; + + struct { + ECalModel *model; + GSList *list; + } foreach_data; + + if (info != TARGET_VCALENDAR) + return; + + task_table = e_task_shell_content_get_task_table (task_shell_content); + table = e_calendar_table_get_table (task_table); + + foreach_data.model = e_calendar_table_get_model (task_table); + foreach_data.list = NULL; + + e_table_selected_row_foreach ( + table, task_shell_content_table_foreach_cb, + &foreach_data); + + if (foreach_data.list != NULL) { + cal_comp_selection_set_string_list ( + selection_data, foreach_data.list); + g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL); + g_slist_free (foreach_data.list); + } } static void diff --git a/calendar/modules/e-task-shell-sidebar.c b/calendar/modules/e-task-shell-sidebar.c index bce2684515..6f2f1bb409 100644 --- a/calendar/modules/e-task-shell-sidebar.c +++ b/calendar/modules/e-task-shell-sidebar.c @@ -29,7 +29,7 @@ #include "e-util/e-util.h" #include "calendar/common/authentication.h" #include "calendar/gui/calendar-config.h" -#include "calendar/gui/e-calendar-selector.h" +#include "calendar/gui/e-task-list-selector.h" #include "calendar/gui/misc.h" #include "e-task-shell-view.h" @@ -361,7 +361,7 @@ task_shell_sidebar_constructed (GObject *object) container = GTK_CONTAINER (widget); - widget = e_calendar_selector_new (source_list); + widget = e_task_list_selector_new (source_list); e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE); gtk_container_add (container, widget); a11y = gtk_widget_get_accessible (widget); |