]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkgamma.c
Updated Slovenian translation
[~andy/gtk] / gtk / gtkgamma.c
index 2eb3c4e795149e606594cf82030abfde6fea5151..5485dede0f7a3aaefc311a852d83164d23ec8489 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#undef GTK_DISABLE_DEPRECATED
+
+#include "config.h"
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 
+#include <gdk-pixbuf/gdk-pixdata.h>
+
 #include "gtkgamma.h"
 #include "gtkcurve.h"
 #include "gtkdialog.h"
 #include "gtkdrawingarea.h"
 #include "gtkentry.h"
 #include "gtkhbox.h"
+#include "gtkimage.h"
 #include "gtklabel.h"
 #include "gtkmain.h"
-#include "gtkpixmap.h"
 #include "gtkradiobutton.h"
-#include "gtksignal.h"
+#include "gtkstock.h"
 #include "gtktable.h"
 #include "gtkvbox.h"
 #include "gtkwindow.h"
 #include "gtkintl.h"
-
-static GtkVBoxClass *parent_class = NULL;
-
+#include "gtkalias.h"
 
 /* forward declarations: */
-static void gtk_gamma_curve_class_init (GtkGammaCurveClass *class);
-static void gtk_gamma_curve_init (GtkGammaCurve *curve);
 static void gtk_gamma_curve_destroy (GtkObject *object);
 
 static void curve_type_changed_callback (GtkWidget *w, gpointer data);
@@ -67,181 +68,185 @@ enum
     NUM_XPMS
   };
 
