small dialog changes



Hi,

This patch basically makes the selection dialogs (color/font/file) use
stock buttons and derive from GtkDialog where they didn't. 

In doing this an issue with the dialog API came up; there is no way to
let people distinguish the Help or Apply button in prebuilt dialogs,
since GTK only has GTK_RESPONSE_ACCEPT and GTK_RESPONSE_REJECT built
in. So after talking to Owen the patch adds GTK_RESPONSE_*
corresponding to the stock buttons we ship with GTK. Of course users
can still make up their own response IDs as well.

See ChangeLog for specifics. I'll commit soon.

Havoc

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1474
diff -u -u -r1.1474 ChangeLog
--- ChangeLog	2000/11/02 17:18:50	1.1474
+++ ChangeLog	2000/11/03 00:55:11
@@ -1,5 +1,39 @@
 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.
+	
+2000-11-02  Havoc Pennington  <hp redhat com>
+
 	* gtk/testgtk.c (create_labels): had a test backward
 
 	* gdk/x11/gdkgc-x11.c (gdk_gc_copy): Copy the client-side GC
Index: gtk/gtkcolorseldialog.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcolorseldialog.c,v
retrieving revision 1.5
diff -u -u -r1.5 gtkcolorseldialog.c
--- gtk/gtkcolorseldialog.c	2000/07/26 11:32:43	1.5
+++ gtk/gtkcolorseldialog.c	2000/11/03 00:55:11
@@ -28,6 +28,7 @@
 #include "gtkframe.h"
 #include "gtkhbbox.h"
 #include "gtkbutton.h"
+#include "gtkstock.h"
 #include "gtkintl.h"
 
 
@@ -79,11 +80,8 @@
 static void
 gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
 {
-  GtkWidget *action_area_button_box, *frame;
+  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 ());
-  
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
   gtk_container_add (GTK_CONTAINER (GTK_DIALOG (colorseldiag)->vbox), frame);
@@ -96,29 +94,21 @@
   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);
   
-  gtk_widget_pop_colormap ();
+  colorseldiag->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
+                                                       GTK_STOCK_BUTTON_CANCEL,
+                                                       GTK_RESPONSE_CANCEL);
+  
+  colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
+                                                     GTK_STOCK_HELP,
+                                                     GTK_RESPONSE_HELP);
 }
 
 GtkWidget*
Index: gtk/gtkdialog.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkdialog.c,v
retrieving revision 1.12
diff -u -u -r1.12 gtkdialog.c
--- gtk/gtkdialog.c	2000/10/20 23:14:40	1.12
+++ gtk/gtkdialog.c	2000/11/03 00:55:11
@@ -129,9 +129,11 @@
   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 @@
                                  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_STOCK_BUTTON_OK,
  *                                                   GTK_RESPONSE_ACCEPT,
  *                                                   GTK_STOCK_BUTTON_CANCEL,
- *                                                   GTK_RESPONSE_NONE,
+ *                                                   GTK_RESPONSE_REJECT,
  *                                                   NULL);
  * </programlisting>
  * 
@@ -373,10 +375,12 @@
  * 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 @@
   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 @@
 }
 
 static void
