[gnome-desktop/mcatanzaro/mr47-followup: 1/2] Go back to a filename parameter for GnomeBGSlideShow



commit f382fba9ed98f6afaaea1099994f170f2f76a05f
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Jul 18 15:26:23 2019 -0500

    Go back to a filename parameter for GnomeBGSlideShow
    
    I think GFile works well for the property, but not for the new function.
    There's not much value in forcing API users to create a GFile
    themselves, and if you already have a GFile it's trivial to get the
    filename from it. Also, we forgot the (transfer none) annotation on the
    parameter.

 libgnome-desktop/gnome-bg-slide-show.c | 14 +++++++++++---
 libgnome-desktop/gnome-bg-slide-show.h |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg-slide-show.c b/libgnome-desktop/gnome-bg-slide-show.c
index 6c107ba1..bc42e5cc 100644
--- a/libgnome-desktop/gnome-bg-slide-show.c
+++ b/libgnome-desktop/gnome-bg-slide-show.c
@@ -229,7 +229,7 @@ gnome_bg_slide_show_init (GnomeBGSlideShow *self)
 
 /**
  * gnome_bg_slide_show_new:
- * @file: The #GFile of the slide show
+ * @filename: The filename of the slide show
  *
  * Creates a new object to manage a slide show.
  * window background between two #cairo_surface_ts.
@@ -237,11 +237,19 @@ gnome_bg_slide_show_init (GnomeBGSlideShow *self)
  * Return value: the new #GnomeBGSlideShow
  **/
 GnomeBGSlideShow *
-gnome_bg_slide_show_new (GFile *file)
+gnome_bg_slide_show_new (const char *filename)
 {
-        return GNOME_BG_SLIDE_SHOW (g_object_new (GNOME_BG_TYPE_SLIDE_SHOW,
+       GFile *file;
+       GnomeBGSlideShow *self;
+
+       file = g_file_new_for_path (filename);
+
+        self = GNOME_BG_SLIDE_SHOW (g_object_new (GNOME_BG_TYPE_SLIDE_SHOW,
                                                   "file", file,
                                                   NULL));
+       g_object_unref (file);
+
+       return self;
 }
 
 static void
diff --git a/libgnome-desktop/gnome-bg-slide-show.h b/libgnome-desktop/gnome-bg-slide-show.h
index 4c3be7b8..bcf17137 100644
--- a/libgnome-desktop/gnome-bg-slide-show.h
+++ b/libgnome-desktop/gnome-bg-slide-show.h
@@ -59,7 +59,7 @@ struct _GnomeBGSlideShowClass
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GnomeBGSlideShow, g_object_unref)
 
 GType             gnome_bg_slide_show_get_type (void);
-GnomeBGSlideShow *gnome_bg_slide_show_new (GFile *file);
+GnomeBGSlideShow *gnome_bg_slide_show_new (const char *filename);
 gboolean          gnome_bg_slide_show_load (GnomeBGSlideShow  *self,
                                             GError           **error);
 


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