-static const char *xpm[][27] =
-  {
-    /* spline: */
-    {
-      /* width height ncolors chars_per_pixel */
-      "16 16 4 1",
-      /* colors */
-      ". c None",
-      "B c #000000",
-      "+ c #BC2D2D",
-      "r c #FF0000",
-      /* pixels */
-      "..............BB",
-      ".........rrrrrrB",
-      ".......rr.......",
-      ".....B+.........",
-      "....BBB.........",
-      "....+B..........",
-      "....r...........",
-      "...r............",
-      "...r............",
-      "..r.............",
-      "..r.............",
-      ".r..............",
-      ".r..............",
-      ".r..............",
-      "B+..............",
-      "BB.............."
-    },
-    /* linear: */
-    {
-      /* width height ncolors chars_per_pixel */
-      "16 16 5 1",
-      /* colors */
-      ". c None", /* transparent */
-      "B c #000000",
-      "' c #7F7F7F",
-      "+ c #824141",
-      "r c #FF0000",
-      /* pixels */
-      "..............BB",
-      "..............+B",
-      "..............r.",
-      ".............r..",
-      ".............r..",
-      "....'B'.....r...",
-      "....BBB.....r...",
-      "....+B+....r....",
-      "....r.r....r....",
-      "...r...r..r.....",
-      "...r...r..r.....",
-      "..r.....rB+.....",
-      "..r.....BBB.....",
-      ".r......'B'.....",
-      "B+..............",
-      "BB.............."
-    },
-    /* free: */
-    {
-      /* width height ncolors chars_per_pixel */
-      "16 16 2 1",
-      /* colors */
-      ". c None",
-      "r c #FF0000",
-      /* pixels */
-      "................",
-      "................",
-      "......r.........",
-      "......r.........",
-      ".......r........",
-      ".......r........",
-      ".......r........",
-      "........r.......",
-      "........r.......",
-      "........r.......",
-      ".....r...r.rrrrr",
-      "....r....r......",
-      "...r.....r......",
-      "..r.......r.....",
-      ".r........r.....",
-      "r..............."
-    },
-    /* gamma: */
-    {
-      /* width height ncolors chars_per_pixel */
-      "16 16 10 1",
-      /* colors */
-      ". c None",
-      "B c #000000",
-      "& c #171717",
-      "# c #2F2F2F",
-      "X c #464646",
-      "= c #5E5E5E",
-      "/ c #757575",
-      "+ c #8C8C8C",
-      "- c #A4A4A4",
-      "` c #BBBBBB",
-      /* pixels */
-      "................",
-      "................",
-      "................",
-      "....B=..+B+.....",
-      "....X&`./&-.....",
-      "...../+.XX......",
-      "......B.B+......",
-      "......X.X.......",
-      "......X&+.......",
-      "......-B........",
-      "....../=........",
-      "......#B........",
-      "......BB........",
-      "......B#........",
-      "................",
-      "................"
-    },
-    /* reset: */
-    {
-      /* width height ncolors chars_per_pixel */
-      "16 16 4 1",
-      /* colors */
-      ". c None",
-      "B c #000000",
-      "+ c #824141",
-      "r c #FF0000",
-      /* pixels */
-      "..............BB",
-      "..............+B",
-      ".............r..",
-      "............r...",
-      "...........r....",
-      "..........r.....",
-      ".........r......",
-      "........r.......",
-      ".......r........",
-      "......r.........",
-      ".....r..........",
-      "....r...........",
-      "...r............",
-      "..r.............",
-      "B+..............",
-      "BB.............."
-    }
-  };
-
-GtkType
-gtk_gamma_curve_get_type (void)
-{
-  static GtkType gamma_curve_type = 0;
-  
-  if (!gamma_curve_type)
-    {
-      static const GtkTypeInfo gamma_curve_info =
-      {
-       "GtkGammaCurve",
-       sizeof (GtkGammaCurve),
-       sizeof (GtkGammaCurveClass),
-       (GtkClassInitFunc) gtk_gamma_curve_class_init,
-       (GtkObjectInitFunc) gtk_gamma_curve_init,
-       /* reserved_1 */ NULL,
-        /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
-      };
-      
-      gamma_curve_type = gtk_type_unique (GTK_TYPE_VBOX, &gamma_curve_info);
-    }
-  return gamma_curve_type;
-}
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+#ifdef __SUNPRO_C
+#pragma align 4 (spline_pixdata)
+#endif
+#ifdef __GNUC__
+static const guint8 spline_pixdata[] __attribute__ ((__aligned__ (4))) = 
+#else
+static const guint8 spline_pixdata[] = 
+#endif
+{ ""
+  /* Pixbuf magic (0x47646b50) */
+  "GdkP"
+  /* length: header (24) + pixel_data (182) */
+  "\0\0\0\316"
+  /* pixdata_type (0x2010002) */
+  "\2\1\0\2"
+  /* rowstride (64) */
+  "\0\0\0@"
+  /* width (16) */
+  "\0\0\0\20"
+  /* height (16) */
+  "\0\0\0\20"
+  /* pixel_data: */
+  "\216\0\0\0\0\202\0\0\0\377\211\0\0\0\0\206\377\0\0\377\1\0\0\0\377\207"
+  "\0\0\0\0\202\377\0\0\377\214\0\0\0\0\2\0\0\0\377\274--\377\215\0\0\0"
+  "\0\203\0\0\0\377\215\0\0\0\0\2\274--\377\0\0\0\377\216\0\0\0\0\1\377"
+  "\0\0\377\216\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\216\0\0"
+  "\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377"
+  "\217\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\216\0\0\0\0\2\0"
+  "\0\0\377\274--\377\216\0\0\0\0\202\0\0\0\377\216\0\0\0\0"};
+
+
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+#ifdef __SUNPRO_C
+#pragma align 4 (linear_pixdata)
+#endif
+#ifdef __GNUC__
+static const guint8 linear_pixdata[] __attribute__ ((__aligned__ (4))) = 
+#else
+static const guint8 linear_pixdata[] = 
+#endif
+{ ""
+  /* Pixbuf magic (0x47646b50) */
+  "GdkP"
+  /* length: header (24) + pixel_data (323) */
+  "\0\0\1["
+  /* pixdata_type (0x2010002) */
+  "\2\1\0\2"
+  /* rowstride (64) */
+  "\0\0\0@"
+  /* width (16) */
+  "\0\0\0\20"
+  /* height (16) */
+  "\0\0\0\20"
+  /* pixel_data: */
+  "\216\0\0\0\0\202\0\0\0\377\216\0\0\0\0\2\202AA\377\0\0\0\377\216\0\0"
+  "\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377"
+  "\206\0\0\0\0\3\177\177\177\377\0\0\0\377\177\177\177\377\205\0\0\0\0"
+  "\1\377\0\0\377\207\0\0\0\0\203\0\0\0\377\205\0\0\0\0\1\377\0\0\377\207"
+  "\0\0\0\0\3\202AA\377\0\0\0\377\202AA\377\204\0\0\0\0\1\377\0\0\377\210"
+  "\0\0\0\0\3\377\0\0\377\0\0\0\0\377\0\0\377\204\0\0\0\0\1\377\0\0\377"
+  "\207\0\0\0\0\1\377\0\0\377\203\0\0\0\0\1\377\0\0\377\202\0\0\0\0\1\377"
+  "\0\0\377\210\0\0\0\0\1\377\0\0\377\203\0\0\0\0\1\377\0\0\377\202\0\0"
+  "\0\0\1\377\0\0\377\207\0\0\0\0\1\377\0\0\377\205\0\0\0\0\3\377\0\0\377"
+  "\0\0\0\377\202AA\377\207\0\0\0\0\1\377\0\0\377\205\0\0\0\0\203\0\0\0"
+  "\377\206\0\0\0\0\1\377\0\0\377\206\0\0\0\0\3\177\177\177\377\0\0\0\377"
+  "\177\177\177\377\205\0\0\0\0\2\0\0\0\377\202AA\377\216\0\0\0\0\202\0"
+  "\0\0\377\216\0\0\0\0"};
+
+
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+#ifdef __SUNPRO_C
+#pragma align 4 (free_pixdata)
+#endif
+#ifdef __GNUC__
+static const guint8 free_pixdata[] __attribute__ ((__aligned__ (4))) = 
+#else
+static const guint8 free_pixdata[] = 
+#endif
+{ ""
+  /* Pixbuf magic (0x47646b50) */
+  "GdkP"
+  /* length: header (24) + pixel_data (204) */
+  "\0\0\0\344"
+  /* pixdata_type (0x2010002) */
+  "\2\1\0\2"
+  /* rowstride (64) */
+  "\0\0\0@"
+  /* width (16) */
+  "\0\0\0\20"
+  /* height (16) */
+  "\0\0\0\20"
+  /* pixel_data: */
+  "\246\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\220\0\0\0\0\1\377"
+  "\0\0\377\217\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\220\0\0"
+  "\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377"
+  "\214\0\0\0\0\1\377\0\0\377\203\0\0\0\0\2\377\0\0\377\0\0\0\0\205\377"
+  "\0\0\377\204\0\0\0\0\1\377\0\0\377\204\0\0\0\0\1\377\0\0\377\211\0\0"
+  "\0\0\1\377\0\0\377\205\0\0\0\0\1\377\0\0\377\210\0\0\0\0\1\377\0\0\377"
+  "\207\0\0\0\0\1\377\0\0\377\206\0\0\0\0\1\377\0\0\377\210\0\0\0\0\1\377"
+  "\0\0\377\205\0\0\0\0\1\377\0\0\377\217\0\0\0\0"};
+
+
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+#ifdef __SUNPRO_C
+#pragma align 4 (gamma_pixdata)
+#endif
+#ifdef __GNUC__
+static const guint8 gamma_pixdata[] __attribute__ ((__aligned__ (4))) = 
+#else
+static const guint8 gamma_pixdata[] = 
+#endif
+{ ""
+  /* Pixbuf magic (0x47646b50) */
+  "GdkP"
+  /* length: header (24) + pixel_data (218) */
+  "\0\0\0\362"
+  /* pixdata_type (0x2010002) */
+  "\2\1\0\2"
+  /* rowstride (64) */
+  "\0\0\0@"
+  /* width (16) */
+  "\0\0\0\20"
+  /* height (16) */
+  "\0\0\0\20"
+  /* pixel_data: */
+  "\264\0\0\0\0\2\0\0\0\377^^^\377\202\0\0\0\0\3\214\214\214\377\0\0\0\377"
+  "\214\214\214\377\211\0\0\0\0\7FFF\377\27\27\27\377\273\273\273\377\0"
+  "\0\0\0uuu\377\27\27\27\377\244\244\244\377\212\0\0\0\0\3uuu\377\214\214"
+  "\214\377\0\0\0\0\202FFF\377\214\0\0\0\0\4\0\0\0\377\0\0\0\0\0\0\0\377"
+  "\214\214\214\377\214\0\0\0\0\3FFF\377\0\0\0\0FFF\377\215\0\0\0\0\3FF"
+  "F\377\27\27\27\377\214\214\214\377\215\0\0\0\0\2\244\244\244\377\0\0"
+  "\0\377\216\0\0\0\0\2uuu\377^^^\377\216\0\0\0\0\2///\377\0\0\0\377\216"
+  "\0\0\0\0\202\0\0\0\377\216\0\0\0\0\2\0\0\0\377///\377\250\0\0\0\0"};
+
+
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+#ifdef __SUNPRO_C
+#pragma align 4 (reset_pixdata)
+#endif
+#ifdef __GNUC__
+static const guint8 reset_pixdata[] __attribute__ ((__aligned__ (4))) = 
+#else
+static const guint8 reset_pixdata[] = 
+#endif
+{ ""
+  /* Pixbuf magic (0x47646b50) */
+  "GdkP"
+  /* length: header (24) + pixel_data (173) */
+  "\0\0\0\305"
+  /* pixdata_type (0x2010002) */
+  "\2\1\0\2"
+  /* rowstride (64) */
+  "\0\0\0@"
+  /* width (16) */
+  "\0\0\0\20"
+  /* height (16) */
+  "\0\0\0\20"
+  /* pixel_data: */
+  "\216\0\0\0\0\202\0\0\0\377\216\0\0\0\0\2\202AA\377\0\0\0\377\215\0\0"
+  "\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377"
+  "\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377"
+  "\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0"
+  "\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377"
+  "\216\0\0\0\0\1\377\0\0\377\215\0\0\0\0\2\0\0\0\377\202AA\377\216\0\0"
+  "\0\0\202\0\0\0\377\216\0\0\0\0"};
+
+G_DEFINE_TYPE (GtkGammaCurve, gtk_gamma_curve, GTK_TYPE_VBOX)
 
 static void
 gtk_gamma_curve_class_init (GtkGammaCurveClass *class)
 {
   GtkObjectClass *object_class;
 
-  parent_class = gtk_type_class (GTK_TYPE_VBOX);
-
   object_class = (GtkObjectClass *) class;
   object_class->destroy = gtk_gamma_curve_destroy;
 }
