[gtk+/resolution-independence: 32/33] Merge commit 'origin/master' into resolution-independence



commit 74f03f97b1d64582bfc3914a8a7162e8b5f9600c
Merge: c0c10b9... a398c84...
Author: Davyd Madeley <davyd madeley id au>
Date:   Tue May 5 12:16:26 2009 +0800

    Merge commit 'origin/master' into resolution-independence
    
    Merge latest work from GTK+ master. GtkAssistant and GtkScale required manual
    merging.

 HACKING                                            |    2 +-
 Makefile.am                                        |   32 +
 NEWS                                               |   42 +
 README.in                                          |   14 +-
 configure.in                                       |    6 +-
 contrib/Makefile.am                                |    2 +
 contrib/gdk-pixbuf-xlib/Makefile.am                |    2 +
 demos/Makefile.am                                  |    2 +
 demos/gtk-demo/Makefile.am                         |    2 +
 docs/Makefile.am                                   |    2 +
 docs/faq/Makefile.am                               |    2 +
 docs/reference/Makefile.am                         |    3 +
 docs/reference/gdk-pixbuf/Makefile.am              |    2 +
 docs/reference/gdk/Makefile.am                     |    2 +
 docs/reference/gtk/Makefile.am                     |    2 +
 docs/reference/gtk/tmpl/filesystem.sgml            |  108 +
 docs/reference/gtk/tmpl/gtkactivatable.sgml        |  100 +
 docs/reference/gtk/tmpl/gtkbuilder.sgml            |    3 +-
 docs/reference/gtk/tmpl/gtkentry.sgml              |    5 +
 docs/reference/gtk/tmpl/gtkimcontext.sgml          |  212 ++
 docs/reference/gtk/tmpl/gtkprintoperation.sgml     |   10 +
 docs/reference/gtk/tmpl/gtkscale.sgml              |   19 +-
 docs/reference/gtk/tmpl/gtktoolshell.sgml          |   82 +
 docs/reference/libgail-util/Makefile.am            |    2 +
 docs/tools/Makefile.am                             |    2 +
 docs/tutorial/Makefile.am                          |    2 +
 examples/gtkdial/gtkdial.c                         |   10 +-
 gdk-pixbuf/Makefile.am                             |    2 +
 gdk-pixbuf/pixops/Makefile.am                      |    2 +
 gdk-pixbuf/pixops/pixops.c                         |    5 +-
 gdk/Makefile.am                                    |    2 +
 gdk/directfb/Makefile.am                           |    2 +
 gdk/gdkmedialib.c                                  |    5 +-
 gdk/quartz/Makefile.am                             |    2 +
 gdk/tests/Makefile.am                              |    2 +
 gdk/win32/Makefile.am                              |    2 +
 gdk/win32/rc/Makefile.am                           |    2 +
 gdk/x11/Makefile.am                                |    2 +
 gdk/x11/gdkproperty-x11.c                          |   16 +-
 gdk/x11/gdkselection-x11.c                         |    5 +-
 git.mk                                             |  182 +
 gtk/Makefile.am                                    |    4 +-
 gtk/gtk-builder-convert                            |   18 +-
 gtk/gtk.symbols                                    |    1 +
 gtk/gtkaboutdialog.c                               |    2 -
 gtk/gtkadjustment.c                                |    6 +-
 gtk/gtkassistant.c                                 |    7 +-
 gtk/gtkbuilderparser.c                             |    3 +-
 gtk/gtkcombobox.c                                  |    8 +-
 gtk/gtkdialog.c                                    |    2 +-
 gtk/gtkentry.c                                     |   30 +-
 gtk/gtkhandlebox.c                                 |    1 +
 gtk/gtkiconview.c                                  |   52 +-
 gtk/gtkrange.c                                     |    6 +
 gtk/gtkscale.c                                     |  259 ++-
 gtk/gtkscrolledwindow.c                            |    8 +-
 gtk/gtkspinbutton.c                                |    9 +
 gtk/gtktextlayout.c                                |   50 +-
 gtk/gtktreeview.c                                  |   22 +-
 gtk/gtkwidget.c                                    |   12 +-
 gtk/tests/Makefile.am                              |    2 +
 gtk/tests/builder.c                                |    4 +-
 gtk/theme-bits/Makefile.am                         |    2 +
 m4macros/Makefile.am                               |    2 +
 modules/Makefile.am                                |    2 +
 modules/engines/Makefile.am                        |    2 +
 modules/engines/ms-windows/Makefile.am             |    2 +
 modules/engines/ms-windows/Theme/Makefile.am       |    2 +
 .../engines/ms-windows/Theme/gtk-2.0/Makefile.am   |    2 +
 modules/engines/pixbuf/Makefile.am                 |    2 +
 modules/input/Makefile.am                          |    2 +
 modules/other/Makefile.am                          |    2 +
 modules/other/gail/Makefile.am                     |    2 +
 modules/other/gail/gailcombobox.c                  |    1 +
 modules/other/gail/libgail-util/Makefile.am        |    2 +
 modules/other/gail/tests/Makefile.am               |    2 +
 modules/printbackends/Makefile.am                  |    2 +
 modules/printbackends/cups/Makefile.am             |    2 +
 modules/printbackends/file/Makefile.am             |    2 +
 modules/printbackends/lpr/Makefile.am              |    2 +
 modules/printbackends/test/Makefile.am             |    2 +
 perf/Makefile.am                                   |    2 +
 po-properties/af.po                                |  176 +-
 po-properties/am.po                                |  176 +-
 po-properties/ang.po                               |  176 +-
 po-properties/ar.po                                |  176 +-
 po-properties/as.po                                |  176 +-
 po-properties/ast.po                               |  176 +-
 po-properties/az.po                                |  176 +-
 po-properties/az_IR.po                             |  176 +-
 po-properties/be.po                                |  176 +-
 po-properties/be latin po                          |  176 +-
 po-properties/bg.po                                |  176 +-
 po-properties/bn.po                                |  176 +-
 po-properties/bn_IN.po                             |  176 +-
 po-properties/br.po                                |  176 +-
 po-properties/bs.po                                |  176 +-
 po-properties/ca.po                                |  176 +-
 po-properties/ca valencia po                       |  176 +-
 po-properties/crh.po                               |  176 +-
 po-properties/cs.po                                |  176 +-
 po-properties/cy.po                                |  176 +-
 po-properties/da.po                                |  176 +-
 po-properties/de.po                                |  176 +-
 po-properties/dz.po                                |  176 +-
 po-properties/el.po                                |  176 +-
 po-properties/en_CA.po                             |  176 +-
 po-properties/en_GB.po                             |  176 +-
 po-properties/eo.po                                |  176 +-
 po-properties/es.po                                |  176 +-
 po-properties/et.po                                |  176 +-
 po-properties/eu.po                                |  176 +-
 po-properties/fa.po                                |  176 +-
 po-properties/fi.po                                |  176 +-
 po-properties/fr.po                                |  176 +-
 po-properties/ga.po                                |  176 +-
 po-properties/gl.po                                |  176 +-
 po-properties/gu.po                                |  176 +-
 po-properties/he.po                                |  176 +-
 po-properties/hi.po                                |  176 +-
 po-properties/hr.po                                |  176 +-
 po-properties/hu.po                                |  176 +-
 po-properties/hy.po                                |  176 +-
 po-properties/ia.po                                |  176 +-
 po-properties/id.po                                |  176 +-
 po-properties/io.po                                |  176 +-
 po-properties/is.po                                |  176 +-
 po-properties/it.po                                |  176 +-
 po-properties/ja.po                                |  176 +-
 po-properties/ka.po                                |  176 +-
 po-properties/kn.po                                |  176 +-
 po-properties/ko.po                                |  176 +-
 po-properties/ku.po                                |  176 +-
 po-properties/li.po                                |  176 +-
 po-properties/lt.po                                |  176 +-
 po-properties/lv.po                                |  176 +-
 po-properties/mai.po                               |  176 +-
 po-properties/mi.po                                |  176 +-
 po-properties/mk.po                                |  176 +-
 po-properties/ml.po                                |  176 +-
 po-properties/mn.po                                |  176 +-
 po-properties/mr.po                                |  176 +-
 po-properties/ms.po                                |  176 +-
 po-properties/nb.po                                |  176 +-
 po-properties/ne.po                                |  176 +-
 po-properties/nl.po                                |  176 +-
 po-properties/nn.po                                |  176 +-
 po-properties/nso.po                               |  176 +-
 po-properties/oc.po                                |  176 +-
 po-properties/or.po                                | 3597 ++++++++++----------
 po-properties/pa.po                                |  176 +-
 po-properties/pl.po                                |  176 +-
 po-properties/ps.po                                | 3395 +++++++++----------
 po-properties/pt.po                                |  176 +-
 po-properties/pt_BR.po                             |  176 +-
 po-properties/ro.po                                |  176 +-
 po-properties/ru.po                                |  176 +-
 po-properties/rw.po                                |  176 +-
 po-properties/si.po                                |  176 +-
 po-properties/sk.po                                |  176 +-
 po-properties/sl.po                                |  176 +-
 po-properties/sq.po                                |  176 +-
 po-properties/sr.po                                |  176 +-
 po-properties/sr ije po                            |  176 +-
 po-properties/sr latin po                          |  176 +-
 po-properties/sv.po                                |  176 +-
 po-properties/ta.po                                |  176 +-
 po-properties/te.po                                |  176 +-
 po-properties/th.po                                |  176 +-
 po-properties/tk.po                                |  176 +-
 po-properties/tr.po                                |  176 +-
 po-properties/tt.po                                |  176 +-
 po-properties/uk.po                                | 3402 +++++++++----------
 po-properties/ur.po                                |  176 +-
 po-properties/uz.po                                |  176 +-
 po-properties/uz cyrillic po                       |  176 +-
 po-properties/vi.po                                |  176 +-
 po-properties/wa.po                                |  176 +-
 po-properties/xh.po                                |  176 +-
 po-properties/yi.po                                |  176 +-
 po-properties/zh_CN.po                             |  176 +-
 po-properties/zh_HK.po                             |  176 +-
 po-properties/zh_TW.po                             |  176 +-
 po/af.po                                           |  374 ++-
 po/am.po                                           |  374 ++-
 po/ang.po                                          |  374 ++-
 po/ar.po                                           | 2149 ++++++------
 po/as.po                                           |  374 ++-
 po/ast.po                                          |  374 ++-
 po/az.po                                           |  376 ++-
 po/az_IR.po                                        |  369 ++-
 po/be.po                                           |  374 ++-
 po/be latin po                                     |  374 ++-
 po/bg.po                                           |  374 ++-
 po/bn.po                                           |  374 ++-
 po/bn_IN.po                                        |  374 ++-
 po/br.po                                           |  374 ++-
 po/bs.po                                           |  376 ++-
 po/ca.po                                           | 2147 ++++++------
 po/ca valencia po                                  |  374 ++-
 po/crh.po                                          |  378 ++-
 po/cs.po                                           |  387 ++-
 po/cy.po                                           |  374 ++-
 po/da.po                                           | 2147 ++++++------
 po/de.po                                           |  374 ++-
 po/dz.po                                           |  374 ++-
 po/el.po                                           |  374 ++-
 po/en_CA.po                                        |  374 ++-
 po/en_GB.po                                        |  374 ++-
 po/eo.po                                           |  374 ++-
 po/es.po                                           | 2127 ++++++------
 po/et.po                                           |  458 ++--
 po/eu.po                                           |  374 ++-
 po/fa.po                                           |  374 ++-
 po/fi.po                                           |  374 ++-
 po/fr.po                                           |  374 ++-
 po/ga.po                                           |  374 ++-
 po/gl.po                                           |  374 ++-
 po/gu.po                                           |  420 ++-
 po/he.po                                           |  374 ++-
 po/hi.po                                           |  374 ++-
 po/hr.po                                           |  376 ++-
 po/hu.po                                           | 2191 +++++++------
 po/hy.po                                           |  374 ++-
 po/ia.po                                           |  374 ++-
 po/id.po                                           |  374 ++-
 po/io.po                                           |  374 ++-
 po/is.po                                           |  374 ++-
 po/it.po                                           | 2154 ++++++------
 po/ja.po                                           |  374 ++-
 po/ka.po                                           |  374 ++-
 po/kn.po                                           |  374 ++-
 po/ko.po                                           |  374 ++-
 po/ku.po                                           |  374 ++-
 po/li.po                                           |  376 ++-
 po/lt.po                                           |  374 ++-
 po/lv.po                                           |  374 ++-
 po/mai.po                                          |  374 ++-
 po/mi.po                                           |  374 ++-
 po/mk.po                                           |  374 ++-
 po/ml.po                                           |  374 ++-
 po/mn.po                                           |  380 ++-
 po/mr.po                                           |  374 ++-
 po/ms.po                                           |  376 ++-
 po/nb.po                                           |  374 ++-
 po/ne.po                                           |  373 ++-
 po/nl.po                                           |  375 ++-
 po/nn.po                                           |  377 ++-
 po/nso.po                                          |  376 ++-
 po/oc.po                                           |  373 ++-
 po/or.po                                           |  409 ++-
 po/pa.po                                           |  374 ++-
 po/pl.po                                           |  374 ++-
 po/ps.po                                           |  374 ++-
 po/pt.po                                           |  374 ++-
 po/pt_BR.po                                        | 2150 ++++++------
 po/ro.po                                           |  374 ++-
 po/ru.po                                           |  374 ++-
 po/rw.po                                           |  377 ++-
 po/si.po                                           |  374 ++-
 po/sk.po                                           |  374 ++-
 po/sl.po                                           |  374 ++-
 po/sq.po                                           |  375 ++-
 po/sr.po                                           | 2147 ++++++------
 po/sr ije po                                       |  376 ++-
 po/sr latin po                                     | 2175 ++++++------
 po/sv.po                                           | 2751 +++++++++-------
 po/ta.po                                           |  374 ++-
 po/te.po                                           |  374 ++-
 po/th.po                                           |  374 ++-
 po/tk.po                                           |  374 ++-
 po/tr.po                                           |  378 ++-
 po/tt.po                                           |  373 ++-
 po/uk.po                                           | 2105 ++++++------
 po/ur.po                                           |  369 ++-
 po/uz.po                                           |  374 ++-
 po/uz cyrillic po                                  |  374 ++-
 po/vi.po                                           |  374 ++-
 po/wa.po                                           |  374 ++-
 po/xh.po                                           |  374 ++-
 po/yi.po                                           |  376 ++-
 po/zh_CN.po                                        | 2150 ++++++------
 po/zh_HK.po                                        |  374 ++-
 po/zh_TW.po                                        |  374 ++-
 tests/Makefile.am                                  |    2 +
 tests/testgtkrc                                    |    2 +
 tests/teststatusicon.c                             |    2 +-
 287 files changed, 49079 insertions(+), 39899 deletions(-)

