gnome-games r8637 - in trunk: aisleriot libgames-support



Author: chpe
Date: Tue Feb  3 14:39:25 2009
New Revision: 8637
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8637&view=rev

Log:
Move aisleriot_util_add_atk_relation to libgames-support, and adapt callers.

Added:
   trunk/libgames-support/games-atk-utils.c
      - copied, changed from r8636, /trunk/aisleriot/util.c
   trunk/libgames-support/games-atk-utils.h
Modified:
   trunk/aisleriot/stats-dialog.c
   trunk/aisleriot/util.c
   trunk/aisleriot/util.h
   trunk/aisleriot/window.c
   trunk/libgames-support/Makefile.am

Modified: trunk/aisleriot/stats-dialog.c
==============================================================================
--- trunk/aisleriot/stats-dialog.c	(original)
+++ trunk/aisleriot/stats-dialog.c	Tue Feb  3 14:39:25 2009
@@ -25,6 +25,10 @@
 
 #include <libgames-support/games-stock.h>
 
+#ifndef HAVE_HILDON
+#include <libgames-support/games-atk-utils.h>
+#endif
+
 #include "conf.h"
 #include "util.h"
 
@@ -74,8 +78,8 @@
   gtk_widget_show_all (frame);
 
 #ifndef HAVE_HILDON
-  aisleriot_util_add_atk_relation (label, frame, ATK_RELATION_LABEL_FOR);
-  aisleriot_util_add_atk_relation (frame, label, ATK_RELATION_LABELLED_BY);
+  games_atk_util_add_atk_relation (label, frame, ATK_RELATION_LABEL_FOR);
+  games_atk_util_add_atk_relation (frame, label, ATK_RELATION_LABELLED_BY);
 #endif /* !HAVE_HILDON */
 }
 
@@ -99,8 +103,8 @@
                              1, 2, row, row + 1);
 
 #ifndef HAVE_HILDON
-  aisleriot_util_add_atk_relation (label, data_label, ATK_RELATION_LABEL_FOR);
-  aisleriot_util_add_atk_relation (data_label, label, ATK_RELATION_LABELLED_BY);
+  games_atk_util_add_atk_relation (label, data_label, ATK_RELATION_LABEL_FOR);
+  games_atk_util_add_atk_relation (data_label, label, ATK_RELATION_LABELLED_BY);
 #endif /* !HAVE_HILDON */
 
   return GTK_LABEL (data_label);

Modified: trunk/aisleriot/util.c
==============================================================================
--- trunk/aisleriot/util.c	(original)
+++ trunk/aisleriot/util.c	Tue Feb  3 14:39:25 2009
@@ -48,31 +48,3 @@
 
   help_hook (parent, game_file, help_hook_data);
 }
-
-/**
- * aisleriot_util_add_atk_relation:
- * @widget:
- * @other:
- * @type:
- *
- * Adds an AtkRelation of type @type to @other into @widget's
- * AtkRelationSet.
- */
-void
-aisleriot_util_add_atk_relation (GtkWidget *widget,
-                                 GtkWidget *other,
-                                 AtkRelationType type)
-{
-#ifndef HAVE_HILDON
-  AtkRelationSet *set;
-  AtkRelation *relation;
-  AtkObject *object;
-
-  object = gtk_widget_get_accessible (other);
-  set = atk_object_ref_relation_set (gtk_widget_get_accessible (widget));
-  relation = atk_relation_new (&object, 1, type);
-  atk_relation_set_add (set, relation);
-  g_object_unref (relation);
-  g_object_unref (set);
-#endif /* !HAVE_HILDON */
-}

Modified: trunk/aisleriot/util.h
==============================================================================
--- trunk/aisleriot/util.h	(original)
+++ trunk/aisleriot/util.h	Tue Feb  3 14:39:25 2009
@@ -31,10 +31,6 @@
 
 void aisleriot_display_help (GtkWindow * parent, const char *game_file);
 
-void aisleriot_util_add_atk_relation (GtkWidget *widget,
-                                      GtkWidget *other,
-                                      AtkRelationType type);
-
 G_END_DECLS
 
 #endif /* !UTIL_H */

Modified: trunk/aisleriot/window.c
==============================================================================
--- trunk/aisleriot/window.c	(original)
+++ trunk/aisleriot/window.c	Tue Feb  3 14:39:25 2009
@@ -48,6 +48,10 @@
 #include <libgames-support/games-sound.h>
 #include <libgames-support/games-string-utils.h>
 
+#ifndef HAVE_HILDON
+#include <libgames-support/games-atk-utils.h>
+#endif
+
 #include "board.h"
 #include "conf.h"
 #include "game.h"
