aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/calendar-commands.c95
-rw-r--r--calendar/gui/calendar-commands.h5
-rw-r--r--calendar/gui/evolution-calendar-control.c20
3 files changed, 111 insertions, 9 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 7323a04e5b..2fffb9408e 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -522,15 +522,14 @@ static GnomeUIInfo gnome_toolbar [] = {
GNOMEUIINFO_END
};
+
+/*
static void
setup_menu (GtkWidget *gcal)
{
- /*
gnome_app_create_menus_with_data (GNOME_APP (gcal), gnome_cal_menu, gcal);
gnome_app_create_toolbar_with_data (GNOME_APP (gcal), gnome_toolbar, gcal);
gnome_app_install_menu_hints(GNOME_APP(gcal), gnome_cal_menu);
- */
-#warning "menus and toolbar are commented out here"
}
static void
@@ -539,10 +538,90 @@ setup_appbar (GtkWidget *gcal)
GtkWidget *appbar;
appbar = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_USER);
- /*gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET (appbar));*/
-#warning "appbar is commented out here"
+ gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET (appbar));
+}
+*/
+
+
+/* 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, BonoboUIHandler *uih)
+{
+ Bonobo_UIHandler remote_uih;
+ GtkWidget *toolbar;
+ GnomeUIBuilderData uibdata;
+
+ uibdata.connect_func = do_ui_signal_connect;
+ uibdata.data = control;
+ uibdata.is_interp = FALSE;
+ uibdata.relay_func = NULL;
+ uibdata.destroy_func = NULL;
+
+ remote_uih = bonobo_control_get_remote_ui_handler (control);
+ bonobo_ui_handler_set_container (uih, remote_uih);
+
+ toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
+ GTK_TOOLBAR_BOTH);
+ gnome_app_fill_toolbar_custom (GTK_TOOLBAR (toolbar),
+ gnome_toolbar, &uibdata,
+ /*app->accel_group*/ NULL);
+
+ gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
+
+ gtk_widget_show_all (toolbar);
+
+ bonobo_ui_handler_dock_add (uih, "/Toolbar",
+ bonobo_object_corba_objref (BONOBO_OBJECT (bonobo_control_new (toolbar))),
+ GNOME_DOCK_ITEM_BEH_LOCKED |
+ GNOME_DOCK_ITEM_BEH_EXCLUSIVE,
+ GNOME_DOCK_TOP,
+ 1, 1, 0);
+
+
+#warning "do something twisted with gnome_cal_menu here?"
+ /*
+ bonobo_ui_handler_menu_new_item (uih, "/File/Mail", N_("_Mail"),
+ NULL, -1,
+ BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
+ 0, 0, msg_composer_cb, NULL);
+ */
+}
+
+
+void
+calendar_control_deactivate (BonoboControl *control, BonoboUIHandler *uih)
+{
+ bonobo_ui_handler_dock_remove (uih, "/Toolbar");
+
+ /*
+ int i;
+ for (i=0; gnome_cal_menu[ i ].type != GNOME_APP_UI_ENDOFINFO; i++){
+ bonobo_ui_handler_menu_remove (uih, "/File/Mail");
+ }
+ */
}
+
+
+
static gint
calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal)
{
@@ -576,8 +655,10 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page,
gtk_widget_set_usize (toplevel, width, 600);
#endif
+ /*
setup_appbar (toplevel);
setup_menu (toplevel);
+ */
if (page)
@@ -625,9 +706,7 @@ void init_calendar (void)
char *str;
init_username ();
- /*user_calendar_file = g_concat_dir_and_file (gnome_util_user_home (), ".gnome/user-cal.vcf");*/
-#warning "unhardcode home directory"
- user_calendar_file = g_concat_dir_and_file ("/home/alves", ".gnome/user-cal.vcf");
+ user_calendar_file = g_concat_dir_and_file (gnome_util_user_home (), ".gnome/user-cal.vcf");
gnome_config_push_prefix (calendar_settings);
diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h
index 2f6c25f04c..26df3882e6 100644
--- a/calendar/gui/calendar-commands.h
+++ b/calendar/gui/calendar-commands.h
@@ -1,6 +1,8 @@
#ifndef CALENDAR_COMMANDS_H
#define CALENDAR_COMMANDS_H
+#include <bonobo/bonobo-control.h>
+
/* This enum and the following array define the color preferences */
typedef enum {
@@ -116,7 +118,8 @@ calendar_iterate (GnomeCalendar *cal,
void init_calendar (void);
-
+void calendar_control_activate (BonoboControl *control, BonoboUIHandler *uih);
+void calendar_control_deactivate (BonoboControl *control, BonoboUIHandler *uih);
void close_cmd (GtkWidget *widget, GnomeCalendar *gcal);
void quit_cmd (void);
diff --git a/calendar/gui/evolution-calendar-control.c b/calendar/gui/evolution-calendar-control.c
index ceee4335eb..b1c436b716 100644
--- a/calendar/gui/evolution-calendar-control.c
+++ b/calendar/gui/evolution-calendar-control.c
@@ -19,6 +19,22 @@ CORBA_Environment ev;
CORBA_ORB orb;
+static void
+control_activate_cb (BonoboControl *control,
+ gboolean activate,
+ gpointer user_data)
+{
+ BonoboUIHandler *uih;
+
+ uih = bonobo_control_get_ui_handler (control);
+ g_assert (uih);
+
+ if (activate)
+ calendar_control_activate (control, uih);
+ else
+ calendar_control_deactivate (control, uih);
+}
+
static BonoboObject *
calendar_factory (BonoboGenericFactory *Factory, void *closure)
@@ -30,8 +46,12 @@ calendar_factory (BonoboGenericFactory *Factory, void *closure)
//cal = gnome_calendar_new ("unnamed");
cal = new_calendar ("title", NULL, NULL, NULL, 0);
gtk_widget_show (GTK_WIDGET (cal));
+
control = bonobo_control_new (GTK_WIDGET (cal));
+ gtk_signal_connect (GTK_OBJECT (control), "activate",
+ control_activate_cb, NULL);
+
return BONOBO_OBJECT (control);
}