diff --cc gtk/gtkassistant.c
index a506605,4e8f155..4c0768f
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@@ -725,6 -729,7 +725,8 @@@ gtk_assistant_init (GtkAssistant *assis
    priv = assistant->priv = GTK_ASSISTANT_GET_PRIVATE (assistant);
  
    gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
 -  gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
++  gtk_container_set_border_width (GTK_CONTAINER (assistant),
++		  GTK_SIZE_ONE_TWELFTH_EM (12));
  
    gtk_widget_push_composite_child ();
  
diff --cc gtk/gtkiconview.c
index 7f3dd6e,3a413f0..9a43d07
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@@ -6504,21 -6418,28 +6513,28 @@@ gtk_icon_view_autoscroll (GtkIconView *
    gdk_window_get_geometry (GTK_WIDGET (icon_view)->window, &x, &y, &width, &height, NULL);
  
    /* see if we are near the edge. */
 -  voffset = py - (y + 2 * SCROLL_EDGE_SIZE);
 +  voffset = py - (y + 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE));
    if (voffset > 0)
 -    voffset = MAX (py - (y + height - 2 * SCROLL_EDGE_SIZE), 0);
 +    voffset = MAX (py - (y + height - 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE)), 0);
  
 -  hoffset = px - (x + 2 * SCROLL_EDGE_SIZE);
 +  hoffset = px - (x + 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE));
    if (hoffset > 0)
 -    hoffset = MAX (px - (x + width - 2 * SCROLL_EDGE_SIZE), 0);
 +    hoffset = MAX (px - (x + width - 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE)), 0);
  
    if (voffset != 0)
