Re: [patch] gnotski with G*DISABLE_DEPRECATED - damn!



On Tue, Jan 15, 2002 at 11:21:28PM +0100, Markus Bertheau wrote:
>  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);
>  }

No need to use ret_locations if you aren't going to use them, in fact the
above leaks a bit.  Just pass NULL instead to gnome_program_locate_file.

George

-- 
George <jirka 5z com>
   A clever man commits no minor blunders.
                       -- Goethe



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