aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/control-factory.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-04-09 23:05:55 +0800
committerDan Winship <danw@src.gnome.org>2002-04-09 23:05:55 +0800
commit3bc71a52c1e6db329c2906f5f2ce414059ef2366 (patch)
treebabde4dd47aeb9efad9c4ccffd903af59f74ddcf /calendar/gui/control-factory.c
parentb782a8c304485de3ae80f53ac100e41f4a6f747f (diff)
downloadgsoc2013-evolution-3bc71a52c1e6db329c2906f5f2ce414059ef2366.tar
gsoc2013-evolution-3bc71a52c1e6db329c2906f5f2ce414059ef2366.tar.gz
gsoc2013-evolution-3bc71a52c1e6db329c2906f5f2ce414059ef2366.tar.bz2
gsoc2013-evolution-3bc71a52c1e6db329c2906f5f2ce414059ef2366.tar.lz
gsoc2013-evolution-3bc71a52c1e6db329c2906f5f2ce414059ef2366.tar.xz
gsoc2013-evolution-3bc71a52c1e6db329c2906f5f2ce414059ef2366.tar.zst
gsoc2013-evolution-3bc71a52c1e6db329c2906f5f2ce414059ef2366.zip
Add view_info arg. If the view_info is non-empty and this is a calendar
* gui/component-factory.c (create_view): Add view_info arg. If the view_info is non-empty and this is a calendar folder, set the "view" property on the control's propertybag. * gui/control-factory.c (calendar_properties_init): Set up the "view" property. (get_prop, set_prop): handle the "view" property by getting/setting the GnomeCalendar's view. Unfortunately, this doesn't actually work. See #23208. * gui/calendar-commands.c (calendar_control_activate): Set the UI component's container before calling gnome_calendar_set_ui_component so that the search bar initialization will work. svn path=/trunk/; revision=16400
Diffstat (limited to 'calendar/gui/control-factory.c')
-rw-r--r--calendar/gui/control-factory.c58
1 files changed, 51 insertions, 7 deletions
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index 0d220a3a83..1d83f934af 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -37,9 +37,11 @@
#include "control-factory.h"
-#define PROPERTY_CALENDAR_URI "folder_uri"
+#define PROPERTY_CALENDAR_URI "folder_uri"
+#define PROPERTY_CALENDAR_URI_IDX 1
-#define PROPERTY_CALENDAR_URI_IDX 1
+#define PROPERTY_CALENDAR_VIEW "view"
+#define PROPERTY_CALENDAR_VIEW_IDX 2
#define CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ControlFactory"
@@ -69,7 +71,7 @@ get_prop (BonoboPropertyBag *bag,
gpointer user_data)
{
GnomeCalendar *gcal = user_data;
- char *uri;
+ const char *uri;
switch (arg_id) {
@@ -78,6 +80,23 @@ get_prop (BonoboPropertyBag *bag,
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;
+ }
+ break;
+
default:
g_warning ("Unhandled arg %d\n", arg_id);
}
@@ -92,15 +111,16 @@ set_prop (BonoboPropertyBag *bag,
gpointer user_data)
{
GnomeCalendar *gcal = user_data;
- char *uri;
+ char *string;
+ GnomeCalendarViewType view;
switch (arg_id) {
case PROPERTY_CALENDAR_URI_IDX:
- uri = BONOBO_ARG_GET_STRING (arg);
- if (!gnome_calendar_open (gcal, uri)) {
+ string = BONOBO_ARG_GET_STRING (arg);
+ if (!gnome_calendar_open (gcal, string)) {
char *msg;
- msg = g_strdup_printf (_("Could not open the folder in '%s'"), uri);
+ 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))));
@@ -108,6 +128,23 @@ set_prop (BonoboPropertyBag *bag,
}
break;
+ case PROPERTY_CALENDAR_VIEW_IDX:
+ string = BONOBO_ARG_GET_STRING (arg);
+ if (!g_strcasecmp (string, "week"))
+ view = GNOME_CAL_WEEK_VIEW;
+ else if (!g_strcasecmp (string, "workweek"))
+ view = GNOME_CAL_WORK_WEEK_VIEW;
+ else if (!g_strcasecmp (string, "month"))
+ view = GNOME_CAL_MONTH_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, FALSE, TRUE);
+ break;
+
default:
g_warning ("Unhandled arg %d\n", arg_id);
break;
@@ -129,6 +166,13 @@ calendar_properties_init (GnomeCalendar *gcal, BonoboControl *control)
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, pbag);
bonobo_object_unref (BONOBO_OBJECT (pbag));