[evolution-patches] Calendar patch for e-text context menus



This patch makes events show context menus if you right-click while
editing them in any of the views. The context menu comes from e-text and
lets you set input method and cut/paste text.

It also makes the calendar not crash on startup (fixes #41641).

Note that text cut/paste does not work in the day/work week views yet -
there's some weirdness going on with the signals there. I'll work out a
separate patch for that.

-- 
Hans Petter
? evolution-trunk-calendar-etext-popup.patch
? log
Index: gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.185
diff -u -p -r1.185 e-day-view.c
--- gui/e-day-view.c	15 Apr 2003 22:26:10 -0000	1.185
+++ gui/e-day-view.c	23 Apr 2003 00:47:37 -0000
@@ -1433,14 +1433,6 @@ e_day_view_focus_in (GtkWidget *widget, 
 	gtk_widget_queue_draw (day_view->top_canvas);
 	gtk_widget_queue_draw (day_view->main_canvas);
 
-	g_assert (GTK_WIDGET_REALIZED (day_view->main_canvas));
-#if 0
-	/* FIXME when gal is fixed */
-	if (E_CANVAS (day_view->main_canvas)->ic)
-		gdk_im_begin (E_CANVAS (day_view->main_canvas)->ic,
-			      GTK_LAYOUT (day_view->main_canvas)->bin_window);
-#endif
-
 	return FALSE;
 }
 
@@ -1461,14 +1453,6 @@ e_day_view_focus_out (GtkWidget *widget,
 	gtk_widget_queue_draw (day_view->top_canvas);
 	gtk_widget_queue_draw (day_view->main_canvas);
 
-	g_assert (GTK_WIDGET_REALIZED (day_view->main_canvas));
-
-#if 0
-	/* FIXME when gal is fixed */
-	if (E_CANVAS (day_view->main_canvas)->ic)
-		gdk_im_end ();
-#endif
-
 	return FALSE;
 }
 
@@ -5269,6 +5253,7 @@ e_day_view_reshape_long_event (EDayView 
 					       "use_ellipsis", TRUE,
 					       "draw_background", FALSE,
 					       "fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
+					       "im_context", E_CANVAS (day_view->top_canvas)->im_context,
 					       NULL);
 		g_signal_connect (event->canvas_item, "event",
 				  G_CALLBACK (e_day_view_on_text_item_event), day_view);
@@ -5426,6 +5411,7 @@ e_day_view_reshape_day_event (EDayView *
 						       "use_ellipsis", TRUE,
 						       "draw_background", FALSE,
 						       "fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
+						       "im_context", E_CANVAS (day_view->main_canvas)->im_context,
 						       NULL);
 			g_signal_connect (event->canvas_item, "event",
 					  G_CALLBACK (e_day_view_on_text_item_event), day_view);
@@ -6177,6 +6163,8 @@ e_day_view_on_editing_started (EDayView 
 		e_day_view_reshape_main_canvas_resize_bars (day_view);
 	}
 
+	g_object_set (item, "handle_popup", TRUE, NULL);
+
 	gtk_signal_emit (GTK_OBJECT (day_view),
 			 e_day_view_signals[SELECTION_CHANGED]);
 }
@@ -6226,6 +6214,7 @@ e_day_view_on_editing_stopped (EDayView 
 	day_view->resize_bars_event_day = -1;
 	day_view->resize_bars_event_num = -1;
 
+	g_object_set (event->canvas_item, "handle_popup", FALSE, NULL);
 	g_object_get (G_OBJECT (event->canvas_item),
 		      "text", &text,
 		      NULL);
Index: gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.156
diff -u -p -r1.156 e-week-view.c
--- gui/e-week-view.c	15 Apr 2003 22:26:10 -0000	1.156
+++ gui/e-week-view.c	23 Apr 2003 00:47:39 -0000
@@ -2750,6 +2750,7 @@ e_week_view_reshape_event_span (EWeekVie
 					       "text", text.value ? text.value : "",
 					       "use_ellipsis", TRUE,
 					       "fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
+					       "im_context", E_CANVAS (week_view->main_canvas)->im_context,
 					       NULL);
 		g_signal_connect (span->text_item, "event",
 				  G_CALLBACK (e_week_view_on_text_item_event),
@@ -3100,7 +3101,7 @@ e_week_view_on_text_item_event (GnomeCan
 						       &event_num, &span_num))
 			return FALSE;
 
-		if (gdkevent->button.button == 3) {
+		if (gdkevent->button.button == 3 && !E_TEXT (item)->editing) {
 			EWeekViewEvent *e;
 			gboolean destroyed;
 
@@ -3127,8 +3128,10 @@ e_week_view_on_text_item_event (GnomeCan
 			return TRUE;
 		}
 
-		week_view->pressed_event_num = event_num;
-		week_view->pressed_span_num = span_num;
+		if (gdkevent->button.button != 3) {
+			week_view->pressed_event_num = event_num;
+			week_view->pressed_span_num = span_num;
+		}
 
 		/* Only let the EText handle the event while editing. */
 		if (!E_TEXT (item)->editing) {
@@ -3214,6 +3217,8 @@ e_week_view_on_editing_started (EWeekVie
 						span_num);
 	}
 
+	g_object_set (item, "handle_popup", TRUE, NULL);
+
 	gtk_signal_emit (GTK_OBJECT (week_view),
 			 e_week_view_signals[SELECTION_CHANGED]);
 }
@@ -3252,6 +3257,7 @@ e_week_view_on_editing_stopped (EWeekVie
 	if (!uid)
 		return;
 
+	g_object_set (span->text_item, "handle_popup", FALSE, NULL);
 	g_object_get (G_OBJECT (span->text_item), "text", &text, NULL);
 	g_assert (text != NULL);
 


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