gnome-games r8053 - in trunk/gnibbles: . pix



Author: thomashpa
Date: Thu Oct 16 23:27:06 2008
New Revision: 8053
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8053&view=rev

Log:
ridding gnibbles of libgnome. Another game down.

Modified:
   trunk/gnibbles/Makefile.am
   trunk/gnibbles/boni.c
   trunk/gnibbles/boni.h
   trunk/gnibbles/bonus.c
   trunk/gnibbles/bonus.h
   trunk/gnibbles/ggz-network.c
   trunk/gnibbles/gnibbles.c
   trunk/gnibbles/gnibbles.h
   trunk/gnibbles/main.c
   trunk/gnibbles/pix/Makefile.am
   trunk/gnibbles/preferences.h
   trunk/gnibbles/properties.c
   trunk/gnibbles/properties.h
   trunk/gnibbles/scoreboard.c
   trunk/gnibbles/scoreboard.h
   trunk/gnibbles/server.c
   trunk/gnibbles/warp.c
   trunk/gnibbles/warpmanager.c

Modified: trunk/gnibbles/Makefile.am
==============================================================================
--- trunk/gnibbles/Makefile.am	(original)
+++ trunk/gnibbles/Makefile.am	Thu Oct 16 23:27:06 2008
@@ -62,10 +62,10 @@
 	$(LIB_GGZ_GTK)
 endif
 
-pixmapdir = $(datadir)/pixmaps/gnibbles
+pixmapdir = $(datadir)/gnome-games/gnibbles/pixmaps
 pixmap_DATA = gnibbles-logo.svg
 
-configdir = $(datadir)/gnibbles
+configdir = $(datadir)/gnome-games/gnibbles/games
 config_DATA = \
 	level001.gnl \
 	level002.gnl \
@@ -99,7 +99,7 @@
 desktop_in_files = gnibbles.desktop.in.in
 desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
 
-schemadir   = @GCONF_SCHEMA_FILE_DIR@
+schemadir = @GCONF_SCHEMA_FILE_DIR@
 schema_in_files = gnibbles.schemas.in
 schema_DATA = $(schema_in_files:.schemas.in=.schemas)
 
@@ -126,8 +126,8 @@
 gnibblesd_LDFLAGS = $(AM_LDFLAGS)
 
 gnibblesd_LDADD = \
-	$(GNOME_GAMES_LIBS)     \
-	$(INTLLIBS) 		\
+	$(GNOME_GAMES_LIBS)	\
+	$(INTLLIBS)			\
 	$(LIB_GGZDMOD)
 
 ggzroom_in_files = gnibbles.room.in
@@ -149,7 +149,7 @@
 	$(schema_in_files) \
 	gnibbles-client.dsc.in \
 	gnibbles-server.dsc.in \
-        gnibbles.room.in
+	gnibbles.room.in
 
 SUBDIRS= help pix
 

Modified: trunk/gnibbles/boni.c
==============================================================================
--- trunk/gnibbles/boni.c	(original)
+++ trunk/gnibbles/boni.c	Thu Oct 16 23:27:06 2008
@@ -18,9 +18,10 @@
  */
 
 #include <config.h>
-#include <gnome.h>
 
-#include <games-sound.h>
+#include <gtk/gtk.h>
+
+#include <libgames-support/games-sound.h>
 
 #include "gnibbles.h"
 #include "main.h"

Modified: trunk/gnibbles/boni.h
==============================================================================
--- trunk/gnibbles/boni.h	(original)
+++ trunk/gnibbles/boni.h	Thu Oct 16 23:27:06 2008
@@ -21,7 +21,8 @@
 #define _BONI_H_
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "bonus.h"
 

Modified: trunk/gnibbles/bonus.c
==============================================================================
--- trunk/gnibbles/bonus.c	(original)
+++ trunk/gnibbles/bonus.c	Thu Oct 16 23:27:06 2008
@@ -18,7 +18,8 @@
  */
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "gnibbles.h"
 #include "bonus.h"

Modified: trunk/gnibbles/bonus.h
==============================================================================
--- trunk/gnibbles/bonus.h	(original)
+++ trunk/gnibbles/bonus.h	Thu Oct 16 23:27:06 2008
@@ -21,7 +21,8 @@
 #define _BONUS_H_
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #define BONUSNONE	0
 #define BONUSREGULAR	1

