Re: [Gimp-developer] multiple instances of splash winners

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

 





Note/Disclaimer: I am *not* suggesting adding this "feature" into gimp. And please don't tell me I am doing something wrong or stupid or degrading gimp in any way or form.


I like many of the splash screens submitted, so I select a random one at startup. If you wish to do the same,


 - create a "gimp-splash" subdirectory under ~/.gimp-2.2
 - place all your favorites there
 - Apply the included patch (patch -p1 < rand-splash.diff)
 - recompile gimp

-Joseph
*** gimp-2.2-pre2/app/gui/splash.c            2004-12-13 08:46:25.000000000 +1300
--- gimp-2.2-pre2s/app/gui/splash.c	2004-12-13 08:46:25.000000000 +1300
***************
*** 74,92 ****
  
    g_return_if_fail (splash == NULL);
  
!   filename = gimp_personal_rc_file ("gimp-splash.png");
!   pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
!   g_free (filename);
! 
!   if (! pixbuf)
!     {
!       filename = g_build_filename (gimp_data_directory (),
!                                    "images", "gimp-splash.png",
!                                    NULL);
        pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
!       g_free (filename);
      }
  
    if (! pixbuf)
      return;
  
--- 74,119 ----
  
    g_return_if_fail (splash == NULL);
  
!   {
!     int nFiles = 0;
!     GError* err;
!     const char* folder = gimp_personal_rc_file("gimp-splash");
!     GDir* d = g_dir_open(folder, 0, &err);
! 
!     filename = 0;
!     if( d ) {
!       srandom(time(NULL));
!       G_CONST_RETURN gchar* name;
!       while( (name = g_dir_read_name(d)) ) {
! 	if( (random() % (nFiles+1)) == 0 ) {
! 	  filename = g_build_filename(folder, name, NULL);
! 	}
! 	++nFiles;
!       }
!       g_dir_close(d);
!     }
!     
!     if( filename ) {
        pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
!       g_free(filename);
      }
+   }
  
+   if (!pixbuf ) {
+     filename = gimp_personal_rc_file ("gimp-splash.png");
+     pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+     g_free (filename);
+ 
+     if (! pixbuf)
+       {
+ 	filename = g_build_filename (gimp_data_directory (),
+ 				     "images", "gimp-splash.png",
+ 				     NULL);
+ 	pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ 	g_free (filename);
+       }
+   }
+   
    if (! pixbuf)
      return;
  

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux