Beispiel #1
0
/* The convenience function to create new items. This should start with a 
   parent argument and end with a variable list of object properties to fit
   in with the standard canvas items. */
GooCanvasItem*
goo_demo_item_new (GooCanvasItem      *parent,
		   gdouble             x,
		   gdouble             y,
		   gdouble             width,
		   gdouble             height,
		   ...)
{
  GooCanvasItem *item;
  GooDemoItem *demo_item;
  const char *first_property;
  va_list var_args;

  item = g_object_new (GOO_TYPE_DEMO_ITEM, NULL);

  demo_item = (GooDemoItem*) item;
  demo_item->x = x;
  demo_item->y = y;
  demo_item->width = width;
  demo_item->height = height;

  va_start (var_args, height);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
Beispiel #2
0
/**
 * goo_canvas_path_new:
 * @parent: the parent item, or %NULL. If a parent is specified, it will assume
 *  ownership of the item, and the item will automatically be freed when it is
 *  removed from the parent. Otherwise call g_object_unref() to free it.
 * @path_data: the sequence of path commands, specified as a string using the
 *  same syntax as in the <ulink url="http://www.w3.org/Graphics/SVG/">Scalable
 *  Vector Graphics (SVG)</ulink> path element.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new path item.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a red line from (20,20) to (40,40):
 *
 * <informalexample><programlisting>
 *  GooCanvasItem *path = goo_canvas_path_new (mygroup,
 *                                             "M 20 20 L 40 40",
 *                                             "stroke-color", "red",
 *                                             NULL);
 * </programlisting></informalexample>
 * 
 * This example creates a cubic bezier curve from (20,100) to (100,100) with
 * the control points at (20,50) and (100,50):
 *
 * <informalexample><programlisting>
 *  GooCanvasItem *path = goo_canvas_path_new (mygroup,
 *                                             "M20,100 C20,50 100,50 100,100",
 *                                             "stroke-color", "blue",
 *                                             NULL);
 * </programlisting></informalexample>
 *
 * This example uses an elliptical arc to create a filled circle with one
 * quarter missing:
 * 
 * <informalexample><programlisting>
 *  GooCanvasItem *path = goo_canvas_path_new (mygroup,
 *                                             "M200,500 h-150 a150,150 0 1,0 150,-150 z",
 *                                             "fill-color", "red",
 *                                             "stroke-color", "blue",
 *                                             "line-width", 5.0,
 *                                             NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new path item.
 **/
GooCanvasItem*
goo_canvas_path_new               (GooCanvasItem *parent,
				   const gchar   *path_data,
				   ...)
{
  GooCanvasItem *item;
  GooCanvasPath *path;
  const char *first_property;
  va_list var_args;

  item = g_object_new (GOO_TYPE_CANVAS_PATH, NULL);
  path = (GooCanvasPath*) item;

  path->path_data->path_commands = goo_canvas_parse_path_data (path_data);

  va_start (var_args, path_data);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
Beispiel #3
0
/* The convenience function to create new items. This should start with a 
   parent argument and end with a variable list of object properties to fit
   in with the standard canvas items. */
GooCanvasItem*
goo_demo_large_line_new (GooCanvasItem      *parent,
			 gdouble             x1,
			 gdouble             y1,
			 gdouble             x2,
			 gdouble             y2,
			 ...)
{
  GooCanvasItem *item;
  GooDemoLargeLine *demo_large_line;
  const char *first_property;
  va_list var_args;

  item = g_object_new (GOO_TYPE_DEMO_LARGE_LINE, NULL);

  demo_large_line = (GooDemoLargeLine*) item;
  demo_large_line->x1 = x1;
  demo_large_line->y1 = y1;
  demo_large_line->x2 = x2;
  demo_large_line->y2 = y2;

  va_start (var_args, y2);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
GtkTextTag *
empathy_chat_text_view_tag_set (EmpathyChatTextView *view,
				const gchar         *tag_name,
				const gchar         *first_property_name,
				...)
{
	EmpathyChatTextViewPriv *priv = GET_PRIV (view);
	GtkTextTag              *tag;
	GtkTextTagTable         *table;
	va_list                  list;

	g_return_val_if_fail (EMPATHY_IS_CHAT_TEXT_VIEW (view), NULL);
	g_return_val_if_fail (tag_name != NULL, NULL);

	table = gtk_text_buffer_get_tag_table (priv->buffer);
	tag = gtk_text_tag_table_lookup (table, tag_name);

	if (tag && first_property_name) {
		va_start (list, first_property_name);
		g_object_set_valist (G_OBJECT (tag), first_property_name, list);
		va_end (list);
	}

	return tag;
}
Beispiel #5
0
/**
 * goo_canvas_path_model_new:
 * @parent: the parent model, or %NULL. If a parent is specified, it will
 *  assume ownership of the item, and the item will automatically be freed when
 *  it is removed from the parent. Otherwise call g_object_unref() to free it.
 * @path_data: the sequence of path commands, specified as a string using the
 *  same syntax as in the <ulink url="http://www.w3.org/Graphics/SVG/">Scalable
 *  Vector Graphics (SVG)</ulink> path element.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new path model.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a red line from (20,20) to (40,40):
 *
 * <informalexample><programlisting>
 *  GooCanvasItemModel *path = goo_canvas_path_model_new (mygroup,
 *                                                        "M 20 20 L 40 40",
 *                                                        "stroke-color", "red",
 *                                                        NULL);
 * </programlisting></informalexample>
 * 
 * This example creates a cubic bezier curve from (20,100) to (100,100) with
 * the control points at (20,50) and (100,50):
 *
 * <informalexample><programlisting>
 *  GooCanvasItemModel *path = goo_canvas_path_model_new (mygroup,
 *                                                        "M20,100 C20,50 100,50 100,100",
 *                                                        "stroke-color", "blue",
 *                                                        NULL);
 * </programlisting></informalexample>
 *
 * This example uses an elliptical arc to create a filled circle with one
 * quarter missing:
 * 
 * <informalexample><programlisting>
 *  GooCanvasItemModel *path = goo_canvas_path_model_new (mygroup,
 *                                                        "M200,500 h-150 a150,150 0 1,0 150,-150 z",
 *                                                        "fill-color", "red",
 *                                                        "stroke-color", "blue",
 *                                                        "line-width", 5.0,
 *                                                        NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new path model.
 **/
GooCanvasItemModel*
goo_canvas_path_model_new (GooCanvasItemModel *parent,
			   const gchar        *path_data,
			   ...)
{
  GooCanvasItemModel *model;
  GooCanvasPathModel *pmodel;
  const char *first_property;
  va_list var_args;

  model = g_object_new (GOO_TYPE_CANVAS_PATH_MODEL, NULL);
  pmodel = (GooCanvasPathModel*) model;

  pmodel->path_data.path_commands = goo_canvas_parse_path_data (path_data);

  va_start (var_args, path_data);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) model, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_model_add_child (parent, model, -1);
      g_object_unref (model);
    }

  return model;
}
void
qof_instance_set (QofInstance *inst, const gchar *first_prop, ...)
{
    va_list ap;
    QofInstancePrivate *priv = GET_PRIVATE(inst);
    g_return_if_fail (QOF_IS_INSTANCE (inst));

    qof_instance_set_dirty (inst);
    va_start (ap, first_prop);
    g_object_set_valist (G_OBJECT (inst), first_prop, ap);
    va_end (ap);
}
Beispiel #7
0
void
gimp_text_layer_set (GimpTextLayer *layer,
                     const gchar   *undo_desc,
                     const gchar   *first_property_name,
                     ...)
{
  GimpImage *image;
  GimpText  *text;
  va_list    var_args;

  g_return_if_fail (gimp_item_is_text_layer (GIMP_ITEM (layer)));
  g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)));

  text = gimp_text_layer_get_text (layer);
  if (! text)
    return;

  image = gimp_item_get_image (GIMP_ITEM (layer));

  gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TEXT, undo_desc);

  g_object_freeze_notify (G_OBJECT (layer));

  if (layer->modified)
    {
      gimp_image_undo_push_text_layer_modified (image, NULL, layer);

      /*  pass copy_tiles = TRUE so we not only ref the tiles; after
       *  being a text layer again, undo doesn't care about the
       *  layer's pixels any longer because they are generated, so
       *  changing the text would happily overwrite the layer's
       *  pixels, changing the pixels on the undo stack too without
       *  any chance to ever undo again.
       */
      gimp_image_undo_push_drawable_mod (image, NULL,
                                         GIMP_DRAWABLE (layer), TRUE);
    }

  gimp_image_undo_push_text_layer (image, undo_desc, layer, NULL);

  va_start (var_args, first_property_name);

  g_object_set_valist (G_OBJECT (text), first_property_name, var_args);

  va_end (var_args);

  g_object_set (layer, "modified", FALSE, NULL);

  g_object_thaw_notify (G_OBJECT (layer));

  gimp_image_undo_group_end (image);
}
Beispiel #8
0
static void
skin_status_bar_construct(SkinStatusBar *status_bar, 
							GnomeCanvasGroup *root, 
							const gchar *first_arg_name, 
							va_list args)
{
	g_return_if_fail(GNOME_IS_CANVAS_GROUP(root));
	g_return_if_fail(SKIN_IS_STATUS_BAR(status_bar));

	status_bar->priv->root = root;
	g_object_set_valist(G_OBJECT(status_bar), first_arg_name, args);

	skin_status_bar_update(status_bar);
}
Beispiel #9
0
Datei: circle.c Projekt: EQ4/lad
GanvCircle*
ganv_circle_new(GanvCanvas* canvas,
                const char* first_property_name, ...)
{
	GanvCircle* circle = GANV_CIRCLE(
		g_object_new(ganv_circle_get_type(), "canvas", canvas, NULL));

	va_list args;
	va_start(args, first_property_name);
	g_object_set_valist(G_OBJECT(circle), first_property_name, args);
	va_end(args);

	return circle;
}
/* takes over reference for outcaps */
static GstElement *
setup_filter (const gchar * name, const gchar * prop, va_list var_args)
{
  GstElement *element;

  GST_DEBUG ("setup_element");
  element = gst_check_setup_element (name);
  g_object_set_valist (G_OBJECT (element), prop, var_args);
  mysrcpad = gst_check_setup_src_pad (element, &srctemplate);
  gst_pad_set_active (mysrcpad, TRUE);
  mysinkpad = gst_check_setup_sink_pad (element, &sinktemplate);
  gst_pad_set_active (mysinkpad, TRUE);

  return element;
}
Beispiel #11
0
static gboolean
gui_pdb_dialog_set (Gimp          *gimp,
                    GimpContainer *container,
                    const gchar   *callback_name,
                    const gchar   *object_name,
                    va_list        args)
{
  GimpPdbDialogClass *klass = NULL;

  if (gimp_container_get_children_type (container) == GIMP_TYPE_BRUSH)
    klass = g_type_class_peek (GIMP_TYPE_BRUSH_SELECT);
  else if (gimp_container_get_children_type (container) == GIMP_TYPE_FONT)
    klass = g_type_class_peek (GIMP_TYPE_FONT_SELECT);
  else if (gimp_container_get_children_type (container) == GIMP_TYPE_GRADIENT)
    klass = g_type_class_peek (GIMP_TYPE_GRADIENT_SELECT);
  else if (gimp_container_get_children_type (container) == GIMP_TYPE_PALETTE)
    klass = g_type_class_peek (GIMP_TYPE_PALETTE_SELECT);
  else if (gimp_container_get_children_type (container) == GIMP_TYPE_PATTERN)
    klass = g_type_class_peek (GIMP_TYPE_PATTERN_SELECT);

  if (klass)
    {
      GimpPdbDialog *dialog;

      dialog = gimp_pdb_dialog_get_by_callback (klass, callback_name);

      if (dialog && dialog->select_type == gimp_container_get_children_type (container))
        {
          GimpObject *object;

          object = gimp_container_get_child_by_name (container, object_name);

          if (object)
            {
              const gchar *prop_name = va_arg (args, const gchar *);

              gimp_context_set_by_type (dialog->context, dialog->select_type,
                                        object);

              if (prop_name)
                g_object_set_valist (G_OBJECT (dialog), prop_name, args);

              gtk_window_present (GTK_WINDOW (dialog));

              return TRUE;
            }
        }
    }
Beispiel #12
0
/**
 * \internal
 * Appends \p text into validate log with pair of style/values, as seen in #GtkTextTag properties.
 *
 * \see GtkTextTag
 */
static GtkTextTag *
validate_append_text_with_property_list(struct validate *validate, const gchar * text,
					const gchar * first_property_name, ...)
{
	GtkTextTag *text_tag;
	va_list argp;

	text_tag = gtk_text_tag_new(NULL);
	gtk_text_tag_table_add(gtk_text_buffer_get_tag_table(validate->text_buffer), text_tag);
	va_start(argp, first_property_name);
	g_object_set_valist(G_OBJECT(text_tag), first_property_name, argp);
	va_end(argp);

	validate_append_text_with_tag(validate, text_tag, text);

	return text_tag;
}
Beispiel #13
0
/**
 * goo_canvas_widget_new:
 * @parent: the parent item, or %NULL. If a parent is specified, it will assume
 *  ownership of the item, and the item will automatically be freed when it is
 *  removed from the parent. Otherwise call g_object_unref() to free it.
 * @widget: the widget.
 * @x: the x coordinate of the item.
 * @y: the y coordinate of the item.
 * @width: the width of the item, or -1 to use the widget's requested width.
 * @height: the height of the item, or -1 to use the widget's requested height.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 *
 * Creates a new widget item.
 *
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create an entry widget centered at (100.0,
 * 100.0):
 *
 * <informalexample><programlisting>
 *  GtkWidget *entry = gtk_entry_new ();
 *  GooCanvasItem *witem = goo_canvas_widget_new (mygroup, entry,
 *                                                100, 100, -1, -1,
 *                                                "anchor", GTK_ANCHOR_CENTER,
 *                                                NULL);
 * </programlisting></informalexample>
 *
 * Returns: a new widget item.
 **/
GooCanvasItem*
goo_canvas_widget_new               (GooCanvasItem    *parent,
				     GtkWidget        *widget,
				     gdouble           x,
				     gdouble           y,
				     gdouble           width,
				     gdouble           height,
				     ...)
{
  GooCanvasItem *item;
  GooCanvasWidget *witem;
  const char *first_property;
  va_list var_args;

  item = g_object_new (GOO_TYPE_CANVAS_WIDGET, NULL);
  witem = (GooCanvasWidget*) item;

  witem->widget = widget;
  g_object_ref (witem->widget);
  g_object_set_data (G_OBJECT (witem->widget), "goo-canvas-item", witem);

  witem->x = x;
  witem->y = y;
  witem->width = width;
  witem->height = height;

  /* The widget defaults to being visible, like the canvas item, but this
     can be overridden by the object property below. */
  if (widget)
    gtk_widget_show (widget);

  va_start (var_args, height);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
Beispiel #14
0
EvTransitionEffect *
ev_transition_effect_new (EvTransitionEffectType  type,
			  const gchar		 *first_property_name,
			  ...)
{
	GObject *object;
	va_list	 args;

	object = g_object_new (EV_TYPE_TRANSITION_EFFECT,
			       "type", type,
			       NULL);

	va_start (args, first_property_name);
	g_object_set_valist (object, first_property_name, args);
	va_end (args);

	return EV_TRANSITION_EFFECT (object);
}
static void
action_set (GActionGroup *group,
            const gchar  *action_name,
            const gchar  *first_param,
            ...)
{
  GAction *action;
  va_list args;

  g_assert (G_IS_ACTION_GROUP (group));
  g_assert (G_IS_ACTION_MAP (group));

  action = g_action_map_lookup_action (G_ACTION_MAP (group), action_name);
  g_assert (G_IS_SIMPLE_ACTION (action));

  va_start (args, first_param);
  g_object_set_valist (G_OBJECT (action), first_param, args);
  va_end (args);
}
Beispiel #16
0
/**
 * goo_canvas_polyline_model_new_line:
 * @parent: the parent model, or %NULL.
 * @x1: the x coordinate of the start of the line.
 * @y1: the y coordinate of the start of the line.
 * @x2: the x coordinate of the end of the line.
 * @y2: the y coordinate of the end of the line.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new polyline model with a single line.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a line from (100,100) to (300,300).
 *
 * <informalexample><programlisting>
 *  GooCanvasItemModel *polyline = goo_canvas_polyline_model_new_line (mygroup,
 *                                                                     100.0, 100.0,
 *                                                                     300.0, 300.0,
 *                                                                     "stroke-color", "red",
 *                                                                     "line-width", 5.0,
 *                                                                     NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new polyline model.
 **/
GooCanvasItemModel*
goo_canvas_polyline_model_new_line (GooCanvasItemModel *parent,
				    gdouble             x1,
				    gdouble             y1,
				    gdouble             x2,
				    gdouble             y2,
				    ...)
{
  GooCanvasItemModel *model;
  GooCanvasPolylineModel *pmodel;
  GooCanvasPolylineData *polyline_data;
  const char *first_property;
  va_list var_args;

  model = g_object_new (GOO_TYPE_CANVAS_POLYLINE_MODEL, NULL);
  pmodel = (GooCanvasPolylineModel*) model;

  polyline_data = &pmodel->polyline_data;
  polyline_data->close_path = FALSE;
  polyline_data->num_points = 2;
  polyline_data->coords = g_slice_alloc (4 * sizeof (gdouble));
  polyline_data->coords[0] = x1;
  polyline_data->coords[1] = y1;
  polyline_data->coords[2] = x2;
  polyline_data->coords[3] = y2;

  va_start (var_args, y2);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) model, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_model_add_child (parent, model, -1);
      g_object_unref (model);
    }

  return model;
}
Beispiel #17
0
/**
 * goo_canvas_polyline_new_line:
 * @parent: the parent item, or %NULL.
 * @x1: the x coordinate of the start of the line.
 * @y1: the y coordinate of the start of the line.
 * @x2: the x coordinate of the end of the line.
 * @y2: the y coordinate of the end of the line.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new polyline item with a single line.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a line from (100,100) to (300,300).
 *
 * <informalexample><programlisting>
 *  GooCanvasItem *polyline = goo_canvas_polyline_new_line (mygroup,
 *                                                          100.0, 100.0,
 *                                                          300.0, 300.0,
 *                                                          "stroke-color", "red",
 *                                                          "line-width", 5.0,
 *                                                          NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new polyline item.
 **/
