From 1b15216f5e285a231bcf5c7165be88607642c259 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 11 May 2004 19:29:04 +0000 Subject: Remove the calendar and task list controls * gui/GNOME_Evolution_Calendar.server.in.in: Remove the calendar and task list controls * gui/main.c (factory): Remove support for the calendar and task list controls * gui/control-factory.c: Remove the property-bag stuff * gui/tasks-control.c: Likewise svn path=/trunk/; revision=25857 --- calendar/gui/GNOME_Evolution_Calendar.server.in.in | 36 ----- calendar/gui/control-factory.c | 153 --------------------- calendar/gui/main.c | 10 +- calendar/gui/tasks-control.c | 111 --------------- 4 files changed, 2 insertions(+), 308 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/GNOME_Evolution_Calendar.server.in.in b/calendar/gui/GNOME_Evolution_Calendar.server.in.in index 437751b21f..5bf2c310e6 100644 --- a/calendar/gui/GNOME_Evolution_Calendar.server.in.in +++ b/calendar/gui/GNOME_Evolution_Calendar.server.in.in @@ -48,24 +48,6 @@ - - - - - - - - - - - - - - - @@ -83,24 +65,6 @@ - - - - - - - - - - - - - - - diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c index 71c918fb14..c6aab4b258 100644 --- a/calendar/gui/control-factory.c +++ b/calendar/gui/control-factory.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -39,13 +38,6 @@ #include "control-factory.h" -#define PROPERTY_CALENDAR_URI "folder_uri" -#define PROPERTY_CALENDAR_URI_IDX 1 - -#define PROPERTY_CALENDAR_VIEW "view" -#define PROPERTY_CALENDAR_VIEW_IDX 2 - - CORBA_Environment ev; CORBA_ORB orb; @@ -62,149 +54,6 @@ control_activate_cb (BonoboControl *control, gboolean activate, gpointer data) calendar_control_deactivate (control, gcal); } -static void -get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - GnomeCalendar *gcal; - const char *uri; - BonoboControl *control = user_data; - - gcal = (GnomeCalendar *) bonobo_control_get_widget (control); - - switch (arg_id) { - - case PROPERTY_CALENDAR_URI_IDX: - uri = e_cal_get_uri (e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal))); - BONOBO_ARG_SET_STRING (arg, uri); - break; - - case PROPERTY_CALENDAR_VIEW_IDX: - switch (gnome_calendar_get_view (gcal)) { - case GNOME_CAL_DAY_VIEW: - BONOBO_ARG_SET_STRING (arg, "day"); - break; - case GNOME_CAL_WEEK_VIEW: - BONOBO_ARG_SET_STRING (arg, "week"); - break; - case GNOME_CAL_WORK_WEEK_VIEW: - BONOBO_ARG_SET_STRING (arg, "workweek"); - break; - case GNOME_CAL_MONTH_VIEW: - BONOBO_ARG_SET_STRING (arg, "month"); - break; - case GNOME_CAL_LIST_VIEW: - BONOBO_ARG_SET_STRING (arg, "list"); - break; - default: - g_assert_not_reached (); - break; - } - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - } -} - -static void -set_prop (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - GnomeCalendar *gcal; - char *string; - GnomeCalendarViewType view; - ESource *source; - ESourceGroup *group; - BonoboControl *control = user_data; - - gcal = (GnomeCalendar *) bonobo_control_get_widget (control); - - switch (arg_id) { - case PROPERTY_CALENDAR_URI_IDX: - string = BONOBO_ARG_GET_STRING (arg); - - group = e_source_group_new ("", string); - source = e_source_new ("", ""); - e_source_set_group (source, group); - - if (gnome_calendar_add_source (gcal, E_CAL_SOURCE_TYPE_EVENT, source)) { - calendar_control_sensitize_calendar_commands (control, gcal, TRUE); - } else { - char *msg; - - msg = g_strdup_printf (_("Could not open the folder in '%s'"), string); - gnome_error_dialog_parented ( - msg, - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal)))); - g_free (msg); - } - - g_object_unref (source); - g_object_unref (group); - - break; - - case PROPERTY_CALENDAR_VIEW_IDX: - string = BONOBO_ARG_GET_STRING (arg); - if (!strcmp (string, "week")) - view = GNOME_CAL_WEEK_VIEW; - else if (!strcmp (string, "workweek")) - view = GNOME_CAL_WORK_WEEK_VIEW; - else if (!strcmp (string, "month")) - view = GNOME_CAL_MONTH_VIEW; - else if (!strcmp (string, "list")) - view = GNOME_CAL_LIST_VIEW; - else if (!strcmp (string, "day")) - view = GNOME_CAL_DAY_VIEW; - else - view = GNOME_CAL_DAY_VIEW; - - /* This doesn't actually work, because the GalView - * comes along and resets the view. FIXME. - */ - gnome_calendar_set_view (gcal, view); - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - break; - } -} - - -static void -calendar_properties_init (GnomeCalendar *gcal, BonoboControl *control) -{ - BonoboPropertyBag *pbag; - - pbag = bonobo_property_bag_new (get_prop, set_prop, control); - - bonobo_property_bag_add (pbag, - PROPERTY_CALENDAR_URI, - PROPERTY_CALENDAR_URI_IDX, - BONOBO_ARG_STRING, - NULL, - _("The URI that the calendar will display"), - 0); - bonobo_property_bag_add (pbag, - PROPERTY_CALENDAR_VIEW, - PROPERTY_CALENDAR_VIEW_IDX, - BONOBO_ARG_STRING, - NULL, - _("The type of view to show"), - 0); - - bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (pbag)), NULL); - bonobo_object_unref (BONOBO_OBJECT (pbag)); -} - BonoboControl * control_factory_new_control (void) { @@ -224,8 +73,6 @@ control_factory_new_control (void) } g_object_set_data (G_OBJECT (gcal), "control", control); - calendar_properties_init (gcal, control); - g_signal_connect (control, "activate", G_CALLBACK (control_activate_cb), gcal); return control; diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 80077d49a7..ecfa80bb5a 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -51,9 +51,7 @@ #define FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_Factory:" BASE_VERSION #define CALENDAR_COMPONENT_ID "OAFIID:GNOME_Evolution_Calendar_Component:" BASE_VERSION -#define CALENDAR_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_Control:" BASE_VERSION #define TASKS_COMPONENT_ID "OAFIID:GNOME_Evolution_Tasks_Component:" BASE_VERSION -#define TASKS_CONTROL_ID "OAFIID:GNOME_Evolution_Tasks_Control:" BASE_VERSION #define ITIP_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_iTip_Control:" BASE_VERSION #define CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_ConfigControl:" BASE_VERSION #define COMP_EDITOR_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_CompEditorFactory:" BASE_VERSION @@ -162,15 +160,11 @@ factory (BonoboGenericFactory *factory, BonoboObject *object = BONOBO_OBJECT (calendar_component_peek ()); bonobo_object_ref (object); return object; - } else if (strcmp (component_id, CALENDAR_CONTROL_ID) == 0) - return BONOBO_OBJECT (control_factory_new_control ()); - else if (strcmp (component_id, TASKS_COMPONENT_ID) == 0) { + } else if (strcmp (component_id, TASKS_COMPONENT_ID) == 0) { BonoboObject *object = BONOBO_OBJECT (tasks_component_peek ()); bonobo_object_ref (object); return object; - } else if (strcmp (component_id, TASKS_CONTROL_ID) == 0) - return BONOBO_OBJECT (tasks_control_new ()); - else if (strcmp (component_id, ITIP_CONTROL_ID) == 0) + } else if (strcmp (component_id, ITIP_CONTROL_ID) == 0) return BONOBO_OBJECT (itip_bonobo_control_new ()); else if (strcmp (component_id, CONFIG_CONTROL_ID) == 0) return BONOBO_OBJECT (cal_prefs_dialog_new ()); diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 9e0d3fe286..f596aa8a07 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -52,23 +51,9 @@ #include "tasks-control.h" #include "evolution-shell-component-utils.h" -#define TASKS_CONTROL_PROPERTY_URI "folder_uri" -#define TASKS_CONTROL_PROPERTY_URI_IDX 1 #define FIXED_MARGIN .05 -static void tasks_control_properties_init (BonoboControl *control, - ETasks *tasks); -static void tasks_control_get_property (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data); -static void tasks_control_set_property (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data); static void tasks_control_activate_cb (BonoboControl *control, gboolean activate, gpointer user_data); @@ -125,108 +110,12 @@ tasks_control_new (void) return NULL; } - tasks_control_properties_init (control, E_TASKS (tasks)); - g_signal_connect (control, "activate", G_CALLBACK (tasks_control_activate_cb), tasks); return control; } -/* Creates the property bag for our new control. */ -static void -tasks_control_properties_init (BonoboControl *control, - ETasks *tasks) - -{ - BonoboPropertyBag *pbag; - - pbag = bonobo_property_bag_new (tasks_control_get_property, - tasks_control_set_property, tasks); - - bonobo_property_bag_add (pbag, - TASKS_CONTROL_PROPERTY_URI, - TASKS_CONTROL_PROPERTY_URI_IDX, - BONOBO_ARG_STRING, - NULL, - _("The URI of the tasks folder to display"), - 0); - - bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (pbag)), NULL); - bonobo_object_unref (BONOBO_OBJECT (pbag)); -} - - -/* Gets a property of our control. FIXME: Finish. */ -static void -tasks_control_get_property (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - ETasks *tasks = user_data; - const char *uri; - ECalModel *model; - - switch (arg_id) { - - case TASKS_CONTROL_PROPERTY_URI_IDX: - model = e_calendar_table_get_model (e_tasks_get_calendar_table (tasks)); - uri = e_cal_get_uri (e_cal_model_get_default_client (model)); - BONOBO_ARG_SET_STRING (arg, uri); - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - } -} - - -static void -tasks_control_set_property (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - ETasks *tasks = user_data; - char *uri; - ESource *source; - ESourceGroup *group; - - switch (arg_id) { - - case TASKS_CONTROL_PROPERTY_URI_IDX: - /* FIXME Remove the old uri? */ - uri = BONOBO_ARG_GET_STRING (arg); - - group = e_source_group_new ("", uri); - source = e_source_new ("", ""); - e_source_set_group (source, group); - - if (!e_tasks_add_todo_source (tasks, source)) { - char *msg; - - msg = g_strdup_printf (_("Could not load the tasks in `%s'"), uri); - gnome_error_dialog_parented ( - msg, - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks)))); - g_free (msg); - } - - g_object_unref (source); - g_object_unref (group); - - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - break; - } -} - - static void tasks_control_activate_cb (BonoboControl *control, gboolean activate, -- cgit v1.2.3