[patch] gnotski with G*DISABLE_DEPRECATED - damn!



the evil send button...

it is right next to attach in evo...


Index: gnotski/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-games/gnotski/Makefile.am,v
retrieving revision 1.10
diff -u -r1.10 Makefile.am
--- gnotski/Makefile.am	2002/01/10 09:21:26	1.10
+++ gnotski/Makefile.am	2002/01/15 22:31:02
@@ -4,7 +4,13 @@
 
 INCLUDES = 			\
 	$(GNOME_GAMES_CFLAGS)		\
-	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
+	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"	\
+	-DREAL_DATADIR=\""$(datadir)"\"	\
+	-DG_DISABLE_DEPRECATED		\
+	-DGDK_DISABLE_DEPRECATED	\
+	-DGDK_PIXBUF_DISABLE_DEPRECATED	\
+	-DGTK_DISABLE_DEPRECATED	\
+	-DGNOME_DISABLE_DEPRECATED
 
 bin_PROGRAMS = gnotski
 
Index: gnotski/gnotski.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gnotski/gnotski.c,v
retrieving revision 1.12
diff -u -r1.12 gnotski.c
--- gnotski/gnotski.c	2001/11/27 01:11:39	1.12
+++ gnotski/gnotski.c	2002/01/15 22:31:04
@@ -17,8 +17,8 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-
 #include <config.h>
+#include <string.h>
 #include <gnome.h>
 #include <libgnomeui/gnome-window-icon.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
@@ -52,11 +52,6 @@
 
 gint statusbar_id,height=-1,width=-1,moves=0;
 
-int session_flag = 0;
-int session_xpos = 0;
-int session_ypos = 0;
-int session_position  = 0;
-
 char current_level[16];
 
 void create_window();
@@ -75,8 +70,6 @@
 int move_piece(int,int,int,int,int);
 void copymap(char *,char *);
 int mapcmp(char *,char *);
-static int save_state(GnomeClient *,gint, GnomeRestartStyle, gint,
-                      GnomeInteractStyle, gint fast, gpointer);
 void print_map(char *);
 void set_move(int);
 void new_move();
@@ -443,13 +436,13 @@
 
 GnomeUIInfo game_menu[] = {
   { GNOME_APP_UI_SUBTREE, N_("_Novice"), NULL, level_1_menu,  NULL,NULL,
-    GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK, 
+    GNOME_APP_PIXMAP_STOCK, NULL, 
     (GdkModifierType) 0, GDK_CONTROL_MASK },
   { GNOME_APP_UI_SUBTREE, N_("_Medium"), NULL, level_2_menu,  NULL,NULL,
-    GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK, 
+    GNOME_APP_PIXMAP_STOCK, NULL, 
     (GdkModifierType) 0, GDK_CONTROL_MASK },
   { GNOME_APP_UI_SUBTREE, N_("_Advanced"), NULL, level_3_menu,  NULL,NULL,
-    GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK,
+    GNOME_APP_PIXMAP_STOCK, NULL,
     (GdkModifierType) 0, GDK_CONTROL_MASK },
   GNOMEUIINFO_MENU_SCORES_ITEM (score_cb, NULL),
   GNOMEUIINFO_SEPARATOR,
@@ -469,65 +462,50 @@
   GNOMEUIINFO_END
 };
 
