[monkey-bubble: 670/753] Fix i18n issues (as in, translations should work again now) and add a
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 670/753] Fix i18n issues (as in, translations should work again now) and add a
- Date: Wed, 14 Jul 2010 22:52:01 +0000 (UTC)
commit b63d00e66ab2e6a387eb5cd520b297bad4cf5c22
Author: George Lebl <jirka 5z com>
Date: Sun Aug 26 23:41:14 2001 +0000
Fix i18n issues (as in, translations should work again now) and add a
Sun Aug 26 16:37:35 2001 George Lebl <jirka 5z com>
* gnome-i18nP.h, gnome-app-util.c, gnome-app.c, gnome-canvas-init.c,
gnome-client.c, gnome-color-picker.c, gnome-dateedit.c,
gnome-druid-page-edge.c, gnome-druid-page-standard.c, gnome-druid.c,
gnome-entry.c, gnome-file-entry.c, gnome-font-picker.c,
gnome-href.c, gnome-stock-icons.c, gnome-ui-init.c, gnome_segv.c,
libgnomeuiP.h: Fix i18n issues (as in, translations should work
again now) and add a gnome-i18nP.h like in libgnome.
* Makefile.am, gnome-dialog-util.[ch], gnome-dialog.[ch],
gnome-messagebox.[ch]: Ressurect the gnome-dialog/messagebox stuff
only to be deprecated, and it is marked deprecated. The
gnome-stock defines for buttons have been added to gnome-dialog.h,
and they point to corresponding GTK_STOCK_ defines.
* gnome-dateedit.[ch], gnome-file-entry.h, gnome-href.[ch]: use
GNOME_DISABLE_DEPRECATED rather then GNOME_EXCLUDE_DEPRECATED
* gnome-file-entry.c: add GNOME_DISABLE_DEPRECATED_SOURCE around
a deprecated method and some fixups related
libgnomeui/ChangeLog | 22 +
libgnomeui/Makefile.am | 7 +
libgnomeui/gnome-app-util.c | 3 +
libgnomeui/gnome-app.c | 6 +-
libgnomeui/gnome-canvas-init.c | 3 +
libgnomeui/gnome-client.c | 4 +-
libgnomeui/gnome-color-picker.c | 5 +-
libgnomeui/gnome-dateedit.c | 8 +-
libgnomeui/gnome-dateedit.h | 4 +-
libgnomeui/gnome-dialog-util.c | 543 +++++++++++++++
libgnomeui/gnome-dialog-util.h | 145 ++++
libgnomeui/gnome-dialog.c | 1170 ++++++++++++++++++++++++++++++++
libgnomeui/gnome-dialog.h | 201 ++++++
libgnomeui/gnome-druid-page-edge.c | 4 +-
libgnomeui/gnome-druid-page-standard.c | 4 +-
libgnomeui/gnome-druid.c | 3 +
libgnomeui/gnome-entry.c | 5 +-
libgnomeui/gnome-file-entry.c | 9 +-
libgnomeui/gnome-file-entry.h | 4 +-
libgnomeui/gnome-font-picker.c | 4 +-
libgnomeui/gnome-href.c | 9 +-
libgnomeui/gnome-href.h | 4 +-
libgnomeui/gnome-i18nP.h | 57 ++
libgnomeui/gnome-messagebox.c | 352 ++++++++++
libgnomeui/gnome-messagebox.h | 82 +++
libgnomeui/gnome-stock-icons.c | 3 +-
libgnomeui/gnome-ui-init.c | 3 +
libgnomeui/gnome_segv.c | 3 +
libgnomeui/libgnomeuiP.h | 4 -
29 files changed, 2643 insertions(+), 28 deletions(-)
---
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index 42d955f..ae80202 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,3 +1,25 @@
+Sun Aug 26 16:37:35 2001 George Lebl <jirka 5z com>
+
+ * gnome-i18nP.h, gnome-app-util.c, gnome-app.c, gnome-canvas-init.c,
+ gnome-client.c, gnome-color-picker.c, gnome-dateedit.c,
+ gnome-druid-page-edge.c, gnome-druid-page-standard.c, gnome-druid.c,
+ gnome-entry.c, gnome-file-entry.c, gnome-font-picker.c,
+ gnome-href.c, gnome-stock-icons.c, gnome-ui-init.c, gnome_segv.c,
+ libgnomeuiP.h: Fix i18n issues (as in, translations should work
+ again now) and add a gnome-i18nP.h like in libgnome.
+
+ * Makefile.am, gnome-dialog-util.[ch], gnome-dialog.[ch],
+ gnome-messagebox.[ch]: Ressurect the gnome-dialog/messagebox stuff
+ only to be deprecated, and it is marked deprecated. The
+ gnome-stock defines for buttons have been added to gnome-dialog.h,
+ and they point to corresponding GTK_STOCK_ defines.
+
+ * gnome-dateedit.[ch], gnome-file-entry.h, gnome-href.[ch]: use
+ GNOME_DISABLE_DEPRECATED rather then GNOME_EXCLUDE_DEPRECATED
+
+ * gnome-file-entry.c: add GNOME_DISABLE_DEPRECATED_SOURCE around
+ a deprecated method and some fixups related
+
Sun Aug 26 09:18:55 2001 George Lebl <jirka 5z com>
* gnome-app-helper.[ch], gnome-app-util.[ch], gnome-app.[ch],
diff --git a/libgnomeui/Makefile.am b/libgnomeui/Makefile.am
index 6301974..c6d7232 100644
--- a/libgnomeui/Makefile.am
+++ b/libgnomeui/Makefile.am
@@ -49,6 +49,8 @@ libgnomeui_2_la_SOURCES = \
gnome-client.c \
gnome-color-picker.c \
gnome-dateedit.c \
+ gnome-dialog.c \
+ gnome-dialog-util.c \
gnome-druid.c \
gnome-druid-page.c \
gnome-druid-page-edge.c \
@@ -60,6 +62,8 @@ libgnomeui_2_la_SOURCES = \
gnome-image-selector.c \
gnome-href.c \
gnome-ice.c \
+ gnome-i18nP.h \
+ gnome-messagebox.c \
gnome-ui-init.c \
gnome-winhints.c \
gnometypes.c \
@@ -74,6 +78,8 @@ gnome_headers = \
gnome-client.h \
gnome-color-picker.h \
gnome-dateedit.h \
+ gnome-dialog.h \
+ gnome-dialog-util.h \
gnome-druid.h \
gnome-druid-page.h \
gnome-druid-page-edge.h \
@@ -87,6 +93,7 @@ gnome_headers = \
gnome-ice.h \
gnome-icon-list.h \
gnome-macros.h \
+ gnome-messagebox.h \
gnome-ui-init.h \
gnome-stock-icons.h \
gnome-types.h \
diff --git a/libgnomeui/gnome-app-util.c b/libgnomeui/gnome-app-util.c
index 08f2c0e..668e488 100644
--- a/libgnomeui/gnome-app-util.c
+++ b/libgnomeui/gnome-app-util.c
@@ -26,6 +26,9 @@
#include "gnome-app-util.h"
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
diff --git a/libgnomeui/gnome-app.c b/libgnomeui/gnome-app.c
index ea259be..12243cc 100644
--- a/libgnomeui/gnome-app.c
+++ b/libgnomeui/gnome-app.c
@@ -43,9 +43,11 @@
#include <string.h>
#include <gtk/gtk.h>
-#include <libgnome/gnome-program.h>
-#include <libgnome/gnome-i18n.h>
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
+#include <libgnome/gnome-program.h>
#include <libgnome/gnome-util.h>
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-preferences.h>
diff --git a/libgnomeui/gnome-canvas-init.c b/libgnomeui/gnome-canvas-init.c
index 8e0ed89..7916813 100644
--- a/libgnomeui/gnome-canvas-init.c
+++ b/libgnomeui/gnome-canvas-init.c
@@ -28,6 +28,9 @@
#include <gobject/gboxed.h>
#include <gtk/gtk.h>
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <libgnomecanvas.h>
#include <libgnome.h>
diff --git a/libgnomeui/gnome-client.c b/libgnomeui/gnome-client.c
index 42293c6..a576c6e 100644
--- a/libgnomeui/gnome-client.c
+++ b/libgnomeui/gnome-client.c
@@ -32,7 +32,9 @@
#include <sys/types.h>
#include <errno.h>
-#include <libgnome/gnome-i18n.h>
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include "gnome-client.h"
#include "gnome-uidefs.h"
#include "gnome-ice.h"
diff --git a/libgnomeui/gnome-color-picker.c b/libgnomeui/gnome-color-picker.c
index 168f683..62f6875 100644
--- a/libgnomeui/gnome-color-picker.c
+++ b/libgnomeui/gnome-color-picker.c
@@ -38,8 +38,11 @@
#include <gtk/gtkdrawingarea.h>
#include <gtk/gtkframe.h>
#include <gtk/gtksignal.h>
+
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include "gnome-color-picker.h"
-#include <libgnome/gnome-i18n.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkbutton.h>
diff --git a/libgnomeui/gnome-dateedit.c b/libgnomeui/gnome-dateedit.c
index c63871e..2140b7d 100644
--- a/libgnomeui/gnome-dateedit.c
+++ b/libgnomeui/gnome-dateedit.c
@@ -38,6 +38,10 @@
#include <stdio.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include "gnome-dateedit.h"
#include <libgnome/gnome-i18n.h>
@@ -908,7 +912,7 @@ gnome_date_edit_get_time (GnomeDateEdit *gde)
return mktime (&tm);
}
-#ifndef GNOME_EXCLUDE_DEPRECATED_SOURCE
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
/**
* gnome_date_edit_get_date:
@@ -923,7 +927,7 @@ gnome_date_edit_get_date (GnomeDateEdit *gde)
return gnome_date_edit_get_time(gde);
}
-#endif /* not GNOME_EXCLUDE_DEPRECATED_SOURCE */
+#endif /* not GNOME_DISABLE_DEPRECATED_SOURCE */
/**
diff --git a/libgnomeui/gnome-dateedit.h b/libgnomeui/gnome-dateedit.h
index df2e45d..c0ab82b 100644
--- a/libgnomeui/gnome-dateedit.h
+++ b/libgnomeui/gnome-dateedit.h
@@ -86,9 +86,9 @@ int gnome_date_edit_get_flags (GnomeDateEdit *gde);
time_t gnome_date_edit_get_initial_time(GnomeDateEdit *gde);
-#ifndef GNOME_EXCLUDE_DEPRECATED
+#ifndef GNOME_DISABLE_DEPRECATED
time_t gnome_date_edit_get_date (GnomeDateEdit *gde);
-#endif /* GNOME_EXCLUDE_DEPRECATED */
+#endif /* GNOME_DISABLE_DEPRECATED */
G_END_DECLS
diff --git a/libgnomeui/gnome-dialog-util.c b/libgnomeui/gnome-dialog-util.c
new file mode 100644
index 0000000..536bdb3
--- /dev/null
+++ b/libgnomeui/gnome-dialog-util.c
@@ -0,0 +1,543 @@
+/* GNOME GUI Library: gnome-dialog-util.c
+ * Copyright (C) 1998 Free Software Foundation
+ * All rights reserved.
+ * Author: Havoc Pennington
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ */
+/*
+ @NOTATION@
+*/
+
+#include <config.h>
+
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
+
+#include "gnome-i18nP.h"
+
+#include "gnome-dialog.h"
+#include "gnome-messagebox.h"
+#include "gnome-types.h"
+#include "gnome-uidefs.h"
+#include "gnome-dialog-util.h"
+#include <gtk/gtk.h>
+
+static GtkWidget *
+show_ok_box(const gchar * message, const gchar * type, GtkWindow * parent)
+{
+ GtkWidget * mbox;
+
+ mbox = gnome_message_box_new (message, type,
+ GNOME_STOCK_BUTTON_OK, NULL);
+
+ if (parent != NULL) {
+ gnome_dialog_set_parent(GNOME_DIALOG(mbox),parent);
+ }
+
+ gtk_widget_show (mbox);
+ return mbox;
+}
+
+
+/* A little OK box */
+/**
+ * gnome_ok_dialog:
+ * @message: Message to display
+ *
+ * Description: Creates and shows a simple message dialog.
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_ok_dialog (const gchar * message)
+{
+ return show_ok_box (message, GNOME_MESSAGE_BOX_INFO, NULL);
+}
+
+/**
+ * gnome_ok_dialog_parented:
+ * @message: Message to display
+ * @parent: Parent window
+ *
+ * Description: Creates and shows a simple message dialog.
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_ok_dialog_parented (const gchar * message, GtkWindow * parent)
+{
+ return show_ok_box (message, GNOME_MESSAGE_BOX_INFO, parent);
+}
+
+/* Operation failed fatally. In an OK dialog. */
+/**
+ * gnome_error_dialog:
+ * @error: Message to display
+ *
+ * Description: Creates and shows a error dialog. This is an OK
+ * dialog to display on fatally failed operations.
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_error_dialog (const gchar * error)
+{
+ return show_ok_box(error, GNOME_MESSAGE_BOX_ERROR, NULL);
+}
+
+/**
+ * gnome_error_dialog_parented:
+ * @warning: Message to display
+ * @parent: Parent window
+ *
+ * Description: Creates and shows a error dialog. This is an OK
+ * dialog to display on fatally failed operations.
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_error_dialog_parented (const gchar * error, GtkWindow * parent)
+{
+ return show_ok_box(error, GNOME_MESSAGE_BOX_ERROR, parent);
+}
+
+/* Just a warning. */
+/**
+ * gnome_warning_dialog:
+ * @warning: Message to display
+ *
+ * Description: Creates and shows a warning dialog. For non-fatal
+ * warnings.
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_warning_dialog (const gchar * warning)
+{
+ return show_ok_box(warning, GNOME_MESSAGE_BOX_WARNING, NULL);
+}
+
+/**
+ * gnome_warning_dialog_parented:
+ * @warning: Message to display
+ * @parent: Parent window
+ *
+ * Description: Creates and shows a warning dialog. For non-fatal
+ * warnings.
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_warning_dialog_parented (const gchar * warning, GtkWindow * parent)
+{
+ return show_ok_box(warning, GNOME_MESSAGE_BOX_WARNING, parent);
+}
+
+
+typedef struct {
+ gpointer function;
+ gpointer data;
+ GtkEntry * entry;
+} callback_info;
+
+static void
+dialog_reply_callback (GnomeMessageBox * mbox, gint button, callback_info* data)
+{
+ GnomeReplyCallback func = (GnomeReplyCallback) data->function;
+ (* func)(button, data->data);
+}
+
+static GtkWidget *
+reply_dialog (const gchar * question, GnomeReplyCallback callback, gpointer data,
+ gboolean yes_or_ok, gboolean modal, GtkWindow * parent)
+{
+ GtkWidget * mbox;
+ callback_info * info;
+
+ if (yes_or_ok) {
+ mbox = gnome_message_box_new(question, GNOME_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO, NULL);
+ }
+ else {
+ mbox = gnome_message_box_new(question, GNOME_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL, NULL);
+ }
+
+ if (callback != NULL) {
+ info = g_new(callback_info, 1);
+
+ info->function = callback;
+ info->data = data;
+
+ gtk_signal_connect_full(GTK_OBJECT(mbox), "clicked",
+ GTK_SIGNAL_FUNC(dialog_reply_callback),
+ NULL,
+ info,
+ (GtkDestroyNotify)g_free,
+ FALSE, FALSE);
+ }
+
+ if (modal) {
+ gtk_window_set_modal(GTK_WINDOW(mbox),TRUE);
+ }
+
+ if (parent != NULL) {
+ gnome_dialog_set_parent(GNOME_DIALOG(mbox),parent);
+ }
+
+ gtk_widget_show(mbox);
+ return mbox;
+}
+
+
+/* Ask a yes or no question, and call the callback when it's answered. */
+
+/**
+ * gnome_question_dialog:
+ * @question: Question to ask
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ *
+ * Description: Creates a question dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'Yes', 1 for 'No'
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_question_dialog (const gchar * question,
+ GnomeReplyCallback callback, gpointer data)
+{
+ return reply_dialog(question, callback, data, TRUE, FALSE, NULL);
+}
+
+/**
+ * gnome_question_dialog_parented:
+ * @question: Question to ask
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ * @parent: Parent window
+ *
+ * Description: Creates a question dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'Yes', 1 for 'No'
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_question_dialog_parented (const gchar * question,
+ GnomeReplyCallback callback, gpointer data,
+ GtkWindow * parent)
+{
+ return reply_dialog(question, callback, data, TRUE, FALSE, parent);
+}
+
+/**
+ * gnome_question_dialog_modal:
+ * @question: Question to ask
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ *
+ * Description: Creates a question dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'Yes', 1 for 'No'. The dialog is created as a modal
+ * dialog and the user will have to answer this before proceeding.
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_question_dialog_modal (const gchar * question, GnomeReplyCallback callback, gpointer data)
+{
+ return reply_dialog(question, callback, data, TRUE, TRUE, NULL);
+}
+
+/**
+ * gnome_question_dialog_modal_parented:
+ * @question: Question to ask
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ * @parent: Parent window
+ *
+ * Description: Creates a question dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'Yes', 1 for 'No'. The dialog is created as a modal
+ * dialog and the user will have to answer this before proceeding.
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_question_dialog_modal_parented (const gchar * question,
+ GnomeReplyCallback callback, gpointer data,
+ GtkWindow * parent)
+{
+ return reply_dialog(question, callback, data, TRUE, TRUE, parent);
+}
+
+
+/* OK-Cancel question. */
+
+/**
+ * gnome_ok_cancel_dialog:
+ * @message: Message to display
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ *
+ * Description: Creates an OK/Cancel dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'OK', 1 for 'Cancel'.
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_ok_cancel_dialog (const gchar * message,
+ GnomeReplyCallback callback, gpointer data)
+{
+ return reply_dialog(message, callback, data, FALSE, FALSE, NULL);
+}
+
+/**
+ * gnome_ok_cancel_dialog_parented:
+ * @message: Message to display
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ * @parent: Parent window
+ *
+ * Description: Creates an OK/Cancel dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'OK', 1 for 'Cancel'.
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_ok_cancel_dialog_parented (const gchar * message,
+ GnomeReplyCallback callback, gpointer data,
+ GtkWindow * parent)
+{
+ return reply_dialog(message, callback, data, FALSE, FALSE, parent);
+}
+
+/**
+ * gnome_ok_cancel_dialog_modal:
+ * @message: Message to display
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ *
+ * Description: Creates an OK/Cancel dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'OK', 1 for 'Cancel'. The dialog is created as a modal
+ * dialog and the user will have to answer this before proceeding.
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_ok_cancel_dialog_modal (const gchar * message,
+ GnomeReplyCallback callback, gpointer data)
+{
+ return reply_dialog(message, callback, data, FALSE, TRUE, NULL);
+}
+
+/**
+ * gnome_ok_cancel_dialog_modal_parented:
+ * @message: Message to display
+ * @callback: Callback function for handling dialog results
+ * @data: Data to pass to callback
+ * @parent: Parent window
+ *
+ * Description: Creates and shows an OK/Cancel dialog and calls @callback
+ * when user answers the button number is passed onto 'reply'.
+ * 0 is for 'OK', 1 for 'Cancel'. The dialog is created as a modal
+ * dialog and the user will have to answer this before proceeding.
+ *
+ * void (* GnomeReplyCallback)(gint reply, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_ok_cancel_dialog_modal_parented (const gchar * message,
+ GnomeReplyCallback callback, gpointer data,
+ GtkWindow * parent)
+{
+ return reply_dialog(message, callback, data, FALSE, TRUE, parent);
+}
+
+static void
+dialog_string_callback (GnomeMessageBox * mbox, gint button, callback_info * data)
+{
+ gchar * s = NULL;
+ const char * tmp;
+ GnomeStringCallback func = (GnomeStringCallback)data->function;
+
+ if (button == 0) {
+ tmp = gtk_entry_get_text (data->entry);
+ if (tmp) s = g_strdup(tmp);
+ }
+
+ (* func)(s, data->data);
+}
+
+static GtkWidget *
+request_dialog (const gchar * request, const gchar * default_text, const guint16 max_length,
+ GnomeStringCallback callback, gpointer data,
+ gboolean password,
+ GtkWindow * parent)
+{
+ GtkWidget * mbox;
+ callback_info * info;
+ GtkWidget * entry;
+
+ mbox = gnome_message_box_new ( request, GNOME_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL );
+ gnome_dialog_set_default ( GNOME_DIALOG(mbox), 0 );
+
+ /* set up text entry widget */
+ entry = gtk_entry_new();
+ if (password) gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
+ if ((default_text != NULL) && (*default_text))
+ gtk_entry_set_text(GTK_ENTRY(entry), default_text);
+ if (max_length > 0)
+ gtk_entry_set_max_length(GTK_ENTRY(entry), max_length);
+
+ gtk_box_pack_end ( GTK_BOX(GNOME_DIALOG(mbox)->vbox),
+ entry, FALSE, FALSE, GNOME_PAD_SMALL );
+
+ /* If Return is pressed in the text entry, propagate to the buttons */
+ gnome_dialog_editable_enters(GNOME_DIALOG(mbox), GTK_EDITABLE(entry));
+
+ info = g_new(callback_info, 1);
+
+ info->function = callback;
+ info->data = data;
+ info->entry = GTK_ENTRY(entry);
+
+ gtk_signal_connect_full(GTK_OBJECT(mbox), "clicked",
+ GTK_SIGNAL_FUNC(dialog_string_callback),
+ NULL,
+ info,
+ (GtkDestroyNotify)g_free,
+ FALSE, FALSE);
+
+ if (parent != NULL) {
+ gnome_dialog_set_parent(GNOME_DIALOG(mbox),parent);
+ }
+
+ gtk_widget_grab_focus (entry);
+
+ gtk_widget_show (entry);
+ gtk_widget_show (mbox);
+ return mbox;
+}
+
+/* Get a string. */
+/**
+ * gnome_request_string_dialog:
+ *
+ * Description: Deprecated, use #gnome_request_dialog
+ **/
+GtkWidget *
+gnome_request_string_dialog (const gchar * prompt,
+ GnomeStringCallback callback, gpointer data)
+{
+ g_message("gnome_request_string_dialog is deprecated, use gnome_request_dialog instead.");
+ return request_dialog (prompt, NULL, 0, callback, data, FALSE, NULL);
+}
+
+/**
+ * gnome_request_string_dialog_parented:
+ *
+ * Description: Deprecated, use #gnome_request_dialog
+ **/
+GtkWidget *
+gnome_request_string_dialog_parented (const gchar * prompt,
+ GnomeStringCallback callback, gpointer data,
+ GtkWindow * parent)
+{
+ g_message("gnome_request_string_dialog_parented is deprecated, use gnome_request_dialog instead.");
+ return request_dialog (prompt, NULL, 0, callback, data, FALSE, parent);
+}
+
+/* Request a string, but don't echo to the screen. */
+/**
+ * gnome_request_password_dialog:
+ *
+ * Description: Deprecated, use #gnome_request_dialog
+ **/
+GtkWidget *
+gnome_request_password_dialog (const gchar * prompt, GnomeStringCallback callback, gpointer data)
+{
+ g_message("gnome_request_password_dialog is deprecated, use gnome_request_dialog instead.");
+ return request_dialog (prompt, NULL, 0, callback, data, TRUE, NULL);
+}
+
+/**
+ * gnome_request_password_dialog_parented:
+ *
+ * Description: Deprecated, use #gnome_request_dialog
+ **/
+GtkWidget *
+gnome_request_password_dialog_parented (const gchar * prompt,
+ GnomeStringCallback callback, gpointer data,
+ GtkWindow * parent)
+{
+ g_message("gnome_request_password_dialog_parented is deprecated, use gnome_request_dialog instead.");
+ return request_dialog (prompt, NULL, 0, callback, data, TRUE, parent);
+}
+
+/**
+ * gnome_request_dialog:
+ * @password: %TRUE if on-screen text input is masked
+ * @prompt: Text of the prompt to be displayed
+ * @default_text: Default text in entry widget, %NULL if none
+ * @max_length: Maximum input chars allowed
+ * @callback: Callback function for handling dialog results
+ * @data: Data passed to the callback
+ * @parent: Parent window, or %NULL for no parent.
+ *
+ * Description: Creates and shows a GNOME text entry request dialog.
+ * @callback is called when the dialog closes, passing the text entry
+ * input or %NULL if the user cancelled. @callback is defined as
+ *
+ * void (* GnomeStringCallback)(gchar * string, gpointer data);
+ *
+ * Returns: Pointer to new GNOME dialog object.
+ **/
+GtkWidget *
+gnome_request_dialog (gboolean password, const gchar * prompt,
+ const gchar * default_text, const guint16 max_length,
+ GnomeStringCallback callback, gpointer data,
+ GtkWindow * parent)
+{
+ return request_dialog (prompt, default_text, max_length,
+ callback, data, password, parent);
+}
+
+#endif /* GNOME_DISABLE_DEPRECATED_SOURCE */
diff --git a/libgnomeui/gnome-dialog-util.h b/libgnomeui/gnome-dialog-util.h
new file mode 100644
index 0000000..07449cc
--- /dev/null
+++ b/libgnomeui/gnome-dialog-util.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ @NOTATION@
+ */
+
+#ifndef GNOME_DIALOG_UTIL_H
+#define GNOME_DIALOG_UTIL_H
+
+#ifndef GNOME_DISABLE_DEPRECATED
+
+/****
+ Sugar functions to pop up dialogs in a hurry. These are probably
+ too sugary, but they're used in gnome-app-util anyway so they may as
+ well be here for others to use when there's no GnomeApp.
+ The gnome-app-util functions are preferred if there's a GnomeApp
+ to use them with, because they allow configurable statusbar messages
+ instead of a dialog.
+ ****/
+
+
+#include "gnome-types.h"
+
+G_BEGIN_DECLS
+
+/* The GtkWidget * return values were added in retrospect; sometimes
+ you might want to connect to the "close" signal of the dialog, or
+ something, the return value makes the functions more
+ flexible. However, there is nothing especially guaranteed about
+ these dialogs except that they will be dialogs, so don't count on
+ anything. */
+
+
+/* A little OK box */
+GtkWidget * gnome_ok_dialog (const gchar * message);
+GtkWidget * gnome_ok_dialog_parented (const gchar * message,
+ GtkWindow * parent);
+
+/* Operation failed fatally. In an OK dialog. */
+GtkWidget * gnome_error_dialog (const gchar * error);
+GtkWidget * gnome_error_dialog_parented (const gchar * error,
+ GtkWindow * parent);
+
+/* Just a warning. */
+GtkWidget * gnome_warning_dialog (const gchar * warning);
+GtkWidget * gnome_warning_dialog_parented (const gchar * warning,
+ GtkWindow * parent);
+
+/* Look in gnome-types.h for the callback types. */
+
+/* Ask a yes or no question, and call the callback when it's answered. */
+GtkWidget * gnome_question_dialog (const gchar * question,
+ GnomeReplyCallback callback,
+ gpointer data);
+
+GtkWidget * gnome_question_dialog_parented (const gchar * question,
+ GnomeReplyCallback callback,
+ gpointer data,
+ GtkWindow * parent);
+
+GtkWidget * gnome_question_dialog_modal (const gchar * question,
+ GnomeReplyCallback callback,
+ gpointer data);
+
+GtkWidget * gnome_question_dialog_modal_parented (const gchar * question,
+ GnomeReplyCallback callback,
+ gpointer data,
+ GtkWindow * parent);
+
+
+/* OK-Cancel question. */
+GtkWidget * gnome_ok_cancel_dialog (const gchar * message,
+ GnomeReplyCallback callback,
+ gpointer data);
+
+GtkWidget * gnome_ok_cancel_dialog_parented (const gchar * message,
+ GnomeReplyCallback callback,
+ gpointer data,
+ GtkWindow * parent);
+
+GtkWidget * gnome_ok_cancel_dialog_modal (const gchar * message,
+ GnomeReplyCallback callback,
+ gpointer data);
+
+GtkWidget * gnome_ok_cancel_dialog_modal_parented (const gchar * message,
+ GnomeReplyCallback callback,
+ gpointer data,
+ GtkWindow * parent);
+
+/* This function is deprecated; use gnome_request_dialog() instead. */
+GtkWidget * gnome_request_string_dialog (const gchar * prompt,
+ GnomeStringCallback callback,
+ gpointer data);
+
+/* This function is deprecated; use gnome_request_dialog() instead. */
+GtkWidget * gnome_request_string_dialog_parented (const gchar * prompt,
+ GnomeStringCallback callback,
+ gpointer data,
+ GtkWindow * parent);
+
+/* This function is deprecated; use gnome_request_dialog() instead. */
+GtkWidget * gnome_request_password_dialog (const gchar * prompt,
+ GnomeStringCallback callback,
+ gpointer data);
+
+/* This function is deprecated; use gnome_request_dialog() instead. */
+GtkWidget * gnome_request_password_dialog_parented(const gchar * prompt,
+ GnomeStringCallback callback,
+ gpointer data,
+ GtkWindow * parent);
+
+/* Dialog containing a prompt and a text entry field for a response */
+GtkWidget * gnome_request_dialog (gboolean password,
+ const gchar * prompt,
+ const gchar * default_text,
+ const guint16 max_length,
+ GnomeStringCallback callback,
+ gpointer data,
+ GtkWindow * parent);
+
+G_END_DECLS
+
+#endif /* GNOME_DISABLE_DEPRECATED */
+
+#endif
+
diff --git a/libgnomeui/gnome-dialog.c b/libgnomeui/gnome-dialog.c
new file mode 100644
index 0000000..979035c
--- /dev/null
+++ b/libgnomeui/gnome-dialog.c
@@ -0,0 +1,1170 @@
+/* GNOME GUI Library
+ * Copyright (C) 1997, 1998 Jay Painter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ */
+/*
+ @NOTATION@
+*/
+
+#include <config.h>
+
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
+
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
+#include "gnome-dialog.h"
+#include <libgnome/gnome-util.h>
+#include <libgnome/gnome-config.h>
+#include <string.h> /* for strcmp */
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include "gnome-uidefs.h"
+#include "gnome-dialog-util.h"
+
+#include <libgnomeuiP.h>
+
+struct _GnomeDialogPrivate {
+ GtkWidget *action_area; /* A button box, not an hbox */
+
+ GtkAccelGroup *accelerators;
+
+ unsigned int click_closes : 1;
+ unsigned int just_hide : 1;
+};
+
+enum {
+ CLICKED,
+ CLOSE,
+ LAST_SIGNAL
+};
+
+static void gnome_dialog_class_init (GnomeDialogClass *klass);
+static void gnome_dialog_init (GnomeDialog * dialog);
+static void gnome_dialog_init_action_area (GnomeDialog * dialog);
+
+
+static void gnome_dialog_button_clicked (GtkWidget *button,
+ GtkWidget *messagebox);
+static gint gnome_dialog_key_pressed (GtkWidget * d, GdkEventKey * e);
+static gint gnome_dialog_delete_event (GtkWidget * d, GdkEventAny * e);
+static void gnome_dialog_destroy (GtkObject *object);
+static void gnome_dialog_finalize (GObject *object);
+static void gnome_dialog_show (GtkWidget * d);
+static void gnome_dialog_close_real(GnomeDialog * d);
+
+static GtkWindowClass *parent_class;
+static gint dialog_signals[LAST_SIGNAL] = { 0, 0 };
+
+guint
+gnome_dialog_get_type (void)
+{
+ static guint dialog_type = 0;
+
+ if (!dialog_type)
+ {
+ GtkTypeInfo dialog_info =
+ {
+ "GnomeDialog",
+ sizeof (GnomeDialog),
+ sizeof (GnomeDialogClass),
+ (GtkClassInitFunc) gnome_dialog_class_init,
+ (GtkObjectInitFunc) gnome_dialog_init,
+ NULL,
+ NULL,
+ NULL
+ };
+
+ dialog_type = gtk_type_unique (gtk_window_get_type (), &dialog_info);
+ }
+
+ return dialog_type;
+}
+
+static void
+gnome_dialog_class_init (GnomeDialogClass *klass)
+{
+ GtkObjectClass *object_class;
+ GObjectClass *gobject_class;
+ GtkWidgetClass *widget_class;
+ GtkWindowClass *window_class;
+
+ object_class = (GtkObjectClass*) klass;
+ gobject_class = (GObjectClass*) klass;
+ widget_class = (GtkWidgetClass*) klass;
+ window_class = (GtkWindowClass*) klass;
+
+ parent_class = gtk_type_class (gtk_window_get_type ());
+
+ dialog_signals[CLOSE] =
+ gtk_signal_new ("close",
+ GTK_RUN_LAST,
+ GTK_CLASS_TYPE (object_class),
+ GTK_SIGNAL_OFFSET (GnomeDialogClass, close),
+ gnome_marshal_INT__VOID,
+ GTK_TYPE_INT, 0);
+
+ dialog_signals[CLICKED] =
+ gtk_signal_new ("clicked",
+ GTK_RUN_LAST,
+ GTK_CLASS_TYPE (object_class),
+ GTK_SIGNAL_OFFSET (GnomeDialogClass, clicked),
+ gtk_marshal_VOID__INT,
+ GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+
+ klass->clicked = NULL;
+ klass->close = NULL;
+ object_class->destroy = gnome_dialog_destroy;
+ gobject_class->finalize = gnome_dialog_finalize;
+ widget_class->key_press_event = gnome_dialog_key_pressed;
+ widget_class->delete_event = gnome_dialog_delete_event;
+ widget_class->show = gnome_dialog_show;
+}
+
+static void
+gnome_dialog_init (GnomeDialog *dialog)
+{
+ GtkWidget * vbox;
+ GtkWidget * bf;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ dialog->_priv = g_new0(GnomeDialogPrivate, 1);
+
+ dialog->_priv->just_hide = FALSE;
+ dialog->_priv->click_closes = FALSE;
+ dialog->buttons = NULL;
+
+ /* FIXME:!!!!!!!!!!!!!! */
+ GTK_WINDOW(dialog)->type = 1;
+ gtk_window_set_position(GTK_WINDOW(dialog), 1);
+
+ /*
+ GTK_WINDOW(dialog)->type = gnome_preferences_get_dialog_type();
+ gtk_window_set_position(GTK_WINDOW(dialog),
+ gnome_preferences_get_dialog_position());
+ */
+
+ dialog->_priv->accelerators = gtk_accel_group_new();
+ gtk_window_add_accel_group (GTK_WINDOW(dialog),
+ dialog->_priv->accelerators);
+
+ bf = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (bf), GTK_SHADOW_OUT);
+ gtk_container_add(GTK_CONTAINER(dialog), bf);
+ gtk_widget_show(bf);
+
+ vbox = gtk_vbox_new(FALSE, GNOME_PAD);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox),
+ GNOME_PAD_SMALL);
+ gtk_container_add(GTK_CONTAINER(bf), vbox);
+ gtk_widget_show(vbox);
+
+ gtk_window_set_policy (GTK_WINDOW (dialog), FALSE,
+ FALSE, FALSE);
+
+ dialog->vbox = gtk_vbox_new(FALSE, GNOME_PAD);
+ gtk_box_pack_start (GTK_BOX (vbox), dialog->vbox,
+ TRUE, TRUE,
+ GNOME_PAD_SMALL);
+ gtk_widget_show(dialog->vbox);
+}
+
+static void
+gnome_dialog_init_action_area (GnomeDialog * dialog)
+{
+ GtkWidget * separator;
+
+ if (dialog->_priv->action_area)
+ return;
+
+ dialog->_priv->action_area = gtk_hbutton_box_new ();
+ /* FIXME!!!!!!! */
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->_priv->action_area), 0);
+ /* gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->_priv->action_area),
+ gnome_preferences_get_button_layout()); */
+
+ gtk_button_box_set_spacing (GTK_BOX (dialog->_priv->action_area),
+ GNOME_PAD);
+
+ gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->_priv->action_area,
+ FALSE, TRUE, 0);
+ gtk_widget_show (dialog->_priv->action_area);
+
+ separator = gtk_hseparator_new ();
+ gtk_box_pack_end (GTK_BOX (dialog->vbox), separator,
+ FALSE, TRUE,
+ GNOME_PAD_SMALL);
+ gtk_widget_show (separator);
+}
+
+
+/**
+ * gnome_dialog_construct: Functionality of gnome_dialog_new() for language wrappers.
+ * @dialog: Dialog to construct.
+ * @title: Title of the dialog.
+ * @ap: va_list of buttons, NULL-terminated.
+ *
+ * See gnome_dialog_new().
+ **/
+void
+gnome_dialog_construct (GnomeDialog * dialog,
+ const gchar * title,
+ va_list ap)
+{
+ gchar * button_name;
+
+ if (title)
+ gtk_window_set_title (GTK_WINDOW (dialog), title);
+
+ while (TRUE) {
+
+ button_name = va_arg (ap, gchar *);
+
+ if (button_name == NULL) {
+ break;
+ }
+
+ gnome_dialog_append_button( dialog,
+ button_name);
+ };
+
+ /* argument list may be null if the user wants to do weird things to the
+ * dialog, but we need to make sure this is initialized */
+ gnome_dialog_init_action_area(dialog);
+}
+
+/**
+ * gnome_dialog_constructv: Functionality of gnome_dialog_new(), for language wrappers.
+ * @dialog: Dialog to construct.
+ * @title: Title of the dialog.
+ * @buttons: NULL-terminated array of buttons.
+ *
+ * See gnome_dialog_new().
+ **/
+void gnome_dialog_constructv (GnomeDialog * dialog,
+ const gchar * title,
+ const gchar ** buttons)
+{
+ const gchar * button_name;
+
+ if (title)
+ gtk_window_set_title (GTK_WINDOW (dialog), title);
+
+ while (TRUE) {
+
+ button_name = *buttons++;
+
+ if (button_name == NULL) {
+ break;
+ }
+
+ gnome_dialog_append_button( dialog,
+ button_name);
+ };
+
+ /* argument list may be null if the user wants to do weird things to the
+ * dialog, but we need to make sure this is initialized */
+ gnome_dialog_init_action_area(dialog);
+}
+
+
+
+/**
+ * gnome_dialog_new: Create a new #GnomeDialog.
+ * @title: The title of the dialog; appears in window titlebar.
+ * @...: NULL-terminated varargs list of button names or GNOME_STOCK_BUTTON_* defines.
+ *
+ * Creates a new #GnomeDialog, with the given title, and any button names
+ * in the arg list. Buttons can be simple names, such as _("My Button"),
+ * or gnome-stock defines such as %GNOME_STOCK_BUTTON_OK, etc. The last
+ * argument should be NULL to terminate the list.
+ *
+ * Buttons passed to this function are numbered from left to right,
+ * starting with 0. So the first button in the arglist is button 0,
+ * then button 1, etc. These numbers are used throughout the
+ * #GnomeDialog API.
+ *
+ * Return value: The new #GnomeDialog.
+ **/
+GtkWidget* gnome_dialog_new (const gchar * title,
+ ...)
+{
+ va_list ap;
+ GnomeDialog *dialog;
+
+ dialog = gtk_type_new (gnome_dialog_get_type ());
+
+ va_start (ap, title);
+
+ gnome_dialog_construct(dialog, title, ap);
+
+ va_end(ap);
+
+ return GTK_WIDGET (dialog);
+}
+
+/**
+ * gnome_dialog_newv: Create a new #GnomeDialog.
+ * @title: Title of the dialog.
+ * @buttons: NULL-terminated vector of buttons names.
+ *
+ * See gnome_dialog_new(), this function is identical but does not use
+ * varargs.
+ *
+ * Return value: The new #GnomeDialog.
+ **/
+GtkWidget* gnome_dialog_newv (const gchar * title,
+ const gchar ** buttons)
+{
+ GnomeDialog *dialog;
+
+ dialog = gtk_type_new (gnome_dialog_get_type ());
+
+ gnome_dialog_constructv(dialog, title, buttons);
+
+ return GTK_WIDGET (dialog);
+}
+
+/**
+ * gnome_dialog_set_parent: Set the logical parent window of a #GnomeDialog.
+ * @dialog: #GnomeDialog to set the parent of.
+ * @parent: Parent #GtkWindow.
+ *
+ * Dialogs have "parents," usually the main application window which spawned
+ * them. This function will let the window manager know about the parent-child
+ * relationship. Usually this means the dialog must stay on top of the parent,
+ * and will be minimized when the parent is. Gnome also allows users to
+ * request dialog placement above the parent window (vs. at the mouse position,
+ * or at a default window manger location).
+ *
+ **/
+void gnome_dialog_set_parent (GnomeDialog * dialog,
+ GtkWindow * parent)
+{
+ /* This code is duplicated in gnome-file-entry.c:browse-clicked. If
+ * a change is made here, update it there too. */
+ /* Also, It might be good at some point to make the first argument
+ * GtkWidget, instead of GnomeDialog */
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+ g_return_if_fail(parent != NULL);
+ g_return_if_fail(GTK_IS_WINDOW(parent));
+ g_return_if_fail(parent != GTK_WINDOW(dialog));
+
+ gtk_window_set_transient_for (GTK_WINDOW(dialog), parent);
+
+ /* FIXME!!!!!!!! */
+ /*if ( gnome_preferences_get_dialog_centered() ) { */
+ if (1) {
+
+ /* User wants us to center over parent */
+
+ gint x, y, w, h, dialog_x, dialog_y;
+
+ if ( ! GTK_WIDGET_VISIBLE(parent)) return; /* Can't get its
+ size/pos */
+
+ /* Throw out other positioning */
+ gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_NONE);
+
+ gdk_window_get_origin (GTK_WIDGET(parent)->window, &x, &y);
+ gdk_window_get_size (GTK_WIDGET(parent)->window, &w, &h);
+
+ /* The problem here is we don't know how big the dialog is.
+ So "centered" isn't really true. We'll go with
+ "kind of more or less on top" */
+
+ dialog_x = x + w/4;
+ dialog_y = y + h/4;
+
+ gtk_widget_set_uposition(GTK_WIDGET(dialog), dialog_x, dialog_y);
+ }
+}
+
+
+/**
+ * gnome_dialog_append_buttons: Add buttons to a dialog after its initial construction.
+ * @dialog: #GnomeDialog to add buttons to.
+ * @first: First button to add.
+ * @...: varargs list of additional buttons, NULL-terminated.
+ *
+ * This function is mostly for internal library use. You should use
+ * gnome_dialog_new() instead. See that function for a description of
+ * the button arguments.
+ *
+ **/
+void gnome_dialog_append_buttons (GnomeDialog * dialog,
+ const gchar * first,
+ ...)
+{
+ va_list ap;
+ const gchar * button_name = first;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ va_start(ap, first);
+
+ while(button_name != NULL) {
+ gnome_dialog_append_button (dialog, button_name);
+ button_name = va_arg (ap, gchar *);
+ }
+ va_end(ap);
+}
+
+/**
+ * gnome_dialog_append_button: Add a button to a dialog after its initial construction.
+ * @dialog: #GnomeDialog to add button to.
+ * @button_name: Button to add.
+ *
+ * This function is mostly for internal library use. You should use
+ * gnome_dialog_new() instead. See that function for a description of
+ * the button argument.
+ *
+ **/
+void gnome_dialog_append_button (GnomeDialog * dialog,
+ const gchar * button_name)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ if (button_name != NULL) {
+ GtkWidget *button;
+
+ gnome_dialog_init_action_area (dialog);
+
+ button = gtk_button_new_from_stock (button_name);
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT);
+ gtk_box_pack_start (GTK_BOX (dialog->_priv->action_area), button, TRUE, TRUE, 0);
+
+ gtk_widget_grab_default (button);
+ gtk_widget_show (button);
+
+ gtk_signal_connect_after (GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) gnome_dialog_button_clicked,
+ dialog);
+
+ dialog->buttons = g_list_append (dialog->buttons, button);
+ }
+}
+
+#define GNOME_STOCK_BUTTON_PADDING 2
+static GtkWidget *
+gnome_pixmap_button(GtkWidget *pixmap, const char *text)
+{
+ GtkWidget *button, *label, *hbox, *w;
+ gboolean use_icon, use_label;
+
+ g_return_val_if_fail(text != NULL, NULL);
+
+ button = gtk_button_new();
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_widget_show(hbox);
+ gtk_container_add(GTK_CONTAINER(button), hbox);
+ w = hbox;
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_widget_show(hbox);
+ gtk_box_pack_start(GTK_BOX(w), hbox, TRUE, FALSE,
+ GNOME_STOCK_BUTTON_PADDING);
+
+ use_icon = gnome_config_get_bool("/Gnome/Icons/ButtonUseIcons=true");
+ use_label = gnome_config_get_bool("/Gnome/Icons/ButtonUseLabels=true");
+
+ if ((use_label) || (!use_icon) || (!pixmap)) {
+ label = gtk_label_new(_(text));
+ gtk_widget_show(label);
+ gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE,
+ GNOME_STOCK_BUTTON_PADDING);
+ }
+
+ if ((use_icon) && (pixmap)) {
+
+ gtk_widget_show(pixmap);
+ gtk_box_pack_start(GTK_BOX(hbox), pixmap,
+ FALSE, FALSE, 0);
+ } else {
+ gtk_widget_unref(pixmap);
+ }
+
+ return button;
+}
+
+
+
+/**
+ * gnome_dialog_append_button_with_pixmap: Add a pixmap button to a dialog.
+ * @dialog: #GnomeDialog to add the button to.
+ * @button_name: Name of the button, or stock button #define.
+ * @pixmap_name: Stock pixmap name.
+ *
+ * gnome_dialog_new() does not permit custom buttons with pixmaps, so if you
+ * want one of those you need to use this function.
+ *
+ **/
+void gnome_dialog_append_button_with_pixmap (GnomeDialog * dialog,
+ const gchar * button_name,
+ const gchar * pixmap_name)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ if (button_name != NULL) {
+ GtkWidget *button;
+
+ if (pixmap_name != NULL) {
+ GtkWidget *pixmap;
+
+ pixmap = gtk_image_new_from_stock (pixmap_name, GTK_ICON_SIZE_BUTTON);
+ button = gnome_pixmap_button (pixmap, button_name);
+ } else {
+ button = gtk_button_new_from_stock (button_name);
+ }
+
+ gnome_dialog_init_action_area (dialog);
+
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT);
+ gtk_box_pack_start (GTK_BOX (dialog->_priv->action_area), button, TRUE, TRUE, 0);
+
+ gtk_widget_grab_default (button);
+ gtk_widget_show (button);
+
+ gtk_signal_connect_after (GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) gnome_dialog_button_clicked,
+ dialog);
+
+ dialog->buttons = g_list_append (dialog->buttons, button);
+ }
+}
+
+/**
+ * gnome_dialog_append_buttonsv: Like gnome_dialog_append_buttons(), but with a vector arg instead of a varargs list.
+ * @dialog: #GnomeDialog to append to.
+ * @buttons: NULL-terminated vector of buttons to append.
+ *
+ * For internal use, language bindings, etc. Use gnome_dialog_new() instead.
+ *
+ **/
+void gnome_dialog_append_buttonsv (GnomeDialog * dialog,
+ const gchar ** buttons)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ while(*buttons != NULL) {
+ gnome_dialog_append_button (dialog, *buttons);
+ buttons++;
+ }
+}
+
+/**
+ * gnome_dialog_append_buttons_with_pixmaps: Like gnome_dialog_append_button_with_pixmap(), but allows multiple buttons.
+ * @dialog: #GnomeDialog to append to.
+ * @names: NULL-terminated vector of button names.
+ * @pixmaps: NULL-terminated vector of pixmap names.
+ *
+ * Simply calls gnome_dialog_append_button_with_pixmap() repeatedly.
+ *
+ **/
+void gnome_dialog_append_buttons_with_pixmaps (GnomeDialog * dialog,
+ const gchar **names,
+ const gchar **pixmaps)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ while(*names != NULL) {
+ gnome_dialog_append_button_with_pixmap (dialog, *names, *pixmaps);
+ names++; pixmaps++;
+ }
+}
+
+struct GnomeDialogRunInfo {
+ gint button_number;
+ gint close_id, clicked_id, destroy_id;
+ gboolean destroyed;
+ GMainLoop *mainloop;
+};
+
+static void
+gnome_dialog_shutdown_run(GnomeDialog* dialog,
+ struct GnomeDialogRunInfo* runinfo)
+{
+ if (!runinfo->destroyed)
+ {
+
+ gtk_signal_disconnect(GTK_OBJECT(dialog),
+ runinfo->close_id);
+ gtk_signal_disconnect(GTK_OBJECT(dialog),
+ runinfo->clicked_id);
+
+ runinfo->close_id = runinfo->clicked_id = -1;
+ }
+
+ if (runinfo->mainloop)
+ {
+ g_main_quit(runinfo->mainloop);
+ g_main_destroy(runinfo->mainloop);
+ runinfo->mainloop = NULL;
+ }
+}
+
+static void
+gnome_dialog_setbutton_callback(GnomeDialog *dialog,
+ gint button_number,
+ struct GnomeDialogRunInfo *runinfo)
+{
+ if(runinfo->close_id < 0)
+ return;
+
+ runinfo->button_number = button_number;
+
+ gnome_dialog_shutdown_run(dialog, runinfo);
+}
+
+static gboolean
+gnome_dialog_quit_run(GnomeDialog *dialog,
+ struct GnomeDialogRunInfo *runinfo)
+{
+ if(runinfo->close_id < 0)
+ return FALSE;
+
+ gnome_dialog_shutdown_run(dialog, runinfo);
+
+ return FALSE;
+}
+
+static void
+gnome_dialog_mark_destroy(GnomeDialog* dialog,
+ struct GnomeDialogRunInfo* runinfo)
+{
+ runinfo->destroyed = TRUE;
+
+ if(runinfo->close_id < 0)
+ return;
+ else gnome_dialog_shutdown_run(dialog, runinfo);
+}
+
+static gint
+gnome_dialog_run_real(GnomeDialog* dialog, gboolean close_after)
+{
+ gboolean was_modal;
+ struct GnomeDialogRunInfo ri = {-1,-1,-1,-1,FALSE,NULL};
+
+ g_return_val_if_fail(dialog != NULL, -1);
+ g_return_val_if_fail(GNOME_IS_DIALOG(dialog), -1);
+
+ was_modal = GTK_WINDOW(dialog)->modal;
+ if (!was_modal)
+ gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
+
+ /* There are several things that could happen to the dialog, and we
+ need to handle them all: click, delete_event, close, destroy */
+
+ ri.clicked_id =
+ gtk_signal_connect(GTK_OBJECT(dialog), "clicked",
+ GTK_SIGNAL_FUNC(gnome_dialog_setbutton_callback),
+ &ri);
+
+ ri.close_id =
+ gtk_signal_connect(GTK_OBJECT(dialog), "close",
+ GTK_SIGNAL_FUNC(gnome_dialog_quit_run),
+ &ri);
+
+ ri.destroy_id =
+ gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
+ GTK_SIGNAL_FUNC(gnome_dialog_mark_destroy),
+ &ri);
+
+ if ( ! GTK_WIDGET_VISIBLE(GTK_WIDGET(dialog)) )
+ gtk_widget_show(GTK_WIDGET(dialog));
+
+ ri.mainloop = g_main_new(FALSE);
+ g_main_run(ri.mainloop);
+
+ g_assert(ri.mainloop == NULL);
+
+ if(!ri.destroyed) {
+
+ gtk_signal_disconnect(GTK_OBJECT(dialog), ri.destroy_id);
+
+ if(!was_modal)
+ {
+ gtk_window_set_modal(GTK_WINDOW(dialog),FALSE);
+ }
+
+ if(ri.close_id >= 0) /* We didn't shut down the run? */
+ {
+ gtk_signal_disconnect(GTK_OBJECT(dialog), ri.close_id);
+ gtk_signal_disconnect(GTK_OBJECT(dialog), ri.clicked_id);
+ }
+
+ if (close_after)
+ {
+ gnome_dialog_close(dialog);
+ }
+ }
+
+ return ri.button_number;
+}
+
+/**
+ * gnome_dialog_run: Make the dialog modal and block waiting for user response.
+ * @dialog: #GnomeDialog to use.
+ *
+ * Blocks until the user clicks a button, or closes the dialog with the
+ * window manager's close decoration (or by pressing Escape).
+ *
+ * You need to set up the dialog to do the right thing when a button
+ * is clicked or delete_event is received; you must consider both of
+ * those possibilities so that you know the status of the dialog when
+ * gnome_dialog_run() returns. A common mistake is to forget about
+ * Escape and the window manager close decoration; by default, these
+ * call gnome_dialog_close(), which by default destroys the dialog. If
+ * your button clicks do not destroy the dialog, you don't know
+ * whether the dialog is destroyed when gnome_dialog_run()
+ * returns. This is bad.
+ *
+ * So you should either close the dialog on button clicks as well, or
+ * change the gnome_dialog_close() behavior to hide instead of
+ * destroy. You can do this with gnome_dialog_close_hides().
+ *
+ * Return value: If a button was pressed, the button number is returned. If not, -1 is returned.
+ **/
+gint
+gnome_dialog_run(GnomeDialog *dialog)
+{
+ return gnome_dialog_run_real(dialog,FALSE);
+}
+
+/**
+ * gnome_dialog_run_and_close: Like gnome_dialog_run(), but force-closes the dialog after the run, iff the dialog was not closed already.
+ * @dialog: #GnomeDialog to use.
+ *
+ * See gnome_dialog_run(). The only difference is that this function calls
+ * gnome_dialog_close() before returning, if the dialog was not already closed.
+ *
+ * Return value: If a button was pressed, the button number. Otherwise -1.
+ **/
+gint
+gnome_dialog_run_and_close(GnomeDialog* dialog)
+{
+ return gnome_dialog_run_real(dialog,TRUE);
+}
+
+/**
+ * gnome_dialog_set_default: Set the default button for the dialog. The Enter key activates the default button.
+ * @dialog: #GnomeDialog to affect.
+ * @button: Number of the default button.
+ *
+ * The default button will be activated if the user just presses return.
+ * Usually you should make the least-destructive button the default.
+ * Otherwise, the most commonly-used button.
+ *
+ **/
+void
+gnome_dialog_set_default (GnomeDialog *dialog,
+ gint button)
+{
+ GList *list;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ list = g_list_nth (dialog->buttons, button);
+
+ if (list && list->data) {
+ gtk_widget_grab_default (GTK_WIDGET (list->data));
+ return;
+ }
+#ifdef GNOME_ENABLE_DEBUG
+ /* If we didn't find the button, complain */
+ g_warning("Button number %d does not appear to exist\n", button);
+#endif
+}
+
+/**
+ * gnome_dialog_set_close: Whether to call gnome_dialog_close() when a button is clicked.
+ * @dialog: #GnomeDialog to affect.
+ * @click_closes: TRUE if clicking any button should call gnome_dialog_close().
+ *
+ * This is a convenience function so you don't have to connect callbacks
+ * to each button just to close the dialog. By default, #GnomeDialog
+ * has this parameter set the FALSE and it will not close on any click.
+ * (This was a design error.) However, almost all the #GnomeDialog subclasses,
+ * such as #GnomeMessageBox and #GnomePropertyBox, have this parameter set to
+ * TRUE by default.
+ *
+ **/
+void gnome_dialog_set_close (GnomeDialog * dialog,
+ gboolean click_closes)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ dialog->_priv->click_closes = click_closes;
+}
+
+/**
+ * gnome_dialog_close_hides: gnome_dialog_close() can destroy or hide the dialog; toggle this behavior.
+ * @dialog: #GnomeDialog to affect.
+ * @just_hide: If TRUE, gnome_dialog_close() calls gtk_widget_hide() instead of gtk_widget_destroy().
+ *
+ * Some dialogs are expensive to create, so you want to keep them around and just
+ * gtk_widget_show() them when they are opened, and gtk_widget_hide() them when
+ * they're closed. Other dialogs are expensive to keep around, so you want to
+ * gtk_widget_destroy() them when they're closed. It's a judgment call you
+ * will need to make for each dialog.
+ *
+ **/
+void gnome_dialog_close_hides (GnomeDialog * dialog,
+ gboolean just_hide)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ dialog->_priv->just_hide = just_hide;
+}
+
+
+/**
+ * gnome_dialog_set_sensitive: Set the sensitivity of a button.
+ * @dialog: #GnomeDialog to affect.
+ * @button: Which button to affect.
+ * @setting: TRUE means it's sensitive.
+ *
+ * Calls gtk_widget_set_sensitive() on the specified button number.
+ *
+ **/
+void gnome_dialog_set_sensitive (GnomeDialog *dialog,
+ gint button,
+ gboolean setting)
+{
+ GList *list;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ list = g_list_nth (dialog->buttons, button);
+
+ if (list && list->data) {
+ gtk_widget_set_sensitive(GTK_WIDGET(list->data), setting);
+ return;
+ }
+#ifdef GNOME_ENABLE_DEBUG
+ /* If we didn't find the button, complain */
+ g_warning("Button number %d does not appear to exist\n", button);
+#endif
+}
+
+/**
+ * gnome_dialog_button_connect: Connect a callback to one of the button's "clicked" signals.
+ * @dialog: #GnomeDialog to affect.
+ * @button: Button number.
+ * @callback: A standard Gtk callback.
+ * @data: Callback data.
+ *
+ * Simply gtk_signal_connect() to the "clicked" signal of the specified button.
+ *
+ **/
+void gnome_dialog_button_connect (GnomeDialog *dialog,
+ gint button,
+ GtkSignalFunc callback,
+ gpointer data)
+{
+ GList * list;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ list = g_list_nth (dialog->buttons, button);
+
+ if (list && list->data) {
+ gtk_signal_connect(GTK_OBJECT(list->data), "clicked",
+ callback, data);
+ return;
+ }
+#ifdef GNOME_ENABLE_DEBUG
+ /* If we didn't find the button, complain */
+ g_warning("Button number %d does not appear to exist\n", button);
+#endif
+}
+
+/**
+ * gnome_dialog_button_connect_object: gtk_signal_connect_object() to a button.
+ * @dialog: #GnomeDialog to affect.
+ * @button: Button to connect to.
+ * @callback: Callback.
+ * @obj: As for gtk_signal_connect_object().
+ *
+ * gtk_signal_connect_object() to the "clicked" signal of the given button.
+ *
+ **/
+void gnome_dialog_button_connect_object (GnomeDialog *dialog,
+ gint button,
+ GtkSignalFunc callback,
+ GtkObject * obj)
+{
+ GList * list;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ list = g_list_nth (dialog->buttons, button);
+
+ if (list && list->data) {
+ gtk_signal_connect_object (GTK_OBJECT(list->data), "clicked",
+ callback, obj);
+ return;
+ }
+#ifdef GNOME_ENABLE_DEBUG
+ /* If we didn't find the button, complain */
+ g_warning("Button number %d does not appear to exist\n", button);
+#endif
+}
+
+
+/**
+ * gnome_dialog_set_accelerator: Set an accelerator key for a button.
+ * @dialog: #GnomeDialog to affect.
+ * @button: Button number.
+ * @accelerator_key: Key for the accelerator.
+ * @accelerator_mods: Modifier.
+ *
+ *
+ **/
+void gnome_dialog_set_accelerator(GnomeDialog * dialog,
+ gint button,
+ const guchar accelerator_key,
+ guint8 accelerator_mods)
+{
+ GList * list;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ list = g_list_nth (dialog->buttons, button);
+
+ if (list && list->data) {
+ /*FIXME*/
+ gtk_widget_add_accelerator(GTK_WIDGET(list->data),
+ "clicked",
+ dialog->_priv->accelerators,
+ accelerator_key,
+ accelerator_mods,
+ GTK_ACCEL_VISIBLE);
+
+ return;
+ }
+#ifdef GNOME_ENABLE_DEBUG
+ /* If we didn't find the button, complain */
+ g_warning("Button number %d does not appear to exist\n", button);
+#endif
+}
+
+/**
+ * gnome_dialog_editable_enters: Make the "activate" signal of an editable click the default dialog button.
+ * @dialog: #GnomeDialog to affect.
+ * @editable: Editable to affect.
+ *
+ * Normally if there's an editable widget (such as #GtkEntry) in your
+ * dialog, pressing Enter will activate the editable rather than the
+ * default dialog button. However, in most cases, the user expects to
+ * type something in and then press enter to close the dialog. This
+ * function enables that behavior.
+ *
+ **/
+void gnome_dialog_editable_enters (GnomeDialog * dialog,
+ GtkEditable * editable)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(editable != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+ g_return_if_fail(GTK_IS_EDITABLE(editable));
+
+ gtk_signal_connect_object(GTK_OBJECT(editable), "activate",
+ GTK_SIGNAL_FUNC(gtk_window_activate_default),
+ GTK_OBJECT(dialog));
+}
+
+
+static void
+gnome_dialog_button_clicked (GtkWidget *button,
+ GtkWidget *dialog)
+{
+ GList *list;
+ int which = 0;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ list = GNOME_DIALOG (dialog)->buttons;
+
+ while (list){
+ if (list->data == button) {
+ gnome_dialog_clicked(GNOME_DIALOG(dialog), which);
+ /* Dialog may now be destroyed... */
+ break;
+ }
+ list = list->next;
+ ++which;
+ }
+}
+
+/**
+ * gnome_dialog_close: Emit the "clicked" signal as if a button was pressed.
+ * @dialog: #GnomeDialog to click.
+ * @button_num: button number to pass to the "clicked" signal.
+ *
+ * This function emits the "clicked" signal, simulating a click
+ * on the dialog buttons.
+ *
+ **/
+void
+gnome_dialog_clicked (GnomeDialog *dialog,
+ gint button_num)
+{
+ gboolean click_closes;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ click_closes = GNOME_DIALOG(dialog)->_priv->click_closes;
+
+ gtk_signal_emit (GTK_OBJECT (dialog), dialog_signals[CLICKED],
+ button_num);
+
+ /* The dialog may have been destroyed by the clicked signal, which
+ is why we had to save the click_closes flag. Users should be
+ careful not to set click_closes and then destroy the dialog
+ themselves too. */
+
+ if (click_closes) {
+ gnome_dialog_close(GNOME_DIALOG(dialog));
+ }
+}
+
+static gint gnome_dialog_key_pressed (GtkWidget * d, GdkEventKey * e)
+{
+ g_return_val_if_fail(GNOME_IS_DIALOG(d), TRUE);
+
+ if(e->keyval == GDK_Escape)
+ {
+ gnome_dialog_close(GNOME_DIALOG(d));
+
+ return TRUE; /* Stop the event? is this TRUE or FALSE? */
+ }
+
+ /* Have to call parent's handler, or the widget wouldn't get any
+ key press events. Note that this is NOT done if the dialog
+ may have been destroyed. */
+ if (GTK_WIDGET_CLASS(parent_class)->key_press_event)
+ return (* (GTK_WIDGET_CLASS(parent_class)->key_press_event))(d, e);
+ else return FALSE; /* Not handled. */
+}
+
+static gint gnome_dialog_delete_event (GtkWidget * d, GdkEventAny * e)
+{
+ gnome_dialog_close(GNOME_DIALOG(d));
+ return TRUE; /* We handled it. */
+}
+
+static void gnome_dialog_destroy (GtkObject *object)
+{
+ GnomeDialog *dialog;
+
+ /* remember, destroy can be run multiple times! */
+
+ g_return_if_fail(object != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(object));
+
+ dialog = GNOME_DIALOG(object);
+
+ if(dialog->buttons)
+ g_list_free(dialog->buttons);
+ dialog->buttons = NULL;
+
+ if (GTK_OBJECT_CLASS(parent_class)->destroy)
+ (* (GTK_OBJECT_CLASS(parent_class)->destroy))(object);
+}
+
+static void gnome_dialog_finalize (GObject *object)
+{
+ GnomeDialog *dialog;
+
+ g_return_if_fail(object != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(object));
+
+ dialog = GNOME_DIALOG(object);
+
+ g_free(dialog->_priv);
+ dialog->_priv = NULL;
+
+ if (G_OBJECT_CLASS(parent_class)->finalize)
+ (* (G_OBJECT_CLASS(parent_class)->finalize))(object);
+}
+
+void gnome_dialog_close_real(GnomeDialog * dialog)
+{
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ gtk_widget_hide(GTK_WIDGET(dialog));
+
+ if ( ! dialog->_priv->just_hide ) {
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ }
+}
+
+/**
+ * gnome_dialog_close: Close (hide or destroy) the dialog.
+ * @dialog: #GnomeDialog to close.
+ *
+ * See also gnome_dialog_close_hides(). This function emits the
+ * "close" signal, which either hides or destroys the dialog (destroy
+ * by default). If you connect to the "close" signal, and your
+ * callback returns TRUE, the hide or destroy will be blocked. You can
+ * do this to avoid closing the dialog if the user gives invalid
+ * input, for example.
+ *
+ * Using gnome_dialog_close() in place of gtk_widget_hide() or
+ * gtk_widget_destroy() allows you to easily catch all sources of
+ * dialog closure, including delete_event and button clicks, and
+ * handle them in a central location.
+ **/
+void gnome_dialog_close(GnomeDialog * dialog)
+{
+ gint close_handled = FALSE;
+
+ g_return_if_fail(dialog != NULL);
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ gtk_signal_emit (GTK_OBJECT(dialog), dialog_signals[CLOSE],
+ &close_handled);
+
+ if ( ! close_handled ) {
+ gnome_dialog_close_real(dialog);
+ }
+}
+
+static void gnome_dialog_show (GtkWidget * d)
+{
+ if (GTK_WIDGET_CLASS(parent_class)->show)
+ (* (GTK_WIDGET_CLASS(parent_class)->show))(d);
+}
+
+#endif /* GNOME_DISABLE_DEPRECATED_SOURCE */
diff --git a/libgnomeui/gnome-dialog.h b/libgnomeui/gnome-dialog.h
new file mode 100644
index 0000000..7cb274e
--- /dev/null
+++ b/libgnomeui/gnome-dialog.h
@@ -0,0 +1,201 @@
+/* GNOME GUI Library
+ * Copyright (C) 1995-1998 Jay Painter
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ */
+/*
+ @NOTATION@
+*/
+
+#ifndef __GNOME_DIALOG_H__
+#define __GNOME_DIALOG_H__
+
+#ifndef GNOME_DISABLE_DEPRECATED
+
+#include <gdk/gdk.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkeditable.h>
+#include <gtk/gtkaccelgroup.h>
+
+
+#include <stdarg.h>
+
+G_BEGIN_DECLS
+
+#define GNOME_TYPE_DIALOG (gnome_dialog_get_type ())
+#define GNOME_DIALOG(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_DIALOG, GnomeDialog))
+#define GNOME_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_DIALOG, GnomeDialogClass))
+#define GNOME_IS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_DIALOG))
+#define GNOME_IS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_DIALOG))
+#define GNOME_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_DIALOG, GnomeDialogClass))
+
+typedef struct _GnomeDialog GnomeDialog;
+typedef struct _GnomeDialogPrivate GnomeDialogPrivate;
+typedef struct _GnomeDialogClass GnomeDialogClass;
+
+/* The vbox can be accessed directly; if you fool with anything else,
+ you're on your own. */
+struct _GnomeDialog
+{
+ GtkWindow window;
+ /*< public >*/
+ GtkWidget * vbox;
+ GList *buttons;
+ /*< private >*/
+ GnomeDialogPrivate *_priv;
+};
+
+struct _GnomeDialogClass
+{
+ GtkWindowClass parent_class;
+
+ void (* clicked) (GnomeDialog *dialog, gint button_number);
+ gboolean (* close) (GnomeDialog * dialog);
+};
+
+/* GnomeDialog creates an action area with the buttons of your choice.
+ You should pass the button names (possibly GNOME_STOCK_BUTTON_*) as
+ arguments to gnome_dialog_new(). The buttons are numbered in the
+ order you passed them in, starting at 0. These numbers are used
+ in other functions, and passed to the "clicked" callback. */
+
+guint gnome_dialog_get_type (void) G_GNUC_CONST;
+
+/* Arguments: Title and button names, then NULL */
+GtkWidget* gnome_dialog_new (const gchar * title,
+ ...);
+/* Arguments: Title and NULL terminated array of button names. */
+GtkWidget* gnome_dialog_newv (const gchar * title,
+ const gchar **buttons);
+
+/* For now this just means the dialog can be centered over
+ its parent. */
+void gnome_dialog_set_parent (GnomeDialog * dialog,
+ GtkWindow * parent);
+
+/* Note: it's better to use GnomeDialog::clicked rather than
+ connecting to a button. These are really here in case
+ you're lazy. */
+/* Connect to the "clicked" signal of a single button */
+void gnome_dialog_button_connect (GnomeDialog *dialog,
+ gint button,
+ GtkSignalFunc callback,
+ gpointer data);
+/* Connect the object to the "clicked" signal of a single button */
+void gnome_dialog_button_connect_object (GnomeDialog *dialog,
+ gint button,
+ GtkSignalFunc callback,
+ GtkObject * obj);
+
+/* Run the dialog, return the button # that was pressed or -1 if none.
+ (this sets the dialog modal while it blocks)
+ */
+gint gnome_dialog_run (GnomeDialog *dialog);
+gint gnome_dialog_run_and_close (GnomeDialog *dialog);
+
+
+/* Set the default button. - it will have a little highlight,
+ and pressing return will activate it. */
+void gnome_dialog_set_default (GnomeDialog *dialog,
+ gint button);
+/* Set sensitivity of a button */
+void gnome_dialog_set_sensitive (GnomeDialog *dialog,
+ gint button,
+ gboolean setting);
+
+/* Set the accelerator for a button. Note that there are two
+ default accelerators: "Return" will be the same as clicking
+ the default button, and "Escape" will emit delete_event.
+ (Note: neither of these is in the accelerator table,
+ Return is a Gtk default and Escape comes from a key press event
+ handler.) */
+void gnome_dialog_set_accelerator(GnomeDialog * dialog,
+ gint button,
+ const guchar accelerator_key,
+ guint8 accelerator_mods);
+
+/* Hide and optionally destroy. Destroys by default, use close_hides()
+ to change this. */
+void gnome_dialog_close (GnomeDialog * dialog);
+
+/* Emit clicked signal */
+void gnome_dialog_clicked (GnomeDialog *dialog, gint button_num);
+
+/* Make _close just hide, not destroy. */
+void gnome_dialog_close_hides (GnomeDialog * dialog,
+ gboolean just_hide);
+
+/* Whether to close after emitting clicked signal - default is
+ FALSE. If clicking *any* button should close the dialog, set it to
+ TRUE. */
+void gnome_dialog_set_close (GnomeDialog * dialog,
+ gboolean click_closes);
+
+/* Normally an editable widget will grab "Return" and keep it from
+ activating the dialog's default button. This connects the activate
+ signal of the editable to the default button. */
+void gnome_dialog_editable_enters (GnomeDialog * dialog,
+ GtkEditable * editable);
+
+/* Use of append_buttons is discouraged, it's really
+ meant for subclasses. */
+void gnome_dialog_append_buttons (GnomeDialog * dialog,
+ const gchar * first,
+ ...);
+void gnome_dialog_append_button (GnomeDialog * dialog,
+ const gchar * name);
+void gnome_dialog_append_buttonsv (GnomeDialog * dialog,
+ const gchar **buttons);
+
+/* Add button with arbitrary text and pixmap. */
+void gnome_dialog_append_button_with_pixmap (GnomeDialog * dialog,
+ const gchar * name,
+ const gchar * pixmap);
+void gnome_dialog_append_buttons_with_pixmaps (GnomeDialog * dialog,
+ const gchar **names,
+ const gchar **pixmaps);
+
+/* Don't use this either; it's for bindings to languages other
+ than C (which makes the varargs kind of lame... feel free to fix)
+ You want _new, see above. */
+void gnome_dialog_construct (GnomeDialog * dialog,
+ const gchar * title,
+ va_list ap);
+void gnome_dialog_constructv (GnomeDialog * dialog,
+ const gchar * title,
+ const gchar **buttons);
+
+/* Stock defines for compatibility, not to be used
+ * in new applications, please see gtk stock icons
+ * and you should use those instead. */
+#define GNOME_STOCK_BUTTON_OK GTK_STOCK_OK
+#define GNOME_STOCK_BUTTON_CANCEL GTK_STOCK_CANCEL
+#define GNOME_STOCK_BUTTON_YES GTK_STOCK_YES
+#define GNOME_STOCK_BUTTON_NO GTK_STOCK_NO
+#define GNOME_STOCK_BUTTON_CLOSE GTK_STOCK_CLOSE
+#define GNOME_STOCK_BUTTON_APPLY GTK_STOCK_APPLY
+#define GNOME_STOCK_BUTTON_HELP GTK_STOCK_HELP
+#define GNOME_STOCK_BUTTON_NEXT GTK_STOCK_GO_FORWARD
+#define GNOME_STOCK_BUTTON_PREV GTK_STOCK_GO_BACK
+#define GNOME_STOCK_BUTTON_UP GTK_STOCK_GO_UP
+#define GNOME_STOCK_BUTTON_DOWN GTK_STOCK_GO_DOWN
+#define GNOME_STOCK_BUTTON_FONT GTK_STOCK_SELECT_FONT
+
+G_END_DECLS
+
+#endif /* GNOME_DISABLE_DEPRECATED */
+
+#endif /* __GNOME_DIALOG_H__ */
diff --git a/libgnomeui/gnome-druid-page-edge.c b/libgnomeui/gnome-druid-page-edge.c
index 8981aec..5f10fc8 100644
--- a/libgnomeui/gnome-druid-page-edge.c
+++ b/libgnomeui/gnome-druid-page-edge.c
@@ -25,12 +25,14 @@
#include <config.h>
#include "gnome-macros.h"
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <libgnomecanvas/gnome-canvas-pixbuf.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include <libgnomecanvas/gnome-canvas-text.h>
#include "gnome-druid.h"
#include "gnome-uidefs.h"
-#include <libgnome/gnome-i18n.h>
#include "gnome-druid-page-edge.h"
diff --git a/libgnomeui/gnome-druid-page-standard.c b/libgnomeui/gnome-druid-page-standard.c
index cfbcfb3..c392007 100644
--- a/libgnomeui/gnome-druid-page-standard.c
+++ b/libgnomeui/gnome-druid-page-standard.c
@@ -23,9 +23,11 @@
#include <config.h>
#include "gnome-macros.h"
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include "gnome-druid.h"
#include "gnome-uidefs.h"
-#include <libgnome/gnome-i18n.h>
/* FIXME: Are these includes needed */
#include <gtk/gtklabel.h>
diff --git a/libgnomeui/gnome-druid.c b/libgnomeui/gnome-druid.c
index bb866c7..77c8ebd 100644
--- a/libgnomeui/gnome-druid.c
+++ b/libgnomeui/gnome-druid.c
@@ -23,6 +23,9 @@
#include <config.h>
#include "gnome-macros.h"
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include "gnome-druid.h"
#include "gnome-uidefs.h"
#include <libgnome/gnome-i18n.h>
diff --git a/libgnomeui/gnome-entry.c b/libgnomeui/gnome-entry.c
index c48ac1a..54cd03c 100644
--- a/libgnomeui/gnome-entry.c
+++ b/libgnomeui/gnome-entry.c
@@ -30,6 +30,9 @@
#include <config.h>
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <stdio.h>
#include <string.h>
#include <gtk/gtkentry.h>
@@ -39,8 +42,6 @@
#include "gnome-entry.h"
-#include <libgnome/gnome-i18n.h>
-
enum {
PROP_0,
PROP_HISTORY_ID,
diff --git a/libgnomeui/gnome-file-entry.c b/libgnomeui/gnome-file-entry.c
index f955746..f95605c 100644
--- a/libgnomeui/gnome-file-entry.c
+++ b/libgnomeui/gnome-file-entry.c
@@ -32,6 +32,9 @@
#include <config.h>
#include "gnome-macros.h"
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <pwd.h>
#include <string.h>
#include <unistd.h>
@@ -187,7 +190,7 @@ fentry_set_arg (GtkObject *object,
break;
}
case ARG_DIRECTORY_ENTRY:
- gnome_file_entry_set_directory (self, GTK_VALUE_BOOL(*arg));
+ gnome_file_entry_set_directory_entry (self, GTK_VALUE_BOOL(*arg));
break;
case ARG_MODAL:
gnome_file_entry_set_modal (self, GTK_VALUE_BOOL(*arg));
@@ -676,7 +679,7 @@ tilde_expand (char *str)
* If @file_must_exist is false, nothing is tested and the path is returned.
* If @file_must_exist is true, then the path is only returned if the path
* actually exists. In case the entry is a directory entry (see
- * #gnome_file_entry_set_directory), then if the path exists and is a
+ * #gnome_file_entry_set_directory_entry), then if the path exists and is a
* directory then it's returned; if not, it is assumed it was a file so
* we try to strip it, and try again. It allocates memory for the returned string.
*
@@ -846,6 +849,7 @@ gnome_file_entry_get_directory_entry(GnomeFileEntry *fentry)
return fentry->_priv->directory_entry;
}
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
/**
* gnome_file_entry_set_directory:
* @fentry: The GnomeFileEntry widget to work with.
@@ -862,3 +866,4 @@ gnome_file_entry_set_directory(GnomeFileEntry *fentry, gboolean directory_entry)
"please use gnome_file_entry_set_directory_entry");
gnome_file_entry_set_directory_entry(fentry, directory_entry);
}
+#endif /* GNOME_DISABLE_DEPRECATED_SOURCE */
diff --git a/libgnomeui/gnome-file-entry.h b/libgnomeui/gnome-file-entry.h
index f923c08..eab8600 100644
--- a/libgnomeui/gnome-file-entry.h
+++ b/libgnomeui/gnome-file-entry.h
@@ -117,11 +117,11 @@ void gnome_file_entry_set_modal (GnomeFileEntry *fentry,
gboolean is_modal);
gboolean gnome_file_entry_get_modal (GnomeFileEntry *fentry);
-#ifndef GNOME_EXCLUDE_DEPRECATED
+#ifndef GNOME_DISABLE_DEPRECATED
/* DEPRECATED, use gnome_file_entry_set_directory_entry */
void gnome_file_entry_set_directory(GnomeFileEntry *fentry,
gboolean directory_entry);
-#endif /* GNOME_EXCLUDE_DEPRECATED */
+#endif /* GNOME_DISABLE_DEPRECATED */
G_END_DECLS
diff --git a/libgnomeui/gnome-font-picker.c b/libgnomeui/gnome-font-picker.c
index ccef478..aba99f1 100644
--- a/libgnomeui/gnome-font-picker.c
+++ b/libgnomeui/gnome-font-picker.c
@@ -22,6 +22,9 @@
#include <config.h>
#include "gnome-macros.h"
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <gtk/gtksignal.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkalignment.h>
@@ -33,7 +36,6 @@
#include <gtk/gtkstock.h>
#include <libgnomeui/gnome-stock-icons.h>
#include "gnome-font-picker.h"
-#include <libgnome/gnome-i18n.h>
#include <string.h>
#include <stdio.h>
diff --git a/libgnomeui/gnome-href.c b/libgnomeui/gnome-href.c
index fd7b43c..7eca865 100644
--- a/libgnomeui/gnome-href.c
+++ b/libgnomeui/gnome-href.c
@@ -23,14 +23,15 @@
#include "config.h"
#include "gnome-macros.h"
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <string.h> /* for strlen */
#include <gtk/gtk.h>
#include <libgnome/gnome-url.h>
#include "gnome-href.h"
-#include <libgnome/gnome-i18n.h>
-
struct _GnomeHRefPrivate {
gchar *url;
GtkWidget *label;
@@ -338,7 +339,7 @@ gnome_href_set_text (GnomeHRef *href, const gchar *text)
g_free(pattern);
}
-#ifndef GNOME_EXCLUDE_DEPRECATED_SOURCE
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
/**
* gnome_href_get_label
@@ -375,7 +376,7 @@ gnome_href_set_label (GnomeHRef *href, const gchar *label)
gnome_href_set_text(href, label);
}
-#endif /* not GNOME_EXCLUDE_DEPRECATED_SOURCE */
+#endif /* not GNOME_DISABLE_DEPRECATED_SOURCE */
static void
gnome_href_clicked (GtkButton *button)
diff --git a/libgnomeui/gnome-href.h b/libgnomeui/gnome-href.h
index 1f1ddad..135b712 100644
--- a/libgnomeui/gnome-href.h
+++ b/libgnomeui/gnome-href.h
@@ -72,11 +72,11 @@ const gchar *gnome_href_get_url(GnomeHRef *href);
void gnome_href_set_text(GnomeHRef *href, const gchar *text);
const gchar *gnome_href_get_text(GnomeHRef *href);
-#ifndef GNOME_EXCLUDE_DEPRECATED
+#ifndef GNOME_DISABLE_DEPRECATED
/* DEPRECATED!, use set/get_text */
void gnome_href_set_label(GnomeHRef *href, const gchar *label);
const gchar *gnome_href_get_label(GnomeHRef *href);
-#endif
+#endif /* GNOME_DISABLE_DEPRECATED */
G_END_DECLS
diff --git a/libgnomeui/gnome-i18nP.h b/libgnomeui/gnome-i18nP.h
new file mode 100644
index 0000000..1ab1412
--- /dev/null
+++ b/libgnomeui/gnome-i18nP.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ @NOTATION@
+ */
+
+/*
+ * Handles i18n for the Gnome libraries. Libraries need to use
+ * dgettext in order to use a non-default translation domain.
+ * Author: Tom Tromey <tromey creche cygnus com>
+ */
+
+#ifndef __GNOME_I18NP_H__
+#define __GNOME_I18NP_H__ 1
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# undef _
+# define _(String) dgettext (PACKAGE, String)
+# ifdef gettext_noop
+# define N_(String) gettext_noop (String)
+# else
+# define N_(String) (String)
+# endif
+#else
+/* Stubs that do something close enough. */
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(Domain,Message) (Message)
+# define dcgettext(Domain,Message,Type) (Message)
+# define bindtextdomain(Domain,Directory) (Domain)
+# define _(String) (String)
+# define N_(String) (String)
+#endif
+
+#include <libgnome/gnome-i18n.h>
+
+#endif /* __GNOME_I18NP_H__ */
diff --git a/libgnomeui/gnome-messagebox.c b/libgnomeui/gnome-messagebox.c
new file mode 100644
index 0000000..1e00225
--- /dev/null
+++ b/libgnomeui/gnome-messagebox.c
@@ -0,0 +1,352 @@
+/* GNOME GUI Library
+ * Copyright (C) 1997, 1998 Jay Painter
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ */
+/*
+ @NOTATION@
+*/
+
+#include <config.h>
+
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
+
+#include <stdarg.h>
+
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
+#include "gnome-messagebox.h"
+
+#include <libgnome/gnome-triggers.h>
+#include <libgnome/gnome-util.h>
+#include <string.h> /* for strcmp */
+#include <gtk/gtk.h>
+#include <libgnomeui/gnome-uidefs.h>
+#include <libgnome/libgnome.h>
+
+#define GNOME_MESSAGE_BOX_WIDTH 425
+#define GNOME_MESSAGE_BOX_HEIGHT 125
+
+struct _GnomeMessageBoxPrivate {
+ /* not used currently, if something is added
+ * make sure to update _init and finalize */
+ int dummy;
+};
+
+static void gnome_message_box_class_init (GnomeMessageBoxClass *klass);
+static void gnome_message_box_init (GnomeMessageBox *messagebox);
+static void gnome_message_box_destroy (GtkObject *object);
+static void gnome_message_box_finalize (GObject *object);
+
+static GnomeDialogClass *parent_class;
+
+guint
+gnome_message_box_get_type (void)
+{
+ static guint message_box_type = 0;
+
+ if (!message_box_type)
+ {
+ GtkTypeInfo message_box_info =
+ {
+ "GnomeMessageBox",
+ sizeof (GnomeMessageBox),
+ sizeof (GnomeMessageBoxClass),
+ (GtkClassInitFunc) gnome_message_box_class_init,
+ (GtkObjectInitFunc) gnome_message_box_init,
+ NULL,
+ NULL,
+ NULL
+ };
+
+ message_box_type = gtk_type_unique (gnome_dialog_get_type (), &message_box_info);
+ }
+
+ return message_box_type;
+}
+
+static void
+gnome_message_box_class_init (GnomeMessageBoxClass *klass)
+{
+ GtkObjectClass *object_class;
+ GObjectClass *gobject_class;
+
+ object_class = (GtkObjectClass *)klass;
+ gobject_class = (GObjectClass *)klass;
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
+
+ object_class->destroy = gnome_message_box_destroy;
+ gobject_class->finalize = gnome_message_box_finalize;
+}
+
+static void
+gnome_message_box_init (GnomeMessageBox *message_box)
+{
+ /*
+ message_box->_priv = g_new0(GnomeMessageBoxPrivate, 1);
+ */
+}
+
+static void
+gnome_message_box_destroy(GtkObject *object)
+{
+ /* remember, destroy can be run multiple times! */
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+static void
+gnome_message_box_finalize(GObject *object)
+{
+ /*
+ GnomeMessageBox *mbox = GNOME_MESSAGE_BOX(object);
+
+ g_free(mbox->_priv);
+ mbox->_priv = NULL;
+ */
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+}
+
+/**
+ * gnome_message_box_construct:
+ * @messagebox: The message box to construct
+ * @message: The message to be displayed.
+ * @message_box_type: The type of the message
+ * @buttons: a NULL terminated array with the buttons to insert.
+ *
+ * For language bindings or subclassing, from C use #gnome_message_box_new or
+ * #gnome_message_box_newv
+ *
+ * Returns:
+ */
+void
+gnome_message_box_construct (GnomeMessageBox *messagebox,
+ const gchar *message,
+ const gchar *message_box_type,
+ const gchar **buttons)
+{
+ GtkWidget *hbox;
+ GtkWidget *pixmap = NULL;
+ GtkWidget *alignment;
+ GtkWidget *label;
+ char *s;
+ GtkStyle *style;
+ const gchar* title_prefix = NULL;
+ const gchar* appname;
+ gint i = 0;
+
+ g_return_if_fail (messagebox != NULL);
+ g_return_if_fail (GNOME_IS_MESSAGE_BOX (messagebox));
+ g_return_if_fail (message != NULL);
+ g_return_if_fail (message_box_type != NULL);
+
+ style = gtk_widget_get_style (GTK_WIDGET (messagebox));
+
+ /* Make noises, basically */
+ gnome_triggers_vdo(message, message_box_type, NULL);
+
+ if (strcmp(GNOME_MESSAGE_BOX_INFO, message_box_type) == 0)
+ {
+ title_prefix = _("Information");
+ s = GNOMEUIPIXMAPDIR "/gnome-info.png";
+ if (s) {
+ pixmap = gtk_image_new_from_file (s);
+ g_free(s);
+ }
+ }
+ else if (strcmp(GNOME_MESSAGE_BOX_WARNING, message_box_type) == 0)
+ {
+ title_prefix = _("Warning");
+ s = GNOMEUIPIXMAPDIR "/gnome-warning.png";
+ if (s) {
+ pixmap = gtk_image_new_from_file (s);
+ g_free(s);
+ }
+ }
+ else if (strcmp(GNOME_MESSAGE_BOX_ERROR, message_box_type) == 0)
+ {
+ title_prefix = _("Error");
+ s = GNOMEUIPIXMAPDIR "/gnome-error.png";
+ if (s) {
+ pixmap = gtk_image_new_from_file (s);
+ g_free(s);
+ }
+ }
+ else if (strcmp(GNOME_MESSAGE_BOX_QUESTION, message_box_type) == 0)
+ {
+ title_prefix = _("Question");
+ s = GNOMEUIPIXMAPDIR "/gnome-question.png";
+ if (s) {
+ pixmap = gtk_image_new_from_file (s);
+ g_free(s);
+ }
+ }
+ else
+ {
+ title_prefix = _("Message");
+ }
+
+ g_assert(title_prefix != NULL);
+ s = NULL;
+ appname = gnome_program_get_human_readable_name(gnome_program_get());
+ if (appname) {
+ s = g_strdup_printf("%s (%s)", title_prefix, appname);
+ }
+ if (s) {
+ gtk_window_set_title(GTK_WINDOW(messagebox), s);
+ g_free(s);
+ } else {
+ gtk_window_set_title(GTK_WINDOW(messagebox), title_prefix);
+ }
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(GNOME_DIALOG(messagebox)->vbox),
+ hbox, TRUE, TRUE, 10);
+ gtk_widget_show (hbox);
+
+ if (pixmap == NULL) {
+ if (pixmap) gtk_widget_destroy(pixmap);
+ s = GNOMEUIPIXMAPDIR "/gnome-default-dlg.png";
+ if (s) {
+ pixmap = gtk_image_new_from_file (s);
+ g_free(s);
+ } else
+ pixmap = NULL;
+ }
+ if (pixmap) {
+ gtk_box_pack_start (GTK_BOX(hbox),
+ pixmap, FALSE, TRUE, 0);
+ gtk_widget_show (pixmap);
+ }
+
+ label = gtk_label_new (message);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_misc_set_padding (GTK_MISC (label), GNOME_PAD, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+ gtk_widget_show (label);
+
+ /* Add some extra space on the right to balance the pixmap */
+ if (pixmap) {
+ alignment = gtk_alignment_new (0., 0., 0., 0.);
+ gtk_widget_set_usize (alignment, GNOME_PAD, -1);
+ gtk_widget_show (alignment);
+
+ gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
+ }
+
+ if (buttons) {
+ while (buttons[i]) {
+ gnome_dialog_append_button (GNOME_DIALOG (messagebox),
+ buttons[i]);
+ i++;
+ };
+ }
+
+ if(GNOME_DIALOG(messagebox)->buttons)
+ gtk_widget_grab_focus(
+ g_list_last (GNOME_DIALOG (messagebox)->buttons)->data);
+
+ gnome_dialog_set_close (GNOME_DIALOG (messagebox),
+ TRUE );
+}
+
+/**
+ * gnome_message_box_new:
+ * @message: The message to be displayed.
+ * @message_box_type: The type of the message
+ * @...: A NULL terminated list of strings to use in each button.
+ *
+ * Creates a dialog box of type @message_box_type with @message. A number
+ * of buttons are inserted on it. You can use the GNOME stock identifiers
+ * to create gnome-stock-buttons.
+ *
+ * Returns a widget that has the dialog box.
+ */
+GtkWidget*
+gnome_message_box_new (const gchar *message,
+ const gchar *message_box_type, ...)
+{
+ va_list ap;
+ GnomeMessageBox *message_box;
+
+ g_return_val_if_fail (message != NULL, NULL);
+ g_return_val_if_fail (message_box_type != NULL, NULL);
+
+ va_start (ap, message_box_type);
+
+ message_box = gtk_type_new (gnome_message_box_get_type ());
+
+ gnome_message_box_construct (message_box, message,
+ message_box_type, NULL);
+
+ /* we need to add buttons by hand here */
+ while (TRUE) {
+ gchar * button_name;
+
+ button_name = va_arg (ap, gchar *);
+
+ if (button_name == NULL) {
+ break;
+ }
+
+ gnome_dialog_append_button ( GNOME_DIALOG(message_box),
+ button_name);
+ }
+
+ va_end (ap);
+
+ gtk_widget_grab_focus(
+ g_list_last (GNOME_DIALOG (message_box)->buttons)->data);
+
+ return GTK_WIDGET (message_box);
+}
+
+/**
+ * gnome_message_box_newv:
+ * @message: The message to be displayed.
+ * @message_box_type: The type of the message
+ * @buttons: a NULL terminated array with the buttons to insert.
+ *
+ * Creates a dialog box of type @message_box_type with @message. A number
+ * of buttons are inserted on it, the messages come from the @buttons array.
+ * You can use the GNOME stock identifiers to create gnome-stock-buttons.
+ * The buttons array can be NULL if you wish to add buttons yourself later.
+ *
+ * Returns a widget that has the dialog box.
+ */
+GtkWidget*
+gnome_message_box_newv (const gchar *message,
+ const gchar *message_box_type,
+ const gchar **buttons)
+{
+ GnomeMessageBox *message_box;
+
+ g_return_val_if_fail (message != NULL, NULL);
+ g_return_val_if_fail (message_box_type != NULL, NULL);
+
+ message_box = gtk_type_new (gnome_message_box_get_type ());
+
+ gnome_message_box_construct (message_box, message,
+ message_box_type, buttons);
+
+ return GTK_WIDGET (message_box);
+}
+
+#endif /* GNOME_DISABLE_DEPRECATED_SOURCE */
diff --git a/libgnomeui/gnome-messagebox.h b/libgnomeui/gnome-messagebox.h
new file mode 100644
index 0000000..863279f
--- /dev/null
+++ b/libgnomeui/gnome-messagebox.h
@@ -0,0 +1,82 @@
+/* GNOME GUI Library
+ * Copyright (C) 1995-1998 Jay Painter
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ */
+/*
+ @NOTATION@
+*/
+#ifndef __GNOME_MESSAGE_BOX_H__
+#define __GNOME_MESSAGE_BOX_H__
+
+#ifndef GNOME_DISABLE_DEPRECATED
+
+#include "gnome-dialog.h"
+
+G_BEGIN_DECLS
+
+#define GNOME_TYPE_MESSAGE_BOX (gnome_message_box_get_type ())
+#define GNOME_MESSAGE_BOX(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_MESSAGE_BOX, GnomeMessageBox))
+#define GNOME_MESSAGE_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_MESSAGE_BOX, GnomeMessageBoxClass))
+#define GNOME_IS_MESSAGE_BOX(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_MESSAGE_BOX))
+#define GNOME_IS_MESSAGE_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_MESSAGE_BOX))
+#define GNOME_MESSAGE_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_MESSAGE_BOX, GnomeMessageBoxClass))
+
+
+#define GNOME_MESSAGE_BOX_INFO "info"
+#define GNOME_MESSAGE_BOX_WARNING "warning"
+#define GNOME_MESSAGE_BOX_ERROR "error"
+#define GNOME_MESSAGE_BOX_QUESTION "question"
+#define GNOME_MESSAGE_BOX_GENERIC "generic"
+
+
+typedef struct _GnomeMessageBox GnomeMessageBox;
+typedef struct _GnomeMessageBoxPrivate GnomeMessageBoxPrivate;
+typedef struct _GnomeMessageBoxClass GnomeMessageBoxClass;
+typedef struct _GnomeMessageBoxButton GnomeMessageBoxButton;
+
+struct _GnomeMessageBox
+{
+ GnomeDialog dialog;
+ /*< private >*/
+ GnomeMessageBoxPrivate *_priv;
+};
+
+struct _GnomeMessageBoxClass
+{
+ GnomeDialogClass parent_class;
+};
+
+
+guint gnome_message_box_get_type (void) G_GNUC_CONST;
+GtkWidget* gnome_message_box_new (const gchar *message,
+ const gchar *messagebox_type,
+ ...);
+
+GtkWidget* gnome_message_box_newv (const gchar *message,
+ const gchar *messagebox_type,
+ const gchar **buttons);
+
+void gnome_message_box_construct (GnomeMessageBox *messagebox,
+ const gchar *message,
+ const gchar *messagebox_type,
+ const gchar **buttons);
+
+G_END_DECLS
+
+#endif /* GNOME_DISABLE_DEPRECATED */
+
+#endif /* __GNOME_MESSAGE_BOX_H__ */
diff --git a/libgnomeui/gnome-stock-icons.c b/libgnomeui/gnome-stock-icons.c
index 438f98e..cb7b748 100644
--- a/libgnomeui/gnome-stock-icons.c
+++ b/libgnomeui/gnome-stock-icons.c
@@ -27,7 +27,8 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include <libgnome/gnome-i18n.h>
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
#include <libgnomeui/gnome-stock-icons.h>
#include "pixmaps/gnome-stock-pixbufs.h"
diff --git a/libgnomeui/gnome-ui-init.c b/libgnomeui/gnome-ui-init.c
index bbbb88a..ce90e88 100644
--- a/libgnomeui/gnome-ui-init.c
+++ b/libgnomeui/gnome-ui-init.c
@@ -42,6 +42,9 @@
#include <locale.h>
#endif
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
#include <libgnome.h>
#include <libgnomeui/gnome-canvas-init.h>
diff --git a/libgnomeui/gnome_segv.c b/libgnomeui/gnome_segv.c
index 41d5c76..e74a643 100644
--- a/libgnomeui/gnome_segv.c
+++ b/libgnomeui/gnome_segv.c
@@ -42,6 +42,9 @@
#include <string.h>
#include <stdio.h>
+/* Must be before all other gnome includes!! */
+#include "gnome-i18nP.h"
+
enum {
RESPONSE_NULL,
RESPONSE_BUG_BUDDY,
diff --git a/libgnomeui/libgnomeuiP.h b/libgnomeui/libgnomeuiP.h
index b988323..b0a570b 100644
--- a/libgnomeui/libgnomeuiP.h
+++ b/libgnomeui/libgnomeuiP.h
@@ -40,10 +40,6 @@ G_BEGIN_DECLS
void gnome_type_init(void);
-/* FIXME: broken */
-extern const GList *gnome_i18n_get_language_list (const gchar *category_name);
-extern char *gnome_i18n_get_preferred_language (void);
-
G_END_DECLS
#endif /* LIBGNOMEUIP_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]