@@ -259,8 +264,8 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
   gtk_container_add (GTK_CONTAINER (curve), curve->table);
 
   curve->curve = gtk_curve_new ();
-  gtk_signal_connect (GTK_OBJECT (curve->curve), "curve_type_changed",
-                     (GtkSignalFunc) curve_type_changed_callback, curve);
+  g_signal_connect (curve->curve, "curve-type-changed",
+                   G_CALLBACK (curve_type_changed_callback), curve);
   gtk_table_attach_defaults (GTK_TABLE (curve->table), curve->curve, 0, 1, 0, 1);
 
   vbox = gtk_vbox_new (/* homogeneous */ FALSE, /* spacing */ 3);
@@ -270,13 +275,13 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
   for (i = 0; i < 3; ++i)
     {
       curve->button[i] = gtk_toggle_button_new ();
-      gtk_object_set_data (GTK_OBJECT (curve->button[i]), "_GtkGammaCurveIndex",
-                          GINT_TO_POINTER (i));
+      g_object_set_data (G_OBJECT (curve->button[i]), I_("_GtkGammaCurveIndex"),
+                        GINT_TO_POINTER (i));
       gtk_container_add (GTK_CONTAINER (vbox), curve->button[i]);
-      gtk_signal_connect (GTK_OBJECT (curve->button[i]), "realize",
-                         (GtkSignalFunc) button_realize_callback, 0);
-      gtk_signal_connect (GTK_OBJECT (curve->button[i]), "toggled",
-                         (GtkSignalFunc) button_toggled_callback, curve);
+      g_signal_connect (curve->button[i], "realize",
+                       G_CALLBACK (button_realize_callback), NULL);
+      g_signal_connect (curve->button[i], "toggled",
+                       G_CALLBACK (button_toggled_callback), curve);
       gtk_widget_show (curve->button[i]);
     }
 
