]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktextview.c
Added VS projects for a11y and libgail-util
[~andy/gtk] / gtk / gtktextview.c
index 47e26bea2f277998f5e79522f504a3a1f243460f..b722c51d986d74c0c2661e417cf331f63bc936ea 100644 (file)
@@ -53,6 +53,7 @@
 #include "gtkscrollable.h"
 #include "gtktypebuiltins.h"
 
+#include "a11y/gtktextviewaccessible.h"
 
 /**
  * SECTION:gtktextview
@@ -133,7 +134,6 @@ struct _GtkTextViewPrivate
   GdkDevice *dnd_device;
 
   gulong selection_drag_handler;
-  guint scroll_timeout;
 
   GtkTextWindow *text_window;
   GtkTextWindow *left_window;
@@ -176,12 +176,16 @@ struct _GtkTextViewPrivate
   GtkTextMark *first_para_mark; /* Mark at the beginning of the first onscreen paragraph */
   gint first_para_pixels;       /* Offset of top of screen in the first onscreen paragraph */
 
-  GtkTextMark *dnd_mark;
   guint blink_timeout;
+  guint scroll_timeout;
 
   guint first_validate_idle;        /* Idle to revalidate onscreen portion, runs before resize */
   guint incremental_validate_idle;  /* Idle to revalidate offscreen portions, runs after redraw */
 
+  gint pending_place_cursor_button;
+
+  GtkTextMark *dnd_mark;
+
   GtkIMContext *im_context;
   GtkWidget *popup_menu;
 
@@ -192,8 +196,6 @@ struct _GtkTextViewPrivate
 
   GtkTextPendingScroll *pending_scroll;
 
-  gint pending_place_cursor_button;
-
   /* Default style settings */
   gint pixels_above_lines;
   gint pixels_below_lines;
@@ -209,7 +211,7 @@ struct _GtkTextViewPrivate
   guint overwrite_mode : 1;
   guint cursor_visible : 1;
 
-  /* if we have reset the IM since the last character entered */  
+  /* if we have reset the IM since the last character entered */
   guint need_im_reset : 1;
 
   guint accepts_tab : 1;
@@ -1350,6 +1352,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
                                GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
 
   g_type_class_add_private (gobject_class, sizeof (GtkTextViewPrivate));
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TEXT_VIEW_ACCESSIBLE);
 }
 
 static void
@@ -4026,6 +4030,7 @@ gtk_text_view_realize (GtkWidget *widget)
     text_window_realize (priv->bottom_window, widget);
 
   gtk_text_view_ensure_layout (text_view);
+  gtk_text_view_invalidate (text_view);
 
   if (priv->buffer)
     {
@@ -4086,8 +4091,6 @@ gtk_text_view_unrealize (GtkWidget *widget)
   if (priv->bottom_window)
     text_window_unrealize (priv->bottom_window);
 
-  gtk_text_view_destroy_layout (text_view);
-
   GTK_WIDGET_CLASS (gtk_text_view_parent_class)->unrealize (widget);
 }
 
@@ -6728,8 +6731,6 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
 
           tmp_list = g_slist_next (tmp_list);
         }
-
-      gtk_text_view_invalidate (text_view);
     }
 }
 
@@ -7520,6 +7521,8 @@ adjust_allocation_recurse (GtkWidget *widget,
    * into widget->allocation if the widget is not realized.
    * FIXME someone figure out why this was.
    */
+  gtk_widget_get_allocation (widget, &allocation);
+
   if (!gtk_widget_get_realized (widget))
     {
       if (gtk_widget_get_visible (widget))
@@ -7566,7 +7569,7 @@ adjust_allocation (GtkWidget *widget,
   
   adjust_allocation_recurse (widget, &scroll_data);
 }
-            
+
 static void
 gtk_text_view_value_changed (GtkAdjustment *adjustment,
                              GtkTextView   *text_view)
@@ -8250,6 +8253,8 @@ popup_targets_received (GtkClipboard     *clipboard,
       gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), menuitem);
 
       menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_SELECT_ALL, NULL);
+      gtk_widget_set_sensitive (menuitem,
+                                gtk_text_buffer_get_char_count (priv->buffer) > 0);
       g_signal_connect (menuitem, "activate",
                        G_CALLBACK (select_all_cb), text_view);
       gtk_widget_show (menuitem);