[evolution-patches] Deletion of System Calendar/Tasks



Kind of hacky, but does what the address book does now.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2500.2.11
diff -u -p -r1.2500.2.11 ChangeLog
--- ChangeLog	21 Sep 2004 16:12:04 -0000	1.2500.2.11
+++ ChangeLog	22 Sep 2004 18:16:55 -0000
@@ -1,3 +1,10 @@
+2004-09-22  JP Rosevear  <jpr novell com>
+
+	* gui/calendar-component.c (fill_popup_menu_cb): ditto
+
+	* gui/tasks-component.c (fill_popup_menu_cb): don't allow a delete
+	of the system calendar
+
 2004-09-21  JP Rosevear  <jpr novell com>
  
  	Fixes #60904
Index: gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.182
diff -u -p -r1.182 calendar-component.c
--- gui/calendar-component.c	7 Aug 2004 22:32:15 -0000	1.182
+++ gui/calendar-component.c	22 Sep 2004 18:16:55 -0000
@@ -418,16 +418,22 @@ edit_calendar_cb (GtkWidget *widget, Cal
 static void
 fill_popup_menu_cb (ESourceSelector *selector, GtkMenu *menu, CalendarComponentView *component_view)
 {
-	gboolean sensitive;
-
-	sensitive = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector)) ?
-		TRUE : FALSE;
+	ESource *source;
+	gboolean sensitive, system;
+	const char *source_uri;
+	
+	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
+	sensitive =  source ? TRUE : FALSE;
 
+	/* FIXME Gross hack, should have a property or something */
+	source_uri = e_source_peek_relative_uri (source);
+	system = source_uri && !strcmp ("system", source_uri);
+	
 	add_popup_menu_item (menu, _("New Calendar"), "stock_calendar",
 			     G_CALLBACK (new_calendar_cb), component_view, TRUE);
 	add_popup_menu_item (menu, _("Copy"), "stock_folder-copy",
 			     G_CALLBACK (copy_calendar_cb), component_view, sensitive);
-	add_popup_menu_item (menu, _("Delete"), "stock_delete", G_CALLBACK (delete_calendar_cb), component_view, sensitive); 
+	add_popup_menu_item (menu, _("Delete"), "stock_delete", G_CALLBACK (delete_calendar_cb), component_view, sensitive && !system); 
 	add_popup_menu_item (menu, _("Properties..."), NULL, G_CALLBACK (edit_calendar_cb), component_view, sensitive);
 }
 
Index: gui/tasks-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-component.c,v
retrieving revision 1.73
diff -u -p -r1.73 tasks-component.c
--- gui/tasks-component.c	7 Aug 2004 22:32:15 -0000	1.73
+++ gui/tasks-component.c	22 Sep 2004 18:16:55 -0000
@@ -364,17 +364,23 @@ edit_task_list_cb (GtkWidget *widget, Ta
 static void
 fill_popup_menu_cb (ESourceSelector *selector, GtkMenu *menu, TasksComponentView *component_view)
 {
-	gboolean sensitive;
+	ESource *source;
+	gboolean sensitive, system;
+	const char *source_uri;
+	
+	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
+	sensitive =  source ? TRUE : FALSE;
 
-	sensitive = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector)) ?
-		TRUE : FALSE;
+	/* FIXME Gross hack, should have a property or something */
+	source_uri = e_source_peek_relative_uri (source);
+	system = source_uri && !strcmp ("system", source_uri);
 
 	add_popup_menu_item (menu, _("New Task List"), "stock_todo",
 			     G_CALLBACK (new_task_list_cb), component_view, TRUE);
 	add_popup_menu_item (menu, _("Copy"), "stock_folder-copy",
 			     G_CALLBACK (copy_task_list_cb), component_view, sensitive);
 	add_popup_menu_item (menu, _("Delete"), "stock_delete", G_CALLBACK (delete_task_list_cb),
-			     component_view, sensitive);
+			     component_view, sensitive && !system);
 	add_popup_menu_item (menu, _("Properties..."), NULL, G_CALLBACK (edit_task_list_cb),
 			     component_view, sensitive);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]