-     gtk_adjustment_set_value (icon_view->priv->vadjustment,
-                               icon_view->priv->vadjustment->value + voffset);
- 
+     {
+       value = CLAMP (icon_view->priv->vadjustment->value + voffset, 
+ 		     icon_view->priv->vadjustment->lower,
+ 		     icon_view->priv->vadjustment->upper - icon_view->priv->vadjustment->page_size);
+       gtk_adjustment_set_value (icon_view->priv->vadjustment, value);
+     }
    if (hoffset != 0)
-     gtk_adjustment_set_value (icon_view->priv->hadjustment,
-                               icon_view->priv->hadjustment->value + hoffset);
+     {
+       value = CLAMP (icon_view->priv->hadjustment->value + hoffset, 
+ 		     icon_view->priv->hadjustment->lower,
+ 		     icon_view->priv->hadjustment->upper - icon_view->priv->hadjustment->page_size);
+       gtk_adjustment_set_value (icon_view->priv->hadjustment, value);
+     }
  }
  
  
diff --cc gtk/gtkscale.c
index 623f571,87aa469..f4a859c
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@@ -110,10 -112,25 +112,25 @@@ static gboolean gtk_scale_expos
  static void     gtk_scale_real_get_layout_offsets (GtkScale       *scale,
                                                     gint           *x,
                                                     gint           *y);
 +static void gtk_scale_unit_changed                (GtkWidget      *widget);
