GnomeDialog: a couple of api additions
- From: jacob berkman <jacob ximian com>
- To: gnome-libs-devel gnome org
- Cc: Anders Carlsson <andersca gnu org>, Michael Meeks <michael ximian com>
- Subject: GnomeDialog: a couple of api additions
- Date: 19 Dec 2001 18:34:52 -0500
these simple functions provide stuff glade had used in gnome 1.
it'd be nice to have these.
otherwise, considering that GnomeDialog is deprecated, is there any
reason not to un-privatize it, such that old code poking into it works
again?
if neither of these are acceptable, some evil hacks (slightly less evil
now that i've seen what glade does in GnomeMessageBox) can be done.
jacob
--
"In fact, can you imagine anything more terrifying than a zombie clown?"
-- moby
? ChangeLog.flc
? Makefile.am2
? gnome_segv
? old-gnome-window-icon.c
Index: gnome-dialog.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-dialog.c,v
retrieving revision 1.82
diff -u -r1.82 gnome-dialog.c
--- gnome-dialog.c 2001/12/10 22:52:10 1.82
+++ gnome-dialog.c 2001/12/19 23:35:38
@@ -842,6 +842,27 @@
}
/**
+ * gnome_dialog_get_close: Whether gnome_dialog_close() will be called when a button is clicked.
+ * @dialog: #GnomeDialog to query
+ *
+ * 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.
+ *
+ * Return value: whether gnome_dialog_close() will be called when a button is clicked
+ **/
+gboolean
+gnome_dialog_get_close (GnomeDialog * dialog)
+{
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+
+ return dialog->_priv->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().
@@ -862,7 +883,26 @@
dialog->_priv->just_hide = just_hide;
}
+/**
+ * gnome_dialog_get_close_hides: get whether gnome_dialog_close() destroys or hides the dialog
+ * @dialog: #GnomeDialog to affect.
+ *
+ * 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.
+ *
+ * Return value: whether gnome_dialog_close() will hide this #GnomeDialog
+ **/
+gboolean
+gnome_dialog_get_close_hides (GnomeDialog * dialog)
+{
+ g_return_if_fail(GNOME_IS_DIALOG(dialog));
+ return dialog->_priv->just_hide;
+}
+
/**
* gnome_dialog_set_sensitive: Set the sensitivity of a button.
* @dialog: #GnomeDialog to affect.
@@ -1169,6 +1209,27 @@
{
if (GTK_WIDGET_CLASS(parent_class)->show)
(* (GTK_WIDGET_CLASS(parent_class)->show))(d);
+}
+
+/**
+ * gnome_dialog_get_action_area: get the action area (hbuttonbox) of
+ * the #GnomeDialog
+ * @dialog: #GnomeDialog to get the action area from
+ *
+ * This is a private function, and only meant for UI builders such as
+ * Glade. DO NOT USE THIS IN YOUR APPLICATION!
+ *
+ * Return value: #GtkHButtonBox which holds the buttons
+ *
+ **/
+GtkWidget *
+gnome_dialog_get_action_area (GnomeDialog *dialog)
+{
+ g_return_val_if_fail (GNOME_IS_DIALOG (dialog), NULL);
+
+ gnome_dialog_init_action_area (dialog);
+
+ return dialog->_priv->action_area;
}
#endif /* GNOME_DISABLE_DEPRECATED_SOURCE */
Index: gnome-dialog.h
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-dialog.h,v
retrieving revision 1.46
diff -u -r1.46 gnome-dialog.h
--- gnome-dialog.h 2001/09/08 13:53:06 1.46
+++ gnome-dialog.h 2001/12/19 23:35:38
@@ -139,12 +139,17 @@
void gnome_dialog_close_hides (GnomeDialog * dialog,
gboolean just_hide);
+gboolean gnome_dialog_get_close_hides (GnomeDialog *dialog);
+
/* 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);
+/* get whether a button click should close the dialog */
+gboolean gnome_dialog_get_close (GnomeDialog *dialog);
+
/* 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. */
@@ -195,6 +200,8 @@
#define GNOME_STOCK_BUTTON_DOWN GTK_STOCK_GO_DOWN
#define GNOME_STOCK_BUTTON_FONT GTK_STOCK_SELECT_FONT
+/* private: for gui builders (glade) only */
+GtkWidget *gnome_dialog_get_action_area (GnomeDialog *dialog);
G_END_DECLS
#endif /* GNOME_DISABLE_DEPRECATED */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]