[Xfce4-commits] <parole:master> Add playlist-count-label
Simon Steinbeiss
noreply at xfce.org
Thu Feb 21 14:44:02 CET 2013
Updating branch refs/heads/master
to 947755875843226f65e560ca699463b2d0a40e32 (commit)
from 9acc65a09bd430deb4d34f03c29524bca0db1a66 (commit)
commit 947755875843226f65e560ca699463b2d0a40e32
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Thu Feb 21 14:43:26 2013 +0100
Add playlist-count-label
data/interfaces/playlist.ui | 15 ++++++++++++++-
src/parole-medialist.c | 11 ++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/data/interfaces/playlist.ui b/data/interfaces/playlist.ui
index 898fd26..31d0449 100644
--- a/data/interfaces/playlist.ui
+++ b/data/interfaces/playlist.ui
@@ -243,6 +243,19 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="n_items">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Playlist empty</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHBox" id="playlist_controls">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -356,7 +369,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">2</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 227b2f9..53bf4f6 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -200,6 +200,7 @@ struct ParoleMediaListPrivate
GtkWidget *repeat_button;
GtkWidget *shuffle_button;
GtkWidget *settings_button;
+ GtkWidget *n_items;
};
enum
@@ -254,6 +255,7 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean disc, g
GtkTreeRowReference *row;
GtkTreeIter iter;
gint nch;
+ gchar *n_items_text = "Playlist empty";
if (disc)
list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->disc_view)));
@@ -300,7 +302,9 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean disc, g
}
else
parole_media_list_set_widget_sensitive (list, TRUE);
-
+ if ( nch != 0 )
+ n_items_text = g_strdup_printf ("%i items",nch);
+ gtk_label_set_text (GTK_LABEL(list->priv->n_items),n_items_text);
}
/**
@@ -969,12 +973,15 @@ parole_media_list_remove_clicked_cb (GtkButton *button, ParoleMediaList *list)
if ( nch == 0)
{
parole_media_list_set_widget_sensitive (list, FALSE);
+ gtk_label_set_text (GTK_LABEL(list->priv->n_items),"Playlist empty");
/*
* Will emit the signal media_cursor_changed with FALSE because there is no any
* row remaining, so the player can disable click on the play button.
*/
g_signal_emit (G_OBJECT (list), signals [MEDIA_CURSOR_CHANGED], 0, FALSE);
}
+
+ gtk_label_set_text (GTK_LABEL(list->priv->n_items),g_strdup_printf ("%i items",nch));
}
/**
@@ -1107,6 +1114,7 @@ parole_media_list_clear_list (ParoleMediaList *list)
TRACE("CLEAR START");
gtk_list_store_clear (GTK_LIST_STORE (list->priv->store));
parole_media_list_set_widget_sensitive (list, FALSE);
+ gtk_label_set_text (GTK_LABEL(list->priv->n_items),"Playlist empty");
TRACE("CLEAR END");
}
@@ -1693,6 +1701,7 @@ parole_media_list_init (ParoleMediaList *list)
list->priv->repeat_button = GTK_WIDGET (gtk_builder_get_object (builder, "repeat-media"));
list->priv->shuffle_button = GTK_WIDGET (gtk_builder_get_object (builder, "shuffle-media"));
list->priv->settings_button = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
+ list->priv->n_items = GTK_WIDGET (gtk_builder_get_object (builder, "n_items"));
g_signal_connect (GTK_TOGGLE_BUTTON(list->priv->settings_button), "toggled",
G_CALLBACK (parole_media_list_show_button_menu), list);
More information about the Xfce4-commits
mailing list