1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2004-2012 Qball Cow <qball@gmpclient.org>
3 * Project homepage: http://gmpclient.org/
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-mpddata-treeview.h"
27 //#include "gmpc-paned-size-group.h"
32 #define PLUGIN_ID_MARK 1024
33 #define PLUGIN_ID_INTERNALL 2048
34 /* Usefull signal objects. */
35 extern config_obj
*config
;
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_DEPRECATED2
= 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_ORDER
, /* int for sorting the list */
71 PL3_CAT_BROWSER_TOP
= 0,
72 PL3_CAT_BROWSER_LIBRARY
= 1000,
73 PL3_CAT_BROWSER_ONLINE_MEDIA
= 2000,
74 PL3_CAT_BROWSER_MISC
= 3000
77 /** gmpcPrefPlugin: need to be instant apply.
78 * Plugin is expected to fill the container with it preferences widgets. (gtk_container_add)
79 * if destroy is called, it needs to detacht it from the container (gtk_container_remove)
82 void (*construct
)(GtkWidget
*container
);
83 void (*destroy
)(GtkWidget
*container
);
85 void (*padding1
) (void);
86 void (*padding2
) (void);
87 void (*padding3
) (void);
90 /** gmpcPlBrowserPlugin, functions needed for intergration with the playlist browser
94 * Adding to the left side tree */
95 void (*add
) (GtkWidget
*cat_tree
);
97 * If selected, you need to fill the right screen */
98 void (*selected
) (GtkWidget
*container
);
100 * if unselected, you need to remove youself from the container
102 void (*unselected
) (GtkWidget
*container
);
103 int (*cat_right_mouse_menu
) (GtkWidget
*menu
, int type
, GtkWidget
*tree
,GdkEventButton
*event
);
104 void (*cat_key_press
) (GtkWidget
*tree
, GdkEventKey
*event
, int selected_type
) G_GNUC_DEPRECATED
;
105 /****** GO MENU ********/
106 int (*add_go_menu
) (GtkWidget
*menu
);
107 /****** Key presses (in the whole window) **/
108 int (*key_press_event
) (GtkWidget
*mw
, GdkEventKey
*event
, int type
);
109 /** Song list right mouse menu intergration.
110 * This is only called (And allowed to be called) if the treeview is a GmpcMpdDataTreeview with songs
112 int (*song_list_option_menu
) (GmpcMpdDataTreeview
*tree
, GtkMenu
*menu
);
114 MpdData
* (*integrate_search
) (const int search_field
,const gchar
*search_query
,GError
**error
);
115 gboolean (*integrate_search_field_supported
) (const int search_field
);
116 void (*padding3
) (void);
117 } gmpcPlBrowserPlugin
;
120 /* 16 == 0.14 release */
121 /* 17 == 0.15.5 release */
122 /* 18 == 16 december */
123 /* 19 == 0.16* 24 december */
124 /* 20 == 0.16.5 release */
125 /* 21 == 0.17.0 release -> adding padding so abi wont break next time */
126 #define PLUGIN_API_VERSION 21
130 /* Name of the plugin */
133 const int version
[3];
135 PluginType plugin_type
;
136 /* unique plugin id */
137 /* do not fill in, is done by gmpc */
140 /* path where the plugin is (only directory) can be used to get location of f.e. glade/images
141 * Don't use this anymore use: gmpc_get.*_path */
142 /* Do not fill in, done by gmpc */
144 /* function gets called on startup */
146 /* Plugin should destroy all it's widgets and free all allocated space */
147 void (*destroy
)(void);
148 /* Browser Plugins */
149 gmpcPlBrowserPlugin
*browser
;
150 /* plugin with one signal for changes on Mpd */
151 StatusChangedCallback mpd_status_changed
;
152 /* (dis)connect signal */
153 ConnectionChangedCallback mpd_connection_changed
;
154 /* structure to let the plugin intergrate it's preferences */
155 gmpcPrefPlugin
*pref
;
156 /** Meta data, this is deprecated, do not use.*/
159 /** Plugin control functions
161 int (*get_enabled
)(void);
162 void (*set_enabled
)(int enable
);
163 /* Function that is called when the plugin is going to be destroyed,
164 * This is the place if you want to save settings
166 void (*save_yourself
)(void);
169 gint (*tool_menu_integration
) (GtkMenu
*menu
);
170 const gchar
* (*get_translation_domain
) (void);
171 void (*padding3
) (void);
176 * Allows the plugin to access the EasyCommand
178 extern GmpcEasyCommand
*gmpc_easy_command
;
185 * Get the treeview and tree_store of the category list on the left.
187 GtkListStore
* playlist3_get_category_tree_store(void);
188 GtkTreeView
* playlist3_get_category_tree_view(void);
191 * Get this GtkWindow of the playlist.
192 * Use this to set parent and so
194 GtkWidget
* playlist3_get_window(void);
196 * indicates if the window is hidden to tray
198 gboolean
playlist3_window_is_hidden(void);
200 /** plugin functions */
201 gmpcPluginParent
* plugin_get_from_id(int id
);
205 * Helper functions to get path to gmpc directory and metadata directory
208 char * gmpc_get_full_glade_path(const char *filename
);
209 gchar
* gmpc_get_covers_path(const gchar
*filename
);
210 gchar
* gmpc_get_user_path(const gchar
*filename
);
211 gchar
* gmpc_get_cache_directory(const gchar
*filename
);
212 void playlist3_insert_browser(GtkTreeIter
*iter
, gint position
);
215 void pl3_option_menu_activate(void);
216 /* Tell mpd to reload the go menu */
217 void pl3_update_go_menu(void);
220 /* Used by plugins themself */
221 gchar
* gmpc_plugin_get_data_path (gmpcPlugin
*plug
);
224 * Update parts of the gui
226 void pl3_tool_menu_update(void);
231 const char *connection_get_music_directory(void);
234 void info2_fill_song_view(mpd_Song
*song
);
235 void info2_activate(void);
237 void info2_fill_artist_view(const gchar
*artist
);
238 void info2_fill_album_view(const gchar
*artist
,const gchar
*album
);
240 extern GObject
*paned_size_group
;
246 * show the main window
248 void create_playlist3(void);
250 * Get the state of the sidebar
252 GmpcPluginSidebarState
playlist3_get_sidebar_state(void);
255 * hide the main window
259 extern GmpcMetaWatcher
*gmw
;