[banshee] Improve the import media dialog



commit b48853c426589bfee7894d4ab6147cb3b45a6ca7
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Sep 30 17:41:08 2009 -0700

    Improve the import media dialog
    
    Change the default import button text to just "Import", and if the
    importer has a non-null ImportLabel use that instead, eg "Choose
    Folders" for the folder import source.  Fixes BGO #559013.
    
    Get rid of the dialog's Title since it's duplicated in the body.

 .../Banshee.Library.Gui/ImportDialog.cs            |   16 ++++++++++++++--
 .../Resources/banshee-dialogs.glade                |    6 +++---
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
index 3a05602..118b8f2 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
@@ -31,6 +31,8 @@ using System.Collections.Generic;
 using Gtk;
 using Glade;
 
+using Mono.Unix;
+
 using Banshee.Sources;
 using Banshee.ServiceStack;
 using Banshee.Gui;
@@ -43,6 +45,7 @@ namespace Banshee.Library.Gui
         private ComboBox source_combo_box;
         private ListStore source_model;
         private AccelGroup accel_group;
+        private Button import_button;
 
         [Widget] private Gtk.Label choose_label;
 
@@ -58,9 +61,11 @@ namespace Banshee.Library.Gui
                 Dialog.TransientFor = ServiceManager.Get<GtkElementsService> ().PrimaryWindow;
             }
             
+            Dialog.WidthRequest = 400;
             Dialog.WindowPosition = WindowPosition.CenterOnParent;
             Dialog.AddAccelGroup (accel_group);
             Dialog.DefaultResponse = ResponseType.Ok;
+            import_button = (Glade["ImportButton"] as Button);
 
             DoNotShowAgainVisible = doNotShowAgainVisible;
             
@@ -72,19 +77,26 @@ namespace Banshee.Library.Gui
             
             Glade["MessageLabel"].Visible = ServiceManager.SourceManager.DefaultSource.Count == 0;
             
-            (Glade["ImportButton"] as Button).AddAccelerator ("activate", accel_group, 
-                (uint)Gdk.Key.Return, 0, AccelFlags.Visible);
+            import_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return, 0, AccelFlags.Visible);
             
             Dialog.StyleSet += delegate {
                 UpdateIcons ();
             };
         }
+
+        private void UpdateImportLabel ()
+        {
+            string label = ActiveSource == null ? null : ActiveSource.ImportLabel;
+            import_button.Label = label ?? Catalog.GetString ("_Import");
+            import_button.WidthRequest = Math.Max (import_button.WidthRequest, 140);
+        }
         
         private void PopulateSourceList ()
         {
             source_model = new ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (IImportSource));
             
             source_combo_box = new ComboBox ();
+            source_combo_box.Changed += delegate { UpdateImportLabel (); };
             source_combo_box.Model = source_model;
             choose_label.MnemonicWidget = source_combo_box;
             
diff --git a/src/Core/Banshee.ThickClient/Resources/banshee-dialogs.glade b/src/Core/Banshee.ThickClient/Resources/banshee-dialogs.glade
index c1ebf94..7fd9816 100644
--- a/src/Core/Banshee.ThickClient/Resources/banshee-dialogs.glade
+++ b/src/Core/Banshee.ThickClient/Resources/banshee-dialogs.glade
@@ -4,7 +4,7 @@
 <glade-interface>
   <widget class="GtkDialog" id="ImportDialog">
     <property name="border_width">12</property>
-    <property name="title" translatable="yes">Import Media to Library</property>
+    <property name="title" translatable="no"></property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
     <property name="window_position">GTK_WIN_POS_CENTER</property>
@@ -57,7 +57,7 @@
                   <widget class="GtkLabel" id="choose_label">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Choose an import _source:</property>
+                    <property name="label" translatable="yes">Import _from:</property>
                     <property name="use_underline">True</property>
                   </widget>
                   <packing>
@@ -131,7 +131,7 @@
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="has_default">True</property>
-                <property name="label" translatable="yes">I_mport Media Source</property>
+                <property name="label" translatable="no">Import</property>
                 <property name="use_underline">True</property>
                 <property name="response_id">-5</property>
               </widget>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]