-run_destroy_handler (GtkDialog *dialog, gpointer data)
+run_unmap_handler (GtkDialog *dialog, gpointer data)
 {
   RunInfo *ri = data;
 
@@ -542,7 +550,7 @@
  * 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 @@
   
   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 =
Index: gtk/gtkdialog.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkdialog.h,v
retrieving revision 1.9
diff -u -u -r1.9 gtkdialog.h
--- gtk/gtkdialog.h	2000/10/20 23:14:40	1.9
+++ gtk/gtkdialog.h	2000/11/03 00:55:11
@@ -46,23 +46,39 @@
 
 /* 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 @@
                                         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,
Index: gtk/gtkfilesel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesel.c,v
retrieving revision 1.67
diff -u -u -r1.67 gtkfilesel.c
--- gtk/gtkfilesel.c	2000/08/12 15:02:17	1.67
+++ gtk/gtkfilesel.c	2000/11/03 00:55:11
@@ -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 @@
         (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 @@
 
   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 @@
   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_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 ("");
Index: gtk/gtkfilesel.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesel.h,v
retrieving revision 1.11
diff -u -u -r1.11 gtkfilesel.h
--- gtk/gtkfilesel.h	2000/08/30 00:33:37	1.11
+++ gtk/gtkfilesel.h	2000/11/03 00:55:11
@@ -29,7 +29,7 @@
 
 
 #include <gdk/gdk.h>
-#include <gtk/gtkwindow.h>
+#include <gtk/gtkdialog.h>
 
 
 #ifdef __cplusplus
@@ -50,7 +50,7 @@
 
 struct _GtkFileSelection
 {
-  GtkWindow window;
+  GtkDialog parent_instance;
 
   GtkWidget *dir_list;
   GtkWidget *file_list;
@@ -79,7 +79,7 @@
 
 struct _GtkFileSelectionClass
 {
-  GtkWindowClass parent_class;
+  GtkDialogClass parent_class;
 };
 
 
Index: gtk/gtkfontsel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfontsel.c,v
retrieving revision 1.42
diff -u -u -r1.42 gtkfontsel.c
--- gtk/gtkfontsel.c	2000/07/26 11:32:43	1.42
+++ gtk/gtkfontsel.c	2000/11/03 00:55:11
@@ -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 @@
         (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 @@
   
   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_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 @@
 		      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->action_area = dialog->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);
+  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_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->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->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 @@
   GtkFontSelectionDialog *fontseldiag;
   
   fontseldiag = gtk_type_new (GTK_TYPE_FONT_SELECTION_DIALOG);
-  gtk_window_set_title (GTK_WINDOW (fontseldiag),
-			title ? title : _("Font Selection"));
+
+  if (title)
+    gtk_window_set_title (GTK_WINDOW (fontseldiag), title);
   
   return GTK_WIDGET (fontseldiag);
 }
Index: gtk/gtkfontsel.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfontsel.h,v
retrieving revision 1.12
diff -u -u -r1.12 gtkfontsel.h
--- gtk/gtkfontsel.h	2000/08/30 00:33:37	1.12
+++ gtk/gtkfontsel.h	2000/11/03 00:55:11
@@ -33,10 +33,9 @@
 
 
 #include <gdk/gdk.h>
-#include <gtk/gtkwindow.h>
+#include <gtk/gtkdialog.h>
 #include <gtk/gtkvbox.h>
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -93,7 +92,7 @@
 
 struct _GtkFontSelectionDialog
 {
-  GtkWindow window;
+  GtkDialog parent_instance;
   
   GtkWidget *fontsel;
   
@@ -111,7 +110,7 @@
 
 struct _GtkFontSelectionDialogClass
 {
-  GtkWindowClass parent_class;
+  GtkDialogClass parent_class;
 };
 
 
Index: gtk/gtkmessagedialog.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmessagedialog.c,v
retrieving revision 1.2
diff -u -u -r1.2 gtkmessagedialog.c
--- gtk/gtkmessagedialog.c	2000/10/20 23:14:40	1.2
+++ gtk/gtkmessagedialog.c	2000/11/03 00:55:11
@@ -150,11 +150,9 @@
  * 
  * Creates a new message dialog, which is a simple dialog with an icon
  * indicating the dialog type (error, warning, etc.) and some text the
- * user may want to see. If the button set you select with the @buttons
- * argument has positive buttons (OK, Yes) they will result in a response ID
- * of GTK_RESPONSE_ACCEPT. If it has negative buttons (Cancel, No) they will
- * result in a response ID of GTK_RESPONSE_REJECT. See #GtkDialog for more
- * details.
+ * user may want to see. When the user clicks a button a "response"
+ * signal is emitted with response IDs from #GtkResponseType. See
+ * #GtkDialog for more details.
  * 
  * Return value: a new #GtkMessageDialog
  **/
@@ -209,37 +207,37 @@
     case GTK_BUTTONS_OK:
       gtk_dialog_add_button (dialog,
                              GTK_STOCK_BUTTON_OK,
-                             GTK_RESPONSE_ACCEPT);
+                             GTK_RESPONSE_OK);
       break;
 
     case GTK_BUTTONS_CLOSE:
       gtk_dialog_add_button (dialog,
                              GTK_STOCK_BUTTON_CLOSE,
-                             GTK_RESPONSE_ACCEPT);
+                             GTK_RESPONSE_CLOSE);
       break;
 
     case GTK_BUTTONS_CANCEL:
       gtk_dialog_add_button (dialog,
                              GTK_STOCK_BUTTON_CANCEL,
-                             GTK_RESPONSE_REJECT);
+                             GTK_RESPONSE_CANCEL);
       break;
 
     case GTK_BUTTONS_YES_NO:
       gtk_dialog_add_button (dialog,
                              GTK_STOCK_BUTTON_YES,
-                             GTK_RESPONSE_ACCEPT);
+                             GTK_RESPONSE_YES);
       gtk_dialog_add_button (dialog,
                              GTK_STOCK_BUTTON_NO,
-                             GTK_RESPONSE_REJECT);
+                             GTK_RESPONSE_NO);
       break;
 
     case GTK_BUTTONS_OK_CANCEL:
       gtk_dialog_add_button (dialog,
                              GTK_STOCK_BUTTON_OK,
-                             GTK_RESPONSE_ACCEPT);
+                             GTK_RESPONSE_OK);
       gtk_dialog_add_button (dialog,
                              GTK_STOCK_BUTTON_CANCEL,
-                             GTK_RESPONSE_REJECT);
+                             GTK_RESPONSE_CANCEL);
       break;
       
     default:





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]