[monkey-bubble] fully use our internal copy of libgnome now



commit e68f6b0113200922d813d0fd576b02082a4a5767
Author: Sven Herzberg <herzi gnome-de org>
Date:   Wed Jul 14 23:52:37 2010 +0200

    fully use our internal copy of libgnome now
    
    * Makefile.am,
    * configure.in: add the new subfolder; dropped the libgnome dependency
    * libgnome/Makefile.am: add build rules for the library
    * libgnome/gnome-score.c: fix compilation errors and warnings
    * libgnomeui/Makefile.am: let our gnomeui depend our libgnome
    * src/ui/main.c,
    * src/ui/ui-main.c: drop the last remainders of libgnome

 Makefile.am            |    1 +
 configure.in           |    6 +++++-
 libgnome/Makefile.am   |   10 ++++++++++
 libgnome/gnome-score.c |   20 ++++----------------
 libgnomeui/Makefile.am |    6 +++---
 src/ui/main.c          |   12 ------------
 src/ui/ui-main.c       |    1 -
 7 files changed, 23 insertions(+), 33 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 34d620c..2cf3fe3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,6 +4,7 @@ always_subdirs=\
 	data \
 	pixmaps \
         sounds \
+        libgnome \
         libgnomeui \
         src \
         po \
diff --git a/configure.in b/configure.in
index a9ad161..5b2a7e8 100644
--- a/configure.in
+++ b/configure.in
@@ -148,7 +148,10 @@ AC_SUBST(UI_CFLAGS)
 AC_SUBST(UI_LIBS)
 
 if test "$with_platform" = "gnome"; then
-	PKG_CHECK_MODULES(PLATFORM,[libgnome-2.0])
+	PLATFORM_LIBS=""
+	PLATFORM_CFLAGS=""
+	AC_SUBST(PLATFORM_LIBS)
+	AC_SUBST(PLATFORM_CFLAGS)
 elif test "$with_platform" = "maemo"; then
 	PKG_CHECK_MODULES(PLATFORM,[hildon-1 libosso conic])
 fi
