diff options
-rw-r--r-- | plugins/gtkui/gtkui.c | 32 | ||||
-rw-r--r-- | plugins/gtkui/gtkui_api.h | 5 | ||||
-rw-r--r-- | plugins/gtkui/widgets.c | 2 |
3 files changed, 24 insertions, 15 deletions
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 2fa2173c..6f3760a9 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -822,20 +822,26 @@ init_widget_layout (void) { gtk_box_pack_start (GTK_BOX(lookup_widget(mainwin, "plugins_bottom_vbox")), rootwidget->widget, TRUE, TRUE, 0); // load layout + // config var name is defined in DDB_GTKUI_CONF_LAYOUT + // gtkui.layout: 0.6.0 and 0.6.1 + // gtkui.layout.major.minor.point: later versions + char layout[20000]; - deadbeef->conf_get_str ("gtkui.layout", gtkui_def_layout, layout, sizeof (layout)); - - int upgraded_062 = deadbeef->conf_get_int ("gtkui.layout_062_upgraded", 0); - if (strcmp (layout, gtkui_def_layout) && !upgraded_062) { - // add top bar - char layout_upgrade[20000]; - snprintf (layout_upgrade, sizeof (layout_upgrade), "vbox expand=\"0 1\" fill=\"1 1\" homogeneous=0 {hbox expand=\"0 1 0\" fill=\"1 1 1\" homogeneous=0 {playtb {} seekbar {} volumebar {} } %s }", layout); - strcpy (layout, layout_upgrade); - deadbeef->conf_set_str ("gtkui.layout", layout); - } - if (!upgraded_062) { - deadbeef->conf_set_int ("gtkui.layout_062_upgraded", 1); - deadbeef->conf_save (); + deadbeef->conf_get_str (DDB_GTKUI_CONF_LAYOUT, "-", layout, sizeof (layout)); + if (!strcmp (layout, "-")) { + // upgrade from 0.6.0 to 0.6.2 + char layout_060[20000]; + deadbeef->conf_get_str ("gtkui.layout", "-", layout_060, sizeof (layout_060)); + if (!strcmp (layout_060, "-")) { + // new setup + strcpy (layout, gtkui_def_layout); + } + else { + // upgrade with top bar + snprintf (layout, sizeof (layout), "vbox expand=\"0 1\" fill=\"1 1\" homogeneous=0 {hbox expand=\"0 1 0\" fill=\"1 1 1\" homogeneous=0 {playtb {} seekbar {} volumebar {} } %s }", layout_060); + deadbeef->conf_set_str (DDB_GTKUI_CONF_LAYOUT, layout); + deadbeef->conf_save (); + } } ddb_gtkui_widget_t *w = NULL; diff --git a/plugins/gtkui/gtkui_api.h b/plugins/gtkui/gtkui_api.h index c8057339..a3dd95d2 100644 --- a/plugins/gtkui/gtkui_api.h +++ b/plugins/gtkui/gtkui_api.h @@ -44,7 +44,10 @@ #endif #define DDB_GTKUI_API_VERSION_MAJOR 2 -#define DDB_GTKUI_API_VERSION_MINOR 0 +#define DDB_GTKUI_API_VERSION_MINOR 1 + +// added in API 2.1 +#define DDB_GTKUI_CONF_LAYOUT "gtkui.layout.0.6.2" // this flag tells that the widget should be added to h/vboxes with expand=FALSE #define DDB_GTKUI_WIDGET_FLAG_NON_EXPANDABLE 0x00000001 diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c index 2d499464..2f9ff7af 100644 --- a/plugins/gtkui/widgets.c +++ b/plugins/gtkui/widgets.c @@ -479,7 +479,7 @@ void w_save (void) { char buf[20000] = ""; save_widget_to_string (buf, sizeof (buf), rootwidget->children); - deadbeef->conf_set_str ("gtkui.layout", buf); + deadbeef->conf_set_str (DDB_GTKUI_CONF_LAYOUT, buf); deadbeef->conf_save (); } |