diff options
Diffstat (limited to 'libcaja-private/caja-bookmark.c')
| -rw-r--r-- | libcaja-private/caja-bookmark.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c index 587e8cc9..cbcec80a 100644 --- a/libcaja-private/caja-bookmark.c +++ b/libcaja-private/caja-bookmark.c @@ -274,11 +274,13 @@ char * caja_bookmark_get_uri (CajaBookmark *bookmark) { GFile *file; - char *uri; + char *uri = NULL; - file = caja_bookmark_get_location (bookmark); - uri = g_file_get_uri (file); - g_object_unref (file); + if ((file = caja_bookmark_get_location (bookmark)) != NULL) + { + uri = g_file_get_uri (file); + g_object_unref (file); + } return uri; } @@ -330,7 +332,7 @@ caja_bookmark_icon_is_different (CajaBookmark *bookmark, return TRUE; } - return !g_icon_equal (bookmark->details->icon, new_icon) != 0; + return !g_icon_equal (bookmark->details->icon, new_icon); } /** @@ -585,20 +587,6 @@ caja_bookmark_new (GFile *location, const char *name, gboolean has_custom_name, return new_bookmark; } -static cairo_surface_t * -create_image_cairo_for_bookmark (CajaBookmark *bookmark) -{ - cairo_surface_t *surface; - - surface = caja_bookmark_get_surface (bookmark, GTK_ICON_SIZE_MENU); - if (surface == NULL) - { - return NULL; - } - - return surface; -} - static GtkWidget * bookmark_image_menu_item_new_from_surface (cairo_surface_t *icon_surface, const gchar *label_name) @@ -644,20 +632,24 @@ bookmark_image_menu_item_new_from_surface (cairo_surface_t *icon_surface, GtkWidget * caja_bookmark_menu_item_new (CajaBookmark *bookmark) { - cairo_surface_t *image_cairo; - - image_cairo = create_image_cairo_for_bookmark (bookmark); + GtkWidget *menu_item = NULL; if (strlen (bookmark->details->name) > 0) { - GtkWidget *menu_item; - - menu_item = bookmark_image_menu_item_new_from_surface (image_cairo, bookmark->details->name); - - return menu_item; + cairo_surface_t *surface; + + surface = + caja_bookmark_get_surface (bookmark, + GTK_ICON_SIZE_MENU); + menu_item = + bookmark_image_menu_item_new_from_surface (surface, + bookmark->details->name); + if (surface != NULL) + { + cairo_surface_destroy (surface); + } } - else - return NULL; + return menu_item; } gboolean |