@@ -284,13 +289,13 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
   for (i = 3; i < 5; ++i)
     {
       curve->button[i] = gtk_button_new ();
-      gtk_object_set_data (GTK_OBJECT (curve->button[i]), "_GtkGammaCurveIndex",
-                          GINT_TO_POINTER (i));
+      g_object_set_data (G_OBJECT (curve->button[i]), I_("_GtkGammaCurveIndex"),
+                        GINT_TO_POINTER (i));
       gtk_container_add (GTK_CONTAINER (vbox), curve->button[i]);
-      gtk_signal_connect (GTK_OBJECT (curve->button[i]), "realize",
-                         (GtkSignalFunc) button_realize_callback, 0);
-      gtk_signal_connect (GTK_OBJECT (curve->button[i]), "clicked",
-                         (GtkSignalFunc) button_clicked_callback, curve);
+      g_signal_connect (curve->button[i], "realize",
+                       G_CALLBACK (button_realize_callback), NULL);
+      g_signal_connect (curve->button[i], "clicked",
+                       G_CALLBACK (button_clicked_callback), curve);
       gtk_widget_show (curve->button[i]);
     }
 
@@ -302,21 +307,29 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
 static void
 button_realize_callback (GtkWidget *w)
 {
-  GtkWidget *pixmap;
-  GdkBitmap *mask;
-  GdkPixmap *pm;
+  GtkWidget *image;
+  struct {
+    const guint8 *stream;
+    gint length;
+  } streams[5] = {
+    { linear_pixdata, sizeof (linear_pixdata) },
+    { spline_pixdata, sizeof (spline_pixdata) },
+    { free_pixdata, sizeof (free_pixdata) },
+    { gamma_pixdata, sizeof (gamma_pixdata) },
+    { reset_pixdata, sizeof (reset_pixdata) }
+  };
+  GdkPixdata pixdata;
+  GdkPixbuf *pixbuf;
   int i;
 
-  i = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex"));
-  pm = gdk_pixmap_create_from_xpm_d (w->window, &mask,
-                                    &w->style->bg[GTK_STATE_NORMAL], (gchar **)xpm[i]);
+  i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "_GtkGammaCurveIndex"));
+  gdk_pixdata_deserialize (&pixdata, streams[i].length, streams[i].stream, NULL);
+  pixbuf = gdk_pixbuf_from_pixdata (&pixdata, TRUE, NULL);
+  image = gtk_image_new_from_pixbuf (pixbuf);
+  gtk_container_add (GTK_CONTAINER (w), image);
+  gtk_widget_show (image);
 
-  pixmap = gtk_pixmap_new (pm, mask);
-  gtk_container_add (GTK_CONTAINER (w), pixmap);
-  gtk_widget_show (pixmap);
-
-  gdk_pixmap_unref (pm);
-  gdk_bitmap_unref (mask);   /* a bitmap is really just a special pixmap */
+  g_object_unref (pixbuf);
 }
 
 static void
@@ -329,7 +342,7 @@ button_toggled_callback (GtkWidget *w, gpointer data)
   if (!GTK_TOGGLE_BUTTON (w)->active)
     return;
 
-  active = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex"));
+  active = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "_GtkGammaCurveIndex"));
 
   for (i = 0; i < 3; ++i)
     if ((i != active) && GTK_TOGGLE_BUTTON (c->button[i])->active)
@@ -353,7 +366,6 @@ gamma_cancel_callback (GtkWidget *w, gpointer data)
   GtkGammaCurve *c = data;
 
   gtk_widget_destroy (c->gamma_dialog);
-  c->gamma_dialog = 0;
 }
 
 static void
@@ -367,7 +379,7 @@ gamma_ok_callback (GtkWidget *w, gpointer data)
   start = gtk_entry_get_text (GTK_ENTRY (c->gamma_text));
   if (start)
     {
-      v = strtod (start, &end);
+      v = g_strtod (start, &end);
       if (end > start && v > 0.0)
        c->gamma = v;
     }