GooCanvasItem*
goo_canvas_polyline_new_line          (GooCanvasItem *parent,
				       gdouble        x1,
				       gdouble        y1,
				       gdouble        x2,
				       gdouble        y2,
				       ...)
{
  GooCanvasItem *item;
  GooCanvasPolyline *polyline;
  GooCanvasPolylineData *polyline_data;
  const char *first_property;
  va_list var_args;

  item = g_object_new (GOO_TYPE_CANVAS_POLYLINE, NULL);
  polyline = (GooCanvasPolyline*) item;

  polyline_data = polyline->polyline_data;
  polyline_data->close_path = FALSE;
  polyline_data->num_points = 2;
  polyline_data->coords = g_slice_alloc (4 * sizeof (gdouble));
  polyline_data->coords[0] = x1;
  polyline_data->coords[1] = y1;
  polyline_data->coords[2] = x2;
  polyline_data->coords[3] = y2;

  va_start (var_args, y2);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
/* Makes sure that icon/progress item contains the desired type
   of item. If possible, tries to avoid creating a new widget but
   reuses the existing one */
static void
hildon_banner_ensure_child                      (HildonBanner *self, 
                                                 GtkWidget *user_widget,
                                                 guint pos,
                                                 GType type,
                                                 const gchar *first_property, 
                                                 ...)
{
    GtkWidget *widget;
    va_list args;
    HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (self);

    g_assert (priv);

    widget = priv->main_item;
    va_start (args, first_property);

    /* Reuse existing widget if possible */
    if (! user_widget && G_TYPE_CHECK_INSTANCE_TYPE (widget, type))
    {
        g_object_set_valist (G_OBJECT (widget), first_property, args);
    }
    else
    {
        /* We have to abandon old content widget */
        if (widget)
            gtk_container_remove (GTK_CONTAINER (priv->layout), widget);
        
        /* Use user provided widget or create a new one */
        priv->main_item = widget = user_widget ? 
            user_widget : GTK_WIDGET (g_object_new_valist(type, first_property, args));
        gtk_box_pack_start (GTK_BOX (priv->layout), widget, FALSE, FALSE, 0);
    }

    /* We make sure that the widget exists in desired position. Different
       banners place this child widget to different places */
    gtk_box_reorder_child (GTK_BOX (priv->layout), widget, pos);
    va_end (args);
}
Beispiel #19
0
/**
 * mx_table_insert_actor_with_properties
 * @table: a #MxTable
 * @actor: the child #ClutterActor
 * @row: the row to place the child into
 * @column: the column to place the child into
 * @first_property_name: name of the first property to set
 * @...: value for the first property, followed optionally by more name/value pairs terminated with NULL.
 *
 * Add an actor into at the specified row and column, with additional child
 * properties to set.
 */
void
mx_table_insert_actor_with_properties (MxTable      *table,
                                       ClutterActor *actor,
                                       gint          row,
                                       gint          column,
                                       const gchar  *first_property_name,
                                       ...)
{
  va_list args;
  MxTableChild *meta;

  g_return_if_fail (MX_IS_TABLE (table));
  g_return_if_fail (CLUTTER_IS_ACTOR (actor));
  g_return_if_fail (row >= -1);
  g_return_if_fail (column >= -1);
  g_return_if_fail (first_property_name != NULL);

  if (row < 0)
    row = table->priv->n_rows + 1;

  if (column < 0)
    column = table->priv->n_cols + 1;

  clutter_actor_add_child (CLUTTER_ACTOR (table), actor);

  meta =
    (MxTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (table),
                                                       actor);
  meta->row = row;
  meta->col = column;

  va_start (args, first_property_name);
  g_object_set_valist ((GObject*) meta, first_property_name, args);
  va_end (args);

  _mx_table_update_row_col (table, meta);

  clutter_actor_queue_relayout (CLUTTER_ACTOR (table));
}
Beispiel #20
0
/**
 * goo_canvas_rect_model_new:
 * @parent: the parent model, or %NULL. If a parent is specified, it will
 *  assume ownership of the item, and the item will automatically be freed when
 *  it is removed from the parent. Otherwise call g_object_unref() to free it.
 * @x: the x coordinate of the left of the rectangle.
 * @y: the y coordinate of the top of the rectangle.
 * @width: the width of the rectangle.
 * @height: the height of the rectangle.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new rectangle item.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a rectangle at (100,100) with a
 * width of 200 and a height of 100.
 *
 * <informalexample><programlisting>
 *  GooCanvasItemModel *rect = goo_canvas_rect_model_new (mygroup, 100.0, 100.0, 200.0, 100.0,
 *                                                        "stroke-color", "red",
 *                                                        "line-width", 5.0,
 *                                                        "fill-color", "blue",
 *                                                        NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new rectangle model.
 **/
GooCanvasItemModel*
goo_canvas_rect_model_new (GooCanvasItemModel *parent,
			   gdouble             x,
			   gdouble             y,
			   gdouble             width,
			   gdouble             height,
			   ...)
{
  GooCanvasItemModel *model;
  GooCanvasRectModel *rmodel;
  GooCanvasRectData *rect_data;
  const char *first_property;
  va_list var_args;

  model = g_object_new (GOO_TYPE_CANVAS_RECT_MODEL, NULL);
  rmodel = (GooCanvasRectModel*) model;

  rect_data = &rmodel->rect_data;
  rect_data->x = x;
  rect_data->y = y;
  rect_data->width = width;
  rect_data->height = height;
  rect_data->radius_x = 0;
  rect_data->radius_y = 0;

  va_start (var_args, height);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) model, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_model_add_child (parent, model, -1);
      g_object_unref (model);
    }

  return model;
}
Beispiel #21
0
/**
 * goo_canvas_rect_new:
 * @parent: the parent item, or %NULL. If a parent is specified, it will assume
 *  ownership of the item, and the item will automatically be freed when it is
 *  removed from the parent. Otherwise call g_object_unref() to free it.
 * @x: the x coordinate of the left of the rectangle.
 * @y: the y coordinate of the top of the rectangle.
 * @width: the width of the rectangle.
 * @height: the height of the rectangle.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new rectangle item.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a rectangle at (100,100) with a
 * width of 200 and a height of 100.
 *
 * <informalexample><programlisting>
 *  GooCanvasItem *rect = goo_canvas_rect_new (mygroup, 100.0, 100.0, 200.0, 100.0,
 *                                             "stroke-color", "red",
 *                                             "line-width", 5.0,
 *                                             "fill-color", "blue",
 *                                             NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new rectangle item.
 **/
GooCanvasItem*
goo_canvas_rect_new (GooCanvasItem *parent,
		     gdouble        x,
		     gdouble        y,
		     gdouble        width,
		     gdouble        height,
		     ...)
{
  GooCanvasItem *item;
  GooCanvasRect *rect;
  GooCanvasRectData *rect_data;
  const char *first_property;
  va_list var_args;

  item = g_object_new (GOO_TYPE_CANVAS_RECT, NULL);
  rect = (GooCanvasRect*) item;

  rect_data = rect->rect_data;
  rect_data->x = x;
  rect_data->y = y;
  rect_data->width = width;
  rect_data->height = height;
  rect_data->radius_x = 0;
  rect_data->radius_y = 0;

  va_start (var_args, height);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
Beispiel #22
0
/**
 * goo_canvas_polyline_model_new:
 * @parent: the parent model, or %NULL. If a parent is specified, it will
 *  assume ownership of the item, and the item will automatically be freed when
 *  it is removed from the parent. Otherwise call g_object_unref() to free it.
 * @close_path: if the last point should be connected to the first.
 * @num_points: the number of points in the polyline.
 * @...: the pairs of coordinates for each point in the line, followed by
 *  optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new polyline model.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a filled triangle with vertices
 * at (100,100), (300,100), and (200,300).
 *
 * <informalexample><programlisting>
 *  GooCanvasItemModel *polyline = goo_canvas_polyline_model_new (mygroup, TRUE, 3,
 *                                                                100.0, 100.0,
 *                                                                300.0, 100.0,
 *                                                                200.0, 300.0,
 *                                                                "stroke-color", "red",
 *                                                                "line-width", 5.0,
 *                                                                "fill-color", "blue",
 *                                                                NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new polyline model.
 **/
GooCanvasItemModel*
goo_canvas_polyline_model_new (GooCanvasItemModel *parent,
			       gboolean            close_path,
			       gint                num_points,
			       ...)
{
  GooCanvasItemModel *model;
  GooCanvasPolylineModel *pmodel;
  GooCanvasPolylineData *polyline_data;
  const char *first_property;
  va_list var_args;
  gint i;

  model = g_object_new (GOO_TYPE_CANVAS_POLYLINE_MODEL, NULL);
  pmodel = (GooCanvasPolylineModel*) model;

  polyline_data = &pmodel->polyline_data;
  polyline_data->close_path = close_path;
  polyline_data->num_points = num_points;
  if (num_points)
    polyline_data->coords = g_slice_alloc (num_points * 2 * sizeof (gdouble));

  va_start (var_args, num_points);
  for (i = 0; i < num_points * 2; i++)
    polyline_data->coords[i] = va_arg (var_args, gdouble);

  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) model, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_model_add_child (parent, model, -1);
      g_object_unref (model);
    }

  return model;
}
Beispiel #23
0
/**
 * goo_canvas_polyline_new:
 * @parent: the parent item, or %NULL. If a parent is specified, it will assume
 *  ownership of the item, and the item will automatically be freed when it is
 *  removed from the parent. Otherwise call g_object_unref() to free it.
 * @close_path: if the last point should be connected to the first.
 * @num_points: the number of points in the polyline.
 * @...: the pairs of coordinates for each point in the line, followed by
 *  optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new polyline item.
 * 
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create a filled triangle with vertices
 * at (100,100), (300,100), and (200,300).
 *
 * <informalexample><programlisting>
 *  GooCanvasItem *polyline = goo_canvas_polyline_new (mygroup, TRUE, 3,
 *                                                     100.0, 100.0,
 *                                                     300.0, 100.0,
 *                                                     200.0, 300.0,
 *                                                     "stroke-color", "red",
 *                                                     "line-width", 5.0,
 *                                                     "fill-color", "blue",
 *                                                     NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new polyline item.
 **/
GooCanvasItem*
goo_canvas_polyline_new               (GooCanvasItem *parent,
				       gboolean       close_path,
				       gint           num_points,
				       ...)
{
  GooCanvasItem *item;
  GooCanvasPolyline *polyline;
  GooCanvasPolylineData *polyline_data;
  const char *first_property;
  va_list var_args;
  gint i;

  item = g_object_new (GOO_TYPE_CANVAS_POLYLINE, NULL);
  polyline = (GooCanvasPolyline*) item;

  polyline_data = polyline->polyline_data;
  polyline_data->close_path = close_path;
  polyline_data->num_points = num_points;
  if (num_points)
    polyline_data->coords = g_slice_alloc (num_points * 2 * sizeof (gdouble));

  va_start (var_args, num_points);
  for (i = 0; i < num_points * 2; i++)
    polyline_data->coords[i] = va_arg (var_args, gdouble);

  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
Beispiel #24
0
/**
 * goo_canvas_ellipse_new:
 * @parent: the parent item, or %NULL. If a parent is specified, it will assume
 *  ownership of the item, and the item will automatically be freed when it is
 *  removed from the parent. Otherwise call g_object_unref() to free it.
 * @center_x: the x coordinate of the center of the ellipse.
 * @center_y: the y coordinate of the center of the ellipse.
 * @radius_x: the horizontal radius of the ellipse.
 * @radius_y: the vertical radius of the ellipse.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new ellipse item.
 *
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create an ellipse centered at (100.0,
 * 100.0), with a horizontal radius of 50.0 and a vertical radius of 30.0.
 * It is drawn with a red outline with a width of 5.0 and filled with blue:
 *
 * <informalexample><programlisting>
 *  GooCanvasItem *ellipse = goo_canvas_ellipse_new (mygroup, 100.0, 100.0, 50.0, 30.0,
 *                                                   "stroke-color", "red",
 *                                                   "line-width", 5.0,
 *                                                   "fill-color", "blue",
 *                                                   NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new ellipse item.
 **/
GooCanvasItem*
goo_canvas_ellipse_new (GooCanvasItem *parent,
			gdouble        center_x,
			gdouble        center_y,
			gdouble        radius_x,
			gdouble        radius_y,
			...)
{
  GooCanvasItem *item;
  GooCanvasEllipse *ellipse;
  GooCanvasEllipseData *ellipse_data;
  const char *first_property;
  va_list var_args;

  item = g_object_new (GOO_TYPE_CANVAS_ELLIPSE, NULL);
  ellipse = (GooCanvasEllipse*) item;

  ellipse_data = ellipse->ellipse_data;
  ellipse_data->center_x = center_x;
  ellipse_data->center_y = center_y;
  ellipse_data->radius_x = radius_x;
  ellipse_data->radius_y = radius_y;

  va_start (var_args, radius_y);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) item, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_add_child (parent, item, -1);
      g_object_unref (item);
    }

  return item;
}
Beispiel #25
0
/**
 * goo_canvas_ellipse_model_new:
 * @parent: the parent model, or %NULL. If a parent is specified, it will
 *  assume ownership of the item, and the item will automatically be freed when
 *  it is removed from the parent. Otherwise call g_object_unref() to free it.
 * @center_x: the x coordinate of the center of the ellipse.
 * @center_y: the y coordinate of the center of the ellipse.
 * @radius_x: the horizontal radius of the ellipse.
 * @radius_y: the vertical radius of the ellipse.
 * @...: optional pairs of property names and values, and a terminating %NULL.
 * 
 * Creates a new ellipse model.
 *
 * <!--PARAMETERS-->
 *
 * Here's an example showing how to create an ellipse centered at (100.0,
 * 100.0), with a horizontal radius of 50.0 and a vertical radius of 30.0.
 * It is drawn with a red outline with a width of 5.0 and filled with blue:
 *
 * <informalexample><programlisting>
 *  GooCanvasItemModel *ellipse = goo_canvas_ellipse_model_new (mygroup, 100.0, 100.0, 50.0, 30.0,
 *                                                              "stroke-color", "red",
 *                                                              "line-width", 5.0,
 *                                                              "fill-color", "blue",
 *                                                              NULL);
 * </programlisting></informalexample>
 * 
 * Returns: a new ellipse model.
 **/
GooCanvasItemModel*
goo_canvas_ellipse_model_new (GooCanvasItemModel *parent,
			      gdouble             center_x,
			      gdouble             center_y,
			      gdouble             radius_x,
			      gdouble             radius_y,
			      ...)
{
  GooCanvasItemModel *model;
  GooCanvasEllipseModel *emodel;
  GooCanvasEllipseData *ellipse_data;
  const char *first_property;
  va_list var_args;

  model = g_object_new (GOO_TYPE_CANVAS_ELLIPSE_MODEL, NULL);
  emodel = (GooCanvasEllipseModel*) model;

  ellipse_data = &emodel->ellipse_data;
  ellipse_data->center_x = center_x;
  ellipse_data->center_y = center_y;
  ellipse_data->radius_x = radius_x;
  ellipse_data->radius_y = radius_y;

  va_start (var_args, radius_y);
  first_property = va_arg (var_args, char*);
  if (first_property)
    g_object_set_valist ((GObject*) model, first_property, var_args);
  va_end (var_args);

  if (parent)
    {
      goo_canvas_item_model_add_child (parent, model, -1);
      g_object_unref (model);
    }

  return model;
}
Beispiel #26
0
/**
 * gdict_source_set_transportv
 * @source: a #GdictSource
 * @transport: a #GdictSourceTransport
 * @first_transport_property: FIXME
 * @var_args: FIXME
 *
 * FIXME
 *
 * Since: 1.0
 */
void
gdict_source_set_transportv (GdictSource          *source,
			     GdictSourceTransport  transport,
			     const gchar          *first_transport_property,
			     va_list               var_args)
{
  GdictSourcePrivate *priv;
  
  g_return_if_fail (GDICT_IS_SOURCE (source));
  g_return_if_fail (IS_VALID_TRANSPORT (transport));
  
  priv = source->priv;
  
  priv->transport = transport;
      
  if (priv->context)
    g_object_unref (priv->context);
  
  switch (priv->transport)
    {
    case GDICT_SOURCE_TRANSPORT_DICTD:
      priv->context = gdict_client_context_new (NULL, -1);
      g_assert (GDICT_IS_CLIENT_CONTEXT (priv->context));
      
      g_object_set_valist (G_OBJECT (priv->context),
                           first_transport_property,
                           var_args);
      
      break;
    case GDICT_SOURCE_TRANSPORT_INVALID:
    default:
      g_assert_not_reached ();
      break;
    }
  
  /* update the keyfile */
  if (!priv->keyfile)
    priv->keyfile = g_key_file_new ();
      
  g_key_file_set_string (priv->keyfile,
  			 SOURCE_GROUP,
  			 SOURCE_KEY_TRANSPORT,
  			 valid_transports[transport]);
  
  switch (priv->transport)
    {
    case GDICT_SOURCE_TRANSPORT_DICTD:
      g_key_file_set_string (priv->keyfile,
      			     SOURCE_GROUP,
      			     SOURCE_KEY_HOSTNAME,
      			     gdict_client_context_get_hostname (GDICT_CLIENT_CONTEXT (priv->context)));
      g_key_file_set_integer (priv->keyfile,
      			      SOURCE_GROUP,
      			      SOURCE_KEY_PORT,
      			      gdict_client_context_get_port (GDICT_CLIENT_CONTEXT (priv->context)));
      break;
    case GDICT_SOURCE_TRANSPORT_INVALID:
    default:
      g_assert_not_reached ();
      break;
    }
}
Beispiel #27
0
/*
 * Create a new price tree view with (optional) top level root node.
 * This view will be based on a model that is common to all view of
 * the same set of books, but will have its own private filter on that
 * model.
 */
GtkTreeView *
gnc_tree_view_price_new (QofBook *book,
                         const gchar *first_property_name,
                         ...)
{
    GncTreeView *view;
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreeViewColumn *col;
    GNCPriceDB *price_db;
    va_list var_args;
    const gchar *sample_text;
    gchar *sample_text2;

    ENTER(" ");
    /* Create/get a pointer to the existing model for this set of books. */
    price_db = gnc_pricedb_get_db(book);
    model = gnc_tree_model_price_new (book, price_db);

    /* Set up the view private filter on the common model. */
    f_model = gtk_tree_model_filter_new (model, NULL);
    g_object_unref(G_OBJECT(model));
    s_model = gtk_tree_model_sort_new_with_model (f_model);
    g_object_unref(G_OBJECT(f_model));

    /* Create our view */
    view = g_object_new (GNC_TYPE_TREE_VIEW_PRICE,
                         "name", "price_tree", NULL);
    gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
    g_object_unref(G_OBJECT(s_model));

    DEBUG("model ref count is %d",   G_OBJECT(model)->ref_count);
    DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
    DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);

    sample_text = gnc_commodity_get_printname(gnc_default_currency());
    sample_text2 = g_strdup_printf("%s%s", sample_text, sample_text);
    col = gnc_tree_view_add_text_column (
              view, _("Security"), "security", NULL, sample_text2,
              GNC_TREE_MODEL_PRICE_COL_COMMODITY,
              GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
              sort_by_name);
    g_free(sample_text2);
    col = gnc_tree_view_add_text_column (
              view, _("Currency"), "currency", NULL, sample_text,
              GNC_TREE_MODEL_PRICE_COL_CURRENCY,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_name);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Date"), "date", NULL, "2005-05-20",
              GNC_TREE_MODEL_PRICE_COL_DATE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_date);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Source"), "source", NULL, "Finance::Quote",
              GNC_TREE_MODEL_PRICE_COL_SOURCE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_source);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Type"), "type", NULL, "last",
              GNC_TREE_MODEL_PRICE_COL_TYPE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_type);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_numeric_column (
              view, _("Price"), "price", "100.00000",
              GNC_TREE_MODEL_PRICE_COL_VALUE,
              GNC_TREE_VIEW_COLUMN_COLOR_NONE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_value);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));

    gnc_tree_view_configure_columns(view);

    /* Set properties */
    va_start (var_args, first_property_name);
    g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
    va_end (var_args);

    /* Sort on the commodity column by default. This allows for a consistent
     * sort if commodities are removed and re-added from the model. */
    if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
            NULL, NULL))
    {
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
                                             GNC_TREE_MODEL_PRICE_COL_COMMODITY,
                                             GTK_SORT_ASCENDING);
    }

    gtk_widget_show(GTK_WIDGET(view));
    LEAVE(" %p", view);
    return GTK_TREE_VIEW(view);
}
/*
 * Create a new commodity tree view with (optional) top level root node.
 * This view will be based on a model that is common to all view of
 * the same set of books, but will have its own private filter on that
 * model.
 */
GtkTreeView *
gnc_tree_view_commodity_new (QofBook *book,
                             const gchar *first_property_name,
                             ...)
{
    GncTreeView *view;
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreeViewColumn *col;
    gnc_commodity_table *ct;
    va_list var_args;

    ENTER(" ");
    /* Create/get a pointer to the existing model for this set of books. */
    ct = gnc_commodity_table_get_table (book);
    model = gnc_tree_model_commodity_new (book, ct);

    /* Set up the view private filter on the common model. */
    f_model = gtk_tree_model_filter_new (model, NULL);
    g_object_unref(G_OBJECT(model));
    s_model = gtk_tree_model_sort_new_with_model (f_model);
    g_object_unref(G_OBJECT(f_model));

    /* Create our view */
    view = g_object_new (GNC_TYPE_TREE_VIEW_COMMODITY,
                         "name", "commodity_tree", NULL);
    gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
    g_object_unref(G_OBJECT(s_model));

    DEBUG("model ref count is %d",   G_OBJECT(model)->ref_count);
    DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
    DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);

    /* Set default visibilities */
    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);

    col = gnc_tree_view_add_text_column (
              view, _("Namespace"), "namespace", NULL, "NASDAQ",
              GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE,
              GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              view, _("Symbol"), "symbol", NULL, "ACMEACME",
              GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Name"), "name", NULL, "Acme Corporation, Inc.",
              GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Print Name"), "printname", NULL,
              "ACMEACME (Acme Corporation, Inc.)",
              GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              view, _("Display symbol"), "user_symbol", NULL, "ACME",
              GNC_TREE_MODEL_COMMODITY_COL_USER_SYMBOL,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Unique Name"), "uniquename", NULL,
              "NASDAQ::ACMEACME", GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              /* Translators: Again replace CUSIP by the name of your
                 National Securities Identifying Number. */
              view, _("ISIN/CUSIP"), "cusip_code", NULL, "QWERTYUIOP",
              GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_numeric_column (
              view, _("Fraction"), "fraction", "10000",
              GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
              GNC_TREE_VIEW_COLUMN_COLOR_NONE,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_fraction);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_toggle_column(
              view, _("Get Quotes"),
              /* Translators: This string has a context prefix; the translation
                 must only contain the part after the | character. */
              Q_("Column letter for 'Get Quotes'|Q"), "quote_flag",
              GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_quote_flag,
              NULL);
    col = gnc_tree_view_add_text_column (
              view, _("Source"), "quote_source", NULL, "yahoo",
              GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              view, _("Timezone"), "quote_timezone", NULL, "America/New_York",
              GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));

    gnc_tree_view_configure_columns(view);

    /* Set properties */
    va_start (var_args, first_property_name);
    g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
    va_end (var_args);

    /* Sort on the name column by default. This allows for a consistent
     * sort if commodities are briefly removed and re-added. */
    if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
            NULL, NULL))
    {
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
                                             GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
                                             GTK_SORT_ASCENDING);
    }

    gtk_widget_show(GTK_WIDGET(view));
    LEAVE(" %p", view);
    return GTK_TREE_VIEW(view);
}