[totem/wip/hadess/print-playlist-metadata] playlist: Add "print metadata" button in debug dialogue
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/print-playlist-metadata] playlist: Add "print metadata" button in debug dialogue
- Date: Fri, 10 Apr 2020 13:52:12 +0000 (UTC)
commit e4684fc0b07f77eae75892d007ff0fe036afbc85
Author: Bastien Nocera <hadess hadess net>
Date: Fri Apr 10 15:50:16 2020 +0200
playlist: Add "print metadata" button in debug dialogue
data/playlist.ui | 15 +++++++++++++++
src/totem-playlist.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
---
diff --git a/data/playlist.ui b/data/playlist.ui
index 54a743441..5f12c3f44 100644
--- a/data/playlist.ui
+++ b/data/playlist.ui
@@ -106,6 +106,21 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkToolButton" id="print_metadata_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">document-print-symbolic</property>
+ <signal name="clicked" handler="print_metadata_action_callback"/>
+ <property name="tooltip-text" translatable="no">Print Metadata</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
<child>
<object class="GtkToolButton" id="select_subtitle_button">
<property name="visible">True</property>
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 3b5c49e5f..95564c31e 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -55,6 +55,7 @@ G_MODULE_EXPORT void totem_playlist_add_files (GtkWidget *widget, TotemPlaylist
G_MODULE_EXPORT void playlist_remove_button_clicked (GtkWidget *button, TotemPlaylist *playlist);
G_MODULE_EXPORT void playlist_copy_location_action_callback (GtkWidget *button, TotemPlaylist *playlist);
G_MODULE_EXPORT void playlist_select_subtitle_action_callback (GtkWidget *button, TotemPlaylist *playlist);
+G_MODULE_EXPORT void print_metadata_action_callback (GtkWidget *button, TotemPlaylist *playlist);
typedef struct {
@@ -403,6 +404,45 @@ gtk_tree_selection_has_selected (GtkTreeSelection *selection)
return retval;
}
+void
+print_metadata_action_callback (GtkWidget *button, TotemPlaylist *playlist)
+{
+ GList *rows, *l;
+ guint i;
+
+ rows = gtk_tree_selection_get_selected_rows (playlist->priv->selection, NULL);
+ if (rows == NULL)
+ return;
+
+ i = 0;
+ for (l = rows; l != NULL; l = l->next) {
+ g_autofree char *url = NULL;
+ g_autofree char *sub_url = NULL;
+ gboolean playing;
+ GtkTreeIter iter;
+
+ gtk_tree_model_get_iter (playlist->priv->model, &iter, l->data);
+ gtk_tree_model_get (playlist->priv->model,
+ &iter,
+ PLAYING_COL, &playing,
+ URI_COL, &url,
+ SUBTITLE_URI_COL, &sub_url,
+ -1);
+
+ g_print ("Item #%d\n", i);
+ if (playing)
+ g_print ("\tPlaying\n");
+ g_print ("\tURI: %s\n", url);
+ if (sub_url)
+ g_print ("\tSubtitle URI: %s\n", sub_url);
+
+ gtk_tree_path_free (l->data);
+ i++;
+ }
+
+ g_list_free (rows);
+}
+
void
playlist_select_subtitle_action_callback (GtkWidget *button, TotemPlaylist *playlist)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]