aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
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
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')
-rw-r--r--calendar/gui/calendar-commands.c4
-rw-r--r--calendar/gui/calendar-component.c3
-rw-r--r--calendar/gui/component-factory.c3
-rw-r--r--calendar/gui/control-factory.c58
4 files changed, 59 insertions, 9 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 4165760231..dcd17fe8c7 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -686,12 +686,12 @@ calendar_control_activate (BonoboControl *control,
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
- gnome_calendar_set_ui_component (gcal, uic);
-
remote_uih = bonobo_control_get_remote_ui_container (control);
bonobo_ui_component_set_container (uic, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
+ gnome_calendar_set_ui_component (gcal, uic);
+
bonobo_ui_component_add_verb_list_with_data (uic, verbs, gcal);
bonobo_ui_component_freeze (uic, NULL);
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 211a79fa39..a9cc8a89f9 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -83,6 +83,7 @@ static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
const char *type,
+ const char *view_info,
BonoboControl **control_return,
void *closure)
{
@@ -101,6 +102,8 @@ create_view (EvolutionShellComponent *shell_component,
}
bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
+ if (!g_strcasecmp (type, "calendar") && *view_info)
+ bonobo_control_set_property (control, "view", view_info, NULL);
*control_return = control;
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index 211a79fa39..a9cc8a89f9 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -83,6 +83,7 @@ static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
const char *type,
+ const char *view_info,
BonoboControl **control_return,
void *closure)
{
@@ -101,6 +102,8 @@ create_view (EvolutionShellComponent *shell_component,
}
bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
+ if (!g_strcasecmp (type, "calendar") && *view_info)
+ bonobo_control_set_property (control, "view", view_info, NULL);
*control_return = control;
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));