[evolution-patches] UI Hackfest - right click changes



hi,

 The attached patch fixes some functionality defects in the Calendar
sources view with respect to the right clicks.

I have added changes 
i) to allow the new calendar option to pop up when right clicking on a
source group or in the free area inside the view. Do not add 
options like copy, properties etc. which do not make sense of a group.
ii) let the selected source group be the default value in the source
group combo box (so one need not select it again, as they have to do it 
now)
iii) do not provide the 'new calendar' option in the rt click popup menu
on an existing source.

kindly let me know if the changes are ok and if something needs to be
added/modified.
I committed the code in as i had no other 'safe' place to put it in..
so pl. poke me soon if you want it taken out ;-)


thanks,
harish



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2565
diff -u -3 -p -u -p -r1.2565 ChangeLog
--- ChangeLog	25 Nov 2004 08:08:02 -0000	1.2565
+++ ChangeLog	25 Nov 2004 14:25:52 -0000
@@ -1,3 +1,18 @@
+2004-11-25  Harish Krishnaswamy  <kharish novell com>
+
+	* gui/calendar-component.c: 
+	(new_calendar_cb), (edit_calendar_cb): Use modified_setup_edit_calendar call.
+	(popup_event_cb): If source is null (Rt click on a source group), show the new 
+	calendar popup menu item. Else, do not show the new calendar option. 
+	* gui/dialogs/calendar-setup.[ch] (eccp_get_source_type): Compare the
+	source_groups by their uid and not the pointers, so that the correct option
+	is activated on the combo box.
+	(calendar_setup_edit_calendar) : add a source_group parameter to the function.
+	(calendar_setup_new_calendar): Use modified signature of the above function.
+	* gui/e-calendar-view.c (on_edit_appointment): check the icalcomponent
+	to see if it is a meeting and set the argument to e_calendar_view_edit_appointment
+	correctly.
+
 2004-11-25  Chenthill Palanisamy  <pchenthill novell com>
 		
 	* gui/dialogs/event-deitor.c (show_meeting): removed the
Index: gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.190
diff -u -3 -p -u -p -r1.190 calendar-component.c
--- gui/calendar-component.c	28 Oct 2004 09:26:13 -0000	1.190
+++ gui/calendar-component.c	25 Nov 2004 14:25:52 -0000
@@ -363,7 +363,7 @@ delete_calendar_cb (EPopup *ep, EPopupIt
 static void
 new_calendar_cb (EPopup *ep, EPopupItem *pitem, void *data)
 {
-	calendar_setup_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)));
+	calendar_setup_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), NULL, pitem->user_data);
 }
 
 static void
@@ -376,7 +376,7 @@ edit_calendar_cb (EPopup *ep, EPopupItem
 	if (!selected_source)
 		return;
 
-	calendar_setup_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source);
+	calendar_setup_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source, NULL);
 }
 
 static EPopupItem ecc_source_popups[] = {
@@ -412,8 +412,19 @@ popup_event_cb(ESourceSelector *selector
 	t = e_cal_popup_target_new_source(ep, selector);
 	t->target.widget = (GtkWidget *)component_view->calendar;
 
-	for (i=0;i<sizeof(ecc_source_popups)/sizeof(ecc_source_popups[0]);i++)
-		menus = g_slist_prepend(menus, &ecc_source_popups[i]);
+	if (!insource) {
+
+		ESourceGroup *group;
+
+		group = e_source_selector_get_primary_source_group (selector);
+		g_object_ref (group);
+		((EPopupItem) ecc_source_popups [0]).user_data = group;
+		menus = g_slist_prepend (menus, &ecc_source_popups [0]);
+	}
+	else {
+		for (i=1;i<sizeof(ecc_source_popups)/sizeof(ecc_source_popups[0]);i++)
+			menus = g_slist_prepend(menus, &ecc_source_popups[i]);
+	}
 
 	e_popup_add_items((EPopup *)ep, menus, ecc_source_popup_free, component_view);
 
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.69
diff -u -3 -p -u -p -r1.69 e-calendar-view.c
--- gui/e-calendar-view.c	28 Oct 2004 09:26:13 -0000	1.69
+++ gui/e-calendar-view.c	25 Nov 2004 14:25:52 -0000
@@ -995,7 +995,8 @@ on_edit_appointment (EPopup *ep, EPopupI
 
 		if (event)
 			e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
-						     event->comp_data->icalcomp, FALSE);
+						     event->comp_data->icalcomp, 
+						     icalcomponent_get_first_property(event->comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY));
 
 		g_list_free (selected);
 	}
Index: gui/dialogs/calendar-setup.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/calendar-setup.c,v
retrieving revision 1.30
diff -u -3 -p -u -p -r1.30 calendar-setup.c
--- gui/dialogs/calendar-setup.c	4 Nov 2004 04:36:49 -0000	1.30
+++ gui/dialogs/calendar-setup.c	25 Nov 2004 14:25:52 -0000
@@ -198,7 +198,7 @@ eccp_get_source_type (EConfig *ec, EConf
 
 			gtk_list_store_append (store, &iter);
 			gtk_list_store_set (store, &iter, 0, e_source_group_peek_name (group), 1, group, -1);
-			if (sdialog->source_group == group)
+			if (!strcmp (e_source_group_peek_uid (sdialog->source_group), e_source_group_peek_uid (group)))
 				active = i;
 			i++;
 		}
