[frogr] Renamed frogr_util_open_images_in_viewer to frogr_util_open_pictures_in_viewer, make it accept a lis
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Renamed frogr_util_open_images_in_viewer to frogr_util_open_pictures_in_viewer, make it accept a lis
- Date: Sun, 4 Nov 2012 21:47:07 +0000 (UTC)
commit 9511560f927e24e78f71c06733a1b4aa7f37e0cc
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Sat Nov 3 13:27:23 2012 +0100
Renamed frogr_util_open_images_in_viewer to frogr_util_open_pictures_in_viewer,
make it accept a list of pictures instead of uris and make it choose
the proper app_info for images and videos.
src/frogr-details-dialog.c | 13 +------------
src/frogr-main-view.c | 12 +-----------
src/frogr-util.c | 24 +++++++++++++++++++++---
src/frogr-util.h | 2 +-
4 files changed, 24 insertions(+), 27 deletions(-)
---
diff --git a/src/frogr-details-dialog.c b/src/frogr-details-dialog.c
index f4f9c1b..eac111a 100644
--- a/src/frogr-details-dialog.c
+++ b/src/frogr-details-dialog.c
@@ -1060,18 +1060,7 @@ static void
_on_picture_button_clicked (GtkButton *button, gpointer data)
{
FrogrDetailsDialogPrivate *priv = FROGR_DETAILS_DIALOG_GET_PRIVATE (data);
- GSList *current_pic = NULL;
- GList *uris_list = NULL;
- FrogrPicture *picture = NULL;
-
- for (current_pic = priv->pictures; current_pic; current_pic = g_slist_next (current_pic))
- {
- picture = FROGR_PICTURE (current_pic->data);
- uris_list = g_list_append (uris_list, g_strdup (frogr_picture_get_fileuri (picture)));
- }
-
- /* This function will already free the list and its elements */
- frogr_util_open_images_in_viewer (uris_list);
+ frogr_util_open_pictures_in_viewer (priv->pictures);
}
static void
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index acf0fa4..9dac16a 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -1052,23 +1052,13 @@ static void
_open_pictures_in_external_viewer (FrogrMainView *self)
{
GSList *pictures = NULL;
- GSList *current_pic = NULL;
- GList *uris_list = NULL;
- FrogrPicture *picture = NULL;
if (!_pictures_selected_required_check (self))
return;
pictures = _get_selected_pictures (self);
- for (current_pic = pictures; current_pic; current_pic = g_slist_next (current_pic))
- {
- picture = FROGR_PICTURE (current_pic->data);
- uris_list = g_list_append (uris_list, g_strdup (frogr_picture_get_fileuri (picture)));
- }
+ frogr_util_open_pictures_in_viewer (pictures);
g_slist_free (pictures);
-
- /* This function will already free the list and its elements */
- frogr_util_open_images_in_viewer (uris_list);
}
static void
diff --git a/src/frogr-util.c b/src/frogr-util.c
index 5584473..0cf857c 100644
--- a/src/frogr-util.c
+++ b/src/frogr-util.c
@@ -20,6 +20,7 @@
* GPL version 2 or later (Copyright (C) <2007> Wim Taymans <wim taymans gmail com>)
*/
+#include "frogr-picture.h"
#include "frogr-util.h"
#include "frogr-global-defs.h"
@@ -197,15 +198,32 @@ frogr_util_open_uri (const gchar *uri)
}
void
-frogr_util_open_images_in_viewer (GList *uris_list)
+frogr_util_open_pictures_in_viewer (GSList *pictures)
{
GAppInfo *app_info = NULL;
+ GList *uris_list = NULL;
+ GSList *current_pic = NULL;
+ FrogrPicture *picture = NULL;
/* Early return */
- if (!uris_list)
+ if (!pictures)
return;
- app_info = g_app_info_get_default_for_type ("image/jpg", TRUE);
+ for (current_pic = pictures; current_pic; current_pic = g_slist_next (current_pic))
+ {
+ picture = FROGR_PICTURE (current_pic->data);
+ uris_list = g_list_append (uris_list, g_strdup (frogr_picture_get_fileuri (picture)));
+ }
+
+ /* We currently choose the application based in the mime type of the
+ first picture. This is very basic, but probably good enough for now */
+ picture = FROGR_PICTURE (pictures->data);
+ if (frogr_picture_is_video (picture))
+ app_info = g_app_info_get_default_for_type ("video/mpeg", TRUE);
+ else
+ app_info = g_app_info_get_default_for_type ("image/jpg", TRUE);
+
+ /* uris_list will be freed inside of the function */
_open_uris_with_app_info (uris_list, app_info);
}
diff --git a/src/frogr-util.h b/src/frogr-util.h
index ffb74ca..1d68f8d 100644
--- a/src/frogr-util.h
+++ b/src/frogr-util.h
@@ -33,7 +33,7 @@ const gchar *frogr_util_get_locale_dir (void);
void frogr_util_open_uri (const gchar *uri);
-void frogr_util_open_images_in_viewer (GList *uris_list);
+void frogr_util_open_pictures_in_viewer (GSList *pictures);
void frogr_util_show_info_dialog (GtkWindow *parent, const gchar *message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]