commit 61183915a6282ef7eb4b93ea22442cdcac0aa39f
Author: phantomjinx <p.g.richard...@phantomjinx.co.uk>
Date:   Thu Dec 24 14:05:00 2009 +0000

    fledgling sorttab plugin

 plugins/sorttab_display/Makefile.am        |  124 +++++++++++++++++++++
 plugins/sorttab_display/display_sorttabs.c |    1 +
 plugins/sorttab_display/display_sorttabs.h |   37 ++++++
 plugins/sorttab_display/plugin.c           |  166 ++++++++++++++++++++++++++++
 plugins/sorttab_display/plugin.h           |   55 +++++++++
 plugins/sorttab_display/sorttab_display.ui |    9 ++
 6 files changed, 392 insertions(+), 0 deletions(-)
---
diff --git a/plugins/sorttab_display/Makefile.am 
b/plugins/sorttab_display/Makefile.am
new file mode 100644
index 0000000..7cc6c58
--- /dev/null
+++ b/plugins/sorttab_display/Makefile.am
@@ -0,0 +1,124 @@
+plugin_name = sorttab_display
+plugin_lib = lib$(plugin_name).so
+plugin_file = $(plugin_name).plugin
+
+# Plugin UI file
+sorttab_display_uidir = $(gtkpod_ui_dir)
+sorttab_display_ui_DATA =  $(plugin_name).ui
+
+# Plugin Glade file
+sorttab_display_gladedir = $(gtkpod_glade_dir)
+sorttab_display_glade_DATA =  $(plugin_name).glade
+
+# Plugin Icon file
+sorttab_display_pixmapsdir = $(gtkpod_image_dir)
+sorttab_display_pixmaps_DATA = $(plugin_name).png
+
+# Plugin description file
+plugin_in_files = $(plugin_file)
+
+sorttab_display_plugindir = $(gtkpod_plugin_dir)
+sorttab_display_plugin_DATA = $(plugin_file)
+
+SUBDIRS = icons
+
+# Include paths
+AM_CPPFLAGS = \
+    -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+    -DGTKPOD_DATA_DIR=\"$(gtkpod_data_dir)\" \
+    -DGTKPDO_PLUGIN_DIR=\"$(gtkpod_plugin_dir)\" \
+    -DGTKPDO_IMAGE_DIR=\"$(gtkpod_image_dir)\" \
+    -DGTKPOD_GLADE_DIR=\"$(gtkpod_glade_dir)\" \
+    -DGTKPOD_UI_DIR=\"$(gtkpod_ui_dir)\" \
+    -DPACKAGE_DATA_DIR=\"$(datadir)\" \
+    -DPACKAGE_SRC_DIR=\"$(srcdir)\" \
+    $(GTKPOD_CFLAGS)
+
+# Where to install the plugin
+plugindir = $(gtkpod_plugin_dir)
+
+# The plugin
+plugin_LTLIBRARIES = libsorttab_display.la
+
+# Plugin sources
+libsorttab_display_la_SOURCES = plugin.c plugin.h \
+                                                                
display_sorttabs.c display_sorttabs.h \
+                                                                file_export.c 
file_export.h \
+                                                                
sorttab_display_actions.c sorttab_display_actions.h
+
+libsorttab_display_la_LDFLAGS = $(GTKPOD_PLUGIN_LDFLAGS)
+
+# Plugin dependencies
+libsorttab_display_la_LIBADD = \
+    $(LIBGTKPOD_LIBS) \
+    $(LIBANJUTA_LIBS)
+
+EXTRA_DIST = \
+       $(plugin_in_files) \
+       $(sorttab_display_plugin_DATA) \
+       $(sorttab_display_ui_DATA) \
+       $(sorttab_display_glade_DATA) \
+       $(sorttab_display_pixmaps_DATA)
+
+all-local: create-plugin-links create-ui-link copy-icons-dir
+
+# Creating symbolic links in plugin root directory
+create-plugin-links:
+       echo "Creating plugin links"
+       if test ! -e ../$(plugin_lib); then \
+         ln -s `pwd`/.libs/$(plugin_lib) ../$(plugin_lib); \
+       fi; \
+       if test ! -e ../$(plugin_file); then \
+         ln -s `pwd`/$(plugin_file) ../$(plugin_file); \
+       fi;
+       
+# Creating symbolic link to ui file in installed ui directory
+create-ui-link: create-ui-dir
+       if test -e $(gtkpod_ui_dir)/$(sorttab_display_ui_DATA); then \
+         # File already exists. Replacing ..." \
+         sudo rm -f $(gtkpod_ui_dir)/$(sorttab_display_ui_DATA); \
+       fi; \
+       # Creating link for $(sorttab_display_ui_DATA)" \
+       sudo ln -s `pwd`/$(sorttab_display_ui_DATA) 
$(gtkpod_ui_dir)/$(sorttab_display_ui_DATA);
+
+create-ui-dir: create-data-dir
+       if test ! -d $(gtkpod_ui_dir); then \
+         sudo mkdir $(gtkpod_ui_dir); \
+       fi;
+
+# Copy icons
+copy-icons-dir: create-icons-dir
+       sudo cp -rf `pwd`/icons/* $(gtkpod_image_dir)/; \
+       sudo find $(gtkpod_image_dir) -name 'Makefile*' -delete;
+
+create-icons-dir: create-data-dir
+       if test ! -d $(gtkpod_image_dir); then \
+         sudo mkdir $(gtkpod_image_dir); \
+       fi;
+
+create-data-dir: create-base-data-dir
+       if test ! -d $(gtkpod_data_dir); then \
+         sudo mkdir $(gtkpod_data_dir); \
+       fi;
+
+create-base-data-dir:
+       if test ! -d $(datadir)/$(PACKAGE); then \
+         sudo mkdir $(datadir)/$(PACKAGE); \
+       fi;
+
+# Clean up the links and files created purely for dev testing
+clean-local: clean-plugin-files clean-ui-dir clean-image-dir
+
+clean-plugin-files:
+       rm -f ../$(plugin_lib) ../$(plugin_file)
+
+clean-ui-dir:
+       if test -h $(gtkpod_ui_dir)/$(sorttab_display_ui_DATA); then \
+         # Symbolic link exists. Removing ..." \
+         sudo rm -f $(gtkpod_ui_dir)/$(sorttab_display_ui_DATA); \
+       fi;
+
+clean-image-dir:
+       if test -d $(gtkpod_image_dir); then \
+         sudo find $(gtkpod_image_dir) -name 'sorttab_display*' -delete; \
+       fi;
\ No newline at end of file
diff --git a/plugins/sorttab_display/display_sorttabs.c 
b/plugins/sorttab_display/display_sorttabs.c
new file mode 120000
index 0000000..63f3427
--- /dev/null
+++ b/plugins/sorttab_display/display_sorttabs.c
@@ -0,0 +1 @@
+../../src/display_sorttabs.c
\ No newline at end of file
diff --git a/plugins/sorttab_display/display_sorttabs.h 
b/plugins/sorttab_display/display_sorttabs.h
new file mode 100644
index 0000000..4d7978d
--- /dev/null
+++ b/plugins/sorttab_display/display_sorttabs.h
@@ -0,0 +1,37 @@
+/* Time-stamp: <2007-03-19 23:11:13 jcs>
+|
+|  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
+|  Part of the gtkpod project.
+|
+|  URL: http://www.gtkpod.org/
+|  URL: http://gtkpod.sourceforge.net/
+|
+|  This program is free software; you can redistribute it and/or modify
+|  it under the terms of the GNU General Public License as published by
+|  the Free Software Foundation; either version 2 of the License, or
+|  (at your option) any later version.
+|
+|  This program is distributed in the hope that it will be useful,
+|  but WITHOUT ANY WARRANTY; without even the implied warranty of
+|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+|  GNU General Public License for more details.
+|
+|  You should have received a copy of the GNU General Public License
+|  along with this program; if not, write to the Free Software
+|  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+|
+|  iTunes and iPod are trademarks of Apple
+|
+|  This product is not supported/written/published by Apple!
+|
+|  $Id$
+*/
+
+#ifndef __DISPLAY_SORTTAB_H__
+#define __DISPLAY_SORTTAB_H__
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#endif /* __DISPLAY_SORTTAB_H__ */
diff --git a/plugins/sorttab_display/plugin.c b/plugins/sorttab_display/plugin.c
new file mode 100644
index 0000000..35e2c10
--- /dev/null
+++ b/plugins/sorttab_display/plugin.c
@@ -0,0 +1,166 @@
+/*
+ |  Copyright (C) 2002-2010 Jorg Schuler <jcsjcs at users sourceforge net>
+ |                                          Paul Richardson <phantom_sf at 
users.sourceforge.net>
+ |  Part of the gtkpod project.
+ |
+ |  URL: http://www.gtkpod.org/
+ |  URL: http://gtkpod.sourceforge.net/
+ |
+ |  This program is free software; you can redistribute it and/or modify
+ |  it under the terms of the GNU General Public License as published by
+ |  the Free Software Foundation; either version 2 of the License, or
+ |  (at your option) any later version.
+ |
+ |  This program is distributed in the hope that it will be useful,
+ |  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ |  GNU General Public License for more details.
+ |
+ |  You should have received a copy of the GNU General Public License
+ |  along with this program; if not, write to the Free Software
+ |  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ |
+ |  iTunes and iPod are trademarks of Apple
+ |
+ |  This product is not supported/written/published by Apple!
+ |
+ |  $Id$
+ */
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <glib.h>
+#include "libgtkpod/stock_icons.h"
+#include "libgtkpod/gtkpod_app_iface.h"
+#include "plugin.h"
+
+/* Parent class. Part of standard class definition */
+static gpointer parent_class;
+
+static GtkActionEntry sorttab_actions[] =
+    {
+        {
+            "ActionLoadiPod", /* Action name */
+            PLAYLIST_DISPLAY_READ_ICON_STOCK_ID, /* Stock icon */
+            N_("_Load iPod(s)"), /* Display label */
+            NULL, /* short-cut */
+            NULL, /* Tooltip */
+            G_CALLBACK (on_load_ipods_mi) /* callback */
+        },
+        {
+            "ActionSaveChanges", /* Action name */
+            PLAYLIST_DISPLAY_SYNC_ICON_STOCK_ID, /* Stock icon */
+            N_("_Save Changes"), /* Display label */
+            NULL, /* short-cut */
+            NULL, /* Tooltip */
+            G_CALLBACK (on_save_changes) /* callback */
+        },
+        {
+            "ActionAddFiles", /* Action name */
+            PLAYLIST_DISPLAY_ADD_FILES_ICON_STOCK_ID, /* Stock icon */
+            N_("Add _Files"), /* Display label */
+            NULL, /* short-cut */
+            NULL, /* Tooltip */
+            G_CALLBACK (on_create_add_files) /* callback */
+        },
+        {
+            "ActionAddDirectory", /* Action name */
+            PLAYLIST_DISPLAY_ADD_DIRS_ICON_STOCK_ID, /* Stock icon */
+            N_("Add Fol_der"), /* Display label */
+            NULL, /* short-cut */
+            NULL, /* Tooltip */
+            G_CALLBACK (on_create_add_directory) /* callback */
+        },
+        {
+            "ActionAddSorttab", /* Action name */
+            PLAYLIST_DISPLAY_ADD_PLAYLISTS_ICON_STOCK_ID, /* Stock icon */
+            N_("Add _Sorttab"), /* Display label */
+            NULL, /* short-cut */
+            NULL, /* Tooltip */
+            G_CALLBACK (on_create_add_sorttabs) /* callback */
+        }
+    };
+
+static gboolean activate_plugin(AnjutaPlugin *plugin) {
+    AnjutaUI *ui;
+    SorttabDisplayPlugin *sorttab_display_plugin;
+    GtkActionGroup* action_group;
+
+    /* Prepare the icons for the sorttab */
+
+    sorttab_display_plugin = (SorttabDisplayPlugin*) plugin;
+    ui = anjuta_shell_get_ui(plugin->shell, NULL);
+
+    /* Add our sorttab_actions */
+    action_group
+            = anjuta_ui_add_action_group_entries(ui, 
"ActionGroupSorttabDisplay", _("Sorttab Display"), sorttab_actions, 
G_N_ELEMENTS (sorttab_actions), GETTEXT_PACKAGE, TRUE, plugin);
+    sorttab_display_plugin->action_group = action_group;
+
+    /* Merge UI */
+    sorttab_display_plugin->uiid = anjuta_ui_merge(ui, UI_FILE);
+
+    /* Add widget in Shell. Any number of widgets can be added */
+
+    sorttab_display_plugin->pl_window = gtk_scrolled_window_new(NULL, NULL);
+    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW 
(sorttab_display_plugin->pl_window), GTK_POLICY_AUTOMATIC, 
GTK_POLICY_AUTOMATIC);
+    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW 
(sorttab_display_plugin->pl_window), GTK_SHADOW_IN);
+
+    sorttab_display_plugin->sorttab_view = pm_create_treeview();
+
+    g_signal_connect (gtkpod_app, "sorttab_selected", G_CALLBACK 
(sorttab_display_select_sorttab_cb), NULL);
+    g_signal_connect (gtkpod_app, "itdb_updated", G_CALLBACK 
(sorttab_display_update_itdb_cb), NULL);
+
+    gtk_container_add(GTK_CONTAINER (sorttab_display_plugin->pl_window), 
GTK_WIDGET (sorttab_display_plugin->sorttab_view));
+    gtk_widget_show_all(sorttab_display_plugin->pl_window);
+    anjuta_shell_add_widget(plugin->shell, sorttab_display_plugin->pl_window, 
"SorttabDisplayPlugin", "", NULL, ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
+
+    return TRUE; /* FALSE if activation failed */
+}
+
+static gboolean deactivate_plugin(AnjutaPlugin *plugin) {
+    AnjutaUI *ui;
+    SorttabDisplayPlugin *sorttab_display_plugin;
+
+    sorttab_display_plugin = (SorttabDisplayPlugin*) plugin;
+    ui = anjuta_shell_get_ui(plugin->shell, NULL);
+
+    /* Remove widgets from Shell */
+    anjuta_shell_remove_widget(plugin->shell, 
sorttab_display_plugin->pl_window, NULL);
+
+    /* Destroy the treeview */
+    sorttab_display_plugin->sorttab_view = NULL;
+    destroy_treeview();
+
+    /* Unmerge UI */
+    anjuta_ui_unmerge(ui, sorttab_display_plugin->uiid);
+
+    /* Remove Action groups */
+    anjuta_ui_remove_action_group(ui, sorttab_display_plugin->action_group);
+
+    /* FALSE if plugin doesn't want to deactivate */
+    return TRUE;
+}
+
+static void sorttab_display_plugin_instance_init(GObject *obj) {
+    SorttabDisplayPlugin *plugin = (SorttabDisplayPlugin*) obj;
+    plugin->uiid = 0;
+    plugin->pl_window = NULL;
+    plugin->sorttab_view = NULL;
+    plugin->action_group = NULL;
+}
+
+static void sorttab_display_plugin_class_init(GObjectClass *klass) {
+    AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
+
+    parent_class = g_type_class_peek_parent(klass);
+
+    plugin_class->activate = activate_plugin;
+    plugin_class->deactivate = deactivate_plugin;
+}
+
+ANJUTA_PLUGIN_BEGIN (SorttabDisplayPlugin, sorttab_display_plugin);
+ANJUTA_PLUGIN_END;
+
+ANJUTA_SIMPLE_PLUGIN (SorttabDisplayPlugin, sorttab_display_plugin)
+;
diff --git a/plugins/sorttab_display/plugin.h b/plugins/sorttab_display/plugin.h
new file mode 100644
index 0000000..39edd69
--- /dev/null
+++ b/plugins/sorttab_display/plugin.h
@@ -0,0 +1,55 @@
+/*
+|  Copyright (C) 2002-2010 Jorg Schuler <jcsjcs at users sourceforge net>
+|                                          Paul Richardson <phantom_sf at 
users.sourceforge.net>
+|  Part of the gtkpod project.
+|
+|  URL: http://www.gtkpod.org/
+|  URL: http://gtkpod.sourceforge.net/
+|
+|  This program is free software; you can redistribute it and/or modify
+|  it under the terms of the GNU General Public License as published by
+|  the Free Software Foundation; either version 2 of the License, or
+|  (at your option) any later version.
+|
+|  This program is distributed in the hope that it will be useful,
+|  but WITHOUT ANY WARRANTY; without even the implied warranty of
+|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+|  GNU General Public License for more details.
+|
+|  You should have received a copy of the GNU General Public License
+|  along with this program; if not, write to the Free Software
+|  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+|
+|  iTunes and iPod are trademarks of Apple
+|
+|  This product is not supported/written/published by Apple!
+|
+|  $Id$
+*/
+
+#ifndef PLUGIN_H_
+#define PLUGIN_H_
+
+#include <libanjuta/anjuta-plugin.h>
+
+/* Stock IDs */
+
+#define UI_FILE GTKPOD_UI_DIR"/sorttab_display.ui"
+#define GLADE_FILE GTKPOD_GLADE_DIR"/sorttab_display.glade"
+
+typedef struct _SorttabDisplayPlugin SorttabDisplayPlugin;
+typedef struct _SorttabDisplayPluginClass SorttabDisplayPluginClass;
+
+struct _SorttabDisplayPlugin {
+    AnjutaPlugin parent;
+    GtkTreeView *sorttab_view;
+    GtkWidget *pl_window;
+    gint uiid;
+    GtkActionGroup *action_group;
+};
+
+struct _SorttabDisplayPluginClass {
+    AnjutaPluginClass parent_class;
+};
+
+#endif /* PLUGIN_H_ */
diff --git a/plugins/sorttab_display/sorttab_display.ui 
b/plugins/sorttab_display/sorttab_display.ui
new file mode 100644
index 0000000..8eb3a27
--- /dev/null
+++ b/plugins/sorttab_display/sorttab_display.ui
@@ -0,0 +1,9 @@
+<!--*- xml -*-->
+<ui>
+       <menubar name="MenuMain">
+               <menu name="MenuMusic" action="ActionMenuMusic">
+               </menu>
+       </menubar>
+       <toolbar name="ToolbarMain">
+       </toolbar>
+</ui>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to