commit 68b60ca5877a2aeb978a3c0fc3c6518c31dc6220
Author: Daniele Forsi <dani...@forsi.it>
Date:   Thu Jul 12 14:03:21 2012 +0200

    Do not accept empty names for smart playlists
    
    Make the "Save" button insensitive if the name is empty.

 plugins/playlist_display/playlist_display_spl.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/plugins/playlist_display/playlist_display_spl.c 
b/plugins/playlist_display/playlist_display_spl.c
index c131c35..695e396 100644
--- a/plugins/playlist_display/playlist_display_spl.c
+++ b/plugins/playlist_display/playlist_display_spl.c
@@ -336,6 +336,14 @@ static void spl_set_combobox(GtkComboBox *cb, const 
ComboEntry centries[], guint
 
 }
 
+static void spl_name_entry_changed(GtkEntry *entry, GtkWidget *button) {
+    g_return_if_fail (button);
+    if (gtk_entry_get_text_length (entry) >= 1)
+        gtk_widget_set_sensitive(button, TRUE);
+    else
+        gtk_widget_set_sensitive(button, FALSE);
+}
+
 static void spl_matchcheckedonly_toggled(GtkToggleButton *togglebutton, 
GtkWidget *spl_window) {
     Playlist *spl;
 
@@ -1386,6 +1394,9 @@ static void spl_edit_all(iTunesDB *itdb, Playlist *spl, 
gint32 pos) {
 
     /* Set checkboxes and connect signal handlers */
     if ((w = gtkpod_builder_xml_get_widget(spl_wizard->builder, 
"spl_name_entry"))) {
+        g_signal_connect (w, "changed",
+                G_CALLBACK (spl_name_entry_changed),
+                gtkpod_builder_xml_get_widget(spl_wizard->builder, 
"spl_ok_button"));
         if (spl_dup->name)
             gtk_entry_set_text(GTK_ENTRY (w), spl_dup->name);
     }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to