]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkgamma.c
Add "getters" for all the non-deprecated set_foo functions. Added missing
[~andy/gtk] / gtk / gtkgamma.c
index db4b903fd2b61eff385b285e5edef16ad2898be5..700185baf319f84517cb052f8ce9d3246c5ed1f8 100644 (file)
@@ -2,19 +2,28 @@
  * Copyright (C) 1997 David Mosberger
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -33,6 +42,7 @@
 #include "gtktable.h"
 #include "gtkvbox.h"
 #include "gtkwindow.h"
+#include "gtkintl.h"
 
 static GtkVBoxClass *parent_class = NULL;
 
@@ -57,7 +67,7 @@ enum
     NUM_XPMS
   };
 
-static char *xpm[][27] =
+static const char *xpm[][27] =
   {
     /* spline: */
     {
@@ -201,26 +211,26 @@ static char *xpm[][27] =
     }
   };
 
-guint
+GtkType
 gtk_gamma_curve_get_type (void)
 {
-  static guint gamma_curve_type = 0;
-
+  static GtkType gamma_curve_type = 0;
+  
   if (!gamma_curve_type)
     {
-      GtkTypeInfo gamma_curve_info =
+      static const GtkTypeInfo gamma_curve_info =
       {
        "GtkGammaCurve",
        sizeof (GtkGammaCurve),
        sizeof (GtkGammaCurveClass),
        (GtkClassInitFunc) gtk_gamma_curve_class_init,
        (GtkObjectInitFunc) gtk_gamma_curve_init,
-       (GtkArgSetFunc) NULL,
-        (GtkArgGetFunc) NULL,
+       /* reserved_1 */ NULL,
+        /* reserved_2 */ NULL,
+        (GtkClassInitFunc) NULL,
       };
-
-      gamma_curve_type =
-       gtk_type_unique (gtk_vbox_get_type (), &gamma_curve_info);
+      
+      gamma_curve_type = gtk_type_unique (GTK_TYPE_VBOX, &gamma_curve_info);
     }
   return gamma_curve_type;
 }
@@ -230,7 +240,7 @@ gtk_gamma_curve_class_init (GtkGammaCurveClass *class)
 {
   GtkObjectClass *object_class;
 
-  parent_class = gtk_type_class (gtk_vbox_get_type ());
+  parent_class = gtk_type_class (GTK_TYPE_VBOX);
 
   object_class = (GtkObjectClass *) class;
   object_class->destroy = gtk_gamma_curve_destroy;
@@ -261,7 +271,7 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
     {
       curve->button[i] = gtk_toggle_button_new ();
       gtk_object_set_data (GTK_OBJECT (curve->button[i]), "_GtkGammaCurveIndex",
-                          (gpointer) (long) i);
+                          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);
@@ -275,7 +285,7 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
     {
       curve->button[i] = gtk_button_new ();
       gtk_object_set_data (GTK_OBJECT (curve->button[i]), "_GtkGammaCurveIndex",
-                          (gpointer) (long) i);
+                          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);
@@ -297,9 +307,9 @@ button_realize_callback (GtkWidget *w)
   GdkPixmap *pm;
   int i;
 
-  i = (long) gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex");
+  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], xpm[i]);
+                                    &w->style->bg[GTK_STATE_NORMAL], (gchar **)xpm[i]);
 
   pixmap = gtk_pixmap_new (pm, mask);
   gtk_container_add (GTK_CONTAINER (w), pixmap);
@@ -319,14 +329,14 @@ button_toggled_callback (GtkWidget *w, gpointer data)
   if (!GTK_TOGGLE_BUTTON (w)->active)
     return;
 
-  active = (long) gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex");
+  active = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex"));
 
   for (i = 0; i < 3; ++i)
     if ((i != active) && GTK_TOGGLE_BUTTON (c->button[i])->active)
       break;
 
   if (i < 3)
-    gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (c->button[i]), FALSE);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->button[i]), FALSE);
 
   switch (active)
     {
@@ -370,7 +380,7 @@ button_clicked_callback (GtkWidget *w, gpointer data)
   GtkGammaCurve *c = data;
   int active;
 
-  active = (long) gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex");
+  active = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex"));
   if (active == 3)
     {
       /* set gamma */
@@ -382,14 +392,14 @@ button_clicked_callback (GtkWidget *w, gpointer data)
          gchar buf[64];
          
          c->gamma_dialog = gtk_dialog_new ();
-         gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), "Gamma");
+         gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), _("Gamma"));
          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 (_("Gamma value"));
          gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
          gtk_widget_show (label);
          
@@ -402,7 +412,7 @@ 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");
+         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);
@@ -410,7 +420,7 @@ button_clicked_callback (GtkWidget *w, gpointer data)
          gtk_widget_grab_default (button);
          gtk_widget_show (button);
          
-         button = gtk_button_new_with_label ("Cancel");
+         button = gtk_button_new_with_label (_("Cancel"));
          gtk_signal_connect (GTK_OBJECT (button), "clicked",
                              (GtkSignalFunc) gamma_cancel_callback, c);
          gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
@@ -441,13 +451,13 @@ curve_type_changed_callback (GtkWidget *w, gpointer data)
     default:                   active = 2; break;
     }
   if (!GTK_TOGGLE_BUTTON (c->button[active])->active)
-    gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (c->button[active]), TRUE);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->button[active]), TRUE);
 }
 
 GtkWidget*
 gtk_gamma_curve_new (void)
 {
-  return gtk_type_new (gtk_gamma_curve_get_type ());
+  return gtk_type_new (GTK_TYPE_GAMMA_CURVE);
 }
 
 static void
@@ -466,3 +476,4 @@ gtk_gamma_curve_destroy (GtkObject *object)
   if (GTK_OBJECT_CLASS (parent_class)->destroy)
     (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 }
+