@@ -2520,8 +2524,8 @@
   gtk_box_pack_start (GTK_BOX (priv->score_box), priv->score_label, FALSE, FALSE, 0);
   gtk_box_pack_end (GTK_BOX (statusbar_hbox), priv->score_box, FALSE, FALSE, 0);
 
-  aisleriot_util_add_atk_relation (label, priv->score_label, ATK_RELATION_LABEL_FOR);
-  aisleriot_util_add_atk_relation (priv->score_label, label, ATK_RELATION_LABELLED_BY);
+  games_atk_util_add_atk_relation (label, priv->score_label, ATK_RELATION_LABEL_FOR);
+  games_atk_util_add_atk_relation (priv->score_label, label, ATK_RELATION_LABELLED_BY);
 
   time_box = gtk_hbox_new (12, FALSE);
   label = gtk_label_new (_("Time:"));
@@ -2531,8 +2535,8 @@
   gtk_box_pack_end (GTK_BOX (statusbar_hbox), time_box, FALSE, FALSE, 0);
   gtk_widget_show_all (time_box);
 
-  aisleriot_util_add_atk_relation (label, priv->clock, ATK_RELATION_LABEL_FOR);
-  aisleriot_util_add_atk_relation (priv->clock, label, ATK_RELATION_LABELLED_BY);
+  games_atk_util_add_atk_relation (label, priv->clock, ATK_RELATION_LABEL_FOR);
+  games_atk_util_add_atk_relation (priv->clock, label, ATK_RELATION_LABELLED_BY);
 #endif /* !HAVE_HILDON */
 
   /* Load the UI after we've connected the statusbar,

Modified: trunk/libgames-support/Makefile.am
==============================================================================
--- trunk/libgames-support/Makefile.am	(original)
+++ trunk/libgames-support/Makefile.am	Tue Feb  3 14:39:25 2009
@@ -64,6 +64,8 @@
 
 if !HAVE_HILDON
 libgames_support_la_SOURCES +=		\
+	games-atk-utils.c		\
+	games-atk-utils.h		\
 	games-clock.c			\
 	games-clock.h			\
 	games-frame.c			\

Copied: trunk/libgames-support/games-atk-utils.c (from r8636, /trunk/aisleriot/util.c)
==============================================================================
--- /trunk/aisleriot/util.c	(original)
+++ trunk/libgames-support/games-atk-utils.c	Tue Feb  3 14:39:25 2009
@@ -20,37 +20,12 @@
 
 #include <config.h>
 
-#include <string.h>
-
-#include <glib/gi18n.h>
-
 #include <gtk/gtk.h>
 
-#include "util.h"
-
-static AisleriotHelpFunc help_hook;
-static gpointer help_hook_data;
-
-void
-aisleriot_util_set_help_func (AisleriotHelpFunc func,
-                              gpointer user_data)
-{
-  help_hook = func;
-  help_hook_data = user_data;
-}
-
-void
-aisleriot_display_help (GtkWindow *parent,
-                        const char *game_file)
-{
-  if (!help_hook)
-    return;
-
-  help_hook (parent, game_file, help_hook_data);
-}
+#include "games-atk-utils.h"
 
 /**
- * aisleriot_util_add_atk_relation:
+ * games_atk_util_add_atk_relation:
  * @widget:
  * @other:
  * @type:
@@ -59,11 +34,10 @@
  * AtkRelationSet.
  */
 void
-aisleriot_util_add_atk_relation (GtkWidget *widget,
+games_atk_util_add_atk_relation (GtkWidget *widget,
                                  GtkWidget *other,
                                  AtkRelationType type)
 {
-#ifndef HAVE_HILDON
   AtkRelationSet *set;
   AtkRelation *relation;
   AtkObject *object;
@@ -74,5 +48,4 @@
   atk_relation_set_add (set, relation);
   g_object_unref (relation);
   g_object_unref (set);
-#endif /* !HAVE_HILDON */
 }

Added: trunk/libgames-support/games-atk-utils.h
==============================================================================
--- (empty file)
+++ trunk/libgames-support/games-atk-utils.h	Tue Feb  3 14:39:25 2009
@@ -0,0 +1,33 @@
+/*
+ *  Copyright  2009 Christian Persch
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1, or (at your option)
+ *  any later version.
+ *
+ *  This program 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GAMES_ATK_UTILS_H
+#define GAMES_ATK_UTILS_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+  
+void games_atk_util_add_atk_relation (GtkWidget *widget,
+                                      GtkWidget *other,
+                                      AtkRelationType type);
+
+G_END_DECLS
+
+#endif /* !GAMES_ATK_UTILS_H */



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