]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcellrenderertext.c
Estonian translation update by Ivar Smolin.
[~andy/gtk] / gtk / gtkcellrenderertext.c
index 34b4b6acd02084b5ebe66ad99ecc1ceee0a7c929..e65057dcefb1b0921313beb9c3cbf0d342311dad 100644 (file)
@@ -475,7 +475,11 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
   /**
    * GtkCellRendererText:alignment:
    *
-   * Specifies how to align the lines of text.
+   * Specifies how to align the lines of text with respect to each other. 
+   *
+   * Note that this property describes how to align the lines of text in 
+   * case there are several of them. The "xalign" property of #GtkCellRenderer, 
+   * on the other hand, sets the horizontal alignment of the whole text.
    *
    * Since: 2.10
    */
@@ -558,11 +562,14 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
 
   /**
    * GtkCellRendererText::edited
-   * @renderer: the object which received the signal.
-   * @path: the path identifying the edited cell.
-   * @new_text: the new text.
+   * @renderer: the object which received the signal
+   * @path: the path identifying the edited cell
+   * @new_text: the new text
    *
    * This signal is emitted after @renderer has been edited.
+   *
+   * It is the responsibility of the application to update the model
+   * and store @new_text at the position indicated by @path.
    */
   text_cell_renderer_signals [EDITED] =
     g_signal_new (I_("edited"),
@@ -588,8 +595,7 @@ gtk_cell_renderer_text_finalize (GObject *object)
 
   pango_font_description_free (celltext->font);
 
-  if (celltext->text)
-    g_free (celltext->text);
+  g_free (celltext->text);
 
   if (celltext->extra_attrs)
     pango_attr_list_unref (celltext->extra_attrs);
@@ -728,7 +734,7 @@ gtk_cell_renderer_text_get_property (GObject        *object,
       break;  
 
     case PROP_LANGUAGE:
-      g_value_set_string (value, pango_language_to_string (priv->language));
+      g_value_set_static_string (value, pango_language_to_string (priv->language));
       break;
 
     case PROP_ELLIPSIZE:
@@ -1005,8 +1011,7 @@ gtk_cell_renderer_text_set_property (GObject      *object,
   switch (param_id)
     {
     case PROP_TEXT:
-      if (celltext->text)
-        g_free (celltext->text);
+      g_free (celltext->text);
 
       if (priv->markup_set)
         {
@@ -1050,8 +1055,7 @@ gtk_cell_renderer_text_set_property (GObject      *object,
            return;
          }
 
-       if (celltext->text)
-         g_free (celltext->text);
+       g_free (celltext->text);
 
        if (celltext->extra_attrs)
          pango_attr_list_unref (celltext->extra_attrs);
@@ -1445,12 +1449,6 @@ get_layout (GtkCellRendererText *celltext,
     {
       pango_layout_set_width (layout, priv->wrap_width * PANGO_SCALE);
       pango_layout_set_wrap (layout, priv->wrap_mode);
-
-      if (pango_layout_get_line_count (layout) == 1)
-       {
-         pango_layout_set_width (layout, -1);
-         pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
-       }
     }
   else
     {
@@ -1539,7 +1537,8 @@ get_size (GtkCellRenderer *cell,
   else
     layout = get_layout (celltext, widget, FALSE, 0);
 
-  pango_layout_get_pixel_extents (layout, NULL, &rect);
+  pango_layout_get_extents (layout, NULL, &rect);
+  pango_extents_to_pixels (&rect, NULL);
 
   if (height)
     *height = cell->ypad * 2 + rect.height;
@@ -1585,6 +1584,11 @@ get_size (GtkCellRenderer *cell,
          *y_offset = MAX (*y_offset, 0);
        }
     }
+  else
+    {
+      if (x_offset) *x_offset = 0;
+      if (y_offset) *y_offset = 0;
+    }
 
   g_object_unref (layout);
 }
@@ -1736,8 +1740,6 @@ popdown_timeout (gpointer data)
 {
   GtkCellRendererTextPrivate *priv;
 
-  GDK_THREADS_ENTER ();
-
   priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
 
   priv->entry_menu_popdown_timeout = 0;
@@ -1745,8 +1747,6 @@ popdown_timeout (gpointer data)
   if (!GTK_WIDGET_HAS_FOCUS (priv->entry))
     gtk_cell_renderer_text_editing_done (GTK_CELL_EDITABLE (priv->entry), data);
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -1763,7 +1763,7 @@ gtk_cell_renderer_text_popup_unmap (GtkMenu *menu,
   if (priv->entry_menu_popdown_timeout)
     return;
 
-  priv->entry_menu_popdown_timeout = g_timeout_add (500, popdown_timeout,
+  priv->entry_menu_popdown_timeout = gdk_threads_add_timeout (500, popdown_timeout,
                                                     data);
 }
 
@@ -1800,7 +1800,9 @@ gtk_cell_renderer_text_focus_out_event (GtkWidget *entry,
   if (priv->in_entry_menu)
     return FALSE;
 
-  gtk_cell_renderer_text_editing_done (GTK_CELL_EDITABLE (entry), data);
+  GTK_ENTRY (entry)->editing_canceled = TRUE;
+  gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
+  gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (entry));
 
   /* entry needs focus-out-event */
   return FALSE;