[evolution-patches] Fix for gtkhtml
- From: Tor Lillqvist <tml novell com>
- To: evolution-patches gnome org
- Subject: [evolution-patches] Fix for gtkhtml
- Date: Wed, 01 Mar 2006 05:01:20 +0200
kmaraas's recent change to gtkhtml.c broke it.
This patch unbreaks it:
-- Reinstate the function get_class_properties() (although I rename it
to setup_class_properties() as its return value isn't used, it's needed
only for side effect), and reinstate the call to
setup_class_properties() in init_properties_widget().
-- Reinstate the next_uri() function which *is* used.
-- Remove the known_protocols[] array, though, which is not used.
(I still see the problem of #319407, this isn't related to that...)
--tml
? src/koe1.c
? src/libgtkhtml-3.8.pc
Index: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.616
diff -p -u -2 -r1.616 gtkhtml.c
--- src/gtkhtml.c 28 Feb 2006 20:51:54 -0000 1.616
+++ src/gtkhtml.c 1 Mar 2006 02:51:57 -0000
@@ -2317,4 +2317,39 @@ client_notify_spell_widget (GConfClient*
static void
+setup_class_properties (GtkHTML *html)
+{
+ GtkHTMLClass *klass;
+
+ klass = GTK_HTML_CLASS (GTK_WIDGET_GET_CLASS (html));
+ if (!klass->properties) {
+ klass->properties = gtk_html_class_properties_new (GTK_WIDGET (html));
+
+ if (!gconf_is_initialized ()) {
+ char *argv[] = { "gtkhtml", NULL };
+
+ g_warning ("gconf is not initialized, please call gconf_init before using GtkHTML library. "
+ "Meanwhile it's initialized by gtkhtml itself.");
+ gconf_init (1, argv, &gconf_error);
+ if (gconf_error)
+ g_error ("gconf error: %s\n", gconf_error->message);
+ }
+
+ gconf_client = gconf_client_get_default ();
+ if (!gconf_client)
+ g_error ("cannot create gconf_client\n");
+ gconf_client_add_dir (gconf_client, GTK_HTML_GCONF_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, &gconf_error);
+ if (gconf_error)
+ g_error ("gconf error: %s\n", gconf_error->message);
+ gconf_client_add_dir (gconf_client, GNOME_SPELL_GCONF_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, &gconf_error);
+ if (gconf_error)
+ g_error ("gconf error: %s\n", gconf_error->message);
+ gtk_html_class_properties_load (klass->properties, gconf_client);
+
+ if (gconf_error)
+ g_warning ("gconf error: %s\n", gconf_error->message);
+ }
+}
+
+static void
set_focus_child (GtkContainer *containter, GtkWidget *w)
{
@@ -2507,19 +2542,30 @@ drag_data_delete (GtkWidget *widget, Gdk
}
-static gchar *known_protocols [] = {
- "http://",
- "ftp://",
- "nntp://",
- "news://",
- "mailto:",
- "file:",
- NULL
-};
+static gchar *
+next_uri (guchar **uri_list, gint *len, gint *list_len)
+{
+ guchar *uri, *begin;
+
+ begin = *uri_list;
+ *len = 0;
+ while (**uri_list && **uri_list != '\n' && **uri_list != '\r' && *list_len) {
+ (*uri_list) ++;
+ (*len) ++;
+ (*list_len) --;
+ }
+
+ uri = g_strndup (begin, *len);
+
+ while ((!**uri_list || **uri_list == '\n' || **uri_list == '\r') && *list_len) {
+ (*uri_list) ++;
+ (*list_len) --;
+ }
+
+ return uri;
+}
static HTMLObject *
new_img_obj_from_uri (HTMLEngine *e, char *uri, char *title, gint len)
{
- gint i;
-
if (!strncmp (uri, "file:", 5)) {
if (!HTML_IS_PLAIN_PAINTER(e->painter)) {
@@ -3064,4 +3110,6 @@ static void
init_properties_widget (GtkHTML *html)
{
+ setup_class_properties (html);
+
if (!gconf_client)
gconf_client = gconf_client_get_default ();
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]