-static const struct poptOption options[] = {
-  { NULL, 'x', POPT_ARG_INT, &session_xpos, 0, NULL, NULL },
-  { NULL, 'y', POPT_ARG_INT, &session_ypos, 0, NULL, NULL },
-  { NULL, '\0', 0, NULL, 0 }
-};
-
 /* ------------------------------------------------------- */
 
 int main (int argc, char **argv){
-  GnomeClient *client;
 
   gnome_score_init(APPNAME);
   bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain(GETTEXT_PACKAGE);
    
-  gnome_init_with_popt_table(APPNAME, VERSION, argc, argv, options, 0, NULL);
+  gnome_program_init(APPNAME, VERSION, LIBGNOMEUI_MODULE, argc, argv,
+		     GNOME_PARAM_POPT_TABLE, NULL,
+		     GNOME_PARAM_APP_DATADIR, REAL_DATADIR,
+		     NULL);
   gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/gnotski-icon.png");
-  client = gnome_master_client();
-  gtk_object_ref(GTK_OBJECT(client));
-  gtk_object_sink(GTK_OBJECT(client));
   
-  gtk_signal_connect(GTK_OBJECT (client), "save_yourself", 
-		     GTK_SIGNAL_FUNC (save_state), argv[0]);
-  gtk_signal_connect(GTK_OBJECT(client), "die", GTK_SIGNAL_FUNC(quit_game_cb),
-		     argv[0]);
-
   create_window();
   gnome_app_create_menus(GNOME_APP(window), main_menu);
   load_image();
   create_space(); 
   create_statusbar();
 
-  if(session_xpos >= 0 && session_ypos >= 0)
-    gtk_widget_set_uposition(window, session_xpos, session_ypos);
-    
   gtk_widget_show(window);
   new_game_cb(space,NULL);
   
   gtk_main ();
   
-/*  gtk_object_unref(GTK_OBJECT(client)); */
   return 0;
 }
 
 void create_window(){
   window = gnome_app_new(APPNAME, N_(APPNAME_LONG));
-  gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
+  gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
   gtk_widget_realize(window);
-  gtk_signal_connect(GTK_OBJECT(window), "delete_event", 
+  g_signal_connect(G_OBJECT(window), "delete_event", 
 		     GTK_SIGNAL_FUNC(quit_game_cb), NULL);
 }
 
 gint expose_space(GtkWidget *widget, GdkEventExpose *event){ 
-  gdk_draw_pixmap(widget->window, 
-                  widget->style->fg_gc[GTK_WIDGET_STATE(widget)], 
-                  buffer, event->area.x, event->area.y, 
-                  event->area.x, event->area.y, 
-                  event->area.width, event->area.height);
+  if (buffer)
+    gdk_draw_drawable (widget->window, 
+		       widget->style->fg_gc[GTK_WIDGET_STATE(widget)], 
+		       buffer, event->area.x, event->area.y, 
+		       event->area.x, event->area.y, 
+		       event->area.width, event->area.height);
   return FALSE; 
 }
 
@@ -599,7 +577,7 @@
   GdkRectangle area;
   int value;
   
-  gdk_draw_pixmap(buffer, space->style->black_gc, tiles_pixmap,
+  gdk_draw_drawable (buffer, space->style->black_gc, tiles_pixmap,
 		  get_piece_nr(target,x,y)*TILE_SIZE, 0, 
 		  x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);
   if(get_piece_id(target,x,y)=='*'){
@@ -607,13 +585,13 @@
       value = 20;
     else
       value = 22;
-    gdk_draw_pixmap(buffer, space->style->black_gc, tiles_pixmap,
+    gdk_draw_drawable (buffer, space->style->black_gc, tiles_pixmap,
 		    value*TILE_SIZE+10,10,
 		    x*TILE_SIZE+10, y*TILE_SIZE+10,8,8);
   }
   area.x = x*TILE_SIZE; area.y = y*TILE_SIZE; 
   area.width = TILE_SIZE; area.height = TILE_SIZE;
-  gtk_widget_draw (space, &area);
+  gdk_window_invalidate_rect (GTK_WIDGET (space)->window, &area, FALSE);
 }
 
 void score_cb(GtkWidget *widget, gpointer data){
@@ -629,7 +607,7 @@
 gint configure_space(GtkWidget *widget, GdkEventConfigure *event){
   if(width>0){
     if(buffer)
-      gdk_pixmap_unref(buffer);
+      g_object_unref (G_OBJECT (buffer));
     buffer = gdk_pixmap_new(widget->window, widget->allocation.width, 
 			    widget->allocation.height, -1);
     redraw_all();
@@ -638,26 +616,20 @@
 }
 
 void create_space(){
-  gtk_widget_push_visual(gdk_rgb_get_visual ());
-  gtk_widget_push_colormap(gdk_rgb_get_cmap());
   space = gtk_drawing_area_new();
-  gtk_widget_pop_colormap();
-  gtk_widget_pop_visual();
   gnome_app_set_contents(GNOME_APP(window),space);
-  gtk_drawing_area_size(GTK_DRAWING_AREA(space),
-			TILE_SIZE*width,TILE_SIZE*height); 
   gtk_widget_set_events(space, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
 			GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK);
   gtk_widget_realize(space);
-  gtk_signal_connect(GTK_OBJECT(space), "expose_event", 
+  g_signal_connect (G_OBJECT(space), "expose_event", 
                      GTK_SIGNAL_FUNC(expose_space), NULL);
-  gtk_signal_connect(GTK_OBJECT(space), "configure_event", 
+  g_signal_connect (G_OBJECT(space), "configure_event", 
                      GTK_SIGNAL_FUNC(configure_space), NULL);
-  gtk_signal_connect(GTK_OBJECT(space), "button_press_event", 
+  g_signal_connect (G_OBJECT(space), "button_press_event", 
                      GTK_SIGNAL_FUNC(button_press_space), NULL);
-  gtk_signal_connect (GTK_OBJECT(space),"button_release_event",
+  g_signal_connect (G_OBJECT(space),"button_release_event",
                       GTK_SIGNAL_FUNC(button_release_space), NULL);
-  gtk_signal_connect (GTK_OBJECT(space), "motion_notify_event",
+  g_signal_connect (G_OBJECT(space), "motion_notify_event",
                       GTK_SIGNAL_FUNC(button_motion_space), NULL);
   gtk_widget_show(space);
 }
@@ -686,11 +658,13 @@
 }
 
 void load_image(){
-  char *fname;
+  gchar *fname;
   GdkPixbuf *image;
+  GSList **ret_locations = NULL;
 
-  fname = gnome_unconditional_pixmap_file("gnotski.png");
-  if(!g_file_exists(fname)) {
+  fname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR,
+				     "pixmaps/gnotski.png", TRUE, ret_locations);
+  if (!g_file_test (fname, G_FILE_TEST_EXISTS)) {
     g_print(_("Could not find \'%s\' pixmap file\n"), fname); exit(1);
   }
   image = gdk_pixbuf_new_from_file(fname, NULL);
@@ -710,7 +684,7 @@
   char str[4];
   if(moves<999) moves++;
   sprintf(str,"%03d", moves);
-  gtk_label_set(GTK_LABEL(move_value), str);
+  gtk_label_set_text (GTK_LABEL (move_value), str);
 }
 
 
@@ -915,7 +889,7 @@
   widget = space;
 
   prepare_map(data);
-  gtk_drawing_area_size(GTK_DRAWING_AREA(space),
+  gtk_widget_set_size_request (GTK_WIDGET (space),
 			width*TILE_SIZE,height*TILE_SIZE);
   gtk_widget_realize(window);
 
@@ -924,41 +898,11 @@
 
 void quit_game_cb(GtkWidget *widget, gpointer data){
   if(buffer)
-    gdk_pixmap_unref(buffer);
+    g_object_unref (G_OBJECT (buffer));
   if(tiles_pixmap)
-    gdk_pixmap_unref(tiles_pixmap);
+    g_object_unref (G_OBJECT (tiles_pixmap));
 
   gtk_main_quit();
-}
-
-static char *nstr(int n){
-  char buf[20]; sprintf(buf, "%d", n);
-  return strdup(buf);
-}
-
-static int save_state(GnomeClient *client,gint phase, 
-                      GnomeRestartStyle save_style, gint shutdown,
-                      GnomeInteractStyle interact_style, gint fast,
-                      gpointer client_data){
-  char *argv[20];
-  int i;
-  gint xpos, ypos;
-  
-  gdk_window_get_origin(window->window, &xpos, &ypos);
-  
-  i = 0;
-  argv[i++] = (char *)client_data;
-  argv[i++] = "-x";
-  argv[i++] = nstr(xpos);
-  argv[i++] = "-y";
-  argv[i++] = nstr(ypos);
-  
-  gnome_client_set_restart_command(client, i, argv);
-  gnome_client_set_clone_command(client, 0, NULL);
-  
-  free(argv[2]);
-  free(argv[4]);
-  return TRUE;
 }
 
 void level_cb(GtkWidget *widget, gpointer data){


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