X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtktext.c;h=1d09a9f038325364f3699a6d7ceaf419db03a217;hb=c03700734ee4fe5caa0e602bfe261acad96511db;hp=4d17b791d04219960eb61a10a68360459bb95de0;hpb=4b47bcb3a98a8478407ff9d1c642ab7983c386e9;p=~andy%2Fgtk diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 4d17b791d..1d09a9f03 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -24,6 +24,9 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#undef GDK_DISABLE_DEPRECATED +#undef GTK_DISABLE_DEPRECATED + #include #include #include "gdk/gdkkeysyms.h" @@ -264,9 +267,9 @@ static GtkTextFont* get_text_font (GdkFont* gfont); static void text_font_unref (GtkTextFont *text_font); static void insert_text_property (GtkText* text, GdkFont* font, - GdkColor *fore, GdkColor* back, guint len); + const GdkColor *fore, const GdkColor* back, guint len); static TextProperty* new_text_property (GtkText *text, GdkFont* font, - GdkColor* fore, GdkColor* back, guint length); + const GdkColor* fore, const GdkColor* back, guint length); static void destroy_text_property (TextProperty *prop); static void init_properties (GtkText *text); static void realize_property (GtkText *text, TextProperty *prop); @@ -595,32 +598,32 @@ gtk_text_class_init (GtkTextClass *class) g_object_class_install_property (gobject_class, PROP_HADJUSTMENT, g_param_spec_object ("hadjustment", - _("Horizontal Adjustment"), - _("Horizontal adjustment for the text widget"), + P_("Horizontal Adjustment"), + P_("Horizontal adjustment for the text widget"), GTK_TYPE_ADJUSTMENT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_VADJUSTMENT, g_param_spec_object ("vadjustment", - _("Vertical Adjustment"), - _("Vertical adjustment for the text widget"), + P_("Vertical Adjustment"), + P_("Vertical adjustment for the text widget"), GTK_TYPE_ADJUSTMENT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_LINE_WRAP, g_param_spec_boolean ("line_wrap", - _("Line Wrap"), - _("Whether lines are wrapped at widget edges"), + P_("Line Wrap"), + P_("Whether lines are wrapped at widget edges"), TRUE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_WORD_WRAP, g_param_spec_boolean ("word_wrap", - _("Word Wrap"), - _("Whether words are wrapped at widget edges"), + P_("Word Wrap"), + P_("Whether words are wrapped at widget edges"), FALSE, G_PARAM_READWRITE)); @@ -955,12 +958,12 @@ gtk_text_thaw (GtkText *text) } void -gtk_text_insert (GtkText *text, - GdkFont *font, - GdkColor *fore, - GdkColor *back, - const char *chars, - gint nchars) +gtk_text_insert (GtkText *text, + GdkFont *font, + const GdkColor *fore, + const GdkColor *back, + const char *chars, + gint nchars) { GtkOldEditable *old_editable = GTK_OLD_EDITABLE (text); gboolean frozen = FALSE; @@ -1252,7 +1255,7 @@ gtk_text_destroy (GtkObject *object) if (text->timer) { - gtk_timeout_remove (text->timer); + g_source_remove (text->timer); text->timer = 0; } @@ -1644,7 +1647,6 @@ static gint gtk_text_scroll_timeout (gpointer data) { GtkText *text; - GdkEventMotion event; gint x, y; GdkModifierType mask; @@ -1657,12 +1659,16 @@ gtk_text_scroll_timeout (gpointer data) if (mask & (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK)) { - event.is_hint = 0; - event.x = x; - event.y = y; - event.state = mask; + GdkEvent *event = gdk_event_new (GDK_MOTION_NOTIFY); + + event->motion.is_hint = 0; + event->motion.x = x; + event->motion.y = y; + event->motion.state = mask; - gtk_text_motion_notify (GTK_WIDGET (text), &event); + gtk_text_motion_notify (GTK_WIDGET (text), (GdkEventMotion *)event); + + gdk_event_free (event); } GDK_THREADS_LEAVE (); @@ -1789,7 +1795,7 @@ gtk_text_button_release (GtkWidget *widget, if (text->timer) { - gtk_timeout_remove (text->timer); + g_source_remove (text->timer); text->timer = 0; } @@ -1867,9 +1873,9 @@ gtk_text_motion_notify (GtkWidget *widget, { if (text->timer == 0) { - text->timer = gtk_timeout_add (SCROLL_TIME, - gtk_text_scroll_timeout, - text); + text->timer = g_timeout_add (SCROLL_TIME, + gtk_text_scroll_timeout, + text); if (y < 0) scroll_int (text, y/2); @@ -2870,7 +2876,7 @@ text_font_unref (GtkTextFont *text_font) } static gint -text_properties_equal (TextProperty* prop, GdkFont* font, GdkColor *fore, GdkColor *back) +text_properties_equal (TextProperty* prop, GdkFont* font, const GdkColor *fore, const GdkColor *back) { if (prop->flags & PROPERTY_FONT) { @@ -2964,8 +2970,8 @@ unrealize_properties (GtkText *text) } static TextProperty* -new_text_property (GtkText *text, GdkFont *font, GdkColor* fore, - GdkColor* back, guint length) +new_text_property (GtkText *text, GdkFont *font, const GdkColor* fore, + const GdkColor* back, guint length) { TextProperty *prop; @@ -3098,7 +3104,7 @@ make_forward_space (GtkText* text, guint len) * point. */ static void insert_text_property (GtkText* text, GdkFont* font, - GdkColor *fore, GdkColor* back, guint len) + const GdkColor *fore, const GdkColor* back, guint len) { GtkPropertyMark *mark = &text->point; TextProperty* forward_prop = MARK_CURRENT_PROPERTY(mark);