[gok] Remove deprecated GTK+ symbols - bgo#572686
- From: Gerd Kohlberger <gerdk src gnome org>
- To: svn-commits-list gnome org
- Subject: [gok] Remove deprecated GTK+ symbols - bgo#572686
- Date: Sun, 26 Apr 2009 13:33:58 -0400 (EDT)
commit 3fcf5d3110710bb3b71e34693e2a70cf59b2b7fd
Author: Gerd Kohlberger <gerdk src gnome org>
Date: Sun Apr 26 19:21:21 2009 +0200
Remove deprecated GTK+ symbols - bgo#572686
- gtk_type_unique
- GtkType
- GtkTypeInfo
- GtkObjectInitFunc
- GtkClassInitFunc
---
gok/gok-button.c | 58 ++++++++++-------------------------------------------
gok/gok-button.h | 36 ++++++++++++++------------------
2 files changed, 27 insertions(+), 67 deletions(-)
diff --git a/gok/gok-button.c b/gok/gok-button.c
index 1f5f081..3bf7416 100644
--- a/gok/gok-button.c
+++ b/gok/gok-button.c
@@ -1,7 +1,7 @@
/* gok-button.c
*
-* Copyright 2002 Sun Microsystems, Inc.,
-* Copyright 2001 University Of Toronto
+* Copyright 2002-2009 Sun Microsystems, Inc.,
+* Copyright 2001-2009 University Of Toronto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -19,56 +19,20 @@
* Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include "gok-button.h"
+
#include "gok-keyboard.h"
#include "gok-log.h"
#include "gok-data.h"
#include "gok-scanner.h"
#include "main.h"
-#include <stdio.h>
-#include <gnome.h>
-
-static void gok_button_class_init (GokButtonClass *klass);
-static void gok_button_init (GokButton *gok_button);
-static gboolean gok_button_expose (GtkWidget *widget, GdkEventExpose *expose);
-GokKey* gok_button_find_key (GtkWidget* pWidget);
-static GtkToggleButtonClass *parent_class = NULL;
+static gboolean gok_button_expose (GtkWidget *widget, GdkEventExpose *expose);
+static GokKey * gok_button_find_key (GtkWidget *pWidget);
/* TODO: make image/text relationship (i.e. image on left, label on right) configurable */
-/**
-* gok_button_get_type
-*
-* returns: the gok button type
-**/
-GtkType
-gok_button_get_type ()
-{
- static GtkType GokButtonType = 0;
- if (!GokButtonType)
- {
- static const GtkTypeInfo GokButtonInfo =
- {
- "GokButton",
- sizeof (GokButton),
- sizeof (GokButtonClass),
- (GtkClassInitFunc) gok_button_class_init,
- (GtkObjectInitFunc) gok_button_init,
- NULL,
- NULL,
- (GtkClassInitFunc) NULL,
- };
-
- GokButtonType = gtk_type_unique (GTK_TYPE_TOGGLE_BUTTON, &GokButtonInfo);
- }
-
- return GokButtonType;
-}
+G_DEFINE_TYPE (GokButton, gok_button, GTK_TYPE_TOGGLE_BUTTON)
/**
* gok_button_class_init
@@ -78,9 +42,8 @@ gok_button_get_type ()
static void
gok_button_class_init (GokButtonClass *klass)
{
- GtkWidgetClass *widget_class;
- widget_class = (GtkWidgetClass*) klass;
- parent_class = g_type_class_peek_parent (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
widget_class->expose_event = gok_button_expose;
}
@@ -289,7 +252,8 @@ void gok_button_state_changed (GtkWidget *widget, GtkStateType state, gpointer u
*
* Returns: A pointer to the key that holds the widget, NULL if not found.
**/
-GokKey* gok_button_find_key (GtkWidget* pWidget)
+static GokKey *
+gok_button_find_key (GtkWidget* pWidget)
{
GokKeyboard* pKeyboard;
GokKey* pKey;
@@ -315,7 +279,7 @@ gok_button_expose (GtkWidget *widget,
GdkEventExpose *event)
{
gboolean retval =
- (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
+ (* GTK_WIDGET_CLASS (gok_button_parent_class)->expose_event) (widget, event);
if (GTK_WIDGET_DRAWABLE (widget) && GOK_BUTTON (widget)->pImage) {
if (GOK_BUTTON (widget)->indicator_type != NULL) {
diff --git a/gok/gok-button.h b/gok/gok-button.h
index 55c1f8f..94df7e1 100644
--- a/gok/gok-button.h
+++ b/gok/gok-button.h
@@ -1,7 +1,7 @@
/* gok-button.h
*
-* Copyright 2001,2002 Sun Microsystems, Inc.,
-* Copyright 2001,2002 University Of Toronto
+* Copyright 2001-2009 Sun Microsystems, Inc.,
+* Copyright 2001-2009 University Of Toronto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,25 +23,24 @@
#define __GOKBUTTON_H__
#include <gtk/gtk.h>
-#include <gdk/gdk.h>
+
#include "gok-key.h"
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
-#define GOK_TYPE_BUTTON (gok_button_get_type ())
-#define GOK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOK_TYPE_BUTTON, GokButton))
-#define GOK_BUTTON_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GOK_TYPE_BUTTON, GokButtonClass)
-#define GOK_IS_BUTTON(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GOK_TYPE_BUTTON)
-#define GOK_IS_BUTTON_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE (klass, GOK_TYPE_BUTTON)
+#define GOK_TYPE_BUTTON (gok_button_get_type ())
+#define GOK_BUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOK_TYPE_BUTTON, GokButton))
+#define GOK_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST (k, GOK_TYPE_BUTTON, GokButtonClass)
+#define GOK_IS_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE (o, GOK_TYPE_BUTTON))
+#define GOK_IS_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE (k, GOK_TYPE_BUTTON))
-typedef struct _GokButton GokButton;
-typedef struct _GokButtonClass GokButtonClass;
+typedef struct _GokButton GokButton;
+typedef struct _GokButtonClass GokButtonClass;
struct _GokButton
{
- GtkToggleButton button;
+ GtkToggleButton parent;
+
GtkWidget* pBox;
GtkWidget* pLabel;
GtkWidget* pImage;
@@ -50,10 +49,10 @@ struct _GokButton
struct _GokButtonClass
{
- GtkToggleButtonClass parent_class;
+ GtkToggleButtonClass parent;
};
-GtkType gok_button_get_type (void) G_GNUC_CONST;
+GType gok_button_get_type (void) G_GNUC_CONST;
GtkWidget* gok_button_new_with_label (const gchar *pText, GokImagePlacementPolicy align);
GtkWidget* gok_button_new_with_image (GtkWidget *image, GokImagePlacementPolicy align);
void gok_button_set_image (GokButton *button, GtkImage *image);
@@ -62,9 +61,6 @@ gint gok_button_enter_notify (GtkWidget *widget, GdkEventCrossing *event);
gint gok_button_leave_notify (GtkWidget *widget, GdkEventCrossing *event);
void gok_button_state_changed (GtkWidget *widget, GtkStateType state, gpointer user_data);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+G_END_DECLS
#endif /* __GOKBUTTON_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]