File removi-GIO-in-splash.patch of Package gimp
diff -ur a/app/gui/splash.c b/app/gui/splash.c
--- a/app/gui/splash.c 2018-11-08 16:58:41.000000000 +0300
+++ b/app/gui/splash.c 2018-11-09 22:33:10.114063375 +0300
@@ -87,17 +87,12 @@
gint max_height,
gboolean be_verbose);
static GdkPixbufAnimation *
- splash_image_load_from_path (const gchar *filename,
+ splash_image_load_from_file (const gchar *filename,
gint max_width,
gint max_height,
gboolean be_verbose);
static GdkPixbufAnimation *
- splash_image_load_from_file (GFile *file,
- gint max_width,
- gint max_height,
- gboolean be_verbose);
-static GdkPixbufAnimation *
- splash_image_pick_from_dirs (GList *dirs,
+ splash_image_pick_from_dir (const gchar *dirname,
gint max_width,
gint max_height,
gboolean be_verbose);
@@ -483,18 +478,16 @@
}
static GdkPixbufAnimation *
-splash_image_load (gint max_width,
- gint max_height,
- gboolean be_verbose)
+splash_image_load (gint max_width,
+ gint max_height,
+ gboolean be_verbose)
{
GdkPixbufAnimation *animation = NULL;
gchar *filename;
- GFile *file;
- GList *list;
/* File "gimp-splash.png" in personal configuration directory. */
filename = gimp_personal_rc_file ("gimp-splash.png");
- animation = splash_image_load_from_path (filename,
+ animation = splash_image_load_from_file (filename,
max_width, max_height,
be_verbose);
g_free (filename);
@@ -503,21 +496,17 @@
/* Random image under splashes/ directory in personal config dir. */
filename = gimp_personal_rc_file ("splashes");
- file = g_file_new_for_path (filename);
+ animation = splash_image_pick_from_dir (filename,
+ max_width, max_height,
+ be_verbose);
g_free (filename);
- list = NULL;
- list = g_list_prepend (list, file);
- animation = splash_image_pick_from_dirs (list,
- max_width, max_height,
- be_verbose);
- g_list_free_full (list, g_object_unref);
if (animation)
return animation;
/* Release splash image. */
filename = g_build_filename (gimp_data_directory (),
"images", "gimp-splash.png", NULL);
- animation = splash_image_load_from_path (filename,
+ animation = splash_image_load_from_file (filename,
max_width, max_height,
be_verbose);
g_free (filename);
@@ -526,58 +515,29 @@
/* Random release image in installed splashes/ directory. */
filename = g_build_filename (gimp_data_directory (), "splashes", NULL);
- file = g_file_new_for_path (filename);
+ animation = splash_image_pick_from_dir (filename,
+ max_width, max_height,
+ be_verbose);
g_free (filename);
- list = NULL;
- list = g_list_prepend (list, file);
- animation = splash_image_pick_from_dirs (list,
- max_width, max_height,
- be_verbose);
- g_list_free_full (list, g_object_unref);
return animation;
}
static GdkPixbufAnimation *
-splash_image_load_from_path (const gchar *filename,
+splash_image_load_from_file (const gchar *filename,
gint max_width,
gint max_height,
gboolean be_verbose)
{
GdkPixbufAnimation *animation;
GFile *file;
-
- file = g_file_new_for_path (filename);
- animation = splash_image_load_from_file (file,
- max_width, max_height,
- be_verbose);
- g_object_unref (file);
-
- return animation;
-}
-
-static GdkPixbufAnimation *
-splash_image_load_from_file (GFile *file,
- gint max_width,
- gint max_height,
- gboolean be_verbose)
-{
- GdkPixbufAnimation *animation = NULL;
GFileInfo *info;
- GFileInputStream *input;
gboolean is_svg = FALSE;
if (be_verbose)
- {
- gchar *path;
-
- path = g_file_get_path (file);
-
- g_printerr ("Trying splash '%s' ... ", path);
-
- g_free (path);
- }
+ g_printerr ("Trying splash '%s' ... ", filename);
+ file = g_file_new_for_path (filename);
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
@@ -609,14 +569,9 @@
}
g_object_unref (info);
}
+ g_object_unref (file);
- input = g_file_read (file, NULL, NULL);
- if (input)
- {
- animation = gdk_pixbuf_animation_new_from_stream (G_INPUT_STREAM (input),
- NULL, NULL);
- g_object_unref (input);
- }
+ animation = gdk_pixbuf_animation_new_from_file (filename, NULL);
/* FIXME Right now, we only try to scale static images.
* Animated images may end up bigger than the expected max dimensions.
@@ -628,11 +583,9 @@
{
GdkPixbuf *pixbuf;
- input = g_file_read (file, NULL, NULL);
- pixbuf = gdk_pixbuf_new_from_stream_at_scale (G_INPUT_STREAM (input),
- max_width, max_height,
- TRUE, NULL, NULL);
- g_object_unref (input);
+ pixbuf = gdk_pixbuf_new_from_file_at_size (filename,
+ max_width, max_height,
+ NULL);
if (pixbuf)
{
GdkPixbufSimpleAnim *simple_anim = NULL;
@@ -658,55 +611,39 @@
}
static GdkPixbufAnimation *
-splash_image_pick_from_dirs (GList *dirs,
- gint max_width,
- gint max_height,
- gboolean be_verbose)
+splash_image_pick_from_dir (const gchar *dirname,
+ gint max_width,
+ gint max_height,
+ gboolean be_verbose)
{
GdkPixbufAnimation *animation = NULL;
- GList *splashes = NULL;
- GList *iter;
+ GDir *dir = g_dir_open (dirname, 0, NULL);
- for (iter = dirs; iter; iter = iter->next)
+ if (dir)
{
- GFileEnumerator *enumerator;
+ const gchar *entry;
+ GList *splashes = NULL;
- enumerator = g_file_enumerate_children (iter->data,
- G_FILE_ATTRIBUTE_STANDARD_NAME ","
- G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN ","
- G_FILE_ATTRIBUTE_TIME_MODIFIED,
- G_FILE_QUERY_INFO_NONE,
- NULL, NULL);
- if (enumerator)
- {
- GFileInfo *info;
+ while ((entry = g_dir_read_name (dir)))
+ splashes = g_list_prepend (splashes, g_strdup (entry));
- while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)))
- {
- GFile *child;
+ g_dir_close (dir);
- child = g_file_enumerator_get_child (enumerator, info);
- if (g_file_query_file_type (child,
- G_FILE_QUERY_INFO_NONE,
- NULL) == G_FILE_TYPE_REGULAR)
- splashes = g_list_prepend (splashes, child);
- else
- g_object_unref (child);
- g_object_unref (info);
- }
+ if (splashes)
+ {
+ gint32 i = g_random_int_range (0, g_list_length (splashes));
+ gchar *filename = g_build_filename (dirname,
+ g_list_nth_data (splashes, i),
+ NULL);
+
+ animation = splash_image_load_from_file (filename,
+ max_width, max_height,
+ be_verbose);
+ g_free (filename);
+ g_list_free_full (splashes, (GDestroyNotify) g_free);
}
}
- if (splashes)
- {
- gint32 i = g_random_int_range (0, g_list_length (splashes));
-
- animation = splash_image_load_from_file (g_list_nth_data (splashes, i),
- max_width, max_height,
- be_verbose);
- g_list_free_full (splashes, (GDestroyNotify) g_object_unref);
- }
-
return animation;
}
Только в b/app/gui: splash.c.orig