[evolution-patches] Re: [Calendar] Edit button - Attendees - Implementation



Hi

Sending a updated patch for edit button implementation

Please review.

Thanks
Johnny

On 1/10/06, Johnny Jacob <johnnyjacob gmail com> wrote:
> Hi
>
> Implemented Edit button for attendees in event-page
>
> Please review
>
> Thanks
> Johnny
>
>
>
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2940
diff -u -p -r1.2940 ChangeLog
--- calendar/ChangeLog	16 Jan 2006 05:47:06 -0000	1.2940
+++ calendar/ChangeLog	16 Jan 2006 11:39:26 -0000
@@ -1,3 +1,15 @@
+2006-01-10  Johnny Jacob <johnnyjacob gmail com>
+
+	* gui/dialogs/event-page.c (edit_button_cb): Added.
+	edit the selected attendee.
+	(sensitize_widgets) : enable/disable edit button and 
+	Attendee list view.
+	(button_press_event) : don't popup the menu if editing is
+	disabled.
+	(get_widgets) : get and connect signals for edit button
+	* gui/e-meetings-list-view.ch (e_meeting_list_view_set_editable ) :
+	Added. set/unset the editable property of list view.
+
 2006-01-16 P S Chakravarthi <pchakravarthi novell com>
 
 	Minor Feature: Reply and Reply all for calendar items of clients
Index: calendar/gui/e-meeting-list-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-list-view.h,v
retrieving revision 1.4
diff -u -p -r1.4 e-meeting-list-view.h
--- calendar/gui/e-meeting-list-view.h	15 Dec 2005 07:46:25 -0000	1.4
+++ calendar/gui/e-meeting-list-view.h	16 Jan 2006 11:40:03 -0000
@@ -63,6 +63,7 @@ void       e_meeting_list_view_edit (EMe
 void       e_meeting_list_view_invite_others_dialog (EMeetingListView *emlv);
 void	   e_meeting_list_view_remove_attendee_from_name_selector (EMeetingListView *view, EMeetingAttendee *ma);
 void       e_meeting_list_view_add_attendee_to_name_selector (EMeetingListView *view, EMeetingAttendee *ma);
+void       e_meeting_list_view_set_editable (EMeetingListView *lview, gboolean set);
 
 G_END_DECLS
 
Index: calendar/gui/e-meeting-list-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-list-view.c,v
retrieving revision 1.25
diff -u -p -r1.25 e-meeting-list-view.c
--- calendar/gui/e-meeting-list-view.c	22 Dec 2005 10:12:06 -0000	1.25
+++ calendar/gui/e-meeting-list-view.c	16 Jan 2006 11:40:10 -0000
@@ -851,3 +851,24 @@ e_meeting_list_view_invite_others_dialog
 	dialog = e_name_selector_peek_dialog (view->priv->name_selector);
 	gtk_widget_show (GTK_WIDGET (dialog));
 }
+
+void 
+e_meeting_list_view_set_editable (EMeetingListView *lview, gboolean set)
+{
+	GtkCellRenderer *renderer;
+	EMeetingListViewPrivate *priv;
+
+	priv = lview->priv;
+
+	gint edit_level = set;
+
+	g_hash_table_foreach (priv->renderers, change_edit_cols_for_organizer, GINT_TO_POINTER (edit_level));
+}
+
+static void   
+set_editable (gpointer key, gpointer value, gpointer user_data)
+{
+       GtkCellRenderer *renderer = (GtkCellRenderer *) value;
+       guint edit_level = GPOINTER_TO_INT (user_data); 
+       g_object_set (G_OBJECT (renderer), "editable", GINT_TO_POINTER (edit_level), NULL);
+}
Index: calendar/gui/dialogs/event-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.c,v
retrieving revision 1.100
diff -u -p -r1.100 event-page.c
--- calendar/gui/dialogs/event-page.c	13 Jan 2006 10:31:05 -0000	1.100
+++ calendar/gui/dialogs/event-page.c	16 Jan 2006 11:40:31 -0000
@@ -835,6 +835,8 @@ sensitize_widgets (EventPage *epage)
 
 	gtk_widget_set_sensitive (priv->organizer, !read_only);
 	gtk_widget_set_sensitive (priv->add, (!read_only &&  sens) || delegate);
