Re: Mozilla selections question

Philip <[email protected]>
Newsgroups gmane.comp.mozilla.devel.gtk
Organization Telenet Internet
Message-ID <[email protected]>
Havoc Pennington wrote:


> You want to ask for a different target type, rather than the text
> target. gtk_clipboard_request_contents() takes a "target" argument,
> that's what you need to change.
> 
> To get the available targets, ask for the special TARGETS target. See
> gtkentry.c in GTK 2.0 for an example.
> 
> 

Indeed, I found  that already using a small application called GClipper
which does exactly that.. I guess the target for the HTML-text is
"text/html" but when I change the target to that I only get the character
"<" as selection-data :


In a function that loads the preferences : mwin->selection =
gdk_atom_intern ("CLIPBOARD", FALSE); or
mwin->selection = GDK_SELECTION_PRIMARY;

...

In a function called "Get new selection" :

 targets_atom = gdk_atom_intern ("text/html", FALSE);
  do
  {
    convert_successfull = gtk_selection_convert (
	GTK_WIDGET(mwin), mwin->selection, targets_atom, GDK_CURRENT_TIME);
    /* Let Gtk process all the pending events before continuing. */
    while(gtk_events_pending())
    {
       gtk_main_iteration();
    }
  } while(!convert_successfull);



"on mwin selection received"   (GtkWidget       *widget,
      			GtkSelectionData *data,
			guint            time,
			MainWin          *mwin)
{

	data->data is now just "<"
}
}

Also, when I make a small application that loops all targets and
g_print()'s all the target->data's then I don't see any HTML (I do see
text in the target's called COMPOUND_TEXT and TEXT and ... but nothing in
the text/html; etc

These are the targets that I have tried :

COMPOUND_TEXT : Plain text presentation of the HTML-document MULTIPLE :
Nothing
STRING :  Plain text
TARGETS : The list of available targets TEXT : Plain text (with some stuff
missing like ^(TM)) TIMESTAMP : 0
UTF8_STRING : Plain text
text/_moz_htmlcontext : "<"
text_moz_htmlinfo : 1
text/html : Nothing or "<" sometimes
text/unicode : \n




-- 
Philip van Hoof aka freax (http://www.freax.eu.org)
irc: irc.openprojects.net mailto:freax @ linux.be
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.