@@ -222,6 +225,7 @@ dnl  --------
 AC_OUTPUT([
   Makefile
   data/Makefile
+  libgnome/Makefile
   libgnomeui/Makefile
   pixmaps/Makefile
   pixmaps/bubbles/Makefile
diff --git a/libgnome/Makefile.am b/libgnome/Makefile.am
new file mode 100644
index 0000000..e9cef02
--- /dev/null
+++ b/libgnome/Makefile.am
@@ -0,0 +1,10 @@
+noinst_LTLIBRARIES=libgnome.la
+
+libgnome_la_CPPFLAGS=\
+        $(LIBMONKEYUTIL_A_CFLAGS) \
+        -DLIBGNOME_LOCALSTATEDIR=\""$(localstatedir)"\"\
+        $(NULL)
+libgnome_la_SOURCES=\
+        gnome-score.c \
+        gnome-score.h \
+        $(NULL)
diff --git a/libgnome/gnome-score.c b/libgnome/gnome-score.c
index 3566011..8efc01f 100644
--- a/libgnome/gnome-score.c
+++ b/libgnome/gnome-score.c
@@ -45,9 +45,7 @@
 
 #include <glib/gi18n-lib.h>
 
-#include "gnome-i18n.h"
 #include "gnome-score.h"
-#include "gnome-util.h"
 
 #ifdef G_OS_WIN32
 #include <fcntl.h>
@@ -63,8 +61,6 @@
 #define strtok_r(s, delim, ptrptr) (*(ptrptr) = strtok (s, delim))
 #endif
 
-#include "libgnome-private.h"
-
 #ifndef NSCORES
 #define NSCORES 10
 #endif
@@ -106,8 +102,9 @@ gnome_get_score_file_name (const gchar * progname, const gchar * level)
 static void
 print_ascore (struct ascore_t *ascore, FILE * outfile)
 {
+	char buf[G_ASCII_DTOSTR_BUF_SIZE];
 	/* make sure we write values to files in a consistent manner */
-	fprintf (outfile, "%f %ld %s\n", ascore->score,
+	fprintf (outfile, "%s %ld %s\n", g_ascii_dtostr (buf, sizeof (buf), ascore->score),
 		 (long int) ascore->scoretime, ascore->username);
 }
 
@@ -151,8 +148,6 @@ log_score (const gchar * progname, const gchar * level, gchar * username,
    infile = g_fopen (game_score_file, "r");
    if (infile)
      {
-       /* make sure we read values from files in a consistent manner */
-       gnome_i18n_push_c_numeric_locale ();
        while(fgets(buf, sizeof(buf), infile))
 	 {
 	     long ltime;
@@ -165,7 +160,7 @@ log_score (const gchar * progname, const gchar * level, gchar * username,
 
 	        if((buf2 = strtok_r (buf, " ", &tokp)) == NULL)
 		  break;
-	        ascore = atof (buf2);
+	        ascore = g_ascii_strtod (buf2, NULL);
 	        if((buf2 = strtok_r (NULL, " ", &tokp)) == NULL)
 		  break;
 	        ltime = atoi (buf2);
@@ -179,7 +174,6 @@ log_score (const gchar * progname, const gchar * level, gchar * username,
 	     anitem->scoretime = (time_t)ltime;
 	     scores = g_list_append (scores, (gpointer) anitem);
 	  }
-        gnome_i18n_pop_c_numeric_locale ();
 
 	fclose (infile);
      }
@@ -230,9 +224,7 @@ log_score (const gchar * progname, const gchar * level, gchar * username,
 
    if (outfile)
      {
-	gnome_i18n_push_c_numeric_locale ();
 	g_list_foreach (scores, (GFunc) print_ascore, outfile);
-	gnome_i18n_pop_c_numeric_locale ();
 	fclose (outfile);
      }
    else
@@ -492,8 +484,6 @@ gnome_score_get_notable (const gchar * gamename,
 	*scores = g_malloc ((NSCORES + 1) * sizeof (gfloat));
 	*scoretimes = g_malloc ((NSCORES + 1) * sizeof (time_t));
 
-        gnome_i18n_push_c_numeric_locale ();
-
 	for (retval = 0;
 	     fgets (buf, sizeof (buf), infile) && retval < NSCORES;
 	     retval++)
@@ -502,7 +492,7 @@ gnome_score_get_notable (const gchar * gamename,
 
 	     buf[strlen (buf) - 1] = 0;
 	     buf2 = strtok_r (buf, " ", &tokp);
-	     (*scores)[retval] = atof (buf2);
+	     (*scores)[retval] = g_ascii_strtod (buf2, NULL);
 	     buf2 = strtok_r (NULL, " ", &tokp);
 	     (*scoretimes)[retval] = atoi (buf2);
 	     buf2 = strtok_r (NULL, "\n", &tokp);
@@ -511,8 +501,6 @@ gnome_score_get_notable (const gchar * gamename,
 	(*names)[retval] = NULL;
 	(*scores)[retval] = 0.0;
 
-        gnome_i18n_pop_c_numeric_locale ();
-
 	fclose (infile);
      }
    else
diff --git a/libgnomeui/Makefile.am b/libgnomeui/Makefile.am
index bea2c89..c68beb4 100644
--- a/libgnomeui/Makefile.am
+++ b/libgnomeui/Makefile.am
@@ -1,10 +1,12 @@
 noinst_LTLIBRARIES=libgnomeui.la
 
 libgnomeui_la_CPPFLAGS=\
+        -I$(top_srcdir) \
         $(LIBMONKEYUTIL_A_CFLAGS) \
         $(PLATFORM_CFLAGS) \
         $(AM_CPPFLAGS)
 libgnomeui_la_LIBADD=\
+        $(top_builddir)/libgnome/libgnome.la \
         $(LIBMONKEYUTIL_A_LIBS) \
         $(PLATFORM_LIBS) \
         $(LIBADD)
@@ -14,9 +16,7 @@ libgnomeui_la_SOURCES=\
         $(NULL)
 
 noinst_PROGRAMS=linktest
-linktest_CPPFLAGS=\
-        -I$(top_srcdir) \
-        $(libgnomeui_la_CPPFLAGS)
+linktest_CPPFLAGS=$(libgnomeui_la_CPPFLAGS)
 linktest_LDADD=\
         libgnomeui.la \
         $(libgnomeui_la_LIBADD)
diff --git a/src/ui/main.c b/src/ui/main.c
index c484a9f..a323317 100644
--- a/src/ui/main.c
+++ b/src/ui/main.c
@@ -13,10 +13,7 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#ifdef GNOME
 #include <libgnome/gnome-score.h>
-#include <libgnome/gnome-init.h>
-#endif
 #include <glib/gthread.h>
 
 #include <math.h>
@@ -114,15 +111,6 @@ int main(int  argc, char **argv)
   global.game = NULL;
 #endif
 
-#ifdef GNOME
-  /* to get help working */
-  gnome_program_init (PACKAGE, VERSION,
-		      LIBGNOME_MODULE,
-		      argc, argv,
-		      GNOME_PROGRAM_STANDARD_PROPERTIES,
-		      NULL);
-#endif
-
   gtk_window_set_default_icon_name ("monkey-bubble");
 
   manager = sound_manager_get_instance();
diff --git a/src/ui/ui-main.c b/src/ui/ui-main.c
index 27bb2f7..dc363fe 100644
--- a/src/ui/ui-main.c
+++ b/src/ui/ui-main.c
@@ -37,7 +37,6 @@
 #ifdef GNOME
 #include <libgnomeui/gnome-scores.h>
 #include <libgnome/gnome-score.h>
-#include <libgnome/gnome-sound.h>
 #endif
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>



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