@@ -381,7 +393,7 @@ button_clicked_callback (GtkWidget *w, gpointer data)
   GtkGammaCurve *c = data;
   int active;
 
-  active = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex"));
+  active = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "_GtkGammaCurveIndex"));
   if (active == 3)
     {
       /* set gamma */
@@ -393,14 +405,19 @@ button_clicked_callback (GtkWidget *w, gpointer data)
          gchar buf[64];
          
          c->gamma_dialog = gtk_dialog_new ();
+         gtk_window_set_screen (GTK_WINDOW (c->gamma_dialog),
+                                gtk_widget_get_screen (w));
          gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), _("Gamma"));
+         g_object_add_weak_pointer (G_OBJECT (c->gamma_dialog),
+                                    (gpointer *)&c->gamma_dialog);
+         
          vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
          
          hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
          gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2);
          gtk_widget_show (hbox);
          
-         label = gtk_label_new (_("_Gamma value"));
+         label = gtk_label_new_with_mnemonic (_("_Gamma value"));
          gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
          gtk_widget_show (label);
          
@@ -413,19 +430,19 @@ button_clicked_callback (GtkWidget *w, gpointer data)
          
          /* fill in action area: */
          hbox = GTK_DIALOG (c->gamma_dialog)->action_area;
-         
-         button = gtk_button_new_with_label (_("OK"));
-         GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
-         gtk_signal_connect (GTK_OBJECT (button), "clicked",
-                             (GtkSignalFunc) gamma_ok_callback, c);
+
+          button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+         g_signal_connect (button, "clicked",
+                           G_CALLBACK (gamma_cancel_callback), c);
          gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-         gtk_widget_grab_default (button);
          gtk_widget_show (button);
          
-         button = gtk_button_new_with_label (_("Cancel"));
-         gtk_signal_connect (GTK_OBJECT (button), "clicked",
-                             (GtkSignalFunc) gamma_cancel_callback, c);
+          button = gtk_button_new_from_stock (GTK_STOCK_OK);
+         GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+         g_signal_connect (button, "clicked",
+                           G_CALLBACK (gamma_ok_callback), c);
          gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+         gtk_widget_grab_default (button);
          gtk_widget_show (button);
          
          gtk_widget_show (c->gamma_dialog);
@@ -459,22 +476,19 @@ curve_type_changed_callback (GtkWidget *w, gpointer data)
 GtkWidget*
 gtk_gamma_curve_new (void)
 {
-  return gtk_type_new (GTK_TYPE_GAMMA_CURVE);
+  return g_object_new (GTK_TYPE_GAMMA_CURVE, NULL);
 }
 
 static void
 gtk_gamma_curve_destroy (GtkObject *object)
 {
-  GtkGammaCurve *c;
-
-  g_return_if_fail (GTK_IS_GAMMA_CURVE (object));
-
-  c = GTK_GAMMA_CURVE (object);
+  GtkGammaCurve *c = GTK_GAMMA_CURVE (object);
 
   if (c->gamma_dialog)
     gtk_widget_destroy (c->gamma_dialog);
 
-  if (GTK_OBJECT_CLASS (parent_class)->destroy)
-    (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+  GTK_OBJECT_CLASS (gtk_gamma_curve_parent_class)->destroy (object);
 }
 
+#define __GTK_GAMMA_CURVE_C__
+#include "gtkaliasdef.c"