1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2004-2011 Qball Cow <qball@sarine.nl>
3 * Project homepage: http://gmpc.wikia.com/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <libmpd/libmpd.h>
24 #include "gmpc-extras.h"
25 #include "gmpc-profiles.h"
26 #include "gmpc-mpddata-treeview.h"
28 //#include "gmpc-paned-size-group.h"
33 #define PLUGIN_ID_MARK 1024
34 #define PLUGIN_ID_INTERNALL 2048
35 /* Usefull signal objects. */
36 extern MpdObj
*connection
;
37 extern GmpcProfiles
*gmpc_profiles
;
38 extern GmpcConnection
*gmpcconn
;
41 typedef struct _gmpcPluginParent gmpcPluginParent
;
43 /* This is a bitmask.*/
45 GMPC_PLUGIN_DUMMY
= 1,
46 GMPC_PLUGIN_PL_BROWSER
= 2,
47 GMPC_PLUGIN_NO_GUI
= 4,
50 GMPC_PLUGIN_META_DATA
= 32,
51 /* Make compiler happy about GMPC_PLUGIN_PL_BROWSER|GMPC_PLUGIN_METADATA */
52 GMPC_BROWSER_META
= 34
55 /* the gtk_tree_store row's */
58 PL3_CAT_TYPE
, /** Plugin id */
59 PL3_CAT_TITLE
, /** title that is showed */
60 PL3_CAT_INT_ID
, /* id */
61 PL3_CAT_ICON_ID
, /* icon id */
62 PL3_CAT_PROC_DEPRECATED
, /* for the lazy tree, if the dir is allready processed */
63 PL3_CAT_ICON_SIZE_DEPRECATED
, /** icon size */
64 PL3_CAT_BROWSE_FORMAT_DEPRECATED
, /** string, added for tag browser */
65 PL3_CAT_ORDER
, /* int for sorting the list */
71 /** gmpcPrefPlugin: need to be instant apply.
72 * Plugin is expected to fill the container with it preferences widgets. (gtk_container_add)
73 * if destroy is called, it needs to detacht it from the container (gtk_container_remove)
76 void (*construct
)(GtkWidget
*container
);
77 void (*destroy
)(GtkWidget
*container
);
79 void (*padding1
) (void);
80 void (*padding2
) (void);
81 void (*padding3
) (void);
84 /** gmpcPlBrowserPlugin, functions needed for intergration with the playlist browser
88 * Adding to the left side tree */
89 void (*add
) (GtkWidget
*cat_tree
);
91 * If selected, you need to fill the right screen */
92 void (*selected
) (GtkWidget
*container
);
94 * if unselected, you need to remove youself from the container
96 void (*unselected
) (GtkWidget
*container
);
97 int (*cat_right_mouse_menu
) (GtkWidget
*menu
, int type
, GtkWidget
*tree
,GdkEventButton
*event
);
98 void (*cat_key_press
) (GtkWidget
*tree
, GdkEventKey
*event
, int selected_type
) G_GNUC_DEPRECATED
;
99 /****** GO MENU ********/
100 int (*add_go_menu
) (GtkWidget
*menu
);
101 /****** Key presses (in the whole window) **/
102 int (*key_press_event
) (GtkWidget
*mw
, GdkEventKey
*event
, int type
);
103 /** Song list right mouse menu intergration.
104 * This is only called (And allowed to be called) if the treeview is a GmpcMpdDataTreeview with songs
106 int (*song_list_option_menu
) (GmpcMpdDataTreeview
*tree
, GtkMenu
*menu
);
108 MpdData
* (*integrate_search
) (const int search_field
,const gchar
*search_query
,GError
**error
);
109 gboolean (*integrate_search_field_supported
) (const int search_field
);
110 void (*padding3
) (void);
111 } gmpcPlBrowserPlugin
;
114 * Metadata fetching plugin.
115 * All fields required
119 /* Set and get priority */
120 int (*get_priority
) (void);
121 void (*set_priority
) (int priority
);
122 int (*get_image
) (mpd_Song
*song
, MetaDataType type
, char **path
) G_GNUC_DEPRECATED
;
125 void (*get_uris
) (mpd_Song
*song
, MetaDataType type
, void (*callback
)(GList
*uris
, gpointer data
), gpointer data
) G_GNUC_DEPRECATED
;
126 /* New api, return linked list of MetaData Objects (see metadata.h) */
127 void (*get_metadata
) (mpd_Song
*song
, MetaDataType
, void (*callback
)(GList
*metadata
, gpointer data
), gpointer data
);
128 void (*padding3
) (void);
129 } gmpcMetaDataPlugin
;
132 /* 16 == 0.14 release */
133 /* 17 == 0.15.5 release */
134 /* 18 == 16 december */
135 /* 19 == 0.16* 24 december */
136 /* 20 == 0.16.5 release */
137 /* 21 == 0.17.0 release -> adding padding so abi wont break next time */
138 #define PLUGIN_API_VERSION 21
142 /* Name of the plugin */
145 const int version
[3];
147 PluginType plugin_type
;
148 /* unique plugin id */
149 /* do not fill in, is done by gmpc */
152 /* path where the plugin is (only directory) can be used to get location of f.e. glade/images
153 * Don't use this anymore use: gmpc_get.*_path */
154 /* Do not fill in, done by gmpc */
156 /* function gets called on startup */
158 /* Plugin should destroy all it's widgets and free all allocated space */
159 void (*destroy
)(void);
160 /* Browser Plugins */
161 gmpcPlBrowserPlugin
*browser
;
162 /* plugin with one signal for changes on Mpd */
163 StatusChangedCallback mpd_status_changed
;
164 /* (dis)connect signal */
165 ConnectionChangedCallback mpd_connection_changed
;
166 /* structure to let the plugin intergrate it's preferences */
167 gmpcPrefPlugin
*pref
;
169 gmpcMetaDataPlugin
*metadata
;
171 /** Plugin control functions
173 int (*get_enabled
)(void);
174 void (*set_enabled
)(int enable
);
175 /* Function that is called when the plugin is going to be destroyed,
176 * This is the place if you want to save settings
178 void (*save_yourself
)(void);
181 gint (*tool_menu_integration
) (GtkMenu
*menu
);
182 const gchar
* (*get_translation_domain
) (void);
183 void (*padding3
) (void);
188 * Allows the plugin to access the EasyCommand
190 extern GmpcEasyCommand
*gmpc_easy_command
;
197 * Get the treeview and tree_store of the category list on the left.
199 GtkListStore
* playlist3_get_category_tree_store(void);
200 GtkTreeView
* playlist3_get_category_tree_view(void);
203 * Get this GtkWindow of the playlist.
204 * Use this to set parent and so
206 GtkWidget
* playlist3_get_window(void);
208 * indicates if the window is hidden to tray
210 gboolean
playlist3_window_is_hidden(void);
212 /** plugin functions */
213 gmpcPluginParent
* plugin_get_from_id(int id
);
217 * Helper functions to get path to gmpc directory and metadata directory
220 char * gmpc_get_full_glade_path(const char *filename
);
221 gchar
* gmpc_get_covers_path(const gchar
*filename
);
222 gchar
* gmpc_get_user_path(const gchar
*filename
);
223 gchar
* gmpc_get_cache_directory(const gchar
*filename
);
224 void playlist3_insert_browser(GtkTreeIter
*iter
, gint position
);
227 void pl3_option_menu_activate(void);
228 /* Tell mpd to reload the go menu */
229 void pl3_update_go_menu(void);
232 /* Used by plugins themself */
233 gchar
* gmpc_plugin_get_data_path (gmpcPlugin
*plug
);
236 * Update parts of the gui
238 void pl3_tool_menu_update(void);
243 const char *connection_get_music_directory(void);
246 void info2_fill_song_view(mpd_Song
*song
);
247 void info2_activate(void);
249 void info2_fill_artist_view(const gchar
*artist
);
250 void info2_fill_album_view(const gchar
*artist
,const gchar
*album
);
252 extern GObject
*paned_size_group
;
256 * @param icon The #GtkWidget to add
258 * Add an icon to the status bar.
261 void main_window_add_status_icon(GtkWidget
*icon
);
264 * show the main window
266 void create_playlist3(void);
269 * hide the main window