aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-04-09 04:21:31 +0800
committerSeth Alves <alves@src.gnome.org>2000-04-09 04:21:31 +0800
commit181e276c46263a695457f4c250c917560d6e1596 (patch)
tree723f398a2812c049fe0ce078b8e9b7efad4113de /calendar/gui
parent4c1b64ea55dc20faa79c79f85fb53d04d956315b (diff)
downloadgsoc2013-evolution-181e276c46263a695457f4c250c917560d6e1596.tar
gsoc2013-evolution-181e276c46263a695457f4c250c917560d6e1596.tar.gz
gsoc2013-evolution-181e276c46263a695457f4c250c917560d6e1596.tar.bz2
gsoc2013-evolution-181e276c46263a695457f4c250c917560d6e1596.tar.lz
gsoc2013-evolution-181e276c46263a695457f4c250c917560d6e1596.tar.xz
gsoc2013-evolution-181e276c46263a695457f4c250c917560d6e1596.tar.zst
gsoc2013-evolution-181e276c46263a695457f4c250c917560d6e1596.zip
new function: friendly wrapper for cal_client_create_calendar
* gui/gnome-cal.c (gnome_calendar_create): new function: friendly wrapper for cal_client_create_calendar * gui/calendar-commands.c (new_calendar): call gnome_calendar_create if no filename is provided * gui/prop.c (properties): calendar is a frame * gui/calendar-commands.c (calendar_control_activate): sort out the menus a bit, more of them show up now. * gui/Makefile.am: don't build library or test, just the bonobo control * gui/gncal-todo.c (simple_todo_editor): calendar is a frame instead of a window, now. * gui/gnome-cal.c (gnome_calendar_new): same * gui/goto.c (goto_dialog): same svn path=/trunk/; revision=2339
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am22
-rw-r--r--calendar/gui/calendar-commands.c107
-rw-r--r--calendar/gui/evolution-calendar-control.c6
-rw-r--r--calendar/gui/gnome-cal.c21
-rw-r--r--calendar/gui/gnome-cal.h2
-rw-r--r--calendar/gui/prop.c5
6 files changed, 91 insertions, 72 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 6f35ed7ed2..15f1492739 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -28,9 +28,8 @@ LINK_FLAGS = \
$(top_builddir)/libical/src/libical/libical.la \
$(top_builddir)/calendar/cal-client/libcal-client.la
-noinst_LIBRARIES = libcalendarwidget.a
-
-libcalendarwidget_a_SOURCES = \
+bin_PROGRAMS = evolution-calendar
+evolution_calendar_SOURCES = \
alarm.c \
alarm.h \
e-day-view-main-item.c \
@@ -76,25 +75,12 @@ libcalendarwidget_a_SOURCES = \
year-view.c \
year-view.h \
calendar-commands.c \
- calendar-commands.h
-
-
-bin_PROGRAMS = evolution-calendar
-noinst_PROGRAMS = test-calendar-widget
-test_calendar_widget_SOURCES = main.c
-test_calendar_widget_INCLUDES = \
- $(INCLUDES) \
- -DG_LOG_DOMAIN=\"test-calendar-widget\"
-test_calendar_widget_LDADD = \
- libcalendarwidget.a \
- $(LINK_FLAGS)
-
-evolution_calendar_SOURCES = evolution-calendar-control.c
+ calendar-commands.h \
+ evolution-calendar-control.c
evolution_calendar_LDADD = \
$(EXTRA_GNOME_LIBS) \
$(BONOBO_HTML_GNOME_LIBS) \
- $(top_builddir)/calendar/gui/libcalendarwidget.a \
$(top_builddir)/widgets/e-minicard/libeminicard.a \
$(top_builddir)/widgets/e-table/libetable.a \
$(top_builddir)/widgets/e-text/libetext.a \
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 5275bd9484..9b3fa91525 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -387,12 +387,12 @@ close_save (GtkWidget *w)
}
static void
-save_as_calendar_cmd (GtkWidget *widget, void *data)
+save_as_calendar_cmd (BonoboUIHandler *uih, void *user_data, const char *path)
{
GtkFileSelection *fs;
fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save calendar")));
- gtk_object_set_user_data (GTK_OBJECT (fs), data);
+ gtk_object_set_user_data (GTK_OBJECT (fs), user_data);
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
(GtkSignalFunc) save_ok,
@@ -492,57 +492,58 @@ calendar_control_activate (BonoboControl *control,
/* file menu */
- bonobo_ui_handler_menu_new_item (uih, "/File/New", N_("_Mail"),
- 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", NULL,
- NULL, -1,
+ 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", NULL,
- NULL, -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, save_calendar_cmd, cal); */
- /* separator */
- bonobo_ui_handler_menu_new_item (uih, "/File/Close", NULL,
- NULL, -1,
+ 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/Close", N_("_Close Calendar"),
+ N_("Close current calendar"),
+ -1, BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
0, 0, close_cmd, cal);
- bonobo_ui_handler_menu_new_item (uih, "/File/Exit", NULL,
- NULL, -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, quit_cmd, cal);
+ /*bonobo_ui_handler_menu_new_item (uih, "/File/Exit",
+ N_("_Exit"), N_("Exit"),
+ -1, BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
+ 0, 0, quit_cmd, 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, display_objedit, cal);
+ N_("_New appointment..."), N_("Create a new appointment"),
+ -1, BONOBO_UI_HANDLER_PIXMAP_STOCK,
+ GNOME_STOCK_MENU_NEW, 0, 0,
+ display_objedit, cal);
bonobo_ui_handler_menu_new_item (uih, "/Edit/New Appointment for today",
N_("New appointment for _today..."),
N_("Create a new appointment for today"),
- -1,
- BONOBO_UI_HANDLER_PIXMAP_STOCK,
- GNOME_STOCK_MENU_NEW,
- 0, 0, display_objedit_today, cal);
+ -1, BONOBO_UI_HANDLER_PIXMAP_STOCK,
+ GNOME_STOCK_MENU_NEW, 0, 0,
+ display_objedit_today, 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", NULL,
- NULL, -1,
+ 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);
- /* settings menu */
-
- bonobo_ui_handler_menu_new_item (uih, "/Settings/Preferences", NULL,
- NULL, -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, properties_cmd, cal);
}
@@ -571,6 +572,7 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page,
GtkWidget *toplevel;
char title[128];
int xpos, ypos, width, height;
+ gboolean success;
/* i18n: This "%s%s" indicates possession. Languages where the order is
* the inverse should translate it to "%2$s%1$s".
@@ -582,14 +584,10 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page,
if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){
if (xpos != -1)
gtk_widget_set_uposition (toplevel, xpos, ypos);
-#if 0
- if (width != -1)
- gtk_widget_set_usize (toplevel, width, 600);
-#endif
+ /*if (width != -1)
+ gtk_widget_set_usize (toplevel, width, 600);*/
}
-#if 0
- gtk_widget_set_usize (toplevel, width, 600);
-#endif
+ /*gtk_widget_set_usize (toplevel, width, 600); */
/*
setup_appbar (toplevel);
@@ -600,12 +598,19 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page,
if (page)
gnome_calendar_set_view (GNOME_CALENDAR (toplevel), page);
- if (calendar_file && g_file_exists (calendar_file))
- gnome_calendar_load (GNOME_CALENDAR (toplevel), calendar_file);
- /* FIX ME
- else
- GNOME_CALENDAR (toplevel)->client->filename = g_strdup (calendar_file);
- */
+ printf ("calendar_file is '%s'\n", calendar_file?calendar_file:"NULL");
+ if (calendar_file && g_file_exists (calendar_file)) {
+ printf ("loading calendar\n");
+ success = gnome_calendar_load (GNOME_CALENDAR (toplevel), calendar_file);
+ }
+ else {
+ printf ("creating calendar\n");
+ success = gnome_calendar_create (GNOME_CALENDAR (toplevel), calendar_file);
+ /*GNOME_CALENDAR (toplevel)->client->filename = g_strdup (calendar_file);*/
+ }
+
+ printf ("load or create returned %d\n", success);
+
gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event",
GTK_SIGNAL_FUNC(calendar_close_event), toplevel);
@@ -757,7 +762,7 @@ calendar_object_compare_by_start (gconstpointer a, gconstpointer b)
const CalendarObject *ca = a;
const CalendarObject *cb = b;
time_t diff;
-
+
diff = ca->ev_start - cb->ev_start;
return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
}
diff --git a/calendar/gui/evolution-calendar-control.c b/calendar/gui/evolution-calendar-control.c
index 028a3bc1c5..cba1180cf4 100644
--- a/calendar/gui/evolution-calendar-control.c
+++ b/calendar/gui/evolution-calendar-control.c
@@ -37,7 +37,9 @@ calendar_factory (BonoboGenericFactory *Factory, void *closure)
BonoboControl *control;
/* Create the control. */
- GnomeCalendar *cal = new_calendar ("title", NULL, NULL, NULL, 0);
+ GnomeCalendar *cal = new_calendar (full_name,
+ user_calendar_file,
+ NULL, NULL, 0);
gtk_widget_show (GTK_WIDGET (cal));
control = bonobo_control_new (GTK_WIDGET (cal));
@@ -86,6 +88,8 @@ main (int argc, char **argv)
alarm_init ();
init_calendar ();
+ /*g_log_set_always_fatal ((GLogLevelFlags) 0xFFFF);*/
+
CORBA_exception_init (&ev);
init_bonobo (argc, argv);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 7b784fc613..86655f15e5 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -282,6 +282,27 @@ gnome_calendar_load (GnomeCalendar *gcal, char *file)
return 1;
}
+int
+gnome_calendar_create (GnomeCalendar *gcal, char *file)
+{
+ g_return_val_if_fail (gcal != NULL, 0);
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
+ g_return_val_if_fail (file != NULL, 0);
+
+ /* FIXME: connect to the cal_loaded signal fo the CalClient and get the
+ * asynchronous notification properly!
+ */
+
+ /* if ((r = calendar_load (gcal->cal, file)) != NULL){ DELETE */
+ if (cal_client_create_calendar (gcal->client, file) == FALSE){
+ printf ("Error creating calendar: %s\n", file);
+ return 0;
+ }
+ gnome_calendar_update_all (gcal, NULL, 0);
+ return 1;
+}
+
+
void
gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
{
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index edc39b9676..636696e9a0 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -45,6 +45,8 @@ guint gnome_calendar_get_type (void);
GtkWidget *gnome_calendar_new (char *title);
int gnome_calendar_load (GnomeCalendar *gcal,
char *file);
+int gnome_calendar_create (GnomeCalendar *gcal,
+ char *file);
void gnome_calendar_add_object (GnomeCalendar *gcal,
iCalObject *obj);
void gnome_calendar_remove_object (GnomeCalendar *gcal,
diff --git a/calendar/gui/prop.c b/calendar/gui/prop.c
index 43b89df74a..c5169a05bd 100644
--- a/calendar/gui/prop.c
+++ b/calendar/gui/prop.c
@@ -710,8 +710,9 @@ properties (GtkWidget *toplevel)
prop_win = gnome_property_box_new ();
gtk_window_set_title (GTK_WINDOW (prop_win), _("Preferences"));
- gnome_dialog_set_parent (GNOME_DIALOG (prop_win), GTK_WINDOW (toplevel));
-
+ gnome_dialog_set_parent (GNOME_DIALOG (prop_win),
+ GTK_WINDOW (gtk_widget_get_toplevel (toplevel)));
+
create_time_display_page ();
create_colors_page ();
create_todo_page ();