diff options
Diffstat (limited to 'tools/glade/glade/gnome-db/gnomedberrordlg.c')
-rw-r--r-- | tools/glade/glade/gnome-db/gnomedberrordlg.c | 232 |
1 files changed, 232 insertions, 0 deletions
diff --git a/tools/glade/glade/gnome-db/gnomedberrordlg.c b/tools/glade/glade/gnome-db/gnomedberrordlg.c new file mode 100644 index 00000000..696be87d --- /dev/null +++ b/tools/glade/glade/gnome-db/gnomedberrordlg.c @@ -0,0 +1,232 @@ +/* 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 <gtk/gtkmain.h> +#include <libgnomedb/gnome-db-error-dialog.h> +#include "../gb.h" + +/* Include the 21x21 icon pixmap for this widget, to be used in the palette */ +#include "../graphics/gnome-db-error-dlg.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 = "GnomeDbErrorDlg|GtkWindow::title"; +static gchar *Type = "GnomeDbErrorDlg|GtkWindow::type"; +static gchar *Position = "GnomeDbErrorDlg|GtkWindow::window_position"; +static gchar *Modal = "GnomeDbErrorDlg|GtkWindow::modal"; +static gchar *DefaultWidth = "GnomeDbErrorDlg|GtkWindow::default_width"; +static gchar *DefaultHeight = "GnomeDbErrorDlg|GtkWindow::default_height"; +static gchar *Shrink = "GnomeDbErrorDlg|GtkWindow::allow_shrink"; +static gchar *Grow = "GnomeDbErrorDlg|GtkWindow::allow_grow"; +static gchar *AutoShrink = "GnomeDbErrorDlg|GtkWindow::auto_shrink"; +static gchar *IconName = "GnomeDbErrorDlg|GtkWindow::icon_name"; +static gchar *FocusOnMap = "GnomeDbErrorDlg|GtkWindow::focus_on_map"; + +static gchar *Resizable = "GnomeDbErrorDlg|GtkWindow::resizable"; +static gchar *DestroyWithParent = "GnomeDbErrorDlg|GtkWindow::destroy_with_parent"; +static gchar *Icon = "GnomeDbErrorDlg|GtkWindow::icon"; + +static gchar *Role = "GnomeDbErrorDlg|GtkWindow::role"; +static gchar *TypeHint = "GnomeDbErrorDlg|GtkWindow::type_hint"; +static gchar *SkipTaskbar = "GnomeDbErrorDlg|GtkWindow::skip_taskbar_hint"; +static gchar *SkipPager = "GnomeDbErrorDlg|GtkWindow::skip_pager_hint"; +static gchar *Decorated = "GnomeDbErrorDlg|GtkWindow::decorated"; +static gchar *Gravity = "GnomeDbErrorDlg|GtkWindow::gravity"; +static gchar *Urgency = "GnomeDbErrorDlg|GtkWindow::urgency_hint"; + +/****** + * 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 GnomeDbErrorDlg, 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_db_errordlg_new (GbWidgetNewData *data) +{ + GtkWidget *widget; + GList *elem; + + widget = gnome_db_error_dialog_new (_("Error")); + + /* We connect a close signal handler which always returns TRUE so that + the built-in close functionality is skipped. */ + gtk_signal_connect (GTK_OBJECT (widget), "close", + GTK_SIGNAL_FUNC (gtk_true), NULL); + + /* Now we connect our normal delete_event handler. */ + gtk_signal_connect (GTK_OBJECT (widget), "delete_event", + GTK_SIGNAL_FUNC (editor_close_window), NULL); + + gtk_object_set_data (GTK_OBJECT (widget), TypeHint, + GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX)); + + return widget; +} + + + +/* + * Creates the components needed to edit the extra properties of this widget. + */ +static void +gb_gnome_db_errordlg_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); +} + + + +/* + * 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_db_errordlg_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); +} + + + +/* + * 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_db_errordlg_set_properties (GtkWidget * widget, GbWidgetSetArgData * data) +{ + 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); +} + + + +/* + * Adds menu items to a context menu which is just about to appear! + * Add commands to aid in editing a GnomeDbErrorDlg, with signals pointing to + * other functions in this file. + */ +static void +gb_gnome_db_errordlg_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_db_errordlg_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data) +{ + if (data->create_widget) + { + gchar *title; + gboolean translatable, context; + gchar *comments; + + 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_db_error_dialog_new (%s);\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); +} + + + +/* + * 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_db_errordlg_init () +{ + /* Initialise the GTK type */ + volatile GtkType type; + type = gnome_db_error_dialog_get_type(); + + /* Initialize the GbWidget structure */ + gb_widget_init_struct(&gbwidget); + + /* Fill in the pixmap struct & tooltip */ + gbwidget.pixmap_struct = gnome_db_error_dlg_xpm; + gbwidget.tooltip = _("Database error dialog"); + + /* Fill in any functions that this GbWidget has */ + gbwidget.gb_widget_new = gb_gnome_db_errordlg_new; + gbwidget.gb_widget_create_properties = gb_gnome_db_errordlg_create_properties; + gbwidget.gb_widget_get_properties = gb_gnome_db_errordlg_get_properties; + gbwidget.gb_widget_set_properties = gb_gnome_db_errordlg_set_properties; + gbwidget.gb_widget_write_source = gb_gnome_db_errordlg_write_source; + gbwidget.gb_widget_create_popup_menu = gb_gnome_db_errordlg_create_popup_menu; + gbwidget.gb_widget_destroy = gb_window_destroy; + + return &gbwidget; +} + |