[totem] main: Split getting title and content-type
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] main: Split getting title and content-type
- Date: Sat, 14 Jul 2012 23:26:17 +0000 (UTC)
commit 1b2d2a3f17e07046d14c27f8ab3a852d09e773e8
Author: Bastien Nocera <hadess hadess net>
Date: Sat Jul 14 23:50:30 2012 +0100
main: Split getting title and content-type
We used to have a single function returning both.
src/totem-object.c | 7 ++++---
src/totem-playlist.c | 48 +++++++++++++++++++++++++++++++-----------------
src/totem-playlist.h | 4 ++--
3 files changed, 37 insertions(+), 22 deletions(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index aee5915..030407a 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -723,7 +723,7 @@ totem_object_get_title_at_playlist_pos (TotemObject *totem, guint playlist_index
char *
totem_get_short_title (TotemObject *totem)
{
- return totem_playlist_get_current_title (totem->playlist, NULL);
+ return totem_playlist_get_current_title (totem->playlist);
}
/**
@@ -1792,7 +1792,8 @@ totem_action_set_mrl_with_warning (TotemObject *totem,
source_table, G_N_ELEMENTS (source_table),
GDK_ACTION_COPY);
- display_name = totem_playlist_get_current_title (totem->playlist, &content_type);
+ display_name = totem_playlist_get_current_title (totem->playlist);
+ content_type = totem_playlist_get_current_content_type (totem->playlist);
totem_action_add_recent (totem, totem->mrl, display_name, content_type);
g_free (display_name);
g_free (content_type);
@@ -2419,7 +2420,7 @@ on_playlist_change_name (TotemPlaylist *playlist, TotemObject *totem)
{
char *name;
- name = totem_playlist_get_current_title (playlist, NULL);
+ name = totem_playlist_get_current_title (playlist);
if (name != NULL) {
update_mrl_label (totem, name);
g_free (name);
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index f858617..4adc727 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -2500,10 +2500,10 @@ totem_playlist_get_current_mrl (TotemPlaylist *playlist, char **subtitle)
}
char *
-totem_playlist_get_current_title (TotemPlaylist *playlist, char **content_type)
+totem_playlist_get_current_title (TotemPlaylist *playlist)
{
GtkTreeIter iter;
- char *path;
+ char *title;
g_return_val_if_fail (TOTEM_IS_PLAYLIST (playlist), NULL);
@@ -2511,23 +2511,37 @@ totem_playlist_get_current_title (TotemPlaylist *playlist, char **content_type)
return NULL;
gtk_tree_model_get_iter (playlist->priv->model,
- &iter,
- playlist->priv->current);
+ &iter,
+ playlist->priv->current);
- if (content_type != NULL) {
- gtk_tree_model_get (playlist->priv->model,
- &iter,
- FILENAME_COL, &path,
- MIME_TYPE_COL, content_type,
- -1);
- } else {
- gtk_tree_model_get (playlist->priv->model,
- &iter,
- FILENAME_COL, &path,
- -1);
- }
+ gtk_tree_model_get (playlist->priv->model,
+ &iter,
+ FILENAME_COL, &title,
+ -1);
+ return title;
+}
- return path;
+char *
+totem_playlist_get_current_content_type (TotemPlaylist *playlist)
+{
+ GtkTreeIter iter;
+ char *content_type;
+
+ g_return_val_if_fail (TOTEM_IS_PLAYLIST (playlist), NULL);
+
+ if (update_current_from_playlist (playlist) == FALSE)
+ return NULL;
+
+ gtk_tree_model_get_iter (playlist->priv->model,
+ &iter,
+ playlist->priv->current);
+
+ gtk_tree_model_get (playlist->priv->model,
+ &iter,
+ MIME_TYPE_COL, &content_type,
+ -1);
+
+ return content_type;
}
char *
diff --git a/src/totem-playlist.h b/src/totem-playlist.h
index e8544b9..008886c 100644
--- a/src/totem-playlist.h
+++ b/src/totem-playlist.h
@@ -130,8 +130,8 @@ void totem_playlist_clear_with_g_mount (TotemPlaylist *playlist,
GMount *mount);
char *totem_playlist_get_current_mrl (TotemPlaylist *playlist,
char **subtitle);
-char *totem_playlist_get_current_title (TotemPlaylist *playlist,
- char **content_type);
+char *totem_playlist_get_current_title (TotemPlaylist *playlist);
+char *totem_playlist_get_current_content_type (TotemPlaylist *playlist);
char *totem_playlist_get_title (TotemPlaylist *playlist,
guint title_index);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]