some api changes, other patchings
- From: jacob berkman <jacob ximian com>
- To: gnome-2-0 <gnome-2-0-list gnome org>
- Cc: Michael Meeks <michael ximian com>, Anders Carlsson <andersca gnu org>
- Subject: some api changes, other patchings
- Date: 06 Dec 2001 19:35:30 -0500
hello,
i've got pretty much all of libgnomeui working with libglade now. since
it seems customary to provide screenshots of gnome 2 stuff, here's one:
http://primates.ximian.com/~jacob/gnome2/libglade-gnomeapp2.png
the window in the upper left is the one created by libglade-convert and
libglade 2.0; lower right is glade 1.
this required a few api changes. early on (last week) i was more
enthusiastic about fixing things, so in one or two cases i did the more
correct solution.
anyway, the patches are attached, and a summary follows:
libbonoboui:
* provide a bonobo-ui-type-builtins.h with our enums etc. this is
used by the dock item support
* make BonoboDockLayout a GObject like it should be. this was
discussed last week, and the uses of it in libgnomeui are fixed as
well; nothing else uses it.
libgnomeui:
* fixup uses of BonoboDockLayout
* give properties to GnomeAppBar and implement a constructor. this
obsoletes gnome_appbar_construct(), which could be added back as a
noop if necessary.
* put GnomeDialogPrivate in libgnomeuiP.h so the glade stuff can
peek at the action area
* a pending patch (66294) requires subclasses to not access the
[hv]adjustment until after the object has been constructed, so fix
this in the icon list
* make gnome_message_box_construct() public (it is useless as a
private function)
anyway, this was a lot of frustrating work and i'd like to get it into
cvs soon such that developers can test it, so some feedback either way
is appreciated. if i don't get any feedback by next wednesday i plan on
committing then.
jacob
--
"In fact, can you imagine anything more terrifying than a zombie clown?"
-- moby
? bonobo-ui-type-builtins.c
? bonobo-ui-type-builtins.h
? libbonoboui.defs
? name
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/Makefile.am,v
retrieving revision 1.193
diff -u -r1.193 Makefile.am
--- Makefile.am 2001/12/02 23:01:05 1.193
+++ Makefile.am 2001/12/07 00:15:49
@@ -20,6 +20,7 @@
bonobo-control-internal.h \
bonobo-ui-engine-config.h \
bonobo-ui-engine-private.h \
+ bonobo-ui-marshal.h \
bonobo-ui-node-private.h \
bonobo-ui-preferences.h \
bonobo-ui-sync-menu.h \
@@ -34,7 +35,7 @@
libbonoboincludedir = $(includedir)/libbonoboui-2.0/bonobo
-libbonoboinclude_HEADERS = \
+libbonoboui_h_sources = \
bonobo-canvas-component.h \
bonobo-canvas-item.h \
bonobo-control-frame.h \
@@ -109,6 +110,7 @@
bonobo-ui-toolbar-separator-item.c \
bonobo-ui-toolbar-toggle-button-item.c \
bonobo-ui-toolbar.c \
+ bonobo-ui-type-builtins.c \
bonobo-ui-util.c \
bonobo-ui-xml.c \
bonobo-widget.c \
@@ -116,26 +118,66 @@
bonobo-zoomable.c \
bonobo-zoomable-frame.c \
bonobo-ui-marshal-main.c
+
+
+$(libbonoboui_2_la_OBJECTS): $(libbonoboui_built_sources)
-marshal_sources = \
- bonobo-ui-marshal.c \
- bonobo-ui-marshal.h
+libbonoboui_built_public_sources = \
+ bonobo-ui-type-builtins.h
-$(libbonoboui_2_la_OBJECTS): $(marshal_sources)
+libbonoboui_built_sources = \
+ bonobo-ui-type-builtins.c \
+ bonobo-ui-marshal.c \
+ bonobo-ui-marshal.h \
+ libbonoboui.defs
+
+libbonoboinclude_HEADERS = \
+ $(libbonoboui_h_sources) \
+ $(libbonoboui_built_public_sources)
bonobo-ui-marshal.h: bonobo-ui-marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --header --prefix=bonobo_ui_marshal > $@
bonobo-ui-marshal.c: bonobo-ui-marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --body --prefix=bonobo_ui_marshal > $@
+bonobo-ui-type-builtins.c: $(libbonoboui_h_sources) $(GLIB_MKENUMS)
+ $(GLIB_MKENUMS) \
+ --fhead "#include \"libbonoboui.h\"\n\n" \
+ --fhead "#include \"bonobo-ui-type-builtins.h\"\n\n" \
+ --fprod "\n/* enumerations from \"@filename \" */" \
+ --vhead "static const G Type@Value _ enum_name@_values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
+ --vtail " { 0, NULL, NULL }\n};\n\n" \
+ --vtail "GType\n enum_name@_get_type (void)\n{\n" \
+ --vtail " static GType type = 0;\n\n" \
+ --vtail " if (!type)\n" \
+ --vtail " type = g_ type@_register_static (\"@EnumName \", _ enum_name@_values);\n\n" \
+ --vtail " return type;\n}\n\n" \
+ $(libbonoboui_h_sources) > xgen-gtbec \
+ && cp xgen-gtbec $(@F) \
+ && rm -f xgen-gtbec
+bonobo-ui-type-builtins.h: $(libbonoboui_h_sources) $(GLIB_MKENUMS)
+ $(GLIB_MKENUMS) \
+ --fhead "#ifndef __BONOBO_UI_TYPE_BUILTINS_H__\n" \
+ --fhead "#define __BONOBO_UI_TYPE_BUILTINS_H__ 1\n\n" \
+ --fhead "#include <glib-object.h>\n\n" \
+ --fhead "G_BEGIN_DECLS\n\n" \
+ --ftail "G_END_DECLS\n\n" \
+ --ftail "#endif /* __BONOBO_UI_TYPE_BUILTINS_H__ */\n" \
+ --fprod "\n/* --- @filename@ --- */" \
+ --eprod "#define BONOBO_TYPE_ ENUMSHORT@ @enum_name _get_type()\n" \
+ --eprod "GType @enum_name _get_type (void);\n" \
+ $(libbonoboui_h_sources) > xgen-gth \
+ && cp xgen-gth $(@F) \
+ && rm -f xgen-gth
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libbonoboui-2.0.pc
EXTRA_DIST = bonobo-insert-component.xpm libbonoboui-2.0.pc.in \
bonobo-ui-marshal.list
-CLEANFILES = $(marshal_sources)
+CLEANFILES = $(bonobo_built_sources)
-DONT_DIST_SOURCE = $(marshal_sources)
+DONT_DIST_SOURCE = $(bonobo_built_sources)
dist-hook:
for file in $(DONT_DIST_SOURCE) ; do \
Index: bonobo-dock-layout.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-dock-layout.c,v
retrieving revision 1.17
diff -u -r1.17 bonobo-dock-layout.c
--- bonobo-dock-layout.c 2001/08/08 05:19:46 1.17
+++ bonobo-dock-layout.c 2001/12/07 00:15:49
@@ -42,16 +42,14 @@
* bonobo_dock_layout_init function! */
};
+static GObjectClass *parent_class = NULL;
-static GtkObjectClass *parent_class = NULL;
-
static void bonobo_dock_layout_class_init (BonoboDockLayoutClass *class);
-static void bonobo_dock_layout_init (BonoboDockLayout *layout);
+static void bonobo_dock_layout_instance_init(BonoboDockLayout *layout);
-static void bonobo_dock_layout_destroy (GtkObject *object);
static void bonobo_dock_layout_finalize (GObject *object);
static gint item_compare_func (gconstpointer a,
@@ -74,20 +72,15 @@
static void
bonobo_dock_layout_class_init (BonoboDockLayoutClass *class)
{
- GtkObjectClass *object_class;
- GObjectClass *gobject_class;
-
- object_class = (GtkObjectClass *) class;
- gobject_class = (GObjectClass *) class;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- object_class->destroy = bonobo_dock_layout_destroy;
gobject_class->finalize = bonobo_dock_layout_finalize;
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = g_type_class_ref (G_TYPE_OBJECT);
}
static void
-bonobo_dock_layout_init (BonoboDockLayout *layout)
+bonobo_dock_layout_instance_init (BonoboDockLayout *layout)
{
layout->_priv = NULL;
/* XXX: when there is some private stuff enable this
@@ -97,28 +90,15 @@
}
static void
-bonobo_dock_layout_destroy (GtkObject *object)
+bonobo_dock_layout_finalize (GObject *object)
{
BonoboDockLayout *layout;
- /* remember, destroy can be run multiple times! */
-
layout = BONOBO_DOCK_LAYOUT (object);
while (layout->items)
remove_item (layout, layout->items);
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-bonobo_dock_layout_finalize (GObject *object)
-{
- BonoboDockLayout *layout;
-
- layout = BONOBO_DOCK_LAYOUT (object);
-
/* Free the private structure */
g_free (layout->_priv);
layout->_priv = NULL;
@@ -207,28 +187,26 @@
-GtkType
+GType
bonobo_dock_layout_get_type (void)
{
- static guint layout_type = 0;
+ static GType layout_type = 0;
if (layout_type == 0)
{
- GtkTypeInfo layout_info =
- {
- "BonoboDockLayout",
- sizeof (BonoboDockLayout),
- sizeof (BonoboDockLayoutClass),
- (GtkClassInitFunc) bonobo_dock_layout_class_init,
- (GtkObjectInitFunc) bonobo_dock_layout_init,
- NULL,
- NULL,
- NULL
+ GTypeInfo layout_info = {
+ sizeof (BonoboDockLayoutClass),
+ NULL, NULL,
+ (GClassInitFunc)bonobo_dock_layout_class_init,
+ NULL, NULL,
+ sizeof (BonoboDockLayout),
+ 0,
+ (GInstanceInitFunc)bonobo_dock_layout_instance_init
};
-
- layout_type = gtk_type_unique (gtk_object_get_type (), &layout_info);
- }
+ layout_type = g_type_register_static (G_TYPE_OBJECT, "BonoboDockLayout", &layout_info, 0);
+ }
+
return layout_type;
}
@@ -243,11 +221,7 @@
BonoboDockLayout *
bonobo_dock_layout_new (void)
{
- BonoboDockLayout *new;
-
- new = gtk_type_new (bonobo_dock_layout_get_type ());
-
- return new;
+ return BONOBO_DOCK_LAYOUT (g_object_new (BONOBO_TYPE_DOCK_LAYOUT, NULL));
}
/**
Index: bonobo-dock-layout.h
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-dock-layout.h,v
retrieving revision 1.15
diff -u -r1.15 bonobo-dock-layout.h
--- bonobo-dock-layout.h 2001/08/08 05:19:46 1.15
+++ bonobo-dock-layout.h 2001/12/07 00:15:49
@@ -74,7 +74,7 @@
struct _BonoboDockLayout
{
- GtkObject object;
+ GObject object;
GList *items; /* BonoboDockLayoutItem */
@@ -88,7 +88,7 @@
};
BonoboDockLayout *bonobo_dock_layout_new (void);
-GtkType bonobo_dock_layout_get_type (void) G_GNUC_CONST;
+GType bonobo_dock_layout_get_type (void) G_GNUC_CONST;
gboolean bonobo_dock_layout_add_item (BonoboDockLayout *layout,
BonoboDockItem *item,
Index: bonobo-ui-toolbar.h
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-ui-toolbar.h,v
retrieving revision 1.20
diff -u -r1.20 bonobo-ui-toolbar.h
--- bonobo-ui-toolbar.h 2001/08/08 05:19:46 1.20
+++ bonobo-ui-toolbar.h 2001/12/07 00:15:49
@@ -23,13 +23,11 @@
#define BONOBO_IS_UI_TOOLBAR(obj) (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_UI_TOOLBAR))
#define BONOBO_IS_UI_TOOLBAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), BONOBO_TYPE_UI_TOOLBAR))
-
-enum _BonoboUIToolbarStyle {
+typedef enum {
BONOBO_UI_TOOLBAR_STYLE_PRIORITY_TEXT,
BONOBO_UI_TOOLBAR_STYLE_ICONS_AND_TEXT,
BONOBO_UI_TOOLBAR_STYLE_ICONS_ONLY
-};
-typedef enum _BonoboUIToolbarStyle BonoboUIToolbarStyle;
+} BonoboUIToolbarStyle;
typedef struct _BonoboUIToolbarPrivate BonoboUIToolbarPrivate;
@@ -47,7 +45,6 @@
void (* style_changed) (BonoboUIToolbar *toolbar);
} BonoboUIToolbarClass;
-
GtkType bonobo_ui_toolbar_get_type (void) G_GNUC_CONST;
void bonobo_ui_toolbar_construct (BonoboUIToolbar *toolbar);
GtkWidget *bonobo_ui_toolbar_new (void);
Index: glade-bonobo.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/glade/glade-bonobo.c,v
retrieving revision 1.19
diff -u -r1.19 glade-bonobo.c
--- glade-bonobo.c 2001/11/09 06:48:38 1.19
+++ glade-bonobo.c 2001/12/07 00:27:00
@@ -1,8 +1,9 @@
/*
* glade-bonobo.c: support for bonobo widgets in libglade.
*
- * Author:
- * Michael Meeks (michael helixcode com)
+ * Authors:
+ * Michael Meeks (michael ximian com)
+ * Jacob Berkman (jacob ximian com>
*
* Copyright (C) 2000,2001 Ximian, Inc., 2001 James Henstridge.
*/
@@ -13,6 +14,37 @@
#include <glade/glade-init.h>
#include <glade/glade-build.h>
+static void
+dock_allow_floating (GladeXML *xml, GtkWidget *widget,
+ const char *name, const char *value)
+{
+ bonobo_dock_allow_floating_items (BONOBO_DOCK (widget),
+ *value == 'y');
+}
+
+static void
+dock_item_set_shadow_type (GladeXML *xml, GtkWidget *widget,
+ const char *name, const char *value)
+{
+ bonobo_dock_item_set_shadow_type (
+ BONOBO_DOCK_ITEM (widget),
+ glade_enum_from_string (GTK_TYPE_SHADOW_TYPE, value));
+}
+
+static GtkWidget *
+dock_item_build (GladeXML *xml, GType widget_type,
+ GladeWidgetInfo *info)
+{
+ GtkWidget *w;
+
+ w = glade_standard_build_widget (xml, widget_type, info);
+
+ BONOBO_DOCK_ITEM (w)->name = g_strdup (info->name);
+
+ return w;
+}
+
+
static GtkWidget *
glade_bonobo_widget_new (GladeXML *xml,
GType widget_type,
@@ -139,17 +171,96 @@
return NULL;
}
+static void
+add_dock_item (GladeXML *xml,
+ GtkWidget *parent,
+ GladeWidgetInfo *info,
+ GladeChildInfo *childinfo)
+{
+ BonoboDockPlacement placement;
+ guint band, offset;
+ int position;
+ BonoboDockItemBehavior behavior;
+ int i;
+ GtkWidget *child;
+
+ band = offset = position = 0;
+ placement = BONOBO_DOCK_TOP;
+ behavior = BONOBO_DOCK_ITEM_BEH_NORMAL;
+
+ for (i = 0; i < childinfo->child->n_properties; i++) {
+ const char *name = childinfo->child->properties[i].name;
+ const char *value = childinfo->child->properties[i].value;
+
+ if (!strcmp (name, "placement"))
+ placement = glade_enum_from_string (
+ BONOBO_TYPE_DOCK_PLACEMENT,
+ value);
+ else if (!strcmp (name, "band"))
+ band = strtoul (value, NULL, 10);
+ else if (!strcmp (name, "position"))
+ position = strtol (value, NULL, 10);
+ else if (!strcmp (name, "offset"))
+ offset = strtoul (value, NULL, 10);
+ else if (!strcmp (name, "behavior"))
+ behavior = glade_flags_from_string (
+ BONOBO_TYPE_DOCK_ITEM_BEHAVIOR,
+ value);
+ }
+
+ child = glade_xml_build_widget (xml, childinfo->child);
+
+ bonobo_dock_add_item (BONOBO_DOCK (parent),
+ BONOBO_DOCK_ITEM (child),
+ placement, band, position, offset,
+ FALSE);
+}
+
+
+static void
+dock_build_children (GladeXML *xml, GtkWidget *w, GladeWidgetInfo *info)
+{
+ int i;
+ GtkWidget *child;
+ GladeChildInfo *childinfo;
+
+ for (i = 0; i < info->n_children; i++) {
+ childinfo = &info->children[i];
+
+ if (!strcmp (childinfo->child->class, "BonoboDockItem")) {
+ add_dock_item (xml, w, info, childinfo);
+ continue;
+ }
+
+ if (bonobo_dock_get_client_area (BONOBO_DOCK (w)))
+ g_warning ("Multiple client areas for BonoboDock found.");
+
+ child = glade_xml_build_widget (xml, childinfo->child);
+ bonobo_dock_set_client_area (BONOBO_DOCK (w), child);
+ }
+}
+
/* this macro puts a version check function into the module */
GLADE_MODULE_CHECK_INIT
void
glade_module_register_widgets (void)
{
- glade_provide ("bonobo");
+ glade_require ("gtk");
+
+ glade_register_custom_prop (BONOBO_TYPE_DOCK, "allow_floating", dock_allow_floating);
+ glade_register_custom_prop (BONOBO_TYPE_DOCK_ITEM, "shadow_type", dock_item_set_shadow_type);
+
glade_register_widget (BONOBO_TYPE_WIDGET,
glade_bonobo_widget_new,
NULL, NULL);
glade_register_widget (BONOBO_TYPE_WINDOW,
NULL, glade_standard_build_children,
bonobo_window_find_internal_child);
+ glade_register_widget (BONOBO_TYPE_DOCK,
+ NULL, dock_build_children,
+ NULL);
+ glade_register_widget (BONOBO_TYPE_DOCK_ITEM,
+ dock_item_build, glade_standard_build_children, NULL);
+ glade_provide ("bonobo");
}
? ChangeLog.flc
? Makefile.am2
? gnome_segv
? old-gnome-window-icon.c
Index: gnome-app.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-app.c,v
retrieving revision 1.140
diff -u -r1.140 gnome-app.c
--- gnome-app.c 2001/11/30 10:14:55 1.140
+++ gnome-app.c 2001/12/07 00:28:01
@@ -190,17 +190,12 @@
static void
gnome_app_instance_init (GnomeApp *app)
{
- const char *str = NULL;
- GValue value = { 0, };
-
+ const char *icons;
+
app->_priv = NULL;
/* XXX: when there is some private stuff enable this
app->_priv = g_new0(GnomeAppPrivate, 1);
*/
-
- app->name = NULL;
- app->prefix = NULL;
-
app->accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (app), app->accel_group);
@@ -208,6 +203,8 @@
gtk_container_add (GTK_CONTAINER (app), app->vbox);
app->dock = bonobo_dock_new ();
+ app->layout = bonobo_dock_layout_new ();
+
gtk_box_pack_start (GTK_BOX (app->vbox), app->dock,
TRUE, TRUE, 0);
@@ -216,22 +213,18 @@
GTK_SIGNAL_FUNC (layout_changed),
(gpointer) app);
- app->layout = g_object_ref (bonobo_dock_layout_new ());
- gtk_object_sink (GTK_OBJECT (app->layout));
-
app->enable_layout_config = TRUE;
+
+ g_object_get (G_OBJECT (gnome_program_get ()),
+ LIBGNOMEUI_PARAM_DEFAULT_ICON, &icons,
+ NULL);
- g_value_init (&value, G_TYPE_STRING);
- g_object_get_property (G_OBJECT (gnome_program_get ()),
- LIBGNOMEUI_PARAM_DEFAULT_ICON, &value);
- str = g_value_get_string (&value);
- if (str != NULL) {
- char **files = g_strsplit (str, ";", -1);
+ if (icons && *icons) {
+ char **files = g_strsplit (icons, ";", -1);
gnome_window_icon_set_from_file_list (GTK_WINDOW (app),
(const char **)files);
g_strfreev (files);
}
- g_value_unset (&value);
}
static void
@@ -258,7 +251,7 @@
if (app->enable_layout_config)
write_layout_config (app, app->layout);
- gtk_object_unref (GTK_OBJECT (app->layout));
+ g_object_unref (G_OBJECT (app->layout));
app->layout = NULL;
}
@@ -281,10 +274,9 @@
if (app->enable_layout_config) {
BonoboDockLayout *layout;
- layout = g_object_ref (bonobo_dock_get_layout (BONOBO_DOCK (app->dock)));
- gtk_object_sink (GTK_OBJECT (layout));
+ layout = bonobo_dock_get_layout (BONOBO_DOCK (app->dock));
write_layout_config (app, layout);
- gtk_object_unref (GTK_OBJECT (layout));
+ g_object_unref (G_OBJECT (layout));
}
}
Index: gnome-appbar.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-appbar.c,v
retrieving revision 1.41
diff -u -r1.41 gnome-appbar.c
--- gnome-appbar.c 2001/11/13 01:09:28 1.41
+++ gnome-appbar.c 2001/12/07 00:28:01
@@ -39,6 +39,7 @@
#include <libgnome/gnome-i18n.h>
#include "gnome-uidefs.h"
+#include "gnometypebuiltins.h"
#ifndef GNOME_ENABLE_DEBUG
#define GNOME_ENABLE_DEBUG /* to be sure */
@@ -50,6 +51,7 @@
future. Statusbar could be a label, entry, GtkStatusbar, or
something else; progress could be a label or progress bar; it's
all up in the air for now. */
+ /* there is no reason for these not to be properties */
GtkWidget * progress;
GtkWidget * status;
gchar * prompt; /* The text of a prompt, if any. */
@@ -64,60 +66,35 @@
gint16 editable_start; /* The first editable position in the interactive
buffer. */
+
+ /* these are construct only currently. there is no reason this
+ * couldn't be changed. */
+
+ GnomePreferencesType interactivity;
gboolean interactive : 1; /* This means status is an entry rather than a
label, for the moment. */
+ gboolean has_progress : 1;
+ gboolean has_status : 1;
};
-
-static void gnome_appbar_finalize (GObject *object);
-
enum {
USER_RESPONSE,
CLEAR_PROMPT,
LAST_SIGNAL
};
+enum {
+ PROP_0,
+ PROP_HAS_PROGRESS,
+ PROP_HAS_STATUS,
+ PROP_INTERACTIVITY
+};
+
static gint appbar_signals[LAST_SIGNAL] = { 0 };
GNOME_CLASS_BOILERPLATE (GnomeAppBar, gnome_appbar,
GtkHBox, GTK_TYPE_HBOX)
-static void
-gnome_appbar_class_init (GnomeAppBarClass *class)
-{
- GtkObjectClass *object_class;
- GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- gobject_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- appbar_signals[USER_RESPONSE] =
- gtk_signal_new ("user_response",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GnomeAppBarClass, user_response),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- appbar_signals[CLEAR_PROMPT] =
- gtk_signal_new ("clear_prompt",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GnomeAppBarClass, clear_prompt),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- class->user_response = NULL;
- class->clear_prompt = NULL; /* maybe should have a handler
- and the clear_prompt function
- just emits. */
- gobject_class->finalize = gnome_appbar_finalize;
-}
-
static GSList *
stringstack_push(GSList * stringstack, const gchar * s)
{
@@ -268,120 +245,14 @@
gboolean has_status,
GnomePreferencesType interactivity)
{
- GnomeAppBar * ab = gtk_type_new (GNOME_TYPE_APPBAR);
-
- gnome_appbar_construct(ab, has_progress, has_status, interactivity);
-
- return GTK_WIDGET(ab);
+ return GTK_WIDGET (g_object_new (GNOME_TYPE_APPBAR,
+ "has_progress", has_progress,
+ "has_status", has_status,
+ "interactivity", interactivity,
+ NULL));
}
/**
- * gnome_appbar_construct
- * @ab: Pointer to GNOME appbar object.
- * @has_progress: %TRUE if appbar needs progress bar widget.
- * @has_status: %TRUE if appbar needs status bar widget.
- * @interactivity: See gnome_appbar_new() explanation.
- *
- * Description:
- * For use to bindings in languages other than C. Don't use.
- **/
-
-void
-gnome_appbar_construct(GnomeAppBar * ab,
- gboolean has_progress,
- gboolean has_status,
- GnomePreferencesType interactivity)
-{
- GtkBox *box;
-
- /* These checks are kind of gross because an unfinished object will
- be returned from _new instead of NULL */
-
- /* Can't be interactive if there's no status bar */
- g_return_if_fail( ((has_status == FALSE) &&
- (interactivity == GNOME_PREFERENCES_NEVER)) ||
- (has_status == TRUE));
-
- box = GTK_BOX (ab);
-
- box->spacing = GNOME_PAD_SMALL;
- box->homogeneous = FALSE;
-
- if (has_progress)
- ab->_priv->progress = gtk_progress_bar_new();
- else
- ab->_priv->progress = NULL;
-
- /*
- * If the progress meter goes on the right then we place it after we
- * create the status line.
- */
- if (has_progress &&
- /* FIXME: this should listen to changes! */
- ! gnome_gconf_get_bool ("/desktop/gnome/interface/statusbar-meter-on-right"))
- gtk_box_pack_start (box, ab->_priv->progress, FALSE, FALSE, 0);
-
- if ( has_status ) {
- if ( (interactivity == GNOME_PREFERENCES_ALWAYS) ||
- ( (interactivity == GNOME_PREFERENCES_USER) &&
- /* FIXME: this should listen to changes! */
- gnome_gconf_get_bool ("/desktop/gnome/interface/statusbar-interactive")) ) {
- ab->_priv->interactive = TRUE;
-
- ab->_priv->status = gtk_entry_new();
-
- gtk_signal_connect (GTK_OBJECT(ab->_priv->status), "delete_text",
- GTK_SIGNAL_FUNC(entry_delete_text_cb),
- ab);
- gtk_signal_connect (GTK_OBJECT(ab->_priv->status), "insert_text",
- GTK_SIGNAL_FUNC(entry_insert_text_cb),
- ab);
- gtk_signal_connect_after(GTK_OBJECT(ab->_priv->status), "key_press_event",
- GTK_SIGNAL_FUNC(entry_key_press_cb),
- ab);
- gtk_signal_connect(GTK_OBJECT(ab->_priv->status), "activate",
- GTK_SIGNAL_FUNC(entry_activate_cb),
- ab);
-
- /* no prompt now */
- gtk_entry_set_editable(GTK_ENTRY(ab->_priv->status), FALSE);
-
- gtk_box_pack_start (box, ab->_priv->status, TRUE, TRUE, 0);
- }
- else {
- GtkWidget * frame;
-
- ab->_priv->interactive = FALSE;
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
-
- ab->_priv->status = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (ab->_priv->status), 0.0, 0.0);
- gtk_widget_set_usize (ab->_priv->status, 1, -1);
-
- gtk_box_pack_start (box, frame, TRUE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER(frame), ab->_priv->status);
-
- gtk_widget_show (frame);
- }
- }
- else {
- ab->_priv->status = NULL;
- ab->_priv->interactive = FALSE;
- }
-
- if (has_progress &&
- /* FIXME: this should listen to changes! */
- gnome_gconf_get_bool ("/desktop/gnome/interface/statusbar-meter-on-right"))
- gtk_box_pack_start (box, ab->_priv->progress, FALSE, FALSE, 0);
-
- if (ab->_priv->status) gtk_widget_show (ab->_priv->status);
- if (ab->_priv->progress) gtk_widget_show(ab->_priv->progress);
-}
-
-
-/**
* gnome_appbar_set_prompt
* @appbar: Pointer to GNOME appbar object.
* @prompt: Text of the prompt message.
@@ -712,3 +583,207 @@
GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
+static GObject *
+gnome_appbar_constructor (GType type,
+ guint n_properties,
+ GObjectConstructParam *properties)
+{
+ GObject *object;
+ GnomeAppBar *ab;
+ GtkBox *box;
+ gboolean has_status, has_progress, interactivity;
+
+ object = G_OBJECT_CLASS (parent_class)->constructor (type,
+ n_properties,
+ properties);
+
+ ab = GNOME_APPBAR (object);
+
+ has_status = ab->_priv->has_status;
+ has_progress = ab->_priv->has_progress;
+ interactivity = ab->_priv->interactivity;
+
+ box = GTK_BOX (ab);
+
+ box->spacing = GNOME_PAD_SMALL;
+ box->homogeneous = FALSE;
+
+ if (has_progress)
+ ab->_priv->progress = gtk_progress_bar_new ();
+
+ /*
+ * If the progress meter goes on the right then we place it after we
+ * create the status line.
+ */
+ if (has_progress &&
+ /* FIXME: this should listen to changes! */
+ ! gnome_gconf_get_bool ("/desktop/gnome/interface/statusbar-meter-on-right"))
+ gtk_box_pack_start (box, ab->_priv->progress, FALSE, FALSE, 0);
+
+ if ( has_status ) {
+ if ( interactivity ) {
+ ab->_priv->status = gtk_entry_new();
+
+ gtk_signal_connect (GTK_OBJECT(ab->_priv->status), "delete_text",
+ GTK_SIGNAL_FUNC(entry_delete_text_cb),
+ ab);
+ gtk_signal_connect (GTK_OBJECT(ab->_priv->status), "insert_text",
+ GTK_SIGNAL_FUNC(entry_insert_text_cb),
+ ab);
+ gtk_signal_connect_after(GTK_OBJECT(ab->_priv->status), "key_press_event",
+ GTK_SIGNAL_FUNC(entry_key_press_cb),
+ ab);
+ gtk_signal_connect(GTK_OBJECT(ab->_priv->status), "activate",
+ GTK_SIGNAL_FUNC(entry_activate_cb),
+ ab);
+
+ /* no prompt now */
+ gtk_entry_set_editable(GTK_ENTRY(ab->_priv->status), FALSE);
+
+ gtk_box_pack_start (box, ab->_priv->status, TRUE, TRUE, 0);
+ } else {
+ GtkWidget * frame;
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
+
+ ab->_priv->status = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (ab->_priv->status), 0.0, 0.0);
+ gtk_widget_set_usize (ab->_priv->status, 1, -1);
+
+ gtk_box_pack_start (box, frame, TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER(frame), ab->_priv->status);
+
+ gtk_widget_show (frame);
+ }
+ }
+
+ if (has_progress &&
+ /* FIXME: this should listen to changes! */
+ gnome_gconf_get_bool ("/desktop/gnome/interface/statusbar-meter-on-right"))
+ gtk_box_pack_start (box, ab->_priv->progress, FALSE, FALSE, 0);
+
+ if (ab->_priv->status) gtk_widget_show (ab->_priv->status);
+ if (ab->_priv->progress) gtk_widget_show(ab->_priv->progress);
+
+ return object;
+}
+
+static void
+gnome_appbar_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GnomeAppBarPrivate *priv = GNOME_APPBAR (object)->_priv;
+ switch (prop_id) {
+ case PROP_HAS_STATUS:
+ priv->has_status = g_value_get_boolean (value);
+ break;
+ case PROP_HAS_PROGRESS:
+ priv->has_progress = g_value_get_boolean (value);
+ break;
+ case PROP_INTERACTIVITY:
+ priv->interactivity = g_value_get_enum (value);
+ switch (priv->interactivity) {
+ case GNOME_PREFERENCES_NEVER:
+ priv->interactive = FALSE;
+ break;
+ case GNOME_PREFERENCES_ALWAYS:
+ priv->interactive = TRUE;
+ break;
+ default:
+ priv->interactive = gnome_gconf_get_bool ("/desktop/gnome/interface/statusbar-interactive");
+ break;
+ }
+ }
+}
+
+static void
+gnome_appbar_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GnomeAppBarPrivate *priv = GNOME_APPBAR (object)->_priv;
+
+ switch (prop_id) {
+ case PROP_HAS_STATUS:
+ g_value_set_boolean (value, priv->has_status);
+ break;
+ case PROP_HAS_PROGRESS:
+ g_value_set_boolean (value, priv->has_progress);
+ break;
+ case PROP_INTERACTIVITY:
+ g_value_set_enum (value, priv->interactivity);
+ break;
+ }
+}
+
+static void
+gnome_appbar_class_init (GnomeAppBarClass *class)
+{
+ GtkObjectClass *object_class;
+ GObjectClass *gobject_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
+
+ object_class = (GtkObjectClass *) class;
+ gobject_class = (GObjectClass *) class;
+ widget_class = (GtkWidgetClass *) class;
+ container_class = (GtkContainerClass *) class;
+
+ parent_class = GTK_HBOX_CLASS (gtk_type_class (GTK_TYPE_HBOX));
+
+ gobject_class->constructor = gnome_appbar_constructor;
+ gobject_class->get_property = gnome_appbar_get_property;
+ gobject_class->set_property = gnome_appbar_set_property;
+
+ appbar_signals[USER_RESPONSE] =
+ gtk_signal_new ("user_response",
+ GTK_RUN_LAST,
+ GTK_CLASS_TYPE (object_class),
+ GTK_SIGNAL_OFFSET (GnomeAppBarClass, user_response),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
+
+ appbar_signals[CLEAR_PROMPT] =
+ gtk_signal_new ("clear_prompt",
+ GTK_RUN_LAST,
+ GTK_CLASS_TYPE (object_class),
+ GTK_SIGNAL_OFFSET (GnomeAppBarClass, clear_prompt),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
+
+ g_object_class_install_property (
+ gobject_class,
+ PROP_HAS_PROGRESS,
+ g_param_spec_boolean ("has_progress",
+ _("Has Progress"),
+ _("Create a progress widget."),
+ FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ gobject_class,
+ PROP_HAS_STATUS,
+ g_param_spec_boolean ("has_status",
+ _("Has Status"),
+ _("Create a status widget."),
+ FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ gobject_class,
+ PROP_INTERACTIVITY,
+ g_param_spec_enum ("interactivity",
+ _("Interactivity"),
+ _("Level of user activity required."),
+ GNOME_TYPE_PREFERENCES_TYPE,
+ GNOME_PREFERENCES_NEVER,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ class->user_response = NULL;
+ class->clear_prompt = NULL; /* maybe should have a handler
+ and the clear_prompt function
+ just emits. */
+ gobject_class->finalize = gnome_appbar_finalize;
+}
Index: gnome-appbar.h
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-appbar.h,v
retrieving revision 1.21
diff -u -r1.21 gnome-appbar.h
--- gnome-appbar.h 2001/10/23 21:56:54 1.21
+++ gnome-appbar.h 2001/12/07 00:28:01
@@ -124,12 +124,6 @@
gchar * gnome_appbar_get_response (GnomeAppBar * appbar);
-/* For use to bindings in languages other than C. Don't use. */
-void gnome_appbar_construct(GnomeAppBar * ab,
- gboolean has_progress,
- gboolean has_status,
- GnomePreferencesType interactivity);
-
G_END_DECLS
#endif /* __GNOME_APPBAR_H__ */
Index: gnome-dateedit.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-dateedit.c,v
retrieving revision 1.57
diff -u -r1.57 gnome-dateedit.c
--- gnome-dateedit.c 2001/11/13 01:09:28 1.57
+++ gnome-dateedit.c 2001/12/07 00:28:01
@@ -494,6 +494,7 @@
gde->_priv->lower_hour = 7;
gde->_priv->upper_hour = 19;
gde->_priv->flags = GNOME_DATE_EDIT_SHOW_TIME;
+ create_children (gde);
}
static void
@@ -814,8 +815,7 @@
void
gnome_date_edit_construct (GnomeDateEdit *gde, time_t the_time, GnomeDateEditFlags flags)
{
- gde->_priv->flags = flags;
- create_children (gde);
+ gnome_date_edit_set_flags (gde, flags);
gnome_date_edit_set_time (gde, the_time);
}
Index: gnome-dialog.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-dialog.c,v
retrieving revision 1.77
diff -u -r1.77 gnome-dialog.c
--- gnome-dialog.c 2001/09/14 19:33:17 1.77
+++ gnome-dialog.c 2001/12/07 00:28:01
@@ -37,15 +37,6 @@
#include <libgnomeuiP.h>
-struct _GnomeDialogPrivate {
- GtkWidget *action_area; /* A button box, not an hbox */
-
- GtkAccelGroup *accelerators;
-
- unsigned int click_closes : 1;
- unsigned int just_hide : 1;
-};
-
enum {
CLICKED,
CLOSE,
Index: gnome-druid-page-edge.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-druid-page-edge.c,v
retrieving revision 1.26
diff -u -r1.26 gnome-druid-page-edge.c
--- gnome-druid-page-edge.c 2001/11/13 01:09:28 1.26
+++ gnome-druid-page-edge.c 2001/12/07 00:28:01
@@ -278,6 +278,7 @@
{
GnomeCanvas *canvas;
guint32 fill_color;
+ PangoFontDescription *font_desc;
canvas = GNOME_CANVAS (druid_page_edge->_priv->canvas);
@@ -311,8 +312,6 @@
GNOME_TYPE_CANVAS_PIXBUF,
"x", 0.0,
"y", 0.0,
- "x_set", TRUE,
- "y_set", TRUE,
NULL);
if (druid_page_edge->top_watermark_image != NULL)
@@ -323,8 +322,6 @@
druid_page_edge->_priv->logo_item =
gnome_canvas_item_new (gnome_canvas_root (canvas),
GNOME_TYPE_CANVAS_PIXBUF,
- "x_set", TRUE,
- "y_set", TRUE,
NULL);
if (druid_page_edge->logo_image != NULL)
@@ -334,8 +331,6 @@
druid_page_edge->_priv->watermark_item =
gnome_canvas_item_new (gnome_canvas_root (canvas),
GNOME_TYPE_CANVAS_PIXBUF,
- "x_set", TRUE,
- "y_set", TRUE,
NULL);
if (druid_page_edge->watermark_image != NULL)
@@ -344,23 +339,27 @@
NULL);
fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->title_color);
+ font_desc = pango_font_description_from_string (_("Helvetical Bold 18"));
druid_page_edge->_priv->title_item =
gnome_canvas_item_new (gnome_canvas_root (canvas),
GNOME_TYPE_CANVAS_TEXT,
"text", druid_page_edge->title,
"fill_color_rgba", fill_color,
- "fontset", _("-adobe-helvetica-bold-r-normal-*-*-180-*-*-p-*-*-*,*-r-*"),
+ "font_desc", font_desc,
NULL);
+ pango_font_description_free (font_desc);
fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->text_color);
+ font_desc = pango_font_description_from_string (_("Helvetical Medium 12"));
druid_page_edge->_priv->text_item =
gnome_canvas_item_new (gnome_canvas_root (canvas),
GNOME_TYPE_CANVAS_TEXT,
"text", druid_page_edge->text,
"justification", GTK_JUSTIFY_LEFT,
- "fontset", _("-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-*-*,*-r-*"),
+ "font_desc", font_desc,
"fill_color_rgba", fill_color,
NULL);
+ pango_font_description_free (font_desc);
gtk_signal_connect (GTK_OBJECT (druid_page_edge),
"prepare",
@@ -377,12 +376,14 @@
case GNOME_EDGE_START:
gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid), FALSE, TRUE, TRUE, TRUE);
gnome_druid_set_show_finish (GNOME_DRUID (druid), FALSE);
- gtk_widget_grab_default (GNOME_DRUID (druid)->next);
+ if (GTK_IS_WINDOW (gtk_widget_get_toplevel (druid)))
+ gtk_widget_grab_default (GNOME_DRUID (druid)->next);
break;
case GNOME_EDGE_FINISH:
gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid), TRUE, FALSE, TRUE, TRUE);
gnome_druid_set_show_finish (GNOME_DRUID (druid), TRUE);
- gtk_widget_grab_default (GNOME_DRUID (druid)->finish);
+ if (GTK_IS_WINDOW (gtk_widget_get_toplevel (druid)))
+ gtk_widget_grab_default (GNOME_DRUID (druid)->finish);
break;
case GNOME_EDGE_OTHER:
gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid), TRUE, TRUE, TRUE, TRUE);
Index: gnome-druid-page-standard.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-druid-page-standard.c,v
retrieving revision 1.35
diff -u -r1.35 gnome-druid-page-standard.c
--- gnome-druid-page-standard.c 2001/11/13 01:09:28 1.35
+++ gnome-druid-page-standard.c 2001/12/07 00:28:02
@@ -122,7 +122,7 @@
gobject_class->set_property = gnome_druid_page_standard_set_property;
gobject_class->finalize = gnome_druid_page_standard_finalize;
object_class->destroy = gnome_druid_page_standard_destroy;
- widget_class->size_allocate = gnome_druid_page_standard_size_allocate;
+ /* widget_class->size_allocate = gnome_druid_page_standard_size_allocate; */
widget_class->realize = gnome_druid_page_standard_realize;
widget_class->style_set = gnome_druid_page_standard_style_set;
druid_page_class->prepare = gnome_druid_page_standard_prepare;
@@ -524,7 +524,8 @@
{
gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid), TRUE, TRUE, TRUE, TRUE);
gnome_druid_set_show_finish (GNOME_DRUID (druid), FALSE);
- gtk_widget_grab_default (GNOME_DRUID (druid)->next);
+ if (GTK_IS_WINDOW (gtk_widget_get_toplevel (druid)))
+ gtk_widget_grab_default (GNOME_DRUID (druid)->next);
}
GtkWidget *
Index: gnome-icon-list.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-icon-list.c,v
retrieving revision 1.121
diff -u -r1.121 gnome-icon-list.c
--- gnome-icon-list.c 2001/11/13 01:09:28 1.121
+++ gnome-icon-list.c 2001/12/07 00:28:02
@@ -1841,6 +1841,23 @@
return TRUE;
}
+static GObject *
+gnome_icon_list_constructor (GType type,
+ guint n_properties,
+ GObjectConstructParam *properties)
+{
+ GObject *gil;
+
+ gil = G_OBJECT_CLASS (parent_class)->constructor (type,
+ n_properties,
+ properties);
+
+ gnome_canvas_set_scroll_region (GNOME_CANVAS (gil), 0.0, 0.0, 1000000.0, 1000000.0);
+ gnome_canvas_scroll_to (GNOME_CANVAS (gil), 0, 0);
+
+ return gil;
+}
+
static void
gnome_icon_list_class_init (GilClass *gil_class)
{
@@ -1892,6 +1909,7 @@
object_class->destroy = gil_destroy;
gobject_class->finalize = gil_finalize;
+ gobject_class->constructor = gnome_icon_list_constructor;
widget_class->size_request = gil_size_request;
widget_class->size_allocate = gil_size_allocate;
@@ -1918,9 +1936,6 @@
gil->_priv->selection_mode = GTK_SELECTION_SINGLE;
gil->_priv->dirty = TRUE;
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (gil), 0.0, 0.0, 1000000.0, 1000000.0);
- gnome_canvas_scroll_to (GNOME_CANVAS (gil), 0, 0);
}
/**
Index: gnome-mdi-session.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-mdi-session.c,v
retrieving revision 1.28
diff -u -r1.28 gnome-mdi-session.c
--- gnome-mdi-session.c 2001/09/02 19:21:17 1.28
+++ gnome-mdi-session.c 2001/12/07 00:28:02
@@ -199,7 +199,7 @@
bonobo_dock_layout_parse_string(mdi->active_window->layout, string);
gtk_container_forall(GTK_CONTAINER(app->dock), remove_items, app->dock);
bonobo_dock_add_from_layout(BONOBO_DOCK(app->dock), layout);
- gtk_object_unref(GTK_OBJECT(layout));
+ g_object_unref (G_OBJECT(layout));
}
#endif
}
@@ -496,7 +496,7 @@
layout = bonobo_dock_get_layout (BONOBO_DOCK (app->dock));
string = bonobo_dock_layout_create_string (layout);
- gtk_object_unref (GTK_OBJECT (layout));
+ g_object_unref (G_OBJECT (layout));
gnome_config_set_string(key, string);
g_free(string);
Index: gnome-mdi.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-mdi.c,v
retrieving revision 1.124
diff -u -r1.124 gnome-mdi.c
--- gnome-mdi.c 2001/11/18 22:27:28 1.124
+++ gnome-mdi.c 2001/12/07 00:28:02
@@ -724,7 +724,7 @@
if(app) {
layout = bonobo_dock_get_layout(BONOBO_DOCK(app->dock));
layout_string = bonobo_dock_layout_create_string(layout);
- gtk_object_unref(GTK_OBJECT(layout));
+ g_object_unref (G_OBJECT(layout));
}
app_create(mdi, layout_string);
Index: gnome-messagebox.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-messagebox.c,v
retrieving revision 1.59
diff -u -r1.59 gnome-messagebox.c
--- gnome-messagebox.c 2001/12/01 19:37:36 1.59
+++ gnome-messagebox.c 2001/12/07 00:28:02
@@ -47,11 +47,6 @@
int dummy;
};
-static void gnome_message_box_construct (GnomeMessageBox *messagebox,
- const gchar *message,
- const gchar *message_box_type,
- const gchar **buttons);
-
GNOME_CLASS_BOILERPLATE (GnomeMessageBox, gnome_message_box,
GnomeDialog, GNOME_TYPE_DIALOG)
@@ -85,7 +80,7 @@
*
* Returns:
*/
-static void
+void
gnome_message_box_construct (GnomeMessageBox *messagebox,
const gchar *message,
const gchar *message_box_type,
@@ -144,12 +139,9 @@
if (appname) {
s = g_strdup_printf("%s (%s)", title_prefix, appname);
}
- if (s) {
- gtk_window_set_title(GTK_WINDOW(messagebox), s);
- g_free(s);
- } else {
- gtk_window_set_title(GTK_WINDOW(messagebox), title_prefix);
- }
+
+ gnome_dialog_construct (GNOME_DIALOG (messagebox), s ? s : title_prefix, buttons);
+ g_free (s);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX(GNOME_DIALOG(messagebox)->vbox),
@@ -177,18 +169,6 @@
gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
}
-
- if (buttons) {
- while (buttons[i]) {
- gnome_dialog_append_button (GNOME_DIALOG (messagebox),
- buttons[i]);
- i++;
- };
- }
-
- if(GNOME_DIALOG(messagebox)->buttons)
- gtk_widget_grab_focus(
- g_list_last (GNOME_DIALOG (messagebox)->buttons)->data);
gnome_dialog_set_close (GNOME_DIALOG (messagebox),
TRUE );
Index: gnome-messagebox.h
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-messagebox.h,v
retrieving revision 1.22
diff -u -r1.22 gnome-messagebox.h
--- gnome-messagebox.h 2001/09/06 04:59:18 1.22
+++ gnome-messagebox.h 2001/12/07 00:28:02
@@ -70,6 +70,11 @@
const gchar *messagebox_type,
const gchar **buttons);
+void gnome_message_box_construct (GnomeMessageBox *messagebox,
+ const gchar *message,
+ const gchar *message_box_type,
+ const gchar **buttons);
+
G_END_DECLS
#endif /* GNOME_DISABLE_DEPRECATED */
Index: libgnomeuiP.h
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/libgnomeuiP.h,v
retrieving revision 1.13
diff -u -r1.13 libgnomeuiP.h
--- libgnomeuiP.h 2001/11/20 22:03:00 1.13
+++ libgnomeuiP.h 2001/12/07 00:28:02
@@ -39,6 +39,15 @@
void gnome_type_init(void);
+struct _GnomeDialogPrivate {
+ GtkWidget *action_area; /* A button box, not an hbox */
+
+ GtkAccelGroup *accelerators;
+
+ unsigned int click_closes : 1;
+ unsigned int just_hide : 1;
+};
+
G_END_DECLS
#endif /* LIBGNOMEUIP_H */
Index: glade-gnome.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/glade/glade-gnome.c,v
retrieving revision 1.50
diff -u -r1.50 glade-gnome.c
--- glade-gnome.c 2001/10/25 00:34:01 1.50
+++ glade-gnome.c 2001/12/07 00:28:10
@@ -32,7 +32,553 @@
#include <glade/glade-build.h>
#include <libgnomeui/libgnomeui.h>
+#include <libgnomeui/libgnomeuiP.h>
+
+#include <libbonoboui.h>
+
+typedef struct {
+ const char *extension;
+ GnomeUIInfo data;
+} gnomeuiinfo_map_t;
+
+static GnomeUIInfo tmptree[] = {
+ GNOMEUIINFO_END
+};
+
+static const gnomeuiinfo_map_t gnome_uiinfo_mapping[] = {
+ { "ABOUT_ITEM", GNOMEUIINFO_MENU_ABOUT_ITEM(NULL, NULL) },
+ { "CLEAR_ITEM", GNOMEUIINFO_MENU_CLEAR_ITEM(NULL, NULL) },
+ { "CLOSE_ITEM", GNOMEUIINFO_MENU_CLOSE_ITEM(NULL, NULL) },
+ { "CLOSE_WINDOW_ITEM", GNOMEUIINFO_MENU_CLOSE_WINDOW_ITEM(NULL,NULL) },
+ { "COPY_ITEM", GNOMEUIINFO_MENU_COPY_ITEM(NULL, NULL) },
+ { "CUT_ITEM", GNOMEUIINFO_MENU_CUT_ITEM(NULL, NULL) },
+ { "EDIT_TREE", GNOMEUIINFO_MENU_EDIT_TREE(tmptree) },
+ { "END_GAME_ITEM", GNOMEUIINFO_MENU_END_GAME_ITEM(NULL, NULL) },
+ { "EXIT_ITEM", GNOMEUIINFO_MENU_EXIT_ITEM(NULL, NULL) },
+ { "FILES_TREE", GNOMEUIINFO_MENU_FILES_TREE(tmptree) },
+ { "FILE_TREE", GNOMEUIINFO_MENU_FILE_TREE(tmptree) },
+ { "FIND_AGAIN_ITEM", GNOMEUIINFO_MENU_FIND_AGAIN_ITEM(NULL, NULL) },
+ { "FIND_ITEM", GNOMEUIINFO_MENU_FIND_ITEM(NULL, NULL) },
+ { "GAME_TREE", GNOMEUIINFO_MENU_GAME_TREE(tmptree) },
+ { "HELP_TREE", GNOMEUIINFO_MENU_HELP_TREE(tmptree) },
+ { "HINT_ITEM", GNOMEUIINFO_MENU_HINT_ITEM(NULL, NULL) },
+ { "NEW_GAME_ITEM", GNOMEUIINFO_MENU_NEW_GAME_ITEM(NULL, NULL) },
+ { "NEW_ITEM", GNOMEUIINFO_MENU_NEW_ITEM(NULL, NULL, NULL, NULL) },
+ { "NEW_SUBTREE", GNOMEUIINFO_MENU_NEW_SUBTREE(tmptree) },
+ { "NEW_WINDOW_ITEM", GNOMEUIINFO_MENU_NEW_WINDOW_ITEM(NULL, NULL) },
+ { "OPEN_ITEM", GNOMEUIINFO_MENU_OPEN_ITEM(NULL, NULL) },
+ { "PASTE_ITEM", GNOMEUIINFO_MENU_PASTE_ITEM(NULL, NULL) },
+ { "PAUSE_GAME_ITEM", GNOMEUIINFO_MENU_PAUSE_GAME_ITEM(NULL, NULL) },
+ { "PREFERENCES_ITEM", GNOMEUIINFO_MENU_PREFERENCES_ITEM(NULL, NULL) },
+ { "PRINT_ITEM", GNOMEUIINFO_MENU_PRINT_ITEM(NULL, NULL) },
+ { "PRINT_SETUP_ITEM", GNOMEUIINFO_MENU_PRINT_SETUP_ITEM(NULL, NULL) },
+ { "PROPERTIES_ITEM", GNOMEUIINFO_MENU_PROPERTIES_ITEM(NULL, NULL) },
+ { "REDO_ITEM", GNOMEUIINFO_MENU_REDO_ITEM(NULL, NULL) },
+ { "REDO_MOVE_ITEM", GNOMEUIINFO_MENU_REDO_MOVE_ITEM(NULL, NULL) },
+ { "REPLACE_ITEM", GNOMEUIINFO_MENU_REPLACE_ITEM(NULL, NULL) },
+ { "RESTART_GAME_ITEM", GNOMEUIINFO_MENU_RESTART_GAME_ITEM(NULL,NULL) },
+ { "REVERT_ITEM", GNOMEUIINFO_MENU_REVERT_ITEM(NULL, NULL) },
+ { "SAVE_AS_ITEM", GNOMEUIINFO_MENU_SAVE_AS_ITEM(NULL, NULL) },
+ { "SAVE_ITEM", GNOMEUIINFO_MENU_SAVE_ITEM(NULL, NULL) },
+ { "SCORES_ITEM", GNOMEUIINFO_MENU_SCORES_ITEM(NULL, NULL) },
+ { "SELECT_ALL_ITEM", GNOMEUIINFO_MENU_SELECT_ALL_ITEM(NULL, NULL) },
+ { "SETTINGS_TREE", GNOMEUIINFO_MENU_SETTINGS_TREE(tmptree) },
+ { "UNDO_ITEM", GNOMEUIINFO_MENU_UNDO_ITEM(NULL, NULL) },
+ { "UNDO_MOVE_ITEM", GNOMEUIINFO_MENU_UNDO_MOVE_ITEM(NULL, NULL) },
+ { "VIEW_TREE", GNOMEUIINFO_MENU_VIEW_TREE(tmptree) },
+ { "WINDOWS_TREE", GNOMEUIINFO_MENU_WINDOWS_TREE(tmptree) },
+};
+
+static int
+stock_compare (const void *a, const void *b)
+{
+ const gnomeuiinfo_map_t *ga = a;
+ const gnomeuiinfo_map_t *gb = b;
+
+ return strcmp (ga->extension, gb->extension);
+}
+
+static gboolean
+get_stock_uiinfo (const char *stock_name, GnomeUIInfo *info)
+{
+ const int len = strlen ("GNOMEUIINFO_MENU_");
+ gnomeuiinfo_map_t *v;
+ gnomeuiinfo_map_t base;
+
+ /* If an error happens, return this */
+ if (!strncmp (stock_name, "GNOMEUIINFO_MENU_", len)) {
+ base.extension = stock_name + len;
+ v = bsearch (
+ &base,
+ gnome_uiinfo_mapping,
+ sizeof(gnome_uiinfo_mapping) /
+ sizeof(gnomeuiinfo_map_t),
+ sizeof (gnome_uiinfo_mapping [0]),
+ stock_compare);
+ if (v) {
+ *info = v->data;
+ return TRUE;
+ } else
+ return FALSE;
+ }
+ return FALSE;
+}
+
+static void
+menushell_build_children (GladeXML *xml, GtkWidget *w,
+ GladeWidgetInfo *info)
+{
+ int i, j;
+ GnomeUIInfo infos[2] = {
+ { GNOME_APP_UI_ITEM },
+ GNOMEUIINFO_END
+ };
+#if 0
+ GtkAccelGroup *uline = NULL;
+
+ if (strcmp (info->class, "GtkMenuBar") != 0) {
+ uline = gtk_menu_ensure_uline_accel_group (GTK_MENU (w));
+ glade_xml_push_uline_accel (xml, uline);
+ }
+#endif
+
+ for (i = 0; i < info->n_children; i++) {
+ GladeChildInfo *cinfo = &info->children[i];
+ GladeWidgetInfo *cwinfo = cinfo->child;
+ GtkWidget *child;
+ gchar *stock_name = NULL;
+
+ for (j = 0; j < cwinfo->n_properties; j++) {
+ if (!strcmp (cwinfo->properties[j].name, "stock_item")) {
+ stock_name = cwinfo->properties[j].value;
+ break;
+ }
+ }
+ if (!stock_name) {
+ /* this is a normal menu item */
+ child = glade_xml_build_widget (xml, cwinfo);
+ gtk_menu_shell_append (GTK_MENU_SHELL (w), child);
+ continue;
+ }
+ /* load the template GnomeUIInfo for this item */
+ if (!get_stock_uiinfo (stock_name, &infos[0])) {
+ /* failure ... */
+ if (!strncmp (stock_name, "GNOMEUIINFO_", 12))
+ stock_name += 12;
+ child = gtk_menu_item_new_with_label (stock_name);
+ glade_xml_set_common_params (xml, child, cwinfo);
+ gtk_menu_shell_append (GTK_MENU_SHELL(w), child);
+ continue;
+ }
+ /* we now have the template for this item. Now fill it in */
+ for (j = 0; j < cwinfo->n_properties; j++) {
+ const char *name = cwinfo->properties[j].name;
+ const char *value = cwinfo->properties[j].value;
+ if (!strcmp (name, "label"))
+ infos[0].label = _(value);
+ else if (!strcmp (name, "tooltip"))
+ infos[0].hint = _(value);
+ }
+ gnome_app_fill_menu (GTK_MENU_SHELL(w), infos,
+ glade_xml_ensure_accel(xml), TRUE,
+ i);
+ child = infos[0].widget;
+ gtk_menu_item_remove_submenu(GTK_MENU_ITEM(child));
+ glade_xml_set_common_params(xml, child, cwinfo);
+ }
+
+#if 0
+ if (uline)
+ glade_xml_pop_uline_accel(xml);
+#endif
+#if 0
+ if (strcmp(info->class, "GtkMenuBar") != 0 &&
+ gnome_preferences_get_menus_have_tearoff()) {
+ GtkWidget *tearoff = gtk_tearoff_menu_item_new();
+
+ gtk_menu_prepend(GTK_MENU(w), tearoff);
+ gtk_widget_show(tearoff);
+ }
+#endif
+}
+
+static void
+gnome_add_dock_item (GladeXML *xml,
+ GtkWidget *parent,
+ GladeWidgetInfo *info,
+ GladeChildInfo *childinfo)
+{
+ BonoboDockPlacement placement;
+ guint band, offset;
+ int position;
+ BonoboDockItemBehavior behavior;
+ int i;
+ GtkWidget *child;
+ GtkWindow *toplevel;
+
+ band = offset = position = 0;
+ placement = BONOBO_DOCK_TOP;
+ behavior = BONOBO_DOCK_ITEM_BEH_NORMAL;
+
+ for (i = 0; i < childinfo->child->n_properties; i++) {
+ const char *name = childinfo->child->properties[i].name;
+ const char *value = childinfo->child->properties[i].value;
+
+ if (!strcmp (name, "placement"))
+ placement = glade_enum_from_string (
+ BONOBO_TYPE_DOCK_PLACEMENT,
+ value);
+ else if (!strcmp (name, "band"))
+ band = strtoul (value, NULL, 10);
+ else if (!strcmp (name, "position"))
+ position = strtol (value, NULL, 10);
+ else if (!strcmp (name, "offset"))
+ offset = strtoul (value, NULL, 10);
+ else if (!strcmp (name, "behavior"))
+ behavior = glade_flags_from_string (
+ BONOBO_TYPE_DOCK_ITEM_BEHAVIOR,
+ value);
+ }
+
+ child = glade_xml_build_widget (xml, childinfo->child);
+
+ toplevel = glade_xml_get_toplevel (xml);
+
+ g_print ("%p: %s\n", toplevel, g_type_name (G_TYPE_FROM_INSTANCE (toplevel)));
+
+ if (GNOME_IS_APP (toplevel)) {
+ g_message ("gnome_app_add_dock_item ()");
+ gnome_app_add_dock_item (
+ GNOME_APP (toplevel),
+ BONOBO_DOCK_ITEM (child),
+ placement,
+ band,
+ position,
+ offset);
+ } else {
+ bonobo_dock_add_item (BONOBO_DOCK (parent),
+ BONOBO_DOCK_ITEM (child),
+ placement, band, position, offset,
+ FALSE);
+ }
+}
+
+
+static void
+gnome_dock_build_children (GladeXML *xml, GtkWidget *w, GladeWidgetInfo *info)
+{
+ int i;
+ GtkWidget *child;
+ GtkWindow *toplevel;
+ GladeChildInfo *childinfo;
+
+ g_message ("gnome api!");
+
+ toplevel = glade_xml_get_toplevel (xml);
+
+ for (i = 0; i < info->n_children; i++) {
+ childinfo = &info->children[i];
+
+ if (!strcmp (childinfo->child->class, "BonoboDockItem")) {
+ gnome_add_dock_item (xml, w, info, childinfo);
+ continue;
+ }
+
+ if (bonobo_dock_get_client_area (BONOBO_DOCK (w)))
+ g_warning ("Multiple client areas for BonoboDock found.");
+
+ child = glade_xml_build_widget (xml, childinfo->child);
+
+ if (GNOME_IS_APP (toplevel))
+ gnome_app_set_contents (GNOME_APP (toplevel), child);
+ else
+ bonobo_dock_set_client_area (BONOBO_DOCK (w), child);
+ }
+}
+
+static void
+dialog_build_children(GladeXML *self, GtkWidget *w,
+ GladeWidgetInfo *info)
+
+{
+ GnomeDialog *dialog = GNOME_DIALOG (w);
+ GtkWidget *aa;
+ GList *children, *list;
+ char *label;
+
+ glade_standard_build_children (self, w, info);
+
+ aa = dialog->_priv->action_area;
+ if (!aa)
+ return;
+
+ children = gtk_container_get_children (GTK_CONTAINER (aa));
+ for (list = children; list; list = list->next) {
+ gtk_widget_ref (GTK_WIDGET (list->data));
+ gtk_container_remove (GTK_CONTAINER (aa), GTK_WIDGET (list->data));
+ }
+
+ for (list = children; list; list = list->next) {
+ g_object_get (G_OBJECT (list->data), "label", &label, NULL);
+ if (label)
+ gnome_dialog_append_button (dialog, label);
+ }
+
+ g_list_foreach (children, (GFunc)gtk_widget_unref, NULL);
+ g_list_free (children);
+}
+
+static void
+app_build_children (GladeXML *self, GtkWidget *parent,
+ GladeWidgetInfo *info)
+{
+ int i, j;
+
+ for (i = 0; i < info->n_children; i++) {
+ GladeChildInfo *cinfo;
+ GtkWidget *child;
+
+ cinfo = &info->children[i];
+
+ child = glade_xml_build_widget (self, cinfo->child);
+
+ g_object_ref (G_OBJECT (child));
+ gtk_widget_freeze_child_notify (child);
+
+ if (cinfo->internal_child) {
+ if (!strcmp (cinfo->internal_child, "appbar"))
+ gnome_app_set_statusbar (GNOME_APP (parent), child);
+#if 0
+ else if (!strcmp (cinfo->internal_child, "dock"))
+ build_dock (self, GNOME_APP (parent), BONOBO_DOCK (child), cinfo->child);
+#endif
+ } else
+ g_error ("wtf?");
+
+#if 0
+ for (j = 0; j < info->children[i].n_properties; j++)
+ glade_xml_set_packing_property (
+ self, GNOME_APP (parent)->vbox, child,
+ cinfo->properties[j].name,
+ cinfo->properties[j].value);
+#endif
+ gtk_widget_thaw_child_notify(child);
+ g_object_unref(G_OBJECT(child));
+
+ }
+}
+
+static GtkWidget *
+app_build (GladeXML *xml, GType widget_type,
+ GladeWidgetInfo *info)
+{
+ GtkWidget *app;
+ const char *s;
+
+ app = glade_standard_build_widget (xml, widget_type, info);
+
+ g_object_get (G_OBJECT (gnome_program_get ()),
+ GNOME_PARAM_APP_ID, &s,
+ NULL);
+
+ g_object_set (G_OBJECT (app), "app_id", s, NULL);
+
+ return app;
+}
+
static GtkWidget *
+dialog_new (GladeXML *xml, GType widget_type,
+ GladeWidgetInfo *info)
+{
+ GtkWidget *dialog;
+ const char *buttons[] = { NULL };
+
+ dialog = glade_standard_build_widget (xml, widget_type, info);
+
+ gnome_dialog_constructv (GNOME_DIALOG (dialog), NULL, buttons);
+
+ return dialog;
+}
+
+/* GnomeDruidPageEdge really sucks. */
+#if 0
+#define DRUID_SET_STRING(pos, POS, var) \
+static void \
+druid_page_##pos##_set_##var (GladeXML *xml, GtkWidget *w, \
+ const char *name, const char *value) \
+{ \
+ gnome_druid_page_##pos##_set_##var (GNOME_DRUID_PAGE_##POS (w), value); \
+}
+
+#define DRUID_SET_COLOR(pos, POS, var) \
+static void \
+druid_page_##pos##_set_##var##_color (GladeXML *xml, GtkWidget *w, \
+ const char *name, const char *value) \
+{ \
+ GdkColor colour = { 0 }; \
+ if (gdk_color_parse(value, &colour) && \
+ gdk_colormap_alloc_color (gtk_widget_get_default_colormap(), \
+ &colour, FALSE, TRUE)) { \
+ } else { \
+ g_warning ("could not parse colour name `%s'", value); \
+ return; \
+ } \
+ gnome_druid_page_##pos##_set_##var##_color (GNOME_DRUID_PAGE_##POS (w), &colour); \
+}
+
+
+DRUID_SET_STRING (edge, EDGE, title)
+DRUID_SET_STRING (edge, EDGE, text)
+DRUID_SET_COLOR (edge, EDGE, title)
+DRUID_SET_COLOR (edge, EDGE, text)
+DRUID_SET_COLOR (edge, EDGE, bg)
+DRUID_SET_COLOR (edge, EDGE, logo_bg)
+DRUID_SET_COLOR (edge, EDGE, textbox)
+#endif
+
+/* this is a huge hack */
+static GtkWidget *
+druid_page_edge_new (GladeXML *xml, GType widget_type,
+ GladeWidgetInfo *info)
+{
+ GtkWidget *druid;
+ GnomeEdgePosition position = GNOME_EDGE_OTHER;
+ int i;
+
+ const char *title, *text;
+ const char *title_color, *text_color;
+ const char *bg_color, *logo_bg_color, *textbox_color;
+ char *filename;
+ GdkPixbuf *logo, *watermark, *top_watermark;
+
+ title = text = title_color = text_color = bg_color = logo_bg_color = textbox_color = NULL;
+ logo = watermark = top_watermark = NULL;
+
+ for (i = 0; i < info->n_properties; i++) {
+ const char *name = info->properties[i].name;
+ const char *value = info->properties[i].value;
+
+ if (!strcmp (name, "position"))
+ position = glade_enum_from_string (
+ GNOME_TYPE_EDGE_POSITION, value);
+ else if (!strcmp (name, "textbox_color"))
+ textbox_color = value;
+ else if (!strcmp (name, "logo_background_color"))
+ logo_bg_color = value;
+ else if (!strcmp (name, "background_color"))
+ bg_color = value;
+ else if (!strcmp (name, "text_color"))
+ text_color = value;
+ else if (!strcmp (name, "title_color"))
+ title_color = value;
+ else if (!strcmp (name, "text"))
+ text = value;
+ else if (!strcmp (name, "title"))
+ title = value;
+ else if (!strcmp (name, "logo_image")) {
+ if (logo)
+ gdk_pixbuf_unref (logo);
+ filename = glade_xml_relative_file (xml, value);
+ logo = gdk_pixbuf_new_from_file (filename, NULL);
+ g_free (filename);
+ } else if (!strcmp (name, "watermark_image")) {
+ if (watermark)
+ gdk_pixbuf_unref (watermark);
+ filename = glade_xml_relative_file (xml, value);
+ watermark = gdk_pixbuf_new_from_file (filename, NULL);
+ g_free (filename);
+ }
+
+ }
+
+ druid = gnome_druid_page_edge_new_with_vals (
+ position, TRUE, title, text,
+ logo, watermark, top_watermark);
+
+
+
+ if (logo)
+ gdk_pixbuf_unref (logo);
+ if (watermark)
+ gdk_pixbuf_unref (watermark);
+ if (top_watermark)
+ gdk_pixbuf_unref (top_watermark);
+
+ return druid;
+}
+
+static GtkWidget *
+message_box_new (GladeXML *xml, GType widget_type,
+ GladeWidgetInfo *info)
+{
+ GtkWidget *dialog;
+ const char *buttons[] = { NULL };
+ const char *type = "generic", *message = NULL;
+ int i;
+
+ for (i = 0; i < info->n_properties; i++) {
+ const char *name = info->properties[i].name;
+ const char *value = info->properties[i].value;
+
+ if (!strcmp (name, "message"))
+ message = value;
+ if (!strcmp (name, "message_box_type"))
+ type = value;
+ }
+
+ dialog = glade_standard_build_widget (xml, widget_type, info);
+
+ gnome_message_box_construct (GNOME_MESSAGE_BOX (dialog), message, type, buttons);
+
+ return dialog;
+}
+
+static GtkWidget *
+date_edit_new (GladeXML *xml, GType widget_type,
+ GladeWidgetInfo *info)
+{
+ GtkWidget *de;
+
+ de = glade_standard_build_widget (xml, widget_type, info);
+
+ g_object_set (G_OBJECT (de), "time", time (NULL), NULL);
+
+ return de;
+}
+
+static GtkWidget *
+icon_list_new (GladeXML *xml, GType widget_type,
+ GladeWidgetInfo *info)
+{
+ GtkWidget *gil;
+ int flags = 0;
+ int icon_width = 0;
+ int i;
+
+ for (i = 0; i < info->n_properties; i++) {
+ const char *name = info->properties[i].name;
+ const char *value = info->properties[i].value;
+
+ if (!strcmp (name, "text_editable")) {
+ if (*value == 'y')
+ flags |= GNOME_ICON_LIST_IS_EDITABLE;
+ } else if (!strcmp (name, "text_static")) {
+ if (*value == 'y')
+ flags |= GNOME_ICON_LIST_STATIC_TEXT;
+ } else if (!strcmp (name, "icon_width")) {
+ icon_width = strtol (value, NULL, 10);
+ }
+ }
+
+ gil = glade_standard_build_widget (xml, widget_type, info);
+
+ gnome_icon_list_construct (GNOME_ICON_LIST (gil),
+ icon_width, flags);
+
+ return gil;
+}
+
+static GtkWidget *
druidpagestandard_find_internal_child(GladeXML *xml, GtkWidget *parent,
const gchar *childname)
{
@@ -47,7 +593,9 @@
{
if (!strcmp(childname, "vbox"))
return GNOME_DIALOG(parent)->vbox;
- g_warning ("Internal '%s'", childname);
+ else if (!strcmp (childname, "action_area"))
+ return GNOME_DIALOG (parent)->_priv->action_area;
+
return NULL;
}
@@ -77,10 +625,8 @@
{
if (!strcmp(childname, "vbox"))
return GNOME_DIALOG(parent)->vbox;
-#if 0
else if (!strcmp(childname, "action_area"))
- return GNOME_DIALOG(parent)->action_area;
-#endif
+ return GNOME_DIALOG(parent)->_priv->action_area;
else if (!strcmp(childname, "notebook"))
return GNOME_PROPERTY_BOX(parent)->notebook;
else if (!strcmp(childname, "ok_button"))
@@ -94,7 +640,116 @@
return NULL;
}
+static GtkWidget *
+app_find_internal_child (GladeXML *xml, GtkWidget *parent,
+ const char *childname)
+{
+ if (!strcmp (childname, "dock"))
+ return GNOME_APP (parent)->dock;
+#if 0
+ else if (!strcmp (childname, "appbar"))
+ return GNOME_APP (parent)->statusbar;
+#endif
+
+ return NULL;
+}
+
+static void
+app_enable_layout_config (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_app_enable_layout_config (GNOME_APP (w),
+ *value == 'y');
+}
+
+static void
+pixmap_entry_set_preview (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_pixmap_entry_set_preview (GNOME_PIXMAP_ENTRY (w),
+ *value == 'y');
+}
+
+static void
+icon_list_set_selection_mode (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_icon_list_set_selection_mode (
+ GNOME_ICON_LIST (w),
+ glade_enum_from_string (GTK_TYPE_SELECTION_MODE,
+ value));
+}
+
+static void
+icon_list_set_row_spacing (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_icon_list_set_row_spacing (GNOME_ICON_LIST (w),
+ strtol (value, NULL, 10));
+}
+
+static void
+icon_list_set_col_spacing (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_icon_list_set_col_spacing (GNOME_ICON_LIST (w),
+ strtol (value, NULL, 10));
+}
+static void
+icon_list_set_text_spacing (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_icon_list_set_text_spacing (GNOME_ICON_LIST (w),
+ strtol (value, NULL, 10));
+}
+
+static void
+custom_noop (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ ;
+}
+
+static void
+dialog_set_auto_close (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_dialog_set_close (GNOME_DIALOG (w), *value == 'y');
+}
+
+static void
+dialog_set_hide_on_close (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ gnome_dialog_close_hides (GNOME_DIALOG (w), *value == 'y');
+}
+
+static void
+about_set_authors (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+{
+ char **authors;
+ GValueArray *authors_array;
+ int i;
+
+ authors = g_strsplit (value, "\n", 0);
+ authors_array = g_value_array_new (0);
+
+ for (i = 0; authors[i] != NULL; i++) {
+ GValue value = { 0 };
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_static_string (&value, authors[i]);
+ authors_array = g_value_array_append (authors_array, &value);
+ }
+
+ g_object_set (G_OBJECT (w), "authors", authors_array, NULL);
+
+ g_value_array_free (authors_array);
+
+ g_strfreev (authors);
+}
+
/* this macro puts a version check function into the module */
GLADE_MODULE_CHECK_INIT
@@ -103,21 +758,47 @@
{
glade_require ("bonobo");
- glade_register_widget (GNOME_TYPE_APP, glade_standard_build_widget,
- glade_standard_build_children, NULL);
+ glade_register_custom_prop (GNOME_TYPE_APP, "enable_layout_config", app_enable_layout_config);
+ glade_register_custom_prop (GNOME_TYPE_PIXMAP_ENTRY, "preview", pixmap_entry_set_preview);
+ glade_register_custom_prop (GNOME_TYPE_ICON_LIST, "selection_mode", icon_list_set_selection_mode);
+ glade_register_custom_prop (GNOME_TYPE_ICON_LIST, "icon_width", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_ICON_LIST, "row_spacing", icon_list_set_row_spacing);
+ glade_register_custom_prop (GNOME_TYPE_ICON_LIST, "column_spacing", icon_list_set_col_spacing);
+ glade_register_custom_prop (GNOME_TYPE_ICON_LIST, "text_spacing", icon_list_set_text_spacing);
+ glade_register_custom_prop (GNOME_TYPE_ICON_LIST, "text_editable", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_ICON_LIST, "text_static", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DIALOG, "auto_close", dialog_set_auto_close);
+ glade_register_custom_prop (GNOME_TYPE_DIALOG, "hide_on_close", dialog_set_hide_on_close);
+ glade_register_custom_prop (GNOME_TYPE_MESSAGE_BOX, "message", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_MESSAGE_BOX, "message_box_type", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_ABOUT, "authors", about_set_authors);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "title", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "text", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "title_color", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "text_color", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "background_color", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "logo_background_color", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "textbox_color", custom_noop);
+ glade_register_custom_prop (GNOME_TYPE_DRUID_PAGE_EDGE, "position", custom_noop);
+ glade_register_custom_prop (GTK_TYPE_IMAGE_MENU_ITEM, "stock_item", custom_noop);
+ glade_register_custom_prop (GTK_TYPE_MENU_ITEM, "stock_item", custom_noop);
+
+ glade_register_widget (GNOME_TYPE_ABOUT, NULL, NULL, NULL);
+ glade_register_widget (GNOME_TYPE_APP, app_build, app_build_children,
+ app_find_internal_child);
glade_register_widget (GNOME_TYPE_APPBAR, glade_standard_build_widget,
NULL, NULL);
glade_register_widget (GNOME_TYPE_COLOR_PICKER,glade_standard_build_widget,
NULL, NULL);
- glade_register_widget (GNOME_TYPE_DATE_EDIT, glade_standard_build_widget,
+ glade_register_widget (GNOME_TYPE_DATE_EDIT, date_edit_new,
NULL, NULL);
- glade_register_widget (GNOME_TYPE_DIALOG, glade_standard_build_widget,
- glade_standard_build_children, dialog_find_internal_child);
+ glade_register_widget (GNOME_TYPE_DIALOG, dialog_new,
+ dialog_build_children, dialog_find_internal_child);
glade_register_widget (GNOME_TYPE_DRUID, glade_standard_build_widget,
glade_standard_build_children, NULL);
glade_register_widget (GNOME_TYPE_DRUID_PAGE, glade_standard_build_widget,
glade_standard_build_children, NULL);
- glade_register_widget (GNOME_TYPE_DRUID_PAGE_EDGE, glade_standard_build_widget,
+ glade_register_widget (GNOME_TYPE_DRUID_PAGE_EDGE, druid_page_edge_new,
NULL, NULL);
glade_register_widget (GNOME_TYPE_DRUID_PAGE_STANDARD, glade_standard_build_widget,
glade_standard_build_children, druidpagestandard_find_internal_child);
@@ -129,16 +810,25 @@
NULL, NULL);
glade_register_widget (GNOME_TYPE_ICON_ENTRY, glade_standard_build_widget,
NULL, NULL);
- glade_register_widget (GNOME_TYPE_ICON_LIST, glade_standard_build_widget,
+ glade_register_widget (GNOME_TYPE_ICON_LIST, icon_list_new,
NULL, NULL);
glade_register_widget (GNOME_TYPE_ICON_SELECTION, glade_standard_build_widget,
NULL, NULL);
+ glade_register_widget (GNOME_TYPE_MESSAGE_BOX, message_box_new,
+ glade_standard_build_children, dialog_find_internal_child);
glade_register_widget (GNOME_TYPE_PIXMAP_ENTRY, glade_standard_build_widget,
NULL, NULL);
glade_register_widget (GNOME_TYPE_PROPERTY_BOX, glade_standard_build_widget,
glade_standard_build_children, propertybox_find_internal_child);
glade_register_widget (GNOME_TYPE_SCORES, glade_standard_build_widget,
NULL, NULL);
+ glade_register_widget (GNOME_TYPE_PIXMAP, glade_standard_build_widget, NULL, NULL);
+ glade_register_widget (GNOME_TYPE_FONT_PICKER, NULL, NULL, NULL);
+ /* things we need to override */
+ glade_register_widget (BONOBO_TYPE_DOCK, NULL, gnome_dock_build_children, NULL);
+ glade_register_widget (GTK_TYPE_MENU_BAR, NULL, menushell_build_children, NULL);
+ glade_register_widget (GTK_TYPE_MENU, NULL, menushell_build_children, NULL);
+
glade_provide ("gnome");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]