Modified: trunk/gnibbles/ggz-network.c
==============================================================================
--- trunk/gnibbles/ggz-network.c	(original)
+++ trunk/gnibbles/ggz-network.c	Thu Oct 16 23:27:06 2008
@@ -19,26 +19,29 @@
  */
 
 #include <config.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <gnome.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <errno.h>
 #include <netdb.h>
 #include <pwd.h>
 
-#include "main.h"
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
 
 #include <ggzmod.h>
 #include <ggz-embed.h>
 #include <ggz-gtk.h>
+
 #include "games-dlg-chat.h"
 #include "games-dlg-players.h"
 
+#include "main.h"
 #include "gnibbles.h"
 #include "properties.h"
 #include "ggz-network.h"

Modified: trunk/gnibbles/gnibbles.c
==============================================================================
--- trunk/gnibbles/gnibbles.c	(original)
+++ trunk/gnibbles/gnibbles.c	Thu Oct 16 23:27:06 2008
@@ -20,12 +20,16 @@
  */
 
 #include <config.h>
-#include <gnome.h>
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#include <games-scores-dialog.h>
-#include <games-scores.h>
-#include <games-sound.h>
+
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-scores-dialog.h>
+#include <libgames-support/games-scores.h>
+#include <libgames-support/games-sound.h>
 
 #include "main.h"
 #include "gnibbles.h"
@@ -85,15 +89,19 @@
 {
   GdkPixbuf *image;
   gchar *filename;
+  const char *dirname;
 
-  filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR,
-					pixmap, TRUE, NULL);
+  dirname = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
+  filename = g_build_filename (dirname, pixmap, NULL);
 
   if (!filename) {
     char *message =
       g_strdup_printf (_("Gnibbles couldn't find pixmap file:\n%s\n\n"
 			 "Please check your Gnibbles installation"), pixmap);
     gnibbles_error (window, message);
+    /* We should never get here since the app exits in gnibbles_error. But let's
+     * free it anyway in case someone comes along and changes gnibbles_error */
+    g_free(message);
   }
 
   image = gdk_pixbuf_new_from_file_at_size (filename, xsize, ysize, NULL);
@@ -168,7 +176,7 @@
   if (logo_pixmap)
     g_object_unref (logo_pixmap);
   logo_pixmap =
-    gnibbles_load_pixmap_file (window, "pixmaps/gnibbles/gnibbles-logo.svg",
+    gnibbles_load_pixmap_file (window, "gnibbles-logo.svg",
 			       width, height);
 }
 