@@ -347,7 +347,7 @@ static ECalConfigItem ectp_items[] = {
  * Show calendar properties for @source.
  **/
 void
-calendar_setup_edit_calendar (struct _GtkWindow *parent, ESource *source)
+calendar_setup_edit_calendar (struct _GtkWindow *parent, ESource *source, ESourceGroup *group)
 {
 	CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1);
 	char *xml;
@@ -380,6 +380,8 @@ calendar_setup_edit_calendar (struct _Gt
 
 		sdialog->source_group = (ESourceGroup *)sdialog->menu_source_groups->data;
 		g_object_unref (gconf);
+		if (group)
+			sdialog->source_group = (ESourceGroup *)group;
 	}
 
 	/* HACK: doesn't work if you don't do this */
@@ -407,7 +409,7 @@ calendar_setup_edit_calendar (struct _Gt
 void
 calendar_setup_new_calendar (struct _GtkWindow *parent)
 {
-	calendar_setup_edit_calendar (parent, NULL);
+	calendar_setup_edit_calendar (parent, NULL, NULL);
 }
 
 void
Index: gui/dialogs/calendar-setup.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/calendar-setup.h,v
retrieving revision 1.2
diff -u -3 -p -u -p -r1.2 calendar-setup.h
--- gui/dialogs/calendar-setup.h	4 Nov 2004 04:36:49 -0000	1.2
+++ gui/dialogs/calendar-setup.h	25 Nov 2004 14:25:52 -0000
@@ -30,7 +30,7 @@ extern "C" {
 #pragma }
 #endif
 
-void calendar_setup_edit_calendar  (struct _GtkWindow *parent, struct _ESource *source);
+void calendar_setup_edit_calendar  (struct _GtkWindow *parent, struct _ESource *source, struct _ESourceGroup *group);
 void calendar_setup_new_calendar   (struct _GtkWindow *parent);
 
 void calendar_setup_edit_task_list (struct _GtkWindow *parent, struct _ESource *source);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/ChangeLog,v
retrieving revision 1.179
diff -u -3 -p -u -p -r1.179 ChangeLog
--- ChangeLog	5 Nov 2004 12:13:17 -0000	1.179
+++ ChangeLog	25 Nov 2004 14:46:55 -0000
@@ -1,3 +1,11 @@
+2004-11-25  Harish Krishnaswamy  <kharish novell com>
+
+	* libedataserverui/e-source-selector.[ch]:
+	(selector_button_press_event): if rt-clicked on a source 
+	group, set it as primary on the selector and emit a popup event.
+	(e_source_selector_get_primary_source_group): accessor for 
+	primary source group.
+
 2004-11-05  Rodrigo Moya <rodrigo novell com>
 
 	* configure.in: use evolution-data-server-$BASE_VERSION as the
Index: libedataserverui/e-source-selector.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-source-selector.c,v
retrieving revision 1.26
diff -u -3 -p -u -p -r1.26 e-source-selector.c
--- libedataserverui/e-source-selector.c	14 Oct 2004 17:46:37 -0000	1.26
+++ libedataserverui/e-source-selector.c	25 Nov 2004 14:46:55 -0000
@@ -42,6 +42,7 @@ struct _ESourceSelectorPrivate {
 	
 	GHashTable *selected_sources;
 	GtkTreeRowReference *saved_primary_selection;
+	ESourceGroup *primary_source_group;
 	
 	int rebuild_model_idle_id;
 
@@ -595,9 +596,15 @@ selector_button_press_event (GtkWidget *
 
 			/* TODO: we could still emit a popup event for this and let the callee decide? */
 			if (E_IS_SOURCE_GROUP (data)) {
-				g_object_unref (data);
+				/* do i need to ref it here */
+				ESourceGroup *group;
 				
-				return FALSE;
+				group = E_SOURCE_GROUP (data);g_object_ref (group);
+				priv->primary_source_group = group;
+				g_signal_emit(selector, signals[POPUP_EVENT], 0, NULL, event, &res);
+				/* data shuld be unreffed after creating the
+				 * new source*/	
+				return res;
 			}
 			
 			source = E_SOURCE (data);
@@ -827,6 +834,22 @@ e_source_selector_get_selection (ESource
 	}
 
 	return g_slist_reverse (selection_list);
+}
+
+/**
+ * e_source_selector_get_primary_source_group :
+ * 
+ * Return the primary source group associated with the selector.
+ * Return value: primary_source_group if selector is valid, NULL otherwise.
+ */
+
+ESourceGroup *
+e_source_selector_get_primary_source_group (ESourceSelector *selector)
+{
+	g_return_val_if_fail (E_IS_SOURCE_SELECTOR (selector), NULL);
+	
+	return selector->priv->primary_source_group;
+
 }
 
 /**
Index: libedataserverui/e-source-selector.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-source-selector.h,v
retrieving revision 1.9
diff -u -3 -p -u -p -r1.9 e-source-selector.h
--- libedataserverui/e-source-selector.h	21 Oct 2004 16:07:03 -0000	1.9
+++ libedataserverui/e-source-selector.h	25 Nov 2004 14:46:55 -0000
@@ -80,6 +80,7 @@ ESource *e_source_selector_peek_primary_
 void     e_source_selector_set_primary_selection   (ESourceSelector *selector,
 						    ESource         *source);
 
+ESourceGroup *e_source_selector_get_primary_source_group (ESourceSelector *selector);
 G_END_DECLS
 
 #endif /* _E_SOURCE_SELECTOR_H_ */


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