Commit 69f42512 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

Derive from GtkDialog, and use stock buttons. Should be 100% source

2000-11-02  Havoc Pennington  <hp@redhat.com>

	* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
	use stock buttons. Should be 100% source compatible, appropriate
	filesel fields now point to dialog->vbox and dialog->action_area.
	On the bizarre side, dialog->action_area and filesel->action_area
	are not the same widget.
	(gtk_file_selection_init): Put some padding around the selection
	entry, so it isn't touching the GtkDialog separator.

	* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
	use stock buttons, etc. Should also be source compatible.
	Set the dialog default title in _init not _new().

	* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
	Use stock buttons; don't put a button box inside the existing
	dialog button box. Don't bother with push/pop colormap anymore.

	* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
	specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
	for message dialog, and necessary for the font selection and color
	selection with help and apply buttons.

	* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
	to the created button widget. Set GTK_CAN_DEFAULT on the button.
	(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
	between buttons, put less padding around the action area.
	(gtk_dialog_run): Exit on unmap rather than on destroy.
	This will also exit the loop if the widget is hidden.
	(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
	instead of GTK_RESPONSE_NONE; since we're already adding a bunch
	of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
	special-case delete event.

	* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
	formatting
parent 8aef169f
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
Sun Nov 5 05:32:39 2000 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (uposition_stop_configure): provide a toggle
......
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
Sun Nov 5 05:32:39 2000 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (uposition_stop_configure): provide a toggle
......
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
Sun Nov 5 05:32:39 2000 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (uposition_stop_configure): provide a toggle
......
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
Sun Nov 5 05:32:39 2000 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (uposition_stop_configure): provide a toggle
......
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
Sun Nov 5 05:32:39 2000 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (uposition_stop_configure): provide a toggle
......
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
Sun Nov 5 05:32:39 2000 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (uposition_stop_configure): provide a toggle
......
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
Sun Nov 5 05:32:39 2000 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (uposition_stop_configure): provide a toggle
......
......@@ -27,9 +27,9 @@ GtkObject
GtkWindow
GtkDialog
GtkColorSelectionDialog
GtkFileSelection
GtkFontSelectionDialog
GtkInputDialog
GtkFileSelection
GtkFontSelectionDialog
GtkPlug
GtkEventBox
GtkHandleBox
......
This diff is collapsed.
......@@ -153,6 +153,14 @@ gtk_window_set_title(). See the #GtkWindow section for more).
@GTK_RESPONSE_NONE:
@GTK_RESPONSE_REJECT:
@GTK_RESPONSE_ACCEPT:
@GTK_RESPONSE_DELETE_EVENT:
@GTK_RESPONSE_OK:
@GTK_RESPONSE_CANCEL:
@GTK_RESPONSE_CLOSE:
@GTK_RESPONSE_YES:
@GTK_RESPONSE_NO:
@GTK_RESPONSE_APPLY:
@GTK_RESPONSE_HELP:
<!-- ##### FUNCTION gtk_dialog_new ##### -->
<para>
......@@ -202,6 +210,7 @@ directly, but into the vbox and action_area, as described above.
@dialog:
@button_text:
@response_id:
@Returns:
<!-- ##### FUNCTION gtk_dialog_add_buttons ##### -->
......
......@@ -28,6 +28,7 @@
#include "gtkframe.h"
#include "gtkhbbox.h"
#include "gtkbutton.h"
#include "gtkstock.h"
#include "gtkintl.h"
......@@ -79,10 +80,7 @@ gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass)
static void
gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
{
GtkWidget *action_area_button_box, *frame;
gtk_widget_set_colormap (GTK_WIDGET (colorseldiag), gdk_rgb_get_cmap ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
GtkWidget *action_area_button_box, *frame;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
......@@ -96,29 +94,21 @@ gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
gtk_container_add (GTK_CONTAINER (frame), colorseldiag->colorsel);
gtk_widget_show (colorseldiag->colorsel);
action_area_button_box = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX(action_area_button_box), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing (GTK_BUTTON_BOX(action_area_button_box), 5);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (colorseldiag)->action_area), action_area_button_box, TRUE, TRUE, 0);
gtk_widget_show (action_area_button_box);
colorseldiag->ok_button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (colorseldiag->ok_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (action_area_button_box), colorseldiag->ok_button, TRUE, TRUE, 0);
action_area_button_box = GTK_DIALOG (colorseldiag)->action_area;
colorseldiag->ok_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
GTK_STOCK_BUTTON_OK,
GTK_RESPONSE_OK);
gtk_widget_grab_default (colorseldiag->ok_button);
gtk_widget_show (colorseldiag->ok_button);
colorseldiag->cancel_button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (colorseldiag->cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (action_area_button_box), colorseldiag->cancel_button, TRUE, TRUE, 0);
gtk_widget_show (colorseldiag->cancel_button);
colorseldiag->help_button = gtk_button_new_with_label (_("Help"));
GTK_WIDGET_SET_FLAGS (colorseldiag->help_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (action_area_button_box), colorseldiag->help_button, TRUE, TRUE, 0);
gtk_widget_show (colorseldiag->help_button);
colorseldiag->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
GTK_STOCK_BUTTON_CANCEL,
GTK_RESPONSE_CANCEL);
gtk_widget_pop_colormap ();
colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
GTK_STOCK_HELP,
GTK_RESPONSE_HELP);
}
GtkWidget*
......
......@@ -129,9 +129,11 @@ gtk_dialog_init (GtkDialog *dialog)
dialog->action_area = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->action_area),
GTK_BUTTONBOX_SPREAD);
GTK_BUTTONBOX_END);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog->action_area), 5);
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 10);
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area,
FALSE, TRUE, 0);
gtk_widget_show (dialog->action_area);
......@@ -147,7 +149,7 @@ gtk_dialog_delete_event_handler (GtkWidget *widget,
gpointer user_data)
{
/* emit response signal */
gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_NONE);
gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_DELETE_EVENT);
/* Do the destroy by default */
return FALSE;
......@@ -244,7 +246,7 @@ gtk_dialog_new_empty (const gchar *title,
* GTK_STOCK_BUTTON_OK,
* GTK_RESPONSE_ACCEPT,
* GTK_STOCK_BUTTON_CANCEL,
* GTK_RESPONSE_NONE,
* GTK_RESPONSE_REJECT,
* NULL);
* </programlisting>
*
......@@ -373,10 +375,12 @@ gtk_dialog_add_action_widget (GtkDialog *dialog,
* Adds a button with the given text (or a stock button, if @button_text is a
* stock ID) and sets things up so that clicking the button will emit the
* "response" signal with the given @response_id. The button is appended to the
* end of the dialog's action area.
*
* end of the dialog's action area. The button widget is returned, but usually
* you don't need it.
*
* Return value: the button widget that was added
**/
void
GtkWidget*
gtk_dialog_add_button (GtkDialog *dialog,
const gchar *button_text,
gint response_id)
......@@ -389,11 +393,15 @@ gtk_dialog_add_button (GtkDialog *dialog,
button = gtk_button_new_stock (button_text,
gtk_window_get_default_accel_group (GTK_WINDOW (dialog)));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_show (button);
gtk_dialog_add_action_widget (dialog,
button,
response_id);
return button;
}
static void
......@@ -491,7 +499,7 @@ shutdown_loop (RunInfo *ri)
}
static void
run_destroy_handler (GtkDialog *dialog, gpointer data)
run_unmap_handler (GtkDialog *dialog, gpointer data)
{
RunInfo *ri = data;
......@@ -542,7 +550,7 @@ run_delete_handler (GtkDialog *dialog,
* During gtk_dialog_run(), the default behavior of "delete_event" is
* disabled; if the dialog receives "delete_event", it will not be
* destroyed as windows usually are, and gtk_dialog_run() will return
* GTK_RESPONSE_NONE. Also, during gtk_dialog_run() the dialog will be
* GTK_RESPONSE_DELETE_EVENT. Also, during gtk_dialog_run() the dialog will be
* modal. You can force gtk_dialog_run() to return at any time by
* calling gtk_dialog_response() to emit the "response"
* signal. Destroying the dialog during gtk_dialog_run() is a very bad
......@@ -597,8 +605,8 @@ gtk_dialog_run (GtkDialog *dialog)
destroy_handler =
gtk_signal_connect (GTK_OBJECT (dialog),
"destroy",
GTK_SIGNAL_FUNC (run_destroy_handler),
"unmap",
GTK_SIGNAL_FUNC (run_unmap_handler),
&ri);
delete_handler =
......
......@@ -46,23 +46,39 @@ typedef enum
/* Convenience enum to use for action_id's. Positive values are
* totally user-interpreted. GTK will sometimes return
* GTK_ACTION_NONE if no action_id is available.
* GTK_RESPONSE_NONE if no response_id is available.
*
* Typical usage is:
* if (gtk_dialog_run(dialog) == GTK_ACTION_ACCEPT)
* if (gtk_dialog_run(dialog) == GTK_RESPONSE_ACCEPT)
* blah();
*/
typedef enum
{
/* GTK returns this if a response widget has no response_id,
* or the dialog gets destroyed with no response
* or if the dialog gets programmatically hidden or destroyed.
*/
GTK_RESPONSE_NONE = -1,
/* GTK won't return these unless you pass them in
* as the response for an action widget
* as the response for an action widget. They are
* for your convenience.
*/
GTK_RESPONSE_REJECT = -2,
GTK_RESPONSE_ACCEPT = -3
GTK_RESPONSE_ACCEPT = -3,
/* If the dialog is deleted. */
GTK_RESPONSE_DELETE_EVENT = -4,
/* These are returned from GTK dialogs, and you can also use them
* yourself if you like.
*/
GTK_RESPONSE_OK = -5,
GTK_RESPONSE_CANCEL = -6,
GTK_RESPONSE_CLOSE = -7,
GTK_RESPONSE_YES = -8,
GTK_RESPONSE_NO = -9,
GTK_RESPONSE_APPLY = -10,
GTK_RESPONSE_HELP = -11
} GtkResponseType;
......@@ -102,17 +118,15 @@ GtkWidget* gtk_dialog_new_with_buttons (const gchar *title,
const gchar *first_button_text,
...);
void gtk_dialog_add_action_widget (GtkDialog *dialog,
GtkWidget *child,
gint response_id);
void gtk_dialog_add_button (GtkDialog *dialog,
const gchar *button_text,
gint response_id);
void gtk_dialog_add_buttons (GtkDialog *dialog,
const gchar *first_button_text,
...);
void gtk_dialog_add_action_widget (GtkDialog *dialog,
GtkWidget *child,
gint response_id);
GtkWidget* gtk_dialog_add_button (GtkDialog *dialog,
const gchar *button_text,
gint response_id);
void gtk_dialog_add_buttons (GtkDialog *dialog,
const gchar *first_button_text,
...);
/* Emit response signal */
void gtk_dialog_response (GtkDialog *dialog,
......
......@@ -58,6 +58,7 @@
#include "gtklistitem.h"
#include "gtkmain.h"
#include "gtkscrolledwindow.h"
#include "gtkstock.h"
#include "gtksignal.h"
#include "gtkvbox.h"
#include "gtkmenu.h"
......@@ -443,7 +444,7 @@ gtk_file_selection_get_type (void)
(GtkClassInitFunc) NULL,
};
file_selection_type = gtk_type_unique (GTK_TYPE_WINDOW, &filesel_info);
file_selection_type = gtk_type_unique (GTK_TYPE_DIALOG, &filesel_info);
}
return file_selection_type;
......@@ -456,7 +457,7 @@ gtk_file_selection_class_init (GtkFileSelectionClass *class)
object_class = (GtkObjectClass*) class;
parent_class = gtk_type_class (GTK_TYPE_WINDOW);
parent_class = gtk_type_class (GTK_TYPE_DIALOG);
object_class->destroy = gtk_file_selection_destroy;
}
......@@ -470,17 +471,18 @@ gtk_file_selection_init (GtkFileSelection *filesel)
GtkWidget *confirm_area;
GtkWidget *pulldown_hbox;
GtkWidget *scrolled_win;
GtkDialog *dialog;
char *dir_title [2];
char *file_title [2];
dialog = GTK_DIALOG (filesel);
filesel->cmpl_state = cmpl_init_state ();
/* The dialog-sized vertical box */
filesel->main_vbox = gtk_vbox_new (FALSE, 10);
filesel->main_vbox = dialog->vbox;
gtk_container_set_border_width (GTK_CONTAINER (filesel), 10);
gtk_container_add (GTK_CONTAINER (filesel), filesel->main_vbox);
gtk_widget_show (filesel->main_vbox);
/* The horizontal box containing create, rename etc. buttons */
filesel->button_area = gtk_hbutton_box_new ();
......@@ -555,28 +557,23 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_widget_show (filesel->action_area);
/* The OK/Cancel button area */
confirm_area = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (confirm_area), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (confirm_area), 5);
gtk_box_pack_end (GTK_BOX (filesel->main_vbox), confirm_area, FALSE, FALSE, 0);
gtk_widget_show (confirm_area);
confirm_area = dialog->action_area;
/* The OK button */
filesel->ok_button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (filesel->ok_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (confirm_area), filesel->ok_button, TRUE, TRUE, 0);
filesel->ok_button = gtk_dialog_add_button (dialog,
GTK_STOCK_BUTTON_OK,
GTK_RESPONSE_OK);
gtk_widget_grab_default (filesel->ok_button);
gtk_widget_show (filesel->ok_button);
/* The Cancel button */
filesel->cancel_button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (filesel->cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (confirm_area), filesel->cancel_button, TRUE, TRUE, 0);
gtk_widget_show (filesel->cancel_button);
filesel->cancel_button = gtk_dialog_add_button (dialog,
GTK_STOCK_BUTTON_CANCEL,
GTK_RESPONSE_CANCEL);
/* The selection entry widget */
entry_vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_end (GTK_BOX (filesel->main_vbox), entry_vbox, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (filesel->main_vbox), entry_vbox, FALSE, FALSE, 2);
gtk_widget_show (entry_vbox);
filesel->selection_text = label = gtk_label_new ("");
......
......@@ -29,7 +29,7 @@
#include <gdk/gdk.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkdialog.h>
#ifdef __cplusplus
......@@ -50,7 +50,7 @@ typedef struct _GtkFileSelectionClass GtkFileSelectionClass;
struct _GtkFileSelection
{
GtkWindow window;
GtkDialog parent_instance;
GtkWidget *dir_list;
GtkWidget *file_list;
......@@ -79,7 +79,7 @@ struct _GtkFileSelection
struct _GtkFileSelectionClass
{
GtkWindowClass parent_class;
GtkDialogClass parent_class;
};
......
......@@ -48,6 +48,7 @@
#include "gtklabel.h"
#include "gtkrc.h"
#include "gtksignal.h"
#include "gtkstock.h"
#include "gtktable.h"
#include "gtkvbox.h"
#include "gtkscrolledwindow.h"
......@@ -900,7 +901,8 @@ gtk_font_selection_dialog_get_type (void)
(GtkClassInitFunc) NULL,
};
font_selection_dialog_type = gtk_type_unique (GTK_TYPE_WINDOW, &fontsel_diag_info);
font_selection_dialog_type = gtk_type_unique (GTK_TYPE_DIALOG,
&fontsel_diag_info);
}
return font_selection_dialog_type;
......@@ -913,12 +915,16 @@ gtk_font_selection_dialog_class_init (GtkFontSelectionDialogClass *klass)
object_class = (GtkObjectClass*) klass;
font_selection_dialog_parent_class = gtk_type_class (GTK_TYPE_WINDOW);
font_selection_dialog_parent_class = gtk_type_class (GTK_TYPE_DIALOG);
}
static void
gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
{
GtkDialog *dialog;
dialog = GTK_DIALOG (fontseldiag);
fontseldiag->dialog_width = -1;
fontseldiag->auto_resize = TRUE;
......@@ -930,9 +936,7 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
gtk_container_set_border_width (GTK_CONTAINER (fontseldiag), 4);
gtk_window_set_policy(GTK_WINDOW(fontseldiag), FALSE, TRUE, TRUE);
fontseldiag->main_vbox = gtk_vbox_new (FALSE, 4);
gtk_widget_show (fontseldiag->main_vbox);
gtk_container_add (GTK_CONTAINER (fontseldiag), fontseldiag->main_vbox);
fontseldiag->main_vbox = dialog->vbox;
fontseldiag->fontsel = gtk_font_selection_new();
gtk_container_set_border_width (GTK_CONTAINER (fontseldiag->fontsel), 4);
......@@ -941,34 +945,26 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
fontseldiag->fontsel, TRUE, TRUE, 0);
/* Create the action area */
fontseldiag->action_area = gtk_hbutton_box_new ();
gtk_button_box_set_layout(GTK_BUTTON_BOX(fontseldiag->action_area),
GTK_BUTTONBOX_END);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(fontseldiag->action_area), 5);
gtk_box_pack_start (GTK_BOX (fontseldiag->main_vbox),
fontseldiag->action_area, FALSE, FALSE, 0);
gtk_widget_show (fontseldiag->action_area);
fontseldiag->ok_button = gtk_button_new_with_label(_("OK"));
GTK_WIDGET_SET_FLAGS (fontseldiag->ok_button, GTK_CAN_DEFAULT);
gtk_widget_show(fontseldiag->ok_button);
gtk_box_pack_start (GTK_BOX (fontseldiag->action_area),
fontseldiag->ok_button, TRUE, TRUE, 0);
gtk_widget_grab_default (fontseldiag->ok_button);
fontseldiag->apply_button = gtk_button_new_with_label(_("Apply"));
GTK_WIDGET_SET_FLAGS (fontseldiag->apply_button, GTK_CAN_DEFAULT);
/*gtk_widget_show(fontseldiag->apply_button);*/
gtk_box_pack_start (GTK_BOX(fontseldiag->action_area),
fontseldiag->apply_button, TRUE, TRUE, 0);
fontseldiag->action_area = dialog->action_area;
fontseldiag->cancel_button = gtk_button_new_with_label(_("Cancel"));
GTK_WIDGET_SET_FLAGS (fontseldiag->cancel_button, GTK_CAN_DEFAULT);
gtk_widget_show(fontseldiag->cancel_button);
gtk_box_pack_start (GTK_BOX(fontseldiag->action_area),
fontseldiag->cancel_button, TRUE, TRUE, 0);
fontseldiag->ok_button = gtk_dialog_add_button (dialog,
GTK_STOCK_BUTTON_OK,
GTK_RESPONSE_OK);
gtk_widget_grab_default (fontseldiag->ok_button);
fontseldiag->apply_button = gtk_dialog_add_button (dialog,
GTK_STOCK_BUTTON_APPLY,
GTK_RESPONSE_APPLY);
gtk_widget_hide (fontseldiag->apply_button);
fontseldiag->cancel_button = gtk_dialog_add_button (dialog,
GTK_STOCK_BUTTON_CANCEL,
GTK_RESPONSE_CANCEL);
gtk_window_set_title (GTK_WINDOW (fontseldiag),
_("Font Selection"));
}
GtkWidget*
......@@ -977,8 +973,9 @@ gtk_font_selection_dialog_new (const gchar *title)
GtkFontSelectionDialog *fontseldiag;