@@ -176,36 +184,36 @@
 gnibbles_load_pixmap (GtkWidget * window)
 {
   gchar *bonus_files[] = {
-    "pixmaps/gnibbles/blank.svg",
-    "pixmaps/gnibbles/diamond.svg",
-    "pixmaps/gnibbles/bonus1.svg",
-    "pixmaps/gnibbles/bonus2.svg",
-    "pixmaps/gnibbles/life.svg",
-    "pixmaps/gnibbles/bonus3.svg",
-    "pixmaps/gnibbles/bonus4.svg",
-    "pixmaps/gnibbles/bonus5.svg",
-    "pixmaps/gnibbles/questionmark.svg"
+    "blank.svg",
+    "diamond.svg",
+    "bonus1.svg",
+    "bonus2.svg",
+    "life.svg",
+    "bonus3.svg",
+    "bonus4.svg",
+    "bonus5.svg",
+    "questionmark.svg"
   };
   gchar *small_files[] = {
-    "pixmaps/gnibbles/wall-empty.svg",
-    "pixmaps/gnibbles/wall-straight-up.svg",
-    "pixmaps/gnibbles/wall-straight-side.svg",
-    "pixmaps/gnibbles/wall-corner-bottom-left.svg",
-    "pixmaps/gnibbles/wall-corner-bottom-right.svg",
-    "pixmaps/gnibbles/wall-corner-top-left.svg",
-    "pixmaps/gnibbles/wall-corner-top-right.svg",
-    "pixmaps/gnibbles/wall-tee-up.svg",
-    "pixmaps/gnibbles/wall-tee-right.svg",
-    "pixmaps/gnibbles/wall-tee-left.svg",
-    "pixmaps/gnibbles/wall-tee-down.svg",
-    "pixmaps/gnibbles/wall-cross.svg",
-    "pixmaps/gnibbles/snake-red.svg",
-    "pixmaps/gnibbles/snake-green.svg",
-    "pixmaps/gnibbles/snake-blue.svg",
-    "pixmaps/gnibbles/snake-yellow.svg",
-    "pixmaps/gnibbles/snake-cyan.svg",
-    "pixmaps/gnibbles/snake-magenta.svg",
-    "pixmaps/gnibbles/snake-grey.svg"
+    "wall-empty.svg",
+    "wall-straight-up.svg",
+    "wall-straight-side.svg",
+    "wall-corner-bottom-left.svg",
+    "wall-corner-bottom-right.svg",
+    "wall-corner-top-left.svg",
+    "wall-corner-top-right.svg",
+    "wall-tee-up.svg",
+    "wall-tee-right.svg",
+    "wall-tee-left.svg",
+    "wall-tee-down.svg",
+    "wall-cross.svg",
+    "snake-red.svg",
+    "snake-green.svg",
+    "snake-blue.svg",
+    "snake-yellow.svg",
+    "snake-cyan.svg",
+    "snake-magenta.svg",
+    "snake-grey.svg"
   };
   int i;
 
@@ -230,15 +238,18 @@
 gnibbles_load_level (GtkWidget * window, gint level)
 {
   gchar *tmp = NULL;
+  const char *dirname;
   gchar *filename;
   FILE *in;
   gchar tmpboard[BOARDWIDTH + 2];
   gint i, j;
   gint count = 0;
 
-  tmp = g_strdup_printf ("gnibbles/level%03d.gnl", level);
-  filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR,
-					tmp, TRUE, NULL);
+  tmp = g_strdup_printf ("level%03d.gnl", level);
+
+  dirname = games_runtime_get_directory (GAMES_RUNTIME_GAME_GAMES_DIRECTORY);
+  filename = g_build_filename (dirname, tmp, NULL);
+
   g_free (tmp);
   if ((in = fopen (filename, "r")) == NULL) {
     char *message =

Modified: trunk/gnibbles/gnibbles.h
==============================================================================
--- trunk/gnibbles/gnibbles.h	(original)
+++ trunk/gnibbles/gnibbles.h	Thu Oct 16 23:27:06 2008
@@ -21,7 +21,8 @@
 #define _GNIBBLES_H_
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "warpmanager.h"
 

Modified: trunk/gnibbles/main.c
==============================================================================
--- trunk/gnibbles/main.c	(original)
+++ trunk/gnibbles/main.c	Thu Oct 16 23:27:06 2008
@@ -20,17 +20,20 @@
  */
 
 #include <config.h>
-#include <gnome.h>
+
 #include <string.h>
-#include <gdk/gdkkeysyms.h>
 #include <time.h>
 
-#include <games-gridframe.h>
-#include <games-stock.h>
-#include <games-scores.h>
-#include <games-sound.h>
-#include <games-conf.h>
-#include <games-runtime.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#include <libgames-support/games-conf.h>
+#include <libgames-support/games-gridframe.h>
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-scores.h>
+#include <libgames-support/games-sound.h>
+#include <libgames-support/games-stock.h>
 
 #include "main.h"
 #include "properties.h"
@@ -54,7 +57,7 @@
 
 GtkWidget *window;
 GtkWidget *drawing_area;
-GtkWidget *appbar;
+GtkWidget *statusbar;
 GtkWidget *notebook;
 GtkWidget *chat = NULL;
 
@@ -892,12 +895,14 @@
 {
   GdkPixmap *cursor_dot_pm;
   GtkWidget *vbox;
+  GtkWidget *main_vbox;
   GtkWidget *packing;
   GtkWidget *menubar;
   GtkUIManager *ui_manager;
   GtkAccelGroup *accel_group;
 
-  window = gnome_app_new ("gnibbles", "Nibbles");
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Nibbles"));
 
   gtk_window_set_default_size (GTK_WINDOW (window), DEFAULT_WIDTH, DEFAULT_HEIGHT);
   games_conf_add_window (GTK_WINDOW (window), KEY_PREFERENCES_GROUP);
@@ -967,20 +972,24 @@
   gtk_widget_set_events (drawing_area, GDK_BUTTON_PRESS_MASK |
 			 GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK);
 
-  gnome_app_set_contents (GNOME_APP (window), notebook);
+  main_vbox = gtk_vbox_new (FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
   gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, NULL);
   gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), MAIN_PAGE);
 
+  statusbar = gtk_statusbar_new ();
+  gtk_box_pack_start (GTK_BOX (main_vbox), statusbar, FALSE, FALSE, 0);
+
+  gtk_container_add (GTK_CONTAINER (window), main_vbox);
+
+
   gtk_widget_show_all (window);
 #ifdef GGZ_CLIENT
   gtk_widget_hide (chat);
 #endif
   gtk_widget_show (drawing_area);
 
-  appbar = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_USER);
-  gnome_app_set_statusbar (GNOME_APP (window), appbar);
-
-  scoreboard = gnibbles_scoreboard_new (appbar);
+  scoreboard = gnibbles_scoreboard_new (statusbar);
 
 }
 
@@ -1048,28 +1057,45 @@
 int
 main (int argc, char **argv)
 {
-  GnomeProgram *program;
   GOptionContext *context;
+  gboolean retval;
+  GError *error = NULL;
 
-  setgid_io_init ();
-
-  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-  textdomain (GETTEXT_PACKAGE);
-
+#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
+  /* If we're going to use gnome-vfs, we need to init threads before
+   * calling any glib functions.
+   */
   g_thread_init (NULL);
+#endif
   
   if (!games_runtime_init ("gnibbles"))
     return 1;
 
+  setgid_io_init ();
+
+  bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
+
   context = g_option_context_new (NULL);
+
+#if GLIB_CHECK_VERSION (2, 12, 0)
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+#endif  g_option_context_add_group (context, gtk_get_option_group (TRUE));
+
+  g_option_context_add_group (context, gtk_get_option_group (TRUE));
   games_sound_add_option_group (context);
 
-  program = gnome_program_init ("gnibbles", VERSION, LIBGNOMEUI_MODULE,
-				argc, argv,
-				GNOME_PARAM_GOPTION_CONTEXT, context,
-				GNOME_PARAM_POPT_TABLE, NULL,
-				GNOME_PARAM_APP_DATADIR, REAL_DATADIR, NULL);
+  retval = g_option_context_parse (context, &argc, &argv, &error);
+  g_option_context_free (context);
+  if (!retval) {
+    g_print ("%s", error->message);
+    g_error_free (error);
+    exit (1);
+  }
+
+  g_set_application_name (_("Nibbles"));
+
   gtk_window_set_default_icon_name ("gnome-gnibbles");
   srand (time (NULL));
 
@@ -1109,8 +1135,6 @@
 
   games_conf_shutdown ();
 
-  g_object_unref (program);
-
   games_runtime_shutdown ();
 
   return 0;

Modified: trunk/gnibbles/pix/Makefile.am
==============================================================================
--- trunk/gnibbles/pix/Makefile.am	(original)
+++ trunk/gnibbles/pix/Makefile.am	Thu Oct 16 23:27:06 2008
@@ -1,15 +1,15 @@
-pixmapdir=$(datadir)/pixmaps/gnibbles
+pixmapdir=$(datadir)/gnome-games/gnibbles/pixmaps
 
 BONUS_PIX=\
 	blank.svg \
-        bonus1.svg \
-        bonus2.svg \
-        bonus3.svg \
-        bonus4.svg \
-        bonus5.svg \
-        diamond.svg \
-        life.svg \
-        questionmark.svg
+	bonus1.svg \
+	bonus2.svg \
+	bonus3.svg \
+	bonus4.svg \
+	bonus5.svg \
+	diamond.svg \
+	life.svg \
+	questionmark.svg
 
 
 SMALL_PIX=\

Modified: trunk/gnibbles/preferences.h
==============================================================================
--- trunk/gnibbles/preferences.h	(original)
+++ trunk/gnibbles/preferences.h	Thu Oct 16 23:27:06 2008
@@ -21,7 +21,8 @@
 #define _PREFERENCES_H_
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "properties.h"
 

Modified: trunk/gnibbles/properties.c
==============================================================================
--- trunk/gnibbles/properties.c	(original)
+++ trunk/gnibbles/properties.c	Thu Oct 16 23:27:06 2008
@@ -20,11 +20,14 @@
  */
 
 #include <config.h>
-#include <gnome.h>
+
 #include <string.h>
-#include <games-sound.h>
-#include <games-scores.h>
-#include <games-conf.h>
+
+#include <gtk/gtk.h>
+
+#include <libgames-support/games-sound.h>
+#include <libgames-support/games-scores.h>
+#include <libgames-support/games-conf.h>
 
 #include "properties.h"
 #include "main.h"

Modified: trunk/gnibbles/properties.h
==============================================================================
--- trunk/gnibbles/properties.h	(original)
+++ trunk/gnibbles/properties.h	Thu Oct 16 23:27:06 2008
@@ -23,7 +23,8 @@
 #define _PROPERTIES_H_
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "gnibbles.h"
 

Modified: trunk/gnibbles/scoreboard.c
==============================================================================
--- trunk/gnibbles/scoreboard.c	(original)
+++ trunk/gnibbles/scoreboard.c	Thu Oct 16 23:27:06 2008
@@ -20,14 +20,17 @@
  */
 
 #include <config.h>
+
 #include <string.h>
-#include <gnome.h>
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
 
 #include "gnibbles.h"
 #include "scoreboard.h"
 
 GnibblesScoreboard *
-gnibbles_scoreboard_new (GtkWidget * t_appbar)
+gnibbles_scoreboard_new (GtkWidget * t_statusbar)
 {
   int i;
   char buffer[255];
@@ -39,7 +42,7 @@
   tmp->count = 0;
 
   for (i = 0; i < NUMWORMS; i++) {
-    hbox = gtk_hbox_new (FALSE, GNOME_PAD);
+    hbox = gtk_hbox_new (FALSE, 8);
     gtk_widget_show (hbox);
 
     sprintf (buffer, _("Worm %d:"), i + 1);
@@ -50,7 +53,7 @@
     gtk_widget_set_sensitive (tmp->data[i], FALSE);
     gtk_box_pack_start (GTK_BOX (hbox), tmp->data[i], FALSE, FALSE, 0);
 
-    gtk_box_pack_start (GTK_BOX (t_appbar), hbox, FALSE, FALSE, GNOME_PAD_SMALL);
+    gtk_box_pack_start (GTK_BOX (t_statusbar), hbox, FALSE, FALSE, 4);
   }
 
   return (tmp);

Modified: trunk/gnibbles/scoreboard.h
==============================================================================
--- trunk/gnibbles/scoreboard.h	(original)
+++ trunk/gnibbles/scoreboard.h	Thu Oct 16 23:27:06 2008
@@ -21,7 +21,8 @@
 #define _SCOREBOARD_H_
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "gnibbles.h"
 #include "worm.h"
@@ -33,7 +34,7 @@
   gint count;
 } GnibblesScoreboard;
 
-GnibblesScoreboard *gnibbles_scoreboard_new (GtkWidget * t_appbar);
+GnibblesScoreboard *gnibbles_scoreboard_new (GtkWidget * t_statusbar);
 
 void gnibbles_scoreboard_register (GnibblesScoreboard * scoreboard,
 				   GnibblesWorm * t_worm,

Modified: trunk/gnibbles/server.c
==============================================================================
--- trunk/gnibbles/server.c	(original)
+++ trunk/gnibbles/server.c	Thu Oct 16 23:27:06 2008
@@ -17,9 +17,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  * USA
  */
-#include "config.h"
-#include <gnome.h>
-#include <ggzdmod.h>
+#include <config.h>
+
 #include <sys/types.h>
 #include <errno.h>
 #include <stdio.h>
@@ -27,6 +26,10 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <gtk/gtk.h>
+
+#include <ggzdmod.h>
+
 #include "server.h"
 
 // Global game variables

Modified: trunk/gnibbles/warp.c
==============================================================================
--- trunk/gnibbles/warp.c	(original)
+++ trunk/gnibbles/warp.c	Thu Oct 16 23:27:06 2008
@@ -18,7 +18,8 @@
  */
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "gnibbles.h"
 #include "warp.h"

Modified: trunk/gnibbles/warpmanager.c
==============================================================================
--- trunk/gnibbles/warpmanager.c	(original)
+++ trunk/gnibbles/warpmanager.c	Thu Oct 16 23:27:06 2008
@@ -18,7 +18,8 @@
  */
 
 #include <config.h>
-#include <gnome.h>
+
+#include <gtk/gtk.h>
 
 #include "gnibbles.h"
 #include "warp.h"



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