diff options
author | JP Rosevear <jpr@ximian.com> | 2004-03-24 05:51:43 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-03-24 05:51:43 +0800 |
commit | 6f309e984bbfd7b5376dd38637a55dd46d307c92 (patch) | |
tree | 8ad076c83aa48544a5fb2d51d4ba4311c04b2d36 /calendar | |
parent | e8e4e125f60b84c012ed2b1379329f73d1bb388d (diff) | |
download | gsoc2013-evolution-6f309e984bbfd7b5376dd38637a55dd46d307c92.tar.gz gsoc2013-evolution-6f309e984bbfd7b5376dd38637a55dd46d307c92.tar.zst gsoc2013-evolution-6f309e984bbfd7b5376dd38637a55dd46d307c92.zip |
Fixes #51948
2004-03-23 JP Rosevear <jpr@ximian.com>
Fixes #51948
* gui/dialogs/meeting-page.c (button_press_event): compile this
again, determine the row with a different method
(button_press_event): pass mpage
(meeting_page_construct): listen for button press event
* gui/e-meeting-list-view.c: remove commit that wasn't supposed to
go in
svn path=/trunk/; revision=25167
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 12 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 43 | ||||
-rw-r--r-- | calendar/gui/e-meeting-list-view.c | 91 |
3 files changed, 36 insertions, 110 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a0e198094c..ea422277b8 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,17 @@ 2004-03-23 JP Rosevear <jpr@ximian.com> + Fixes #51948 + + * gui/dialogs/meeting-page.c (button_press_event): compile this + again, determine the row with a different method + (button_press_event): pass mpage + (meeting_page_construct): listen for button press event + + * gui/e-meeting-list-view.c: remove commit that wasn't supposed to + go in + +2004-03-23 JP Rosevear <jpr@ximian.com> + * gui/e-calendar-view.c: make the flow control correct 2004-03-23 JP Rosevear <jpr@ximian.com> diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index 32209ccd0a..ab82e4eb93 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -653,24 +653,35 @@ static EPopupMenu context_menu[] = { E_POPUP_TERMINATOR }; -#if 0 -/* FIXME: handle context menu for treeview */ -/* handle context menu over message-list */ static gint -right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer data) +button_press_event (GtkWidget *widget, GdkEventButton *event, MeetingPage *mpage) { - MeetingPage *mpage = MEETING_PAGE (data); MeetingPagePrivate *priv; GtkMenu *menu; EMeetingAttendee *ia; - int disable_mask = 0, hide_mask = 0, view_row; - + GtkTreePath *path; + GtkTreeIter iter; + char *address; + int disable_mask = 0, hide_mask = 0; + priv = mpage->priv; - view_row = e_table_model_to_view_row (etable, row); - priv->row = e_meeting_model_etable_view_to_model_row (etable, priv->model, view_row); + /* only process right-clicks */ + if (event->button != 3 || event->type != GDK_BUTTON_PRESS) + return FALSE; - ia = e_meeting_model_find_attendee_at_row (priv->model, priv->row); + /* only if we right-click on an attendee */ + if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->list_view), event->x, event->y, &path, NULL, NULL, NULL)) + return FALSE; + if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path)) + return FALSE; + + gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1); + ia = e_meeting_store_find_attendee (priv->model, address, &priv->row); + g_free (address); + if (!ia) + return FALSE; + if (e_meeting_attendee_get_edit_level (ia) != E_MEETING_ATTENDEE_EDIT_FULL) disable_mask = CAN_DELETE; @@ -680,15 +691,13 @@ right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer da context_menu[1].pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU); - menu = e_popup_menu_create (context_menu, disable_mask, hide_mask, data); + menu = e_popup_menu_create (context_menu, disable_mask, hide_mask, mpage); e_auto_kill_popup_menu_on_selection_done (menu); - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, - event->button.button, event->button.time); + gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time); return TRUE; } -#endif /** * meeting_page_construct: @@ -770,11 +779,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems, priv->list_view = e_meeting_list_view_new (priv->model); -#if 0 - /* FIXME: handle context menu for treeview */ - g_signal_connect((real_table), - "right_click", G_CALLBACK (right_click_cb), mpage); -#endif + g_signal_connect (G_OBJECT (priv->list_view), "button_press_event", G_CALLBACK (button_press_event), mpage); gtk_widget_show (GTK_WIDGET (priv->list_view)); sw = gtk_scrolled_window_new (NULL, NULL); diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c index 90b36e9bdb..55d73a7f80 100644 --- a/calendar/gui/e-meeting-list-view.c +++ b/calendar/gui/e-meeting-list-view.c @@ -85,95 +85,7 @@ start_addressbook_server (EMeetingListView *view) return; } } -#if 0 -static void -popup_delete_cb (GtkWidget *widget, gpointer data) -{ - EMeetingListView *emlv = data; - EMeetingListViewPrivate *priv; - EMeetingAttendee *ia; - int pos = 0; - - priv = emlv->priv; - - ia = e_meeting_store_find_attendee_at_row (priv->store, priv->row); - - /* If the user deletes the attendee explicitly, assume they no - longer want the organizer showing up */ - if (ia == priv->ia) { - g_object_unref (priv->ia); - priv->ia = NULL; - } - - /* If this was a delegatee, no longer delegate */ - if (e_meeting_attendee_is_set_delfrom (ia)) { - EMeetingAttendee *ib; - - ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delfrom (ia), &pos); - if (ib != NULL) { - e_meeting_attendee_set_delto (ib, NULL); - e_meeting_attendee_set_edit_level (ib, E_MEETING_ATTENDEE_EDIT_FULL); - } - } - - /* Handle deleting all attendees in the delegation chain */ - while (ia != NULL) { - EMeetingAttendee *ib = NULL; - - g_object_ref (ia); - g_ptr_array_add (priv->deleted_attendees, ia); - e_meeting_store_remove_attendee (priv->model, ia); - - if (e_meeting_attendee_get_delto (ia) != NULL) - ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL); - ia = ib; - } -} -enum { - CAN_DELEGATE = 2, - CAN_DELETE = 4 -}; - -static gboolean -button_press_event (GtkWidget *widget, GdkEventButton *event, EMeetingListView *emlv) -{ - EMeetingListViewPrivate *priv; - GtkWidget *menu; - GtkTreePath *path; - ESource *source = NULL; - - /* only process right-clicks */ - if (event->button != 3 || event->type != GDK_BUTTON_PRESS) - return FALSE; - - priv = emlv->priv; - - /* create the menu */ - menu = gtk_menu_new (); - - view_row = e_table_model_to_view_row (etable, row); - priv->row = e_meeting_model_etable_view_to_model_row (etable, priv->model, view_row); - - ia = e_meeting_model_find_attendee_at_row (priv->model, priv->row); - if (e_meeting_attendee_get_edit_level (ia) != E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask = CAN_DELETE; - - /* FIXME: if you enable Delegate, then change index to '1'. - * (This has now been enabled). */ - /* context_menu[1].pixmap_widget = gnome_stock_new_with_icon (GNOME_STOCK_MENU_TRASH); */ - context_menu[1].pixmap_widget = - gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU); - - menu = e_popup_menu_create (context_menu, disable_mask, hide_mask, data); - e_auto_kill_popup_menu_on_selection_done (menu); - - /* popup the menu */ - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time); - - return TRUE; -} -#endif static void emlv_finalize (GObject *obj) { @@ -217,12 +129,9 @@ emlv_init (EMeetingListView *view) priv->corba_select_names = CORBA_OBJECT_NIL; start_addressbook_server (view); - -// g_signal_connect (G_OBJECT (view), "button_press_event", G_CALLBACK (button_press_event), selector); } E_MAKE_TYPE (e_meeting_list_view, "EMeetingListView", EMeetingListView, emlv_class_init, emlv_init, GTK_TYPE_TREE_VIEW); - static GList * get_type_strings () { |