commit 4721fefd22bf2e77138750fb0566f43b95a04cdb
Author: phantomjinx <p.g.richard...@phantomjinx.co.uk>
Date:   Sun Mar 6 14:34:52 2011 +0000

    Add extra action to load a selected ipod
    
    * With more than one iPod, it is annoying to click load iPods only to find
      that all iPods try to be loaded rather than just the selected one.
    
    * Load iPod toolbar button modified to have a drop down that includes a
      "load selected ipod" menuitem as well as the "load all ipods".
    
    * Default of the button is still to load all ipods as most users will have
      just the one iPod

 .../playlist_display/playlist_display_actions.c    |    7 ++++++
 .../playlist_display/playlist_display_actions.h    |    1 +
 .../playlist_display/playlist_display_toolbar.xml  |    7 +++++-
 plugins/playlist_display/plugin.c                  |   21 ++++++++++++++++++++
 plugins/playlist_display/plugin.h                  |    3 ++
 5 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/plugins/playlist_display/playlist_display_actions.c 
b/plugins/playlist_display/playlist_display_actions.c
index 3f7bf34..4c50881 100644
--- a/plugins/playlist_display/playlist_display_actions.c
+++ b/plugins/playlist_display/playlist_display_actions.c
@@ -333,6 +333,13 @@ static void create_add_files_dialog(Playlist *pl) {
     gdk_threads_add_idle((GSourceFunc) fileselection_add_files_cb, names);
 }
 
+void on_load_ipod_mi(GtkAction *action, PlaylistDisplayPlugin* plugin) {
+    iTunesDB *itdb = gtkpod_get_current_itdb();
+    if (itdb != NULL) {
+        gp_load_ipod(itdb);
+    }
+}
+
 void on_load_ipods_mi(GtkAction* action, PlaylistDisplayPlugin* plugin) {
     gp_load_ipods();
 }
diff --git a/plugins/playlist_display/playlist_display_actions.h 
b/plugins/playlist_display/playlist_display_actions.h
index a7fd41d..20ced8c 100644
--- a/plugins/playlist_display/playlist_display_actions.h
+++ b/plugins/playlist_display/playlist_display_actions.h
@@ -36,6 +36,7 @@
 #include <gtk/gtk.h>
 #include "plugin.h"
 
+void on_load_ipod_mi(GtkAction* action, PlaylistDisplayPlugin* plugin);
 void on_load_ipods_mi(GtkAction* action, PlaylistDisplayPlugin* plugin);
 void on_save_changes(GtkAction *action, PlaylistDisplayPlugin* plugin);
 void on_create_add_files(GtkAction *action, PlaylistDisplayPlugin* plugin);
diff --git a/plugins/playlist_display/playlist_display_toolbar.xml 
b/plugins/playlist_display/playlist_display_toolbar.xml
index 35f6216..0498e64 100644
--- a/plugins/playlist_display/playlist_display_toolbar.xml
+++ b/plugins/playlist_display/playlist_display_toolbar.xml
@@ -1,6 +1,11 @@
 <ui>
        <toolbar name="PlaylistToolbar">
-               <toolitem name="Load iPod(s)" action="ActionLoadiPod" />
+               <toolitem name="Load iPod(s)" action="ActionDisplayLoadiPods">
+                       <menu name="LoadiPodMenu" action="ActionLoadiPodsMenu">
+                               <menuitem name="Load Selected iPod" 
action="ActionLoadiPod"/>
+                               <menuitem name="Load iPod(s)" 
action="ActionLoadiPods"/>
+                       </menu>
+               </toolitem>
                <toolitem name="Save Changes" action="ActionSaveChanges" />
                <toolitem name="Add Files" action="ActionAddFiles" />
                <toolitem name="Add Directory" action="ActionAddDirectory" />
diff --git a/plugins/playlist_display/plugin.c 
b/plugins/playlist_display/plugin.c
index 1edb02f..2368e2c 100644
--- a/plugins/playlist_display/plugin.c
+++ b/plugins/playlist_display/plugin.c
@@ -57,12 +57,28 @@ static GtkActionEntry playlist_actions[] =
         {
             ACTION_LOAD_IPOD, /* Action name */
             PLAYLIST_DISPLAY_READ_ICON_STOCK_ID, /* Stock icon */
+            N_("_Load Selected iPod"), /* Display label */
+            NULL, /* short-cut */
+            N_("Load the currently selected iPod"), /* Tooltip */
+            G_CALLBACK (on_load_ipod_mi) /* callback */
+        },
+        {
+            ACTION_LOAD_IPODS, /* Action name */
+            PLAYLIST_DISPLAY_READ_ICON_STOCK_ID, /* Stock icon */
             N_("_Load iPod(s)"), /* Display label */
             NULL, /* short-cut */
             N_("Load all currently listed iPods"), /* Tooltip */
             G_CALLBACK (on_load_ipods_mi) /* callback */
         },
         {
+            ACTION_LOAD_IPODS_MENU,
+            NULL,
+            N_("_Load iPods"),
+            NULL,
+            NULL,
+            NULL
+        },
+        {
             ACTION_SAVE_CHANGES, /* Action name */
             PLAYLIST_DISPLAY_SYNC_ICON_STOCK_ID, /* Stock icon */
             N_("_Save Changes"), /* Display label */
@@ -293,6 +309,7 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) {
     PlaylistDisplayPlugin *playlist_display_plugin;
     GtkActionGroup* action_group;
     GtkAction *new_playlist_action;
+    GtkAction *load_ipods_action;
 
     /* Set preferences */
     set_default_preferences();
@@ -321,6 +338,10 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) {
     g_signal_connect(new_playlist_action, "activate", 
G_CALLBACK(on_new_playlist_activate), NULL);
     gtk_action_group_add_action (playlist_display_plugin->action_group, 
GTK_ACTION (new_playlist_action));
 
+    load_ipods_action = tool_menu_action_new (ACTION_DISPLAY_LOAD_IPODS, 
_("Load iPods"), _("Load all or selected iPods"), 
PLAYLIST_DISPLAY_READ_ICON_STOCK_ID);
+    g_signal_connect(load_ipods_action, "activate", 
G_CALLBACK(on_load_ipods_mi), NULL);
+    gtk_action_group_add_action (playlist_display_plugin->action_group, 
GTK_ACTION (load_ipods_action));
+
     /* Merge UI */
     gchar *uipath = g_build_filename(get_ui_dir(), "playlist_display.ui", 
NULL);
     playlist_display_plugin->uiid = anjuta_ui_merge(ui, uipath);
diff --git a/plugins/playlist_display/plugin.h 
b/plugins/playlist_display/plugin.h
index 1d64f28..cee4f72 100644
--- a/plugins/playlist_display/plugin.h
+++ b/plugins/playlist_display/plugin.h
@@ -46,6 +46,9 @@
 
 /* Action IDs */
 #define ACTION_LOAD_IPOD "ActionLoadiPod"
+#define ACTION_LOAD_IPODS "ActionLoadiPods"
+#define ACTION_DISPLAY_LOAD_IPODS "ActionDisplayLoadiPods"
+#define ACTION_LOAD_IPODS_MENU "ActionLoadiPodsMenu"
 #define ACTION_SAVE_CHANGES "ActionSaveChanges"
 #define ACTION_ADD_FILES "ActionAddFiles"
 #define ACTION_ADD_DIRECTORY "ActionAddDirectory"

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to