aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMichael Meeks <mmeeks@src.gnome.org>2000-09-14 07:40:42 +0800
committerMichael Meeks <mmeeks@src.gnome.org>2000-09-14 07:40:42 +0800
commit9964204c9c080650f79863a483a4c42886d55239 (patch)
tree3c0693385a73461319ab94b63fb15cbe80ae88e5 /calendar
parent5678a57e33c55ab2622a3fbb823b42e4f80c31cc (diff)
downloadgsoc2013-evolution-9964204c9c080650f79863a483a4c42886d55239.tar
gsoc2013-evolution-9964204c9c080650f79863a483a4c42886d55239.tar.gz
gsoc2013-evolution-9964204c9c080650f79863a483a4c42886d55239.tar.bz2
gsoc2013-evolution-9964204c9c080650f79863a483a4c42886d55239.tar.lz
gsoc2013-evolution-9964204c9c080650f79863a483a4c42886d55239.tar.xz
gsoc2013-evolution-9964204c9c080650f79863a483a4c42886d55239.tar.zst
gsoc2013-evolution-9964204c9c080650f79863a483a4c42886d55239.zip
The Commit from hell that breaks all UI related stuff;
Anything UI related that breaks is now my fault; apologies in advance. svn path=/trunk/; revision=5415
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog4
-rw-r--r--calendar/gui/calendar-commands.c155
-rw-r--r--calendar/gui/dialogs/task-editor.c28
-rw-r--r--calendar/gui/event-editor.c36
4 files changed, 100 insertions, 123 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index f497d96d65..ea084d444d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-07 Michael Meeks <michael@helixcode.com>
+
+ * gui/calendar-commands.c: Re-write most UI handler code.
+
2000-09-13 Federico Mena Quintero <federico@helixcode.com>
* gui/calendar-model.c (obj_updated_cb): Removed an unused
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 40928530af..9f9b58aa7f 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -478,6 +478,8 @@ properties_cmd (BonoboUIHandler *uih, void *user_data, const char *path)
}
+#warning FIXME: reinstate this when radiobuttons are implemented
+#if 0
/* Note: if the order of these is changed, make sure you change the indices
used to access the widgets in calendar_control_activate(). */
static GnomeUIInfo gnome_toolbar_view_buttons [] = {
@@ -500,80 +502,42 @@ static GnomeUIInfo gnome_toolbar_view_buttons [] = {
#endif
GNOMEUIINFO_END
};
+#endif
-
-static GnomeUIInfo calendar_toolbar [] = {
- GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new appointment"),
- new_appointment_cb, GNOME_STOCK_PIXMAP_NEW),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print this calendar"), tb_print_cb, GNOME_STOCK_PIXMAP_PRINT),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_PIXMAP_BACK),
- GNOMEUIINFO_ITEM_STOCK (N_("Today"), N_("Go to present time"), today_clicked, GNOME_STOCK_PIXMAP_HOME),
- GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_PIXMAP_FORWARD),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_JUMP_TO),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_RADIOLIST (gnome_toolbar_view_buttons),
-
- GNOMEUIINFO_END
+BonoboUIVerb verbs [] = {
+ BONOBO_UI_VERB ("CalendarNew", new_calendar_cmd),
+ BONOBO_UI_VERB ("CalendarOpen", open_calendar_cmd),
+ BONOBO_UI_VERB ("CalendarSaveAs", save_as_calendar_cmd),
+ BONOBO_UI_VERB ("CalendarPrint", file_print_cb),
+ BONOBO_UI_VERB ("EditNewAppointment", new_appointment_cb),
+ BONOBO_UI_VERB ("CalendarPreferences", properties_cmd),
+ BONOBO_UI_VERB ("AboutCalendar", about_calendar_cmd),
+
+ BONOBO_UI_VERB ("CalendarPrev", previous_clicked),
+ BONOBO_UI_VERB ("CalendarToday", today_clicked),
+ BONOBO_UI_VERB ("CalendarNext", next_clicked),
+ BONOBO_UI_VERB ("CalendarGoto", goto_clicked),
+
+ BONOBO_UI_VERB_END
};
-
-
-/* Performs signal connection as appropriate for interpreters or native bindings */
-static void
-do_ui_signal_connect (GnomeUIInfo *uiinfo, gchar *signal_name,
- GnomeUIBuilderData *uibdata)
-{
- if (uibdata->is_interp)
- gtk_signal_connect_full (GTK_OBJECT (uiinfo->widget),
- signal_name, NULL, uibdata->relay_func,
- uibdata->data ?
- uibdata->data : uiinfo->user_data,
- uibdata->destroy_func, FALSE, FALSE);
-
- else if (uiinfo->moreinfo)
- gtk_signal_connect (GTK_OBJECT (uiinfo->widget),
- signal_name, uiinfo->moreinfo, uibdata->data ?
- uibdata->data : uiinfo->user_data);
-}
-
-
void
calendar_control_activate (BonoboControl *control,
GnomeCalendar *cal)
{
- Bonobo_UIHandler remote_uih;
- GtkWidget *toolbar, *toolbar_frame;
- BonoboControl *toolbar_control;
- GnomeUIBuilderData uibdata;
+ Bonobo_UIHandler remote_uih;
BonoboUIHandler *uih;
- int behavior;
uih = bonobo_control_get_ui_handler (control);
g_assert (uih != NULL);
- uibdata.connect_func = do_ui_signal_connect;
- uibdata.data = cal;
- uibdata.is_interp = FALSE;
- uibdata.relay_func = NULL;
- uibdata.destroy_func = NULL;
-
g_print ("In calendar_control_activate\n");
remote_uih = bonobo_control_get_remote_ui_handler (control);
bonobo_ui_handler_set_container (uih, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
+#if 0
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
GTK_TOOLBAR_BOTH);
gnome_app_fill_toolbar_custom (GTK_TOOLBAR (toolbar),
@@ -614,52 +578,31 @@ calendar_control_activate (BonoboControl *control,
behavior,
GNOME_DOCK_TOP,
1, 1, 0);
-
- /* file menu */
- bonobo_ui_handler_menu_new_item (uih, "/File/New/Calendar", N_("New Ca_lendar"),
- N_("Create a new calendar"),
- -1, BONOBO_UI_HANDLER_PIXMAP_NONE,
- NULL, 0, 0, new_calendar_cmd, cal);
- bonobo_ui_handler_menu_new_item (uih, "/File/Open/Calendar", N_("Open Ca_lendar"),
- N_("Open a calendar"), -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, open_calendar_cmd, cal);
- bonobo_ui_handler_menu_new_item (uih, "/File/Save Calendar As",
- N_("Save Calendar As"),
- N_("Save Calendar As"),
- -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, save_as_calendar_cmd, cal);
- bonobo_ui_handler_menu_new_item (uih, "/File/Print", N_("Print..."),
- N_("Print this calendar"), -1,
- BONOBO_UI_HANDLER_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_PRINT,
- 'p', GDK_CONTROL_MASK,
- file_print_cb, cal);
-
- /* edit menu */
- bonobo_ui_handler_menu_new_item (uih, "/Edit/New Appointment",
- N_("_New appointment..."), N_("Create a new appointment"),
- -1, BONOBO_UI_HANDLER_PIXMAP_STOCK,
- GNOME_STOCK_MENU_NEW, 0, 0,
- new_appointment_cb, cal);
-
- //bonobo_ui_handler_menu_new_separator (uih, "/Edit", -1);
-
- bonobo_ui_handler_menu_new_item (uih, "/Edit/Preferences",
- N_("Preferences"), N_("Preferences"),
- -1, BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, properties_cmd, cal);
- /* help menu */
-
- bonobo_ui_handler_menu_new_item (uih,
- "/Help/About Calendar",
- N_("About Calendar"),
- N_("About Calendar"),
- -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, about_calendar_cmd, cal);
-
+#endif
+
+ { /* FIXME: sweeten this whole function */
+ char *fname;
+ xmlNode *ui;
+ Bonobo_UIContainer container;
+ BonoboUIComponent *component;
+
+ component = bonobo_ui_compat_get_component (uih);
+ bonobo_ui_component_add_verb_list_with_data (
+ component, verbs, cal);
+
+ container = bonobo_ui_compat_get_container (uih);
+ g_return_if_fail (container != CORBA_OBJECT_NIL);
+
+ fname = bonobo_ui_util_get_ui_fname ("evolution-calendar.xml");
+ g_warning ("Attempting ui load from '%s'", fname);
+
+ ui = bonobo_ui_util_new_ui (component, fname, "evolution-calendar");
+
+ bonobo_ui_component_set_tree (component, container, "/", ui, NULL);
+
+ g_free (fname);
+ xmlFreeNode (ui);
+ }
}
@@ -671,7 +614,10 @@ calendar_control_deactivate (BonoboControl *control)
g_print ("In calendar_control_deactivate\n");
- bonobo_ui_handler_dock_remove (uih, "/Toolbar");
+ bonobo_ui_component_rm (
+ bonobo_ui_compat_get_component (uih),
+ bonobo_ui_compat_get_container (uih), "/", NULL);
+
bonobo_ui_handler_unset_container (uih);
}
@@ -692,6 +638,7 @@ new_calendar (char *full_name, char *geometry, gboolean hidden)
GtkWidget *toplevel;
int xpos, ypos, width, height;
+
toplevel = gnome_calendar_new ();
if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)) {
@@ -764,7 +711,7 @@ init_calendar (void)
am_pm_flag = gnome_config_get_bool ("/calendar/Calendar/AM PM flag=0");
week_starts_on_monday = gnome_config_get_bool ("/calendar/Calendar/Week starts on Monday=0");
- if (day_end < day_begin){
+ if (day_end < day_begin) {
day_begin = 8;
day_end = 17;
}
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 240d1a5010..08d76a14be 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -228,6 +228,7 @@ TaskEditor *
task_editor_construct (TaskEditor *tedit)
{
TaskEditorPrivate *priv;
+ GtkWidget *bonobo_win;
g_return_val_if_fail (tedit != NULL, NULL);
g_return_val_if_fail (IS_TASK_EDITOR (tedit), NULL);
@@ -257,7 +258,26 @@ task_editor_construct (TaskEditor *tedit)
goto error;
}
- bonobo_ui_handler_set_app (priv->uih, GNOME_APP (priv->app));
+ bonobo_win = bonobo_win_new ("event-editor-dialog", "Event Editor");
+
+ /* FIXME: The sucking bit */
+ {
+ GtkWidget *contents;
+
+ contents = gnome_dock_get_client_area (
+ GNOME_DOCK (GNOME_APP (priv->app)->dock));
+ if (!contents) {
+ g_message ("event_editor_construct(): Could not get contents");
+ goto error;
+ }
+ gtk_widget_ref (contents);
+ gtk_container_remove (GTK_CONTAINER (contents->parent), contents);
+ bonobo_win_set_contents (BONOBO_WIN (bonobo_win), contents);
+ gtk_widget_destroy (priv->app);
+ priv->app = GTK_WIDGET (bonobo_win);
+ }
+
+ bonobo_ui_handler_set_app (priv->uih, BONOBO_WIN (priv->app));
create_menu (tedit);
create_toolbar (tedit);
@@ -655,9 +675,11 @@ create_toolbar (TaskEditor *tedit)
bonobo_ui_handler_create_toolbar (priv->uih, "Toolbar");
+#warning This should be converted to xml.
+#if 0
/* Fetch the toolbar. What a pain in the ass. */
- dock_item = gnome_app_get_dock_item_by_name (GNOME_APP (priv->app), GNOME_APP_TOOLBAR_NAME);
+ dock_item = bonobo_win_get_dock_item_by_name (BONOBO_WIN (priv->app), BONOBO_WIN_TOOLBAR_NAME);
g_assert (dock_item != NULL);
toolbar_child = gnome_dock_item_get_child (dock_item);
@@ -665,7 +687,7 @@ create_toolbar (TaskEditor *tedit)
/* Turn off labels as GtkToolbar sucks */
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS);
-
+#endif
list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar,
tedit);
bonobo_ui_handler_toolbar_add_list (priv->uih, "/Toolbar", list);
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index 452399c836..3f6efd1bb0 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -1394,24 +1394,10 @@ create_toolbar (EventEditor *ee)
{
EventEditorPrivate *priv;
BonoboUIHandlerToolbarItem *list;
- GnomeDockItem *dock_item;
- GtkWidget *toolbar_child;
priv = ee->priv;
bonobo_ui_handler_create_toolbar (priv->uih, "Toolbar");
-
- /* Fetch the toolbar. What a pain in the ass. */
-
- dock_item = gnome_app_get_dock_item_by_name (GNOME_APP (priv->app), GNOME_APP_TOOLBAR_NAME);
- g_assert (dock_item != NULL);
-
- toolbar_child = gnome_dock_item_get_child (dock_item);
- g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child));
-
- /* Turn off labels as GtkToolbar sucks */
- gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS);
-
list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, ee);
bonobo_ui_handler_toolbar_add_list (priv->uih, "/Toolbar", list);
}
@@ -1446,6 +1432,7 @@ EventEditor *
event_editor_construct (EventEditor *ee)
{
EventEditorPrivate *priv;
+ GtkWidget *bonobo_win;
g_return_val_if_fail (ee != NULL, NULL);
g_return_val_if_fail (IS_EVENT_EDITOR (ee), NULL);
@@ -1468,6 +1455,24 @@ event_editor_construct (EventEditor *ee)
init_widgets (ee);
/* Construct the app */
+ bonobo_win = bonobo_win_new ("event-editor-dialog", "Event Editor");
+
+ /* FIXME: The sucking bit */
+ {
+ GtkWidget *contents;
+
+ contents = gnome_dock_get_client_area (
+ GNOME_DOCK (GNOME_APP (priv->app)->dock));
+ if (!contents) {
+ g_message ("event_editor_construct(): Could not get contents");
+ goto error;
+ }
+ gtk_widget_ref (contents);
+ gtk_container_remove (GTK_CONTAINER (contents->parent), contents);
+ bonobo_win_set_contents (BONOBO_WIN (bonobo_win), contents);
+ gtk_widget_destroy (priv->app);
+ priv->app = bonobo_win;
+ }
priv->uih = bonobo_ui_handler_new ();
if (!priv->uih) {
@@ -1475,7 +1480,7 @@ event_editor_construct (EventEditor *ee)
goto error;
}
- bonobo_ui_handler_set_app (priv->uih, GNOME_APP (priv->app));
+ bonobo_ui_handler_set_app (priv->uih, BONOBO_WIN (priv->app));
create_menu (ee);
create_toolbar (ee);
@@ -1791,7 +1796,6 @@ set_all_day (GtkWidget *toggle, EventEditor *ee)
e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day);
e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day);
-
e_date_edit_set_time (E_DATE_EDIT (priv->end_time), mktime (&end_tm));
}