[evolution-patches] Re: evolution-patches Digest, Vol 1, Issue 1842
- From: ganesh <rganesan novell com>
- To: sraghavan novell com
- Cc: evolution-patches lists ximian com
- Subject: [evolution-patches] Re: evolution-patches Digest, Vol 1, Issue 1842
- Date: Tue, 31 May 2005 15:46:11 +0530
Could you commit this to HEAD ?
Ganesh.
------------------------------
Message: 4
Date: Mon, 30 May 2005 01:48:21 -0600
From: "Srinivasa Ragavan" <sragavan novell com>
Subject: [evolution-patches] Patch to fix DnD to composer
To: <evolution-patches lists ximian com>
Message-ID: <s29a70ef 032 sinclair provo novell com>
Content-Type: text/plain; charset="us-ascii"
Hi,
I have attached the patch, which fixes the bug, when a url is dropped to the composer(gtkhtml) window, it pastes.
I added a new bonobo-interface to get the widget and listen for dnd signals. It currently pastes the dnd except, url, file, evo items (cal, contact, task).
The patch has two parts. One to evoltion and other to gtkhtml.
Please review it.
Thanks
Srini.
-------------- next part --------------
Index: e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.508
diff -u -p -r1.508 e-msg-composer.c
--- e-msg-composer.c 23 May 2005 07:10:03 -0000 1.508
+++ e-msg-composer.c 30 May 2005 07:09:57 -0000
@@ -2914,9 +2914,10 @@ drop_popup_free(EPopup *ep, GSList *item
}
static void
-drag_data_received (EMsgComposer *composer, GdkDragContext *context,
+drag_data_received (GtkWidget *w, GdkDragContext *context,
int x, int y, GtkSelectionData *selection,
- guint info, guint time)
+ guint info, guint time,
+ EMsgComposer *composer)
{
if (selection->data == NULL || selection->length == -1)
return;
@@ -3362,6 +3363,7 @@ create_composer (int visible_mask)
int vis;
GList *icon_list;
BonoboControlFrame *control_frame;
+ GtkWidget *html_widget;
composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL);
gtk_window_set_title ((GtkWindow *) composer, _("Compose a message"));
@@ -3385,7 +3387,7 @@ create_composer (int visible_mask)
/* DND support */
gtk_drag_dest_set (GTK_WIDGET (composer), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY|GDK_ACTION_ASK|GDK_ACTION_MOVE);
- g_signal_connect(composer, "drag_data_received", G_CALLBACK (drag_data_received), NULL);
+ g_signal_connect(composer, "drag_data_received", G_CALLBACK (drag_data_received), composer);
g_signal_connect(composer, "drag-motion", G_CALLBACK(drag_motion), composer);
e_msg_composer_load_config (composer, visible_mask);
@@ -3515,6 +3517,14 @@ create_composer (int visible_mask)
e_error_run (GTK_WINDOW (composer), "mail-composer:no-editor-control", NULL);
gtk_object_destroy (GTK_OBJECT (composer));
return NULL;
+ }
+
+ CORBA_exception_init (&ev);
+ html_widget = GNOME_GtkHTML_Editor_Engine_getWidget(composer->editor_engine, &ev);
+ CORBA_exception_free (&ev);
+
+ if (html_widget) {
+ g_signal_connect (html_widget, "drag_data_received", G_CALLBACK (drag_data_received), composer);
}
setup_cut_copy_paste (composer);
-------------- next part --------------
Index: components/html-editor/Editor.idl
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/Editor.idl,v
retrieving revision 1.7
diff -u -p -r1.7 Editor.idl
--- components/html-editor/Editor.idl 13 Feb 2002 15:52:09 -0000 1.7
+++ components/html-editor/Editor.idl 30 May 2005 07:08:06 -0000
@@ -90,6 +90,11 @@ module Editor {
* is there any undo event in undo queue?
*/
boolean hasUndo ();
+
+ /*
+ * Gets the html widget
+ */
+ any getWidget ();
};
struct URLRequestEvent {
Index: components/html-editor/engine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/engine.c,v
retrieving revision 1.26
diff -u -p -r1.26 engine.c
--- components/html-editor/engine.c 17 May 2005 14:48:59 -0000 1.26
+++ components/html-editor/engine.c 30 May 2005 07:08:07 -0000
@@ -226,6 +226,14 @@ impl_drop_undo (PortableServer_Servant s
gtk_html_drop_undo (e->cd->html);
}
+static CORBA_any *
+impl_get_widget (PortableServer_Servant servant, CORBA_Environment * ev)
+{
+ EditorEngine *e = html_editor_engine_from_servant (servant);
+
+ return (CORBA_any *) e->cd->html;
+}
+
static void
engine_object_finalize (GObject *object)
{
@@ -270,6 +278,7 @@ editor_engine_class_init (EditorEngineCl
epv->ignoreWord = impl_ignore_word;
epv->hasUndo = impl_has_undo;
epv->dropUndo = impl_drop_undo;
+ epv->getWidget = impl_get_widget;
}
BONOBO_TYPE_FUNC_FULL (
Index: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.602
diff -u -p -r1.602 gtkhtml.c
--- src/gtkhtml.c 17 May 2005 14:47:36 -0000 1.602
+++ src/gtkhtml.c 30 May 2005 07:08:08 -0000
@@ -76,8 +76,12 @@
#include <libgnome/gnome-util.h>
enum DndTargetType {
+ DND_TARGET_TYPE_MESSAGE_RFC822,
+ DND_TARGET_TYPE_X_UID_LIST,
DND_TARGET_TYPE_TEXT_URI_LIST,
DND_TARGET_TYPE_MOZILLA_URL,
+ DND_TARGET_TYPE_TEXT_VCARD,
+ DND_TARGET_TYPE_TEXT_CALENDAR,
DND_TARGET_TYPE_TEXT_HTML,
DND_TARGET_TYPE_UTF8_STRING,
DND_TARGET_TYPE_TEXT_PLAIN,
@@ -85,8 +89,12 @@ enum DndTargetType {
};
static GtkTargetEntry dnd_link_sources [] = {
+ { "message/rfc822", 0, DND_TARGET_TYPE_MESSAGE_RFC822 },
+ { "x-uid-list", 0, DND_TARGET_TYPE_X_UID_LIST },
{ "text/uri-list", 0, DND_TARGET_TYPE_TEXT_URI_LIST },
- { "text/x-moz-url", 0, DND_TARGET_TYPE_MOZILLA_URL },
+ { "_NETSCAPE_URL", 0, DND_TARGET_TYPE_MOZILLA_URL },
+ { "text/x-vcard", 0, DND_TARGET_TYPE_TEXT_VCARD },
+ { "text/calendar", 0, DND_TARGET_TYPE_TEXT_CALENDAR },
{ "text/html", 0, DND_TARGET_TYPE_TEXT_HTML },
{ "UTF8_STRING", 0, DND_TARGET_TYPE_UTF8_STRING },
{ "text/plain", 0, DND_TARGET_TYPE_TEXT_PLAIN },
@@ -2161,6 +2169,7 @@ selection_received (GtkWidget *widget,
&& (selection_data->type != GDK_SELECTION_TYPE_STRING)
&& (selection_data->type != gdk_atom_intern ("COMPOUND_TEXT", FALSE))
&& (selection_data->type != gdk_atom_intern ("TEXT", FALSE))
+ && (selection_data->type != gdk_atom_intern ("text/plain", FALSE))
&& (selection_data->type != gdk_atom_intern ("text/html", FALSE))) {
g_warning ("Selection \"STRING\" was not returned as strings!\n");
} else if (selection_data->length > 0) {
@@ -2657,62 +2666,8 @@ drag_data_received (GtkWidget *widget, G
selection_received (widget, selection_data, time);
pasted = TRUE;
break;
- case DND_TARGET_TYPE_MOZILLA_URL : {
- HTMLObject *obj;
- char *utf8, *title;
-
- /* MOZ_URL is in UCS-2 but in format 8. BROKEN!
- *
- * The data contains the URL, a \n, then the
- * title of the web page.
- */
-
- if (selection_data->format != 8 ||
- selection_data->length == 0 ||
- (selection_data->length % 2) != 0) {
- g_printerr (_("Mozilla url dropped on Composer had wrong format (%d) or length (%d)\n"),
- selection_data->format,
- selection_data->length);
- /* get out of the switch */
- break;
- }
-
- utf8 = ucs2_to_utf8_with_bom_check (selection_data->data, selection_data->length);
- title = strchr (utf8, '\n');
- if (title) {
- *title = 0;
- title ++;
- }
-
- html_undo_level_begin (engine->undo, "Dropped URI(s)", "Remove Dropped URI(s)");
-
- obj = new_obj_from_uri (engine, utf8, (HTML_IS_PLAIN_PAINTER (engine->painter) && context->action <= GDK_ACTION_COPY) ? utf8 : title, -1);
- if (obj) {
- html_engine_paste_object (engine, obj, html_object_get_length (obj));
- pasted = TRUE;
- }
- html_undo_level_end (engine->undo);
- g_free (utf8);
- }
- break;
-
- case DND_TARGET_TYPE_TEXT_URI_LIST: {
- HTMLObject *obj;
- gint list_len, len;
- gchar *uri;
-
- html_undo_level_begin (engine->undo, "Dropped URI(s)", "Remove Dropped URI(s)");
- list_len = selection_data->length;
- do {
- uri = next_uri (&selection_data->data, &len, &list_len);
- obj = new_obj_from_uri (engine, uri, NULL, -1);
- if (obj) {
- html_engine_paste_object (engine, obj, html_object_get_length (obj));
- pasted = TRUE;
- }
- } while (list_len);
- html_undo_level_end (engine->undo);
- }
+ case DND_TARGET_TYPE_MOZILLA_URL :
+ case DND_TARGET_TYPE_TEXT_URI_LIST:
break;
}
gtk_drag_finish (context, pasted, FALSE, time);
------------------------------
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]