gok r2511 - in branches/rm-dep: . gok



Author: gerdk
Date: Fri Jul 25 09:57:27 2008
New Revision: 2511
URL: http://svn.gnome.org/viewvc/gok?rev=2511&view=rev

Log:
2008-07-25  Gerd Kohlberger  <gerdk svn gnome org>

	* gok/callbacks.c: Cleanup includes.
	(on_buttonAccessMethodWizard_clicked): (GtkWindow*) -> GTK_WINDOW

	* gok/gok-button.c: Use G_DEFINE_TYPE.
	(GtkWidgetClass*) -> GTK_WIDGET_CLASS

	* gok/gok-button.h: GtkType -> GType.
	Add class accessor macro. Use G_*_DECLS.



Modified:
   branches/rm-dep/ChangeLog
   branches/rm-dep/gok/callbacks.c
   branches/rm-dep/gok/gok-button.c
   branches/rm-dep/gok/gok-button.h

Modified: branches/rm-dep/gok/callbacks.c
==============================================================================
--- branches/rm-dep/gok/callbacks.c	(original)
+++ branches/rm-dep/gok/callbacks.c	Fri Jul 25 09:57:27 2008
@@ -23,14 +23,16 @@
 #  include <config.h>
 #endif
 
-#include <gnome.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <glade/glade.h>
 #include <gdk/gdkx.h>
+
 #ifdef HAVE_XINPUT
 #include <X11/extensions/XInput.h>
 #endif
-
 #include <X11/Xatom.h>
-#include <glade/glade.h>
+
 #include "callbacks.h"
 #include "gok-scanner.h"
 #include "gok-input.h"
@@ -364,13 +366,13 @@
                                         gpointer         user_data)
 {
 	GtkWidget* pDialog;
-	
-	pDialog = gtk_message_dialog_new ((GtkWindow*)gok_settingsdialog_get_window(),
+
+	pDialog = gtk_message_dialog_new (GTK_WINDOW (gok_settingsdialog_get_window ()),
 		GTK_DIALOG_DESTROY_WITH_PARENT,
 		GTK_MESSAGE_ERROR,
 		GTK_BUTTONS_CLOSE,
 		_("Sorry, Access Method Wizard not implemented yet."));
-	
+
 	gtk_window_set_title (GTK_WINDOW (pDialog), _("GOK Access Method Wizard"));
 	gtk_dialog_run (GTK_DIALOG (pDialog));
 	gtk_widget_destroy (pDialog);

Modified: branches/rm-dep/gok/gok-button.c
==============================================================================
--- branches/rm-dep/gok/gok-button.c	(original)
+++ branches/rm-dep/gok/gok-button.c	Fri Jul 25 09:57:27 2008
@@ -23,52 +23,21 @@
 #  include <config.h>
 #endif
 
+#include <gtk/gtk.h>
+
 #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);
+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 +47,9 @@
 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;
+
+	widget_class = GTK_WIDGET_CLASS (klass);
 	widget_class->expose_event = gok_button_expose;
 }
 
@@ -314,9 +283,9 @@
 gok_button_expose (GtkWidget      *widget,
 		   GdkEventExpose *event)
 {
- 	gboolean retval = 
-		(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
-	
+	gboolean retval =
+		(* 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) {
 			GtkWidget *image = GOK_BUTTON (widget)->pImage;
@@ -377,6 +346,5 @@
 			}
 		}
 	}
-
 	return retval;
 }

Modified: branches/rm-dep/gok/gok-button.h
==============================================================================
--- branches/rm-dep/gok/gok-button.h	(original)
+++ branches/rm-dep/gok/gok-button.h	Fri Jul 25 09:57:27 2008
@@ -23,18 +23,16 @@
 #define __GOKBUTTON_H__
 
 #include <gtk/gtk.h>
-#include <gdk/gdk.h>
 #include "gok-key.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#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)
+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_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GOK_TYPE_BUTTON, GokButtonClass))
 
 typedef struct _GokButton       GokButton;
 typedef struct _GokButtonClass  GokButtonClass;
@@ -42,29 +40,28 @@
 struct _GokButton
 {
 	GtkToggleButton button;
-	GtkWidget* pBox;
-	GtkWidget* pLabel;
-        GtkWidget* pImage;
-        gchar     *indicator_type;
+
+	GtkWidget *pBox;
+	GtkWidget *pLabel;
+	GtkWidget *pImage;
+	gchar     *indicator_type;
 };
 
 struct _GokButtonClass
 {
-  GtkToggleButtonClass parent_class;
+	GtkToggleButtonClass parent_class;
 };
 
-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);
 void gok_button_set_label (GokButton *button, GtkLabel *label);
 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 */
+void gok_button_state_changed  (GtkWidget *widget, GtkStateType state, gpointer user_data);
 
+G_END_DECLS
 
 #endif /* __GOKBUTTON_H__ */



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