summaryrefslogtreecommitdiff
path: root/tools/glade/glade/gnome
diff options
context:
space:
mode:
Diffstat (limited to 'tools/glade/glade/gnome')
-rw-r--r--tools/glade/glade/gnome/Makefile.am33
-rw-r--r--tools/glade/glade/gnome/bonobodock.c510
-rw-r--r--tools/glade/glade/gnome/bonobodockitem.c786
-rw-r--r--tools/glade/glade/gnome/gnomeabout.c554
-rw-r--r--tools/glade/glade/gnome/gnomeapp.c461
-rw-r--r--tools/glade/glade/gnome/gnomeappbar.c198
-rw-r--r--tools/glade/glade/gnome/gnomecanvas.c263
-rw-r--r--tools/glade/glade/gnome/gnomecolorpicker.c233
-rw-r--r--tools/glade/glade/gnome/gnomecontrol.c757
-rw-r--r--tools/glade/glade/gnome/gnomedateedit.c313
-rw-r--r--tools/glade/glade/gnome/gnomedialog.c358
-rw-r--r--tools/glade/glade/gnome/gnomedruid.c499
-rw-r--r--tools/glade/glade/gnome/gnomedruidpageedge.c537
-rw-r--r--tools/glade/glade/gnome/gnomedruidpagestandard.c463
-rw-r--r--tools/glade/glade/gnome/gnomeentry.c225
-rw-r--r--tools/glade/glade/gnome/gnomefileentry.c382
-rw-r--r--tools/glade/glade/gnome/gnomefontpicker.c406
-rw-r--r--tools/glade/glade/gnome/gnomehref.c220
-rw-r--r--tools/glade/glade/gnome/gnomeiconentry.c222
-rw-r--r--tools/glade/glade/gnome/gnomeiconlist.c475
-rw-r--r--tools/glade/glade/gnome/gnomeiconselection.c168
-rw-r--r--tools/glade/glade/gnome/gnomemessagebox.c515
-rw-r--r--tools/glade/glade/gnome/gnomepixmap.c361
-rw-r--r--tools/glade/glade/gnome/gnomepixmapentry.c319
-rw-r--r--tools/glade/glade/gnome/gnomepropertybox.c383
25 files changed, 9641 insertions, 0 deletions
diff --git a/tools/glade/glade/gnome/Makefile.am b/tools/glade/glade/gnome/Makefile.am
new file mode 100644
index 00000000..02f3da2d
--- /dev/null
+++ b/tools/glade/glade/gnome/Makefile.am
@@ -0,0 +1,33 @@
+## Process this file with automake to produce Makefile.in
+
+noinst_LIBRARIES = libgnomewidgets.a
+
+# maybe this should just be $(GLADE_GNOME_CFLAGS) ?
+INCLUDES = $(GLADE_CFLAGS) \
+ $(GLADE_DEPRECATION_CFLAGS)
+
+libgnomewidgets_a_SOURCES = \
+ bonobodock.c \
+ bonobodockitem.c \
+ gnomeabout.c \
+ gnomeapp.c \
+ gnomeappbar.c \
+ gnomecanvas.c \
+ gnomecolorpicker.c \
+ gnomecontrol.c \
+ gnomedateedit.c \
+ gnomedialog.c \
+ gnomedruid.c \
+ gnomedruidpageedge.c \
+ gnomedruidpagestandard.c \
+ gnomeentry.c \
+ gnomefileentry.c \
+ gnomefontpicker.c \
+ gnomehref.c \
+ gnomeiconentry.c \
+ gnomeiconlist.c \
+ gnomeiconselection.c \
+ gnomemessagebox.c \
+ gnomepixmap.c \
+ gnomepixmapentry.c \
+ gnomepropertybox.c
diff --git a/tools/glade/glade/gnome/bonobodock.c b/tools/glade/glade/gnome/bonobodock.c
new file mode 100644
index 00000000..24a2db34
--- /dev/null
+++ b/tools/glade/glade/gnome/bonobodock.c
@@ -0,0 +1,510 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+#include "../glade_gnome.h"
+#include "../tree.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/bonobo-dock.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *AllowFloating = "BonoboDock::allow_floating";
+
+
+static void gb_bonobo_dock_add_band_on_left (GtkWidget * menuitem,
+ GtkWidget * dock);
+static void gb_bonobo_dock_add_band_on_right (GtkWidget * menuitem,
+ GtkWidget * dock);
+static void gb_bonobo_dock_add_band_on_top (GtkWidget * menuitem,
+ GtkWidget * dock);
+static void gb_bonobo_dock_add_band_on_bottom (GtkWidget * menuitem,
+ GtkWidget * dock);
+static void gb_bonobo_dock_add_band_floating (GtkWidget * menuitem,
+ GtkWidget * dock);
+static void gb_bonobo_dock_add_band (GtkWidget * dock,
+ BonoboDockPlacement placement);
+
+static void gb_bonobo_dock_init_widget (GtkWidget *widget);
+static void gb_bonobo_dock_size_request (GtkWidget *widget,
+ GtkRequisition *requisition,
+ gpointer user_data);
+static void gb_bonobo_dock_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer user_data);
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the funtion in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class BonoboDock, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_bonobo_dock_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = bonobo_dock_new ();
+
+ /* FIXME: GnomeLibs 1.0.1 bug workaround to resize floating items. */
+ gb_bonobo_dock_init_widget (new_widget);
+
+ return new_widget;
+}
+
+
+/* FIXME: GnomeLibs 1.0.1 bug workaround to resize floating items. */
+static void
+gb_bonobo_dock_create_from_widget (GtkWidget *widget,
+ GbWidgetCreateFromData *data)
+{
+ gb_bonobo_dock_init_widget (widget);
+}
+
+
+/* FIXME: GnomeLibs 1.0.1 bug workaround to resize floating items. */
+static void
+gb_bonobo_dock_init_widget (GtkWidget *widget)
+{
+ gtk_signal_connect_after (GTK_OBJECT (widget), "size_request",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_size_request),
+ NULL);
+ gtk_signal_connect_after (GTK_OBJECT (widget), "size_allocate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_size_allocate),
+ NULL);
+}
+
+
+/* FIXME: GnomeLibs 1.0.1 bug workaround to resize floating items.
+ Calls gtk_widget_size_request() for all floating items, just so that they
+ calculate their requisition. */
+static void
+gb_bonobo_dock_size_request (GtkWidget *widget, GtkRequisition *requisition,
+ gpointer user_data)
+{
+ GList *lp;
+ GtkWidget *w;
+ GtkRequisition float_item_requisition;
+
+ lp = BONOBO_DOCK (widget)->floating_children;
+ while (lp != NULL)
+ {
+ w = lp->data;
+ lp = lp->next;
+ gtk_widget_size_request (w, &float_item_requisition);
+ }
+}
+
+
+/* FIXME: GnomeLibs 1.0.1 bug workaround to resize floating items.
+ Calls gtk_widget_size_allocate() for all floating items, allocating
+ whatever the item wants in its requisition. */
+static void
+gb_bonobo_dock_size_allocate (GtkWidget *widget, GtkAllocation *allocation,
+ gpointer user_data)
+{
+ GList *lp;
+ GtkWidget *w;
+ GtkAllocation float_item_allocation;
+
+ lp = BONOBO_DOCK (widget)->floating_children;
+ while (lp != NULL)
+ {
+ w = lp->data;
+ lp = lp->next;
+
+ float_item_allocation.x = 0;
+ float_item_allocation.y = 0;
+ float_item_allocation.width = w->requisition.width;
+ float_item_allocation.height = w->requisition.height;
+ gtk_widget_size_allocate (w, &float_item_allocation);
+ }
+}
+
+
+void
+gb_bonobo_dock_add_child (GtkWidget *widget, GtkWidget * child,
+ GbWidgetSetArgData *data)
+{
+ gchar *orientation_string, *placement_string;
+ BonoboDockPlacement placement;
+ GtkOrientation orientation;
+ gint band_num, position, offset, placement_index, orientation_index;
+
+ if (BONOBO_IS_DOCK_ITEM (child))
+ {
+ data->loading_type = GB_CHILD_PROPERTIES;
+
+ placement_string = load_choice (data, "placement");
+ placement = BONOBO_DOCK_TOP;
+ if (placement_string && placement_string[0])
+ {
+ placement_index = glade_util_string_array_index (GladePlacementSymbols,
+ GladePlacementSize,
+ placement_string);
+ if (placement_index != -1)
+ placement = GladePlacementValues[placement_index];
+ }
+
+ if (placement == BONOBO_DOCK_FLOATING)
+ {
+ orientation_string = load_choice (data, "orientation");
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+ if (orientation_string && orientation_string[0])
+ {
+ orientation_index = glade_util_string_array_index (GladeOrientationSymbols, GladeOrientationSize, orientation_string);
+ if (orientation_index != -1)
+ orientation = GladeOrientationValues[orientation_index];
+ }
+
+ /* FIXME: Where fo we put the floating item? Use 300,300 for now. */
+ bonobo_dock_add_floating_item (BONOBO_DOCK (widget),
+ BONOBO_DOCK_ITEM (child),
+ 300, 300, orientation);
+ }
+ else
+ {
+ gboolean new_band = FALSE;
+
+ band_num = load_int (data, "band");
+ position = load_int (data, "position");
+ offset = load_int (data, "offset");
+
+ /* When loading, we don't want to create a new band explicitly,
+ but when pasting we do (though I'm not sure yet). */
+ if (data->xml_buffer)
+ new_band = TRUE;
+
+ bonobo_dock_add_item (BONOBO_DOCK (widget), BONOBO_DOCK_ITEM (child),
+ placement, band_num, position, offset,
+ new_band /* FIXME: what should this be. */);
+ }
+
+ data->loading_type = GB_STANDARD_PROPERTIES;
+ }
+ else
+ {
+ bonobo_dock_set_client_area (BONOBO_DOCK (widget), child);
+ }
+
+ /* Floating dock items must be shown after adding to the dock, or they do
+ not appear (GnomeLibs 1.0.1). */
+ gtk_widget_show (child);
+}
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_bonobo_dock_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_bool (AllowFloating, _("Allow Floating:"),
+ _("If floating dock items are allowed"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_bonobo_dock_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_widget_output_bool (data, AllowFloating,
+ BONOBO_DOCK (widget)->floating_items_allowed);
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_bonobo_dock_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gboolean allow_floating;
+
+ allow_floating = gb_widget_input_bool (data, AllowFloating);
+ if (data->apply)
+ {
+ bonobo_dock_allow_floating_items (BONOBO_DOCK (widget), allow_floating);
+ }
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a BonoboDock, with signals pointing to
+ * other functions in this file.
+ */
+static void
+gb_bonobo_dock_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+ GtkWidget *menuitem;
+
+ menuitem = gtk_menu_item_new_with_label (_("Add dock band on top"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_add_band_on_top),
+ widget);
+
+ menuitem = gtk_menu_item_new_with_label (_("Add dock band on bottom"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_add_band_on_bottom),
+ widget);
+
+ menuitem = gtk_menu_item_new_with_label (_("Add dock band on left"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_add_band_on_left),
+ widget);
+
+ menuitem = gtk_menu_item_new_with_label (_("Add dock band on right"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_add_band_on_right),
+ widget);
+
+ menuitem = gtk_menu_item_new_with_label (_("Add floating dock item"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_add_band_floating),
+ widget);
+}
+
+static void
+gb_bonobo_dock_add_band_on_left (GtkWidget * menuitem, GtkWidget * dock)
+{
+ gb_bonobo_dock_add_band (dock, BONOBO_DOCK_LEFT);
+}
+
+static void
+gb_bonobo_dock_add_band_on_right (GtkWidget * menuitem, GtkWidget * dock)
+{
+ gb_bonobo_dock_add_band (dock, BONOBO_DOCK_RIGHT);
+}
+
+static void
+gb_bonobo_dock_add_band_on_top (GtkWidget * menuitem, GtkWidget * dock)
+{
+ gb_bonobo_dock_add_band (dock, BONOBO_DOCK_TOP);
+}
+
+static void
+gb_bonobo_dock_add_band_on_bottom (GtkWidget * menuitem, GtkWidget * dock)
+{
+ gb_bonobo_dock_add_band (dock, BONOBO_DOCK_BOTTOM);
+}
+
+static void
+gb_bonobo_dock_add_band_floating (GtkWidget * menuitem, GtkWidget * dock)
+{
+ gb_bonobo_dock_add_band (dock, BONOBO_DOCK_FLOATING);
+}
+
+static void
+gb_bonobo_dock_add_band (GtkWidget * dock, BonoboDockPlacement placement)
+{
+ GtkWidget *dock_item, *placeholder;
+ gint x, y;
+
+ dock_item = gb_widget_new ("BonoboDockItem", NULL);
+
+ placeholder = editor_new_placeholder ();
+ gtk_container_add (GTK_CONTAINER (dock_item), placeholder);
+
+ if (placement == BONOBO_DOCK_FLOATING)
+ {
+ gdk_window_get_pointer (NULL, &x, &y, NULL);
+ /* Place the floating item slightly to the left and above the pointer,
+ but make sure it is on the screen. */
+ x = MAX (0, x - 50);
+ y = MAX (0, y - 50);
+ bonobo_dock_add_floating_item (BONOBO_DOCK (dock),
+ BONOBO_DOCK_ITEM (dock_item),
+ x, y, GTK_ORIENTATION_HORIZONTAL);
+ }
+ else
+ {
+ bonobo_dock_add_item (BONOBO_DOCK (dock), BONOBO_DOCK_ITEM (dock_item),
+ placement, -1, 0, 0, TRUE);
+ }
+
+ /* Floating dock items must be shown after adding to the dock, or they do
+ not appear (GnomeLibs 1.0.1). */
+ gtk_widget_show (dock_item);
+
+ /* Show the properties of the new dock item. */
+ gb_widget_show_properties (dock_item);
+
+ tree_add_widget (dock_item);
+}
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_bonobo_dock_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ /* If our parent is a GnomeApp we don't create the BonoboDock here. */
+ if (widget->parent && GTK_IS_VBOX (widget->parent)
+ && widget->parent->parent && GNOME_IS_APP (widget->parent->parent))
+ {
+ data->create_widget = FALSE;
+ source_add (data, " %s = GNOME_APP (%s)->dock;\n",
+ data->wname, data->component_name);
+ }
+
+ if (data->create_widget)
+ {
+ source_add (data, " %s = bonobo_dock_new ();\n", data->wname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ if (!BONOBO_DOCK (widget)->floating_items_allowed)
+ {
+ source_add (data,
+ " bonobo_dock_allow_floating_items (BONOBO_DOCK (%s), FALSE);\n",
+ data->wname);
+ }
+
+ /* Set the initial positions for any floating dock items. */
+ gtk_object_set_data (GTK_OBJECT (widget), "glade-dock-item-x",
+ GINT_TO_POINTER (100));
+ gtk_object_set_data (GTK_OBJECT (widget), "glade-dock-item-y",
+ GINT_TO_POINTER (100));
+}
+
+
+/* Outputs source to add a child menu to a BonoboDock. */
+static void
+gb_bonobo_dock_write_add_child_source (GtkWidget * parent,
+ const gchar *parent_name,
+ GtkWidget *child,
+ GbWidgetWriteSourceData * data)
+{
+ if (BONOBO_IS_DOCK_ITEM (child))
+ {
+ gchar *orientation;
+ gint x, y;
+
+ /* FIXME: We should support adding normal dock items eventually. */
+ if (!glade_gnome_is_app_dock_item (child))
+ g_warning ("Can't add normal dock items to a BonoboDock: %s",
+ data->wname);
+
+ if (!BONOBO_DOCK_ITEM (child)->is_floating)
+ g_warning ("Can't add non-floating dock items to a BonoboDock: %s",
+ data->wname);
+
+ if (BONOBO_DOCK_ITEM (child)->orientation == GTK_ORIENTATION_HORIZONTAL)
+ orientation = "GTK_ORIENTATION_HORIZONTAL";
+ else
+ orientation = "GTK_ORIENTATION_VERTICAL";
+
+ /* We add the floating item to the layout. I think that is OK.
+ FIXME: Ideally we don't want the position of the floating item to
+ be set explicitly, so the user has to position in. But I don't know
+ if that can be done. So what should we do? */
+
+ x = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (parent),
+ "glade-dock-item-x"));
+ y = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (parent),
+ "glade-dock-item-y"));
+
+ source_add (data,
+ " bonobo_dock_layout_add_floating_item (BONOBO_DOCK_LAYOUT (GNOME_APP (%s)->layout),\n"
+ " BONOBO_DOCK_ITEM (%s), %i, %i,\n"
+ " %s);\n",
+ data->component_name, data->wname, x, y, orientation);
+
+ gtk_object_set_data (GTK_OBJECT (parent), "glade-dock-item-x",
+ GINT_TO_POINTER (x + 50));
+ gtk_object_set_data (GTK_OBJECT (parent), "glade-dock-item-y",
+ GINT_TO_POINTER (y + 50));
+ }
+ else
+ {
+ source_add (data,
+ " gnome_app_set_contents (GNOME_APP (%s), %s);\n",
+ data->component_name, data->wname);
+ }
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_bonobo_dock_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = bonobo_dock_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = bonobo_dock_xpm;
+ gbwidget.tooltip = _("Gnome Dock");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_bonobo_dock_new;
+ gbwidget.gb_widget_create_from_widget = gb_bonobo_dock_create_from_widget;
+ gbwidget.gb_widget_add_child = gb_bonobo_dock_add_child;
+ gbwidget.gb_widget_create_properties = gb_bonobo_dock_create_properties;
+ gbwidget.gb_widget_get_properties = gb_bonobo_dock_get_properties;
+ gbwidget.gb_widget_set_properties = gb_bonobo_dock_set_properties;
+ gbwidget.gb_widget_create_popup_menu = gb_bonobo_dock_create_popup_menu;
+ gbwidget.gb_widget_write_source = gb_bonobo_dock_write_source;
+ gbwidget.gb_widget_write_add_child_source = gb_bonobo_dock_write_add_child_source;
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/bonobodockitem.c b/tools/glade/glade/gnome/bonobodockitem.c
new file mode 100644
index 00000000..8c871210
--- /dev/null
+++ b/tools/glade/glade/gnome/bonobodockitem.c
@@ -0,0 +1,786 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include <bonobo.h>
+#include "../gb.h"
+#include "../glade_gnome.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/bonobo-dock-item.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *ShadowType = "BonoboDockItem::shadow_type";
+static gchar *Orientation = "BonoboDockItem::orientation";
+
+/* These 5 are boolean flags in the property editor, but saved as one property,
+ "behavior" in the XML. */
+static gchar *Locked = "BonoboDockItem::locked";
+static gchar *Exclusive = "BonoboDockItem::exclusive";
+static gchar *NeverFloating = "BonoboDockItem::never_floating";
+static gchar *NeverVertical = "BonoboDockItem::never_vertical";
+static gchar *NeverHorizontal = "BonoboDockItem::never_horizontal";
+
+/* These are only used for loading & saving - they are not displayed in the
+ property editor. */
+static gchar *Placement = "BonoboDockItem::placement";
+static gchar *BandNum = "BonoboDockItem::band";
+static gchar *Position = "BonoboDockItem::position";
+static gchar *Offset = "BonoboDockItem::offset";
+static gchar *Behavior = "BonoboDockItem::behavior";
+
+static const gchar *GbShadowChoices[] =
+{"None", "In", "Out",
+ "Etched In", "Etched Out", NULL};
+static const gint GbShadowValues[] =
+{
+ GTK_SHADOW_NONE,
+ GTK_SHADOW_IN,
+ GTK_SHADOW_OUT,
+ GTK_SHADOW_ETCHED_IN,
+ GTK_SHADOW_ETCHED_OUT
+};
+static const gchar *GbShadowSymbols[] =
+{
+ "GTK_SHADOW_NONE",
+ "GTK_SHADOW_IN",
+ "GTK_SHADOW_OUT",
+ "GTK_SHADOW_ETCHED_IN",
+ "GTK_SHADOW_ETCHED_OUT"
+};
+
+
+static void gb_bonobo_dock_item_init_widget (GtkWidget *widget);
+static void gb_bonobo_dock_item_drag_end (GtkWidget *widget,
+ gpointer user_data);
+
+static void gb_bonobo_dock_item_add_item_before (GtkWidget * menuitem,
+ BonoboDockItem * dock_item);
+static void gb_bonobo_dock_item_add_item_after (GtkWidget * menuitem,
+ BonoboDockItem * dock_item);
+static void gb_bonobo_dock_item_add_item (BonoboDockItem * existing_dock_item,
+ gboolean after);
+static gboolean gb_bonobo_dock_item_find_position (BonoboDockItem * dock_item,
+ BonoboDockPlacement *placement,
+ gint *band_num,
+ gint *position,
+ gint *offset);
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the funtion in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class BonoboDockItem, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_bonobo_dock_item_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = bonobo_dock_item_new (NULL, BONOBO_DOCK_ITEM_BEH_NORMAL);
+
+ gb_bonobo_dock_item_init_widget (new_widget);
+
+ return new_widget;
+}
+
+
+static void
+gb_bonobo_dock_item_create_from_widget (GtkWidget *widget,
+ GbWidgetCreateFromData *data)
+{
+ gb_bonobo_dock_item_init_widget (widget);
+}
+
+
+static void
+gb_bonobo_dock_item_init_widget (GtkWidget *widget)
+{
+ /* Connect a handler so we can update the properties if the item is moved. */
+ gtk_signal_connect_after (GTK_OBJECT (widget), "dock_drag_end",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_item_drag_end),
+ NULL);
+}
+
+
+/* If the widgets properties are currently shown, we update them if necessary.
+ */
+static void
+gb_bonobo_dock_item_drag_end (GtkWidget *widget, gpointer user_data)
+{
+ if (property_get_widget () == widget)
+ {
+ /* The orientation is only useful for floating items. */
+ property_set_sensitive (Orientation,
+ BONOBO_DOCK_ITEM (widget)->is_floating);
+ }
+}
+
+
+void
+gb_bonobo_dock_item_add_child (GtkWidget *widget, GtkWidget * child,
+ GbWidgetSetArgData *data)
+{
+ /* Try to set up menubars and toolbars just like GnomeApp does.
+ We don't do anything now. I'm not sure what we should do. */
+
+ gtk_container_add (GTK_CONTAINER (widget), child);
+}
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_bonobo_dock_item_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_bool (Locked, _("Locked:"),
+ _("If the dock item is locked in position"));
+ property_add_bool (Exclusive, _("Exclusive:"),
+ _("If the dock item is always the only item in its band"));
+ property_add_bool (NeverFloating, _("Never Floating:"),
+ _("If the dock item is never allowed to float in its own window"));
+ property_add_bool (NeverVertical, _("Never Vertical:"),
+ _("If the dock item is never allowed to be vertical"));
+ property_add_bool (NeverHorizontal, _("Never Horizontal:"),
+ _("If the dock item is never allowed to be horizontal"));
+
+ property_add_choice (ShadowType, _("Shadow:"),
+ _("The type of shadow around the dock item"),
+ GbShadowChoices);
+ property_add_choice (Orientation, _("Orientation:"),
+ _("The orientation of a floating dock item"),
+ GladeOrientationChoices);
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_bonobo_dock_item_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gint i;
+
+ if (BONOBO_DOCK_ITEM (widget)->is_floating)
+ {
+ /* Orientation is only relevant when floating. */
+ for (i = 0; i < GladeOrientationSize; i++)
+ {
+ if (GladeOrientationValues[i] == BONOBO_DOCK_ITEM (widget)->orientation)
+ {
+ gb_widget_output_choice (data, Orientation, i,
+ GladeOrientationSymbols[i]);
+ }
+ }
+ }
+
+ if (data->action == GB_SHOWING)
+ {
+ gb_widget_output_bool (data, Locked, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_LOCKED);
+ gb_widget_output_bool (data, Exclusive, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_EXCLUSIVE);
+ gb_widget_output_bool (data, NeverFloating, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING);
+ gb_widget_output_bool (data, NeverVertical, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL);
+ gb_widget_output_bool (data, NeverHorizontal, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL);
+ }
+
+ for (i = 0; i < sizeof (GbShadowValues) / sizeof (GbShadowValues[0]); i++)
+ {
+ if (GbShadowValues[i] == BONOBO_DOCK_ITEM (widget)->shadow_type)
+ gb_widget_output_choice (data, ShadowType, i, GbShadowSymbols[i]);
+ }
+
+ if (data->action == GB_SHOWING)
+ {
+ /* The orientation is only useful for floating items. */
+ property_set_sensitive (Orientation,
+ BONOBO_DOCK_ITEM (widget)->is_floating);
+ }
+}
+
+
+/* SPECIAL CODE: "placement", "band", "position", "offset" and "behavior"
+ are now packing properties, so we have this special function to save
+ them, which is called directly in gb_widget_save(). */
+void
+gb_bonobo_dock_item_save_packing_properties (GtkWidget *parent,
+ GtkWidget *widget,
+ GbWidgetGetArgData * data)
+{
+ char *behavior;
+
+ save_start_tag (data, "packing");
+
+ if (BONOBO_DOCK_ITEM (widget)->is_floating)
+ {
+ gb_widget_output_string (data, Placement, "BONOBO_DOCK_FLOATING");
+ }
+ else
+ {
+ BonoboDockPlacement placement;
+ gint band_num, position, offset, idx;
+
+ if (gb_bonobo_dock_item_find_position (BONOBO_DOCK_ITEM (widget),
+ &placement, &band_num,
+ &position, &offset))
+ {
+ idx = glade_util_int_array_index (GladePlacementValues,
+ GladePlacementSize,
+ placement);
+ if (idx != -1)
+ gb_widget_output_string (data, Placement,
+ GladePlacementSymbols[idx]);
+
+ gb_widget_output_int (data, BandNum, band_num);
+ gb_widget_output_int (data, Position, position);
+ gb_widget_output_int (data, Offset, offset);
+ }
+ else
+ {
+ g_warning ("Dock band not found");
+ }
+ }
+
+ behavior = glade_util_string_from_flags (BONOBO_TYPE_DOCK_ITEM_BEHAVIOR,
+ BONOBO_DOCK_ITEM (widget)->behavior);
+ save_string (data, Behavior, behavior);
+ g_free (behavior);
+
+ save_end_tag (data, "packing");
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_bonobo_dock_item_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gboolean locked, exclusive, never_floating, never_vertical, never_horizontal;
+ gchar *shadow, *orientation;
+ BonoboDockItemBehavior behavior;
+ gint i;
+
+ /* This is a bit of a hack, as some of the properties are now saved as
+ packing properties instead of normal properties. */
+ if (data->action == GB_LOADING)
+ {
+ gchar *behavior_string;
+
+ data->loading_type = GB_CHILD_PROPERTIES;
+
+ behavior_string = load_string (data, Behavior);
+ behavior = glade_util_flags_from_string (BONOBO_TYPE_DOCK_ITEM_BEHAVIOR,
+ behavior_string);
+
+ data->loading_type = GB_STANDARD_PROPERTIES;
+ }
+ else
+ {
+ behavior = BONOBO_DOCK_ITEM (widget)->behavior;
+
+ locked = gb_widget_input_bool (data, Locked);
+ if (data->apply)
+ {
+ if (locked)
+ behavior |= BONOBO_DOCK_ITEM_BEH_LOCKED;
+ else
+ behavior &= ~BONOBO_DOCK_ITEM_BEH_LOCKED;
+
+ /* This avoids any problems with redrawing the selection. */
+ if (data->action == GB_APPLYING)
+ editor_clear_selection (NULL);
+
+ gtk_widget_queue_resize (widget);
+ }
+
+ exclusive = gb_widget_input_bool (data, Exclusive);
+ if (data->apply)
+ {
+ if (exclusive)
+ behavior |= BONOBO_DOCK_ITEM_BEH_EXCLUSIVE;
+ else
+ behavior &= ~BONOBO_DOCK_ITEM_BEH_EXCLUSIVE;
+ }
+
+ never_floating = gb_widget_input_bool (data, NeverFloating);
+ if (data->apply)
+ {
+ if (never_floating)
+ behavior |= BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING;
+ else
+ behavior &= ~BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING;
+ }
+
+ never_vertical = gb_widget_input_bool (data, NeverVertical);
+ if (data->apply)
+ {
+ if (never_vertical)
+ behavior |= BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL;
+ else
+ behavior &= ~BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL;
+ }
+
+ never_horizontal = gb_widget_input_bool (data, NeverHorizontal);
+ if (data->apply)
+ {
+ if (never_horizontal)
+ behavior |= BONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL;
+ else
+ behavior &= ~BONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL;
+ }
+ }
+
+ /* BonoboDockItem has no method for setting the behavior. */
+ BONOBO_DOCK_ITEM (widget)->behavior = behavior;
+
+
+ shadow = gb_widget_input_choice (data, ShadowType);
+ if (data->apply)
+ {
+ for (i = 0; i < sizeof (GbShadowValues) / sizeof (GbShadowValues[0]);
+ i++)
+ {
+ if (!strcmp (shadow, GbShadowChoices[i])
+ || !strcmp (shadow, GbShadowSymbols[i]))
+ {
+ bonobo_dock_item_set_shadow_type (BONOBO_DOCK_ITEM (widget),
+ GbShadowValues[i]);
+ break;
+ }
+ }
+ }
+
+ orientation = gb_widget_input_choice (data, Orientation);
+ if (data->apply)
+ {
+ for (i = 0; i < GladeOrientationSize; i++)
+ {
+ if (!strcmp (orientation, GladeOrientationChoices[i])
+ || !strcmp (orientation, GladeOrientationSymbols[i]))
+ {
+ bonobo_dock_item_set_orientation (BONOBO_DOCK_ITEM (widget),
+ GladeOrientationValues[i]);
+
+ /* This avoids any problems with redrawing the selection. */
+ if (data->action == GB_APPLYING)
+ editor_clear_selection (NULL);
+
+ /* FIXME: A test to see if changing orientation works. */
+ if (BONOBO_DOCK_ITEM (widget)->bin.child)
+ gtk_widget_queue_resize (BONOBO_DOCK_ITEM (widget)->bin.child);
+
+ break;
+ }
+ }
+ }
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a BonoboDockItem, with signals pointing to
+ * other functions in this file.
+ */
+static void
+gb_bonobo_dock_item_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+ GtkWidget *menuitem;
+
+ /* We can't add items next to floating items or items that have the
+ BONOBO_DOCK_ITEM_BEH_EXCLUSIVE flag set. */
+ if (!BONOBO_DOCK_ITEM (widget)->is_floating
+ && !(BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_EXCLUSIVE))
+ {
+ menuitem = gtk_menu_item_new_with_label (_("Add dock item before"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_item_add_item_before),
+ widget);
+
+ menuitem = gtk_menu_item_new_with_label (_("Add dock item after"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_bonobo_dock_item_add_item_after),
+ widget);
+ }
+}
+
+
+static void
+gb_bonobo_dock_item_add_item_before (GtkWidget * menuitem,
+ BonoboDockItem * dock_item)
+{
+ gb_bonobo_dock_item_add_item (dock_item, FALSE);
+}
+
+
+static void
+gb_bonobo_dock_item_add_item_after (GtkWidget * menuitem,
+ BonoboDockItem * dock_item)
+{
+ gb_bonobo_dock_item_add_item (dock_item, TRUE);
+}
+
+
+static void
+gb_bonobo_dock_item_add_item (BonoboDockItem * existing_dock_item,
+ gboolean after)
+{
+ BonoboDock *dock;
+ BonoboDockBand *dock_band;
+ GtkWidget *dock_item, *placeholder;
+ BonoboDockPlacement placement;
+ gint band_num, position, offset;
+
+ if (!gb_bonobo_dock_item_find_position (BONOBO_DOCK_ITEM (existing_dock_item),
+ &placement, &band_num,
+ &position, &offset))
+ {
+ g_warning ("Dock band not found");
+ return;
+ }
+
+ dock_band = BONOBO_DOCK_BAND (GTK_WIDGET (existing_dock_item)->parent);
+ dock = BONOBO_DOCK (GTK_WIDGET (dock_band)->parent);
+
+ /* Create the new dock item. */
+ dock_item = gb_widget_new ("BonoboDockItem", NULL);
+
+ placeholder = editor_new_placeholder ();
+ gtk_container_add (GTK_CONTAINER (dock_item), placeholder);
+
+ /* Now add it at the required position. */
+ if (after)
+ position++;
+ bonobo_dock_add_item (dock, BONOBO_DOCK_ITEM (dock_item), placement, band_num,
+ position, 0, FALSE);
+
+ gtk_widget_show (dock_item);
+
+ /* Show the properties of the new dock item. */
+ gb_widget_show_properties (dock_item);
+}
+
+
+/* This gets the placement, band number, position and offset of dock items
+ which are not floating. It returns TRUE if the dock item is found. */
+static gboolean
+gb_bonobo_dock_item_find_position (BonoboDockItem * dock_item,
+ BonoboDockPlacement *placement,
+ gint *band_num,
+ gint *position,
+ gint *offset)
+{
+ BonoboDock *dock;
+ BonoboDockBand *dock_band;
+ BonoboDockBandChild *dock_band_child;
+ gint pos;
+ GList *elem;
+
+ g_return_val_if_fail (BONOBO_IS_DOCK_BAND (GTK_WIDGET (dock_item)->parent),
+ FALSE);
+ dock_band = BONOBO_DOCK_BAND (GTK_WIDGET (dock_item)->parent);
+
+ g_return_val_if_fail (BONOBO_IS_DOCK (GTK_WIDGET (dock_band)->parent), FALSE);
+ dock = BONOBO_DOCK (GTK_WIDGET (dock_band)->parent);
+
+ /* First we find out which band the existing dock item is. */
+ if ((*band_num = g_list_index (dock->top_bands, dock_band)) != -1)
+ *placement = BONOBO_DOCK_TOP;
+ else if ((*band_num = g_list_index (dock->bottom_bands, dock_band)) != -1)
+ *placement = BONOBO_DOCK_BOTTOM;
+ else if ((*band_num = g_list_index (dock->left_bands, dock_band)) != -1)
+ *placement = BONOBO_DOCK_LEFT;
+ else if ((*band_num = g_list_index (dock->right_bands, dock_band)) != -1)
+ *placement = BONOBO_DOCK_RIGHT;
+ else
+ return FALSE;
+
+ /* Now find the position of the existing dock item within the band. */
+ for (elem = dock_band->children, pos = 0;
+ elem != NULL;
+ elem = elem->next, pos++)
+ {
+ dock_band_child = (BonoboDockBandChild*) elem->data;
+ if (dock_band_child->widget == GTK_WIDGET (dock_item))
+ {
+ *position = pos;
+ *offset = dock_band_child->offset;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_bonobo_dock_item_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ /* If we are in a GnomeApp's dock, we don't create the dock item here, or
+ add it to the BonoboDock, since it is created automatically when the item
+ is added to the GnomeApp. */
+ if (glade_gnome_is_app_dock_item (widget)
+ && !BONOBO_DOCK_ITEM (widget)->is_floating)
+ {
+ return;
+ }
+
+ if (data->create_widget)
+ {
+ BonoboDockItemBehavior behavior;
+ const gchar *prefix = "\n ";
+ const gchar *prefix2 = "\n | ";
+
+ behavior = BONOBO_DOCK_ITEM (widget)->behavior;
+
+ source_add (data,
+ " %s = bonobo_dock_item_new (%s,",
+ data->wname, source_make_string (data->real_wname, FALSE));
+ if (behavior == 0)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NORMAL);\n", prefix);
+ }
+ else
+ {
+ if (behavior & BONOBO_DOCK_ITEM_BEH_EXCLUSIVE)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_EXCLUSIVE",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NEVER_FLOATING",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_LOCKED)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_LOCKED",
+ prefix);
+ }
+
+ source_add (data, ");\n");
+ }
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+}
+
+
+/* Outputs source to add a child menu to a BonoboDock. */
+static void
+gb_bonobo_dock_item_write_add_child_source (GtkWidget * parent,
+ const gchar *parent_name,
+ GtkWidget *child,
+ GbWidgetWriteSourceData * data)
+{
+ GnomeApp *app;
+
+ /* If we're adding a dock item to a GnomeApp's dock, we use
+ the special functions to add it here. */
+ if ((app = glade_gnome_is_app_dock_item (parent)))
+ {
+ /* Children of floating items are added as normal. */
+ if (BONOBO_DOCK_ITEM (parent)->is_floating)
+ {
+ source_add (data, " gtk_container_add (GTK_CONTAINER (%s), %s);\n",
+ parent_name, data->wname);
+ }
+ else if (GTK_IS_MENU_BAR (child))
+ {
+ source_add (data,
+ " gnome_app_create_menus (GNOME_APP (%s), %s_uiinfo);\n",
+ data->component_name, data->real_wname);
+
+ /* Output the code to install the menu hints, if the GnomeApp has
+ a status bar. This must be output after the code to create the
+ GnomeAppBar is output, so we add it to the same buffer as the
+ signal connections. */
+ if (app->statusbar)
+ {
+ source_add_to_buffer (data, GLADE_SIGNAL_CONNECTIONS,
+ " gnome_app_install_menu_hints (GNOME_APP (%s), %s_uiinfo);\n",
+ data->component_name, data->real_wname);
+ }
+ }
+ else
+ {
+ BonoboDockPlacement placement;
+ BonoboDockItemBehavior behavior;
+ const gchar *placement_string;
+ gint idx, band_num, position, offset;
+ gchar *prefix, *prefix2;
+
+ if (gb_bonobo_dock_item_find_position (BONOBO_DOCK_ITEM (parent),
+ &placement, &band_num,
+ &position, &offset))
+ {
+ idx = glade_util_int_array_index (GladePlacementValues,
+ GladePlacementSize,
+ placement);
+ if (idx == -1)
+ {
+ g_warning ("BonoboDock placement not found");
+ placement = 0;
+ }
+ placement_string = GladePlacementSymbols[idx];
+
+ if (GTK_IS_TOOLBAR (child))
+ {
+ source_add (data,
+ " gnome_app_add_toolbar (GNOME_APP (%s), GTK_TOOLBAR (%s), %s,\n",
+ data->component_name, data->wname,
+ source_make_string (data->wname, FALSE));
+ }
+ else
+ {
+ source_add (data,
+ " gnome_app_add_docked (GNOME_APP (%s), %s, %s,\n",
+ data->component_name, data->wname,
+ source_make_string (data->wname, FALSE));
+ }
+
+ source_add (data, " ");
+ behavior = BONOBO_DOCK_ITEM (parent)->behavior;
+ prefix = "";
+ prefix2 = "\n | ";
+ if (behavior == BONOBO_DOCK_ITEM_BEH_NORMAL)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NORMAL", prefix);
+ }
+ else
+ {
+ if (behavior & BONOBO_DOCK_ITEM_BEH_EXCLUSIVE)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_EXCLUSIVE",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NEVER_FLOATING",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL",
+ prefix);
+ prefix = prefix2;
+ }
+ if (behavior & BONOBO_DOCK_ITEM_BEH_LOCKED)
+ {
+ source_add (data, "%sBONOBO_DOCK_ITEM_BEH_LOCKED",
+ prefix);
+ prefix = prefix2;
+ }
+ }
+
+ source_add (data,
+ ",\n"
+ " %s, %i, %i, %i);\n",
+ placement_string, band_num, position, offset);
+ }
+ }
+ }
+ else
+ {
+ g_warning ("Skipping adding dock item to parent - unimplemented.");
+ }
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_bonobo_dock_item_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = bonobo_dock_item_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = bonobo_dock_item_xpm;
+ gbwidget.tooltip = _("Gnome Dock Item");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_bonobo_dock_item_new;
+ gbwidget.gb_widget_create_from_widget = gb_bonobo_dock_item_create_from_widget;
+ gbwidget.gb_widget_add_child = gb_bonobo_dock_item_add_child;
+ gbwidget.gb_widget_create_popup_menu = gb_bonobo_dock_item_create_popup_menu;
+ gbwidget.gb_widget_create_properties = gb_bonobo_dock_item_create_properties;
+ gbwidget.gb_widget_get_properties = gb_bonobo_dock_item_get_properties;
+ gbwidget.gb_widget_set_properties = gb_bonobo_dock_item_set_properties;
+ gbwidget.gb_widget_write_source = gb_bonobo_dock_item_write_source;
+ gbwidget.gb_widget_write_add_child_source = gb_bonobo_dock_item_write_add_child_source;
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomeabout.c b/tools/glade/glade/gnome/gnomeabout.c
new file mode 100644
index 00000000..730f369e
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomeabout.c
@@ -0,0 +1,554 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-about.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Logo = "GnomeAbout::logo";
+static gchar *Copyright = "GnomeAbout::copyright";
+static gchar *Comments = "GnomeAbout::comments";
+
+static gchar *Authors = "GnomeAbout::authors";
+static gchar *Documenters = "GnomeAbout::documenters";
+static gchar *TranslatorCredits = "GnomeAbout::translator_credits";
+
+static gchar *IconName = "GnomeAbout|GtkWindow::icon_name";
+static gchar *FocusOnMap = "GnomeAbout|GtkWindow::focus_on_map";
+static gchar *DestroyWithParent = "GnomeAbout|GtkWindow::destroy_with_parent";
+static gchar *Icon = "GnomeAbout|GtkWindow::icon";
+
+static gchar *Role = "GnomeAbout|GtkWindow::role";
+static gchar *TypeHint = "GnomeAbout|GtkWindow::type_hint";
+static gchar *SkipTaskbar = "GnomeAbout|GtkWindow::skip_taskbar_hint";
+static gchar *SkipPager = "GnomeAbout|GtkWindow::skip_pager_hint";
+static gchar *Decorated = "GnomeAbout|GtkWindow::decorated";
+static gchar *Gravity = "GnomeAbout|GtkWindow::gravity";
+
+#define GLADE_TRANSLATORS_STRING "translator_credits"
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the funtion in the GbWidget struct at the end of this file.
+ ******/
+
+/* Pinched from gnome-about.c */
+#define GNOME_RESPONSE_CREDITS 1
+
+static void
+gb_gnome_about_response_cb (GtkDialog *dialog, gint response, gpointer data)
+{
+ /* We only let the response signal continue if it is going to show the
+ Credits sub-dialog. Otherwise we stop the signal. If the window close
+ button is pressed, our standard delete-event handler will hide the
+ dialog. But we must ensure the dialog isn't destroyed when it is closed.
+ */
+ if (response != GNOME_RESPONSE_CREDITS) {
+ g_signal_stop_emission_by_name (dialog, "response");
+ }
+}
+
+
+/*
+ * Creates a new GtkWidget of class GnomeAbout, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_about_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+ gchar *project_name;
+ const gchar *authors[] = { NULL };
+
+ project_name = glade_project_get_name (data->project);
+ new_widget = gnome_about_new (project_name ? project_name : "",
+ "x.x", NULL, NULL, authors, authors, NULL, NULL);
+
+ /* We want it to be treated as a normal window. */
+ gtk_window_set_type_hint (GTK_WINDOW (new_widget),
+ GDK_WINDOW_TYPE_HINT_NORMAL);
+
+ /* Make the About dialog modal by default. */
+ /* We can't do this in GNOME 2, as the Credits sub-dialog won't work. */
+ /*gtk_object_set_data (GTK_OBJECT (new_widget), Modal, "TRUE");*/
+
+ /* We connect a close signal handler which always returns TRUE so that
+ the built-in close functionality is skipped. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "response",
+ GTK_SIGNAL_FUNC (gb_gnome_about_response_cb), NULL);
+
+ /* Now we connect our normal delete_event handler. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
+ GTK_SIGNAL_FUNC (editor_close_window), NULL);
+
+ gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
+ GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));
+
+ /* Set the default comment string for the translator credits. */
+ glade_util_set_translation_properties (new_widget, TranslatorCredits,
+ TRUE, "TRANSLATORS: Replace this string with your names, one name per line.", FALSE);
+
+ return new_widget;
+}
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_about_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ gb_window_create_standard_properties (widget, data,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ IconName, FocusOnMap,
+ NULL, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, NULL);
+
+ property_add_filename (Logo, _("Logo:"), _("The pixmap to use as the logo"));
+ property_add_text (Copyright, _("Copyright:"), _("The copyright notice"), 2);
+ property_add_text (Comments, _("Comments:"), _("Additional information, such as a description of the package and its home page on the web"), 3);
+
+ property_add_text (Authors, _("Authors:"), _("The authors of the package, one on each line"), 2);
+ property_add_text (Documenters, _("Documenters:"), _("The documenters of the package, one on each line"), 2);
+ property_add_text (TranslatorCredits, _("Translators:"), _("The translators of the package. This should normally be left empty so that translators can add their names in the po files"), 2);
+}
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_about_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ char *translator_credits, *copyright, *comments, *translator_credits_output;
+
+ gb_window_get_standard_properties (widget, data,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ IconName, FocusOnMap,
+ NULL, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, NULL);
+
+ g_object_get (G_OBJECT (widget),
+ "copyright", &copyright,
+ "comments", &comments,
+ "translator-credits", &translator_credits,
+ NULL);
+
+ gb_widget_output_pixmap_filename (data, Logo,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ Logo));
+ gb_widget_output_translatable_text (data, Copyright, copyright);
+ gb_widget_output_translatable_text (data, Comments, comments);
+
+ gb_widget_output_text (data, Authors,
+ gtk_object_get_data (GTK_OBJECT (widget), Authors));
+ gb_widget_output_text (data, Documenters,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ Documenters));
+
+ /* If we are saving, and translator_credits isn't set but is translatable,
+ we save the string "translator_credits". Translators can then
+ replace this with their own names in the po files. */
+ translator_credits_output = translator_credits;
+ if (data->action == GB_SAVING
+ && (!translator_credits || *translator_credits == '\0'))
+ {
+ gchar *comments_text;
+ gboolean translatable, context;
+
+ glade_util_get_translation_properties (widget, TranslatorCredits,
+ &translatable,
+ &comments_text, &context);
+ if (translatable)
+ translator_credits_output = GLADE_TRANSLATORS_STRING;
+ }
+
+ gb_widget_output_translatable_text (data, TranslatorCredits,
+ translator_credits_output);
+
+ g_free (copyright);
+ g_free (comments);
+ g_free (translator_credits);
+}
+
+static GValueArray *
+carray_from_text (GbWidgetSetArgData *data, GtkWidget *widget, const char *key)
+{
+ GValueArray *array = NULL;
+ char *str;
+
+ str = gb_widget_input_text (data, key);
+ if (data->apply)
+ {
+ char **strv;
+ int i;
+
+ gtk_object_set_data_full (GTK_OBJECT (widget), key, g_strdup (str),
+ str ? g_free : NULL);
+
+ strv = g_strsplit (str, "\n", 0);
+ array = g_value_array_new (0);
+
+ for (i = 0; strv[i]; i++) {
+ GValue value = { 0 };
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, strv[i]);
+ array = g_value_array_append (array, &value);
+ }
+
+ g_strfreev (strv);
+ }
+ if (data->action == GB_APPLYING)
+ g_free (str);
+
+ return array;
+}
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_about_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ GValueArray *authors, *documenters;
+ gchar *copyright, *comments, *translators;
+ gchar *filename, *old_filename;
+ GdkPixbuf *logo = NULL;
+ GObject *object;
+ gboolean redraw = FALSE;
+
+ object = G_OBJECT (widget);
+
+ gb_window_set_standard_properties (widget, data,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ IconName, FocusOnMap,
+ NULL, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, NULL);
+
+ filename = gb_widget_input_pixmap_filename (data, Logo);
+ if (data->apply)
+ {
+ if (filename && filename[0] == '\0')
+ filename = NULL;
+
+ old_filename = gtk_object_get_data (GTK_OBJECT (widget), Logo);
+ glade_project_remove_pixmap (data->project, old_filename);
+ gtk_object_set_data_full (GTK_OBJECT (widget), Logo,
+ g_strdup (filename), filename ? g_free : NULL);
+ glade_project_add_pixmap (data->project, filename);
+ logo = filename ? gdk_pixbuf_new_from_file (filename, NULL) : NULL;
+ g_object_set (object, "logo", logo, NULL);
+ if (logo)
+ g_object_unref (logo);
+ }
+ if (data->action == GB_LOADING)
+ g_free (filename);
+
+ copyright = gb_widget_input_text (data, Copyright);
+ if (data->apply)
+ {
+ g_object_set (object, "copyright", copyright, NULL);
+ redraw = TRUE;
+ }
+ if (data->action == GB_APPLYING)
+ g_free (copyright);
+
+ comments = gb_widget_input_text (data, Comments);
+ if (data->apply)
+ {
+ g_object_set (object, "comments", comments, NULL);
+ redraw = TRUE;
+ }
+ if (data->action == GB_APPLYING)
+ g_free (comments);
+
+
+ translators = gb_widget_input_text (data, TranslatorCredits);
+ if (data->apply)
+ {
+ if (!strcmp (translators, GLADE_TRANSLATORS_STRING))
+ g_object_set (object, "translator-credits", "", NULL);
+ else
+ g_object_set (object, "translator-credits", translators, NULL);
+ }
+ if (data->action == GB_APPLYING)
+ g_free (translators);
+
+ authors = carray_from_text (data, widget, Authors);
+ if (data->apply)
+ g_object_set (object, "authors", authors, NULL);
+ if (authors)
+ g_value_array_free (authors);
+
+ documenters = carray_from_text (data, widget, Documenters);
+ if (data->apply)
+ g_object_set (object, "documenters", documenters, NULL);
+ if (documenters)
+ g_value_array_free (documenters);
+
+ /* If the window is resized the selection rectangles mess it up, so we
+ queue a redraw. */
+ if (redraw)
+ gtk_widget_queue_draw (widget);
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeAbout, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_about_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_about_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ if (data->create_widget)
+ {
+ gchar *project_name = glade_project_get_name (data->project);
+ char *copyright, *about_comments, *translators;
+ char *authors, **authorsv, *documenters, **documentersv;
+ gchar *logo_filename;
+ char *pixbuf_name = NULL;
+ gint i;
+ gboolean translatable, context;
+ gchar *comments;
+
+ g_object_get (G_OBJECT (widget),
+ "copyright", &copyright,
+ "comments", &about_comments,
+ "translator-credits", &translators,
+ NULL);
+
+ authors = gtk_object_get_data (GTK_OBJECT (widget), Authors);
+ documenters = gtk_object_get_data (GTK_OBJECT (widget), Documenters);
+
+ /* Output the array of authors. */
+ if (authors && *authors)
+ {
+ source_add_decl (data, " const gchar *authors[] = {\n");
+ authorsv = g_strsplit (authors, "\n", 0);
+ for (i = 0; authorsv[i]; i++)
+ {
+ if (authorsv[i][0])
+ source_add_decl (data, " %s,\n",
+ source_make_string (authorsv[i], FALSE));
+ }
+ source_add_decl (data, " NULL\n };\n");
+ g_strfreev (authorsv);
+ }
+ else
+ {
+ source_add_decl (data, " const gchar *authors[] = { NULL };\n");
+ }
+
+ /* Output the array of documenters. */
+ if (documenters && *documenters)
+ {
+ source_add_decl (data, " const gchar *documenters[] = {\n");
+ documentersv = g_strsplit (documenters, "\n", 0);
+ for (i = 0; documentersv[i]; i++)
+ {
+ if (documentersv[i][0])
+ source_add_decl (data, " %s,\n",
+ source_make_string (documentersv[i], FALSE));
+ }
+ source_add_decl (data, " NULL\n };\n");
+ g_strfreev (documentersv);
+ }
+ else
+ {
+ source_add_decl (data, " const gchar *documenters[] = { NULL };\n");
+ }
+
+ /* If translators is set, then we use that specific string.
+ If it is not set, then if gettext support is enabled we output code
+ to call gettext to translate the special "translator_credits" string,
+ and use that if it is translated. */
+ glade_util_get_translation_properties (widget, TranslatorCredits,
+ &translatable,
+ &comments, &context);
+ if (translators && translators[0])
+ {
+ source_add_translator_comments_to_buffer (data, GLADE_DECLARATIONS, translatable, comments);
+ source_add_decl (data, " gchar *translators = %s;\n",
+ source_make_string (translators, FALSE));
+ }
+ else if (data->use_gettext && translatable)
+ {
+ if (!comments || comments[0] == '\0')
+ comments = "TRANSLATORS: Replace this string with your names, one name per line.";
+
+ source_add_translator_comments_to_buffer (data, GLADE_DECLARATIONS,
+ translatable, comments);
+ source_add_decl (data,
+ " gchar *translators = _(\"%s\");\n",
+ GLADE_TRANSLATORS_STRING);
+
+ source_add (data,
+ " if (!strcmp (translators, \"%s\"))\n"
+ " translators = NULL;\n",
+ GLADE_TRANSLATORS_STRING);
+ }
+ else
+ {
+ source_add_decl (data, " gchar *translators = NULL;\n");
+ }
+
+ logo_filename = gtk_object_get_data (GTK_OBJECT (widget), Logo);
+ if (logo_filename && logo_filename[0])
+ {
+ pixbuf_name = g_strdup_printf ("%s_logo_pixbuf", data->wname);
+
+ source_add_decl (data, " GdkPixbuf *%s;\n", pixbuf_name);
+ source_create_pixbuf (data, pixbuf_name, logo_filename);
+ }
+
+ /* Now output the call to gnome_about_new(). We do it in pieces since
+ source_make_string() returns a pointer to a single static buffer. */
+ source_add (data,
+ " %s = gnome_about_new (%s, VERSION,\n",
+ data->wname,
+ source_make_string (project_name ? project_name : "",
+ FALSE));
+
+ glade_util_get_translation_properties (widget, Copyright, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+ source_add (data,
+ " %s,\n",
+ source_make_string_full (copyright ? copyright : "",
+ data->use_gettext && translatable,
+ context));
+
+ glade_util_get_translation_properties (widget, Comments, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+ source_add (data,
+ " %s,\n",
+ source_make_string_full (about_comments ? about_comments : "",
+ data->use_gettext && translatable,
+ context));
+
+ source_add (data,
+ " authors,\n"
+ " documenters,\n"
+ " translators,\n");
+
+ source_add (data,
+ " %s);\n",
+ pixbuf_name ? pixbuf_name : "NULL");
+
+ g_free (pixbuf_name);
+ g_free (copyright);
+ g_free (about_comments);
+ g_free (translators);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ gb_window_write_standard_source (widget, data,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ IconName, FocusOnMap,
+ NULL, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, NULL);
+}
+
+
+void
+gb_gnome_about_destroy (GtkWidget * widget,
+ GbWidgetDestroyData * data)
+{
+ gchar *filename;
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), Logo);
+ glade_project_remove_pixmap (data->project, filename);
+
+ gb_window_destroy (widget, data);
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_about_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_about_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_about_xpm;
+ gbwidget.tooltip = _("Gnome About Dialog");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_about_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_about_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_about_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_about_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_about_write_source;
+ gbwidget.gb_widget_destroy = gb_gnome_about_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_about_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomeapp.c b/tools/glade/glade/gnome/gnomeapp.c
new file mode 100644
index 00000000..3835f6d8
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomeapp.c
@@ -0,0 +1,461 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+#include "../tree.h"
+#include "../glade_gnome.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-app.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+
+static gchar *Title = "GnomeApp|GtkWindow::title";
+static gchar *Type = "GnomeApp|GtkWindow::type";
+static gchar *Position = "GnomeApp|GtkWindow::window_position";
+static gchar *Modal = "GnomeApp|GtkWindow::modal";
+static gchar *DefaultWidth = "GnomeApp|GtkWindow::default_width";
+static gchar *DefaultHeight = "GnomeApp|GtkWindow::default_height";
+static gchar *Shrink = "GnomeAppl|GtkWindow::allow_shrink";
+static gchar *Grow = "GnomeApp|GtkWindow::allow_grow";
+static gchar *AutoShrink = "GnomeApp|GtkWindow::auto_shrink";
+static gchar *IconName = "GnomeApp|GtkWindow::icon_name";
+static gchar *FocusOnMap = "GnomeApp|GtkWindow::focus_on_map";
+
+static gchar *Resizable = "GnomeApp|GtkWindow::resizable";
+static gchar *DestroyWithParent = "GnomeApp|GtkWindow::destroy_with_parent";
+static gchar *Icon = "GnomeApp|GtkWindow::icon";
+
+static gchar *Role = "GnomeApp|GtkWindow::role";
+static gchar *TypeHint = "GnomeApp|GtkWindow::type_hint";
+static gchar *SkipTaskbar = "GnomeApp|GtkWindow::skip_taskbar_hint";
+static gchar *SkipPager = "GnomeApp|GtkWindow::skip_pager_hint";
+static gchar *Decorated = "GnomeApp|GtkWindow::decorated";
+static gchar *Gravity = "GnomeApp|GtkWindow::gravity";
+static gchar *Urgency = "GnomeApp|GtkWindow::urgency_hint";
+
+/* This is kept as object data as we don't want config info written when it is
+ used in Glade. */
+static gchar *EnableLayoutConfig = "GnomeApp::enable_layout_config";
+
+/* This is only used within Glade. We don't save or load it, since the
+ appbar will be saved on its own if it has been added. */
+static gchar *StatusBar = "GnomeApp::status_bar";
+
+
+static void gb_gnome_app_setup_initial_app (GtkWidget *widget);
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeApp, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_app_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+ gchar *project_name;
+
+ project_name = glade_project_get_name (data->project);
+ new_widget = gnome_app_new (project_name ? project_name : "", project_name);
+ gtk_object_set_data (GTK_OBJECT (new_widget), EnableLayoutConfig,
+ GINT_TO_POINTER (TRUE));
+
+ /* Turn off the automatic loading/saving of the configuration, and
+ destroy the BonoboDockLayout, so that when items are added they are
+ added straight away. If we don't do this, items don't get added to
+ the widget tree. */
+ gnome_app_enable_layout_config (GNOME_APP (new_widget), FALSE);
+ g_object_unref (G_OBJECT (GNOME_APP (new_widget)->layout));
+ GNOME_APP (new_widget)->layout = NULL;
+
+ gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
+ GTK_SIGNAL_FUNC (editor_close_window), NULL);
+
+ gb_widget_create_from (GNOME_APP (new_widget)->dock,
+ data->action == GB_CREATING ? "BonoboDock" : NULL);
+ gb_widget_set_child_name (GNOME_APP (new_widget)->dock, GladeChildGnomeAppDock);
+
+ if (data->action == GB_CREATING)
+ gb_gnome_app_setup_initial_app (new_widget);
+
+ return new_widget;
+}
+
+
+static void
+gb_gnome_app_add_toolbar_button (GtkToolbar *toolbar,
+ const gchar *stock_id,
+ const gchar *tooltip)
+{
+ GtkWidget *button;
+ GladeWidgetData *wdata;
+
+ button = gb_widget_new ("GtkToolButton", NULL);
+
+ gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (button), stock_id);
+ gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (button), NULL);
+ gtk_tool_button_set_label (GTK_TOOL_BUTTON (button), NULL);
+
+ gtk_object_set_data_full (GTK_OBJECT (button),
+ GladeToolButtonStockIDKey,
+ g_strdup (stock_id), g_free);
+
+ wdata = gtk_object_get_data (GTK_OBJECT (button), GB_WIDGET_DATA_KEY);
+ wdata->tooltip = g_strdup (tooltip);
+
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (button), -1);
+}
+
+
+static void
+gb_gnome_app_setup_initial_app (GtkWidget *widget)
+{
+ GtkWidget *placeholder, *toolbar;
+
+ /* We create a standard menubar and toolbar which the user can edit or
+ simply delete anything they don't want. */
+ glade_gnome_setup_initial_menus (widget);
+
+ /* We need to get rid of the accelerators, since they aren't used, and
+ they would override our default accelerators. */
+ gtk_window_remove_accel_group (GTK_WINDOW (widget),
+ GNOME_APP (widget)->accel_group);
+
+ /* FIXME: GnomeLibs bug workaround. It sets the initial border width
+ to -2, which causes us lots of problems. */
+#if 0
+ gtk_container_set_border_width (GTK_CONTAINER (GNOME_APP (widget)->menubar),
+ 0);
+#endif
+ gb_widget_create_from (GNOME_APP (widget)->menubar, "GtkMenubar");
+ gb_widget_create_from (GNOME_APP (widget)->menubar->parent, "BonoboDockItem");
+
+ /* Toolbar */
+ toolbar = gtk_toolbar_new ();
+ gnome_app_set_toolbar (GNOME_APP (widget), GTK_TOOLBAR (toolbar));
+ gb_widget_create_from (toolbar, "GtkToolbar");
+ gb_widget_create_from (toolbar->parent, "BonoboDockItem");
+
+ gb_gnome_app_add_toolbar_button (GTK_TOOLBAR (toolbar), GTK_STOCK_NEW,
+ _("New File"));
+ gb_gnome_app_add_toolbar_button (GTK_TOOLBAR (toolbar), GTK_STOCK_OPEN,
+ _("Open File"));
+ gb_gnome_app_add_toolbar_button (GTK_TOOLBAR (toolbar), GTK_STOCK_SAVE,
+ _("Save File"));
+
+
+ /* Statusbar */
+ gnome_app_set_statusbar (GNOME_APP (widget),
+ gb_widget_new ("GnomeAppBar", widget));
+ gb_widget_set_child_name (GNOME_APP (widget)->statusbar, GladeChildGnomeAppBar);
+
+ /* We need to size the placeholders or the dialog is very small. */
+ placeholder = editor_new_placeholder ();
+ gtk_widget_set_usize (placeholder, 300, 200);
+ gnome_app_set_contents (GNOME_APP (widget), placeholder);
+}
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_app_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ gb_window_create_standard_properties (widget, data,
+ Title, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+ property_add_bool (StatusBar, _("Status Bar:"),
+ _("If the window has a status bar"));
+ property_add_bool (EnableLayoutConfig, _("Store Config:"),
+ _("If the layout is saved and restored automatically"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_app_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_window_get_standard_properties (widget, data,
+ Title, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ if (data->action == GB_SHOWING)
+ {
+ gb_widget_output_bool (data, StatusBar,
+ GNOME_APP (widget)->statusbar != NULL
+ ? TRUE : FALSE);
+ }
+
+ gb_widget_output_bool (data, EnableLayoutConfig, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), EnableLayoutConfig)));
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_app_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gboolean statusbar, enable_layout_config;
+
+ gb_window_set_standard_properties (widget, data,
+ Title, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ if (data->action == GB_APPLYING)
+ {
+ statusbar = gb_widget_input_bool (data, StatusBar);
+ if (data->apply)
+ {
+ if (statusbar)
+ {
+ if (!GNOME_APP (widget)->statusbar)
+ {
+ gnome_app_set_statusbar (GNOME_APP (widget),
+ gb_widget_new ("GnomeAppBar",
+ widget));
+ gb_widget_set_child_name (GNOME_APP (widget)->statusbar,
+ GladeChildGnomeAppBar);
+ tree_add_widget (GNOME_APP (widget)->statusbar);
+ }
+ }
+ else
+ {
+ if (GNOME_APP (widget)->statusbar)
+ {
+ /* This is not very clean, but there's no proper way to
+ remove the statusbar. The statusbar has an hbox inserted
+ above it which is added to the GnomeApp's vbox, so we
+ remove the hbox. */
+ GtkWidget *hbox = GNOME_APP (widget)->statusbar->parent;
+ gtk_container_remove (GTK_CONTAINER (hbox->parent), hbox);
+ GNOME_APP (widget)->statusbar = NULL;
+ }
+ }
+ }
+ }
+
+ enable_layout_config = gb_widget_input_bool (data, EnableLayoutConfig);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), EnableLayoutConfig,
+ GINT_TO_POINTER (enable_layout_config));
+ }
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeApp, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_app_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_app_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ gchar *appname;
+ gboolean translatable, context;
+ gchar *comments;
+
+ if (data->create_widget)
+ {
+ appname = glade_project_get_name (data->project);
+ appname = appname ? source_make_string (appname, FALSE) : "\"\"";
+ appname = g_strdup (appname);
+
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ /* Note that this assumes that we use the same appname for each GnomeApp.
+ FIXME: I think this is correct, but I'm not sure.
+ Note also that we don't translate the project name. Maybe we should.*/
+ source_add (data, " %s = gnome_app_new (%s, %s);\n", data->wname,
+ appname,
+ GTK_WINDOW (widget)->title
+ ? source_make_string_full (GTK_WINDOW (widget)->title,
+ data->use_gettext && translatable,
+ context)
+ : "NULL");
+ g_free (appname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ /* The title is already set above, so we pass NULL to skip it. */
+ gb_window_write_standard_source (widget, data,
+ NULL, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ if (!GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ EnableLayoutConfig)))
+ {
+ source_add (data,
+ " gnome_app_enable_layout_config (GNOME_APP (%s), FALSE);\n",
+ data->wname);
+ }
+}
+
+
+/* Outputs source to add a child menu to a GnomeApp. */
+static void
+gb_gnome_app_write_add_child_source (GtkWidget * parent,
+ const gchar *parent_name,
+ GtkWidget *child,
+ GbWidgetWriteSourceData * data)
+{
+ gchar *child_name;
+
+ child_name = gb_widget_get_child_name (child);
+
+ if (child_name && (!strcmp (child_name, GladeChildGnomeAppBar)))
+ {
+ source_add (data,
+ " gnome_app_set_statusbar (GNOME_APP (%s), %s);\n",
+ parent_name, data->wname);
+ }
+ else
+ {
+ g_warning ("Adding unknown child to a GnomeApp: %s", data->wname);
+ source_add (data, " gtk_container_add (GTK_CONTAINER (%s), %s);\n",
+ parent_name, data->wname);
+ }
+}
+
+
+static void
+gb_gnome_app_add_child (GtkWidget *widget, GtkWidget * child,
+ GbWidgetSetArgData *data)
+{
+ gchar *child_name = NULL;
+
+ if (data->child_info)
+ child_name = data->child_info->internal_child;
+
+ if (child_name && (!strcmp (child_name, GladeChildGnomeAppBar)))
+ {
+ gnome_app_set_statusbar (GNOME_APP (widget), child);
+ }
+}
+
+
+static GtkWidget *
+gb_gnome_app_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildGnomeAppDock))
+ return GNOME_APP (widget)->dock;
+ else
+ return NULL;
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_app_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_app_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_app_xpm;
+ gbwidget.tooltip = _("Gnome Application Window");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_app_new;
+ gbwidget.gb_widget_add_child = gb_gnome_app_add_child;
+ gbwidget.gb_widget_get_child = gb_gnome_app_get_child;
+ gbwidget.gb_widget_create_properties = gb_gnome_app_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_app_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_app_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_app_write_source;
+ gbwidget.gb_widget_write_add_child_source = gb_gnome_app_write_add_child_source;
+ gbwidget.gb_widget_destroy = gb_window_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_app_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomeappbar.c b/tools/glade/glade/gnome/gnomeappbar.c
new file mode 100644
index 00000000..fe9b6afd
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomeappbar.c
@@ -0,0 +1,198 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-appbar.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *HasProgress = "GnomeApp::has_progress";
+static gchar *HasStatus = "GnomeApp::has_status";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeAppBar, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_appbar_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER);
+
+ gnome_appbar_set_status (GNOME_APPBAR (new_widget), _("Status Message."));
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_appbar_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_bool (HasProgress, _("Progress:"),
+ _("If the app bar has a progress indicator"));
+ property_add_bool (HasStatus, _("Status:"),
+ _("If the app bar has an area for status messages and user input"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_appbar_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_widget_output_bool (data, HasProgress,
+ GTK_WIDGET_VISIBLE (gnome_appbar_get_progress (GNOME_APPBAR (widget))));
+ gb_widget_output_bool (data, HasStatus,
+ GTK_WIDGET_VISIBLE (gnome_appbar_get_status (GNOME_APPBAR (widget))));
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_appbar_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gboolean has_progress, has_status;
+
+ has_progress = gb_widget_input_bool (data, HasProgress);
+ if (data->apply)
+ {
+ if (has_progress)
+ gtk_widget_show (GTK_WIDGET (gnome_appbar_get_progress (GNOME_APPBAR (widget))));
+ else
+ gtk_widget_hide (GTK_WIDGET (gnome_appbar_get_progress (GNOME_APPBAR (widget))));
+ }
+
+ has_status = gb_widget_input_bool (data, HasStatus);
+ if (data->apply)
+ {
+ if (has_status)
+ gtk_widget_show (gnome_appbar_get_status (GNOME_APPBAR (widget)));
+ else
+ gtk_widget_hide (gnome_appbar_get_status (GNOME_APPBAR (widget)));
+
+ /* We need to clear the selection or redrawing is messed up. */
+ editor_clear_selection (NULL);
+ }
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeAppBar, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_appbar_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_appbar_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ if (data->create_widget)
+ {
+ source_add (data,
+ " %s = gnome_appbar_new (%s, %s, GNOME_PREFERENCES_NEVER);\n",
+ data->wname,
+ GTK_WIDGET_VISIBLE (gnome_appbar_get_progress (GNOME_APPBAR (widget)))
+ ? "TRUE" : "FALSE",
+ GTK_WIDGET_VISIBLE (gnome_appbar_get_status (GNOME_APPBAR (widget)))
+ ? "TRUE" : "FALSE");
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ /* If the GnomeAppBar is in a GnomeApp, the code to install the menu hints
+ is output in gnomedockitem.c. */
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_appbar_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_appbar_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_appbar_xpm;
+ gbwidget.tooltip = _("Gnome Application Bar");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_appbar_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_appbar_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_appbar_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_appbar_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_appbar_write_source;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_appbar_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomecanvas.c b/tools/glade/glade/gnome/gnomecanvas.c
new file mode 100644
index 00000000..2f757be5
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomecanvas.c
@@ -0,0 +1,263 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-canvas.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *AntiAliased = "GnomeCanvas::aa";
+static gchar *ScrollX1 = "GnomeCanvas::scroll_x1";
+static gchar *ScrollY1 = "GnomeCanvas::scroll_y1";
+static gchar *ScrollX2 = "GnomeCanvas::scroll_x2";
+static gchar *ScrollY2 = "GnomeCanvas::scroll_y2";
+static gchar *PixelsPerUnit = "GnomeCanvas::pixels_per_unit";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeCanvas, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+/*
+static GtkWidget*
+gb_gnome_canvas_new (GbWidgetNewData *data)
+{
+
+}
+*/
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_canvas_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_bool (AntiAliased, _("Anti-Aliased:"),
+ _("If the canvas is anti-aliased, to smooth the edges of text and graphics"));
+ property_add_float (ScrollX1, _("X1:"), _("The minimum x coordinate"));
+ property_add_float (ScrollY1, _("Y1:"), _("The minimum y coordinate"));
+ property_add_float (ScrollX2, _("X2:"), _("The maximum x coordinate"));
+ property_add_float (ScrollY2, _("Y2:"), _("The maximum y coordinate"));
+
+ property_add_float (PixelsPerUnit, _("Pixels Per Unit:"),
+ _("The number of pixels corresponding to one unit"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_canvas_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_widget_output_bool (data, AntiAliased,
+ GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), AntiAliased)));
+
+ gb_widget_output_float (data, ScrollX1, GNOME_CANVAS (widget)->scroll_x1);
+ gb_widget_output_float (data, ScrollY1, GNOME_CANVAS (widget)->scroll_y1);
+ gb_widget_output_float (data, ScrollX2, GNOME_CANVAS (widget)->scroll_x2);
+ gb_widget_output_float (data, ScrollY2, GNOME_CANVAS (widget)->scroll_y2);
+
+ gb_widget_output_float (data, PixelsPerUnit,
+ GNOME_CANVAS (widget)->pixels_per_unit);
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_canvas_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gboolean antialiased;
+ gfloat value;
+ gfloat scroll_x1, scroll_y1, scroll_x2, scroll_y2;
+ gfloat old_scroll_x1, old_scroll_y1, old_scroll_x2, old_scroll_y2;
+ gfloat pixels_per_unit;
+
+ antialiased = gb_widget_input_bool (data, AntiAliased);
+ if (data->apply)
+ gtk_object_set_data (GTK_OBJECT (widget), AntiAliased,
+ GINT_TO_POINTER (antialiased));
+
+ /* Also check for the old name we used for this. */
+ if (data->action == GB_LOADING)
+ {
+ antialiased = gb_widget_input_bool (data, "anti_aliased");
+ if (data->apply)
+ gtk_object_set_data (GTK_OBJECT (widget), AntiAliased,
+ GINT_TO_POINTER (antialiased));
+ }
+
+ scroll_x1 = old_scroll_x1 = GNOME_CANVAS (widget)->scroll_x1;
+ scroll_y1 = old_scroll_y1 = GNOME_CANVAS (widget)->scroll_y1;
+ scroll_x2 = old_scroll_x2 = GNOME_CANVAS (widget)->scroll_x2;
+ scroll_y2 = old_scroll_y2 = GNOME_CANVAS (widget)->scroll_y2;
+
+ value = gb_widget_input_float (data, ScrollX1);
+ if (data->apply)
+ scroll_x1 = value;
+ value = gb_widget_input_float (data, ScrollY1);
+ if (data->apply)
+ scroll_y1 = value;
+ value = gb_widget_input_float (data, ScrollX2);
+ if (data->apply)
+ scroll_x2 = value;
+ value = gb_widget_input_float (data, ScrollY2);
+ if (data->apply)
+ scroll_y2 = value;
+
+ if (scroll_x1 != old_scroll_x1 || scroll_y1 != old_scroll_y1
+ || scroll_x2 != old_scroll_x2 || scroll_y2 != old_scroll_y2)
+ {
+ gnome_canvas_set_scroll_region (GNOME_CANVAS (widget),
+ scroll_x1, scroll_y1,
+ scroll_x2, scroll_y2);
+ }
+
+ pixels_per_unit = gb_widget_input_float (data, PixelsPerUnit);
+ if (data->apply)
+ gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (widget), pixels_per_unit);
+}
+
+
+/*
+ * Sets the properties for the child widget specific to this type of
+ * parent widget.
+ */
+/*
+static void
+gb_gnome_canvas_set_child_props (GtkWidget * widget, GtkWidget * child, GbWidgetSetArgData * data)
+{
+
+}
+*/
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeCanvas, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_canvas_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_canvas_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ if (data->create_widget)
+ {
+ if (gtk_object_get_data (GTK_OBJECT (widget), AntiAliased))
+ {
+ source_add (data,
+ " %s = gnome_canvas_new_aa ();\n",
+ data->wname);
+ }
+ else
+ {
+ source_add (data,
+ " %s = gnome_canvas_new ();\n",
+ data->wname);
+ }
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ source_add (data,
+ " gnome_canvas_set_scroll_region (GNOME_CANVAS (%s), %g, %g, %g, %g);\n",
+ data->wname,
+ GNOME_CANVAS (widget)->scroll_x1,
+ GNOME_CANVAS (widget)->scroll_y1,
+ GNOME_CANVAS (widget)->scroll_x2,
+ GNOME_CANVAS (widget)->scroll_y2);
+
+ if (GNOME_CANVAS (widget)->pixels_per_unit != 1.0)
+ source_add (data,
+ " gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (%s), %g);\n",
+ data->wname,
+ GNOME_CANVAS (widget)->pixels_per_unit);
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_canvas_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_canvas_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_canvas_xpm;
+ gbwidget.tooltip = _("GnomeCanvas");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_create_properties = gb_gnome_canvas_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_canvas_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_canvas_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_canvas_write_source;
+/*
+ gbwidget.gb_widget_new = gb_gnome_canvas_new;
+ gbwidget.gb_widget_set_child_props = gb_gnome_canvas_set_child_props;
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_canvas_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomecolorpicker.c b/tools/glade/glade/gnome/gnomecolorpicker.c
new file mode 100644
index 00000000..346bdec8
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomecolorpicker.c
@@ -0,0 +1,233 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+#include "../glade_gnome.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-colorpicker.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Dither = "GnomeColorPicker::dither";
+static gchar *UseAlpha = "GnomeColorPicker::use_alpha";
+static gchar *Title = "GnomeColorPicker::title";
+static gchar *FocusOnClick = "GnomeColorPicker|GtkButton::focus_on_click";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeColorPicker, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+/*
+static GtkWidget*
+gb_gnome_color_picker_new (GbWidgetNewData *data)
+{
+
+}
+*/
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_color_picker_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_bool (Dither, _("Dither:"),
+ _("If the sample should use dithering to be more accurate"));
+ property_add_bool (UseAlpha, _("Use Alpha:"),
+ _("If the alpha channel should be used"));
+
+ property_add_string (Title, _("Title:"),
+ _("The title of the color selection dialog"));
+
+ property_add_bool (FocusOnClick, _("Focus On Click:"), _("If the button grabs focus when it is clicked"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_color_picker_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_widget_output_bool (data, Dither, gnome_color_picker_get_dither (GNOME_COLOR_PICKER (widget)));
+ gb_widget_output_bool (data, UseAlpha,
+ gnome_color_picker_get_use_alpha (GNOME_COLOR_PICKER (widget)));
+ gb_widget_output_translatable_string (data, Title,
+ gnome_color_picker_get_title (GNOME_COLOR_PICKER (widget)));
+
+ gb_widget_output_bool (data, FocusOnClick,
+ gtk_button_get_focus_on_click (GTK_BUTTON (widget)));
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_color_picker_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gboolean dither, use_alpha, focus_on_click;
+ gchar *title;
+
+ dither = gb_widget_input_bool (data, Dither);
+ if (data->apply)
+ gnome_color_picker_set_dither (GNOME_COLOR_PICKER (widget), dither);
+
+ use_alpha = gb_widget_input_bool (data, UseAlpha);
+ if (data->apply)
+ gnome_color_picker_set_use_alpha (GNOME_COLOR_PICKER (widget), use_alpha);
+
+ title = gb_widget_input_string (data, Title);
+ if (data->apply)
+ gnome_color_picker_set_title (GNOME_COLOR_PICKER (widget), title);
+
+ focus_on_click = gb_widget_input_bool (data, FocusOnClick);
+ if (data->apply)
+ gtk_button_set_focus_on_click (GTK_BUTTON (widget), focus_on_click);
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeColorPicker, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_color_picker_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_color_picker_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ if (data->create_widget)
+ {
+ source_add (data, " %s = gnome_color_picker_new ();\n", data->wname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ if (strcmp (gnome_color_picker_get_title (GNOME_COLOR_PICKER (widget)),
+ dgettext (GLADE_LIBGNOMEUI_GETTEXT_PACKAGE, "Pick a color")))
+ {
+ gboolean translatable, context;
+ gchar *comments;
+
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data,
+ " gnome_color_picker_set_title (GNOME_COLOR_PICKER (%s), %s);\n",
+ data->wname,
+ source_make_string_full (gnome_color_picker_get_title (GNOME_COLOR_PICKER (widget)),
+ data->use_gettext && translatable,
+ context));
+ }
+
+ if (!gnome_color_picker_get_dither (GNOME_COLOR_PICKER (widget)))
+ {
+ source_add (data,
+ " gnome_color_picker_set_dither (GNOME_COLOR_PICKER (%s), FALSE);\n",
+ data->wname);
+
+ }
+
+ if (gnome_color_picker_get_use_alpha (GNOME_COLOR_PICKER (widget)))
+ {
+ source_add (data,
+ " gnome_color_picker_set_use_alpha (GNOME_COLOR_PICKER (%s), TRUE);\n",
+ data->wname);
+ }
+
+ if (!gtk_button_get_focus_on_click (GTK_BUTTON (widget)))
+ {
+ source_add (data,
+ " gtk_button_set_focus_on_click (GTK_BUTTON (%s), FALSE);\n",
+ data->wname);
+ }
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_color_picker_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_color_picker_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_colorpicker_xpm;
+ gbwidget.tooltip = _("Gnome Color Picker");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_create_properties = gb_gnome_color_picker_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_color_picker_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_color_picker_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_color_picker_write_source;
+/*
+ gbwidget.gb_widget_new = gb_gnome_color_picker_new;
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_color_picker_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomecontrol.c b/tools/glade/glade/gnome/gnomecontrol.c
new file mode 100644
index 00000000..5744fda9
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomecontrol.c
@@ -0,0 +1,757 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1998 Damon Chaplin
+ *
+ * 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.
+ */
+
+/*
+ * Glade only shows Bonobo controls which have a 'glade:show' attribute set
+ * to TRUE, e.g. with this in their .server file:
+ *
+ * <oaf_attribute name="glade:show" type="boolean" value="TRUE"/>
+ *
+ */
+
+#include <config.h>
+
+#include <gtk/gtkhbox.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkspinbutton.h>
+
+#include "../gb.h"
+#include "../palette.h"
+
+#include <bonobo.h>
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-control.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+/* This is the key we use to store a pointer to the bonobo widget's property
+ bag. */
+static gchar *GladePropertyBagKey = "GladePropertyBagKey";
+
+/* This is the Moniker property which stores the type of control. It is saved
+ in the XML. */
+const gchar *Moniker = "BonoboWidget::moniker";
+
+
+static GbWidget *control_get_gb_widget (const char *obj_id);
+
+
+/****************************************************************************
+ * This is the dummy GbWidget we put in the palette. It only contains a
+ * new() function to create Bonobo controls. We create a GbWidget for each
+ * type of control when needed, and it is that that contains functions to
+ * create/get/set properties.
+ ****************************************************************************/
+
+/* Columns in the GtkTreeView for selecting the type of control. */
+enum {
+ COL_OBJID,
+ COL_DESC,
+ COL_LAST
+};
+
+static GtkWidget *
+control_create (GbWidgetNewData * data, char *obj_id, Bonobo_UIContainer uic)
+{
+ GtkWidget *widget;
+ BonoboControlFrame *cf;
+ Bonobo_PropertyBag pb;
+
+ g_return_val_if_fail (obj_id != NULL, NULL);
+
+ widget = bonobo_widget_new_control (obj_id, uic);
+
+ g_return_val_if_fail (widget != NULL, NULL);
+ cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (widget));
+
+ if (!cf) {
+ g_warning ("Control has no frame!");
+ gtk_widget_destroy (widget);
+
+ return NULL;
+ }
+
+ pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
+
+ gtk_object_set_data (GTK_OBJECT (widget), GladePropertyBagKey, pb);
+ gtk_object_set_data (GTK_OBJECT (widget), Moniker, g_strdup (obj_id));
+
+ /* Make sure the GbWidget for this control is created & registered,
+ and set the real GbWidget for this control. */
+ data->widget_data->gbwidget = control_get_gb_widget (obj_id);
+
+ return widget;
+}
+
+static Bonobo_PropertyBag
+control_get_pb (GtkWidget *widget)
+{
+ return gtk_object_get_data (GTK_OBJECT (widget),
+ GladePropertyBagKey);
+}
+
+static Bonobo_UIContainer
+widget_get_uic (GtkWidget *widget)
+{
+ GtkWidget *top;
+
+ top = gtk_widget_get_toplevel (widget);
+
+ if (!BONOBO_IS_WINDOW (top))
+ return CORBA_OBJECT_NIL;
+
+ /* FIXME: Should we unref this somewhere? */
+ return (Bonobo_UIContainer) BONOBO_OBJREF (bonobo_window_get_ui_container (BONOBO_WINDOW (top)));
+}
+
+static void
+on_control_dialog_ok (GtkWidget *widget,
+ GbWidgetNewData *data)
+{
+ GtkTreeView *view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *dialog;
+ GtkTreeSelection *selection;
+ char *moniker;
+ GtkWidget *new_widget;
+
+ dialog = gtk_widget_get_toplevel (widget);
+
+ view = g_object_get_data (G_OBJECT (dialog), "tree_view");
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+ gtk_tree_selection_get_selected (selection, &model, &iter);
+ gtk_tree_model_get (model, &iter, COL_OBJID, &moniker, -1);
+
+ new_widget = control_create (data, moniker, widget_get_uic (data->parent));
+ if (new_widget)
+ {
+ gb_widget_initialize (new_widget, data);
+ data->callback (new_widget, data);
+ }
+ else
+ {
+ glade_util_show_message_box (_("Couldn't create the Bonobo control"),
+ NULL);
+ }
+
+ gtk_widget_destroy (dialog);
+}
+
+static void
+on_control_dialog_destroy (GtkWidget *widget,
+ GbWidgetNewData *data)
+{
+ gb_widget_free_new_data (data);
+ gtk_grab_remove (widget);
+}
+
+static GtkListStore *
+do_query (void)
+{
+ GtkListStore *store;
+ Bonobo_ServerInfoList *servers;
+#if 0
+ /* This is the old query, but too many components are not generally useful
+ and cause problems, so we are changing to an 'opt-in' query, where
+ we only include components that have a 'glade:show' property set to TRUE.
+ */
+ const char *query = "repo_ids.has('IDL:Bonobo/Control:1.0') AND NOT "
+ "repo_ids.has('IDL:GNOME/Vertigo/PanelAppletShell:1.0')";
+#else
+ const char *query = "glade:show";
+#endif
+ char *sort[] = { "description", NULL };
+ CORBA_Environment ev;
+ int i;
+
+ Bonobo_ServerInfo *serverinfo;
+ const char *desc;
+ GtkTreeIter iter;
+
+ store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
+
+ CORBA_exception_init (&ev);
+
+ servers = bonobo_activation_query (query, sort, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("query failed: %s\n", ev._id);
+ CORBA_exception_free (&ev);
+ return store;
+ }
+ CORBA_exception_free (&ev);
+
+#if 0
+ g_print ("got %d servers.\n", servers ? servers->_length : 0);
+#endif
+
+ for (i = 0; i < servers->_length; i++) {
+ serverinfo = &servers->_buffer[i];
+
+ desc = bonobo_server_info_prop_lookup (serverinfo, "description", NULL);
+ if (!desc)
+ desc = bonobo_server_info_prop_lookup (serverinfo, "name", NULL);
+ if (!desc)
+ desc = serverinfo->iid;
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ COL_OBJID, serverinfo->iid,
+ COL_DESC, desc,
+ -1);
+ }
+
+ CORBA_free (servers);
+
+ return store;
+}
+
+static void
+on_list_selection_changed (GtkTreeSelection *selection, GtkDialog *dialog)
+{
+ gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK,
+ gtk_tree_selection_get_selected (selection, NULL, NULL));
+}
+
+static void
+show_control_dialog (GbWidgetNewData *data)
+{
+ GtkWidget *dialog, *vbox, *label, *list, *scroll;
+ GtkListStore *store;
+ GtkCellRenderer *ren;
+
+ dialog = glade_util_create_dialog (_("New Bonobo Control"), data->parent,
+ GTK_SIGNAL_FUNC (on_control_dialog_ok),
+ data, &vbox);
+ g_object_set (G_OBJECT (dialog),
+ "resizable", TRUE,
+ "default-width", 400,
+ "default-height", 300,
+ NULL);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ GTK_RESPONSE_OK, FALSE);
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (on_control_dialog_destroy), data);
+
+ label = gtk_label_new (_("Select a Bonobo Control"));
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+ scroll = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+ "hadjustment", NULL,
+ "vadjustment", NULL,
+ "shadow-type", GTK_SHADOW_ETCHED_IN,
+ "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
+
+ store = do_query ();
+
+ list = g_object_new (GTK_TYPE_TREE_VIEW,
+ "model", store,
+ "headers-visible", FALSE,
+ NULL);
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (list)),
+ "changed",
+ G_CALLBACK (on_list_selection_changed), dialog);
+
+ g_object_unref (store);
+
+ ren = gtk_cell_renderer_text_new ();
+
+#if 0
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (list),
+ -1, _("OAFIID"), ren,
+ "text", COL_OBJID,
+ NULL);
+#endif
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (list),
+ -1, _("Description"), ren,
+ "text", COL_DESC,
+ NULL);
+
+ gtk_container_add (GTK_CONTAINER (scroll), list);
+
+ g_object_set_data (G_OBJECT (dialog), "tree_view", list);
+
+ gtk_widget_show_all (dialog);
+ gtk_grab_add (dialog);
+}
+
+static GtkWidget *
+gb_bonobo_control_new (GbWidgetNewData * data)
+{
+ GtkWidget *new_widget;
+
+ if (data->action == GB_LOADING) {
+ char *moniker;
+
+ moniker = load_string (data->loading_data, Moniker);
+
+ new_widget = control_create (data, moniker, widget_get_uic (data->parent));
+
+ return new_widget;
+ } else {
+ show_control_dialog (data);
+ return NULL;
+ }
+}
+
+/*
+ * Initializes the GbWidget structure.
+ */
+GbWidget *
+gb_bonobo_control_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = BONOBO_TYPE_WIDGET;
+
+ gb_widget_init_struct (&gbwidget);
+
+ gbwidget.pixmap_struct = gnome_control_xpm;
+ gbwidget.tooltip = _("Bonobo Control");
+
+ gbwidget.gb_widget_new = gb_bonobo_control_new;
+
+ return &gbwidget;
+}
+
+
+/****************************************************************************
+ * This is the GbWidget that will be created for each type of control.
+ ****************************************************************************/
+
+/* We use the moniker to ensure the property names are unique in the property
+ editor. */
+static char *
+create_prop_name (const char *moniker, const char *txt)
+{
+ return g_strconcat (moniker, "::", txt, NULL);
+}
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_bonobo_control_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ Bonobo_PropertyBag pb = control_get_pb (widget);
+ char *moniker = gtk_object_get_data (GTK_OBJECT (widget), Moniker);
+ GList *key_list, *names;
+
+ g_assert (moniker);
+
+ if (!pb)
+ return;
+
+ key_list = bonobo_pbclient_get_keys (pb, NULL);
+ for (names = key_list; names; names = names->next) {
+ CORBA_TypeCode tc;
+ char *title, *doc;
+ char *prop = create_prop_name (moniker, names->data);
+
+ tc = bonobo_pbclient_get_type (pb, names->data, NULL);
+ title = bonobo_pbclient_get_doc_title (pb, names->data, NULL);
+ doc = bonobo_pbclient_get_doc (pb, names->data, NULL);
+
+ switch (tc->kind) {
+ case CORBA_tk_boolean:
+ property_add_bool (prop, title, doc);
+ break;
+ case CORBA_tk_string:
+ property_add_string (prop, title, doc);
+ break;
+ case CORBA_tk_short:
+ case CORBA_tk_ushort:
+ /* FIXME: _int_range() ? */
+ property_add_int (prop, title, doc);
+ break;
+ case CORBA_tk_double:
+ case CORBA_tk_float:
+ property_add_float (prop, title, doc);
+ break;
+ case CORBA_tk_ulong:
+ case CORBA_tk_long:
+ property_add_int (prop, title, doc);
+ break;
+ default:
+ g_warning ("Unhandled type %d", tc->kind);
+ break;
+ }
+ g_free (prop);
+ CORBA_free (title);
+ CORBA_free (doc);
+ }
+ bonobo_pbclient_free_keys (key_list);
+}
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_bonobo_control_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
+{
+ Bonobo_PropertyBag pb = control_get_pb (widget);
+ char *moniker = gtk_object_get_data (GTK_OBJECT (widget), Moniker);
+ GList *key_list, *names;
+
+ g_assert (moniker);
+
+ if (!pb)
+ return;
+
+ /* We save the moniker in the XML, though we don't show it in the property
+ editor. */
+ if (data->action == GB_SAVING)
+ {
+ save_string (data, Moniker, moniker);
+ }
+
+ key_list = bonobo_pbclient_get_keys (pb, NULL);
+ for (names = key_list; names; names = names->next) {
+ CORBA_TypeCode tc;
+ char *prop = create_prop_name (moniker, names->data);
+
+ tc = bonobo_pbclient_get_type (pb, names->data, NULL);
+ switch (tc->kind) {
+ case CORBA_tk_boolean:
+ gb_widget_output_bool (data, prop,
+ bonobo_pbclient_get_boolean (pb, names->data, NULL));
+ break;
+ case CORBA_tk_string:
+ {
+ char *str = bonobo_pbclient_get_string (pb, names->data, NULL);
+
+ gb_widget_output_translatable_string (data, prop, str);
+
+ g_free (str);
+ break;
+ }
+ case CORBA_tk_ulong:
+ gb_widget_output_int (data, prop,
+ bonobo_pbclient_get_ulong (pb, names->data, NULL));
+ break;
+ case CORBA_tk_long:
+ gb_widget_output_int (data, prop,
+ bonobo_pbclient_get_long (pb, names->data, NULL));
+ break;
+ case CORBA_tk_short:
+ gb_widget_output_int (data, prop,
+ bonobo_pbclient_get_short (pb, names->data, NULL));
+ break;
+ case CORBA_tk_ushort:
+ gb_widget_output_int (data, prop,
+ bonobo_pbclient_get_ushort (pb, names->data, NULL));
+ break;
+ case CORBA_tk_float:
+ gb_widget_output_float (data, prop,
+ bonobo_pbclient_get_float (pb, names->data, NULL));
+ break;
+ case CORBA_tk_double:
+ gb_widget_output_float (data, prop,
+ bonobo_pbclient_get_double (pb, names->data, NULL));
+ break;
+ default:
+ g_warning ("Unhandled type %d", tc->kind);
+ break;
+ }
+ g_free (prop);
+ }
+ bonobo_pbclient_free_keys (key_list);
+}
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_bonobo_control_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ Bonobo_PropertyBag pb = control_get_pb (widget);
+ char *moniker = gtk_object_get_data (GTK_OBJECT (widget), Moniker);
+ GList *key_list, *names;
+
+ g_assert (moniker);
+
+ if (!pb)
+ return;
+
+ key_list = bonobo_pbclient_get_keys (pb, NULL);
+ for (names = key_list; names; names = names->next) {
+ CORBA_TypeCode tc;
+ char *prop = create_prop_name (moniker, names->data);
+
+#if 0
+ g_print ("Checking property: %s\n", prop);
+#endif
+
+ tc = bonobo_pbclient_get_type (pb, names->data, NULL);
+ switch (tc->kind) {
+ case CORBA_tk_boolean:
+ {
+ gboolean val;
+
+ val = gb_widget_input_bool (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_boolean (pb, names->data, val, NULL);
+ break;
+ }
+ case CORBA_tk_string:
+ {
+ const char *str;
+
+ str = gb_widget_input_string (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_string (pb, names->data, str, NULL);
+
+ break;
+ }
+ case CORBA_tk_float:
+ {
+ gfloat val;
+
+ val = gb_widget_input_float (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_float (pb, names->data, val, NULL);
+ break;
+ }
+ case CORBA_tk_double:
+ {
+ gdouble val;
+
+ val = gb_widget_input_float (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_double (pb, names->data, val, NULL);
+ break;
+ }
+ case CORBA_tk_long:
+ {
+ glong val;
+
+ val = gb_widget_input_int (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_long (pb, names->data, val, NULL);
+ break;
+ }
+ case CORBA_tk_ulong:
+ {
+ glong val;
+
+ val = gb_widget_input_int (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_ulong (pb, names->data, val, NULL);
+ break;
+ }
+ case CORBA_tk_short:
+ {
+ glong val;
+
+ val = gb_widget_input_int (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_short (pb, names->data, val, NULL);
+ break;
+ }
+ case CORBA_tk_ushort:
+ {
+ glong val;
+
+ val = gb_widget_input_int (data, prop);
+ if (data->apply)
+ bonobo_pbclient_set_ushort (pb, names->data, val, NULL);
+ break;
+ }
+ default:
+ g_warning ("Unhandled type %d", tc->kind);
+ break;
+ }
+ g_free (prop);
+ }
+ bonobo_pbclient_free_keys (key_list);
+}
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_bonobo_control_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ char *moniker = gtk_object_get_data (GTK_OBJECT (widget), Moniker);
+ BonoboControlFrame *cf;
+ Bonobo_PropertyBag pb;
+ GList *key_list, *names;
+
+ if (data->create_widget)
+ {
+ /* Currently we don't support BonoboWindow, so it will always be NIL,
+ but if we ever do, then it just needs to set bonobo_uic when it is
+ created. */
+ source_ensure_decl (data, " Bonobo_UIContainer bonobo_uic = CORBA_OBJECT_NIL;\n");
+ source_add (data,
+ " %s = bonobo_widget_new_control (%s, bonobo_uic);\n",
+ data->wname,
+ source_make_string (moniker, FALSE));
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (widget));
+ if (!cf)
+ return;
+
+ pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
+
+ source_ensure_decl (data, " BonoboControlFrame *bonobo_cf;\n");
+ source_ensure_decl (data, " Bonobo_PropertyBag bonobo_pb;\n");
+
+ source_add (data,
+ " bonobo_cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (%s));\n",
+ data->wname);
+ source_add (data,
+ " bonobo_pb = bonobo_control_frame_get_control_property_bag (bonobo_cf, NULL);\n");
+
+
+ key_list = bonobo_pbclient_get_keys (pb, NULL);
+ for (names = key_list; names; names = names->next) {
+ CORBA_TypeCode tc;
+
+ tc = bonobo_pbclient_get_type (pb, names->data, NULL);
+ switch (tc->kind) {
+ case CORBA_tk_boolean: {
+ gboolean val = bonobo_pbclient_get_boolean (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_boolean (bonobo_pb, %s, %s, NULL);\n",
+ source_make_string (names->data, FALSE),
+ val ? "TRUE" : "FALSE");
+ break;
+ }
+ case CORBA_tk_string: {
+ char *val = bonobo_pbclient_get_string (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_string (bonobo_pb, %s,",
+ source_make_string (names->data, FALSE));
+ source_add (data, " %s, NULL);\n",
+ source_make_string (val, data->use_gettext));
+ g_free (val);
+ break;
+ }
+ case CORBA_tk_ulong: {
+ gulong val = bonobo_pbclient_get_ulong (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_ulong (bonobo_pb, %s, %lu, NULL);\n",
+ source_make_string (names->data, FALSE),
+ val);
+ break;
+ }
+ case CORBA_tk_long: {
+ glong val = bonobo_pbclient_get_long (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_long (bonobo_pb, %s, %li, NULL);\n",
+ source_make_string (names->data, FALSE),
+ val);
+ break;
+ }
+ case CORBA_tk_short: {
+ gshort val = bonobo_pbclient_get_short (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_short (bonobo_pb, %s, %i, NULL);\n",
+ source_make_string (names->data, FALSE),
+ val);
+ break;
+ }
+ case CORBA_tk_ushort: {
+ gushort val = bonobo_pbclient_get_ushort (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_ushort (bonobo_pb, %s, %u, NULL);\n",
+ source_make_string (names->data, FALSE),
+ val);
+ break;
+ }
+ case CORBA_tk_float: {
+ gfloat val = bonobo_pbclient_get_float (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_float (bonobo_pb, %s, %g, NULL);\n",
+ source_make_string (names->data, FALSE),
+ val);
+ break;
+ }
+ case CORBA_tk_double: {
+ gdouble val = bonobo_pbclient_get_double (pb, names->data, NULL);
+ source_add (data,
+ " bonobo_pbclient_set_double (bonobo_pb, %s, %g, NULL);\n",
+ source_make_string (names->data, FALSE),
+ val);
+ break;
+ }
+ default:
+ g_warning ("Unhandled type %d", tc->kind);
+ break;
+ }
+
+
+ }
+ bonobo_pbclient_free_keys (key_list);
+}
+
+static GbWidget *
+control_get_gb_widget (const char *obj_id)
+{
+ GbWidget *gbwidget;
+
+ /* Check if this GbWidget is already registered. */
+ gbwidget = gb_widget_lookup_class (obj_id);
+
+ /* If it isn't registered, create it and register it. */
+ if (!gbwidget)
+ {
+ gbwidget = g_new (GbWidget, 1);
+
+ gb_widget_init_struct (gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget->pixmap_struct = gnome_control_xpm;
+ gbwidget->tooltip = NULL;
+
+ /* Fill in any functions that this Gbwidget has */
+ gbwidget->gb_widget_new = NULL;
+ gbwidget->gb_widget_create_properties = gb_bonobo_control_create_properties;
+ gbwidget->gb_widget_get_properties = gb_bonobo_control_get_properties;
+ gbwidget->gb_widget_set_properties = gb_bonobo_control_set_properties;
+ gbwidget->gb_widget_write_source = gb_bonobo_control_write_source;
+
+#if 0
+ g_print ("Registering Bonobo control GbWidget: %s\n", obj_id);
+#endif
+ gb_widget_register_gbwidget (obj_id, gbwidget);
+ }
+
+ return gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomedateedit.c b/tools/glade/glade/gnome/gnomedateedit.c
new file mode 100644
index 00000000..6b18973c
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomedateedit.c
@@ -0,0 +1,313 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-dateedit.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *DateEditFlags = "GnomeDateEdit::dateedit_flags";
+static gchar *ShowTime = "GnomeDateEdit::show_time";
+static gchar *Use24Format = "GnomeDateEdit::use_24_format";
+static gchar *WeekStartMonday = "GnomeDateEdit::week_start_monday";
+static gchar *LowerHour = "GnomeDateEdit::lower_hour";
+static gchar *UpperHour = "GnomeDateEdit::upper_hour";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeDateEdit, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_date_edit_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = gnome_date_edit_new ((time_t) 0, TRUE, TRUE);
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_date_edit_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_bool (ShowTime, _("Show Time:"),
+ _("If the time is shown as well as the date"));
+ property_add_bool (Use24Format, _("24 Hour Format:"),
+ _("If the time is shown in 24-hour format"));
+ property_add_bool (WeekStartMonday, _("Monday First:"),
+ _("If the week should start on Monday"));
+ property_add_int_range (LowerHour, _("Lower Hour:"),
+ _("The lowest hour to show in the popup"),
+ 0, 23, 1, 10, 1);
+ property_add_int_range (UpperHour, _("Upper Hour:"),
+ _("The highest hour to show in the popup"),
+ 0, 23, 1, 10, 1);
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_date_edit_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ GnomeDateEditFlags flags;
+ int lower_hour, upper_hour;
+
+ flags = gnome_date_edit_get_flags (GNOME_DATE_EDIT (widget));
+
+ /* we save only one property, but the property editor has 3 toggle
+ buttons */
+ if (data->action == GB_SAVING) {
+ char *s = glade_util_string_from_flags (GNOME_TYPE_DATE_EDIT_FLAGS, flags);
+ gb_widget_output_string (data, DateEditFlags, s);
+ g_free (s);
+ } else {
+ gb_widget_output_bool (data, ShowTime,
+ flags & GNOME_DATE_EDIT_SHOW_TIME);
+ gb_widget_output_bool (data, Use24Format,
+ flags & GNOME_DATE_EDIT_24_HR);
+ gb_widget_output_bool (data, WeekStartMonday,
+ flags & GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY);
+ }
+
+ g_object_get (G_OBJECT (widget),
+ "lower-hour", &lower_hour,
+ "upper-hour", &upper_hour,
+ NULL);
+
+ gb_widget_output_int (data, LowerHour, lower_hour);
+ gb_widget_output_int (data, UpperHour, upper_hour);
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_date_edit_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ GnomeDateEditFlags flags, old_flags;
+ gboolean value;
+ gint value_int, lower_hour, old_lower_hour, upper_hour, old_upper_hour;
+
+ old_flags = flags = gnome_date_edit_get_flags (GNOME_DATE_EDIT (widget));
+
+ /* we load only one property, but the property editor has 3 toggle
+ buttons */
+ if (data->action == GB_LOADING) {
+ char *s = gb_widget_input_string (data, DateEditFlags);
+ if (data->apply)
+ flags = glade_util_flags_from_string (GNOME_TYPE_DATE_EDIT_FLAGS, s);
+ } else {
+ value = gb_widget_input_bool (data, ShowTime)
+ ? GNOME_DATE_EDIT_SHOW_TIME : 0;
+ if (data->apply)
+ flags = (flags & ~GNOME_DATE_EDIT_SHOW_TIME) | value;
+
+ value = gb_widget_input_bool (data, Use24Format)
+ ? GNOME_DATE_EDIT_24_HR : 0;
+ if (data->apply)
+ flags = (flags & ~GNOME_DATE_EDIT_24_HR) | value;
+
+ value = gb_widget_input_bool (data, WeekStartMonday)
+ ? GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY : 0;
+ if (data->apply)
+ flags = (flags & ~GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY) | value;
+ }
+
+ if (flags != old_flags)
+ gnome_date_edit_set_flags (GNOME_DATE_EDIT (widget), flags);
+
+ g_object_get (G_OBJECT (widget),
+ "lower-hour", &old_lower_hour,
+ "upper-hour", &old_upper_hour,
+ NULL);
+
+ value_int = gb_widget_input_int (data, LowerHour);
+ if (data->apply)
+ lower_hour = value_int;
+ else
+ lower_hour = old_lower_hour;
+
+ value_int = gb_widget_input_int (data, UpperHour);
+ if (data->apply)
+ upper_hour = value_int;
+ else
+ upper_hour = old_upper_hour;
+
+ if (lower_hour != old_lower_hour || upper_hour != old_upper_hour)
+ {
+ gnome_date_edit_set_popup_range (GNOME_DATE_EDIT (widget), lower_hour,
+ upper_hour);
+ }
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeDateEdit, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_date_edit_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_date_edit_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ GnomeDateEditFlags flags;
+ gboolean set_flags = FALSE;
+ int upper_hour, lower_hour;
+
+ flags = gnome_date_edit_get_flags (GNOME_DATE_EDIT (widget));
+
+ if (data->create_widget)
+ {
+ source_add (data, " %s = gnome_date_edit_new ((time_t) 0, %s, %s);\n",
+ data->wname,
+ flags & GNOME_DATE_EDIT_SHOW_TIME ? "TRUE" : "FALSE",
+ flags & GNOME_DATE_EDIT_24_HR ? "TRUE" : "FALSE");
+ }
+ else
+ {
+ set_flags = TRUE;
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ if (flags & GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY)
+ set_flags = TRUE;
+
+ if (set_flags)
+ {
+ const gchar *prefix = "\n ";
+ const gchar *prefix2 = "\n | ";
+
+ source_add (data, " gnome_date_edit_set_flags (GNOME_DATE_EDIT (%s),",
+ data->wname);
+ if (flags)
+ {
+ if (flags & GNOME_DATE_EDIT_SHOW_TIME)
+ {
+ source_add (data, "%sGNOME_DATE_EDIT_SHOW_TIME", prefix);
+ prefix = prefix2;
+ }
+ if (flags & GNOME_DATE_EDIT_24_HR)
+ {
+ source_add (data, "%sGNOME_DATE_EDIT_24_HR", prefix);
+ prefix = prefix2;
+ }
+ if (flags & GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY)
+ {
+ source_add (data, "%sGNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY",
+ prefix);
+ }
+ source_add (data, ");\n");
+ }
+ else
+ source_add (data, "0);\n");
+ }
+
+ g_object_get (G_OBJECT (widget),
+ "lower-hour", &lower_hour,
+ "upper-hour", &upper_hour,
+ NULL);
+
+ if (lower_hour != 7 || upper_hour != 19)
+
+ {
+ source_add (data, " gnome_date_edit_set_popup_range (GNOME_DATE_EDIT (%s), %i, %i);\n",
+ data->wname,
+ lower_hour,
+ upper_hour);
+ }
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_date_edit_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_date_edit_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_dateedit_xpm;
+ gbwidget.tooltip = _("GnomeDateEdit");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_date_edit_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_date_edit_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_date_edit_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_date_edit_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_date_edit_write_source;
+/*
+ gbwidget.gb_widget_set_child_props = gb_gnome_date_edit_set_child_props;
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_date_edit_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomedialog.c b/tools/glade/glade/gnome/gnomedialog.c
new file mode 100644
index 00000000..af0dd469
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomedialog.c
@@ -0,0 +1,358 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+#include "../glade_gnome.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-dialog.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Title = "GnomeDialog|GtkWindow::title";
+static gchar *Type = "GnomeDialog|GtkWindow::type";
+static gchar *Position = "GnomeDialog|GtkWindow::window_position";
+static gchar *Modal = "GnomeDialog|GtkWindow::modal";
+static gchar *DefaultWidth = "GnomeDialog|GtkWindow::default_width";
+static gchar *DefaultHeight = "GnomeDialog|GtkWindow::default_height";
+static gchar *Shrink = "GnomeDialogl|GtkWindow::allow_shrink";
+static gchar *Grow = "GnomeDialog|GtkWindow::allow_grow";
+static gchar *AutoShrink = "GnomeDialog|GtkWindow::auto_shrink";
+static gchar *IconName = "GnomeDialog|GtkWindow::icon_name";
+static gchar *FocusOnMap = "GnomeDialog|GtkWindow::focus_on_map";
+
+static gchar *Resizable = "GnomeDialog|GtkWindow::resizable";
+static gchar *DestroyWithParent = "GnomeDialog|GtkWindow::destroy_with_parent";
+static gchar *Icon = "GnomeDialog|GtkWindow::icon";
+
+static gchar *Role = "GnomeDialog|GtkWindow::role";
+static gchar *TypeHint = "GnomeDialog|GtkWindow::type_hint";
+static gchar *SkipTaskbar = "GnomeDialog|GtkWindow::skip_taskbar_hint";
+static gchar *SkipPager = "GnomeDialog|GtkWindow::skip_pager_hint";
+static gchar *Decorated = "GnomeDialog|GtkWindow::decorated";
+static gchar *Gravity = "GnomeDialog|GtkWindow::gravity";
+static gchar *Urgency = "GnomeDialog|GtkWindow::urgency_hint";
+
+static gchar *AutoClose = "GnomeDialog::auto_close";
+static gchar *HideOnClose = "GnomeDialog::hide_on_close";
+
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeDialog, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_dialog_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget, *placeholder;
+ GList *elem;
+
+ if (data->action == GB_CREATING)
+ {
+ /* When creating a new dialog, we add a few standard buttons, which
+ the user can change/delete easily. */
+ new_widget = gnome_dialog_new (NULL,
+ GTK_STOCK_CANCEL,
+ GTK_STOCK_OK,
+ NULL);
+
+ /* Now turn the buttons into GbWidgets so the user can edit them. */
+ elem = GNOME_DIALOG (new_widget)->buttons;
+ gb_widget_create_from (GTK_WIDGET (elem->data), "button");
+ gtk_object_set_data (GTK_OBJECT (elem->data), GladeButtonStockIDKey,
+ GTK_STOCK_CANCEL);
+
+ elem = elem->next;
+ gb_widget_create_from (GTK_WIDGET (elem->data), "button");
+ gtk_object_set_data (GTK_OBJECT (elem->data), GladeButtonStockIDKey,
+ GTK_STOCK_OK);
+
+ /* We need to size the placeholders or the dialog is very small. */
+ placeholder = editor_new_placeholder ();
+ gtk_widget_set_usize (placeholder, 300, 200);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (new_widget)->vbox),
+ placeholder, TRUE, TRUE, 0);
+ }
+ else
+ {
+ /* When loading we create the bare dialog with no buttons. */
+ new_widget = gnome_dialog_new (NULL, NULL);
+ }
+
+ gb_widget_create_from (GNOME_DIALOG (new_widget)->vbox,
+ data->action == GB_CREATING ? "dialog-vbox" : NULL);
+ gb_widget_set_child_name (GNOME_DIALOG (new_widget)->vbox, GladeChildDialogVBox);
+
+ gb_widget_create_from (GNOME_DIALOG (new_widget)->action_area,
+ data->action == GB_CREATING ? "dialog-action_area"
+ : NULL);
+ gb_widget_set_child_name (GNOME_DIALOG (new_widget)->action_area,
+ GladeChildDialogActionArea);
+
+ /* We connect a close signal handler which always returns TRUE so that
+ the built-in close functionality is skipped. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "close",
+ GTK_SIGNAL_FUNC (gtk_true), NULL);
+
+ /* Now we connect our normal delete_event handler. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
+ GTK_SIGNAL_FUNC (editor_close_window), NULL);
+
+ gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
+ GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));
+
+ return new_widget;
+}
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_dialog_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ gb_window_create_standard_properties (widget, data,
+ Title, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+ property_add_bool (AutoClose, _("Auto Close:"),
+ _("If the dialog closes when any button is clicked"));
+ property_add_bool (HideOnClose, _("Hide on Close:"),
+ _("If the dialog is hidden when it is closed, instead of being destroyed"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_dialog_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_window_get_standard_properties (widget, data,
+ Title, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ gb_widget_output_bool (data, AutoClose, GNOME_DIALOG (widget)->click_closes);
+ gb_widget_output_bool (data, HideOnClose, GNOME_DIALOG (widget)->just_hide);
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_dialog_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gboolean auto_close, hide_on_close;
+
+ gb_window_set_standard_properties (widget, data,
+ Title, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ auto_close = gb_widget_input_bool (data, AutoClose);
+ if (data->apply)
+ gnome_dialog_set_close (GNOME_DIALOG (widget), auto_close);
+
+ hide_on_close = gb_widget_input_bool (data, HideOnClose);
+ if (data->apply)
+ gnome_dialog_close_hides (GNOME_DIALOG (widget), hide_on_close);
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeDialog, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_dialog_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_dialog_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ gchar *wname, *child_name;
+ gboolean translatable, context;
+ gchar *comments;
+
+ if (data->create_widget)
+ {
+ gchar *title;
+
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ title = GTK_WINDOW (widget)->title;
+ source_add (data, " %s = gnome_dialog_new (%s, NULL);\n",
+ data->wname,
+ title ? source_make_string_full (title, data->use_gettext && translatable, context)
+ : "NULL");
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ /* The title is already set above, so we pass NULL to skip it. */
+ gb_window_write_standard_source (widget, data,
+ NULL, Type, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ if (GNOME_DIALOG (widget)->click_closes)
+ {
+ source_add (data,
+ " gnome_dialog_set_close (GNOME_DIALOG (%s), TRUE);\n",
+ data->wname);
+ }
+
+ if (GNOME_DIALOG (widget)->just_hide)
+ {
+ source_add (data,
+ " gnome_dialog_close_hides (GNOME_DIALOG (%s), TRUE);\n",
+ data->wname);
+ }
+
+ /* We output the source code for the children here, since the code should
+ not include calls to create the widgets. We need to specify that the
+ names used are like: "GTK_DIALOG (<dialog-name>)->vbox".
+ We need to remember the dialog's name since data->wname
+ will be overwritten. */
+ wname = g_strdup (data->wname);
+
+ source_add (data, "\n");
+ child_name = (char*) gtk_widget_get_name (GNOME_DIALOG (widget)->vbox);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data, " %s = GNOME_DIALOG (%s)->vbox;\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (GNOME_DIALOG (widget)->vbox, data);
+
+ /* action_area is a child of vbox so I had to add a kludge to stop it
+ being written as a normal child - we need to do it here so that we
+ don't output code to create it. */
+ child_name = (char*) gtk_widget_get_name (GNOME_DIALOG (widget)->action_area);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data, " %s = GNOME_DIALOG (%s)->action_area;\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (GNOME_DIALOG (widget)->action_area, data);
+
+ g_free (wname);
+ data->write_children = FALSE;
+}
+
+
+static GtkWidget *
+gb_gnome_dialog_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildDialogVBox))
+ return GNOME_DIALOG (widget)->vbox;
+ else if (!strcmp (child_name, GladeChildDialogActionArea))
+ return GNOME_DIALOG (widget)->action_area;
+ else
+ return NULL;
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_dialog_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_dialog_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_dialog_xpm;
+ gbwidget.tooltip = _("Gnome Dialog Box");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_dialog_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_dialog_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_dialog_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_dialog_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_dialog_write_source;
+ gbwidget.gb_widget_get_child = gb_gnome_dialog_get_child;
+ gbwidget.gb_widget_destroy = gb_window_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_dialog_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomedruid.c b/tools/glade/glade/gnome/gnomedruid.c
new file mode 100644
index 00000000..aa3a7aa9
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomedruid.c
@@ -0,0 +1,499 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+#include "../tree.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-druid.xpm"
+
+const char *ShowHelp = "GnomeDruid::show_help";
+
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+
+static void show_druid_dialog (GbWidgetNewData * data);
+static void on_druid_dialog_ok (GtkWidget * widget,
+ GbWidgetNewData * data);
+static void on_druid_dialog_destroy (GtkWidget * widget,
+ GbWidgetNewData * data);
+
+static void gb_gnome_druid_add_start_page (GtkWidget * menuitem,
+ GnomeDruid *druid);
+static void gb_gnome_druid_add_finish_page (GtkWidget * menuitem,
+ GnomeDruid *druid);
+static void gb_gnome_druid_insert_page_before (GtkWidget * menuitem,
+ GnomeDruidPage *page);
+static void gb_gnome_druid_insert_page_after (GtkWidget * menuitem,
+ GnomeDruidPage *page);
+static void gb_gnome_druid_show_page (GtkWidget *parent,
+ GtkWidget *new_page);
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeDruid, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_druid_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ if (data->action == GB_LOADING)
+ {
+ new_widget = gnome_druid_new ();
+ return new_widget;
+ }
+ else
+ {
+ show_druid_dialog (data);
+ return NULL;
+ }
+}
+
+
+static void
+show_druid_dialog (GbWidgetNewData * data)
+{
+ GtkWidget *dialog, *vbox, *hbox, *label, *spinbutton;
+ GtkObject *adjustment;
+
+ dialog = glade_util_create_dialog (_("New Gnome Druid"), data->parent,
+ GTK_SIGNAL_FUNC (on_druid_dialog_ok),
+ data, &vbox);
+ gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
+ GTK_SIGNAL_FUNC (on_druid_dialog_destroy), data);
+
+ hbox = gtk_hbox_new (FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
+ gtk_widget_show (hbox);
+
+ label = gtk_label_new (_("Number of Pages:"));
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 5);
+ gtk_widget_show (label);
+
+ adjustment = gtk_adjustment_new (3, 2, 100, 1, 10, 10);
+ spinbutton = glade_util_spin_button_new (GTK_OBJECT (dialog), "pages",
+ GTK_ADJUSTMENT (adjustment), 1, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, TRUE, 5);
+ gtk_widget_set_usize (spinbutton, 50, -1);
+ gtk_widget_grab_focus (spinbutton);
+ gtk_widget_show (spinbutton);
+
+ gtk_widget_show (dialog);
+ gtk_grab_add (dialog);
+}
+
+
+static void
+on_druid_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
+{
+ GtkWidget *new_widget, *spinbutton, *window, *page;
+ gint pages, i;
+
+ window = gtk_widget_get_toplevel (widget);
+
+ /* Only call callback if placeholder/fixed widget is still there */
+ if (gb_widget_can_finish_new (data))
+ {
+ spinbutton = gtk_object_get_data (GTK_OBJECT (window), "pages");
+ g_return_if_fail (spinbutton != NULL);
+ pages = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));
+
+ new_widget = gnome_druid_new ();
+ page = gnome_druid_page_edge_new_aa (GNOME_EDGE_START);
+ gb_widget_create_from (page, "GnomeDruidPageStart");
+ gnome_druid_append_page (GNOME_DRUID (new_widget),
+ GNOME_DRUID_PAGE (page));
+ gnome_druid_set_page (GNOME_DRUID (new_widget), GNOME_DRUID_PAGE (page));
+
+ for (i = 0; i < pages - 2; i++)
+ {
+ page = gb_widget_new ("GnomeDruidPageStandard", new_widget);
+ gnome_druid_append_page (GNOME_DRUID (new_widget),
+ GNOME_DRUID_PAGE (page));
+ }
+
+ if (pages >= 2)
+ {
+ page = gnome_druid_page_edge_new_aa (GNOME_EDGE_FINISH);
+ gb_widget_create_from (page, "GnomeDruidPageFinish");
+ gnome_druid_append_page (GNOME_DRUID (new_widget),
+ GNOME_DRUID_PAGE (page));
+ }
+
+ gtk_widget_show_all (new_widget);
+ gb_widget_initialize (new_widget, data);
+ (*data->callback) (new_widget, data);
+ }
+ gtk_widget_destroy (window);
+}
+
+
+static void
+on_druid_dialog_destroy (GtkWidget * widget,
+ GbWidgetNewData * data)
+{
+ gb_widget_free_new_data (data);
+ gtk_grab_remove (widget);
+}
+
+
+void
+gb_gnome_druid_add_child (GtkWidget *widget,
+ GtkWidget *child,
+ GbWidgetSetArgData *data)
+{
+ gnome_druid_append_page (GNOME_DRUID (widget), GNOME_DRUID_PAGE (child));
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_druid_create_properties (GtkWidget *widget,
+ GbWidgetCreateArgData *data)
+{
+ property_add_bool (ShowHelp, _("Show Help"), _("Display the help button."));
+}
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_druid_get_properties (GtkWidget *widget,
+ GbWidgetGetArgData *data)
+{
+ gboolean show_help;
+
+ g_object_get (G_OBJECT (widget),
+ "show-help", &show_help,
+ NULL);
+
+ gb_widget_output_bool (data, ShowHelp, show_help);
+}
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_druid_set_properties (GtkWidget *widget,
+ GbWidgetSetArgData *data)
+{
+ gboolean show_help;
+
+ show_help = gb_widget_input_bool (data, ShowHelp);
+ if (data->apply)
+ g_object_set (G_OBJECT (widget), "show-help", show_help, NULL);
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeDruid, with signals pointing to
+ * other functions in this file.
+ */
+static void
+gb_gnome_druid_create_popup_menu (GtkWidget * widget,
+ GbWidgetCreateMenuData * data)
+{
+ GtkWidget *menuitem;
+ GnomeDruid *druid;
+ GList *children, *elem;
+
+ if (data->child == NULL)
+ return;
+
+ g_return_if_fail (GNOME_IS_DRUID (data->child->parent));
+ druid = GNOME_DRUID (data->child->parent);
+
+ children = gtk_container_get_children (GTK_CONTAINER (widget));
+
+ /* 'Add Start Page' is added if the druid has no pages or the first one
+ is not a start page. */
+ if (!children ||
+ !(GNOME_IS_DRUID_PAGE_EDGE (children->data) &&
+ GNOME_DRUID_PAGE_EDGE (children->data)->position == GNOME_EDGE_START))
+ {
+ menuitem = gtk_menu_item_new_with_label (_("Add Start Page"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_gnome_druid_add_start_page),
+ druid);
+ }
+
+ /* 'Add Finish Page' is added if the druid has no pages or the last one
+ is not a finish page. */
+ elem = g_list_last (children);
+ if (!elem ||
+ !(GNOME_IS_DRUID_PAGE_EDGE (elem->data) &&
+ GNOME_DRUID_PAGE_EDGE (elem->data)->position == GNOME_EDGE_FINISH))
+ {
+ menuitem = gtk_menu_item_new_with_label (_("Add Finish Page"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_gnome_druid_add_finish_page),
+ druid);
+ }
+
+ g_list_free (children);
+
+ /* 'Insert Page Before' is added if the current page is not the start page.
+ */
+ if (!(GNOME_IS_DRUID_PAGE_EDGE (data->child) &&
+ GNOME_DRUID_PAGE_EDGE (data->child)->position == GNOME_EDGE_START))
+ {
+ menuitem = gtk_menu_item_new_with_label (_("Insert Page Before"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_gnome_druid_insert_page_before),
+ data->child);
+ }
+
+ /* 'Insert Page After' is added if the current page is not the finish page.
+ */
+ if (!(GNOME_IS_DRUID_PAGE_EDGE (data->child) &&
+ GNOME_DRUID_PAGE_EDGE (data->child)->position == GNOME_EDGE_FINISH))
+ {
+ menuitem = gtk_menu_item_new_with_label (_("Insert Page After"));
+ gtk_widget_show (menuitem);
+ gtk_menu_append (GTK_MENU (data->menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (gb_gnome_druid_insert_page_after),
+ data->child);
+ }
+}
+
+
+static void
+gb_gnome_druid_add_start_page (GtkWidget * menuitem,
+ GnomeDruid *druid)
+{
+ GtkWidget *new_page;
+
+ new_page = gnome_druid_page_edge_new_aa (GNOME_EDGE_START);
+ gb_widget_create_from (new_page, "GnomeDruidPageStart");
+ gtk_widget_show_all (new_page);
+
+ gnome_druid_prepend_page (druid, GNOME_DRUID_PAGE (new_page));
+
+ gb_gnome_druid_show_page (GTK_WIDGET (druid), new_page);
+
+ gnome_druid_set_page (druid, GNOME_DRUID_PAGE (new_page));
+ tree_add_widget (GTK_WIDGET (new_page));
+}
+
+
+static void
+gb_gnome_druid_add_finish_page (GtkWidget * menuitem,
+ GnomeDruid *druid)
+{
+ GtkWidget *new_page;
+
+ new_page = gnome_druid_page_edge_new_aa (GNOME_EDGE_FINISH);
+ gb_widget_create_from (new_page, "GnomeDruidPageFinish");
+ gtk_widget_show_all (new_page);
+
+ gnome_druid_append_page (druid, GNOME_DRUID_PAGE (new_page));
+
+ gb_gnome_druid_show_page (GTK_WIDGET (druid), new_page);
+
+ gnome_druid_set_page (druid, GNOME_DRUID_PAGE (new_page));
+ tree_add_widget (GTK_WIDGET (new_page));
+}
+
+
+static void
+gb_gnome_druid_insert_page_before (GtkWidget * menuitem,
+ GnomeDruidPage *page)
+{
+ GtkWidget *parent, *new_page;
+ GnomeDruidPage *prev_page;
+ GList *children, *elem;
+
+ parent = GTK_WIDGET (page)->parent;
+ g_return_if_fail (GNOME_IS_DRUID (parent));
+
+ children = gtk_container_get_children (GTK_CONTAINER (parent));
+ elem = g_list_find (children, page);
+ g_return_if_fail (elem != NULL);
+
+ new_page = gb_widget_new ("GnomeDruidPageStandard", parent);
+ gtk_widget_show_all (new_page);
+
+ if (elem->prev)
+ prev_page = GNOME_DRUID_PAGE (elem->prev->data);
+ else
+ prev_page = NULL;
+
+ g_list_free (children);
+
+ gnome_druid_insert_page (GNOME_DRUID (parent), prev_page,
+ GNOME_DRUID_PAGE (new_page));
+
+ gb_gnome_druid_show_page (parent, new_page);
+
+ gnome_druid_set_page (GNOME_DRUID (parent), GNOME_DRUID_PAGE (new_page));
+ tree_add_widget (GTK_WIDGET (new_page));
+}
+
+
+static void
+gb_gnome_druid_insert_page_after (GtkWidget * menuitem,
+ GnomeDruidPage *page)
+{
+ GtkWidget *parent, *new_page;
+
+ parent = GTK_WIDGET (page)->parent;
+ g_return_if_fail (GNOME_IS_DRUID (parent));
+
+ new_page = gb_widget_new ("GnomeDruidPageStandard", parent);
+ gtk_widget_show_all (new_page);
+
+ gnome_druid_insert_page (GNOME_DRUID (parent),
+ GNOME_DRUID_PAGE (page),
+ GNOME_DRUID_PAGE (new_page));
+
+ gb_gnome_druid_show_page (parent, new_page);
+
+ gnome_druid_set_page (GNOME_DRUID (parent), GNOME_DRUID_PAGE (new_page));
+ tree_add_widget (GTK_WIDGET (new_page));
+}
+
+
+/* FIXME: GnomeDruid bug workaround. */
+static void
+gb_gnome_druid_show_page (GtkWidget *parent, GtkWidget *new_page)
+{
+ /* Hopefully we don't need this for GNOME 2. */
+#if 0
+ if (GTK_WIDGET_REALIZED (parent))
+ gtk_widget_realize (new_page);
+
+ if (GTK_WIDGET_VISIBLE (parent) && GTK_WIDGET_VISIBLE (new_page))
+ {
+ if (GTK_WIDGET_MAPPED (parent))
+ gtk_widget_map (new_page);
+
+ gtk_widget_queue_resize (new_page);
+ }
+#endif
+}
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_druid_write_source (GtkWidget * widget,
+ GbWidgetWriteSourceData * data)
+{
+ gboolean show_help;
+
+ if (data->create_widget)
+ {
+ source_add (data, " %s = gnome_druid_new ();\n", data->wname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ g_object_get (G_OBJECT (widget),
+ "show-help", &show_help,
+ NULL);
+
+ if (show_help)
+ {
+ source_add (data,
+ " gnome_druid_set_show_help (GNOME_DRUID (%s), TRUE);\n",
+ data->wname);
+ }
+}
+
+
+/* Outputs source to add a child widget to a table. */
+static void
+gb_gnome_druid_write_add_child_source (GtkWidget * parent,
+ const gchar *parent_name,
+ GtkWidget *child,
+ GbWidgetWriteSourceData * data)
+{
+ source_add (data,
+ " gnome_druid_append_page (GNOME_DRUID (%s),\n"
+ " GNOME_DRUID_PAGE (%s));\n",
+ parent_name, data->wname);
+}
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_druid_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_druid_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_druid_xpm;
+ gbwidget.tooltip = _("Druid");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_druid_new;
+ gbwidget.gb_widget_add_child = gb_gnome_druid_add_child;
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_druid_create_popup_menu;
+ gbwidget.gb_widget_write_source = gb_gnome_druid_write_source;
+ gbwidget.gb_widget_write_add_child_source = gb_gnome_druid_write_add_child_source;
+ gbwidget.gb_widget_create_properties = gb_gnome_druid_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_druid_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_druid_set_properties;
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomedruidpageedge.c b/tools/glade/glade/gnome/gnomedruidpageedge.c
new file mode 100644
index 00000000..2578d7ba
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomedruidpageedge.c
@@ -0,0 +1,537 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-druid-page-start.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *BackgroundColor = "GnomeDruidPageEdge::background_color";
+static gchar *LogoBackgroundColor = "GnomeDruidPageEdge::logo_background_color";
+static gchar *TextboxColor = "GnomeDruidPageEdge::textbox_color";
+static gchar *TextColor = "GnomeDruidPageEdge::text_color";
+static gchar *TitleColor = "GnomeDruidPageEdge::title_color";
+static gchar *Text = "GnomeDruidPageEdge::text";
+static gchar *Title = "GnomeDruidPageEdge::title";
+static gchar *LogoImage = "GnomeDruidPageEdge::logo";
+static gchar *Watermark = "GnomeDruidPageEdge::watermark";
+static gchar *TopWatermark = "GnomeDruidPageEdge::top_watermark";
+static gchar *Position = "GnomeDruidPageEdge::position";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeDruidPageEdge, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_druid_page_edge_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+ GnomeEdgePosition position = GNOME_EDGE_START;
+
+ if (data->action == GB_LOADING)
+ {
+ char *position_string = load_string (data->loading_data, Position);
+ if (position_string && *position_string)
+ {
+ position = glade_enum_from_string (GNOME_TYPE_EDGE_POSITION,
+ position_string);
+ }
+ else
+ {
+ g_warning ("no position property in XML file. Defaulting to GNOME_EDGE_START");
+ }
+ }
+ else
+ {
+ g_warning ("gb_gnome_druid_page_edge_new() called to create widget. Defaulting to GNOME_EDGE_START");
+ }
+
+ new_widget = gnome_druid_page_edge_new (position);
+
+ return new_widget;
+}
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_druid_page_edge_create_properties (GtkWidget * widget,
+ GbWidgetCreateArgData * data)
+{
+ property_add_string (Title, _("Title:"),
+ _("The title of the page"));
+ property_add_text (Text, _("Text:"),
+ _("The main text of the page, "
+ "introducing people to the druid."), 5);
+ property_add_color (TitleColor, _("Title Color:"),
+ _("The color of the title text"));
+ property_add_color (TextColor, _("Text Color:"),
+ _("The color of the main text"));
+ property_add_color (BackgroundColor, _("Back. Color:"),
+ _("The background color of the page"));
+ property_add_color (LogoBackgroundColor, _("Logo Back. Color:"),
+ _("The background color around the logo"));
+ property_add_color (TextboxColor, _("Text Box Color:"),
+ _("The background color of the main text area"));
+ property_add_filename (LogoImage, _("Logo Image:"),
+ _("The logo to display in the top-right of the page"));
+ property_add_filename (Watermark, _("Side Watermark:"),
+ _("The main image to display on the side of the page."));
+ property_add_filename (TopWatermark, _("Top Watermark:"),
+ _("The watermark to display at the top of the page."));
+}
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_druid_page_edge_get_properties (GtkWidget *widget,
+ GbWidgetGetArgData * data)
+{
+ GnomeDruidPageEdge *page;
+
+ page = GNOME_DRUID_PAGE_EDGE (widget);
+
+ if (data->action == GB_SAVING)
+ {
+ save_string (data, Position,
+ glade_string_from_enum (GNOME_TYPE_EDGE_POSITION,
+ page->position));
+ }
+
+ gb_widget_output_translatable_string (data, Title, gtk_object_get_data (GTK_OBJECT (widget), Title));
+ gb_widget_output_translatable_text (data, Text, page->text);
+
+ /* We do this to make sure the colors are set. */
+ gtk_widget_ensure_style (widget);
+
+ /* Only save colors if they have been set explicitly. */
+ if (data->action == GB_SHOWING
+ || gtk_object_get_data (GTK_OBJECT (widget), TitleColor))
+ gb_widget_output_color (data, TitleColor, &page->title_color);
+
+ if (data->action == GB_SHOWING
+ || gtk_object_get_data (GTK_OBJECT (widget), TextColor))
+ gb_widget_output_color (data, TextColor, &page->text_color);
+
+ if (data->action == GB_SHOWING
+ || gtk_object_get_data (GTK_OBJECT (widget), BackgroundColor))
+ gb_widget_output_color (data, BackgroundColor, &page->background_color);
+
+ if (data->action == GB_SHOWING
+ || gtk_object_get_data (GTK_OBJECT (widget), LogoBackgroundColor))
+ gb_widget_output_color (data, LogoBackgroundColor,
+ &page->logo_background_color);
+
+ if (data->action == GB_SHOWING
+ || gtk_object_get_data (GTK_OBJECT (widget), TextboxColor))
+ gb_widget_output_color (data, TextboxColor, &page->textbox_color);
+
+ gb_widget_output_pixmap_filename (data, LogoImage,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ LogoImage));
+ gb_widget_output_pixmap_filename (data, Watermark,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ Watermark));
+
+ gb_widget_output_pixmap_filename (data, TopWatermark,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ TopWatermark));
+}
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+
+static void
+gb_gnome_druid_page_edge_set_properties (GtkWidget * widget,
+ GbWidgetSetArgData * data)
+{
+ GnomeDruidPageEdge *page;
+ gchar *string, *old_filename;
+ GdkColor *color;
+ GdkPixbuf *pb;
+
+ page = GNOME_DRUID_PAGE_EDGE (widget);
+
+ string = gb_widget_input_string (data, Title);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), Title, g_strdup (string));
+ gnome_druid_page_edge_set_title (page, string);
+ }
+
+ string = gb_widget_input_text (data, Text);
+ if (data->apply)
+ gnome_druid_page_edge_set_text (page, string);
+ if (data->action == GB_APPLYING)
+ g_free (string);
+
+ /* For colors, we store a flag to indicate if the color has been set.
+ Unfortunately the only way to reset a color to the default at present is
+ to remove it from the XML file. */
+ color = gb_widget_input_color (data, BackgroundColor);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), BackgroundColor, "Y");
+ gnome_druid_page_edge_set_bg_color (page, color);
+ }
+
+ color = gb_widget_input_color (data, LogoBackgroundColor);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), LogoBackgroundColor, "Y");
+ gnome_druid_page_edge_set_logo_bg_color (page, color);
+ }
+
+ color = gb_widget_input_color (data, TextboxColor);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), TextboxColor, "Y");
+ gnome_druid_page_edge_set_textbox_color (page, color);
+ }
+
+ color = gb_widget_input_color (data, TextColor);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), TextColor, "Y");
+ gnome_druid_page_edge_set_text_color (page, color);
+ }
+
+ color = gb_widget_input_color (data, TitleColor);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), TitleColor, "Y");
+ gnome_druid_page_edge_set_title_color (page, color);
+ }
+
+ string = gb_widget_input_pixmap_filename (data, LogoImage);
+ if (data->apply)
+ {
+ if (string && string[0] == '\0')
+ string = NULL;
+ old_filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
+ glade_project_remove_pixmap (data->project, old_filename);
+ gtk_object_set_data_full (GTK_OBJECT (widget), LogoImage,
+ g_strdup (string), string ? g_free : NULL);
+ glade_project_add_pixmap (data->project, string);
+ pb = string ? gdk_pixbuf_new_from_file (string, NULL) : NULL;
+ gnome_druid_page_edge_set_logo (page, pb);
+ if (pb)
+ gdk_pixbuf_unref (pb);
+ }
+ if (data->action == GB_LOADING)
+ g_free (string);
+
+ string = gb_widget_input_pixmap_filename (data, Watermark);
+ if (data->apply)
+ {
+ if (string && string[0] == '\0')
+ string = NULL;
+ old_filename = gtk_object_get_data (GTK_OBJECT (widget), Watermark);
+ glade_project_remove_pixmap (data->project, old_filename);
+ gtk_object_set_data_full (GTK_OBJECT (widget), Watermark,
+ g_strdup (string), string ? g_free : NULL);
+ glade_project_add_pixmap (data->project, string);
+ pb = string ? gdk_pixbuf_new_from_file (string, NULL) : NULL;
+ gnome_druid_page_edge_set_watermark (page, pb);
+ if (pb)
+ gdk_pixbuf_unref (pb);
+ }
+ if (data->action == GB_LOADING)
+ g_free (string);
+
+ string = gb_widget_input_pixmap_filename (data, TopWatermark);
+ if (data->apply)
+ {
+ if (string && string[0] == '\0')
+ string = NULL;
+ old_filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
+ glade_project_remove_pixmap (data->project, old_filename);
+ gtk_object_set_data_full (GTK_OBJECT (widget), TopWatermark,
+ g_strdup (string), string ? g_free : NULL);
+ glade_project_add_pixmap (data->project, string);
+ pb = string ? gdk_pixbuf_new_from_file (string, NULL) : NULL;
+ gnome_druid_page_edge_set_top_watermark (page, pb);
+ if (pb)
+ gdk_pixbuf_unref (pb);
+ }
+ if (data->action == GB_LOADING)
+ g_free (string);
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeDruidPageEdge, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_druid_page_edge_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_druid_page_edge_write_source (GtkWidget * widget,
+ GbWidgetWriteSourceData * data)
+{
+ GnomeDruidPageEdge *page;
+ GdkColor *color;
+ gchar *filename, *title;
+ gboolean translatable, context;
+ gchar *comments;
+
+ g_return_if_fail (GNOME_IS_DRUID (widget->parent));
+ page = GNOME_DRUID_PAGE_EDGE (widget);
+
+ /* We do this to make sure the colors are set. */
+ gtk_widget_ensure_style (widget);
+
+ if (data->create_widget)
+ {
+ const char *position = glade_string_from_enum (GNOME_TYPE_EDGE_POSITION,
+ page->position);
+
+ source_add (data, " %s = gnome_druid_page_edge_new (%s);\n",
+ data->wname, position);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ color = &page->background_color;
+ if (gtk_object_get_data (GTK_OBJECT (widget), BackgroundColor))
+ {
+ source_add_decl (data,
+ " GdkColor %s_bg_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ color->red, color->green, color->blue);
+ source_add (data,
+ " gnome_druid_page_edge_set_bg_color (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " &%s_bg_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ color = &page->textbox_color;
+ if (gtk_object_get_data (GTK_OBJECT (widget), TextboxColor))
+ {
+ source_add_decl (data,
+ " GdkColor %s_textbox_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ color->red, color->green, color->blue);
+ source_add (data,
+ " gnome_druid_page_edge_set_textbox_color (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " &%s_textbox_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ color = &page->logo_background_color;
+ if (gtk_object_get_data (GTK_OBJECT (widget), LogoBackgroundColor))
+ {
+ source_add_decl (data,
+ " GdkColor %s_logo_bg_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ color->red, color->green, color->blue);
+ source_add (data,
+ " gnome_druid_page_edge_set_logo_bg_color (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " &%s_logo_bg_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ color = &page->title_color;
+ if (gtk_object_get_data (GTK_OBJECT (widget), TitleColor))
+ {
+ source_add_decl (data,
+ " GdkColor %s_title_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ color->red, color->green, color->blue);
+ source_add (data,
+ " gnome_druid_page_edge_set_title_color (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " &%s_title_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ color = &page->text_color;
+ if (gtk_object_get_data (GTK_OBJECT (widget), TextColor))
+ {
+ source_add_decl (data,
+ " GdkColor %s_text_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ color->red, color->green, color->blue);
+ source_add (data,
+ " gnome_druid_page_edge_set_text_color (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " &%s_text_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ title = gtk_object_get_data (GTK_OBJECT (widget), Title);
+ if (title && *title)
+ {
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data,
+ " gnome_druid_page_edge_set_title (GNOME_DRUID_PAGE_EDGE (%s), %s);\n",
+ data->wname,
+ source_make_string_full (title, data->use_gettext && translatable, context));
+ }
+
+ if (page->text && strcmp (page->text, ""))
+ {
+ glade_util_get_translation_properties (widget, Text, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data,
+ " gnome_druid_page_edge_set_text (GNOME_DRUID_PAGE_EDGE (%s), %s);\n",
+ data->wname,
+ source_make_string_full (page->text, data->use_gettext && translatable, context));
+ }
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
+ if (filename && filename[0])
+ {
+ source_ensure_decl (data, " GdkPixbuf *tmp_pixbuf;\n");
+
+ source_add (data,
+ " tmp_pixbuf = create_pixbuf (\"%s/%s\");\n"
+ " if (tmp_pixbuf)\n"
+ " {\n"
+ " gnome_druid_page_edge_set_logo (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " tmp_pixbuf);\n"
+ " gdk_pixbuf_unref (tmp_pixbuf);\n"
+ " }\n",
+ data->program_name, g_basename (filename), data->wname);
+ }
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), Watermark);
+ if (filename && filename[0])
+ {
+ source_ensure_decl (data, " GdkPixbuf *tmp_pixbuf;\n");
+
+ source_add (data,
+ " tmp_pixbuf = create_pixbuf (\"%s/%s\");\n"
+ " if (tmp_pixbuf)\n"
+ " {\n"
+ " gnome_druid_page_edge_set_watermark (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " tmp_pixbuf);\n"
+ " gdk_pixbuf_unref (tmp_pixbuf);\n"
+ " }\n",
+ data->program_name, g_basename (filename), data->wname);
+ }
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
+ if (filename && filename[0])
+ {
+ source_ensure_decl (data, " GdkPixbuf *tmp_pixbuf;\n");
+
+ source_add (data,
+ " tmp_pixbuf = create_pixbuf (\"%s/%s\");\n"
+ " if (tmp_pixbuf)\n"
+ " {\n"
+ " gnome_druid_page_edge_set_top_watermark (GNOME_DRUID_PAGE_EDGE (%s),\n"
+ " tmp_pixbuf);\n"
+ " gdk_pixbuf_unref (tmp_pixbuf);\n"
+ " }\n",
+ data->program_name, g_basename (filename), data->wname);
+ }
+}
+
+
+
+void
+gb_gnome_druid_page_edge_destroy (GtkWidget * widget,
+ GbWidgetDestroyData * data)
+{
+ gchar *filename;
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
+ glade_project_remove_pixmap (data->project, filename);
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
+ glade_project_remove_pixmap (data->project, filename);
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), Watermark);
+ glade_project_remove_pixmap (data->project, filename);
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_druid_page_edge_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_druid_page_edge_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_druid_page_start_xpm;
+ gbwidget.tooltip = _("Druid Start or Finish Page");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_druid_page_edge_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_druid_page_edge_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_druid_page_edge_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_druid_page_edge_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_druid_page_edge_write_source;
+ gbwidget.gb_widget_destroy = gb_gnome_druid_page_edge_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_druid_page_edge_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomedruidpagestandard.c b/tools/glade/glade/gnome/gnomedruidpagestandard.c
new file mode 100644
index 00000000..97ec324d
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomedruidpagestandard.c
@@ -0,0 +1,463 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-druid-page-standard.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *BackgroundColor = "GnomeDruidPageStandard::background";
+static gchar *LogoBackgroundColor = "GnomeDruidPageStandard::logo_background";
+static gchar *ContentsBackgroundColor = "GnomeDruidPageStandard::contents_background";
+static gchar *TitleColor = "GnomeDruidPageStandard::title_foreground";
+static gchar *Title = "GnomeDruidPageStandard::title";
+static gchar *LogoImage = "GnomeDruidPageStandard::logo";
+static gchar *TopWatermark = "GnomeDruidPageStandard::top_watermark";
+
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeDruidPageStandard, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_druid_page_standard_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget, *placeholder;
+
+ if (data->action == GB_CREATING)
+ {
+ new_widget = gnome_druid_page_standard_new_with_vals ("", NULL, NULL);
+ placeholder = editor_new_placeholder ();
+ gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (new_widget)->vbox),
+ placeholder, TRUE, TRUE, 0);
+ }
+ else
+ {
+ new_widget = gnome_druid_page_standard_new_with_vals ("", NULL, NULL);
+ }
+ gb_widget_create_from (GNOME_DRUID_PAGE_STANDARD (new_widget)->vbox,
+ "druid-vbox");
+ gb_widget_set_child_name (GNOME_DRUID_PAGE_STANDARD (new_widget)->vbox,
+ GladeChildGnomeDruidVBox);
+ gtk_widget_show_all (new_widget);
+ return new_widget;
+}
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_druid_page_standard_create_properties (GtkWidget * widget,
+ GbWidgetCreateArgData * data)
+{
+ property_add_string (Title, _("Title:"),
+ _("The title of the page"));
+ property_add_color (TitleColor, _("Title Color:"),
+ _("The color of the title text"));
+ property_add_color (ContentsBackgroundColor, _("Contents Back. Color:"),
+ _("The background color around the title"));
+ property_add_color (BackgroundColor, _("Back. Color:"),
+ _("The background color of the page"));
+ property_add_color (LogoBackgroundColor, _("Logo Back. Color:"),
+ _("The background color around the logo"));
+ property_add_filename (LogoImage, _("Logo Image:"),
+ _("The logo to display in the top-right of the page"));
+ property_add_filename (TopWatermark, _("Top Watermark:"),
+ _("The image to display along the top of the page"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_druid_page_standard_get_properties (GtkWidget *widget,
+ GbWidgetGetArgData * data)
+{
+ GnomeDruidPageStandard *page;
+ GdkColor *title_color, *background_color, *logo_background_color;
+ gboolean title_color_set, background_color_set, logo_background_color_set;
+
+ page = GNOME_DRUID_PAGE_STANDARD (widget);
+
+ /* We do this to make sure the colors are set. */
+ gtk_widget_ensure_style (widget);
+
+ gb_widget_output_translatable_string (data, Title, page->title);
+
+ g_object_get (G_OBJECT (widget),
+ "title-foreground-set", &title_color_set,
+ "title-foreground-gdk", &title_color,
+ "background-set", &background_color_set,
+ "background-gdk", &background_color,
+ "logo-background-set", &logo_background_color_set,
+ "logo-background-gdk", &logo_background_color,
+ NULL);
+
+ if (data->action == GB_SHOWING || title_color_set)
+ gb_widget_output_color (data, TitleColor, title_color);
+
+ if (data->action == GB_SHOWING || background_color_set)
+ gb_widget_output_color (data, BackgroundColor, background_color);
+
+ if (data->action == GB_SHOWING || logo_background_color_set)
+ gb_widget_output_color (data, LogoBackgroundColor, logo_background_color);
+
+ gdk_color_free (title_color);
+ gdk_color_free (background_color);
+ gdk_color_free (logo_background_color);
+
+ /* FIXME: GNOME 2 bug workaround. It doesn't install the properties for
+ these, so we have to do it ourselves. */
+ if (data->action == GB_SHOWING
+ || gtk_object_get_data (GTK_OBJECT (widget), ContentsBackgroundColor))
+ gb_widget_output_color (data, ContentsBackgroundColor,
+ &page->contents_background);
+
+ gb_widget_output_pixmap_filename (data, LogoImage,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ LogoImage));
+
+ gb_widget_output_pixmap_filename (data, TopWatermark,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ TopWatermark));
+}
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+
+static void
+gb_gnome_druid_page_standard_set_properties (GtkWidget * widget,
+ GbWidgetSetArgData * data)
+{
+ GnomeDruidPageStandard *page;
+ gchar *string, *old_filename;
+ GdkColor *color;
+ GdkPixbuf *image;
+
+ page = GNOME_DRUID_PAGE_STANDARD (widget);
+
+ string = gb_widget_input_string (data, Title);
+ if (data->apply)
+ gnome_druid_page_standard_set_title (page, string);
+
+ color = gb_widget_input_color (data, BackgroundColor);
+ if (data->apply)
+ gnome_druid_page_standard_set_bg_color (page, color);
+
+ color = gb_widget_input_color (data, LogoBackgroundColor);
+ if (data->apply)
+ gnome_druid_page_standard_set_logo_bg_color (page, color);
+
+ color = gb_widget_input_color (data, TitleColor);
+ if (data->apply)
+ gnome_druid_page_standard_set_title_color (page, color);
+
+ color = gb_widget_input_color (data, ContentsBackgroundColor);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), ContentsBackgroundColor, "Y");
+ gnome_druid_page_standard_set_contents_background (page, color);
+ }
+
+ string = gb_widget_input_pixmap_filename (data, LogoImage);
+ if (data->apply)
+ {
+ if (string && string[0] == '\0')
+ string = NULL;
+ old_filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
+ glade_project_remove_pixmap (data->project, old_filename);
+ gtk_object_set_data_full (GTK_OBJECT (widget), LogoImage,
+ g_strdup (string), string ? g_free : NULL);
+ glade_project_add_pixmap (data->project, string);
+ image = string ? gdk_pixbuf_new_from_file (string, NULL) : NULL;
+ gnome_druid_page_standard_set_logo (page, image);
+ if (image)
+ gdk_pixbuf_unref (image);
+ }
+ if (data->action == GB_LOADING)
+ g_free (string);
+
+ string = gb_widget_input_pixmap_filename (data, TopWatermark);
+ if (data->apply)
+ {
+ if (string && string[0] == '\0')
+ string = NULL;
+ old_filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
+ glade_project_remove_pixmap (data->project, old_filename);
+ gtk_object_set_data_full (GTK_OBJECT (widget), TopWatermark,
+ g_strdup (string), string ? g_free : NULL);
+ glade_project_add_pixmap (data->project, string);
+ image = string ? gdk_pixbuf_new_from_file (string, NULL) : NULL;
+ gnome_druid_page_standard_set_top_watermark (page, image);
+ if (image)
+ gdk_pixbuf_unref (image);
+ }
+ if (data->action == GB_LOADING)
+ g_free (string);
+}
+
+static GtkWidget *
+gb_gnome_druid_page_standard_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildGnomeDruidVBox))
+ return GNOME_DRUID_PAGE_STANDARD (widget)->vbox;
+ else
+ return NULL;
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeDruidPageStandard, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_druid_page_standard_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_druid_page_standard_write_source (GtkWidget * widget,
+ GbWidgetWriteSourceData * data)
+{
+ GnomeDruidPageStandard *page;
+ gchar *filename, *title;
+ gchar *wname, *child_name;
+ GdkColor title_color, background_color, logo_background_color;
+ gboolean title_color_set, background_color_set, logo_background_color_set;
+
+ page = GNOME_DRUID_PAGE_STANDARD (widget);
+
+ /* We do this to make sure the colors are set. */
+ gtk_widget_ensure_style (widget);
+
+ if (data->create_widget)
+ {
+ source_add (data,
+ " %s = gnome_druid_page_standard_new ();\n",
+ data->wname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ g_object_get (G_OBJECT (widget),
+ "title-foreground-set", &title_color_set,
+ "title-foreground-gdk", &title_color,
+ "background-set", &background_color_set,
+ "background-gdk", &background_color,
+ "logo-background-set", &logo_background_color_set,
+ "logo-background-gdk", &logo_background_color,
+ "title", &title,
+ NULL);
+
+ if (background_color_set)
+ {
+ source_add_decl (data,
+ " GdkColor %s_bg_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ background_color.red, background_color.green, background_color.blue);
+ source_add (data,
+ " gnome_druid_page_standard_set_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_bg_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ if (logo_background_color_set)
+ {
+ source_add_decl (data,
+ " GdkColor %s_logo_bg_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ logo_background_color.red, logo_background_color.green, logo_background_color.blue);
+ source_add (data,
+ " gnome_druid_page_standard_set_logo_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_logo_bg_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ if (title_color_set)
+ {
+ source_add_decl (data,
+ " GdkColor %s_title_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ title_color.red, title_color.green, title_color.blue);
+ source_add (data,
+ " gnome_druid_page_standard_set_title_foreground (GNOME_DRUID_PAGE_STANDARD (%s), &%s_title_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ if (gtk_object_get_data (GTK_OBJECT (widget), ContentsBackgroundColor))
+ {
+ GdkColor *color = &page->contents_background;
+ source_add_decl (data,
+ " GdkColor %s_contents_bg_color = { 0, %i, %i, %i };\n",
+ data->real_wname,
+ color->red, color->green, color->blue);
+ source_add (data,
+ " gnome_druid_page_standard_set_contents_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_contents_bg_color);\n",
+ data->wname, data->real_wname);
+ }
+
+ if (title && *title)
+ {
+ gboolean translatable, context;
+ gchar *comments;
+
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data,
+ " gnome_druid_page_standard_set_title (GNOME_DRUID_PAGE_STANDARD (%s), %s);\n",
+ data->wname,
+ source_make_string_full (title, data->use_gettext && translatable, context));
+ }
+ g_free (title);
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
+ if (filename && filename[0])
+ {
+ source_ensure_decl (data, " GdkPixbuf *tmp_pixbuf;\n");
+
+ source_add (data,
+ " tmp_pixbuf = create_pixbuf (\"%s/%s\");\n"
+ " if (tmp_pixbuf)\n"
+ " {\n"
+ " gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (%s),\n"
+ " tmp_pixbuf);\n"
+ " gdk_pixbuf_unref (tmp_pixbuf);\n"
+ " }\n",
+ data->program_name, g_basename (filename), data->wname);
+ }
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
+ if (filename && filename[0])
+ {
+ source_ensure_decl (data, " GdkPixbuf *tmp_pixbuf;\n");
+
+ source_add (data,
+ " tmp_pixbuf = create_pixbuf (\"%s/%s\");\n"
+ " if (tmp_pixbuf)\n"
+ " {\n"
+ " gnome_druid_page_standard_set_top_watermark (GNOME_DRUID_PAGE_STANDARD (%s),\n"
+ " tmp_pixbuf);\n"
+ " gdk_pixbuf_unref (tmp_pixbuf);\n"
+ " }\n",
+ data->program_name, g_basename (filename), data->wname);
+ }
+
+ /* We output the source code for the children here, since the code should
+ not include calls to create the widgets. We need to specify that the
+ names used are like: "GTK_COMBO (<combo-name>)->entry".
+ We need to remember the dialog's name since data->wname
+ will be overwritten. */
+ wname = g_strdup (data->wname);
+
+ source_add (data, "\n");
+ child_name = (char*) gtk_widget_get_name (GNOME_DRUID_PAGE_STANDARD (widget)->vbox);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data, " %s = GNOME_DRUID_PAGE_STANDARD (%s)->vbox;\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (GNOME_DRUID_PAGE_STANDARD (widget)->vbox, data);
+
+ g_free (wname);
+ data->write_children = FALSE;
+}
+
+
+void
+gb_gnome_druid_page_standard_destroy (GtkWidget * widget,
+ GbWidgetDestroyData * data)
+{
+ gchar *filename;
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
+ glade_project_remove_pixmap (data->project, filename);
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
+ glade_project_remove_pixmap (data->project, filename);
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_druid_page_standard_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_druid_page_standard_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_druid_page_standard_xpm;
+ gbwidget.tooltip = _("Druid Standard Page");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_druid_page_standard_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_druid_page_standard_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_druid_page_standard_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_druid_page_standard_set_properties;
+ gbwidget.gb_widget_get_child = gb_gnome_druid_page_standard_get_child;
+ gbwidget.gb_widget_write_source = gb_gnome_druid_page_standard_write_source;
+ gbwidget.gb_widget_destroy = gb_gnome_druid_page_standard_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_druid_page_standard_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomeentry.c b/tools/glade/glade/gnome/gnomeentry.c
new file mode 100644
index 00000000..1f190021
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomeentry.c
@@ -0,0 +1,225 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-entry.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *HistoryID = "GnomeEntry::history_id";
+static gchar *MaxSaved = "GnomeEntry::max_saved";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeEntry, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_entry_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = gnome_entry_new (NULL);
+
+ gb_widget_create_from (GTK_COMBO (new_widget)->entry,
+ data->action == GB_CREATING ? "combo-entry" : NULL);
+ gb_widget_set_child_name (GTK_COMBO (new_widget)->entry, GladeChildGnomeEntry);
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_entry_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_string (HistoryID, _("History ID:"),
+ _("The ID to save the history entries under"));
+ property_add_int_range (MaxSaved, _("Max Saved:"),
+ _("The maximum number of history entries saved"),
+ 0, 10000, 1, 10, 1);
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_entry_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_widget_output_string (data, HistoryID, gtk_object_get_data (GTK_OBJECT (widget), HistoryID));
+ gb_widget_output_int (data, MaxSaved, gnome_entry_get_max_saved (GNOME_ENTRY (widget)));
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_entry_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gchar *history_id;
+ gint max_saved;
+
+ history_id = gb_widget_input_string (data, HistoryID);
+ if (data->apply)
+ gtk_object_set_data_full (GTK_OBJECT (widget), HistoryID,
+ g_strdup (history_id),
+ history_id ? g_free : NULL);
+
+ max_saved = gb_widget_input_int (data, MaxSaved);
+ if (data->apply)
+ gnome_entry_set_max_saved (GNOME_ENTRY (widget), max_saved);
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeEntry, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_entry_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_entry_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ gchar *wname, *child_name;
+
+ if (data->create_widget)
+ {
+ gchar *history_id;
+
+ history_id = gtk_object_get_data (GTK_OBJECT (widget), HistoryID);
+ if (history_id && history_id[0])
+ source_add (data, " %s = gnome_entry_new (%s);\n",
+ data->wname, source_make_string (history_id, FALSE));
+ else
+ source_add (data, " %s = gnome_entry_new (NULL);\n",
+ data->wname);
+ }
+ gb_widget_write_standard_source (widget, data);
+
+ /* Note that GLADE_DEFAULT_MAX_HISTORY_SAVED is copied from gnome-entry.c */
+ if (gnome_entry_get_max_saved (GNOME_ENTRY (widget)) != GLADE_DEFAULT_MAX_HISTORY_SAVED)
+ source_add (data, " gnome_entry_set_max_saved (GNOME_ENTRY (%s), %i);\n",
+ data->wname, gnome_entry_get_max_saved (GNOME_ENTRY (widget)));
+
+
+ /* We output the source code for the children here, since the code should
+ not include calls to create the widgets. We need to specify that the
+ names used are like: "GTK_COMBO (<combo-name>)->entry".
+ We need to remember the dialog's name since data->wname
+ will be overwritten. */
+ wname = g_strdup (data->wname);
+
+ source_add (data, "\n");
+ child_name = (char*) gtk_widget_get_name (GTK_COMBO (widget)->entry);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data, " %s = gnome_entry_gtk_entry (GNOME_ENTRY (%s));\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (GTK_COMBO (widget)->entry, data);
+
+ g_free (wname);
+ data->write_children = FALSE;
+}
+
+
+static GtkWidget *
+gb_gnome_entry_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildGnomeEntry))
+ return GTK_COMBO (widget)->entry;
+ else
+ return NULL;
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_entry_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_entry_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_entry_xpm;
+ gbwidget.tooltip = _("Gnome Entry");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_entry_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_entry_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_entry_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_entry_set_properties;
+ gbwidget.gb_widget_get_child = gb_gnome_entry_get_child;
+ gbwidget.gb_widget_write_source = gb_gnome_entry_write_source;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_entry_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomefileentry.c b/tools/glade/glade/gnome/gnomefileentry.c
new file mode 100644
index 00000000..7889659a
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomefileentry.c
@@ -0,0 +1,382 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-fileentry.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Directory = "GnomeFileEntry::directory_entry";
+static gchar *HistoryID = "GnomeFileEntry|GnomeEntry::history_id";
+static gchar *MaxSaved = "GnomeFileEntry|GnomeEntry::max_saved";
+static gchar *Title = "GnomeFileEntry::browse_dialog_title";
+static gchar *Modal = "GnomeFileEntry::modal";
+static gchar *FileChooser = "GnomeFileEntry::use_filechooser";
+
+static gchar *Action = "GnomeFileEntry::filechooser_action";
+
+
+static const gchar *GbActionChoices[] =
+{"Open", "Save", "Select Folder", "Create Folder", NULL};
+static const gint GbActionValues[] =
+{
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+};
+static const gchar *GbActionSymbols[] =
+{
+ "GTK_FILE_CHOOSER_ACTION_OPEN",
+ "GTK_FILE_CHOOSER_ACTION_SAVE",
+ "GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER",
+ "GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER"
+};
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeFileEntry, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_file_entry_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget, *entry;
+
+ new_widget = gnome_file_entry_new (NULL, NULL);
+
+ entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (new_widget));
+ gb_widget_create_from (entry,
+ data->action == GB_CREATING ? "combo-entry" : NULL);
+ gb_widget_set_child_name (entry, GladeChildGnomeEntry);
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_file_entry_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_string (HistoryID, _("History ID:"),
+ _("The ID to save the history entries under"));
+ property_add_int_range (MaxSaved, _("Max Saved:"),
+ _("The maximum number of history entries saved"),
+ 0, 10000, 1, 10, 1);
+ property_add_string (Title, _("Title:"),
+ _("The title of the file selection dialog"));
+ property_add_bool (Directory, _("Directory:"),
+ _("If a directory is needed rather than a file"));
+ property_add_bool (Modal, _("Modal:"),
+ _("If the file selection dialog should be modal"));
+ property_add_bool (FileChooser, _("Use FileChooser:"),
+ _("Use the new GtkFileChooser widget instead of GtkFileSelection"));
+ property_add_choice (Action, _("Action:"),
+ _("The type of file operation being performed"),
+ GbActionChoices);
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_file_entry_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ GtkWidget *gentry;
+ gboolean use_filechooser = FALSE;
+ GtkFileChooserAction action;
+ gint i;
+
+ gentry = gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (widget));
+
+ gb_widget_output_string (data, HistoryID, gtk_object_get_data (GTK_OBJECT (widget), HistoryID));
+ gb_widget_output_int (data, MaxSaved, gnome_entry_get_max_saved (GNOME_ENTRY (gentry)));
+ gb_widget_output_translatable_string (data, Title, gtk_object_get_data (GTK_OBJECT (widget), Title));
+ gb_widget_output_bool (data, Directory,
+ gnome_file_entry_get_directory_entry (GNOME_FILE_ENTRY (widget)));
+ gb_widget_output_bool (data, Modal,
+ gnome_file_entry_get_modal (GNOME_FILE_ENTRY (widget)));
+ g_object_get (G_OBJECT (widget),
+ "use_filechooser", &use_filechooser,
+ "filechooser_action", &action,
+ NULL);
+ gb_widget_output_bool (data, FileChooser, use_filechooser);
+
+ for (i = 0; i < sizeof (GbActionValues) / sizeof (GbActionValues[0]); i++)
+ {
+ if (GbActionValues[i] == action)
+ gb_widget_output_choice (data, Action, i, GbActionSymbols[i]);
+ }
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_file_entry_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ GtkWidget *gentry;
+ gchar *history_id, *title, *action;
+ gint max_saved, i;
+ gboolean directory, modal, use_filechooser;
+
+ gentry = gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (widget));
+
+ history_id = gb_widget_input_string (data, HistoryID);
+ if (data->apply)
+ gtk_object_set_data_full (GTK_OBJECT (widget), HistoryID,
+ g_strdup (history_id),
+ history_id ? g_free : NULL);
+
+ max_saved = gb_widget_input_int (data, MaxSaved);
+ if (data->apply)
+ gnome_entry_set_max_saved (GNOME_ENTRY (gentry), max_saved);
+
+ title = gb_widget_input_string (data, Title);
+ if (data->apply)
+ {
+ gtk_object_set_data_full (GTK_OBJECT (widget), Title, g_strdup (title),
+ title ? g_free : NULL);
+ gnome_file_entry_set_title (GNOME_FILE_ENTRY (widget),
+ title && title[0] ? title : NULL);
+ }
+
+ directory = gb_widget_input_bool (data, Directory);
+ if (data->apply)
+ gnome_file_entry_set_directory_entry (GNOME_FILE_ENTRY (widget), directory);
+
+ modal = gb_widget_input_bool (data, Modal);
+ if (data->apply)
+ gnome_file_entry_set_modal (GNOME_FILE_ENTRY (widget), modal);
+
+ use_filechooser = gb_widget_input_bool (data, FileChooser);
+ if (data->apply)
+ g_object_set (G_OBJECT (widget), "use_filechooser", use_filechooser, NULL);
+
+ action = gb_widget_input_choice (data, Action);
+ if (data->apply)
+ {
+ for (i = 0; i < sizeof (GbActionValues) / sizeof (GbActionValues[0]);
+ i++)
+ {
+ if (!strcmp (action, GbActionChoices[i])
+ || !strcmp (action, GbActionSymbols[i]))
+ {
+ g_object_set (widget, "filechooser_action", GbActionValues[i], NULL);
+ break;
+ }
+ }
+ }
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeFileEntry, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_file_entry_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_file_entry_write_source (GtkWidget * widget,
+ GbWidgetWriteSourceData * data)
+{
+ GtkWidget *gentry, *entry;
+ gchar *title, *history_id;
+ gchar *wname, *child_name;
+ gboolean use_filechooser = FALSE;
+ GtkFileChooserAction action;
+ gboolean translatable, context;
+ gchar *comments;
+
+ gentry = gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (widget));
+
+ title = gtk_object_get_data (GTK_OBJECT (widget), Title);
+ if (title && title[0] == '\0')
+ title = NULL;
+
+ history_id = gtk_object_get_data (GTK_OBJECT (widget), HistoryID);
+ if (history_id && history_id[0] == '\0')
+ history_id = NULL;
+
+ if (data->create_widget)
+ {
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data, " %s = gnome_file_entry_new (%s, ",
+ data->wname,
+ history_id ? source_make_string (history_id, FALSE) : "NULL");
+
+ source_add (data, "%s);\n",
+ title ? source_make_string_full (title, data->use_gettext && translatable, context) : "NULL");
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ /* Note that GLADE_DEFAULT_MAX_HISTORY_SAVED is copied from gnome-entry.c */
+ if (gnome_entry_get_max_saved (GNOME_ENTRY (gentry)) != GLADE_DEFAULT_MAX_HISTORY_SAVED)
+ source_add (data, " gnome_entry_set_max_saved (GNOME_ENTRY (gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (%s))), %i);\n",
+ data->wname,
+ gnome_entry_get_max_saved (GNOME_ENTRY (gentry)));
+
+ if (gnome_file_entry_get_directory_entry (GNOME_FILE_ENTRY (widget)))
+ source_add (data,
+ " gnome_file_entry_set_directory_entry (GNOME_FILE_ENTRY (%s), TRUE);\n",
+ data->wname);
+
+ if (gnome_file_entry_get_modal (GNOME_FILE_ENTRY (widget)))
+ source_add (data,
+ " gnome_file_entry_set_modal (GNOME_FILE_ENTRY (%s), TRUE);\n",
+ data->wname);
+
+ g_object_get (G_OBJECT (widget),
+ "use_filechooser", &use_filechooser,
+ "filechooser_action", &action,
+ NULL);
+
+ if (use_filechooser)
+ {
+ const gchar *action_symbol = GbActionSymbols[0];
+ gint i;
+
+ for (i = 0; i < sizeof (GbActionValues) / sizeof (GbActionValues[0]);
+ i++)
+ {
+ if (GbActionValues[i] == action)
+ action_symbol = GbActionSymbols[i];
+ }
+
+ source_add (data,
+ " g_object_set (G_OBJECT (%s),\n"
+ " \"use_filechooser\", TRUE,\n"
+ " \"filechooser_action\", %s,\n"
+ " NULL);\n",
+ data->wname, action_symbol);
+ }
+
+
+ /* We output the source code for the children here, since the code should
+ not include calls to create the widgets. We need to specify that the
+ names used are like: "GTK_COMBO (<combo-name>)->entry".
+ We need to remember the dialog's name since data->wname
+ will be overwritten. */
+ wname = g_strdup (data->wname);
+
+ source_add (data, "\n");
+ entry = GTK_COMBO (gentry)->entry;
+ child_name = (char*) gtk_widget_get_name (entry);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data,
+ " %s = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (%s));\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (entry, data);
+
+ g_free (wname);
+ data->write_children = FALSE;
+}
+
+
+static GtkWidget *
+gb_gnome_file_entry_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildGnomeEntry))
+ return gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (widget));
+ else
+ return NULL;
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_file_entry_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_file_entry_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_fileentry_xpm;
+ gbwidget.tooltip = _("Gnome File Entry");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_file_entry_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_file_entry_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_file_entry_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_file_entry_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_file_entry_write_source;
+ gbwidget.gb_widget_get_child = gb_gnome_file_entry_get_child;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_file_entry_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomefontpicker.c b/tools/glade/glade/gnome/gnomefontpicker.c
new file mode 100644
index 00000000..5c38972a
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomefontpicker.c
@@ -0,0 +1,406 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+#include "../glade_gnome.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-fontpicker.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+/* Copied from gnome-font-picker.c */
+#define DEF_PREVIEW_TEXT "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
+
+static gchar *Title = "GnomeFontPicker::title";
+static gchar *PreviewText = "GnomeFontPicker::preview_text";
+static gchar *Mode = "GnomeFontPicker::mode";
+static gchar *ShowSize = "GnomeFontPicker::show_size";
+static gchar *UseFont = "GnomeFontPicker::use_font_in_label";
+static gchar *UseFontSize = "GnomeFontPicker::label_font_size";
+static gchar *FocusOnClick = "GnomeFontPicker|GtkButton::focus_on_click";
+
+static const gchar *GbModeChoices[] =
+{
+ "Pixmap",
+ "Font Information",
+ NULL
+};
+static const gint GbModeValues[] =
+{
+ GNOME_FONT_PICKER_MODE_PIXMAP,
+ GNOME_FONT_PICKER_MODE_FONT_INFO
+};
+static const gchar *GbModeSymbols[] =
+{
+ "GNOME_FONT_PICKER_MODE_PIXMAP",
+ "GNOME_FONT_PICKER_MODE_FONT_INFO"
+};
+
+
+static void gb_gnome_font_picker_set_property_states (GtkWidget *widget);
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeFontPicker, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_font_picker_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = gnome_font_picker_new ();
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_font_picker_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_string (Title, _("Title:"),
+ _("The title of the font selection dialog"));
+ property_add_string (PreviewText, _("Preview Text:"),
+ _("The preview text to show in the font selection dialog"));
+ property_add_choice (Mode, _("Mode:"),
+ _("What to display in the font picker button"),
+ GbModeChoices);
+ property_add_bool (ShowSize, _("Show Size:"),
+ _("If the font size is shown as part of the font information"));
+ property_add_bool (UseFont, _("Use Font:"),
+ _("If the selected font is used when displaying the font information"));
+ property_add_int_range (UseFontSize, _("Use Size:"),
+ _("The size of the font to use in the font picker button"),
+ 2, 1000, 1, 10, 1);
+ property_add_bool (FocusOnClick, _("Focus On Click:"), _("If the button grabs focus when it is clicked"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_font_picker_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gint i, show_size, use_font_in_label, use_font_in_label_size;
+ const gchar *title, *preview_text;
+
+ /* Only save if the title is different to the default. */
+ title = gnome_font_picker_get_title (GNOME_FONT_PICKER (widget));
+ if (data->action == GB_SHOWING
+ || (title && strcmp (title, dgettext (GLADE_LIBGNOMEUI_GETTEXT_PACKAGE,
+ "Pick a Font"))))
+ gb_widget_output_translatable_string (data, Title, title);
+
+ /* Only save if the preview text is different to the default. */
+ preview_text = gnome_font_picker_get_preview_text (GNOME_FONT_PICKER (widget));
+ if (data->action == GB_SHOWING
+ || (preview_text && strcmp (dgettext (GLADE_LIBGNOMEUI_GETTEXT_PACKAGE,
+ DEF_PREVIEW_TEXT), preview_text)))
+ gb_widget_output_translatable_string (data, PreviewText, preview_text);
+
+ for (i = 0; i < sizeof (GbModeValues) / sizeof (GbModeValues[0]); i++)
+ {
+ if (GbModeValues[i] == gnome_font_picker_get_mode (GNOME_FONT_PICKER (widget)))
+ gb_widget_output_choice (data, Mode, i, GbModeSymbols[i]);
+ }
+
+ g_object_get (G_OBJECT (widget),
+ "show-size", &show_size,
+ "use-font-in-label", &use_font_in_label,
+ "label-font-size", &use_font_in_label_size,
+ NULL);
+
+ gb_widget_output_bool (data, ShowSize, show_size);
+ gb_widget_output_bool (data, UseFont, use_font_in_label);
+ gb_widget_output_int (data, UseFontSize, use_font_in_label_size);
+
+ if (data->action == GB_SHOWING)
+ gb_gnome_font_picker_set_property_states (widget);
+
+ gb_widget_output_bool (data, FocusOnClick,
+ gtk_button_get_focus_on_click (GTK_BUTTON (widget)));
+}
+
+
+static void
+gb_gnome_font_picker_set_property_states (GtkWidget *widget)
+{
+ gboolean use_font_sens = FALSE, use_font_size_sens = FALSE;
+
+ if (gnome_font_picker_get_mode (GNOME_FONT_PICKER (widget)) == GNOME_FONT_PICKER_MODE_FONT_INFO)
+ {
+ use_font_sens = TRUE;
+ g_object_get (G_OBJECT (widget),
+ "use-font-in-label", &use_font_size_sens,
+ NULL);
+ }
+ property_set_sensitive (ShowSize, use_font_sens);
+ property_set_sensitive (UseFont, use_font_sens);
+ property_set_sensitive (UseFontSize, use_font_size_sens);
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_font_picker_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gchar *title, *preview_text, *mode;
+ gint i, use_font_size, new_use_font_size;
+ gboolean show_size, use_font, focus_on_click;
+ gboolean new_use_font, set_use_font = FALSE;
+ gboolean set_property_states = FALSE;
+
+ title = gb_widget_input_string (data, Title);
+ if (data->apply)
+ gnome_font_picker_set_title (GNOME_FONT_PICKER (widget),
+ title && title[0]
+ ? title : dgettext (GLADE_LIBGNOMEUI_GETTEXT_PACKAGE,
+ "Pick a Font"));
+
+ preview_text = gb_widget_input_string (data, PreviewText);
+ if (data->apply)
+ gnome_font_picker_set_preview_text (GNOME_FONT_PICKER (widget),
+ preview_text && preview_text[0]
+ ? preview_text : DEF_PREVIEW_TEXT);
+
+ mode = gb_widget_input_choice (data, Mode);
+ if (data->apply)
+ {
+ for (i = 0; i < sizeof (GbModeValues) / sizeof (GbModeValues[0]); i++)
+ {
+ if (!strcmp (mode, GbModeChoices[i])
+ || !strcmp (mode, GbModeSymbols[i]))
+ {
+ gnome_font_picker_set_mode (GNOME_FONT_PICKER (widget),
+ GbModeValues[i]);
+ set_property_states = TRUE;
+ break;
+ }
+ }
+ }
+
+ show_size = gb_widget_input_bool (data, ShowSize);
+ if (data->apply)
+ gnome_font_picker_fi_set_show_size (GNOME_FONT_PICKER (widget),
+ show_size);
+
+ g_object_get (G_OBJECT (widget),
+ "use-font-in-label", &new_use_font,
+ "label-font-size", &new_use_font_size,
+ NULL);
+
+ use_font = gb_widget_input_bool (data, UseFont);
+ if (data->apply)
+ {
+ new_use_font = use_font;
+ set_use_font = TRUE;
+ }
+
+ use_font_size = gb_widget_input_int (data, UseFontSize);
+ if (data->apply)
+ {
+ new_use_font_size = use_font_size;
+ set_use_font = TRUE;
+ }
+
+ if (set_use_font)
+ {
+ gnome_font_picker_fi_set_use_font_in_label (GNOME_FONT_PICKER (widget),
+ new_use_font,
+ new_use_font_size);
+ set_property_states = TRUE;
+ }
+
+ if ((data->action == GB_APPLYING) && set_property_states)
+ gb_gnome_font_picker_set_property_states (widget);
+
+ focus_on_click = gb_widget_input_bool (data, FocusOnClick);
+ if (data->apply)
+ gtk_button_set_focus_on_click (GTK_BUTTON (widget), focus_on_click);
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeFontPicker, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_font_picker_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_font_picker_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ const gchar *title, *preview_text;
+ gint i;
+ gboolean translatable, context;
+ gchar *comments;
+
+ if (data->create_widget)
+ source_add (data, " %s = gnome_font_picker_new ();\n", data->wname);
+
+ gb_widget_write_standard_source (widget, data);
+
+ title = gnome_font_picker_get_title (GNOME_FONT_PICKER (widget));
+ if (title && title[0]
+ && strcmp (title, dgettext (GLADE_LIBGNOMEUI_GETTEXT_PACKAGE,
+ "Pick a Font")))
+ {
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data,
+ " gnome_font_picker_set_title (GNOME_FONT_PICKER (%s), %s);\n",
+ data->wname, source_make_string_full (title, data->use_gettext && translatable, context));
+ }
+
+ preview_text = gnome_font_picker_get_preview_text (GNOME_FONT_PICKER (widget));
+ if (preview_text && preview_text[0]
+ && strcmp (dgettext (GLADE_LIBGNOMEUI_GETTEXT_PACKAGE, DEF_PREVIEW_TEXT),
+ preview_text))
+ {
+ glade_util_get_translation_properties (widget, PreviewText,
+ &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data,
+ " gnome_font_picker_set_preview_text (GNOME_FONT_PICKER (%s), %s);\n",
+ data->wname, source_make_string_full (preview_text,
+ data->use_gettext && translatable, context));
+ }
+
+ if (gnome_font_picker_get_mode (GNOME_FONT_PICKER (widget)) != GNOME_FONT_PICKER_MODE_PIXMAP)
+ {
+ for (i = 0; i < sizeof (GbModeValues) / sizeof (GbModeValues[0]); i++)
+ {
+ if (GbModeValues[i] == gnome_font_picker_get_mode (GNOME_FONT_PICKER (widget)))
+ source_add (data,
+ " gnome_font_picker_set_mode (GNOME_FONT_PICKER (%s),\n"
+ " %s);\n",
+ data->wname, GbModeSymbols[i]);
+ }
+ }
+
+ if (gnome_font_picker_get_mode (GNOME_FONT_PICKER (widget)) == GNOME_FONT_PICKER_MODE_FONT_INFO)
+ {
+ int show_size, use_font_in_label, label_font_size;
+ g_object_get (G_OBJECT (widget),
+ "show-size", &show_size,
+ "use-font-in-label", &use_font_in_label,
+ "label-font-size", &label_font_size,
+ NULL);
+ if (!show_size)
+ {
+ source_add (data,
+ " gnome_font_picker_fi_set_show_size (GNOME_FONT_PICKER (%s), FALSE);\n",
+ data->wname);
+ }
+
+ if (use_font_in_label)
+ {
+ source_add (data,
+ " gnome_font_picker_fi_set_use_font_in_label (GNOME_FONT_PICKER (%s),\n"
+ " TRUE, %i);\n",
+ data->wname,
+ label_font_size);
+ }
+ }
+
+ if (!gtk_button_get_focus_on_click (GTK_BUTTON (widget)))
+ {
+ source_add (data,
+ " gtk_button_set_focus_on_click (GTK_BUTTON (%s), FALSE);\n",
+ data->wname);
+ }
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_font_picker_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_font_picker_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_fontpicker_xpm;
+ gbwidget.tooltip = _("Gnome Font Picker");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_font_picker_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_font_picker_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_font_picker_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_font_picker_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_font_picker_write_source;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_font_picker_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomehref.c b/tools/glade/glade/gnome/gnomehref.c
new file mode 100644
index 00000000..fdbeb438
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomehref.c
@@ -0,0 +1,220 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-href.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *HRefURL = "GnomeHRef::url";
+static gchar *HRefLabel = "GnomeHRef::text";
+static gchar *FocusOnClick = "GnomeHRef|GtkButton::focus_on_click";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeHRef, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+/*
+static GtkWidget*
+gb_gnome_href_new (GbWidgetNewData *data)
+{
+
+}
+*/
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_href_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_string (HRefURL, _("URL:"),
+ _("The URL to display when the button is clicked"));
+ property_add_text (HRefLabel, _("Label:"),
+ _("The text to display in the button"), 2);
+ property_add_bool (FocusOnClick, _("Focus On Click:"), _("If the button grabs focus when it is clicked"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_href_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gchar *uri, *label;
+
+ g_object_get (G_OBJECT (widget),
+ "url", &uri,
+ "text", &label,
+ NULL);
+ gb_widget_output_string (data, HRefURL, uri);
+ gb_widget_output_translatable_text (data, HRefLabel, label);
+
+ g_free (uri);
+ g_free (label);
+
+ gb_widget_output_bool (data, FocusOnClick,
+ gtk_button_get_focus_on_click (GTK_BUTTON (widget)));
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_href_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gchar *url, *label_text;
+ gboolean focus_on_click;
+
+ url = gb_widget_input_string (data, HRefURL);
+ if (data->apply)
+ gnome_href_set_url (GNOME_HREF (widget), url && url[0] ? url : "");
+
+ label_text = gb_widget_input_text (data, HRefLabel);
+ /* Support the old name we used for the property. */
+ if (!data->apply && data->action == GB_LOADING)
+ label_text = gb_widget_input_text (data, "label");
+ if (data->apply)
+ gnome_href_set_text (GNOME_HREF (widget), label_text);
+ if (data->action == GB_APPLYING)
+ g_free (label_text);
+
+ focus_on_click = gb_widget_input_bool (data, FocusOnClick);
+ if (data->apply)
+ gtk_button_set_focus_on_click (GTK_BUTTON (widget), focus_on_click);
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeHRef, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_href_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_href_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ gboolean translatable, context;
+ gchar *comments;
+
+ if (data->create_widget)
+ {
+ gchar *url, *label_text;
+
+ g_object_get (G_OBJECT (widget),
+ "url", &url,
+ "text", &label_text,
+ NULL);
+
+ glade_util_get_translation_properties (widget, HRefURL, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data, " %s = gnome_href_new (%s, ",
+ data->wname,
+ url && *url ? source_make_string (url, FALSE) : "\"\"");
+
+ source_add (data, "%s);\n",
+ source_make_string_full (label_text, data->use_gettext && translatable, context));
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ if (!gtk_button_get_focus_on_click (GTK_BUTTON (widget)))
+ {
+ source_add (data,
+ " gtk_button_set_focus_on_click (GTK_BUTTON (%s), FALSE);\n",
+ data->wname);
+ }
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_href_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_href_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_href_xpm;
+ gbwidget.tooltip = _("Gnome HRef Link Button");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_create_properties = gb_gnome_href_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_href_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_href_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_href_write_source;
+/*
+ gbwidget.gb_widget_new = gb_gnome_href_new;
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_href_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomeiconentry.c b/tools/glade/glade/gnome/gnomeiconentry.c
new file mode 100644
index 00000000..55f55caf
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomeiconentry.c
@@ -0,0 +1,222 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-iconentry.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *HistoryID = "GnomeIconEntry|GnomeEntry::history_id";
+static gchar *MaxSaved = "GnomeIconEntry|GnomeEntry::max_saved";
+static gchar *Title = "GnomeIconEntry::browse_dialog_title";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeIconEntry, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_icon_entry_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = gnome_icon_entry_new (NULL, NULL);
+
+ /* Set MaxSaved to the default. */
+ gtk_object_set_data (GTK_OBJECT (new_widget), MaxSaved,
+ GINT_TO_POINTER (GLADE_DEFAULT_MAX_HISTORY_SAVED));
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_icon_entry_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_string (Title, _("Title:"),
+ _("The title of the file selection dialog"));
+ property_add_string (HistoryID, _("History ID:"),
+ _("The ID to save the history entries under"));
+ property_add_int_range (MaxSaved, _("Max Saved:"),
+ _("The maximum number of history entries saved"),
+ 0, 10000, 1, 10, 1);
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_icon_entry_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_widget_output_translatable_string (data, Title, gtk_object_get_data (GTK_OBJECT (widget), Title));
+ gb_widget_output_string (data, HistoryID, gtk_object_get_data (GTK_OBJECT (widget), HistoryID));
+ gb_widget_output_int (data, MaxSaved, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), MaxSaved)));
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_icon_entry_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gchar *title, *history_id;
+ gint max_saved;
+
+ title = gb_widget_input_string (data, Title);
+ if (data->apply)
+ {
+ gtk_object_set_data_full (GTK_OBJECT (widget), Title, g_strdup (title),
+ title ? g_free : NULL);
+ gnome_icon_entry_set_browse_dialog_title (GNOME_ICON_ENTRY (widget),
+ title && title[0] ? title : "");
+ }
+
+ history_id = gb_widget_input_string (data, HistoryID);
+ if (data->apply)
+ gtk_object_set_data_full (GTK_OBJECT (widget), HistoryID,
+ g_strdup (history_id),
+ history_id ? g_free : NULL);
+
+ max_saved = gb_widget_input_int (data, MaxSaved);
+ if (data->apply)
+ gtk_object_set_data (GTK_OBJECT (widget), MaxSaved,
+ GINT_TO_POINTER (max_saved));
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeIconEntry, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_icon_entry_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_icon_entry_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ gchar *title, *history_id;
+ gint max_saved;
+ gboolean translatable, context;
+ gchar *comments;
+
+ title = gtk_object_get_data (GTK_OBJECT (widget), Title);
+ if (title && title[0] == '\0')
+ title = NULL;
+
+ history_id = gtk_object_get_data (GTK_OBJECT (widget), HistoryID);
+ if (history_id && history_id[0] == '\0')
+ history_id = NULL;
+
+ if (data->create_widget)
+ {
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data, " %s = gnome_icon_entry_new (%s, ",
+ data->wname,
+ history_id ? source_make_string (history_id, FALSE) : "NULL");
+
+ source_add (data, "%s);\n",
+ title ? source_make_string_full (title, data->use_gettext && translatable, context) : "NULL");
+ }
+ gb_widget_write_standard_source (widget, data);
+
+ /* Note that GLADE_DEFAULT_MAX_HISTORY_SAVED is copied from gnome-entry.c */
+ max_saved = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ MaxSaved));
+ if (max_saved != GLADE_DEFAULT_MAX_HISTORY_SAVED)
+ source_add (data, " gnome_entry_set_max_saved (GNOME_ENTRY (gnome_icon_entry_gnome_entry (GNOME_ICON_ENTRY (%s))), %i);\n",
+ data->wname, max_saved);
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_icon_entry_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_icon_entry_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_iconentry_xpm;
+ gbwidget.tooltip = _("Gnome Icon Entry");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_icon_entry_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_icon_entry_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_icon_entry_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_icon_entry_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_icon_entry_write_source;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_icon_entry_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomeiconlist.c b/tools/glade/glade/gnome/gnomeiconlist.c
new file mode 100644
index 00000000..12b7d6eb
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomeiconlist.c
@@ -0,0 +1,475 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-iconlist.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+#define DEFAULT_ICON_WIDTH 78
+
+/* These are pinched from GnomeIconList */
+#define DEFAULT_ROW_SPACING 4
+#define DEFAULT_COL_SPACING 2
+#define DEFAULT_TEXT_SPACING 2
+#define DEFAULT_ICON_BORDER 2
+
+static gchar *SelectionMode = "GnomeIconList::selection_mode";
+static gchar *IconWidth = "GnomeIconList::icon_width";
+static gchar *RowSpacing = "GnomeIconList::row_spacing";
+static gchar *ColSpacing = "GnomeIconList::column_spacing";
+#if 0
+/* The icon border property doesn't seem to be used. */
+static gchar *IconBorder = "GnomeIconList::icon_border";
+#endif
+static gchar *TextSpacing = "GnomeIconList::text_spacing";
+static gchar *TextEditable = "GnomeIconList::text_editable";
+static gchar *TextStatic = "GnomeIconList::text_static";
+
+static const gchar *GbModeChoices[] =
+{"Single", "Browse", "Multiple", NULL};
+static const gint GbModeValues[] =
+{
+ GTK_SELECTION_SINGLE,
+ GTK_SELECTION_BROWSE,
+ GTK_SELECTION_MULTIPLE
+};
+static const gchar *GbModeSymbols[] =
+{
+ "GTK_SELECTION_SINGLE",
+ "GTK_SELECTION_BROWSE",
+ "GTK_SELECTION_MULTIPLE"
+};
+
+static gint gb_gnome_icon_list_expose (GtkWidget *widget,
+ GdkEventExpose *event,
+ gpointer data);
+static void gb_gnome_icon_list_adjustment_changed (GtkAdjustment *adjustment,
+ GtkWidget *widget);
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeIconList, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_icon_list_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+ GdkPixbuf *image;
+ gint i;
+
+ new_widget = gnome_icon_list_new (DEFAULT_ICON_WIDTH, NULL, 0);
+
+ image = gdk_pixbuf_new_from_xpm_data ((const char**) gnome_iconlist_xpm);
+ for (i = 0; i < 10; i++)
+ {
+ gnome_icon_list_append_pixbuf (GNOME_ICON_LIST (new_widget), image,
+ NULL,
+ "This is an example icon");
+ }
+ gdk_pixbuf_unref (image);
+ /* We save the property values in the GnomeIconList's data list, since they
+ are not available from GnomeIconList in any way.
+ We let TextEditable and TextStatic default to FALSE so we don't need to
+ set them here. */
+ gtk_object_set_data (GTK_OBJECT (new_widget), SelectionMode,
+ GINT_TO_POINTER (GTK_SELECTION_SINGLE));
+ gtk_object_set_data (GTK_OBJECT (new_widget), IconWidth,
+ GINT_TO_POINTER (DEFAULT_ICON_WIDTH));
+ gtk_object_set_data (GTK_OBJECT (new_widget), RowSpacing,
+ GINT_TO_POINTER (DEFAULT_ROW_SPACING));
+ gtk_object_set_data (GTK_OBJECT (new_widget), ColSpacing,
+ GINT_TO_POINTER (DEFAULT_COL_SPACING));
+#if 0
+ gtk_object_set_data (GTK_OBJECT (new_widget), IconBorder,
+ GINT_TO_POINTER (DEFAULT_ICON_BORDER));
+#endif
+ gtk_object_set_data (GTK_OBJECT (new_widget), TextSpacing,
+ GINT_TO_POINTER (DEFAULT_TEXT_SPACING));
+
+ /* We connect to the expose event so we can connect to the "value_changed"
+ signals of the scrollbar adjustments. The scrollbars aren't setup until
+ the widget is added to a scrolled window. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "expose_event",
+ (GtkSignalFunc) gb_gnome_icon_list_expose, NULL);
+
+ return new_widget;
+}
+
+
+/* If data is not NULL, then we are creating the widget, so the step increments
+ are set to a decent initial value. */
+static gint
+gb_gnome_icon_list_expose (GtkWidget *widget,
+ GdkEventExpose *event,
+ gpointer data)
+{
+ if (GNOME_ICON_LIST (widget)->adj)
+ gtk_signal_connect (GTK_OBJECT (GNOME_ICON_LIST (widget)->adj),
+ "value_changed",
+ (GtkSignalFunc) gb_gnome_icon_list_adjustment_changed,
+ widget);
+ if (GNOME_ICON_LIST (widget)->hadj)
+ gtk_signal_connect (GTK_OBJECT (GNOME_ICON_LIST (widget)->hadj),
+ "value_changed",
+ (GtkSignalFunc) gb_gnome_icon_list_adjustment_changed,
+ widget);
+
+ /* Disconnect this handler since we don't need it any more. */
+ gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
+ (GtkSignalFunc) gb_gnome_icon_list_expose,
+ data);
+ return FALSE;
+}
+
+
+static void
+gb_gnome_icon_list_adjustment_changed (GtkAdjustment *adjustment,
+ GtkWidget *widget)
+{
+ /* Just queue a complete clear for now. It's good enough. */
+ gtk_widget_queue_clear (widget);
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_icon_list_create_properties (GtkWidget * widget,
+ GbWidgetCreateArgData * data)
+{
+ property_add_choice (SelectionMode, _("Select Mode:"),
+ _("The selection mode"),
+ GbModeChoices);
+ property_add_int_range (IconWidth, _("Icon Width:"),
+ _("The width of each icon"),
+ 1, 10000, 1, 10, 1);
+ property_add_int_range (RowSpacing, _("Row Spacing:"),
+ _("The number of pixels between rows of icons"),
+ 0, 10000, 1, 10, 1);
+ property_add_int_range (ColSpacing, _("Col Spacing:"),
+ _("The number of pixels between columns of icons"),
+ 0, 10000, 1, 10, 1);
+#if 0
+ property_add_int_range (IconBorder, _("Icon Border:"),
+ _("The number of pixels around icons (unused?)"),
+ 0, 10000, 1, 10, 1);
+#endif
+ property_add_int_range (TextSpacing, _("Text Spacing:"),
+ _("The number of pixels between the text and the icon"),
+ 0, 10000, 1, 10, 1);
+ property_add_bool (TextEditable, _("Text Editable:"),
+ _("If the icon text can be edited by the user"));
+ property_add_bool (TextStatic, _("Text Static:"),
+ _("If the icon text is static, in which case it will not be copied by the GnomeIconList"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_icon_list_get_properties (GtkWidget *widget,
+ GbWidgetGetArgData * data)
+{
+ GnomeIconList *gil;
+ gint selection_mode, i;
+
+ gil = (GnomeIconList*) widget;
+
+ selection_mode = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ SelectionMode));
+ for (i = 0; i < sizeof (GbModeValues) / sizeof (GbModeValues[0]); i++)
+ {
+ if (GbModeValues[i] == selection_mode)
+ gb_widget_output_choice (data, SelectionMode, i, GbModeSymbols[i]);
+ }
+
+ gb_widget_output_int (data, IconWidth, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), IconWidth)));
+ gb_widget_output_int (data, RowSpacing, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), RowSpacing)));
+ gb_widget_output_int (data, ColSpacing, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), ColSpacing)));
+#if 0
+ gb_widget_output_int (data, IconBorder, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), IconBorder)));
+#endif
+ gb_widget_output_int (data, TextSpacing, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), TextSpacing)));
+ gb_widget_output_bool (data, TextEditable, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), TextEditable)));
+ gb_widget_output_bool (data, TextStatic, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), TextStatic)));
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_icon_list_set_properties (GtkWidget * widget,
+ GbWidgetSetArgData * data)
+{
+ gchar *mode;
+ gint icon_width, row_spacing, col_spacing, /*icon_border,*/ text_spacing, i;
+ gboolean text_editable, text_static;
+
+ mode = gb_widget_input_choice (data, SelectionMode);
+ if (data->apply)
+ {
+ for (i = 0; i < sizeof (GbModeValues) / sizeof (GbModeValues[0]); i++)
+ {
+ if (!strcmp (mode, GbModeChoices[i])
+ || !strcmp (mode, GbModeSymbols[i]))
+ {
+ gnome_icon_list_set_selection_mode (GNOME_ICON_LIST (widget),
+ GbModeValues[i]);
+ gtk_object_set_data (GTK_OBJECT (widget), SelectionMode,
+ GINT_TO_POINTER (GbModeValues[i]));
+ break;
+ }
+ }
+ }
+
+ icon_width = gb_widget_input_int (data, IconWidth);
+ if (data->apply)
+ {
+ gnome_icon_list_set_icon_width (GNOME_ICON_LIST (widget), icon_width);
+ gtk_object_set_data (GTK_OBJECT (widget), IconWidth,
+ GINT_TO_POINTER (icon_width));
+ }
+
+ row_spacing = gb_widget_input_int (data, RowSpacing);
+ if (data->apply)
+ {
+ gnome_icon_list_set_row_spacing (GNOME_ICON_LIST (widget), row_spacing);
+ gtk_object_set_data (GTK_OBJECT (widget), RowSpacing,
+ GINT_TO_POINTER (row_spacing));
+ }
+
+ col_spacing = gb_widget_input_int (data, ColSpacing);
+ if (data->apply)
+ {
+ gnome_icon_list_set_col_spacing (GNOME_ICON_LIST (widget), col_spacing);
+ gtk_object_set_data (GTK_OBJECT (widget), ColSpacing,
+ GINT_TO_POINTER (col_spacing));
+ }
+
+#if 0
+ icon_border = gb_widget_input_int (data, IconBorder);
+ if (data->apply)
+ {
+ gnome_icon_list_set_icon_border (GNOME_ICON_LIST (widget), icon_border);
+ gtk_object_set_data (GTK_OBJECT (widget), IconBorder,
+ GINT_TO_POINTER (icon_border));
+ }
+#endif
+
+ text_spacing = gb_widget_input_int (data, TextSpacing);
+ if (data->apply)
+ {
+ gnome_icon_list_set_text_spacing (GNOME_ICON_LIST (widget),
+ text_spacing);
+ gtk_object_set_data (GTK_OBJECT (widget), TextSpacing,
+ GINT_TO_POINTER (text_spacing));
+ }
+
+ text_editable = gb_widget_input_bool (data, TextEditable);
+ if (data->apply)
+ {
+ /* GnomeIconList doesn't have a function to set this. We may also want
+ to reconfigure any example icon items so this works. */
+ gtk_object_set_data (GTK_OBJECT (widget), TextEditable,
+ GINT_TO_POINTER (text_editable));
+ }
+
+ text_static = gb_widget_input_bool (data, TextStatic);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), TextStatic,
+ GINT_TO_POINTER (text_static));
+ }
+}
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeIconList, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_icon_list_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_icon_list_write_source (GtkWidget * widget,
+ GbWidgetWriteSourceData * data)
+{
+ gint icon_width, row_spacing, col_spacing, /*icon_border,*/ text_spacing;
+ gint i, selection_mode;
+ gboolean text_editable, text_static;
+ gchar *flags;
+
+ icon_width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ IconWidth));
+ text_editable = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ TextEditable));
+ text_static = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ TextStatic));
+
+ if (data->create_widget)
+ {
+ if (text_editable && text_static)
+ flags = "GNOME_ICON_LIST_IS_EDITABLE | GNOME_ICON_LIST_STATIC_TEXT";
+ else if (text_editable)
+ flags = "GNOME_ICON_LIST_IS_EDITABLE";
+ else if (text_static)
+ flags = "GNOME_ICON_LIST_STATIC_TEXT";
+ else
+ flags = "0";
+
+ source_add (data, " %s = gnome_icon_list_new (%i, NULL, %s);\n",
+ data->wname, icon_width, flags);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ if (!data->create_widget)
+ {
+ if (icon_width != DEFAULT_ICON_WIDTH)
+ {
+ source_add (data,
+ " gnome_icon_list_set_icon_width (GNOME_ICON_LIST (%s), %i);\n",
+ data->wname, icon_width);
+ }
+ }
+
+ row_spacing = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ RowSpacing));
+ if (row_spacing != DEFAULT_ROW_SPACING)
+ {
+ source_add (data,
+ " gnome_icon_list_set_row_spacing (GNOME_ICON_LIST (%s), %i);\n",
+ data->wname, row_spacing);
+ }
+
+ col_spacing = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ ColSpacing));
+ if (col_spacing != DEFAULT_COL_SPACING)
+ {
+ source_add (data,
+ " gnome_icon_list_set_col_spacing (GNOME_ICON_LIST (%s), %i);\n",
+ data->wname, col_spacing);
+ }
+
+#if 0
+ icon_border = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ IconBorder));
+ if (icon_border != DEFAULT_ICON_BORDER)
+ {
+ source_add (data,
+ " gnome_icon_list_set_icon_border (GNOME_ICON_LIST (%s), %i);\n",
+ data->wname, icon_border);
+ }
+#endif
+
+ text_spacing = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ TextSpacing));
+ if (text_spacing != DEFAULT_TEXT_SPACING)
+ {
+ source_add (data,
+ " gnome_icon_list_set_text_spacing (GNOME_ICON_LIST (%s), %i);\n",
+ data->wname, text_spacing);
+ }
+
+ selection_mode = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ SelectionMode));
+ if (selection_mode != GTK_SELECTION_SINGLE)
+ {
+ for (i = 0; i < sizeof (GbModeValues) / sizeof (GbModeValues[0]); i++)
+ {
+ if (GbModeValues[i] == selection_mode)
+ source_add (data,
+ " gnome_icon_list_set_selection_mode (GNOME_ICON_LIST (%s), %s);\n",
+ data->wname, GbModeSymbols[i]);
+ }
+ }
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_icon_list_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_icon_list_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_iconlist_xpm;
+ gbwidget.tooltip = _("Icon List");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_icon_list_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_icon_list_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_icon_list_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_icon_list_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_icon_list_write_source;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_icon_list_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomeiconselection.c b/tools/glade/glade/gnome/gnomeiconselection.c
new file mode 100644
index 00000000..279753d7
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomeiconselection.c
@@ -0,0 +1,168 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-iconselection.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeIconSelection, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_icon_selection_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = gnome_icon_selection_new ();
+ gnome_icon_selection_add_defaults (GNOME_ICON_SELECTION (new_widget));
+#if 0
+ gnome_icon_selection_show_icons (GNOME_ICON_SELECTION (new_widget));
+#endif
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+/*
+static void
+gb_gnome_icon_selection_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+/*
+static void
+gb_gnome_icon_selection_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+/*
+static void
+gb_gnome_icon_selection_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeIconSelection, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_icon_selection_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_icon_selection_write_source (GtkWidget * widget,
+ GbWidgetWriteSourceData * data)
+{
+ if (data->create_widget)
+ {
+ source_add (data, " %s = gnome_icon_selection_new ();\n", data->wname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_icon_selection_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_icon_selection_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_iconselection_xpm;
+ gbwidget.tooltip = _("Icon Selection");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_icon_selection_new;
+ gbwidget.gb_widget_write_source = gb_gnome_icon_selection_write_source;
+/*
+ gbwidget.gb_widget_create_properties = gb_gnome_icon_selection_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_icon_selection_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_icon_selection_set_properties;
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_icon_selection_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomemessagebox.c b/tools/glade/glade/gnome/gnomemessagebox.c
new file mode 100644
index 00000000..e8ca907a
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomemessagebox.c
@@ -0,0 +1,515 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+#include "../glade_gnome.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-messagebox.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Title = "GnomeMessageBox|GtkWindow::title";
+static gchar *Position = "GnomeMessageBox|GtkWindow::window_position";
+static gchar *Modal = "GnomeMessageBox|GtkWindow::modal";
+static gchar *DefaultWidth = "GnomeMessageBox|GtkWindow::default_width";
+static gchar *DefaultHeight = "GnomeMessageBox|GtkWindow::default_height";
+static gchar *Shrink = "GnomeMessageBox|GtkWindow::allow_shrink";
+static gchar *Grow = "GnomeMessageBox|GtkWindow::allow_grow";
+static gchar *AutoShrink = "GnomeMessageBox|GtkWindow::auto_shrink";
+static gchar *IconName = "GnomeMessageBox|GtkWindow::icon_name";
+static gchar *FocusOnMap = "GnomeMessageBox|GtkWindow::focus_on_map";
+
+static gchar *Resizable = "GnomeMessageBox|GtkWindow::resizable";
+static gchar *DestroyWithParent = "GnomeMessageBox|GtkWindow::destroy_with_parent";
+static gchar *Icon = "GnomeMessageBox|GtkWindow::icon";
+
+static gchar *Role = "GnomeMessageBox|GtkWindow::role";
+static gchar *TypeHint = "GnomeMessageBox|GtkWindow::type_hint";
+static gchar *SkipTaskbar = "GnomeMessageBox|GtkWindow::skip_taskbar_hint";
+static gchar *SkipPager = "GnomeMessageBox|GtkWindow::skip_pager_hint";
+static gchar *Decorated = "GnomeMessageBox|GtkWindow::decorated";
+static gchar *Gravity = "GnomeMessageBox|GtkWindow::gravity";
+static gchar *Urgency = "GnomeMessageBox|GtkWindow::urgency_hint";
+
+static gchar *MessageBoxType = "GnomeMessageBox::message_box_type";
+static gchar *Message = "GnomeMessageBox::message";
+
+static gchar *AutoClose = "GnomeMessageBox|GnomeDialog::auto_close";
+static gchar *HideOnClose = "GnomeMessageBox|GnomeDialog::hide_on_close";
+
+
+static const gchar *GbMessageBoxTypeChoices[] =
+{
+ "Information",
+ "Warning",
+ "Error",
+ "Question",
+ "Generic",
+ NULL
+};
+static const gchar *GbMessageBoxTypeSymbols[] =
+{
+ "GNOME_MESSAGE_BOX_INFO",
+ "GNOME_MESSAGE_BOX_WARNING",
+ "GNOME_MESSAGE_BOX_ERROR",
+ "GNOME_MESSAGE_BOX_QUESTION",
+ "GNOME_MESSAGE_BOX_GENERIC"
+};
+static const gchar* GbMessageBoxTypePixmapStockIDs[] =
+{
+ GTK_STOCK_DIALOG_INFO,
+ GTK_STOCK_DIALOG_WARNING,
+ GTK_STOCK_DIALOG_ERROR,
+ GTK_STOCK_DIALOG_QUESTION,
+ ""
+};
+
+
+static void get_message_box_widgets (GtkWidget *dialog,
+ GtkWidget **pixmap,
+ GtkWidget **label);
+static void set_message_box_type (GtkWidget *dialog,
+ GtkWidget *pixmap,
+ gchar *type_name);
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the funtion in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomeMessageBox, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ * If the widget needs a special destroy handler, add a signal here.
+ */
+static GtkWidget*
+gb_gnome_message_box_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+ GList *elem;
+ GtkWidget *aa;
+
+ if (data->action == GB_CREATING)
+ {
+ /* When creating a new dialog, we add a few standard buttons, which
+ the user can change/delete easily. */
+ new_widget = gnome_message_box_new ("", GNOME_MESSAGE_BOX_INFO,
+ GTK_STOCK_OK, NULL);
+
+ /* Now turn the buttons into GbWidgets so the user can edit them. */
+ elem = GNOME_DIALOG (new_widget)->buttons;
+ gb_widget_create_from (GTK_WIDGET (elem->data), "button");
+ gtk_object_set_data (GTK_OBJECT (elem->data), GladeButtonStockIDKey,
+ GTK_STOCK_OK);
+ }
+ else
+ {
+ /* FIXME: We create it with an OK button, and then remove the button,
+ to work around a bug in gnome_message_box_new() - it tries to set the
+ keyboard focus to the last button, which may not exist. It also
+ ensures that gnome_dialog_init_action_area() has been called. */
+ new_widget = gnome_message_box_new ("", GNOME_MESSAGE_BOX_INFO,
+ GNOME_STOCK_BUTTON_OK, NULL);
+ gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (new_widget)->action_area),
+ GNOME_DIALOG (new_widget)->buttons->data);
+ GNOME_DIALOG (new_widget)->buttons = NULL;
+ }
+
+ aa = GNOME_DIALOG (new_widget)->action_area;
+
+ gb_widget_create_from (GNOME_DIALOG (new_widget)->vbox,
+ data->action == GB_CREATING ? "dialog-vbox" : NULL);
+ gb_widget_set_child_name (GNOME_DIALOG (new_widget)->vbox, GladeChildDialogVBox);
+ gb_widget_create_from (aa,
+ data->action == GB_CREATING ? "dialog-action_area"
+ : NULL);
+ gb_widget_set_child_name (aa, GladeChildDialogActionArea);
+
+ /* We connect a close signal handler which always returns TRUE so that
+ the built-in close functionality is skipped. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "close",
+ GTK_SIGNAL_FUNC (gtk_true), NULL);
+
+ /* Now we connect our normal delete_event handler. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
+ GTK_SIGNAL_FUNC (editor_close_window), NULL);
+
+ gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
+ GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));
+
+ return new_widget;
+}
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_message_box_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_choice (MessageBoxType, _("Message Type:"),
+ _("The type of the message box"),
+ GbMessageBoxTypeChoices);
+ property_add_text (Message, _("Message:"), _("The message to display"), 5);
+
+ /* We don't allow setting of the title, so we pass NULL here. */
+ gb_window_create_standard_properties (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ property_add_bool (AutoClose, _("Auto Close:"),
+ _("If the dialog closes when any button is clicked"));
+ property_add_bool (HideOnClose, _("Hide on Close:"),
+ _("If the dialog is hidden when it is closed, instead of being destroyed"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_message_box_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ GtkWidget *pixmap, *label;
+ const gchar *label_text;
+ gint type_index;
+
+ get_message_box_widgets (widget, &pixmap, &label);
+ g_return_if_fail (pixmap != NULL);
+ g_return_if_fail (label != NULL);
+
+ type_index = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ MessageBoxType));
+ gb_widget_output_choice (data, MessageBoxType, type_index,
+ GbMessageBoxTypeSymbols[type_index]);
+
+ label_text = gtk_label_get_text (GTK_LABEL (label));
+ gb_widget_output_translatable_text (data, Message, label_text);
+
+ gb_window_get_standard_properties (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+ gb_widget_output_bool (data, AutoClose, GNOME_DIALOG (widget)->click_closes);
+ gb_widget_output_bool (data, HideOnClose, GNOME_DIALOG (widget)->just_hide);
+}
+
+
+/* This tries to find the pixmap and label in the message box. */
+static void
+get_message_box_widgets (GtkWidget *dialog,
+ GtkWidget **pixmap,
+ GtkWidget **label)
+{
+ GtkWidget *vbox, *hbox;
+ GtkBoxChild *child;
+ GList *elem;
+
+ *pixmap = NULL;
+ *label = NULL;
+
+ vbox = GNOME_DIALOG (dialog)->vbox;
+ if (!vbox || !GTK_IS_VBOX (vbox))
+ return;
+
+ for (elem = GTK_BOX (vbox)->children; elem; elem = elem->next)
+ {
+ child = (GtkBoxChild*)elem->data;
+ if (GTK_IS_HBOX (child->widget))
+ break;
+ }
+
+ if (!elem)
+ return;
+
+ hbox = child->widget;
+
+ elem = GTK_BOX (hbox)->children;
+ while (elem)
+ {
+ child = (GtkBoxChild*)elem->data;
+ if (GTK_IS_LABEL (child->widget))
+ *label = child->widget;
+ if (GTK_IS_IMAGE (child->widget))
+ *pixmap = child->widget;
+
+ elem = elem->next;
+ }
+}
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_message_box_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ GtkWidget *pixmap, *label;
+ gchar *message, *type_name;
+ gboolean auto_close, hide_on_close;
+
+ get_message_box_widgets (widget, &pixmap, &label);
+ g_return_if_fail (pixmap != NULL);
+ g_return_if_fail (label != NULL);
+
+ type_name = gb_widget_input_choice (data, MessageBoxType);
+ if (data->apply)
+ {
+ set_message_box_type (widget, pixmap, type_name);
+ }
+
+ message = gb_widget_input_text (data, Message);
+ if (data->apply)
+ {
+ gtk_label_set_text (GTK_LABEL (label), message);
+ }
+ if (data->action == GB_APPLYING)
+ g_free (message);
+
+ gb_window_set_standard_properties (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ auto_close = gb_widget_input_bool (data, AutoClose);
+ if (data->apply)
+ gnome_dialog_set_close (GNOME_DIALOG (widget), auto_close);
+
+ hide_on_close = gb_widget_input_bool (data, HideOnClose);
+ if (data->apply)
+ gnome_dialog_close_hides (GNOME_DIALOG (widget), hide_on_close);
+}
+
+
+/* Here we set the type of the message box, i.e. we change the pixmap. */
+static void
+set_message_box_type (GtkWidget *dialog,
+ GtkWidget *pixmap,
+ gchar *type_name)
+{
+ gint i, type_index = 0; /* Set to 0 in case we can't find it. */
+
+ /* Find out the index of the type. */
+ for (i = 0; GbMessageBoxTypeChoices[i]; i++)
+ {
+ if (!strcmp (type_name, GbMessageBoxTypeChoices[i])
+ || !strcmp (type_name, GbMessageBoxTypeSymbols[i]))
+ {
+ type_index = i;
+ break;
+ }
+ }
+
+ gtk_object_set_data (GTK_OBJECT (dialog), MessageBoxType,
+ GINT_TO_POINTER (type_index));
+
+ g_object_set (G_OBJECT (pixmap), "stock",
+ GbMessageBoxTypePixmapStockIDs[type_index], NULL);
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomeMessageBox, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_message_box_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_message_box_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ GtkWidget *pixmap, *label;
+ const gchar *label_text;
+ gint type_index;
+ gchar *wname, *child_name;
+ gboolean translatable, context;
+ gchar *comments;
+
+ get_message_box_widgets (widget, &pixmap, &label);
+ g_return_if_fail (pixmap != NULL);
+ g_return_if_fail (label != NULL);
+
+ type_index = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ MessageBoxType));
+ label_text = gtk_label_get_text (GTK_LABEL (label));
+
+ if (data->create_widget)
+ {
+ glade_util_get_translation_properties (widget, Message, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ source_add (data,
+ " %s = gnome_message_box_new (%s,\n"
+ " %s, NULL);\n",
+ data->wname,
+ source_make_string_full (label_text, data->use_gettext && translatable, context),
+ GbMessageBoxTypeSymbols[type_index]);
+
+#if 0
+ source_add (data,
+ " gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (%s)->action_area), GNOME_DIALOG (%s)->buttons->data);\n"
+ " GNOME_DIALOG (%s)->buttons = NULL;\n",
+ data->wname, data->wname, data->wname);
+#endif
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ gb_window_write_standard_source (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ if (!GNOME_DIALOG (widget)->click_closes)
+ {
+ source_add (data,
+ " gnome_dialog_set_close (GNOME_DIALOG (%s), FALSE);\n",
+ data->wname);
+ }
+
+ if (GNOME_DIALOG (widget)->just_hide)
+ {
+ source_add (data,
+ " gnome_dialog_close_hides (GNOME_DIALOG (%s), TRUE);\n",
+ data->wname);
+ }
+
+ /* We output the source code for the children here, since the code should
+ not include calls to create the widgets. We need to specify that the
+ names used are like: "GTK_DIALOG (<dialog-name>)->vbox".
+ We need to remember the dialog's name since data->wname
+ will be overwritten. */
+ wname = g_strdup (data->wname);
+
+ source_add (data, "\n");
+ child_name = (char*) gtk_widget_get_name (GNOME_DIALOG (widget)->vbox);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data, " %s = GNOME_DIALOG (%s)->vbox;\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (GNOME_DIALOG (widget)->vbox, data);
+
+ /* action_area is a child of vbox so I had to add a kludge to stop it
+ being written as a normal child - we need to do it here so that we
+ don't output code to create it. */
+ child_name = (char*) gtk_widget_get_name (GNOME_DIALOG (widget)->action_area);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data, " %s = GNOME_DIALOG (%s)->action_area;\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (GNOME_DIALOG (widget)->action_area, data);
+
+ g_free (wname);
+ data->write_children = FALSE;
+}
+
+
+
+static GtkWidget *
+gb_gnome_message_box_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildDialogVBox))
+ return GNOME_DIALOG (widget)->vbox;
+ else if (!strcmp (child_name, GladeChildDialogActionArea))
+ return GNOME_DIALOG (widget)->action_area;
+ else
+ return NULL;
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_message_box_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_message_box_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_messagebox_xpm;
+ gbwidget.tooltip = _("Gnome Message Box");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_message_box_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_message_box_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_message_box_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_message_box_set_properties;
+ gbwidget.gb_widget_get_child = gb_gnome_message_box_get_child;
+ gbwidget.gb_widget_write_source = gb_gnome_message_box_write_source;
+ gbwidget.gb_widget_destroy = gb_window_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_message_box_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomepixmap.c b/tools/glade/glade/gnome/gnomepixmap.c
new file mode 100644
index 00000000..2870dbd2
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomepixmap.c
@@ -0,0 +1,361 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-pixmap.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Filename = "GnomePixmap::filename";
+static gchar *Width = "GnomePixmap::scaled_width";
+static gchar *Height = "GnomePixmap::scaled_height";
+
+/* This is only used in Glade. It is not saved to the XML since it is implied
+ by the existence of the scaled_width & scaled_height properties. */
+static gchar *Scaled = "GnomePixmap::scaled";
+
+static void gb_gnome_pixmap_reload (GtkWidget *widget);
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomePixmap, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_pixmap_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ new_widget = gtk_type_new (gnome_pixmap_get_type ());
+ /* Set the default scaled width to 48 x 48. */
+ gtk_object_set_data (GTK_OBJECT (new_widget), Width, GINT_TO_POINTER (48));
+ gtk_object_set_data (GTK_OBJECT (new_widget), Height, GINT_TO_POINTER (48));
+
+ if (data->action == GB_CREATING)
+ gnome_pixmap_load_xpm_d (GNOME_PIXMAP (new_widget),
+ (const char**) gnome_pixmap_xpm);
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_pixmap_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_filename (Filename, _("File:"), _("The pixmap filename"));
+ property_add_bool (Scaled, _("Scaled:"), _("If the pixmap is scaled"));
+ property_add_int_range (Width, _("Scaled Width:"),
+ _("The width to scale the pixmap to"),
+ 1, 10000, 1, 10, 1);
+ property_add_int_range (Height, _("Scaled Height:"),
+ _("The height to scale the pixmap to"),
+ 1, 10000, 1, 10, 1);
+}
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_pixmap_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gboolean scaled;
+ gint w, h;
+
+ gb_widget_output_pixmap_filename (data, Filename,
+ gtk_object_get_data (GTK_OBJECT (widget),
+ Filename));
+
+ scaled = gtk_object_get_data (GTK_OBJECT (widget), Scaled) != NULL
+ ? TRUE : FALSE;
+ if (data->action == GB_SHOWING)
+ {
+ gb_widget_output_bool (data, Scaled, scaled);
+ property_set_sensitive (Width, scaled);
+ property_set_sensitive (Height, scaled);
+ }
+
+ /* We only save the scaled width and height if the pixmap is scaled. */
+ w = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Width));
+ if (scaled || data->action == GB_SHOWING)
+ gb_widget_output_int (data, Width, w);
+
+ h = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Height));
+ if (scaled || data->action == GB_SHOWING)
+ gb_widget_output_int (data, Height, h);
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_pixmap_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gchar *filename, *old_filename;
+ gboolean set_pixmap = FALSE, scaled;
+ gint width, height;
+
+ filename = gb_widget_input_pixmap_filename (data, Filename);
+ if (data->apply)
+ {
+ set_pixmap = TRUE;
+ if (filename && filename[0] == '\0')
+ filename = NULL;
+
+ old_filename = gtk_object_get_data (GTK_OBJECT (widget), Filename);
+ if (old_filename)
+ {
+ glade_project_remove_pixmap (data->project, old_filename);
+ g_free (old_filename);
+ }
+
+ gtk_object_set_data_full (GTK_OBJECT (widget), Filename,
+ g_strdup (filename),
+ filename ? g_free : NULL);
+ if (filename)
+ {
+ glade_project_add_pixmap (data->project, filename);
+ }
+ }
+ if (data->action == GB_LOADING)
+ g_free (filename);
+
+ scaled = gb_widget_input_bool (data, Scaled);
+ if (data->apply)
+ {
+ set_pixmap = TRUE;
+ gtk_object_set_data (GTK_OBJECT (widget), Scaled, scaled ? "Y" : NULL);
+ if (property_get_widget() == widget)
+ {
+ property_set_sensitive (Width, scaled);
+ property_set_sensitive (Height, scaled);
+ }
+ }
+
+ width = gb_widget_input_int (data, Width);
+ if (data->apply)
+ {
+ set_pixmap = TRUE;
+ if (data->action == GB_LOADING)
+ gtk_object_set_data (GTK_OBJECT (widget), Scaled, "Y");
+ gtk_object_set_data (GTK_OBJECT (widget), Width,
+ GINT_TO_POINTER (width));
+ }
+
+ height = gb_widget_input_int (data, Height);
+ if (data->apply)
+ {
+ set_pixmap = TRUE;
+ if (data->action == GB_LOADING)
+ gtk_object_set_data (GTK_OBJECT (widget), Scaled, "Y");
+ gtk_object_set_data (GTK_OBJECT (widget), Height,
+ GINT_TO_POINTER (height));
+ }
+
+ if (set_pixmap)
+ gb_gnome_pixmap_reload (widget);
+}
+
+
+static void
+gb_gnome_pixmap_reload (GtkWidget *widget)
+{
+ gchar *filename;
+ gboolean scaled;
+ gint width, height;
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), Filename);
+ scaled = gtk_object_get_data (GTK_OBJECT (widget), Scaled) != NULL
+ ? TRUE : FALSE;
+ width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Width));
+ height = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Height));
+
+ if (filename)
+ {
+ if (scaled && width > 0 && height > 0)
+ gnome_pixmap_load_file_at_size (GNOME_PIXMAP (widget), filename,
+ width, height);
+ else
+ gnome_pixmap_load_file (GNOME_PIXMAP (widget), filename);
+ }
+ else
+ {
+ if (scaled && width > 0 && height > 0)
+ gnome_pixmap_load_xpm_d_at_size (GNOME_PIXMAP (widget),
+ (const char**) gnome_pixmap_xpm,
+ width, height);
+ else
+ gnome_pixmap_load_xpm_d (GNOME_PIXMAP (widget),
+ (const char**) gnome_pixmap_xpm);
+ }
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomePixmap, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_pixmap_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_pixmap_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ gchar *filename;
+ gboolean scaled;
+ gint width, height;
+
+ filename = gtk_object_get_data (GTK_OBJECT (widget), Filename);
+ if (filename && !*filename)
+ filename = NULL;
+ scaled = gtk_object_get_data (GTK_OBJECT (widget), Scaled) != NULL
+ ? TRUE : FALSE;
+ width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Width));
+ height = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Height));
+
+ if (data->create_widget)
+ {
+ source_add (data,
+ " %s = g_object_new (GNOME_TYPE_PIXMAP, NULL);\n",
+ data->wname);
+ }
+
+ if (filename)
+ {
+ filename = (gchar*) g_basename (filename);
+
+ source_add_decl (data, " gchar *%s_filename;\n", data->real_wname);
+ /* FIXME: Should convert filename to a valid C string? */
+ source_add (data,
+ " %s_filename = gnome_program_locate_file (NULL,\n"
+ " GNOME_FILE_DOMAIN_APP_PIXMAP, \"%s/%s\", TRUE, NULL);\n"
+ " if (%s_filename)\n",
+ data->real_wname,
+ data->program_name, filename,
+ data->real_wname);
+
+ if (scaled)
+ {
+ source_add (data,
+ " gnome_pixmap_load_file_at_size (GNOME_PIXMAP (%s), %s_filename, %i, %i);\n",
+ data->wname, data->real_wname, width, height);
+ }
+ else
+ {
+ source_add (data,
+ " gnome_pixmap_load_file (GNOME_PIXMAP (%s), %s_filename);\n",
+ data->wname, data->real_wname);
+ }
+
+ source_add (data,
+ " else\n"
+ " g_warning (%s, ",
+ source_make_string ("Couldn't find pixmap file: %s",
+ data->use_gettext));
+ source_add (data,
+ "%s);\n",
+ source_make_string (filename, FALSE));
+
+ source_add (data, " g_free (%s_filename);\n", data->real_wname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+}
+
+
+void
+gb_gnome_pixmap_destroy (GtkWidget * widget, GbWidgetDestroyData * data)
+{
+ gchar *filename;
+
+ /* This can be a stock id or a filename. But glade_project_remove_pixmap()
+ will just ignore it if it isn't a project pixmap file. */
+ filename = gtk_object_get_data (GTK_OBJECT (widget), Filename);
+ glade_project_remove_pixmap (data->project, filename);
+}
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_pixmap_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_pixmap_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_pixmap_xpm;
+ gbwidget.tooltip = _("Gnome Pixmap");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_pixmap_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_pixmap_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_pixmap_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_pixmap_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_pixmap_write_source;
+ gbwidget.gb_widget_destroy = gb_gnome_pixmap_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_pixmap_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomepixmapentry.c b/tools/glade/glade/gnome/gnomepixmapentry.c
new file mode 100644
index 00000000..0dc75baa
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomepixmapentry.c
@@ -0,0 +1,319 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-pixmapentry.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Preview = "GnomePixmapEntry::do_preview";
+static gchar *HistoryID = "GnomePixmapEntry|GnomeEntry::history_id";
+static gchar *MaxSaved = "GnomePixmapEntry|GnomeEntry::max_saved";
+static gchar *Title = "GnomePixmapEntry|GnomeFileEntry::browse_dialog_title";
+static gchar *Modal = "GnomePixmapEntry|GnomeFileEntry::modal";
+static gchar *FileChooser = "GnomePixmapEntry|GnomeFileEntry::use_filechooser";
+
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomePixmapEntry, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_pixmap_entry_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget, *entry;
+
+ new_widget = gnome_pixmap_entry_new (NULL, NULL, TRUE);
+
+ entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (new_widget));
+ gb_widget_create_from (entry,
+ data->action == GB_CREATING ? "combo-entry" : NULL);
+ gb_widget_set_child_name (entry, GladeChildGnomeEntry);
+
+ return new_widget;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+static void
+gb_gnome_pixmap_entry_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ property_add_bool (Preview, _("Preview:"),
+ _("If a small preview of the pixmap is displayed"));
+ property_add_string (HistoryID, _("History ID:"),
+ _("The ID to save the history entries under"));
+ property_add_int_range (MaxSaved, _("Max Saved:"),
+ _("The maximum number of history entries saved"),
+ 0, 10000, 1, 10, 1);
+ property_add_string (Title, _("Title:"),
+ _("The title of the file selection dialog"));
+ property_add_bool (Modal, _("Modal:"),
+ _("If the file selection dialog should be modal"));
+ property_add_bool (FileChooser, _("Use FileChooser:"),
+ _("Use the new GtkFileChooser widget instead of GtkFileSelection"));
+}
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+static void
+gb_gnome_pixmap_entry_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ GtkWidget *gentry;
+ gboolean use_filechooser = FALSE;
+
+ gentry = gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (widget));
+
+ gb_widget_output_string (data, HistoryID, gtk_object_get_data (GTK_OBJECT (widget), HistoryID));
+ gb_widget_output_int (data, MaxSaved, gnome_entry_get_max_saved (GNOME_ENTRY (gentry)));
+ gb_widget_output_translatable_string (data, Title, gtk_object_get_data (GTK_OBJECT (widget), Title));
+ gb_widget_output_bool (data, Modal,
+ gnome_file_entry_get_modal (GNOME_FILE_ENTRY (widget)));
+ gb_widget_output_bool (data, Preview,
+ GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Preview)));
+ g_object_get (G_OBJECT (widget), "use_filechooser", &use_filechooser,
+ NULL);
+ gb_widget_output_bool (data, FileChooser, use_filechooser);
+}
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+static void
+gb_gnome_pixmap_entry_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ GtkWidget *gentry;
+ gchar *history_id, *title;
+ gint max_saved;
+ gboolean modal, preview, use_filechooser;
+
+ gentry = gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (widget));
+
+ preview = gb_widget_input_bool (data, Preview);
+ if (data->apply)
+ {
+ gtk_object_set_data (GTK_OBJECT (widget), Preview,
+ GINT_TO_POINTER (preview));
+ gnome_pixmap_entry_set_preview (GNOME_PIXMAP_ENTRY (widget), preview);
+ /* FIXME: In GnomeLibs 1.0.1 it doesn't resize properly without this. */
+ /*gtk_widget_queue_resize (widget);*/
+ }
+
+ history_id = gb_widget_input_string (data, HistoryID);
+ if (data->apply)
+ gtk_object_set_data_full (GTK_OBJECT (widget), HistoryID,
+ g_strdup (history_id),
+ history_id ? g_free : NULL);
+
+ max_saved = gb_widget_input_int (data, MaxSaved);
+ if (data->apply)
+ gnome_entry_set_max_saved (GNOME_ENTRY (gentry), max_saved);
+
+ title = gb_widget_input_string (data, Title);
+ if (data->apply)
+ {
+ gtk_object_set_data_full (GTK_OBJECT (widget), Title, g_strdup (title),
+ title ? g_free : NULL);
+ gnome_file_entry_set_title (GNOME_FILE_ENTRY (widget),
+ title && title[0] ? title : NULL);
+ }
+
+ modal = gb_widget_input_bool (data, Modal);
+ if (data->apply)
+ gnome_file_entry_set_modal (GNOME_FILE_ENTRY (widget), modal);
+
+ use_filechooser = gb_widget_input_bool (data, FileChooser);
+ if (data->apply)
+ g_object_set (G_OBJECT (widget), "use_filechooser", use_filechooser, NULL);
+}
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomePixmapEntry, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_pixmap_entry_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_pixmap_entry_write_source (GtkWidget * widget,
+ GbWidgetWriteSourceData * data)
+{
+ GtkWidget *gentry, *entry;
+ gchar *title, *history_id;
+ gchar *wname, *child_name;
+ gboolean use_filechooser = FALSE;
+ gboolean translatable, context;
+ gchar *comments;
+
+ gentry = gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (widget));
+
+ title = gtk_object_get_data (GTK_OBJECT (widget), Title);
+ if (title && title[0] == '\0')
+ title = NULL;
+
+ history_id = gtk_object_get_data (GTK_OBJECT (widget), HistoryID);
+ if (history_id && history_id[0] == '\0')
+ history_id = NULL;
+
+ if (data->create_widget)
+ {
+ gboolean do_preview;
+
+ glade_util_get_translation_properties (widget, Title, &translatable,
+ &comments, &context);
+ source_add_translator_comments (data, translatable, comments);
+
+ do_preview = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
+ Preview));
+
+ source_add (data, " %s = gnome_pixmap_entry_new (%s, ",
+ data->wname,
+ history_id ? source_make_string (history_id, FALSE) : "NULL");
+
+ source_add (data, "%s, %s);\n",
+ title ? source_make_string_full (title, data->use_gettext && translatable, context) : "NULL",
+ do_preview ? "TRUE" : "FALSE");
+ }
+ gb_widget_write_standard_source (widget, data);
+
+ /* Note that GLADE_DEFAULT_MAX_HISTORY_SAVED is copied from gnome-entry.c */
+ if (gnome_entry_get_max_saved (GNOME_ENTRY (gentry)) != GLADE_DEFAULT_MAX_HISTORY_SAVED)
+ source_add (data, " gnome_entry_set_max_saved (GNOME_ENTRY (gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (%s))), %i);\n",
+ data->wname,
+ gnome_entry_get_max_saved (GNOME_ENTRY (gentry)));
+
+ if (gnome_file_entry_get_modal (GNOME_FILE_ENTRY (widget)))
+ source_add (data,
+ " gnome_file_entry_set_modal (GNOME_FILE_ENTRY (%s), TRUE);\n",
+ data->wname);
+
+ g_object_get (G_OBJECT (widget), "use_filechooser", &use_filechooser, NULL);
+ if (use_filechooser)
+ source_add (data,
+ " g_object_set (G_OBJECT (%s), \"use_filechooser\", TRUE, NULL);\n",
+ data->wname);
+
+
+ /* We output the source code for the children here, since the code should
+ not include calls to create the widgets. We need to specify that the
+ names used are like: "GTK_COMBO (<combo-name>)->entry".
+ We need to remember the dialog's name since data->wname
+ will be overwritten. */
+ wname = g_strdup (data->wname);
+
+ source_add (data, "\n");
+ entry = GTK_COMBO (gentry)->entry;
+ child_name = (char*) gtk_widget_get_name (entry);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data,
+ " %s = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (%s));\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (entry, data);
+
+ g_free (wname);
+ data->write_children = FALSE;
+}
+
+
+static GtkWidget *
+gb_gnome_pixmap_entry_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildGnomeEntry))
+ return gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (widget));
+ else
+ return NULL;
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_pixmap_entry_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_pixmap_entry_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_pixmapentry_xpm;
+ gbwidget.tooltip = _("GnomePixmapEntry");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_pixmap_entry_new;
+ gbwidget.gb_widget_create_properties = gb_gnome_pixmap_entry_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_pixmap_entry_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_pixmap_entry_set_properties;
+ gbwidget.gb_widget_write_source = gb_gnome_pixmap_entry_write_source;
+ gbwidget.gb_widget_get_child = gb_gnome_pixmap_entry_get_child;
+/*
+ gbwidget.gb_widget_set_child_props = gb_gnome_pixmap_entry_set_child_props;
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_pixmap_entry_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+
diff --git a/tools/glade/glade/gnome/gnomepropertybox.c b/tools/glade/glade/gnome/gnomepropertybox.c
new file mode 100644
index 00000000..51ba9aec
--- /dev/null
+++ b/tools/glade/glade/gnome/gnomepropertybox.c
@@ -0,0 +1,383 @@
+/* Gtk+ User Interface Builder
+ * Copyright (C) 1999 Damon Chaplin
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <gnome.h>
+#include "../gb.h"
+
+/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
+#include "../graphics/gnome-propertybox.xpm"
+
+/*
+ * This is the GbWidget struct for this widget (see ../gbwidget.h).
+ * It is initialized in the init() function at the end of this file
+ */
+static GbWidget gbwidget;
+
+static gchar *Title = "GnomePropertyBox|GtkWindow::title";
+static gchar *Position = "GnomePropertyBox|GtkWindow::window_position";
+static gchar *Modal = "GnomePropertyBox|GtkWindow::modal";
+static gchar *DefaultWidth = "GnomePropertyBox|GtkWindow::default_width";
+static gchar *DefaultHeight = "GnomePropertyBox|GtkWindow::default_height";
+static gchar *Shrink = "GnomePropertyBox|GtkWindow::allow_shrink";
+static gchar *Grow = "GnomePropertyBox|GtkWindow::allow_grow";
+static gchar *AutoShrink = "GnomePropertyBox|GtkWindow::auto_shrink";
+static gchar *IconName = "GnomePropertyBox|GtkWindow::icon_name";
+static gchar *FocusOnMap = "GnomePropertyBox|GtkWindow::focus_on_map";
+
+static gchar *Resizable = "GnomePropertyBox|GtkWindow::resizable";
+static gchar *DestroyWithParent = "GnomePropertyBox|GtkWindow::destroy_with_parent";
+static gchar *Icon = "GnomePropertyBox|GtkWindow::icon";
+
+static gchar *Role = "GnomePropertyBox|GtkWindow::role";
+static gchar *TypeHint = "GnomePropertyBox|GtkWindow::type_hint";
+static gchar *SkipTaskbar = "GnomePropertyBox|GtkWindow::skip_taskbar_hint";
+static gchar *SkipPager = "GnomePropertyBox|GtkWindow::skip_pager_hint";
+static gchar *Decorated = "GnomePropertyBox|GtkWindow::decorated";
+static gchar *Gravity = "GnomePropertyBox|GtkWindow::gravity";
+static gchar *Urgency = "GnomePropertyBox|GtkWindow::urgency_hint";
+
+static void show_gnome_property_box_dialog (GbWidgetNewData * data);
+static void on_gnome_property_box_dialog_ok (GtkWidget * widget,
+ GbWidgetNewData * data);
+static void on_gnome_property_box_dialog_destroy (GtkWidget * widget,
+ GbWidgetNewData * data);
+GtkWidget * gnome_property_box_new_tab_label ();
+
+/******
+ * NOTE: To use these functions you need to uncomment them AND add a pointer
+ * to the function in the GbWidget struct at the end of this file.
+ ******/
+
+/*
+ * Creates a new GtkWidget of class GnomePropertyBox, performing any specialized
+ * initialization needed for the widget to work correctly in this environment.
+ * If a dialog box is used to initialize the widget, return NULL from this
+ * function, and call data->callback with your new widget when it is done.
+ */
+static GtkWidget*
+gb_gnome_property_box_new (GbWidgetNewData *data)
+{
+ GtkWidget *new_widget;
+
+ if (data->action == GB_LOADING)
+ {
+ new_widget = gnome_property_box_new ();
+
+ gb_widget_create_from (GNOME_PROPERTY_BOX (new_widget)->notebook,
+ data->action == GB_CREATING ? "notebook" : NULL);
+ gb_widget_set_child_name (GNOME_PROPERTY_BOX (new_widget)->notebook,
+ GladeChildGnomePBoxNotebook);
+
+ /* We connect a close signal handler which always returns TRUE so that
+ the built-in close functionality is skipped. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "close",
+ GTK_SIGNAL_FUNC (gtk_true), NULL);
+
+ /* Now we connect our normal delete_event handler. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
+ GTK_SIGNAL_FUNC (editor_close_window), NULL);
+
+ return new_widget;
+ }
+ else
+ {
+ show_gnome_property_box_dialog (data);
+ return NULL;
+ }
+}
+
+
+static void
+show_gnome_property_box_dialog (GbWidgetNewData * data)
+{
+ GtkWidget *dialog, *vbox, *hbox, *label, *spinbutton;
+ GtkObject *adjustment;
+
+ dialog = glade_util_create_dialog (_("New GnomePropertyBox"), data->parent,
+ GTK_SIGNAL_FUNC (on_gnome_property_box_dialog_ok),
+ data, &vbox);
+ gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
+ GTK_SIGNAL_FUNC (on_gnome_property_box_dialog_destroy),
+ data);
+
+ hbox = gtk_hbox_new (FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
+ gtk_widget_show (hbox);
+
+ label = gtk_label_new (_("Number of pages:"));
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 5);
+ gtk_widget_show (label);
+
+ adjustment = gtk_adjustment_new (3, 1, 100, 1, 10, 10);
+ spinbutton = glade_util_spin_button_new (GTK_OBJECT (dialog), "pages",
+ GTK_ADJUSTMENT (adjustment), 1, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, TRUE, 5);
+ gtk_widget_set_usize (spinbutton, 50, -1);
+ gtk_widget_grab_focus (spinbutton);
+ gtk_widget_show (spinbutton);
+
+ gtk_widget_show (dialog);
+ gtk_grab_add (dialog);
+}
+
+
+static void
+on_gnome_property_box_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
+{
+ GtkWidget *new_widget, *spinbutton, *window, *placeholder;
+ gint pages, i;
+
+ window = gtk_widget_get_toplevel (widget);
+
+ /* Only call callback if placeholder/fixed widget is still there */
+ if (gb_widget_can_finish_new (data))
+ {
+ spinbutton = gtk_object_get_data (GTK_OBJECT (window), "pages");
+ g_return_if_fail (spinbutton != NULL);
+ pages = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));
+
+ new_widget = gnome_property_box_new ();
+
+ gb_widget_create_from (GNOME_PROPERTY_BOX (new_widget)->notebook,
+ "notebook");
+ gb_widget_set_child_name (GNOME_PROPERTY_BOX (new_widget)->notebook,
+ GladeChildGnomePBoxNotebook);
+
+ for (i = 0; i < pages; i++)
+ {
+ placeholder = editor_new_placeholder ();
+ gtk_widget_set_usize (placeholder, 300, 150);
+ gnome_property_box_append_page (GNOME_PROPERTY_BOX (new_widget),
+ placeholder,
+ gnome_property_box_new_tab_label ());
+ }
+
+ /* We connect a close signal handler which always returns TRUE so that
+ the built-in close functionality is skipped. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "close",
+ GTK_SIGNAL_FUNC (gtk_true), NULL);
+
+ /* Now we connect our normal delete_event handler. */
+ gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
+ GTK_SIGNAL_FUNC (editor_close_window), NULL);
+
+ gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
+ GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));
+
+ gb_widget_initialize (new_widget, data);
+ (*data->callback) (new_widget, data);
+ }
+ gtk_widget_destroy (window);
+}
+
+
+static void
+on_gnome_property_box_dialog_destroy (GtkWidget * widget,
+ GbWidgetNewData * data)
+{
+ gb_widget_free_new_data (data);
+ gtk_grab_remove (widget);
+}
+
+
+GtkWidget *
+gnome_property_box_new_tab_label ()
+{
+ GtkWidget *label;
+
+ label = gb_widget_new ("GtkLabel", NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ return label;
+}
+
+
+
+/*
+ * Creates the components needed to edit the extra properties of this widget.
+ */
+
+static void
+gb_gnome_property_box_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data)
+{
+ gb_window_create_standard_properties (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+}
+
+
+
+
+/*
+ * Gets the properties of the widget. This is used for both displaying the
+ * properties in the property editor, and also for saving the properties.
+ */
+
+static void
+gb_gnome_property_box_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
+{
+ gb_window_get_standard_properties (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+}
+
+
+
+
+/*
+ * Sets the properties of the widget. This is used for both applying the
+ * properties changed in the property editor, and also for loading.
+ */
+
+static void
+gb_gnome_property_box_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
+{
+ gb_window_set_standard_properties (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+}
+
+
+
+
+/*
+ * Adds menu items to a context menu which is just about to appear!
+ * Add commands to aid in editing a GnomePropertyBox, with signals pointing to
+ * other functions in this file.
+ */
+/*
+static void
+gb_gnome_property_box_create_popup_menu (GtkWidget * widget, GbWidgetCreateMenuData * data)
+{
+
+}
+*/
+
+
+
+/*
+ * Writes the source code needed to create this widget.
+ * You have to output everything necessary to create the widget here, though
+ * there are some convenience functions to help.
+ */
+static void
+gb_gnome_property_box_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
+{
+ gchar *wname, *child_name;
+
+ if (data->create_widget)
+ {
+ source_add (data, " %s = gnome_property_box_new ();\n", data->wname);
+ }
+
+ gb_widget_write_standard_source (widget, data);
+
+ gb_window_write_standard_source (widget, data,
+ Title, NULL, Position, Modal,
+ DefaultWidth, DefaultHeight,
+ Shrink, Grow, AutoShrink,
+ IconName, FocusOnMap,
+ Resizable, DestroyWithParent, Icon,
+ Role, TypeHint, SkipTaskbar,
+ SkipPager, Decorated, Gravity, Urgency);
+
+ /* We output the source code for the children here, since the code should
+ not include calls to create the widgets. We need to specify that the
+ names used are like: "GTK_DIALOG (<dialog-name>)->vbox".
+ We need to remember the dialog's name since data->wname
+ will be overwritten. */
+ wname = g_strdup (data->wname);
+
+ source_add (data, "\n");
+ child_name = (char*) gtk_widget_get_name (GNOME_PROPERTY_BOX (widget)->notebook);
+ child_name = source_create_valid_identifier (child_name);
+ source_add (data, " %s = GNOME_PROPERTY_BOX (%s)->notebook;\n",
+ child_name, wname);
+ g_free (child_name);
+ data->create_widget = FALSE;
+ gb_widget_write_source (GNOME_PROPERTY_BOX (widget)->notebook, data);
+
+ g_free (wname);
+ data->write_children = FALSE;
+}
+
+
+static GtkWidget *
+gb_gnome_property_box_get_child (GtkWidget * widget,
+ const gchar * child_name)
+{
+ if (!strcmp (child_name, GladeChildGnomePBoxNotebook))
+ return GNOME_PROPERTY_BOX (widget)->notebook;
+ else
+ return NULL;
+}
+
+
+
+/*
+ * Initializes the GbWidget structure.
+ * I've placed this at the end of the file so we don't have to include
+ * declarations of all the functions.
+ */
+GbWidget*
+gb_gnome_property_box_init ()
+{
+ /* Initialise the GTK type */
+ volatile GtkType type;
+ type = gnome_property_box_get_type();
+
+ /* Initialize the GbWidget structure */
+ gb_widget_init_struct(&gbwidget);
+
+ /* Fill in the pixmap struct & tooltip */
+ gbwidget.pixmap_struct = gnome_propertybox_xpm;
+ gbwidget.tooltip = _("Property Dialog Box");
+
+ /* Fill in any functions that this GbWidget has */
+ gbwidget.gb_widget_new = gb_gnome_property_box_new;
+ gbwidget.gb_widget_write_source = gb_gnome_property_box_write_source;
+ gbwidget.gb_widget_get_child = gb_gnome_property_box_get_child;
+
+ gbwidget.gb_widget_create_properties = gb_gnome_property_box_create_properties;
+ gbwidget.gb_widget_get_properties = gb_gnome_property_box_get_properties;
+ gbwidget.gb_widget_set_properties = gb_gnome_property_box_set_properties;
+ gbwidget.gb_widget_destroy = gb_window_destroy;
+/*
+ gbwidget.gb_widget_create_popup_menu = gb_gnome_property_box_create_popup_menu;
+*/
+
+ return &gbwidget;
+}
+