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
This commit is contained in:
committed by
Havoc Pennington
parent
8aef169f86
commit
69f42512fa
@ -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->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
|
||||
GTK_STOCK_BUTTON_CANCEL,
|
||||
GTK_RESPONSE_CANCEL);
|
||||
|
||||
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);
|
||||
|
||||
gtk_widget_pop_colormap ();
|
||||
colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
|
||||
GTK_STOCK_HELP,
|
||||
GTK_RESPONSE_HELP);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
|
||||
Reference in New Issue
Block a user