aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am42
-rw-r--r--calendar/gui/calendar-component.c320
-rw-r--r--calendar/gui/calendar-component.h3
-rw-r--r--calendar/gui/e-cal-shell-sidebar.c331
-rw-r--r--calendar/gui/e-cal-shell-sidebar.h67
-rw-r--r--calendar/gui/e-cal-shell-view-private.h2
-rw-r--r--calendar/gui/e-cal-shell-view.c1
-rw-r--r--calendar/gui/e-calendar-table.c7
-rw-r--r--calendar/gui/e-calendar-table.h4
-rw-r--r--calendar/gui/e-memo-shell-module.c2
-rw-r--r--calendar/gui/e-memo-shell-sidebar.c264
-rw-r--r--calendar/gui/e-memo-shell-sidebar.h68
-rw-r--r--calendar/gui/e-memo-shell-view-actions.c136
-rw-r--r--calendar/gui/e-memo-shell-view-private.c26
-rw-r--r--calendar/gui/e-memo-shell-view-private.h14
-rw-r--r--calendar/gui/e-memo-shell-view.c1
-rw-r--r--calendar/gui/e-memos.c15
-rw-r--r--calendar/gui/e-memos.h4
-rw-r--r--calendar/gui/e-task-shell-sidebar.c264
-rw-r--r--calendar/gui/e-task-shell-sidebar.h68
-rw-r--r--calendar/gui/e-task-shell-view-private.h2
-rw-r--r--calendar/gui/e-task-shell-view.c1
-rw-r--r--calendar/gui/memos-component.c246
-rw-r--r--calendar/gui/memos-component.h1
-rw-r--r--calendar/gui/memos-control.c353
-rw-r--r--calendar/gui/memos-control.h36
-rw-r--r--calendar/gui/tasks-component.c194
-rw-r--r--calendar/gui/tasks-component.h2
28 files changed, 1272 insertions, 1202 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index d2f092e422..f08b0272c3 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -44,40 +44,54 @@ module_LTLIBRARIES = \
libevolution-tasks.la
libevolution_calendar_la_SOURCES = \
+ calendar-config-keys.h \
calendar-config.c \
calendar-config.h \
- calendar-config-keys.h \
e-cal-shell-module.c \
- e-cal-shell-view.c \
- e-cal-shell-view.h \
+ e-cal-shell-sidebar.c \
+ e-cal-shell-sidebar.h \
e-cal-shell-view-actions.c \
e-cal-shell-view-actions.h \
e-cal-shell-view-private.c \
- e-cal-shell-view-private.h
+ e-cal-shell-view-private.h \
+ e-cal-shell-view.c \
+ e-cal-shell-view.h \
+ e-calendar-selector.c \
+ e-calendar-selector.h
libevolution_memos_la_SOURCES = \
+ calendar-config-keys.h \
calendar-config.c \
calendar-config.h \
- calendar-config-keys.h \
+ e-calendar-selector.c \
+ e-calendar-selector.h \
e-memo-shell-module.c \
- e-memo-shell-view.c \
- e-memo-shell-view.h \
+ e-memo-shell-sidebar.c \
+ e-memo-shell-sidebar.h \
e-memo-shell-view-actions.c \
e-memo-shell-view-actions.h \
e-memo-shell-view-private.c \
- e-memo-shell-view-private.h
+ e-memo-shell-view-private.h \
+ e-memo-shell-view.c \
+ e-memo-shell-view.h \
+ e-memos.c \
+ e-memos.h
libevolution_tasks_la_SOURCES = \
+ calendar-config-keys.h \
calendar-config.c \
calendar-config.h \
- calendar-config-keys.h \
+ e-calendar-selector.c \
+ e-calendar-selector.h \
e-task-shell-module.c \
- e-task-shell-view.c \
- e-task-shell-view.h \
+ e-task-shell-sidebar.c \
+ e-task-shell-sidebar.h \
e-task-shell-view-actions.c \
e-task-shell-view-actions.h \
e-task-shell-view-private.c \
- e-task-shell-view-private.h
+ e-task-shell-view-private.h \
+ e-task-shell-view.c \
+ e-task-shell-view.h
glade_DATA = \
e-itip-control.glade \
@@ -219,8 +233,6 @@ etspec_DATA = \
# main.c \
# memos-component.c \
# memos-component.h \
-# memos-control.c \
-# memos-control.h \
# migration.c \
# migration.h \
# misc.c \
@@ -263,7 +275,6 @@ libevolution_memos_la_LIBADD = \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/filter/libfilter.la \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la \
$(LIBSOUP_LIBS) \
$(CAMEL_LIBS) \
$(EVOLUTION_CALENDAR_LIBS)
@@ -279,7 +290,6 @@ libevolution_tasks_la_LIBADD = \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/filter/libfilter.la \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la \
$(LIBSOUP_LIBS) \
$(CAMEL_LIBS) \
$(EVOLUTION_CALENDAR_LIBS)
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 12a946418c..5f81c81acc 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -62,21 +62,6 @@
#define CREATE_MEETING_ID "meeting"
#define CREATE_ALLDAY_EVENT_ID "allday-event"
#define CREATE_CALENDAR_ID "calendar"
-#define WEB_BASE_URI "webcal://"
-#define CONTACTS_BASE_URI "contacts://"
-#define WEATHER_BASE_URI "weather://"
-#define PERSONAL_RELATIVE_URI "system"
-
-enum DndTargetType {
- DND_TARGET_TYPE_CALENDAR_LIST,
-};
-#define CALENDAR_TYPE "text/calendar"
-#define XCALENDAR_TYPE "text/x-calendar"
-static GtkTargetEntry drag_types[] = {
- { CALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST },
- { XCALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
@@ -522,109 +507,6 @@ source_removed_cb (GnomeCalendar *calendar, ECalSourceType source_type, ESource
}
static void
-set_info (CalendarComponentView *component_view)
-{
- icaltimezone *zone;
- struct icaltimetype start_tt, end_tt;
- time_t start_time, end_time;
- struct tm start_tm, end_tm;
- char buffer[512], end_buffer[256];
- GnomeCalendarViewType view;
-
- gnome_calendar_get_visible_time_range (component_view->calendar, &start_time, &end_time);
- zone = gnome_calendar_get_timezone (component_view->calendar);
-
- start_tt = icaltime_from_timet_with_zone (start_time, FALSE, zone);
- start_tm.tm_year = start_tt.year - 1900;
- start_tm.tm_mon = start_tt.month - 1;
- start_tm.tm_mday = start_tt.day;
- start_tm.tm_hour = start_tt.hour;
- start_tm.tm_min = start_tt.minute;
- start_tm.tm_sec = start_tt.second;
- start_tm.tm_isdst = -1;
- start_tm.tm_wday = time_day_of_week (start_tt.day, start_tt.month - 1,
- start_tt.year);
-
- /* Take one off end_time so we don't get an extra day. */
- end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, zone);
- end_tm.tm_year = end_tt.year - 1900;
- end_tm.tm_mon = end_tt.month - 1;
- end_tm.tm_mday = end_tt.day;
- end_tm.tm_hour = end_tt.hour;
- end_tm.tm_min = end_tt.minute;
- end_tm.tm_sec = end_tt.second;
- end_tm.tm_isdst = -1;
- end_tm.tm_wday = time_day_of_week (end_tt.day, end_tt.month - 1,
- end_tt.year);
-
- view = gnome_calendar_get_view (component_view->calendar);
-
- switch (view) {
- case GNOME_CAL_DAY_VIEW:
- case GNOME_CAL_WORK_WEEK_VIEW:
- case GNOME_CAL_WEEK_VIEW:
- if (start_tm.tm_year == end_tm.tm_year
- && start_tm.tm_mon == end_tm.tm_mon
- && start_tm.tm_mday == end_tm.tm_mday) {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%A %d %b %Y"), &start_tm);
- } else if (start_tm.tm_year == end_tm.tm_year) {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%a %d %b"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%a %d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- } else {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%a %d %b %Y"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%a %d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- }
- break;
- case GNOME_CAL_MONTH_VIEW:
- case GNOME_CAL_LIST_VIEW:
- if (start_tm.tm_year == end_tm.tm_year) {
- if (start_tm.tm_mon == end_tm.tm_mon) {
- e_utf8_strftime (buffer, sizeof (buffer),
- "%d", &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- } else {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%d %b"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- }
- } else {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%d %b %Y"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- }
- break;
- default:
- g_return_if_reached ();
- }
-
- e_info_label_set_info (component_view->info_label, _("Calendars"), buffer);
-}
-
-static void
-calendar_dates_changed_cb (GnomeCalendar *calendar, CalendarComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
config_primary_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
CalendarComponent *calendar_component = data;
@@ -769,88 +651,6 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
}
static gboolean
-selector_tree_drag_drop (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint time,
- CalendarComponent *component)
-{
- GtkTreeViewColumn *column;
- int cell_x;
- int cell_y;
- GtkTreePath *path;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gpointer data;
-
- if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, &path,
- &column, &cell_x, &cell_y))
- return FALSE;
-
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
-
- if (!gtk_tree_model_get_iter (model, &iter, path)) {
- gtk_tree_path_free (path);
- return FALSE;
- }
-
- gtk_tree_model_get (model, &iter, 0, &data, -1);
-
- if (E_IS_SOURCE_GROUP (data)) {
- g_object_unref (data);
- gtk_tree_path_free (path);
- return FALSE;
- }
-
- gtk_tree_path_free (path);
- return TRUE;
-}
-
-static gboolean
-selector_tree_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint time,
- gpointer user_data)
-{
- GtkTreePath *path = NULL;
- gpointer data = NULL;
- GtkTreeViewDropPosition pos;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GdkDragAction action = GDK_ACTION_DEFAULT;
-
- 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, &data, -1);
-
- if (E_IS_SOURCE_GROUP (data) || e_source_get_readonly (data))
- goto finish;
-
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget), path, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
- action = context->suggested_action;
-
- finish:
- if (path)
- gtk_tree_path_free (path);
- if (data)
- g_object_unref (data);
-
- gdk_drag_status (context, action, time);
- return TRUE;
-}
-
-static gboolean
update_single_object (ECal *client, icalcomponent *icalcomp)
{
char *uid;
@@ -905,96 +705,6 @@ update_objects (ECal *client, icalcomponent *icalcomp)
}
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;
- gboolean success = FALSE;
- icalcomponent *icalcomp = NULL;
- ECal *client = NULL;
-
- 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))
- goto finish;
-
- icalcomp = icalparser_parse_string ((char *)data->data);
-
- if (icalcomp) {
- char * uid;
-
- /* FIXME deal with GDK_ACTION_ASK */
- if (context->action == GDK_ACTION_COPY) {
- uid = e_cal_component_gen_uid ();
- icalcomponent_set_uid (icalcomp, uid);
- }
-
- client = auth_new_cal_from_source (source,
- E_CAL_SOURCE_TYPE_EVENT);
-
- if (client) {
- if (e_cal_open (client, TRUE, NULL)) {
- success = TRUE;
- update_objects (client, icalcomp);
- }
-
- g_object_unref (client);
- }
-
- icalcomponent_free (icalcomp);
- }
-
- finish:
- if (source)
- g_object_unref (source);
- if (path)
- gtk_tree_path_free (path);
-
- gtk_drag_finish (context, success, context->action == GDK_ACTION_MOVE, time);
-}
-
-static void
-selector_tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, gpointer data)
-{
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget),
- NULL, GTK_TREE_VIEW_DROP_BEFORE);
-}
-
-static void
-control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
-{
- CalendarComponentView *component_view = data;
-
- if (activate) {
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (component_view->view_control);
-
- e_user_creatable_items_handler_activate (component_view->creatable_items_handler, uic);
- }
-}
-
-
-static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
CalendarComponent *calendar_component = data;
@@ -1189,18 +899,6 @@ create_component_view (CalendarComponent *calendar_component)
a11y = gtk_widget_get_accessible (GTK_WIDGET (component_view->source_selector));
atk_object_set_name (a11y, _("Calendar Source Selector"));
- g_signal_connect (component_view->source_selector, "drag-motion", G_CALLBACK (selector_tree_drag_motion),
- calendar_component);
- g_signal_connect (component_view->source_selector, "drag-leave", G_CALLBACK (selector_tree_drag_leave),
- calendar_component);
- g_signal_connect (component_view->source_selector, "drag-drop", G_CALLBACK (selector_tree_drag_drop),
- calendar_component);
- g_signal_connect (component_view->source_selector, "drag-data-received",
- G_CALLBACK (selector_tree_drag_data_received), calendar_component);
-
- gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
- num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
gtk_widget_show (component_view->source_selector);
selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@@ -1211,10 +909,6 @@ create_component_view (CalendarComponent *calendar_component)
GTK_SHADOW_IN);
gtk_widget_show (selector_scrolled_window);
- component_view->info_label = (EInfoLabel *)e_info_label_new("x-office-calendar");
- e_info_label_set_info (component_view->info_label, _("Calendars"), "");
- gtk_widget_show (GTK_WIDGET (component_view->info_label));
-
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0);
@@ -1265,11 +959,6 @@ create_component_view (CalendarComponent *calendar_component)
component_view->creatable_items_handler = e_user_creatable_items_handler_new ("calendar", create_local_item_cb, calendar_component);
g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view);
- /* We use this to update the component information */
- set_info (component_view);
- g_signal_connect (component_view->calendar, "dates_shown_changed",
- G_CALLBACK (calendar_dates_changed_cb), component_view);
-
/* Load the selection from the last run */
update_selection (component_view);
update_primary_selection (component_view);
@@ -1516,13 +1205,4 @@ calendar_component_init (CalendarComponent *component)
;
}
-
-/* Public API. */
-
-ESourceList *
-calendar_component_peek_source_list (CalendarComponent *component)
-{
- return component->priv->source_list;
-}
-
BONOBO_TYPE_FUNC_FULL (CalendarComponent, GNOME_Evolution_Component, PARENT_TYPE, calendar_component)
diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h
index 8fdb92abbb..1e23bd52c1 100644
--- a/calendar/gui/calendar-component.h
+++ b/calendar/gui/calendar-component.h
@@ -55,7 +55,4 @@ struct _CalendarComponentClass {
GType calendar_component_get_type (void);
-ESourceList *calendar_component_peek_source_list (CalendarComponent *component);
-
-
#endif /* _CALENDAR_COMPONENT_H_ */
diff --git a/calendar/gui/e-cal-shell-sidebar.c b/calendar/gui/e-cal-shell-sidebar.c
new file mode 100644
index 0000000000..5d14f589f0
--- /dev/null
+++ b/calendar/gui/e-cal-shell-sidebar.c
@@ -0,0 +1,331 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-cal-shell-sidebar.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-cal-shell-sidebar.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include <e-util/e-util.h>
+
+#include <gnome-cal.h>
+#include <e-cal-shell-view.h>
+#include <e-calendar-selector.h>
+
+#define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate))
+
+struct _ECalShellSidebarPrivate {
+ GtkWidget *selector;
+};
+
+enum {
+ PROP_0,
+ PROP_SELECTOR
+};
+
+static gpointer parent_class;
+
+static void
+cal_shell_sidebar_update (EShellSidebar *shell_sidebar)
+{
+ EShellView *shell_view;
+ GnomeCalendar *calendar;
+ GnomeCalendarViewType view;
+ time_t start_time, end_time;
+ struct tm start_tm, end_tm;
+ struct icaltimetype start_tt, end_tt;
+ icaltimezone *timezone;
+ gchar buffer[512];
+ gchar end_buffer[512];
+
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ calendar = e_cal_shell_view_get_calendar (
+ E_CAL_SHELL_VIEW (shell_view));
+
+ gnome_calendar_get_visible_time_range (
+ calendar, &start_time, &end_time);
+ timezone = gnome_calendar_get_timezone (calendar);
+ view = gnome_calendar_get_view (calendar);
+
+ start_tt = icaltime_from_timet_with_zone (start_time, FALSE, timezone);
+ start_tm.tm_year = start_tt.year - 1900;
+ start_tm.tm_mon = start_tt.month - 1;
+ start_tm.tm_mday = start_tt.day;
+ start_tm.tm_hour = start_tt.hour;
+ start_tm.tm_min = start_tt.minute;
+ start_tm.tm_sec = start_tt.second;
+ start_tm.tm_isdst = -1;
+ start_tm.tm_wday = time_day_of_week (
+ start_tt.day, start_tt.month - 1, start_tt.year);
+
+ /* Subtract one from end_time so we don't get an extra day. */
+ end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, timezone);
+ end_tm.tm_year = end_tt.year - 1900;
+ end_tm.tm_mon = end_tt.month - 1;
+ end_tm.tm_mday = end_tt.day;
+ end_tm.tm_hour = end_tt.hour;
+ end_tm.tm_min = end_tt.minute;
+ end_tm.tm_sec = end_tt.second;
+ end_tm.tm_isdst = -1;
+ end_tm.tm_wday = time_day_of_week (
+ end_tt.day, end_tt.month - 1, end_tt.year);
+
+ switch (view) {
+ case GNOME_CAL_DAY_VIEW:
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ case GNOME_CAL_WEEK_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year &&
+ start_tm.tm_mon == end_tm.tm_mon &&
+ start_tm.tm_mday == end_tm.tm_mday) {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%A %d %b %Y"), &start_tm);
+ } else if (start_tm.tm_year == end_tm.tm_year) {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%a %d %b"), &start_tm);
+ e_utf8_strftime (
+ end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ } else {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%a %d %b %Y"), &start_tm);
+ e_utf8_strftime (
+ end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+
+ case GNOME_CAL_MONTH_VIEW:
+ case GNOME_CAL_LIST_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year) {
+ if (start_tm.tm_mon == end_tm.tm_mon) {
+ e_utf8_strftime (
+ buffer,
+ sizeof (buffer),
+ "%d", &start_tm);
+ e_utf8_strftime (
+ end_buffer,
+ sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ } else {
+ e_utf8_strftime (
+ buffer,
+ sizeof (buffer),
+ _("%d %b"), &start_tm);
+ e_utf8_strftime (
+ end_buffer,
+ sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ } else {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%d %b %Y"), &start_tm);
+ e_utf8_strftime (
+ end_buffer, sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+
+ e_shell_sidebar_set_secondary_text (shell_sidebar, buffer);
+}
+
+static void
+cal_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTOR:
+ g_value_set_object (
+ value, e_cal_shell_sidebar_get_selector (
+ E_CAL_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+cal_shell_sidebar_dispose (GObject *object)
+{
+ ECalShellSidebarPrivate *priv;
+
+ priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->selector != NULL) {
+ g_object_unref (priv->selector);
+ priv->selector = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+cal_shell_sidebar_constructed (GObject *object)
+{
+ ECalShellSidebarPrivate *priv;
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ ECalShellView *cal_shell_view;
+ ESourceList *source_list;
+ GtkContainer *container;
+ GtkWidget *widget;
+ GnomeCalendar *calendar;
+
+ priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ cal_shell_view = E_CAL_SHELL_VIEW (shell_view);
+ source_list = e_cal_shell_view_get_source_list (cal_shell_view);
+
+ container = GTK_CONTAINER (shell_sidebar);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (container, widget);
+ gtk_widget_show (widget);
+
+ container = GTK_CONTAINER (widget);
+
+ widget = e_calendar_selector_new (source_list);
+ e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
+ gtk_container_add (container, widget);
+ priv->selector = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Setup signal handlers. */
+
+ calendar = e_cal_shell_view_get_calendar (cal_shell_view);
+
+ g_signal_connect_swapped (
+ calendar, "dates-shown-changed",
+ G_CALLBACK (cal_shell_sidebar_update),
+ shell_sidebar);
+
+ cal_shell_sidebar_update (shell_sidebar);
+}
+
+static void
+cal_shell_sidebar_class_init (ECalShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = cal_shell_sidebar_get_property;
+ object_class->dispose = cal_shell_sidebar_dispose;
+ object_class->constructed = cal_shell_sidebar_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTOR,
+ g_param_spec_object (
+ "selector",
+ _("Source Selector Widget"),
+ _("This widget displays groups of calendars"),
+ E_TYPE_SOURCE_SELECTOR,
+ G_PARAM_READABLE));
+}
+
+static void
+cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar)
+{
+ cal_shell_sidebar->priv =
+ E_CAL_SHELL_SIDEBAR_GET_PRIVATE (cal_shell_sidebar);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_cal_shell_sidebar_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ECalShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) cal_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SHELL_SIDEBAR, "ECalShellSidebar",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_cal_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+GtkWidget *
+e_cal_shell_sidebar_get_selector (ECalShellSidebar *cal_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
+
+ return cal_shell_sidebar->priv->selector;
+}
diff --git a/calendar/gui/e-cal-shell-sidebar.h b/calendar/gui/e-cal-shell-sidebar.h
new file mode 100644
index 0000000000..89eaee7613
--- /dev/null
+++ b/calendar/gui/e-cal-shell-sidebar.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-cal-shell-sidebar.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_CAL_SHELL_SIDEBAR_H
+#define E_CAL_SHELL_SIDEBAR_H
+
+#include <e-shell-sidebar.h>
+#include <e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_SHELL_SIDEBAR \
+ (e_cal_shell_sidebar_get_type ())
+#define E_CAL_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebar))
+#define E_CAL_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarClass))
+#define E_IS_CAL_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR))
+#define E_IS_CAL_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_SHELL_SIDEBAR))
+#define E_CAL_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalShellSidebar ECalShellSidebar;
+typedef struct _ECalShellSidebarClass ECalShellSidebarClass;
+typedef struct _ECalShellSidebarPrivate ECalShellSidebarPrivate;
+
+struct _ECalShellSidebar {
+ EShellSidebar parent;
+ ECalShellSidebarPrivate *priv;
+};
+
+struct _ECalShellSidebarClass {
+ EShellSidebarClass parent_class;
+};
+
+GType e_cal_shell_sidebar_get_type (void);
+GtkWidget * e_cal_shell_sidebar_new (EShellView *shell_view);
+GtkWidget * e_cal_shell_sidebar_get_selector(ECalShellSidebar *cal_shell_sidebar);
+
+G_END_DECLS
+
+#endif /* E_CAL_SHELL_SIDEBAR_H */
diff --git a/calendar/gui/e-cal-shell-view-private.h b/calendar/gui/e-cal-shell-view-private.h
index 0b2633d2be..553dc5246c 100644
--- a/calendar/gui/e-cal-shell-view-private.h
+++ b/calendar/gui/e-cal-shell-view-private.h
@@ -27,9 +27,9 @@
#include <e-util/e-util.h>
#include <shell/e-shell-content.h>
-#include <shell/e-shell-sidebar.h>
#include <gnome-cal.h>
+#include <e-cal-shell-sidebar.h>
#include <e-cal-shell-view-actions.h>
#define E_CAL_SHELL_VIEW_GET_PRIVATE(obj) \
diff --git a/calendar/gui/e-cal-shell-view.c b/calendar/gui/e-cal-shell-view.c
index a1e21ab36f..7d7ebd009c 100644
--- a/calendar/gui/e-cal-shell-view.c
+++ b/calendar/gui/e-cal-shell-view.c
@@ -107,6 +107,7 @@ cal_shell_view_class_init (ECalShellView *class,
shell_view_class->icon_name = "evolution-cals";
shell_view_class->type_module = type_module;
shell_view_class->changed = cal_shell_view_changed;
+ shell_view_class->new_shell_sidebar = e_cal_shell_sidebar_new;
g_object_class_install_property (
object_class,
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 71c8cfae1f..9e74ea2c26 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -50,7 +50,6 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-time-utils.h>
-#include "calendar-component.h"
#include "calendar-config.h"
#include "dialogs/delete-comp.h"
#include "dialogs/delete-error.h"
@@ -1858,12 +1857,8 @@ e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *mes
cal_table->activity_id = 0;
}
} else if (cal_table->activity_id == 0) {
- char *client_id = g_strdup_printf ("%p", cal_table);
-
cal_table->activity_id = e_activity_handler_operation_started (
- cal_table->activity_handler, client_id, message, TRUE);
-
- g_free (client_id);
+ cal_table->activity_handler, message, TRUE);
} else {
double progress;
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index 519a540d4a..d2d95fbc73 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <table/e-table-scrolled.h>
#include <misc/e-cell-date-edit.h>
+#include <shell/e-activity-handler.h>
#include "e-cal-model.h"
G_BEGIN_DECLS
@@ -35,9 +36,6 @@ G_BEGIN_DECLS
* Used for calendar events and tasks.
*/
-/* FIXME */
-typedef struct { gint bogus; } EActivityHandler;
-
#define E_CALENDAR_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_table_get_type (), ECalendarTable)
#define E_CALENDAR_TABLE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_table_get_type (), ECalendarTableClass)
#define E_IS_CALENDAR_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_table_get_type ())
diff --git a/calendar/gui/e-memo-shell-module.c b/calendar/gui/e-memo-shell-module.c
index 7629c2d0e3..05781d478f 100644
--- a/calendar/gui/e-memo-shell-module.c
+++ b/calendar/gui/e-memo-shell-module.c
@@ -31,6 +31,7 @@
#include <calendar-config.h>
#include <e-memo-shell-view.h>
+#include <dialogs/calendar-setup.h>
#define MODULE_NAME "memos"
#define MODULE_ALIASES ""
@@ -207,6 +208,7 @@ static void
action_memo_list_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
+ calendar_setup_new_memo_list (NULL);
}
static GtkActionEntry item_entries[] = {
diff --git a/calendar/gui/e-memo-shell-sidebar.c b/calendar/gui/e-memo-shell-sidebar.c
new file mode 100644
index 0000000000..43e61edef9
--- /dev/null
+++ b/calendar/gui/e-memo-shell-sidebar.c
@@ -0,0 +1,264 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-memo-shell-sidebar.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-memo-shell-sidebar.h"
+
+#include <glib/gi18n.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include <e-memos.h>
+#include <e-memo-shell-view.h>
+#include <e-calendar-selector.h>
+
+#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate))
+
+struct _EMemoShellSidebarPrivate {
+ GtkWidget *selector;
+};
+
+enum {
+ PROP_0,
+ PROP_SELECTOR
+};
+
+static gpointer parent_class;
+
+static void
+memo_shell_sidebar_update (EShellSidebar *shell_sidebar)
+{
+ EShellView *shell_view;
+ EMemos *memos;
+ ETable *table;
+ ECalModel *model;
+ EMemoTable *memo_table;
+ GString *string;
+ const gchar *format;
+ gint n_rows;
+ gint n_selected;
+
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ memos = e_memo_shell_view_get_memos (E_MEMO_SHELL_VIEW (shell_view));
+ memo_table = e_memos_get_calendar_table (memos);
+ model = e_memo_table_get_model (memo_table);
+ table = e_memo_table_get_table (memo_table);
+
+ n_rows = e_table_model_get_row_count (model);
+ n_selected = e_table_selected_count (table);
+
+ string = g_string_sized_new (64);
+
+ format = ngettext ("%d memo", "%d memos", n_rows);
+ g_string_append_printf (string, format, n_rows);
+
+ if (n_selected > 0) {
+ format = _("%d selected");
+ g_string_append_len (string, ", ", 2);
+ g_string_append_printf (string, format, n_selected);
+ }
+
+ e_shell_sidebar_set_secondary_text (shell_sidebar, string->str);
+
+ g_string_free (string, TRUE);
+}
+
+static void
+memo_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTOR:
+ g_value_set_object (
+ value, e_memo_shell_sidebar_get_selector (
+ E_MEMO_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_shell_sidebar_dispose (GObject *object)
+{
+ EMemoShellSidebarPrivate *priv;
+
+ priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->selector != NULL) {
+ g_object_unref (priv->selector);
+ priv->selector = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+memo_shell_sidebar_constructed (GObject *object)
+{
+ EMemoShellSidebarPrivate *priv;
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ EMemoShellView *memo_shell_view;
+ ESourceList *source_list;
+ GtkContainer *container;
+ GtkWidget *widget;
+ EMemos *memos;
+ ETable *table;
+ ECalModel *model;
+ EMemoTable *memo_table;
+
+ priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ memo_shell_view = E_MEMO_SHELL_VIEW (shell_view);
+ source_list = e_memo_shell_view_get_source_list (memo_shell_view);
+
+ container = GTK_CONTAINER (shell_sidebar);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (container, widget);
+ gtk_widget_show (widget);
+
+ container = GTK_CONTAINER (widget);
+
+ widget = e_calendar_selector_new (source_list);
+ e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
+ gtk_container_add (container, widget);
+ priv->selector = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Setup signal handlers. */
+
+ memos = e_memo_shell_view_get_memos (memo_shell_view);
+ memo_table = e_memos_get_calendar_table (memos);
+ model = e_memo_table_get_model (memo_table);
+ table = e_memo_table_get_table (memo_table);
+
+ g_signal_connect_swapped (
+ model, "model-changed",
+ G_CALLBACK (memo_shell_sidebar_update),
+ shell_sidebar);
+
+ g_signal_connect_swapped (
+ model, "model-rows-deleted",
+ G_CALLBACK (memo_shell_sidebar_update),
+ shell_sidebar);
+
+ g_signal_connect_swapped (
+ model, "model-rows-inserted",
+ G_CALLBACK (memo_shell_sidebar_update),
+ shell_sidebar);
+
+ g_signal_connect_swapped (
+ model, "selection-change",
+ G_CALLBACK (memo_shell_sidebar_update),
+ shell_sidebar);
+
+ memo_shell_sidebar_update (shell_sidebar);
+}
+
+static void
+memo_shell_sidebar_class_init (EMemoShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = memo_shell_sidebar_get_property;
+ object_class->dispose = memo_shell_sidebar_dispose;
+ object_class->constructed = memo_shell_sidebar_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTOR,
+ g_param_spec_object (
+ "selector",
+ _("Source Selector Widget"),
+ _("This widget displays groups of memo lists"),
+ E_TYPE_SOURCE_SELECTOR,
+ G_PARAM_READABLE));
+}
+
+static void
+memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar)
+{
+ memo_shell_sidebar->priv =
+ E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (memo_shell_sidebar);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_memo_shell_sidebar_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMemoShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SHELL_SIDEBAR, "EMemoShellSidebar",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_memo_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_MEMO_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+GtkWidget *
+e_memo_shell_sidebar_get_selector (EMemoShellSidebar *memo_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar), NULL);
+
+ return memo_shell_sidebar->priv->selector;
+}
diff --git a/calendar/gui/e-memo-shell-sidebar.h b/calendar/gui/e-memo-shell-sidebar.h
new file mode 100644
index 0000000000..ee487b07cb
--- /dev/null
+++ b/calendar/gui/e-memo-shell-sidebar.h
@@ -0,0 +1,68 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-memo-shell-sidebar.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_MEMO_SHELL_SIDEBAR_H
+#define E_MEMO_SHELL_SIDEBAR_H
+
+#include <e-shell-sidebar.h>
+#include <e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_SHELL_SIDEBAR \
+ (e_memo_shell_sidebar_get_type ())
+#define E_MEMO_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebar))
+#define E_MEMO_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarClass))
+#define E_IS_MEMO_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR))
+#define E_IS_MEMO_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_SHELL_SIDEBAR))
+#define E_MEMO_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoShellSidebar EMemoShellSidebar;
+typedef struct _EMemoShellSidebarClass EMemoShellSidebarClass;
+typedef struct _EMemoShellSidebarPrivate EMemoShellSidebarPrivate;
+
+struct _EMemoShellSidebar {
+ EShellSidebar parent;
+ EMemoShellSidebarPrivate *priv;
+};
+
+struct _EMemoShellSidebarClass {
+ EShellSidebarClass parent_class;
+};
+
+GType e_memo_shell_sidebar_get_type (void);
+GtkWidget * e_memo_shell_sidebar_new (EShellView *shell_view);
+GtkWidget * e_memo_shell_sidebar_get_selector
+ (EMemoShellSidebar *memo_shell_sidebar);
+
+G_END_DECLS
+
+#endif /* E_MEMO_SHELL_SIDEBAR_H */
diff --git a/calendar/gui/e-memo-shell-view-actions.c b/calendar/gui/e-memo-shell-view-actions.c
index 0e574cc618..1835cd144f 100644
--- a/calendar/gui/e-memo-shell-view-actions.c
+++ b/calendar/gui/e-memo-shell-view-actions.c
@@ -20,76 +20,150 @@
#include "e-memo-shell-view-private.h"
+#include <e-util/gconf-bridge.h>
+
+#include "print.h"
+
static void
action_memo_clipboard_copy_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemos *memos;
+ EMemoTable *memo_table;
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ memo_table = e_memos_get_calendar_table (memos);
+ e_memo_table_copy_clipboard (memo_table);
}
static void
action_memo_clipboard_cut_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemos *memos;
+ EMemoTable *memo_table;
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ memo_table = e_memos_get_calendar_table (memos);
+ e_memo_table_cut_clipboard (memo_table);
}
static void
action_memo_clipboard_paste_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemos *memos;
+ EMemoTable *memo_table;
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ memo_table = e_memos_get_calendar_table (memos);
+ e_memo_table_paste_clipboard (memo_table);
}
static void
action_memo_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemos *memos;
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ e_memos_delete_selected (memos);
}
static void
action_memo_list_copy_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ /* FIXME */
}
static void
action_memo_list_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ /* FIXME */
}
static void
action_memo_list_new_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
}
static void
action_memo_list_properties_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESource *source;
+ ESourceSelector *selector;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ selector = E_SOURCE_SELECTOR (memo_shell_view->priv->selector);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (source != NULL);
+
+ calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
}
static void
action_memo_open_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemos *memos;
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ e_memos_open_memo (memos);
}
static void
action_memo_preview_cb (GtkToggleAction *action,
EMemoShellView *memo_shell_view)
{
+ /* FIXME */
}
static void
action_memo_print_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemos *memos;
+ ETable *table;
+ EMemoTable *memo_table;
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ memo_table = e_memos_get_calendar_table (memos);
+ table = e_memo_table_get_table (memo_table);
+
+ print_table (
+ table, _("Print Memos"), _("Memos"),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
}
static void
action_memo_print_preview_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemos *memos;
+ ETable *table;
+ EMemoTable *memo_table;
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ memo_table = e_memos_get_calendar_table (memos);
+ table = e_memo_table_get_table (memo_table);
+
+ print_table (
+ table, _("Print Memos"), _("Memos"),
+ GTK_PRINT_OPERATION_ACTION_PREVIEW);
}
static GtkActionEntry memo_entries[] = {
@@ -190,7 +264,10 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
EShellWindow *shell_window;
GtkActionGroup *action_group;
GtkUIManager *manager;
+ GConfBridge *bridge;
+ GObject *object;
const gchar *domain;
+ const gchar *key;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -208,4 +285,63 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
action_group, memo_toggle_entries,
G_N_ELEMENTS (memo_toggle_entries), memo_shell_view);
gtk_ui_manager_insert_action_group (manager, action_group, 0);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (ACTION (MEMO_PREVIEW));
+ key = "/apps/evolution/calendar/display/show_memo_preview";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+}
+
+void
+e_memo_shell_view_actions_update (EMemoShellView *memo_shell_view)
+{
+ ECal *cal;
+ EMemos *memos;
+ ETable *table;
+ ECalModel *model;
+ EMemoTable *memo_table;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkAction *action;
+ gboolean read_only = TRUE;
+ gboolean sensitive;
+ gint n_selected;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ memos = E_MEMOS (memo_shell_view->priv->memos);
+ memo_table = e_memos_get_calendar_table (memos);
+
+ model = e_memo_table_get_model (memo_table);
+ cal = e_cal_model_get_default_client (model);
+
+ table = e_memo_table_get_table (memo_table);
+ n_selected = e_table_selected_count (table);
+
+ if (cal != NULL)
+ e_cal_is_read_only (cal, &read_only, NULL);
+
+ action = ACTION (MEMO_OPEN);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_CLIPBOARD_COPY);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_CLIPBOARD_CUT);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_CLIPBOARD_PASTE);
+ sensitive = !read_only;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_DELETE);
+ sensitive = (n_selected > 0) && !read_only;
+ gtk_action_set_sensitive (action, sensitive);
}
diff --git a/calendar/gui/e-memo-shell-view-private.c b/calendar/gui/e-memo-shell-view-private.c
index bc38ee4a3e..36defa31af 100644
--- a/calendar/gui/e-memo-shell-view-private.c
+++ b/calendar/gui/e-memo-shell-view-private.c
@@ -34,12 +34,34 @@ e_memo_shell_view_private_init (EMemoShellView *memo_shell_view,
priv->source_list = g_object_ref (source_list);
priv->memo_actions = gtk_action_group_new ("memos");
+ priv->activity_handler = e_activity_handler_new ();
}
void
e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
{
EMemoShellViewPrivate *priv = memo_shell_view->priv;
+ EShellContent *shell_content;
+ EShellTaskbar *shell_taskbar;
+ EShellView *shell_view;
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+
+ /* Construct view widgets. */
+
+ widget = e_memos_new ();
+ shell_content = e_shell_view_get_content (shell_view);
+ gtk_container_add (GTK_CONTAINER (shell_content), widget);
+ priv->memos = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ shell_taskbar = e_shell_view_get_taskbar (shell_view);
+ e_activity_handler_attach_task_bar (
+ priv->activity_handler, shell_taskbar);
+
+ e_memo_shell_view_actions_update (memo_shell_view);
}
void
@@ -50,6 +72,10 @@ e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view)
DISPOSE (priv->source_list);
DISPOSE (priv->memo_actions);
+
+ DISPOSE (priv->memos);
+
+ DISPOSE (priv->activity_handler);
}
void
diff --git a/calendar/gui/e-memo-shell-view-private.h b/calendar/gui/e-memo-shell-view-private.h
index 1940dc0927..c53e55c487 100644
--- a/calendar/gui/e-memo-shell-view-private.h
+++ b/calendar/gui/e-memo-shell-view-private.h
@@ -27,9 +27,13 @@
#include <e-util/e-util.h>
#include <shell/e-shell-content.h>
-#include <shell/e-shell-sidebar.h>
+#include <shell/e-activity-handler.h>
+#include <e-memos.h>
+#include <e-calendar-selector.h>
+#include <e-memo-shell-sidebar.h>
#include <e-memo-shell-view-actions.h>
+#include <dialogs/calendar-setup.h>
#define E_MEMO_SHELL_VIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -58,6 +62,12 @@ struct _EMemoShellViewPrivate {
/*** UI Management ***/
GtkActionGroup *memo_actions;
+
+ /*** Other Stuff ***/
+
+ GtkWidget *memos;
+
+ EActivityHandler *activity_handler;
};
void e_memo_shell_view_private_init
@@ -74,6 +84,8 @@ void e_memo_shell_view_private_finalize
void e_memo_shell_view_actions_init
(EMemoShellView *memo_shell_view);
+void e_memo_shell_view_actions_update
+ (EMemoShellView *memo_shell_view);
G_END_DECLS
diff --git a/calendar/gui/e-memo-shell-view.c b/calendar/gui/e-memo-shell-view.c
index 6b9032bb17..2f083ea23e 100644
--- a/calendar/gui/e-memo-shell-view.c
+++ b/calendar/gui/e-memo-shell-view.c
@@ -107,6 +107,7 @@ memo_shell_view_class_init (EMemoShellView *class,
shell_view_class->icon_name = "evolution-memos";
shell_view_class->type_module = type_module;
shell_view_class->changed = memo_shell_view_changed;
+ shell_view_class->new_shell_sidebar = e_memo_shell_sidebar_new;
g_object_class_install_property (
object_class,
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index a8c5b41b2b..cc033942b4 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -38,20 +38,16 @@
#include "e-util/e-error.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-util-private.h"
-#include "shell/e-user-creatable-items-handler.h"
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-categories.h>
#include "widgets/menus/gal-view-menus.h"
#include "dialogs/delete-error.h"
-#include "e-calendar-marshal.h"
#include "calendar-config.h"
#include "cal-search-bar.h"
-#include "calendar-component.h"
#include "comp-util.h"
#include "e-memo-table-config.h"
#include "misc.h"
-#include "memos-component.h"
#include "e-cal-component-memo-preview.h"
#include "e-memos.h"
#include "common/authentication.h"
@@ -653,17 +649,6 @@ e_memos_new (void)
}
-void
-e_memos_set_ui_component (EMemos *memos,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (E_IS_MEMOS (memos));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (memos->priv->search_bar), ui_component);
-}
-
-
static void
e_memos_destroy (GtkObject *object)
{
diff --git a/calendar/gui/e-memos.h b/calendar/gui/e-memos.h
index c4a4e96154..9f196ded22 100644
--- a/calendar/gui/e-memos.h
+++ b/calendar/gui/e-memos.h
@@ -25,7 +25,6 @@
#ifndef _E_MEMOS_H_
#define _E_MEMOS_H_
-#include <bonobo/bonobo-ui-component.h>
#include <gtk/gtk.h>
#include <libedataserver/e-source.h>
#include <libecal/e-cal.h>
@@ -64,9 +63,6 @@ GtkWidget *e_memos_construct (EMemos *memos);
GtkWidget *e_memos_new (void);
-void e_memos_set_ui_component (EMemos *memos,
- BonoboUIComponent *ui_component);
-
gboolean e_memos_add_memo_source (EMemos *memos, ESource *source);
gboolean e_memos_remove_memo_source (EMemos *memos, ESource *source);
gboolean e_memos_set_default_source (EMemos *memos, ESource *source);
diff --git a/calendar/gui/e-task-shell-sidebar.c b/calendar/gui/e-task-shell-sidebar.c
new file mode 100644
index 0000000000..0b0668df86
--- /dev/null
+++ b/calendar/gui/e-task-shell-sidebar.c
@@ -0,0 +1,264 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-task-shell-sidebar.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-task-shell-sidebar.h"
+
+#include <glib/gi18n.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include <e-tasks.h>
+#include <e-task-shell-view.h>
+#include <e-calendar-selector.h>
+
+#define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate))
+
+struct _ETaskShellSidebarPrivate {
+ GtkWidget *selector;
+};
+
+enum {
+ PROP_0,
+ PROP_SELECTOR
+};
+
+static gpointer parent_class;
+
+static void
+task_shell_sidebar_update (EShellSidebar *shell_sidebar)
+{
+ EShellView *shell_view;
+ ETasks *tasks;
+ ETable *table;
+ ECalModel *model;
+ ECalendarTable *cal_table;
+ GString *string;
+ const gchar *format;
+ gint n_rows;
+ gint n_selected;
+
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ tasks = e_task_shell_view_get_tasks (E_TASK_SHELL_VIEW (shell_view));
+ cal_table = e_tasks_get_calendar_table (tasks);
+ model = e_calendar_table_get_model (cal_table);
+ table = e_calendar_table_get_table (cal_table);
+
+ n_rows = e_table_model_get_row_count (model);
+ n_selected = e_table_selected_count (table);
+
+ string = g_string_sized_new (64);
+
+ format = ngettext ("%d task", "%d tasks", n_rows);
+ g_string_append_printf (string, format, n_rows);
+
+ if (n_selected > 0) {
+ format = _("%d selected");
+ g_string_append_len (string, ", ", 2);
+ g_string_append_printf (string, format, n_selected);
+ }
+
+ e_shell_sidebar_set_secondary_text (shell_sidebar, string->str);
+
+ g_string_free (string, TRUE);
+}
+
+static void
+task_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTOR:
+ g_value_set_object (
+ value, e_task_shell_sidebar_get_selector (
+ E_TASK_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_sidebar_dispose (GObject *object)
+{
+ ETaskShellSidebarPrivate *priv;
+
+ priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->selector != NULL) {
+ g_object_unref (priv->selector);
+ priv->selector = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+task_shell_sidebar_constructed (GObject *object)
+{
+ ETaskShellSidebarPrivate *priv;
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ ETaskShellView *task_shell_view;
+ ESourceList *source_list;
+ GtkContainer *container;
+ GtkWidget *widget;
+ ETasks *tasks;
+ ETable *table;
+ ECalModel *model;
+ ECalendarTable *cal_table;
+
+ priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ task_shell_view = E_TASK_SHELL_VIEW (shell_view);
+ source_list = e_task_shell_view_get_source_list (task_shell_view);
+
+ container = GTK_CONTAINER (shell_sidebar);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (container, widget);
+ gtk_widget_show (widget);
+
+ container = GTK_CONTAINER (widget);
+
+ widget = e_calendar_selector_new (source_list);
+ e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
+ gtk_container_add (container, widget);
+ priv->selector = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Setup signal handlers. */
+
+ tasks = e_task_shell_view_get_tasks (task_shell_view);
+ cal_table = e_tasks_get_calendar_table (tasks);
+ model = e_calendar_table_get_model (cal_table);
+ table = e_calendar_table_get_table (cal_table);
+
+ g_signal_connect_swapped (
+ model, "model-changed",
+ G_CALLBACK (task_shell_sidebar_update),
+ shell_sidebar);
+
+ g_signal_connect_swapped (
+ model, "model-rows-deleted",
+ G_CALLBACK (task_shell_sidebar_update),
+ shell_sidebar);
+
+ g_signal_connect_swapped (
+ model, "model-rows-inserted",
+ G_CALLBACK (task_shell_sidebar_update),
+ shell_sidebar);
+
+ g_signal_connect_swapped (
+ model, "selection-change",
+ G_CALLBACK (task_shell_sidebar_update),
+ shell_sidebar);
+
+ task_shell_sidebar_update (shell_sidebar);
+}
+
+static void
+task_shell_sidebar_class_init (ETaskShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETaskShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = task_shell_sidebar_get_property;
+ object_class->dispose = task_shell_sidebar_dispose;
+ object_class->constructed = task_shell_sidebar_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTOR,
+ g_param_spec_object (
+ "selector",
+ _("Source Selector Widget"),
+ _("This widget displays groups of task lists"),
+ E_TYPE_SOURCE_SELECTOR,
+ G_PARAM_READABLE));
+}
+
+static void
+task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar)
+{
+ task_shell_sidebar->priv =
+ E_TASK_SHELL_SIDEBAR_GET_PRIVATE (task_shell_sidebar);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_task_shell_sidebar_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ETaskShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) task_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETaskShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) task_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SHELL_SIDEBAR, "ETaskShellSidebar",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_task_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_TASK_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+GtkWidget *
+e_task_shell_sidebar_get_selector (ETaskShellSidebar *task_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar), NULL);
+
+ return task_shell_sidebar->priv->selector;
+}
diff --git a/calendar/gui/e-task-shell-sidebar.h b/calendar/gui/e-task-shell-sidebar.h
new file mode 100644
index 0000000000..c50fde5d3c
--- /dev/null
+++ b/calendar/gui/e-task-shell-sidebar.h
@@ -0,0 +1,68 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-task-shell-sidebar.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_TASK_SHELL_SIDEBAR_H
+#define E_TASK_SHELL_SIDEBAR_H
+
+#include <e-shell-sidebar.h>
+#include <e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TASK_SHELL_SIDEBAR \
+ (e_task_shell_sidebar_get_type ())
+#define E_TASK_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebar))
+#define E_TASK_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarClass))
+#define E_IS_TASK_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR))
+#define E_IS_TASK_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TASK_SHELL_SIDEBAR))
+#define E_TASK_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETaskShellSidebar ETaskShellSidebar;
+typedef struct _ETaskShellSidebarClass ETaskShellSidebarClass;
+typedef struct _ETaskShellSidebarPrivate ETaskShellSidebarPrivate;
+
+struct _ETaskShellSidebar {
+ EShellSidebar parent;
+ ETaskShellSidebarPrivate *priv;
+};
+
+struct _ETaskShellSidebarClass {
+ EShellSidebarClass parent_class;
+};
+
+GType e_task_shell_sidebar_get_type (void);
+GtkWidget * e_task_shell_sidebar_new (EShellView *shell_view);
+GtkWidget * e_task_shell_sidebar_get_selector
+ (ETaskShellSidebar *task_shell_sidebar);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_SIDEBAR_H */
diff --git a/calendar/gui/e-task-shell-view-private.h b/calendar/gui/e-task-shell-view-private.h
index 22db8668c0..0c7f90c3be 100644
--- a/calendar/gui/e-task-shell-view-private.h
+++ b/calendar/gui/e-task-shell-view-private.h
@@ -27,8 +27,8 @@
#include <e-util/e-util.h>
#include <shell/e-shell-content.h>
-#include <shell/e-shell-sidebar.h>
+#include <e-task-shell-sidebar.h>
#include <e-task-shell-view-actions.h>
#define E_TASK_SHELL_VIEW_GET_PRIVATE(obj) \
diff --git a/calendar/gui/e-task-shell-view.c b/calendar/gui/e-task-shell-view.c
index 798d868910..6be8b48a4c 100644
--- a/calendar/gui/e-task-shell-view.c
+++ b/calendar/gui/e-task-shell-view.c
@@ -107,6 +107,7 @@ task_shell_view_class_init (ETaskShellView *class,
shell_view_class->icon_name = "evolution-tasks";
shell_view_class->type_module = type_module;
shell_view_class->changed = task_shell_view_changed;
+ shell_view_class->new_shell_sidebar = e_task_shell_sidebar_new;
g_object_class_install_property (
object_class,
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index 93af51f061..4927dde9db 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -58,20 +58,9 @@
#define CREATE_SHARED_MEMO_ID "shared-memo"
#define CREATE_MEMO_LIST_ID "memo-list"
-enum DndTargetType {
- DND_TARGET_TYPE_CALENDAR_LIST,
-};
-#define CALENDAR_TYPE "text/calendar"
-#define XCALENDAR_TYPE "text/x-calendar"
#define WEB_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
-static GtkTargetEntry drag_types[] = {
- { CALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST },
- { XCALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
@@ -317,25 +306,6 @@ delete_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
}
}
-static void
-new_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- calendar_setup_new_memo_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)));
-}
-
-static void
-edit_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- MemosComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- calendar_setup_edit_memo_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source);
-}
-
static EPopupItem emc_source_popups[] = {
{ E_POPUP_ITEM, "10.new", N_("_New Memo List"), new_memo_list_cb, NULL, "stock_notes", 0, 0 },
{ E_POPUP_ITEM, "15.copy", N_("_Copy..."), copy_memo_list_cb, NULL, "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY },
@@ -408,48 +378,6 @@ source_removed_cb (EMemos *memos, ESource *source, MemosComponentView *component
e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
}
-static void
-set_info (MemosComponentView *component_view)
-{
- GString *message = g_string_new (NULL);
- int rows, selected_rows;
-
- rows = e_table_model_row_count (component_view->model);
- selected_rows = e_table_selected_count (component_view->table);
-
- g_string_append_printf(message, ngettext("%d memo", "%d memos", rows), rows);
- if (selected_rows > 0)
- g_string_append_printf(message, ngettext(", %d selected", ", %d selected", selected_rows), selected_rows);
-
- e_info_label_set_info (component_view->info_label, _("Memos"), message->str);
-
- g_string_free (message, TRUE);
-}
-
-static void
-table_selection_change_cb (ETableModel *etm, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_changed_cb (ETableModel *etm, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_inserted_cb (ETableModel *etm, int row, int count, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_deleted_cb (ETableModel *etm, int row, int count, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
/* Evolution::Component CORBA methods */
static void
@@ -476,90 +404,6 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
}
static gboolean
-selector_tree_drag_drop (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint time,
- CalendarComponent *component)
-{
- GtkTreeViewColumn *column;
- int cell_x;
- int cell_y;
- GtkTreePath *path;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gpointer data;
-
- if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, &path,
- &column, &cell_x, &cell_y))
- return FALSE;
-
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
-
- if (!gtk_tree_model_get_iter (model, &iter, path)) {
- gtk_tree_path_free (path);
- return FALSE;
- }
-
- gtk_tree_model_get (model, &iter, 0, &data, -1);
-
- if (E_IS_SOURCE_GROUP (data)) {
- g_object_unref (data);
- gtk_tree_path_free (path);
- return FALSE;
- }
-
- gtk_tree_path_free (path);
- return TRUE;
-}
-
-static gboolean
-selector_tree_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint time,
- gpointer user_data)
-{
- GtkTreePath *path = NULL;
- gpointer data = NULL;
- GtkTreeViewDropPosition pos;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GdkDragAction action = GDK_ACTION_DEFAULT;
-
- 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, &data, -1);
-
- if (E_IS_SOURCE_GROUP (data) || e_source_get_readonly (data))
- goto finish;
-
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget), path, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
- action = context->suggested_action;
- if (action == GDK_ACTION_COPY && (context->actions & GDK_ACTION_MOVE))
- action=GDK_ACTION_MOVE;
-
- finish:
- if (path)
- gtk_tree_path_free (path);
- if (data)
- g_object_unref (data);
-
- gdk_drag_status (context, action, time);
- return TRUE;
-}
-
-static gboolean
update_single_object (ECal *client, icalcomponent *icalcomp, gboolean fail_on_modify)
{
char *uid;
@@ -748,27 +592,6 @@ selector_tree_drag_data_received (GtkWidget *widget,
}
static void
-selector_tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, gpointer data)
-{
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget),
- NULL, GTK_TREE_VIEW_DROP_BEFORE);
-}
-
-
-static void
-control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
-{
- MemosComponentView *component_view = data;
-
- if (activate) {
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (component_view->view_control);
-
- e_user_creatable_items_handler_activate (component_view->creatable_items_handler, uic);
- }
-}
-
-static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
MemosComponent *component = data;
@@ -942,48 +765,10 @@ create_component_view (MemosComponent *memos_component)
/* Create the calendar component view */
component_view = g_new0 (MemosComponentView, 1);
- /* Add the source lists */
- component_view->source_list = g_object_ref (priv->source_list);
-
/* Create sidebar selector */
- component_view->source_selector = e_source_selector_new (memos_component->priv->source_list);
- e_source_selector_set_select_new ((ESourceSelector *)component_view->source_selector, TRUE);
- a11y = gtk_widget_get_accessible (GTK_WIDGET (component_view->source_selector));
- atk_object_set_name (a11y, _("Memo Source Selector"));
-
- g_signal_connect (component_view->source_selector, "drag-motion", G_CALLBACK (selector_tree_drag_motion),
- memos_component);
- g_signal_connect (component_view->source_selector, "drag-leave", G_CALLBACK (selector_tree_drag_leave),
- memos_component);
- g_signal_connect (component_view->source_selector, "drag-drop", G_CALLBACK (selector_tree_drag_drop),
- memos_component);
g_signal_connect (component_view->source_selector, "drag-data-received",
G_CALLBACK (selector_tree_drag_data_received), memos_component);
- gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
- num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- gtk_widget_show (component_view->source_selector);
-
- selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (selector_scrolled_window), component_view->source_selector);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_SHADOW_IN);
- gtk_widget_show (selector_scrolled_window);
-
- component_view->info_label = (EInfoLabel *)e_info_label_new("evolution-memos");
- e_info_label_set_info(component_view->info_label, _("Memos"), "");
- gtk_widget_show (GTK_WIDGET (component_view->info_label));
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- component_view->sidebar_control = bonobo_control_new (vbox);
-
/* Create main view */
component_view->view_control = memos_control_new ();
if (!component_view->view_control) {
@@ -1002,14 +787,6 @@ create_component_view (MemosComponent *memos_component)
g_signal_connect (component_view->memos, "source_removed",
G_CALLBACK (source_removed_cb), component_view);
- /* Create status bar */
- statusbar_widget = e_task_bar_new ();
- component_view->activity_handler = e_activity_handler_new ();
- e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget));
- gtk_widget_show (statusbar_widget);
-
- component_view->statusbar_control = bonobo_control_new (statusbar_widget);
-
e_memo_table_set_activity_handler (e_memos_get_calendar_table (component_view->memos), component_view->activity_handler);
/* connect after setting the initial selections, or we'll get unwanted calls
@@ -1021,21 +798,6 @@ create_component_view (MemosComponent *memos_component)
g_signal_connect (component_view->source_selector, "popup_event",
G_CALLBACK (popup_event_cb), component_view);
- /* Set up the "new" item handler */
- component_view->creatable_items_handler = e_user_creatable_items_handler_new ("memos", create_local_item_cb, memos_component);
- g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view);
-
- /* We use this to update the component information */
- set_info (component_view);
- g_signal_connect (component_view->table, "selection_change",
- G_CALLBACK (table_selection_change_cb), component_view);
- g_signal_connect (component_view->model, "model_changed",
- G_CALLBACK (model_changed_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_inserted",
- G_CALLBACK (model_rows_inserted_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_deleted",
- G_CALLBACK (model_rows_deleted_cb), component_view);
-
/* Load the selection from the last run */
update_selection (component_view);
update_primary_selection (component_view);
@@ -1226,12 +988,4 @@ memos_component_init (MemosComponent *component, MemosComponentClass *klass)
component->priv = priv;
}
-/* Public API */
-
-ESourceList *
-memos_component_peek_source_list (MemosComponent *component)
-{
- return component->priv->source_list;
-}
-
BONOBO_TYPE_FUNC_FULL (MemosComponent, GNOME_Evolution_Component, PARENT_TYPE, memos_component)
diff --git a/calendar/gui/memos-component.h b/calendar/gui/memos-component.h
index 399f0ce06a..4841ef4c3e 100644
--- a/calendar/gui/memos-component.h
+++ b/calendar/gui/memos-component.h
@@ -56,6 +56,5 @@ struct _MemosComponentClass {
GType memos_component_get_type (void);
MemosComponent *memos_component_peek (void);
-ESourceList *memos_component_peek_source_list (MemosComponent *component);
#endif /* _MEMOS_COMPONENT_H_ */
diff --git a/calendar/gui/memos-control.c b/calendar/gui/memos-control.c
deleted file mode 100644
index 052ac1fb49..0000000000
--- a/calendar/gui/memos-control.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Damon Chaplin <damon@ximian.com>
- * Ettore Perazzoli
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-stock-icons.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <e-util/e-dialog-utils.h>
-#include <e-util/e-icon-factory.h>
-#include <e-util/e-print.h>
-#include <e-util/e-util-private.h>
-
-#include "calendar-config.h"
-#include "e-memos.h"
-#include "e-memo-table.h"
-#include "print.h"
-#include "memos-control.h"
-#include "evolution-shell-component-utils.h"
-
-#define FIXED_MARGIN .05
-
-
-static void memos_control_activate_cb (BonoboControl *control,
- gboolean activate,
- gpointer user_data);
-static void memos_control_open_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_new_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void memos_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void memos_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void memos_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-
-
-
-BonoboControl *
-memos_control_new (void)
-{
- BonoboControl *control;
- GtkWidget *memos;
-
- memos = e_memos_new ();
- if (!memos)
- return NULL;
- gtk_widget_show (memos);
-
- control = bonobo_control_new (memos);
- if (!control) {
- gtk_widget_destroy (memos);
- g_message ("control_factory_fn(): could not create the control!");
- return NULL;
- }
-
- g_signal_connect (control, "activate", G_CALLBACK (memos_control_activate_cb), memos);
-
- return control;
-}
-
-
-static void
-memos_control_activate_cb (BonoboControl *control,
- gboolean activate,
- gpointer user_data)
-{
- EMemos *memos;
-
- memos = E_MEMOS (user_data);
-
- if (activate)
- memos_control_activate (control, memos);
- else
- memos_control_deactivate (control, memos);
-}
-
-/* Sensitizes the UI Component menu/toolbar commands based on the number of
- * selected memos.
- */
-void
-memos_control_sensitize_commands (BonoboControl *control, EMemos *memos, int n_selected)
-{
- BonoboUIComponent *uic;
- gboolean read_only = TRUE;
- ECal *ecal;
- ECalModel *model;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
- return;
-
- model = e_memo_table_get_model (e_memos_get_calendar_table (memos));
- ecal = e_cal_model_get_default_client (model);
- if (ecal)
- e_cal_is_read_only (ecal, &read_only, NULL);
-
- bonobo_ui_component_set_prop (uic, "/commands/MemosOpenMemo", "sensitive",
- n_selected != 1 ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosCut", "sensitive",
- n_selected == 0 || read_only ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosCopy", "sensitive",
- n_selected == 0 ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosPaste", "sensitive",
- read_only ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosDelete", "sensitive",
- n_selected == 0 || read_only ? "0" : "1",
- NULL);
-}
-
-/* Callback used when the selection in the table changes */
-static void
-selection_changed_cb (EMemos *memos, int n_selected, gpointer data)
-{
- BonoboControl *control;
-
- control = BONOBO_CONTROL (data);
-
- memos_control_sensitize_commands (control, memos, n_selected);
-}
-
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("MemosOpenMemo", memos_control_open_memo_cmd),
- BONOBO_UI_VERB ("MemosNewMemo", memos_control_new_memo_cmd),
- BONOBO_UI_VERB ("MemosCut", memos_control_cut_cmd),
- BONOBO_UI_VERB ("MemosCopy", memos_control_copy_cmd),
- BONOBO_UI_VERB ("MemosPaste", memos_control_paste_cmd),
- BONOBO_UI_VERB ("MemosDelete", memos_control_delete_cmd),
- BONOBO_UI_VERB ("MemosPrint", memos_control_print_cmd),
- BONOBO_UI_VERB ("MemosPrintPreview", memos_control_print_preview_cmd),
-
- BONOBO_UI_VERB_END
-};
-
-void
-memos_control_activate (BonoboControl *control, EMemos *memos)
-{
- Bonobo_UIContainer remote_uih;
- BonoboUIComponent *uic;
- int n_selected;
- EMemoTable *cal_table;
- ETable *etable;
- char *xmlfile;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
- bonobo_ui_component_set_container (uic, remote_uih, NULL);
- bonobo_object_release_unref (remote_uih, NULL);
-
- e_memos_set_ui_component (memos, uic);
-
- bonobo_ui_component_add_verb_list_with_data (uic, verbs, memos);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-memos.xml",
- NULL);
- bonobo_ui_util_set_ui (uic, PREFIX,
- xmlfile,
- "evolution-memos",
- NULL);
- g_free (xmlfile);
-
- e_memos_setup_view_menus (memos, uic);
-
- /* Signals from the memos widget; also sensitize the menu items as appropriate */
-
- g_signal_connect (memos, "selection_changed", G_CALLBACK (selection_changed_cb), control);
-
- cal_table = e_memos_get_calendar_table (memos);
- etable = e_memo_table_get_table (cal_table);
- n_selected = e_table_selected_count (etable);
-
- memos_control_sensitize_commands (control, memos, n_selected);
-
- bonobo_ui_component_thaw (uic, NULL);
-}
-
-
-void
-memos_control_deactivate (BonoboControl *control, EMemos *memos)
-{
- BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
-
- g_return_if_fail (uic != NULL);
-
- e_memos_set_ui_component (memos, NULL);
-
- e_memos_discard_view_menus (memos);
-
- /* Stop monitoring the "selection_changed" signal */
- g_signal_handlers_disconnect_matched (memos, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, control);
-
- bonobo_ui_component_rm (uic, "/", NULL);
- bonobo_ui_component_unset_container (uic, NULL);
-}
-
-static void memos_control_open_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
- e_memos_open_memo (memos);
-}
-
-static void
-memos_control_new_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
- e_memos_new_memo (memos);
-}
-
-static void
-memos_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
- EMemoTable *cal_table;
-
- memos = E_MEMOS (data);
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_cut_clipboard (cal_table);
-}
-
-static void
-memos_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
- EMemoTable *cal_table;
-
- memos = E_MEMOS (data);
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_copy_clipboard (cal_table);
-}
-
-static void
-memos_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
- EMemoTable *cal_table;
-
- memos = E_MEMOS (data);
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_paste_clipboard (cal_table);
-}
-
-static void
-memos_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
- e_memos_delete_selected (memos);
-}
-
-/* File/Print callback */
-static void
-memos_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos = E_MEMOS (data);
- ETable *table;
-
- table = e_memo_table_get_table (
- E_MEMO_TABLE (e_memos_get_calendar_table (memos)));
-
- print_table (
- table, _("Print Memos"), _("Memos"),
- GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-memos_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos = E_MEMOS (data);
- ETable *table;
-
- table = e_memo_table_get_table (
- E_MEMO_TABLE (e_memos_get_calendar_table (memos)));
-
- print_table (
- table, _("Print Memos"), _("Memos"),
- GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
diff --git a/calendar/gui/memos-control.h b/calendar/gui/memos-control.h
deleted file mode 100644
index 5861ae50e5..0000000000
--- a/calendar/gui/memos-control.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _MEMOS_CONTROL_H_
-#define _MEMOS_CONTROL_H_
-
-#include "e-memos.h"
-
-BonoboControl *memos_control_new (void);
-void memos_control_activate (BonoboControl *control, EMemos *memos);
-void memos_control_deactivate (BonoboControl *control, EMemos *memos);
-void memos_control_sensitize_commands (BonoboControl *control, EMemos *memos, int n_selected);
-
-#endif /* _MEMOS_CONTROL_H_ */
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 92c45baab2..9100183048 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -57,20 +57,9 @@
#define CREATE_TASK_ASSIGNED_ID "task-assigned"
#define CREATE_TASK_LIST_ID "task-list"
-enum DndTargetType {
- DND_TARGET_TYPE_CALENDAR_LIST,
-};
-#define CALENDAR_TYPE "text/calendar"
-#define XCALENDAR_TYPE "text/x-calendar"
#define WEB_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
-static GtkTargetEntry drag_types[] = {
- { CALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST },
- { XCALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
@@ -399,48 +388,6 @@ source_removed_cb (ETasks *tasks, ESource *source, TasksComponentView *component
e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
}
-static void
-set_info (TasksComponentView *component_view)
-{
- GString *message = g_string_new (NULL);
- int rows, selected_rows;
-
- rows = e_table_model_row_count (component_view->model);
- selected_rows = e_table_selected_count (component_view->table);
-
- g_string_append_printf(message, ngettext("%d task", "%d tasks", rows), rows);
- if (selected_rows > 0)
- g_string_append_printf(message, ngettext(", %d selected", ", %d selected", selected_rows), selected_rows);
-
- e_info_label_set_info (component_view->info_label, _("Tasks"), message->str);
-
- g_string_free (message, TRUE);
-}
-
-static void
-table_selection_change_cb (ETableModel *etm, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_changed_cb (ETableModel *etm, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_inserted_cb (ETableModel *etm, int row, int count, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_deleted_cb (ETableModel *etm, int row, int count, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
/* Evolution::Component CORBA methods */
static void
@@ -467,90 +414,6 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
}
static gboolean
-selector_tree_drag_drop (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint time,
- CalendarComponent *component)
-{
- GtkTreeViewColumn *column;
- int cell_x;
- int cell_y;
- GtkTreePath *path;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gpointer data;
-
- if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, &path,
- &column, &cell_x, &cell_y))
- return FALSE;
-
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
-
- if (!gtk_tree_model_get_iter (model, &iter, path)) {
- gtk_tree_path_free (path);
- return FALSE;
- }
-
- gtk_tree_model_get (model, &iter, 0, &data, -1);
-
- if (E_IS_SOURCE_GROUP (data)) {
- g_object_unref (data);
- gtk_tree_path_free (path);
- return FALSE;
- }
-
- gtk_tree_path_free (path);
- return TRUE;
-}
-
-static gboolean
-selector_tree_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint time,
- gpointer user_data)
-{
- GtkTreePath *path = NULL;
- gpointer data = NULL;
- GtkTreeViewDropPosition pos;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GdkDragAction action = GDK_ACTION_DEFAULT;
-
- 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, &data, -1);
-
- if (E_IS_SOURCE_GROUP (data) || e_source_get_readonly (data))
- goto finish;
-
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget), path, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
- action = context->suggested_action;
- if (action == GDK_ACTION_COPY && (context->actions & GDK_ACTION_MOVE))
- action=GDK_ACTION_MOVE;
-
- finish:
- if (path)
- gtk_tree_path_free (path);
- if (data)
- g_object_unref (data);
-
- gdk_drag_status (context, action, time);
- return TRUE;
-}
-
-static gboolean
update_single_object (ECal *client, icalcomponent *icalcomp)
{
char *uid;
@@ -732,27 +595,6 @@ selector_tree_drag_data_received (GtkWidget *widget,
}
static void
-selector_tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, gpointer data)
-{
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget),
- NULL, GTK_TREE_VIEW_DROP_BEFORE);
-}
-
-
-static void
-control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
-{
- TasksComponentView *component_view = data;
-
- if (activate) {
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (component_view->view_control);
-
- e_user_creatable_items_handler_activate (component_view->creatable_items_handler, uic);
- }
-}
-
-static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
TasksComponent *component = data;
@@ -940,18 +782,9 @@ create_component_view (TasksComponent *tasks_component)
a11y = gtk_widget_get_accessible (GTK_WIDGET (component_view->source_selector));
atk_object_set_name (a11y, _("Task Source Selector"));
- g_signal_connect (component_view->source_selector, "drag-motion", G_CALLBACK (selector_tree_drag_motion),
- tasks_component);
- g_signal_connect (component_view->source_selector, "drag-leave", G_CALLBACK (selector_tree_drag_leave),
- tasks_component);
- g_signal_connect (component_view->source_selector, "drag-drop", G_CALLBACK (selector_tree_drag_drop),
- tasks_component);
g_signal_connect (component_view->source_selector, "drag-data-received",
G_CALLBACK (selector_tree_drag_data_received), tasks_component);
- gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
- num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
gtk_widget_show (component_view->source_selector);
selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@@ -962,10 +795,6 @@ create_component_view (TasksComponent *tasks_component)
GTK_SHADOW_IN);
gtk_widget_show (selector_scrolled_window);
- component_view->info_label = (EInfoLabel *)e_info_label_new("evolution-tasks");
- e_info_label_set_info(component_view->info_label, _("Tasks"), "");
- gtk_widget_show (GTK_WIDGET (component_view->info_label));
-
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0);
@@ -1010,21 +839,6 @@ create_component_view (TasksComponent *tasks_component)
g_signal_connect (component_view->source_selector, "popup_event",
G_CALLBACK (popup_event_cb), component_view);
- /* Set up the "new" item handler */
- component_view->creatable_items_handler = e_user_creatable_items_handler_new ("tasks", create_local_item_cb, tasks_component);
- g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view);
-
- /* We use this to update the component information */
- set_info (component_view);
- g_signal_connect (component_view->table, "selection_change",
- G_CALLBACK (table_selection_change_cb), component_view);
- g_signal_connect (component_view->model, "model_changed",
- G_CALLBACK (model_changed_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_inserted",
- G_CALLBACK (model_rows_inserted_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_deleted",
- G_CALLBACK (model_rows_deleted_cb), component_view);
-
/* Load the selection from the last run */
update_selection (component_view);
update_primary_selection (component_view);
@@ -1290,12 +1104,4 @@ tasks_component_init (TasksComponent *component, TasksComponentClass *klass)
component->priv = priv;
}
-/* Public API */
-
-ESourceList *
-tasks_component_peek_source_list (TasksComponent *component)
-{
- return component->priv->source_list;
-}
-
BONOBO_TYPE_FUNC_FULL (TasksComponent, GNOME_Evolution_Component, PARENT_TYPE, tasks_component)
diff --git a/calendar/gui/tasks-component.h b/calendar/gui/tasks-component.h
index 8947b3da3e..fc96c5a2a8 100644
--- a/calendar/gui/tasks-component.h
+++ b/calendar/gui/tasks-component.h
@@ -55,6 +55,4 @@ struct _TasksComponentClass {
GType tasks_component_get_type (void);
-ESourceList *tasks_component_peek_source_list (TasksComponent *component);
-
#endif /* _TASKS_COMPONENT_H_ */