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.
24 #include "gmpc-extras.h"
28 #define PLUGIN_LOG_DOMAIN "Plugin"
30 gmpcPluginParent
**plugins
= NULL
;
33 gmpcPluginParent
*plugin_get_from_id(int id
)
35 int pos
= plugin_get_pos(id
);
36 g_assert_cmpint(pos
, <, num_plugins
);
41 static GQuark
plugin_quark(void)
43 return g_quark_from_static_string("gmpc_plugin");
47 int plugin_get_pos(int id
)
49 return id
& (PLUGIN_ID_MARK
- 1);
53 static int plugin_validate(gmpcPlugin
* plug
, GError
** error
)
56 if (plug
->name
== NULL
)
58 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"), _("plugin has no name"));
59 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
, "pluging has no name: %s", plug
->path
);
62 for (i
= 0; i
< num_plugins
; i
++)
64 if (strcmp(gmpc_plugin_get_name(plugins
[i
]), plug
->name
) == 0)
66 g_set_error(error
, plugin_quark(), 0, "%s '%s': %s", _("Failed to load plugin"), plug
->name
,
67 _("plugin with same name already exists"));
68 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
, "pluging with same name already exists: %s", plug
->name
);
72 if (plug
->set_enabled
== NULL
|| plug
->get_enabled
== NULL
)
74 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
75 _("plugin is missing set/get enable function"));
76 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
, "%s: set_enabled == NULL || get_enabled == NULL failed",
80 if (plug
->plugin_type
& GMPC_PLUGIN_PL_BROWSER
)
82 if (plug
->browser
== NULL
)
84 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
85 _("plugin browser structure is incorrect"));
86 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
87 "%s: plugin_type&GMPC_PLUGIN_PL_BROWSER && plugin->browser != NULL Failed", plug
->name
);
90 if (plug
->browser
->cat_key_press
!= NULL
)
92 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
93 _("plugin browser structure is incorrect"));
94 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
95 "Plugin %s implements a cat_key_press event handler that is deprecated", plug
->name
);
98 if (plug
->plugin_type
& GMPC_PLUGIN_META_DATA
)
100 if (plug
->metadata
== NULL
)
102 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
103 _("plugin metadata structure is incorrect"));
104 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
105 "%s: plugin_type&GMPC_PLUGIN_META_DATA && plugin->metadata != NULL Failed", plug
->name
);
108 if (plug
->metadata
->get_priority
== NULL
)
110 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
111 _("plugin metadata structure is incorrect"));
112 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
113 "%s: plugin_type&GMPC_PLUGIN_META_DATA && plugin->metadata->get_priority != NULL Failed", plug
->name
);
116 if (plug
->metadata
->set_priority
== NULL
)
118 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
119 _("plugin metadata structure is incorrect"));
120 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
121 "%s: plugin_type&GMPC_PLUGIN_META_DATA && plugin->metadata->set_priority != NULL Failed", plug
->name
);
124 if (plug
->metadata
->get_image
!= NULL
)
126 g_set_error(error
, plugin_quark(), 0, "%s: %s %s", _("Failed to load plugin"), plug
->name
,
127 _("plugin get_image api is deprecated "));
128 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
129 "%s: plugin_type&GMPC_PLUGIN_META_DATA && plugin->metadata->get_image != NULL was true", plug
->name
);
132 if (plug
->metadata
->get_uris
!= NULL
)
134 g_set_error(error
, plugin_quark(), 0, "%s: %s %s", _("Failed to load plugin"), plug
->name
,
135 _("plugin get_uris api is deprecated "));
136 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
137 "%s: plugin_type&GMPC_PLUGIN_META_DATA && plugin->metadata->get_uris != NULL was true", plug
->name
);
140 if (plug
->metadata
->get_metadata
== NULL
)
142 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
143 _("plugin metadata structure is incorrect"));
144 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
145 "%s: plugin_type&GMPC_PLUGIN_META_DATA && plugin->metadata->get_image != NULL Failed", plug
->name
);
149 /* if there is a browser field, check validity */
152 if ((plug
->browser
->selected
&& plug
->browser
->unselected
== NULL
)
153 || (plug
->browser
->selected
== NULL
&& plug
->browser
->unselected
))
155 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
156 _("plugin browser structure is incorrect"));
157 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
158 "%s: If a plugin provides a browser pane, it needs both selected and unselected", plug
->name
);
162 /* if there is a pref window withouth both construct/destroy, give an error */
165 if (!(plug
->pref
->construct
&& plug
->pref
->destroy
))
167 g_set_error(error
, plugin_quark(), 0, "%s: %s", _("Failed to load plugin"),
168 _("plugin preferences structure is incorrect"));
169 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
170 "%s: If a plugin has a preferences pane, it needs both construct and destroy", plug
->name
);
178 void plugin_add(gmpcPlugin
* plug
, int plugin
, GError
** error
)
180 gmpcPluginParent
*parent
= g_malloc0(sizeof(*parent
));
184 plug
->id
= num_plugins
| ((plugin
) ? PLUGIN_ID_MARK
: PLUGIN_ID_INTERNALL
);
185 /* put it in the list */
187 plugins
= g_realloc(plugins
, (num_plugins
+ 1) * sizeof(gmpcPlugin
**));
188 plugins
[num_plugins
- 1] = parent
;
189 plugins
[num_plugins
] = NULL
;
191 //plug->plugin_type&GMPC_PLUGIN_META_DATA)
192 if (gmpc_plugin_is_metadata(parent
))
194 meta_data_add_plugin(parent
);
199 void plugin_add_new(GmpcPluginBase
* plug
, int plugin
, GError
** error
)
201 gmpcPluginParent
*parent
= g_malloc0(sizeof(*parent
));
205 plug
->id
= num_plugins
| ((plugin
) ? PLUGIN_ID_MARK
: PLUGIN_ID_INTERNALL
);
206 /* put it in the list */
208 plugins
= g_realloc(plugins
, (num_plugins
+ 1) * sizeof(gmpcPlugin
**));
209 plugins
[num_plugins
- 1] = parent
;
210 plugins
[num_plugins
] = NULL
;
212 if (plug
->plugin_type
& GMPC_PLUGIN_META_DATA
)
214 meta_data_add_plugin(parent
);
219 static int plugin_load(const char *path
, const char *file
, GError
** error
)
223 int *api_version
= 0;
224 gmpcPlugin
*plug
= NULL
;
225 gchar
*string
= NULL
;
226 gchar
*full_path
= NULL
;
231 full_path
= g_strdup_printf("%s%c%s", path
, G_DIR_SEPARATOR
, file
);
233 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_DEBUG
, "plugin_load: trying to load plugin %s", full_path
);
235 handle
= g_module_open(full_path
, G_MODULE_BIND_LOCAL
);
239 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
240 "plugin_load: module failed to load: %s:%s\n", file
, g_module_error());
241 g_set_error(error
, plugin_quark(), 0, "%s %s: '%s'", _("Failed to load plugin"), file
, g_module_error());
245 if (g_module_symbol(handle
, "plugin_get_type", (gpointer
) & function
))
248 GType(*get_type
) (void);
250 new = g_object_newv(get_type(), 0, NULL
);
254 g_set_error(error
, plugin_quark(), 0, "%s %s: '%s'", _("Failed to create plugin instance"), file
,
258 new->path
= g_strdup(path
);
259 plugin_add_new(new, 1, error
);
262 if (!g_module_symbol(handle
, "plugin_api_version", (gpointer
) & api_version
))
265 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
266 "plugin_load: symbol failed to bind: %s:%s\n", file
, g_module_error());
268 g_set_error(error
, plugin_quark(), 0, "%s %s: '%s'", _("Failed to bind symbol in plugin"), file
,
272 g_module_close(handle
);
275 if (*api_version
!= PLUGIN_API_VERSION
)
277 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
278 "Plugin '%s' has the wrong api version.\nPlugin api is %i, but we need %i",
279 file
, *api_version
, PLUGIN_API_VERSION
);
281 g_set_error(error
, plugin_quark(), 0, _("Plugin %s has wrong api version: %i"), file
, *api_version
);
284 g_module_close(handle
);
287 if (!g_module_symbol(handle
, "plugin", (gpointer
) & (plug
)))
289 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
290 "plugin_load: symbol failed to bind: %s:%s\n", file
, g_module_error());
292 g_set_error(error
, plugin_quark(), 0, "%s %s: '%s'", _("Plugin %s has wrong no plugin structure: %s"), file
,
295 g_module_close(handle
);
300 g_set_error(error
, plugin_quark(), 0, "%s %s: '%s'", _("Plugin %s has wrong no plugin structure: %s"), file
,
302 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
, "%s: plugin load: unknown type of plugin.\n", file
);
303 g_module_close(handle
);
306 /* set path, plugins might want this for images and glade files. */
307 plug
->path
= g_strdup(path
);
308 if (!plugin_validate(plug
, error
))
310 g_module_close(handle
);
313 /* add the plugin to the list */
314 plugin_add(plug
, 1, error
);
319 static gboolean
__show_plugin_load_error(gpointer data
)
321 playlist3_show_error_message(_("One or more plugins failed to load, see help->messages for more information"),
327 void plugin_load_dir(const gchar
* path
)
329 GDir
*dir
= g_dir_open(path
, 0, NULL
);
333 const gchar
*dirname
= NULL
;
334 while ((dirname
= g_dir_read_name(dir
)) != NULL
)
336 gchar
*full_path
= g_strdup_printf("%s%c%s", path
, G_DIR_SEPARATOR
, dirname
);
337 /* Make sure only to load plugins */
338 if (g_str_has_suffix(dirname
, G_MODULE_SUFFIX
))
340 GError
*error
= NULL
;
341 if (plugin_load(path
, dirname
, &error
))
344 playlist3_show_error_message(error
->message
, ERROR_CRITICAL
);
345 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
346 "Failed to load plugin: %s: %s\n", dirname
, error
->message
);
352 g_log(PLUGIN_LOG_DOMAIN
, G_LOG_LEVEL_INFO
,
353 "%s not loaded, wrong extention, should be: '%s'", dirname
, G_MODULE_SUFFIX
);
361 gtk_init_add(__show_plugin_load_error
, NULL
);
370 void gmpc_plugin_destroy(gmpcPluginParent
* plug
)
374 g_object_unref(plug
->new);
377 if (plug
->old
->destroy
)
379 plug
->old
->destroy();
384 void gmpc_plugin_init(gmpcPluginParent
* plug
)
398 void gmpc_plugin_status_changed(gmpcPluginParent
* plug
, MpdObj
* mi
, ChangedStatusType what
)
402 if (plug
->old
->mpd_status_changed
)
404 plug
->old
->mpd_status_changed(mi
, what
, NULL
);
409 const char *gmpc_plugin_get_name(gmpcPluginParent
* plug
)
411 /* if new plugin, use that method */
414 return gmpc_plugin_base_get_name(plug
->new);
416 g_assert(plug
->old
->name
!= NULL
);
417 return plug
->old
->name
;
421 void gmpc_plugin_save_yourself(gmpcPluginParent
* plug
)
425 gmpc_plugin_base_save_yourself(plug
->new);
428 if (plug
->old
->save_yourself
)
430 plug
->old
->save_yourself();
435 gboolean
gmpc_plugin_get_enabled(gmpcPluginParent
* plug
)
439 return gmpc_plugin_base_get_enabled(plug
->new);
441 if (plug
->old
->get_enabled
)
443 return plug
->old
->get_enabled();
449 void gmpc_plugin_set_enabled(gmpcPluginParent
* plug
, gboolean enabled
)
453 return gmpc_plugin_base_set_enabled(plug
->new, enabled
);
455 if (plug
->old
->set_enabled
)
457 plug
->old
->set_enabled(enabled
);
462 const gchar
*gmpc_plugin_get_translation_domain(gmpcPluginParent
* plug
)
466 return plug
->new->translation_domain
;
468 if (plug
->old
&& plug
->old
->get_translation_domain
)
470 return plug
->old
->get_translation_domain();
476 gchar
*gmpc_plugin_get_data_path(gmpcPlugin
* plug
)
479 gchar
*url
= g_win32_get_package_installation_directory_of_module(NULL
);
480 gchar
*retv
= g_build_path(G_DIR_SEPARATOR_S
, url
, "share", "gmpc", "plugins", NULL
);
481 return retv
; //g_strdup(plug->path);
484 const gchar
*const *paths
= g_get_system_data_dirs();
486 gchar
*homedir
= gmpc_get_user_path("");
487 if (strncmp(plug
->path
, homedir
, strlen(homedir
)) == 0)
489 url
= g_strdup(plug
->path
);
492 /* Ok it is a homedir */
493 url
= g_build_path(G_DIR_SEPARATOR_S
, PACKAGE_DATA_DIR
, "gmpc", "plugins", NULL
);
500 if (g_file_test(url
, G_FILE_TEST_EXISTS
| G_FILE_TEST_IS_DIR
))
508 for (i
= 0; paths
&& paths
[i
]; i
++)
510 url
= g_build_filename(paths
[i
], "gmpc", "plugins", NULL
);
511 if (g_file_test(url
, G_FILE_TEST_EXISTS
| G_FILE_TEST_IS_DIR
))
523 void gmpc_plugin_mpd_connection_changed(gmpcPluginParent
* plug
, MpdObj
* mi
, int connected
, gpointer data
)
525 g_assert(plug
!= NULL
);
529 if (plug
->old
->mpd_connection_changed
!= NULL
)
531 plug
->old
->mpd_connection_changed(mi
, connected
, data
);
536 gboolean
gmpc_plugin_is_browser(gmpcPluginParent
* plug
)
540 return GMPC_PLUGIN_IS_BROWSER_IFACE(plug
->new);
542 return ((plug
->old
->plugin_type
& GMPC_PLUGIN_PL_BROWSER
) != 0);
546 void gmpc_plugin_browser_unselected(gmpcPluginParent
* plug
, GtkWidget
* container
)
548 if (gmpc_plugin_is_browser(plug
))
552 gmpc_plugin_browser_iface_browser_unselected((GmpcPluginBrowserIface
*) plug
->new,
553 GTK_CONTAINER(container
));
556 g_assert(plug
->old
->browser
!= NULL
);
557 g_assert(plug
->old
->browser
->unselected
!= NULL
);
558 plug
->old
->browser
->unselected(container
);
563 void gmpc_plugin_browser_selected(gmpcPluginParent
* plug
, GtkWidget
* container
)
565 if (gmpc_plugin_is_browser(plug
))
569 gmpc_plugin_browser_iface_browser_selected((GmpcPluginBrowserIface
*) plug
->new, GTK_CONTAINER(container
));
572 g_assert(plug
->old
->browser
!= NULL
);
573 g_assert(plug
->old
->browser
->selected
!= NULL
);
574 plug
->old
->browser
->selected(container
);
579 void gmpc_plugin_browser_add(gmpcPluginParent
* plug
, GtkWidget
* cat_tree
)
581 if (gmpc_plugin_is_browser(plug
))
585 gmpc_plugin_browser_iface_browser_add((GmpcPluginBrowserIface
*) plug
->new, cat_tree
);
588 g_assert(plug
->old
->browser
!= NULL
);
589 if (plug
->old
->browser
->add
)
591 plug
->old
->browser
->add(cat_tree
);
597 int gmpc_plugin_browser_cat_right_mouse_menu(gmpcPluginParent
* plug
, GtkWidget
* menu
, int type
, GtkWidget
* tree
,
598 GdkEventButton
* event
)
600 if (gmpc_plugin_is_browser(plug
))
604 if (type
== plug
->new->id
)
605 return gmpc_plugin_browser_iface_browser_option_menu((GmpcPluginBrowserIface
*) plug
->new,
609 g_assert(plug
->old
->browser
!= NULL
);
610 if (plug
->old
->browser
->cat_right_mouse_menu
!= NULL
)
612 return plug
->old
->browser
->cat_right_mouse_menu(menu
, type
, tree
, event
);
619 int gmpc_plugin_browser_key_press_event(gmpcPluginParent
* plug
, GtkWidget
* mw
, GdkEventKey
* event
, int type
)
621 if (gmpc_plugin_is_browser(plug
))
625 /* not going to be implemented */
628 g_assert(plug
->old
->browser
!= NULL
);
629 if (plug
->old
->browser
->key_press_event
!= NULL
)
631 return plug
->old
->browser
->key_press_event(mw
, event
, type
);
638 int gmpc_plugin_browser_add_go_menu(gmpcPluginParent
* plug
, GtkWidget
* menu
)
640 if (gmpc_plugin_is_browser(plug
))
644 return gmpc_plugin_browser_iface_browser_add_go_menu((GmpcPluginBrowserIface
*) plug
->new, GTK_MENU(menu
));
646 g_assert(plug
->old
->browser
!= NULL
);
647 if (plug
->old
->browser
->add_go_menu
!= NULL
)
649 return plug
->old
->browser
->add_go_menu(menu
);
656 int gmpc_plugin_browser_song_list_option_menu(gmpcPluginParent
* plug
, GmpcMpdDataTreeview
* tree
, GtkMenu
* menu
)
660 if (GMPC_PLUGIN_IS_SONG_LIST_IFACE(plug
->new))
662 return gmpc_plugin_song_list_iface_song_list(GMPC_PLUGIN_SONG_LIST_IFACE(plug
->new), GTK_WIDGET(tree
),
667 if (gmpc_plugin_is_browser(plug
))
669 g_assert(plug
->old
->browser
!= NULL
);
670 if (plug
->old
->browser
->song_list_option_menu
)
672 return plug
->old
->browser
->song_list_option_menu(tree
, menu
);
679 gboolean
gmpc_plugin_browser_has_integrate_search(gmpcPluginParent
* plug
)
683 return GMPC_PLUGIN_IS_INTEGRATE_SEARCH_IFACE(plug
->new);
685 if (gmpc_plugin_is_browser(plug
))
687 return plug
->old
->browser
->integrate_search
!= NULL
;
693 MpdData
*gmpc_plugin_browser_integrate_search(gmpcPluginParent
* plug
, const int search_field
, const gchar
* query
,
696 if (!gmpc_plugin_browser_has_integrate_search(plug
))
699 return gmpc_plugin_integrate_search_iface_search(GMPC_PLUGIN_INTEGRATE_SEARCH_IFACE(plug
->new), search_field
,
701 return plug
->old
->browser
->integrate_search(search_field
, query
, error
);
705 gboolean
gmpc_plugin_browser_integrate_search_field_supported(gmpcPluginParent
* plug
, const int search_field
)
707 if (!gmpc_plugin_browser_has_integrate_search(plug
))
711 return gmpc_plugin_integrate_search_iface_field_supported(GMPC_PLUGIN_INTEGRATE_SEARCH_IFACE(plug
->new),
714 if (plug
->old
->browser
->integrate_search_field_supported
== NULL
)
716 return plug
->old
->browser
->integrate_search_field_supported(search_field
);
720 gboolean
gmpc_plugin_has_preferences(gmpcPluginParent
* plug
)
724 return GMPC_PLUGIN_IS_PREFERENCES_IFACE(plug
->new);
726 return (plug
->old
->pref
!= NULL
);
730 void gmpc_plugin_preferences_construct(gmpcPluginParent
* plug
, GtkWidget
* wid
)
732 if (gmpc_plugin_has_preferences(plug
))
736 gmpc_plugin_preferences_iface_preferences_pane_construct(GMPC_PLUGIN_PREFERENCES_IFACE(plug
->new),
740 g_assert(plug
->old
->pref
!= NULL
);
741 g_assert(plug
->old
->pref
->construct
);
742 plug
->old
->pref
->construct(wid
);
747 void gmpc_plugin_preferences_destroy(gmpcPluginParent
* plug
, GtkWidget
* wid
)
749 if (gmpc_plugin_has_preferences(plug
))
753 gmpc_plugin_preferences_iface_preferences_pane_destroy(GMPC_PLUGIN_PREFERENCES_IFACE(plug
->new),
757 g_assert(plug
->old
->pref
!= NULL
);
758 g_assert(plug
->old
->pref
->destroy
);
759 plug
->old
->pref
->destroy(wid
);
764 gboolean
gmpc_plugin_is_internal(gmpcPluginParent
* plug
)
768 return (((plug
->new->plugin_type
) & GMPC_INTERNALL
) != 0);
771 return (((plug
->old
->plugin_type
) & GMPC_INTERNALL
) != 0);
775 const int *gmpc_plugin_get_version(gmpcPluginParent
* plug
)
780 return (const int *)gmpc_plugin_base_get_version(plug
->new, &length
);
782 return (const int *)plug
->old
->version
;
786 int gmpc_plugin_get_type(gmpcPluginParent
* plug
)
790 return plug
->new->plugin_type
;
792 return plug
->old
->plugin_type
;
796 int gmpc_plugin_get_id(gmpcPluginParent
* plug
)
800 return plug
->new->id
;
802 return plug
->old
->id
;
806 gboolean
gmpc_plugin_is_metadata(gmpcPluginParent
* plug
)
810 return GMPC_PLUGIN_IS_META_DATA_IFACE(plug
->new);
812 return (plug
->old
->metadata
!= NULL
);
816 int gmpc_plugin_metadata_get_priority(gmpcPluginParent
* plug
)
818 if (gmpc_plugin_is_metadata(plug
))
821 return gmpc_plugin_meta_data_iface_get_priority(GMPC_PLUGIN_META_DATA_IFACE(plug
->new));
822 return plug
->old
->metadata
->get_priority();
828 void gmpc_plugin_metadata_set_priority(gmpcPluginParent
* plug
, int priority
)
830 if (gmpc_plugin_is_metadata(plug
))
833 return gmpc_plugin_meta_data_iface_set_priority(GMPC_PLUGIN_META_DATA_IFACE(plug
->new), priority
);
834 return plug
->old
->metadata
->set_priority(priority
);
839 void gmpc_plugin_metadata_query_metadata_list(gmpcPluginParent
* plug
, mpd_Song
* song
, MetaDataType type
,
840 void (*callback
) (GList
* uris
, gpointer data
), gpointer data
)
842 if (gmpc_plugin_is_metadata(plug
))
846 gmpc_plugin_meta_data_iface_get_metadata(GMPC_PLUGIN_META_DATA_IFACE(plug
->new), song
, type
, callback
,
850 if (plug
->old
->metadata
->get_metadata
)
852 plug
->old
->metadata
->get_metadata(song
, type
, callback
, data
);
856 callback(NULL
, data
);
860 gint
gmpc_plugin_tool_menu_integration(gmpcPluginParent
* plug
, GtkMenu
* menu
)
864 if (GMPC_PLUGIN_IS_TOOL_MENU_IFACE(plug
->new))
866 return gmpc_plugin_tool_menu_iface_tool_menu_integration(GMPC_PLUGIN_TOOL_MENU_IFACE(plug
->new), menu
);
872 if (plug
->old
->tool_menu_integration
)
873 return plug
->old
->tool_menu_integration(menu
);
878 gboolean
gmpc_plugin_has_enabled (gmpcPluginParent
*plug
)
884 if(plug
->old
&& plug
->old
->get_enabled
&& plug
->old
->set_enabled
) return TRUE
;