- 
- G_DEFINE_ABSTRACT_TYPE (GtkScale, gtk_scale, GTK_TYPE_RANGE)
+ static void     gtk_scale_buildable_interface_init   (GtkBuildableIface *iface);
+ static gboolean gtk_scale_buildable_custom_tag_start (GtkBuildable  *buildable,
+                                                       GtkBuilder    *builder,
+                                                       GObject       *child,
+                                                       const gchar   *tagname,
+                                                       GMarkupParser *parser,
+                                                       gpointer      *data);
+ static void     gtk_scale_buildable_custom_finished  (GtkBuildable  *buildable,
+                                                       GtkBuilder    *builder,
+                                                       GObject       *child,
+                                                       const gchar   *tagname,
+                                                       gpointer       user_data);
+ 
+ 
+ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkScale, gtk_scale, GTK_TYPE_RANGE,
+                                   G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+                                                          gtk_scale_buildable_interface_init))
  
 -
  static gboolean
  single_string_accumulator (GSignalInvocationHint *ihint,
                             GValue                *return_accu,
@@@ -1353,14 -1373,240 +1370,250 @@@ gtk_scale_add_mark (GtkScale        *sc
    gtk_widget_queue_resize (GTK_WIDGET (scale));
  }
  
++static void
 +gtk_scale_unit_changed (GtkWidget *widget)
 +{
 +  /* must chain up */
 +  if (GTK_WIDGET_CLASS (gtk_scale_parent_class)->unit_changed != NULL)
 +    GTK_WIDGET_CLASS (gtk_scale_parent_class)->unit_changed (widget);
 +
 +  _gtk_scale_clear_layout (GTK_SCALE (widget));
 +}
 +
+ static GtkBuildableIface *parent_buildable_iface;
+ 
+ static void
+ gtk_scale_buildable_interface_init (GtkBuildableIface *iface)
+ {
+   parent_buildable_iface = g_type_interface_peek_parent (iface);
+   iface->custom_tag_start = gtk_scale_buildable_custom_tag_start;
+   iface->custom_finished = gtk_scale_buildable_custom_finished;
+ }
+ 
+ typedef struct
+ {
+   GtkScale *scale;
+   GtkBuilder *builder;
+   GSList *marks;
+ } MarksSubparserData;
+ 
+ typedef struct
+ {
+   gdouble value;
+   GtkPositionType position;
+   GString *markup;
+   gchar *context;
+   gboolean translatable;
+ } MarkData;
+ 
+ static void
+ mark_data_free (MarkData *data)
+ {
+   g_string_free (data->markup, TRUE);
+   g_free (data->context);
+   g_slice_free (MarkData, data);
+ }
+ 
+ static void
+ marks_start_element (GMarkupParseContext *context,
+                      const gchar         *element_name,
+                      const gchar        **names,
+                      const gchar        **values,
+                      gpointer             user_data,
+                      GError             **error)
+ {
+   MarksSubparserData *parser_data = (MarksSubparserData*)user_data;
+   guint i;
+   gint line_number, char_number;
+ 
+   if (strcmp (element_name, "marks") == 0)
+    ;
+   else if (strcmp (element_name, "mark") == 0)
+     {
+       gdouble value;
+       gboolean has_value = FALSE;
+       GtkPositionType position = GTK_POS_BOTTOM;
+       const gchar *msg_context = NULL;
+       gboolean translatable = FALSE;
+       MarkData *mark;
+ 
+       for (i = 0; names[i]; i++)
+         {
+           if (strcmp (names[i], "translatable") == 0)
+             {
+               if (!_gtk_builder_boolean_from_string (values[i], &translatable, error))
+                 return;
+             }
+           else if (strcmp (names[i], "comments") == 0)
+             {
+               /* do nothing, comments are for translators */
+             }
+           else if (strcmp (names[i], "context") == 0)
+             msg_context = values[i];
+           else if (strcmp (names[i], "value") == 0)
+             {
+               GValue gvalue = { 0, };
+ 
+               if (!gtk_builder_value_from_string_type (parser_data->builder, G_TYPE_DOUBLE, values[i], &gvalue, error))
+                 return;
+ 
+               value = g_value_get_double (&gvalue);
+               has_value = TRUE;
+             }
+           else if (strcmp (names[i], "position") == 0)
+             {
+               GValue gvalue = { 0, };
+ 
+               if (!gtk_builder_value_from_string_type (parser_data->builder, GTK_TYPE_POSITION_TYPE, values[i], &gvalue, error))
+                 return;
+ 
+               position = g_value_get_enum (&gvalue);
+             }
+           else
+             {
+               g_markup_parse_context_get_position (context,
+                                                    &line_number,
+                                                    &char_number);
+               g_set_error (error,
+                            GTK_BUILDER_ERROR,
+                            GTK_BUILDER_ERROR_INVALID_ATTRIBUTE,
+                            "%s:%d:%d '%s' is not a valid attribute of <%s>",
+                            "<input>",
+                            line_number, char_number, names[i], "mark");
+               return;
+             }
+         }
+ 
+       if (!has_value)
+         {
+           g_markup_parse_context_get_position (context,
+                                                &line_number,
+                                                &char_number);
+           g_set_error (error,
+                        GTK_BUILDER_ERROR,
+                        GTK_BUILDER_ERROR_MISSING_ATTRIBUTE,
+                        "%s:%d:%d <%s> requires attribute \"%s\"",
+                        "<input>",
+                        line_number, char_number, "mark",
+                        "value");
+           return;
+         }
+ 
+       mark = g_slice_new (MarkData);
+       mark->value = value;
+       mark->position = position;
+       mark->markup = g_string_new ("");
+       mark->context = g_strdup (msg_context);
+       mark->translatable = translatable;
+ 
+       parser_data->marks = g_slist_prepend (parser_data->marks, mark);
+     }
+   else
+     {
+       g_markup_parse_context_get_position (context,
+                                            &line_number,
+                                            &char_number);
+       g_set_error (error,
+                    GTK_BUILDER_ERROR,
+                    GTK_BUILDER_ERROR_MISSING_ATTRIBUTE,
+                    "%s:%d:%d unsupported tag for GtkScale: \"%s\"",
+                    "<input>",
+                    line_number, char_number, element_name);
+       return;
+     }
+ }
+ 
+ static void
+ marks_text (GMarkupParseContext  *context,
+             const gchar          *text,
+             gsize                 text_len,
+             gpointer              user_data,
+             GError              **error)
+ {
+   MarksSubparserData *data = (MarksSubparserData*)user_data;
+ 
+   if (strcmp (g_markup_parse_context_get_element (context), "mark") == 0)
+     {
+       MarkData *mark = data->marks->data;
+ 
+       g_string_append_len (mark->markup, text, text_len);
+     }
+ }
+ 
+ static const GMarkupParser marks_parser =
+   {
+     marks_start_element,
+     NULL,
+     marks_text,
+   };
+ 
+ 
+ static gboolean
+ gtk_scale_buildable_custom_tag_start (GtkBuildable  *buildable,
+                                       GtkBuilder    *builder,
+                                       GObject       *child,
+                                       const gchar   *tagname,
+                                       GMarkupParser *parser,
+                                       gpointer      *data)
+ {
+   MarksSubparserData *parser_data;
+ 
+   if (child)
+     return FALSE;
+ 
+   if (strcmp (tagname, "marks") == 0)
+     {
+       parser_data = g_slice_new0 (MarksSubparserData);
+       parser_data->scale = GTK_SCALE (buildable);
+       parser_data->marks = NULL;
+ 
+       *parser = marks_parser;
+       *data = parser_data;
+       return TRUE;
+     }
+ 
+   return parent_buildable_iface->custom_tag_start (buildable, builder, child,
+                                                    tagname, parser, data);
+ }
+ 
+ static void
+ gtk_scale_buildable_custom_finished (GtkBuildable *buildable,
+                                      GtkBuilder   *builder,
+                                      GObject      *child,
+                                      const gchar  *tagname,
+                                      gpointer      user_data)
+ {
+   GtkScale *scale = GTK_SCALE (buildable);
+   MarksSubparserData *marks_data;
+   GtkWidget *toplevel;
+ 
+   if (strcmp (tagname, "marks") == 0)
+     {
+       GSList *m;
+       gchar *markup;
+ 
+       marks_data = (MarksSubparserData *)user_data;
+ 
+       for (m = marks_data->marks; m; m = m->next)
+         {
+           MarkData *mdata = m->data;
+ 
+           if (mdata->translatable && mdata->markup->len)
+             markup = _gtk_builder_parser_translate (gtk_builder_get_translation_domain (builder),
+                                                     mdata->context,
+                                                     mdata->markup->str);
+           else
+             markup = mdata->markup->str;
+ 
+           gtk_scale_add_mark (scale, mdata->value, mdata->position, markup);
+ 
+           mark_data_free (mdata);
+         }
+ 
+       g_slist_free (marks_data->marks);
+       g_slice_free (MarksSubparserData, marks_data);
+     }
+ }
+ 
  #define __GTK_SCALE_C__
  #include "gtkaliasdef.c"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]