diff options
author | waker <wakeroid@gmail.com> | 2013-08-11 16:24:37 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2013-08-11 16:24:37 +0200 |
commit | 748ca83990821a667093fcef30b9c7d1b28589b9 (patch) | |
tree | ad971f0b128a6fffabc8ed5e98152ec704c5307d | |
parent | b5c822c7afe8433cc5e0b14bfc1de21236849680 (diff) |
gtkui major version bump and related fixes
-rw-r--r-- | plugins/converter/convgui.c | 8 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 8 | ||||
-rw-r--r-- | plugins/gtkui/gtkui_api.h | 9 | ||||
-rw-r--r-- | plugins/pltbrowser/pltbrowser.c | 19 | ||||
-rw-r--r-- | plugins/shellexecui/shellexecui.c | 16 |
5 files changed, 27 insertions, 33 deletions
diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c index ccb15878..8680f9c4 100644 --- a/plugins/converter/convgui.c +++ b/plugins/converter/convgui.c @@ -1446,11 +1446,7 @@ convgui_get_actions (DB_playItem_t *it) int convgui_connect (void) { -#if GTK_CHECK_VERSION(3,0,0) - gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui3"); -#else - gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui"); -#endif + gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id (GTKUI_PLUGIN_ID); converter_plugin = (ddb_converter_t *)deadbeef->plug_get_for_id ("converter"); if (!gtkui_plugin) { fprintf (stderr, "convgui: gtkui plugin not found\n"); @@ -1460,7 +1456,7 @@ convgui_connect (void) { fprintf (stderr, "convgui: converter plugin not found\n"); return -1; } - if (converter_plugin->misc.plugin.version_major != 1 || converter_plugin->misc.plugin.version_minor < 2) { + if (!PLUG_TEST_COMPAT(&converter_plugin->misc.plugin, 1, 2)) { fprintf (stderr, "convgui: need converter>=1.2, but found %d.%d\n", converter_plugin->misc.plugin.version_major, converter_plugin->misc.plugin.version_minor); return -1; } diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index a982fe2c..12cc8ec1 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -1719,15 +1719,14 @@ static const char settings_dlg[] = static ddb_gtkui_t plugin = { .gui.plugin.api_vmajor = 1, .gui.plugin.api_vminor = 4, - .gui.plugin.version_major = 1, - .gui.plugin.version_minor = 0, + .gui.plugin.version_major = 2, + .gui.plugin.version_minor = GTKUI_API_VERSION, .gui.plugin.type = DB_PLUGIN_MISC, + .gui.plugin.id = GTKUI_PLUGIN_ID, #if GTK_CHECK_VERSION(3,0,0) - .gui.plugin.id = "gtkui3", .gui.plugin.name = "GTK3 user interface", .gui.plugin.descr = "User interface using GTK+ 3.x", #else - .gui.plugin.id = "gtkui", .gui.plugin.name = "GTK2 user interface", .gui.plugin.descr = "User interface using GTK+ 2.x", #endif @@ -1770,5 +1769,4 @@ static ddb_gtkui_t plugin = { .w_replace = w_replace, .w_remove = w_remove, .create_pltmenu = gtkui_create_pltmenu, - .api_version = GTKUI_API_VERSION, }; diff --git a/plugins/gtkui/gtkui_api.h b/plugins/gtkui/gtkui_api.h index 125c2ef7..a1e88afd 100644 --- a/plugins/gtkui/gtkui_api.h +++ b/plugins/gtkui/gtkui_api.h @@ -25,7 +25,13 @@ #ifndef __GTKUI_API_H #define __GTKUI_API_H -#define GTKUI_API_VERSION 1 // for compile-time checking +#define GTKUI_API_VERSION 0 + +#if GTK_CHECK_VERSION(3,0,0) +#define GTKUI_PLUGIN_ID "gtkui3_1" +#else +#define GTKUI_PLUGIN_ID "gtkui_1" +#endif typedef struct ddb_gtkui_widget_s { const char *type; @@ -95,7 +101,6 @@ typedef struct ddb_gtkui_widget_s { typedef struct { DB_gui_t gui; - int api_version; // returns main window ptr GtkWidget * (*get_mainwin) (void); diff --git a/plugins/pltbrowser/pltbrowser.c b/plugins/pltbrowser/pltbrowser.c index b7e16ba6..8d4febfc 100644 --- a/plugins/pltbrowser/pltbrowser.c +++ b/plugins/pltbrowser/pltbrowser.c @@ -165,31 +165,23 @@ w_pltbrowser_create (void) { return (ddb_gtkui_widget_t *)w; } -static gboolean -pltbrowser_connect_cb (void *ctx) { - return FALSE; -} - static int pltbrowser_connect (void) { -#if GTK_CHECK_VERSION(3,0,0) - gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui3"); -#else - gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui"); -#endif + gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id (GTKUI_PLUGIN_ID); if(!gtkui_plugin) { + fprintf (stderr, "pltbrowser: can't find gtkui plugin\n"); return -1; } gtkui_plugin->w_reg_widget ("pltbrowser", _("Playlist browser"), w_pltbrowser_create); - // need to do it in gtk thread - g_idle_add (pltbrowser_connect_cb, NULL); return 0; } static int pltbrowser_disconnect (void) { - gtkui_plugin->w_unreg_widget ("pltbrowser"); + if (gtkui_plugin) { + gtkui_plugin->w_unreg_widget ("pltbrowser"); + } return 0; } @@ -200,6 +192,7 @@ static DB_misc_t plugin = { .plugin.version_minor = 0, .plugin.type = DB_PLUGIN_MISC, .plugin.id = "pltbrowser", + .plugin.name = "pltbrowser", .plugin.descr = "Playlist browser", .plugin.copyright = "DeaDBeeF -- the music player\n" diff --git a/plugins/shellexecui/shellexecui.c b/plugins/shellexecui/shellexecui.c index 15440523..a473f67b 100644 --- a/plugins/shellexecui/shellexecui.c +++ b/plugins/shellexecui/shellexecui.c @@ -375,17 +375,19 @@ shxui_getactions(DB_playItem_t *it) { } int shxui_connect() { -#if GTK_CHECK_VERSION(3,0,0) - gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui3"); -#else - gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui"); -#endif + gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id (GTKUI_PLUGIN_ID); + if (!gtkui_plugin) { + fprintf (stderr, "shellexecui: can't find gtkui plugin\n"); + return -1; + } shellexec_plugin = (Shx_plugin_t *)deadbeef->plug_get_for_id ("shellexec"); - if(!gtkui_plugin || !shellexec_plugin) { + if (!shellexec_plugin) { + fprintf (stderr, "shellexecui: can't find shellexec plugin\n"); return -1; } - if(shellexec_plugin->misc.plugin.version_major == 1 && + if(shellexec_plugin->misc.plugin.version_major != 1 || shellexec_plugin->misc.plugin.version_minor < 1) { + fprintf (stderr, "shellexecui: requires shellexec version 1.1 or higher\n"); return -1; } return 0; |