+	gtk_widget_set_sensitive (priv->edit, (!read_only && sens) || delegate);
+	e_meeting_list_view_set_editable (priv->list_view, (!read_only && sens) || delegate);
 	gtk_widget_set_sensitive (priv->remove, (!read_only &&  sens) || delegate);
 	gtk_widget_set_sensitive (priv->invite, (!read_only &&  sens) || delegate);
 	gtk_widget_set_sensitive (GTK_WIDGET (priv->list_view), !read_only);	
@@ -968,7 +970,7 @@ event_page_fill_widgets (CompEditorPage 
 	epage = EVENT_PAGE (page);
 	priv = epage->priv;
 
-	if (!e_cal_component_has_organizer (comp)) 
+	if (!e_cal_component_has_organizer (comp))
 		page->flags |= COMP_EDITOR_PAGE_USER_ORG;
 
 	/* Don't send off changes during this time */
@@ -1034,6 +1036,7 @@ event_page_fill_widgets (CompEditorPage 
 								CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
 					gtk_widget_set_sensitive (priv->invite, FALSE);
 					gtk_widget_set_sensitive (priv->add, FALSE);
+					gtk_widget_set_sensitive (priv->edit, FALSE);
 					gtk_widget_set_sensitive (priv->remove, FALSE);
 					priv->user_org = FALSE;
 				}
@@ -1650,6 +1653,27 @@ static hour_minute_changed ( EventPage *
 }
 
 static void
+edit_clicked_cb (GtkButton *btn, EventPage *epage)
+{
+	EventPagePrivate *priv;
+	EMeetingAttendee *attendee;
+	GtkTreePath *path = NULL;
+	GtkTreeViewColumn *focus_col;
+	gint row = 0;
+	
+	priv = epage->priv;
+
+	gtk_tree_view_get_cursor (GTK_TREE_VIEW (priv->list_view), &path, NULL);
+	g_return_if_fail (path != NULL);
+
+	row = gtk_tree_path_get_indices (path)[0];
+
+	gtk_tree_view_get_cursor (GTK_TREE_VIEW (priv->list_view), &path, &focus_col);
+	gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->list_view), path, focus_col, TRUE);
+	gtk_tree_path_free (path);
+}
+
+static void
 add_clicked_cb (GtkButton *btn, EventPage *epage)
 {
 	EMeetingAttendee *attendee;
@@ -1833,6 +1857,7 @@ attendee_added_cb (EMeetingListView *eml
 
 			   gtk_widget_set_sensitive (priv->invite, FALSE);
 			   gtk_widget_set_sensitive (priv->add, FALSE);
+			   gtk_widget_set_sensitive (priv->edit, FALSE);
 		   }
 	   }
    }
@@ -1868,7 +1893,7 @@ enum {
 
 static EPopupItem context_menu_items[] = {
 	{ E_POPUP_ITEM, "10.delete", N_("_Remove"), popup_delete_cb, NULL, GTK_STOCK_REMOVE, ATTENDEE_CAN_DELETE },
-	{ E_POPUP_ITEM, "15.add", N_("_Add "), popup_add_cb, NULL, GTK_STOCK_ADD },	
+	{ E_POPUP_ITEM, "15.add", N_("_Add "), popup_add_cb, NULL, GTK_STOCK_ADD, ATTENDEE_CAN_ADD },	
 };
 
 static void
@@ -1890,7 +1915,6 @@ button_press_event (GtkWidget *widget, G
 	GSList *menus = NULL;
 	ECalPopup *ep;
 	int i;
-
 	priv = epage->priv;
 
 	/* only process right-clicks */
@@ -2190,6 +2214,7 @@ get_widgets (EventPage *epage)
 	priv->invite = GW ("invite");
 	priv->add = GW ("add-attendee");
 	priv->remove = GW ("remove-attendee");
+	priv->edit = GW ("edit-attendee");
 	priv->list_box = GW ("list-box");
 	
 	priv->calendar_label = GW ("calendar-label");
@@ -2820,6 +2845,9 @@ init_widgets (EventPage *epage)
 
 	/* Remove attendee button */
 	g_signal_connect (priv->remove, "clicked", G_CALLBACK (remove_clicked_cb), epage);
+
+	/* Edit attendee button */
+	g_signal_connect (priv->edit, "clicked", G_CALLBACK (edit_clicked_cb), epage);
 
 	/* Contacts button */
 	g_signal_connect(priv->invite, "clicked", G_CALLBACK (invite_cb), epage);	


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