aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-11-04 20:43:28 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-11-04 20:43:28 +0800
commitde2131408dbcced673b45db2f57539847ba28291 (patch)
tree9364b411107a362bfd0b5f69427fe26d573faefb /calendar
parentfd52cd5eeb0f48087306d3473ef20925e27b664d (diff)
downloadgsoc2013-evolution-de2131408dbcced673b45db2f57539847ba28291.tar
gsoc2013-evolution-de2131408dbcced673b45db2f57539847ba28291.tar.gz
gsoc2013-evolution-de2131408dbcced673b45db2f57539847ba28291.tar.bz2
gsoc2013-evolution-de2131408dbcced673b45db2f57539847ba28291.tar.lz
gsoc2013-evolution-de2131408dbcced673b45db2f57539847ba28291.tar.xz
gsoc2013-evolution-de2131408dbcced673b45db2f57539847ba28291.tar.zst
gsoc2013-evolution-de2131408dbcced673b45db2f57539847ba28291.zip
added more menu items. (delete_calendar_cb): callbacks for new popup menu
2003-11-04 Rodrigo Moya <rodrigo@ximian.com> * gui/calendar-component.c (fill_popup_menu_callback): added more menu items. (delete_calendar_cb): callbacks for new popup menu items. (impl_createControls): add the source selector widget to the CalendarComponentPrivate structure. * gui/migration.[ch] (migrate_old_tasks): new function to migrate old tasks setups. (process_old_dir): renamed and added a "filename" argument, so that the same function can be used for tasks and calendar directories. (migrate_old_calendars): added new argument when calling process_old_dir(). * gui/tasks-component.c (tasks_component_init): call migrate_old_tasks() if there are no groups defined. svn path=/trunk/; revision=23181
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog25
-rw-r--r--calendar/gui/calendar-component.c66
2 files changed, 79 insertions, 12 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 7171623a22..a72010410d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,21 @@
+2003-11-04 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/calendar-component.c (fill_popup_menu_callback): added more
+ menu items.
+ (delete_calendar_cb): callbacks for new popup menu items.
+ (impl_createControls): add the source selector widget to the
+ CalendarComponentPrivate structure.
+
+ * gui/migration.[ch] (migrate_old_tasks): new function to migrate
+ old tasks setups.
+ (process_old_dir): renamed and added a "filename" argument, so that
+ the same function can be used for tasks and calendar directories.
+ (migrate_old_calendars): added new argument when calling
+ process_old_dir().
+
+ * gui/tasks-component.c (tasks_component_init): call
+ migrate_old_tasks() if there are no groups defined.
+
2003-11-04 Bolian Yin <bolian.yin@sun.com>
* gui/e-cal-view.c: add new signal "selected_time_changed"
@@ -5,8 +23,11 @@
a11y initialization
* gui/e-day-view-top-item (e_day_view_top_item_get_day_label):
new public function.
- * gui/e-day-view.c (e_day_view_ensure_rows_visible, e_day_view_update_calendar_selection_time): make static functions public
- (e_day_view_cursor_key_up, e_day_view_cursor_key_down, e_day_view_cursor_key_left, e_day_view_cursor_key_right): emit "selected_time_changed".
+ * gui/e-day-view.c (e_day_view_ensure_rows_visible,
+ e_day_view_update_calendar_selection_time): make static functions public
+ (e_day_view_cursor_key_up, e_day_view_cursor_key_down,
+ e_day_view_cursor_key_left, e_day_view_cursor_key_right): emit
+ "selected_time_changed".
2003-11-03 Ettore Perazzoli <ettore@ximian.com>
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index c9ed088e1c..8dd7865897 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -17,7 +17,8 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Author: Ettore Perazzoli <ettore@ximian.com>
+ * Authors: Ettore Perazzoli <ettore@ximian.com>
+ * Rodrigo Moya <rodrigo@ximian.com>
*/
#ifdef HAVE_CONFIG_H
@@ -38,6 +39,8 @@
#include <bonobo/bonobo-i18n.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkimagemenuitem.h>
+#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkstock.h>
#include <gal/util/e-util.h>
#include <errno.h>
@@ -55,6 +58,7 @@ struct _CalendarComponentPrivate {
GSList *source_selection;
GnomeCalendar *calendar;
+ GtkWidget *source_selector;
};
@@ -149,6 +153,47 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap,
}
static void
+delete_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
+{
+ GSList *selection, *l;
+ CalendarComponentPrivate *priv;
+
+ priv = comp->priv;
+
+ selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (priv->source_selector));
+ if (!selection)
+ return;
+
+ for (l = selection; l; l = l->next) {
+ GtkWidget *dialog;
+ ESource *selected_source = l->data;
+
+ /* create the confirmation dialog */
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (gtk_widget_get_toplevel (widget)),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ _("Calendar '%s' will be removed. Are you sure you want to continue?"),
+ e_source_peek_name (selected_source));
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) {
+ if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->source_selector),
+ selected_source))
+ e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->source_selector),
+ selected_source);
+
+ e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
+
+ /* FIXME: remove the calendar.ics file and the directory */
+ }
+
+ gtk_widget_destroy (dialog);
+ }
+
+ e_source_selector_free_selection (selection);
+}
+
+static void
new_calendar_cb (GtkWidget *widget, ESourceSelector *selector)
{
new_calendar_dialog (GTK_WINDOW (gtk_widget_get_toplevel (widget)));
@@ -157,7 +202,9 @@ new_calendar_cb (GtkWidget *widget, ESourceSelector *selector)
static void
fill_popup_menu_callback (ESourceSelector *selector, GtkMenu *menu, CalendarComponent *comp)
{
- add_popup_menu_item (menu, _("New Calendar"), NULL, G_CALLBACK (new_calendar_cb), selector);
+ add_popup_menu_item (menu, _("New Calendar"), NULL, G_CALLBACK (new_calendar_cb), comp);
+ add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_calendar_cb), comp);
+ add_popup_menu_item (menu, _("Rename"), NULL, NULL, NULL);
}
static void
@@ -249,7 +296,6 @@ impl_createControls (PortableServer_Servant servant,
{
CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
CalendarComponentPrivate *priv;
- GtkWidget *selector;
GtkWidget *selector_scrolled_window;
BonoboControl *sidebar_control;
BonoboControl *view_control;
@@ -257,11 +303,11 @@ impl_createControls (PortableServer_Servant servant,
priv = calendar_component->priv;
/* Create sidebar selector */
- selector = e_source_selector_new (calendar_component->priv->source_list);
- gtk_widget_show (selector);
+ priv->source_selector = e_source_selector_new (calendar_component->priv->source_list);
+ gtk_widget_show (priv->source_selector);
selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (selector_scrolled_window), selector);
+ gtk_container_add (GTK_CONTAINER (selector_scrolled_window), priv->source_selector);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window),
@@ -296,17 +342,17 @@ impl_createControls (PortableServer_Servant servant,
g_signal_connect (view_control, "activate", G_CALLBACK (control_activate_cb), priv->calendar);
- g_signal_connect_object (selector, "selection_changed",
+ g_signal_connect_object (priv->source_selector, "selection_changed",
G_CALLBACK (source_selection_changed_callback),
G_OBJECT (calendar_component), 0);
- g_signal_connect_object (selector, "primary_selection_changed",
+ g_signal_connect_object (priv->source_selector, "primary_selection_changed",
G_CALLBACK (primary_source_selection_changed_callback),
G_OBJECT (calendar_component), 0);
- g_signal_connect_object (selector, "fill_popup_menu",
+ g_signal_connect_object (priv->source_selector, "fill_popup_menu",
G_CALLBACK (fill_popup_menu_callback),
G_OBJECT (calendar_component), 0);
- update_uris_for_selection (E_SOURCE_SELECTOR (selector), calendar_component);
+ update_uris_for_selection (E_SOURCE_SELECTOR (priv->source_selector), calendar_component);
*corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev);
*corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev);