Commit 7296d477 authored by Johannes Schmid's avatar Johannes Schmid Committed by Johannes Schmid

Removed old and unused API and thus fixed #513845 – Port gdl to gio

2008-09-02  Johannes Schmid  <jhs@gnome.org>

        * Makefile.am:
        * configure.in:
        * docs/reference/gdl-sections.txt:
        * docs/reference/gdl.types:
        * gdl-gnome-1.0.pc.in:
        * gdl/Makefile.am:
        * gdl/gdl-data-frame.c:
        * gdl/gdl-data-frame.h:
        * gdl/gdl-data-model-test.c:
        * gdl/gdl-data-model-test.h:
        * gdl/gdl-data-model.c:
        * gdl/gdl-data-model.h:
        * gdl/gdl-data-row.c:
        * gdl/gdl-data-row.h:
        * gdl/gdl-data-view.c:
        * gdl/gdl-data-view.h:
        * gdl/test-dataview.c:
        Removed old and unused API and thus fixed
        #513845 – Port gdl to gio


svn path=/trunk/; revision=498
parent 5cfb1f4b
2008-09-02 Johannes Schmid <jhs@gnome.org>
* Makefile.am:
* configure.in:
* docs/reference/gdl-sections.txt:
* docs/reference/gdl.types:
* gdl-gnome-1.0.pc.in:
* gdl/Makefile.am:
* gdl/gdl-data-frame.c:
* gdl/gdl-data-frame.h:
* gdl/gdl-data-model-test.c:
* gdl/gdl-data-model-test.h:
* gdl/gdl-data-model.c:
* gdl/gdl-data-model.h:
* gdl/gdl-data-row.c:
* gdl/gdl-data-row.h:
* gdl/gdl-data-view.c:
* gdl/gdl-data-view.h:
* gdl/test-dataview.c:
Removed old and unused API and thus fixed
#513845 – Port gdl to gio
=== gdl 2.23.90 ===
2008-08-18 Naba Kumar <naba@gnome.org>
......
......@@ -11,10 +11,6 @@ EXTRA_DIST = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gdl-1.0.pc
if HAVE_GNOME
pkgconfig_DATA += gdl-gnome-1.0.pc
endif
CLEANFILES = gdl-1.0.pc intltool-extract intltool-merge intltool-update
......@@ -32,14 +32,10 @@ SNAPSHOT=0_`date +%Y%m%d_%H%M%S`_cvs
AC_SUBST(SNAPSHOT)
GTK_REQUIRED=2.12.0
GNOME_REQUIRED=2.6.0
XML_REQUIRED=2.2.8
LIBGLADE_REQUIRED=2.0.0
GNOME_VFS_REQUIRED=2.6.0
GCONF_REQUIRED=2.0.0
AC_SUBST(GTK_REQUIRED)
AC_SUBST(GNOME_REQUIRED)
AC_SUBST(XML_REQUIRED)
AC_SUBST(LIBGLADE_REQUIRED)
......@@ -74,38 +70,6 @@ PKG_CHECK_MODULES(GDL_DEPENDENCIES,
AC_SUBST(GDL_DEPENDENCIES_CFLAGS)
AC_SUBST(GDL_DEPENDENCIES_LIBS)
dnl ****************
dnl GNOME Libraries
dnl ****************
AC_ARG_ENABLE(gnome,
[ --disable-gnome Compile without gnome support],
[ if test "$enableval" = "no"; then
user_disabled_gnome=1
fi ],
[ user_disabled_gnome=0 ])
DEPRECATED_FLAGS=""
AC_MSG_CHECKING(if gnome is disabled)
if test "$user_disabled_gnome" = 1; then
AC_MSG_RESULT(yes)
gnome="no"
else
AC_MSG_RESULT(no)
PKG_CHECK_MODULES(GNOME,
[libgnomeui-2.0 >= $GNOME_REQUIRED,
gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED,
gconf-2.0 >= $GCONF_REQUIRED],
[gnome="yes"],
[gnome="no"])
AC_SUBST(GNOME_CFLAGS)
AC_SUBST(GNOME_LIBS)
fi
AM_CONDITIONAL(HAVE_GNOME, [test x$gnome = xyes])
if test x$MAINT = x; then
DEPRECATED_FLAGS="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED -DBONOBO_UI_DISABLE_DEPRECATED"
AC_SUBST(DEPRECATED_FLAGS)
......@@ -169,5 +133,4 @@ docs/Makefile
docs/reference/Makefile
gdl.spec
gdl-1.0.pc
gdl-gnome-1.0.pc
])
......@@ -70,23 +70,6 @@ GDL_IS_DOCK_MASTER_CLASS
GDL_DOCK_MASTER_GET_CLASS
</SECTION>
<SECTION>
<FILE>gdl-icons</FILE>
<TITLE>GdlIcons</TITLE>
GdlIcons
gdl_icons_new
gdl_icons_get_folder_icon
gdl_icons_get_uri_icon
gdl_icons_get_mime_icon
<SUBSECTION Standard>
GDL_ICONS
GDL_IS_ICONS
GDL_TYPE_ICONS
gdl_icons_get_type
GDL_ICONS_CLASS
GDL_IS_ICONS_CLASS
</SECTION>
<SECTION>
<FILE>gdl-dock-item</FILE>
GdlDockItemBehavior
......
gdl_dock_layout_get_type
gdl_dock_master_get_type
gdl_icons_get_type
gdl_dock_item_get_type
gdl_dock_get_type
gdl_dock_object_get_type
......
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/libgdl-1.0
idldir=@datadir@/idl/libgdl-1.0
Name: gdl-gnome
Description: Gnome DevTool Libraries - Gnome part
Version: @VERSION@
Requires: libgnomeui-2.0 gnome-vfs-2.0 gtk+-2.0 gdl-1.0
Libs: -L${libdir} -lgdl-gnome-1
Cflags: -I${includedir}
......@@ -4,7 +4,6 @@ INCLUDES = \
-I$(includedir) -I$(top_srcdir) \
$(WARN_CFLAGS) $(DEPRECATED_FLAGS) \
$(GDL_DEPENDENCIES_CFLAGS) $(XML_CFLAGS) \
$(GNOME_CFLAGS) \
$(EXTRA_CPPFLAGS)
lib_LTLIBRARIES = libgdl-1.la
......@@ -66,30 +65,10 @@ libgdl_1_la_SOURCES = \
libgdl_1_la_LIBADD = \
$(GDL_DEPENDENCIES_LIBS) \
$(XML_LIBS) \
$(GNOME_LIBS)
$(XML_LIBS)
libgdl_1_la_LDFLAGS = $(EXTRA_LDFLAGS)
libgdl_gnome_headers = \
gdl-icons.h
if HAVE_GNOME
lib_LTLIBRARIES += libgdl-gnome-1.la
endif
libgdl_gnome_1_la_SOURCES = \
$(libgdl_gnome_headers) \
gdl-icons.c
libgdl_gnome_1_la_LIBADD = \
libgdl-1.la \
$(GDL_DEPENDENCIES_LIBS) \
$(XML_LIBS) \
$(GNOME_LIBS)
libgdl_gnome_1_la_LDFLAGS = $(EXTRA_LDFLAGS)
noinst_PROGRAMS=test-dock test-combo-button
test_dock_sources=test-dock.c
......@@ -98,36 +77,11 @@ test_dock_LDADD=libgdl-1.la $(XML_LIBS)
test_combo_button_SOURCES = test-combo-button.c
test_combo_button_LDADD = libgdl-1.la
if HAVE_GNOME
noinst_PROGRAMS += test-dataview
test_dataview_SOURCES = \
gdl-data-view.h \
gdl-data-view.c \
gdl-data-frame.h \
gdl-data-frame.c \
gdl-data-model.h \
gdl-data-model.c \
gdl-data-model-test.h \
gdl-data-model-test.c \
gdl-data-row.h \
gdl-data-row.c \
test-dataview.c
test_dataview_LDADD = libgdl-1.la libgdl-gnome-1.la
endif
libgdlincludedir = $(includedir)/libgdl-1.0/gdl
libgdlinclude_HEADERS = \
$(libgdl_headers) \
libgdltypebuiltins.h
libgdl_gnomeincludedir = $(includedir)/libgdl-1.0/gdl
libgdl_gnomeinclude_HEADERS = \
$(libgdl_gnome_headers)
gladedir = $(datadir)/gdl/glade
glade_DATA = layout.glade
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* This file is part of the GNOME Devtools Libraries.
*
* Copyright (C) 2001 Dave Camp <dave@ximian.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gdl-i18n.h"
#include "gdl-tools.h"
#include <string.h>
#include "gdl-data-view.h"
#include "gdl-data-frame.h"
#include "gdl-data-model.h"
#include "gdl-data-row.h"
struct _GdlDataFramePrivate {
GdkRectangle shadow_r;
GdkRectangle frame_r;
GdkRectangle titlebar_r;
GdkRectangle title_r;
GdkRectangle close_r;
GdkRectangle row_r;
int shadow_offset;
int titlebar_height;
char *title;
GdlDataRow *row;
PangoLayout *layout;
gboolean selected;
};
static void gdl_data_frame_class_init (GdlDataFrameClass *klass);
static void gdl_data_frame_instance_init (GdlDataFrame *obj);
static void gdl_data_frame_finalize (GObject *object);
GDL_CLASS_BOILERPLATE (GdlDataFrame, gdl_data_frame, GObject, G_TYPE_OBJECT);
#define PAD 2
#define BORDER 1
#define CENTERY(r1, r2) { r1.y = ((r2.y + (r2.height / 2)) - (r1.height / 2)); }
void
gdl_data_frame_layout (GdlDataFrame *frame)
{
GdkPixbuf *close_pixbuf;
/* Sizes */
if (frame->priv->row) {
gdl_data_row_get_size (frame->priv->row,
NULL, NULL,
&frame->priv->row_r.width,
&frame->priv->row_r.height);
} else {
frame->priv->row_r.height = frame->priv->row_r.width = 0;
}
if (frame->priv->layout) {
pango_layout_get_pixel_size (frame->priv->layout,
&frame->priv->title_r.width,
&frame->priv->title_r.height);
} else {
frame->priv->title_r.width = frame->priv->title_r.height = 0;
}
close_pixbuf = gdl_data_view_get_close_pixbuf (frame->view);
if (close_pixbuf) {
frame->priv->close_r.width =
gdk_pixbuf_get_width (close_pixbuf);
frame->priv->close_r.height =
gdk_pixbuf_get_width (close_pixbuf);
} else {
frame->priv->close_r.width = frame->priv->close_r.height = 0;
}
frame->priv->titlebar_r.height = MAX (frame->priv->titlebar_height,
frame->priv->title_r.height);
frame->priv->titlebar_r.height = MAX (frame->priv->titlebar_r.height,
frame->priv->close_r.height);
frame->priv->frame_r.width = 2 * BORDER + 3 * PAD + frame->priv->title_r.width + frame->priv->close_r.width;
frame->priv->frame_r.width = MAX (frame->priv->frame_r.width,
frame->priv->row_r.width + 2 * BORDER + 2 * PAD);
frame->priv->frame_r.height = frame->priv->row_r.height + frame->priv->titlebar_r.height + 2 * PAD + 2 * BORDER;
frame->priv->titlebar_r.width = frame->priv->frame_r.width - BORDER;
frame->priv->shadow_r.width = frame->priv->frame_r.width;
frame->priv->shadow_r.height = frame->priv->frame_r.height;
/* Locations */
frame->priv->frame_r.x = frame->area.x;
frame->priv->frame_r.y = frame->area.y;
frame->priv->shadow_r.x = frame->priv->frame_r.x + frame->priv->shadow_offset;
frame->priv->shadow_r.y = frame->priv->frame_r.y + frame->priv->shadow_offset;
frame->priv->titlebar_r.x = frame->priv->frame_r.x + BORDER;
frame->priv->titlebar_r.y = frame->priv->frame_r.y + BORDER;
frame->priv->title_r.x = frame->priv->frame_r.x + BORDER + PAD;
CENTERY (frame->priv->title_r, frame->priv->titlebar_r);
frame->priv->close_r.x = (frame->priv->frame_r.x + frame->priv->frame_r.width) - (frame->priv->close_r.width + BORDER + PAD);
CENTERY (frame->priv->close_r, frame->priv->titlebar_r);
if (frame->priv->row) {
frame->priv->row_r.x = frame->priv->frame_r.x + BORDER + PAD;
frame->priv->row_r.y = frame->priv->titlebar_r.y + frame->priv->titlebar_r.height + PAD;
gdl_data_row_layout (frame->priv->row, &frame->priv->row_r);
} else {
frame->priv->row_r.x = frame->priv->row_r.y = 0;
}
frame->area.width = frame->priv->frame_r.width + frame->priv->shadow_offset;
frame->area.height = frame->priv->frame_r.height + frame->priv->shadow_offset;
}
#if 0 /* not used */
static void
change_layout (GdlDataFrame *frame)
{
char *text = frame->priv->title ? frame->priv->title : "?";
pango_layout_set_text (frame->priv->layout, text, strlen (text));
}
#endif
#define EXPLODE(r) (r).x, (r).y, (r).width, (r).height
void
gdl_data_frame_draw (GdlDataFrame *frame, GdkDrawable *drawable,
GdkRectangle *expose_area)
{
GdkRectangle inter;
guint8 state =
frame->priv->selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
gdk_draw_rectangle (drawable,
GTK_WIDGET (frame->view)->style->dark_gc[state],
TRUE,
EXPLODE (frame->priv->shadow_r));
gdk_draw_rectangle (drawable,
GTK_WIDGET (frame->view)->style->base_gc[GTK_STATE_NORMAL],
TRUE,
EXPLODE (frame->priv->frame_r));
gdk_draw_rectangle (drawable,
GTK_WIDGET (frame->view)->style->black_gc,
FALSE,
EXPLODE (frame->priv->frame_r));
gdk_draw_rectangle (drawable,
GTK_WIDGET (frame->view)->style->bg_gc[state],
TRUE,
EXPLODE (frame->priv->titlebar_r));
gdk_draw_layout (drawable,
GTK_WIDGET (frame->view)->style->fg_gc[state],
frame->priv->title_r.x, frame->priv->title_r.y,
frame->priv->layout);
if (gdk_rectangle_intersect (expose_area, &frame->priv->close_r, &inter)) {
GdkPixbuf *pixbuf = gdl_data_view_get_close_pixbuf (frame->view);
gdk_draw_pixbuf (drawable, NULL, pixbuf,
0, 0,
inter.x - frame->priv->close_r.x,
inter.y - frame->priv->close_r.y,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
GDK_RGB_DITHER_NORMAL, 0, 0);
}
if (frame->priv->row) {
if (gdk_rectangle_intersect (expose_area, &frame->priv->row_r,
&inter)) {
gdl_data_row_render (frame->priv->row, drawable,
&inter,
frame->priv->selected ? GTK_CELL_RENDERER_SELECTED : 0);
}
}
}
void
gdl_data_frame_class_init (GdlDataFrameClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *)klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gdl_data_frame_finalize;
}
void
gdl_data_frame_instance_init (GdlDataFrame *frame)
{
frame->priv = g_new0 (GdlDataFramePrivate, 1);
frame->area.x = frame->area.y = 0;
frame->priv->shadow_offset = 3;
frame->priv->titlebar_height = 20;
frame->area.height = frame->area.width = 100;
}
void
gdl_data_frame_finalize (GObject *object)
{
GdlDataFrame *frame = GDL_DATA_FRAME (object);
if (frame->priv) {
g_free (frame->priv->title);
g_object_unref (frame->priv->layout);
g_object_unref (frame->priv->row);
g_free (frame->priv);
frame->priv = NULL;
}
GDL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
void
gdl_data_frame_set_selected (GdlDataFrame *frame,
gboolean val)
{
frame->priv->selected = val;
gdk_window_invalidate_rect (GTK_LAYOUT (frame->view)->bin_window,
&frame->priv->frame_r,
TRUE);
}
gboolean
gdl_data_frame_button_press (GdlDataFrame *frame,
GdkEventButton *event)
{
return FALSE;
}
void
gdl_data_frame_set_position (GdlDataFrame *frame,
int x,
int y)
{
frame->area.x = x;
frame->area.y = y;
gdl_data_frame_layout (frame);
}
static void
setup_layout (GdlDataFrame *frame)
{
PangoFontDescription *font_desc =
pango_font_description_copy (GTK_WIDGET (frame->view)->style->font_desc);
pango_font_description_set_weight (font_desc,
PANGO_WEIGHT_BOLD);
frame->priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (frame->view),
frame->priv->title ? frame->priv->title : "?");
pango_layout_set_font_description (frame->priv->layout,
font_desc);
pango_font_description_free (font_desc);
}
GdlDataFrame *
gdl_data_frame_new (GdlDataView *view,
GdlDataRow *row)
{
GdlDataFrame *frame;
frame = GDL_DATA_FRAME (g_object_new (GDL_TYPE_DATA_FRAME, NULL));
frame->view = view;
frame->priv->row = row;
frame->priv->title = g_strdup (gdl_data_row_get_title (row));
setup_layout (frame);
gdl_data_frame_layout (frame);
return frame;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* This file is part of the GNOME Devtools Libraries.
*
* Copyright (C) 2001 Dave Camp <dave@ximian.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GDL_DATA_FRAME_H
#define GDL_DATA_FRAME_H
#include <glib-object.h>
#include <gdl/gdl-data-row.h>
G_BEGIN_DECLS
#define GDL_TYPE_DATA_FRAME (gdl_data_frame_get_type ())
#define GDL_DATA_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DATA_FRAME, GdlDataFrame))
#define GDL_DATA_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_DATA_VIEW_FRAM, GdlDataFrame))
#define GDL_IS_DATA_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DATA_FRAME))
#define GDL_IS_DATA_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DATA_FRAME))
#define GDL_DATA_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDL_TYPE_DATA_FRAME, GdlDataFrameClass))
typedef struct _GdlDataFrame GdlDataFrame;
typedef struct _GdlDataFramePrivate GdlDataFramePrivate;
typedef struct _GdlDataFrameClass GdlDataFrameClass;
struct _GdlDataFrame {
GObject parent;
GdlDataView *view;
GdkRectangle area;
GdlDataFramePrivate *priv;
};
struct _GdlDataFrameClass {
GObjectClass parent_class;
};
GType gdl_data_frame_get_type (void);
GdlDataFrame *gdl_data_frame_new (GdlDataView *view,
GdlDataRow *row);
void gdl_data_frame_layout (GdlDataFrame *frame);
void gdl_data_frame_draw (GdlDataFrame *item,
GdkDrawable *drawable,
GdkRectangle *expose_area);
void gdl_data_frame_set_selected (GdlDataFrame *frame,
gboolean val);
gboolean gdl_data_frame_button_press (GdlDataFrame *frame,
GdkEventButton *event);
void gdl_data_frame_set_position (GdlDataFrame *frame,
int x,
int y);
G_END_DECLS
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gdl-i18n.h"
#include "gdl-data-model-test.h"
#include "gdl-data-model.h"
#include <string.h>
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtkcellrenderertoggle.h>
GObjectClass *parent_class;
typedef struct _DataItem {
char *name;
char *value;
char *path;
struct _DataItem *children;
} DataItem;
DataItem data1[] = {
{ "foo1", "foo1", "0:0", NULL},
{ "bar1", "bar1", "0:1", NULL },
{ "baz1", "baz1", "0:2", NULL },
{ NULL, NULL, NULL, NULL }
};
DataItem data2[] = {
{ "foo2", "foo2", "1:0", NULL },
{ "bar2", "bar2", "1:1", NULL },
{ "baz2", "baz2", "1:2", NULL },
{ NULL, NULL, NULL, NULL }
};
DataItem data5[] = {
{ "1", "1", "2:2:1:0", NULL },
{ "2", "2", "2:2:1:1", NULL },
{ "3", "3", "2:2:1:2", NULL },
{ "4", "4", "2:2:1:3", NULL },
{ "5", "5", "2:2:1:4", NULL },
{ "6", "6", "2:2:1:5", NULL },
{ NULL, NULL, NULL, NULL }
};
DataItem data4[] = {
{ "foo4", "foo4", "2:2:0", NULL },
{ "bar4", "[...]", "2:2:1", data5 },
{ "baz4", "baz4", "2:2:2", NULL },
{ NULL, NULL, NULL, NULL }
};
DataItem data3[] = {
{ "foo foo", "foo3", "2:0", NULL },
{ "bar3", "1", "2:1", NULL },
{ "baz3", "{...}", "2:2", data4 },
{ NULL, NULL, NULL, NULL }
};
DataItem root[] = {
{ "test-data", "value1", "0", NULL } ,
{ "test-data2", "value2", "1", NULL } ,
{ "test-data3", "{...}", "2", data3 } ,
{ NULL, NULL, NULL }
};
static gboolean
get_iter (GdlDataModel *dm, GdlDataIter *iter, GtkTreePath *path)
{
int *i = gtk_tree_path_get_indices (path);
int n = gtk_tree_path_get_depth (path);
DataItem *item;
g_assert (i);
item = &root[*i++];
while (--n) {
item = &item->children[*i++];
}
iter->data1 = item;
return TRUE;
}
static GtkTreePath *
get_path (GdlDataModel *dm, GdlDataIter *iter)
{
DataItem *item = iter->data1;
return gtk_tree_path_new_from_string (item->path);
}
static void
get_name (GdlDataModel *dm, GdlDataIter *iter, char **name)
{
DataItem *item = iter->data1;
*name = item->name;
}
static void
get_value (GdlDataModel *dm, GdlDataIter *iter, GValue *value)
{
DataItem *item = iter->data1;
if (strcmp (item->name, "bar3")) {
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, item->value);
} else {
g_value_init (value, G_TYPE_BOOLEAN);
g_value_set_boolean (value, !strcmp (item->value, "1"));
}
}
static void
get_renderer (GdlDataModel *dm, GdlDataIter *iter,
GtkCellRenderer **renderer, char **field,
gboolean *is_editable)
{
DataItem *item = iter->data1;
if (!strcmp (item->name, "bar3")) {
*renderer = g_object_new (gtk_cell_renderer_toggle_get_type (),
"activatable", TRUE, NULL);
*field = "active";
} else {
*renderer = g_object_new (gtk_cell_renderer_text_get_type (),
"editable", TRUE, NULL);
*field = "text";
}
*is_editable = (item->children == NULL);
}
static gboolean
iter_next (GdlDataModel *dm, GdlDataIter *iter)
{
DataItem *item = iter->data1;
item++;
if (item->name) {
iter->data1 = item;
return TRUE;
} else {
return FALSE;
}
}
static gboolean
iter_children (GdlDataModel *dm, GdlDataIter *iter, GdlDataIter *parent)
{
DataItem *item = parent->data1;
item = &item->children[0];
if (item) {
iter->data1 = item;
return TRUE;
} else {
return FALSE;