~ubuntu-branches/ubuntu/precise/gtkhtml4.0/precise-proposed

« back to all changes in this revision

Viewing changes to gtkhtml/gtkhtml.c

  • Committer: Ken VanDine
  • Date: 2011-06-24 16:38:18 UTC
  • mfrom: (3.1.7 gtkhtml4.0)
  • Revision ID: ken.vandine@canonical.com-20110624163818-pemvs906ip0y1vvw
Tags: 4.1.2-0ubuntu1
releasing version 4.1.2-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
788
788
                html->ibeam_cursor = NULL;
789
789
        }
790
790
 
791
 
        if (html->priv) {
792
 
                gtk_scrollable_set_hadjustment (GTK_SCROLLABLE (html), NULL);
793
 
                gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (html), NULL);
794
 
 
795
 
                hadjustment_notify_cb (html);
796
 
                vadjustment_notify_cb (html);
797
 
 
798
 
                g_signal_handlers_disconnect_by_func (html, hadjustment_notify_cb, NULL);
799
 
                g_signal_handlers_disconnect_by_func (html, vadjustment_notify_cb, NULL);
800
 
 
801
 
                if (html->priv->idle_handler_id != 0) {
802
 
                        g_source_remove (html->priv->idle_handler_id);
803
 
                        html->priv->idle_handler_id = 0;
804
 
                }
805
 
 
806
 
                if (html->priv->scroll_timeout_id != 0) {
807
 
                        g_source_remove (html->priv->scroll_timeout_id);
808
 
                        html->priv->scroll_timeout_id = 0;
809
 
                }
810
 
 
811
 
                if (html->priv->notify_monospace_font_id) {
812
 
                        gconf_client_notify_remove (
813
 
                                gconf_client_get_default (),
814
 
                                html->priv->notify_monospace_font_id);
815
 
                        html->priv->notify_monospace_font_id = 0;
816
 
                }
817
 
 
818
 
                if (html->priv->resize_cursor) {
819
 
                        g_object_unref (html->priv->resize_cursor);
820
 
                        html->priv->resize_cursor = NULL;
821
 
                }
822
 
 
823
 
                if (html->priv->im_context) {
824
 
                        g_object_unref (html->priv->im_context);
825
 
                        html->priv->im_context = NULL;
826
 
                }
827
 
 
828
 
                g_free (html->priv->base_url);
829
 
                g_free (html->priv->caret_first_focus_anchor);
830
 
                g_free (html->priv);
831
 
                html->priv = NULL;
832
 
        }
 
791
        gtk_scrollable_set_hadjustment (GTK_SCROLLABLE (html), NULL);
 
792
        gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (html), NULL);
 
793
 
 
794
        hadjustment_notify_cb (html);
 
795
        vadjustment_notify_cb (html);
 
796
 
 
797
        g_signal_handlers_disconnect_by_func (html, hadjustment_notify_cb, NULL);
 
798
        g_signal_handlers_disconnect_by_func (html, vadjustment_notify_cb, NULL);
 
799
 
 
800
        if (html->priv->idle_handler_id != 0) {
 
801
                g_source_remove (html->priv->idle_handler_id);
 
802
                html->priv->idle_handler_id = 0;
 
803
        }
 
804
 
 
805
        if (html->priv->scroll_timeout_id != 0) {
 
806
                g_source_remove (html->priv->scroll_timeout_id);
 
807
                html->priv->scroll_timeout_id = 0;
 
808
        }
 
809
 
 
810
        if (html->priv->notify_monospace_font_id) {
 
811
                gconf_client_notify_remove (
 
812
                        gconf_client_get_default (),
 
813
                        html->priv->notify_monospace_font_id);
 
814
                html->priv->notify_monospace_font_id = 0;
 
815
        }
 
816
 
 
817
        if (html->priv->resize_cursor) {
 
818
                g_object_unref (html->priv->resize_cursor);
 
819
                html->priv->resize_cursor = NULL;
 
820
        }
 
821
 
 
822
        if (html->priv->im_context) {
 
823
                g_object_unref (html->priv->im_context);
 
824
                html->priv->im_context = NULL;
 
825
        }
 
826
 
 
827
        g_free (html->priv->base_url);
 
828
        html->priv->base_url = NULL;
 
829
 
 
830
        g_free (html->priv->caret_first_focus_anchor);
 
831
        html->priv->caret_first_focus_anchor = NULL;
833
832
 
834
833
        if (html->engine) {
835
 
                g_object_unref (G_OBJECT (html->engine));
 
834
                g_object_unref (html->engine);
836
835
                html->engine = NULL;
837
836
        }
838
837
 
970
969
        }
971
970
 
972
971
        html_font_manager_set_default (&painter->font_manager,
973
 
                                       (gchar *)font_var, (gchar *)fixed_family,
 
972
                                       (gchar *) font_var, (gchar *) fixed_family,
974
973
                                       font_var_size, font_var_points,
975
974
                                       fixed_size, fixed_points);
976
975
        if (fixed_desc)
2348
2347
                        GString *buffer;
2349
2348
 
2350
2349
                        state = html_engine_save_buffer_new (html->engine, TRUE);
2351
 
                        buffer = (GString *)state->user_data;
 
2350
                        buffer = (GString *) state->user_data;
2352
2351
 
2353
2352
                        html_object_save (selection_object, state);
2354
2353
                        g_string_append_unichar (buffer, 0x0000);
2883
2882
        gchar *filename;
2884
2883
        GConfClient *client;
2885
2884
 
 
2885
        g_type_class_add_private (klass, sizeof (GtkHTMLPrivate));
 
2886
 
2886
2887
        html_class = (GtkHTMLClass *) klass;
2887
2888
        object_class = (GObjectClass *) klass;
2888
2889
        widget_class = (GtkWidgetClass *) klass;
3490
3491
        html->in_selection = FALSE;
3491
3492
        html->in_selection_drag = FALSE;
3492
3493
 
3493
 
        html->priv = g_new0 (GtkHTMLPrivate, 1);
 
3494
        html->priv = G_TYPE_INSTANCE_GET_PRIVATE (
 
3495
                html, GTK_TYPE_HTML, GtkHTMLPrivate);
 
3496
 
3494
3497
        html->priv->idle_handler_id = 0;
3495
3498
        html->priv->scroll_timeout_id = 0;
3496
3499
        html->priv->skip_update_cursor = FALSE;
4373
4376
void
4374
4377
gtk_html_indent_push_level (GtkHTML *html, HTMLListType level_type)
4375
4378
{
4376
 
        guint8 type = (guint8)level_type;
 
4379
        guint8 type = (guint8) level_type;
4377
4380
        gtk_html_modify_indent_by_delta (html, +1, &type);
4378
4381
}
4379
4382
 
4476
4479
                gtk_selection_data_set (selection_data,
4477
4480
                                        gdk_atom_intern ("text/html", FALSE), 8,
4478
4481
                                        (const guchar *) contents->html_text,
4479
 
                                        (gint )strlen (contents->html_text));
 
4482
                                        (gint ) strlen (contents->html_text));
4480
4483
        } else if (contents->plain_text) {
4481
4484
                gtk_selection_data_set_text (selection_data,
4482
4485
                                             contents->plain_text,
4483
 
                                             (gint )strlen (contents->plain_text));
 
4486
                                             (gint ) strlen (contents->plain_text));
4484
4487
        }
4485
4488
}
4486
4489
 
6192
6195
        html_image_factory_move_images (html->engine->image_factory, tmp->engine->image_factory);
6193
6196
 
6194
6197
        /* copy the forms */
6195
 
        g_list_foreach (tmp->engine->formList, (GFunc)html_form_set_engine, html->engine);
 
6198
        g_list_foreach (tmp->engine->formList, (GFunc) html_form_set_engine, html->engine);
6196
6199
 
6197
6200
        /* move top level iframes and embedded widgets from tmp to html */
6198
6201
        html_object_forall (tmp->engine->clue, html->engine, reparent_embedded, html);
6486
6489
        obj = html_engine_get_object_at (html->engine, x, y, (guint *) &offset, FALSE);
6487
6490
 
6488
6491
        if (obj && HTML_IS_IMAGE (obj)) {
6489
 
                HTMLImage *image = (HTMLImage*)obj;
 
6492
                HTMLImage *image = (HTMLImage*) obj;
6490
6493
 
6491
6494
                if (!image->image_ptr)
6492
6495
                        return NULL;
6497
6500
        return NULL;
6498
6501
}
6499
6502
 
 
6503
/* Unref when done with it */
 
6504
GdkPixbufAnimation *
 
6505
gtk_html_get_image_at (GtkHTML *html, gint x, gint y)
 
6506
{
 
6507
        HTMLObject *obj;
 
6508
        gint offset;
 
6509
 
 
6510
        g_return_val_if_fail (GTK_IS_HTML (html), NULL);
 
6511
 
 
6512
        obj = html_engine_get_object_at (html->engine, x, y, (guint *) &offset, FALSE);
 
6513
 
 
6514
        if (obj && HTML_IS_IMAGE (obj)) {
 
6515
                HTMLImage *image = (HTMLImage*) obj;
 
6516
 
 
6517
                if (!image->image_ptr || !image->image_ptr->animation)
 
6518
                        return NULL;
 
6519
 
 
6520
                return g_object_ref (image->image_ptr->animation);
 
6521
        }
 
6522
 
 
6523
        return NULL;
 
6524
}
 
6525
 
6500
6526
gchar *
6501
6527
gtk_html_get_cursor_image_src (GtkHTML *html)
6502
6528
{
6512
6538
                obj = html_engine_get_focus_object (html->engine, &offset);
6513
6539
 
6514
6540
        if (obj && HTML_IS_IMAGE (obj)) {
6515
 
                HTMLImage *image = (HTMLImage*)obj;
 
6541
                HTMLImage *image = (HTMLImage*) obj;
6516
6542
 
6517
6543
                if (!image->image_ptr)
6518
6544
                        return NULL;