Commit b0fa66a7 authored by Tobias Ellinghaus's avatar Tobias Ellinghaus

Reference views by name, not a number

This removes (almost) all knowledge about existing views from dt's core
code. Instead of hardcoding the list of available views we just load
whatever we find in the corresponding directory and allow libs to
reference them by name. That also fixes bugs when loading a view failed
(for example map when osmgpsmap isn't installed), resulting in wrong
views being loaded in some cases.
parent a8df04e8
......@@ -49,6 +49,7 @@ FILE(GLOB SOURCE_FILES
"common/locallaplaciancl.c"
"common/metadata.c"
"common/mipmap_cache.c"
"common/module.c"
"common/noiseprofiles.c"
"common/pdf.c"
"common/styles.c"
......
......@@ -270,7 +270,7 @@ int dt_load_from_string(const gchar *input, gboolean open_image_in_dr, gboolean
if(id)
{
dt_film_open(id);
dt_ctl_switch_mode_to(DT_LIBRARY);
dt_ctl_switch_mode_to("lighttable");
}
else
{
......@@ -304,7 +304,7 @@ int dt_load_from_string(const gchar *input, gboolean open_image_in_dr, gboolean
if(open_image_in_dr)
{
dt_control_set_mouse_over_id(id);
dt_ctl_switch_mode_to(DT_DEVELOP);
dt_ctl_switch_mode_to("darkroom");
}
}
}
......@@ -965,13 +965,13 @@ int dt_init(int argc, char *argv[], const gboolean init_gui, const gboolean load
dt_gui_gtk_load_config();
}
dt_control_gui_mode_t mode = DT_LIBRARY;
const char *mode = "lighttable";
// april 1st: you have to earn using dt first! or know that you can switch views with keyboard shortcuts
time_t now;
time(&now);
struct tm lt;
localtime_r(&now, &lt);
if(lt.tm_mon == 3 && lt.tm_mday == 1) mode = DT_KNIGHT;
if(lt.tm_mon == 3 && lt.tm_mday == 1) mode = "knight";
if(init_gui)
{
// init the gui part of views
......@@ -1022,7 +1022,7 @@ int dt_init(int argc, char *argv[], const gboolean init_gui, const gboolean load
if(loaded_images == 1 && only_single_images)
{
dt_control_set_mouse_over_id(last_id);
mode = DT_DEVELOP;
mode = "darkroom";
}
#endif
}
......@@ -1065,7 +1065,7 @@ void dt_cleanup()
#endif
if(init_gui)
{
dt_ctl_switch_mode_to(DT_MODE_NONE);
dt_ctl_switch_mode_to("");
dt_dbus_destroy(darktable.dbus);
dt_control_shutdown(darktable.control);
......
......@@ -82,7 +82,7 @@ typedef unsigned int u_int;
#include "common/poison.h"
#endif
#define DT_MODULE_VERSION 16 // version of dt's module interface
#define DT_MODULE_VERSION 17 // version of dt's module interface
// every module has to define this:
#ifdef _DEBUG
......
/*
* This file is part of darktable,
* copyright (c) 2017 tobias ellinghaus.
*
* darktable is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* darktable is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with darktable. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <string.h>
#include <gmodule.h>
#include "config.h"
#include "common/file_location.h"
#include "common/module.h"
GList *dt_module_load_modules(const char *subdir, size_t module_size,
int (*load_module_so)(void *module, const char *libname, const char *plugin_name),
void (*init_module)(void *module),
gint (*sort_modules)(gconstpointer a, gconstpointer b))
{
GList *plugin_list = NULL;
char plugindir[PATH_MAX] = { 0 };
const gchar *dir_name;
dt_loc_get_plugindir(plugindir, sizeof(plugindir));
g_strlcat(plugindir, subdir, sizeof(plugindir));
GDir *dir = g_dir_open(plugindir, 0, NULL);
if(!dir) return NULL;
const int name_offset = strlen(SHARED_MODULE_PREFIX),
name_end = strlen(SHARED_MODULE_PREFIX) + strlen(SHARED_MODULE_SUFFIX);
while((dir_name = g_dir_read_name(dir)))
{
// get lib*.so
if(!g_str_has_prefix(dir_name, SHARED_MODULE_PREFIX)) continue;
if(!g_str_has_suffix(dir_name, SHARED_MODULE_SUFFIX)) continue;
char *plugin_name = g_strndup(dir_name + name_offset, strlen(dir_name) - name_end);
void *module = calloc(1, module_size);
gchar *libname = g_module_build_path(plugindir, plugin_name);
int res = load_module_so(module, libname, plugin_name);
g_free(libname);
g_free(plugin_name);
if(res)
{
free(module);
continue;
}
plugin_list = g_list_append(plugin_list, module);
if(init_module) init_module(module);
}
g_dir_close(dir);
if(sort_modules) plugin_list = g_list_sort(plugin_list, sort_modules);
return plugin_list;
}
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
/*
* This file is part of darktable,
* copyright (c) 2017 tobias ellinghaus.
*
* darktable is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* darktable is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with darktable. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib.h>
GList *dt_module_load_modules(const char *subdir, size_t module_size,
int (*load_module_so)(void *module, const char *libname, const char *plugin_name),
void (*init_module)(void *module),
gint (*sort_modules)(gconstpointer a, gconstpointer b));
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
......@@ -58,8 +58,6 @@ void dt_control_init(dt_control_t *s)
s->log_message_timeout_id = 0;
dt_pthread_mutex_init(&(s->log_mutex), NULL);
dt_conf_set_int("ui_last/view", DT_MODE_NONE);
pthread_cond_init(&s->cond, NULL);
dt_pthread_mutex_init(&s->cond_mutex, NULL);
dt_pthread_mutex_init(&s->queue_mutex, NULL);
......@@ -393,37 +391,49 @@ void dt_control_button_released(double x, double y, int which, uint32_t state)
dt_view_manager_button_released(darktable.view_manager, x - tb, y - tb, which, state);
}
static gboolean _dt_ctl_switch_mode_to(gpointer user_data)
static void _dt_ctl_switch_mode_prepare()
{
dt_control_gui_mode_t mode = GPOINTER_TO_INT(user_data);
darktable.control->button_down = 0;
darktable.control->button_down_which = 0;
darktable.gui->center_tooltip = 0;
GtkWidget *widget = dt_ui_center(darktable.gui->ui);
gtk_widget_set_tooltip_text(widget, "");
}
if(!dt_view_manager_switch(darktable.view_manager, mode))
dt_conf_set_int("ui_last/view", mode);
static gboolean _dt_ctl_switch_mode_to(gpointer user_data)
{
const char *mode = (const char*)user_data;
_dt_ctl_switch_mode_prepare();
dt_view_manager_switch(darktable.view_manager, mode);
return FALSE;
}
static gboolean _dt_ctl_switch_mode_to_by_view(gpointer user_data)
{
const dt_view_t *view = (const dt_view_t*)user_data;
_dt_ctl_switch_mode_prepare();
dt_view_manager_switch_by_view(darktable.view_manager, view);
return FALSE;
}
void dt_ctl_switch_mode_to(dt_control_gui_mode_t mode)
void dt_ctl_switch_mode_to(const char *mode)
{
dt_control_gui_mode_t oldmode = dt_conf_get_int("ui_last/view");
if(oldmode == mode) return;
const dt_view_t *current_view = dt_view_manager_get_current_view(darktable.view_manager);
if(current_view && !strcmp(mode, current_view->module_name)) return;
g_main_context_invoke(NULL, _dt_ctl_switch_mode_to, (gpointer)mode);
}
g_main_context_invoke(NULL, _dt_ctl_switch_mode_to, GINT_TO_POINTER(mode));
void dt_ctl_switch_mode_to_by_view(const dt_view_t *view)
{
if(view == dt_view_manager_get_current_view(darktable.view_manager)) return;
g_main_context_invoke(NULL, _dt_ctl_switch_mode_to_by_view, (gpointer)view);
}
void dt_ctl_switch_mode()
{
dt_control_gui_mode_t mode = dt_conf_get_int("ui_last/view");
if(mode == DT_LIBRARY)
mode = DT_DEVELOP;
else
mode = DT_LIBRARY;
const dt_view_t *view = dt_view_manager_get_current_view(darktable.view_manager);
const char *mode = (view && !strcmp(view->module_name, "lighttable")) ? "darkroom" : "lighttable";
dt_ctl_switch_mode_to(mode);
}
......
......@@ -39,24 +39,6 @@
struct dt_lib_backgroundjob_element_t;
typedef enum dt_control_gui_mode_t
{
DT_LIBRARY = 0,
DT_DEVELOP,
#ifdef HAVE_GPHOTO2
DT_CAPTURE,
#endif
#ifdef HAVE_MAP
DT_MAP,
#endif
DT_SLIDESHOW,
#ifdef HAVE_PRINT
DT_PRINT,
#endif
DT_KNIGHT,
DT_MODE_NONE
} dt_control_gui_mode_t;
typedef GdkCursorType dt_cursor_t;
// called from gui
......@@ -98,7 +80,8 @@ void dt_control_queue_redraw_center();
void dt_control_queue_redraw_widget(GtkWidget *widget);
void dt_ctl_switch_mode();
void dt_ctl_switch_mode_to(dt_control_gui_mode_t mode);
void dt_ctl_switch_mode_to(const char *mode);
void dt_ctl_switch_mode_to_by_view(const dt_view_t *view);
struct dt_control_t;
......
......@@ -336,7 +336,7 @@ static int32_t dt_camera_import_job_run(dt_job_t *job)
// Switch to new filmroll
dt_film_open(dt_import_session_film_id(params->shared.session));
dt_ctl_switch_mode_to(DT_LIBRARY);
dt_ctl_switch_mode_to("lighttable");
// register listener
dt_camctl_listener_t listener = { 0 };
......
......@@ -24,6 +24,7 @@
#include "common/dtpthread.h"
#include "common/imageio_rawspeed.h"
#include "common/interpolation.h"
#include "common/module.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/blend.h"
......@@ -204,8 +205,9 @@ static dt_introspection_field_t *default_get_f(const char *name)
return NULL;
}
int dt_iop_load_module_so(dt_iop_module_so_t *module, const char *libname, const char *op)
int dt_iop_load_module_so(void *m, const char *libname, const char *op)
{
dt_iop_module_so_t *module = (dt_iop_module_so_t *)m;
g_strlcpy(module->op, op, 20);
module->data = NULL;
dt_print(DT_DEBUG_CONTROL, "[iop_load_module] loading iop `%s' from %s\n", op, libname);
......@@ -1257,59 +1259,38 @@ static void init_key_accels(dt_iop_module_so_t *module)
sqlite3_finalize(stmt);
}
void dt_iop_load_modules_so()
static void dt_iop_init_module_so(void *m)
{
GList *res = NULL;
dt_iop_module_so_t *module;
darktable.iop = NULL;
char plugindir[PATH_MAX] = { 0 }, op[20];
const gchar *d_name;
dt_loc_get_plugindir(plugindir, sizeof(plugindir));
g_strlcat(plugindir, "/plugins", sizeof(plugindir));
GDir *dir = g_dir_open(plugindir, 0, NULL);
if(!dir) return;
const int name_offset = strlen(SHARED_MODULE_PREFIX),
name_end = strlen(SHARED_MODULE_PREFIX) + strlen(SHARED_MODULE_SUFFIX);
while((d_name = g_dir_read_name(dir)))
dt_iop_module_so_t *module = (dt_iop_module_so_t *)m;
init_presets(module);
// do not init accelerators if there is no gui
if(darktable.gui)
{
// get lib*.so
if(!g_str_has_prefix(d_name, SHARED_MODULE_PREFIX)) continue;
if(!g_str_has_suffix(d_name, SHARED_MODULE_SUFFIX)) continue;
g_strlcpy(op, d_name + name_offset, MIN(sizeof(op), strlen(d_name) - name_end + 1));
module = (dt_iop_module_so_t *)calloc(1, sizeof(dt_iop_module_so_t));
gchar *libname = g_module_build_path(plugindir, (const gchar *)op);
if(dt_iop_load_module_so(module, libname, op))
// Calling the accelerator initialization callback, if present
init_key_accels(module);
if(module->flags() & IOP_FLAGS_SUPPORTS_BLENDING)
{
free(module);
continue;
dt_accel_register_slider_iop(module, FALSE, NC_("accel", "fusion"));
}
g_free(libname);
res = g_list_append(res, module);
init_presets(module);
// do not init accelerators if there is no gui
if(darktable.gui)
if(!(module->flags() & IOP_FLAGS_DEPRECATED))
{
// Calling the accelerator initialization callback, if present
init_key_accels(module);
// Adding the optional show accelerator to the table (blank)
dt_accel_register_iop(module, FALSE, NC_("accel", "show module"), 0, 0);
dt_accel_register_iop(module, FALSE, NC_("accel", "enable module"), 0, 0);
if(module->flags() & IOP_FLAGS_SUPPORTS_BLENDING)
{
dt_accel_register_slider_iop(module, FALSE, NC_("accel", "fusion"));
}
if(!(module->flags() & IOP_FLAGS_DEPRECATED))
{
// Adding the optional show accelerator to the table (blank)
dt_accel_register_iop(module, FALSE, NC_("accel", "show module"), 0, 0);
dt_accel_register_iop(module, FALSE, NC_("accel", "enable module"), 0, 0);
dt_accel_register_iop(module, FALSE, NC_("accel", "reset module parameters"), 0, 0);
dt_accel_register_iop(module, FALSE, NC_("accel", "show preset menu"), 0, 0);
}
dt_accel_register_iop(module, FALSE, NC_("accel", "reset module parameters"), 0, 0);
dt_accel_register_iop(module, FALSE, NC_("accel", "show preset menu"), 0, 0);
}
}
g_dir_close(dir);
darktable.iop = res;
}
void dt_iop_load_modules_so()
{
darktable.iop = dt_module_load_modules("/plugins", sizeof(dt_iop_module_so_t), dt_iop_load_module_so,
dt_iop_init_module_so, NULL);
}
int dt_iop_load_module(dt_iop_module_t *module, dt_iop_module_so_t *module_so, dt_develop_t *dev)
......
......@@ -118,7 +118,6 @@ void dt_accel_register_global(const gchar *path, guint accel_key, GdkModifierTyp
g_strlcpy(accel->translated_path, accel_path, sizeof(accel->translated_path));
*(accel->module) = '\0';
accel->views = DT_VIEW_DARKROOM | DT_VIEW_LIGHTTABLE | DT_VIEW_TETHERING;
accel->local = FALSE;
darktable.control->accelerator_list = g_slist_prepend(darktable.control->accelerator_list, accel);
}
......@@ -136,7 +135,6 @@ void dt_accel_register_view(dt_view_t *self, const gchar *path, guint accel_key,
g_strlcpy(accel->translated_path, accel_path, sizeof(accel->translated_path));
g_strlcpy(accel->module, self->module_name, sizeof(accel->module));
accel->views = self->view(self);
accel->local = FALSE;
darktable.control->accelerator_list = g_slist_prepend(darktable.control->accelerator_list, accel);
}
......@@ -156,7 +154,6 @@ void dt_accel_register_iop(dt_iop_module_so_t *so, gboolean local, const gchar *
g_strlcpy(accel->module, so->op, sizeof(accel->module));
accel->local = local;
accel->views = DT_VIEW_DARKROOM;
darktable.control->accelerator_list = g_slist_prepend(darktable.control->accelerator_list, accel);
}
......@@ -173,7 +170,6 @@ void dt_accel_register_lib(dt_lib_module_t *self, const gchar *path, guint accel
g_strlcpy(accel->module, self->plugin_name, sizeof(accel->module));
accel->local = FALSE;
accel->views = self->views(self);
darktable.control->accelerator_list = g_slist_prepend(darktable.control->accelerator_list, accel);
}
......@@ -206,7 +202,6 @@ void dt_accel_register_slider_iop(dt_iop_module_so_t *so, gboolean local, const
g_strlcpy(accel->translated_path, paths_trans[i], sizeof(accel->translated_path));
g_strlcpy(accel->module, so->op, sizeof(accel->module));
accel->local = local;
accel->views = DT_VIEW_DARKROOM;
darktable.control->accelerator_list = g_slist_prepend(darktable.control->accelerator_list, accel);
}
......@@ -225,7 +220,6 @@ void dt_accel_register_lua(const gchar *path, guint accel_key, GdkModifierType m
g_strlcpy(accel->translated_path, accel_path, sizeof(accel->translated_path));
*(accel->module) = '\0';
accel->views = DT_VIEW_DARKROOM | DT_VIEW_LIGHTTABLE | DT_VIEW_TETHERING;
accel->local = FALSE;
darktable.control->accelerator_list = g_slist_prepend(darktable.control->accelerator_list, accel);
}
......
......@@ -30,7 +30,6 @@ typedef struct dt_accel_t
gchar path[256];
gchar translated_path[256];
gchar module[256];
guint views;
gboolean local;
GClosure *closure;
......
......@@ -60,6 +60,16 @@
#define DT_UI_PANEL_MODULE_SPACING 3
typedef enum dt_gui_view_switch_t
{
DT_GUI_VIEW_SWITCH_TO_TETHERING = 1,
DT_GUI_VIEW_SWITCH_TO_LIGHTTABLE,
DT_GUI_VIEW_SWITCH_TO_DARKROOM,
DT_GUI_VIEW_SWITCH_TO_MAP,
DT_GUI_VIEW_SWITCH_TO_SLIDESHOW,
DT_GUI_VIEW_SWITCH_TO_PRINT
} dt_gui_view_switch_to_t;
const char *_ui_panel_config_names[]
= { "header", "toolbar_top", "toolbar_bottom", "left", "right", "bottom" };
......@@ -416,9 +426,7 @@ static gboolean draw_borders(GtkWidget *widget, cairo_t *crf, gpointer user_data
cairo_paint(cr);
// draw scrollbar indicators
int v = darktable.view_manager->current_view;
dt_view_t *view = NULL;
if(v >= 0 && v < darktable.view_manager->num_views) view = darktable.view_manager->view + v;
const dt_view_t *view = dt_view_manager_get_current_view(darktable.view_manager);
color_found = gtk_style_context_lookup_color (context, "bg_color", &color);
if(!color_found)
{
......@@ -590,7 +598,6 @@ static gboolean borders_scrolled(GtkWidget *widget, GdkEventScroll *event, gpoin
int dt_gui_gtk_load_config()
{
GtkWidget *widget = dt_ui_main_window(darktable.gui->ui);
dt_conf_set_int("ui_last/view", DT_MODE_NONE);
int width = dt_conf_get_int("ui_last/window_w");
int height = dt_conf_get_int("ui_last/window_h");
gint x = MAX(0, dt_conf_get_int("ui_last/window_x"));
......@@ -678,41 +685,37 @@ static gboolean _gui_switch_view_key_accel_callback(GtkAccelGroup *accel_group,
guint keyval, GdkModifierType modifier, gpointer p)
{
int view = GPOINTER_TO_INT(p);
dt_control_gui_mode_t mode = DT_MODE_NONE;
const char *mode = "";
/* do some setup before switch view*/
switch(view)
{
#ifdef HAVE_GPHOTO2
case DT_GUI_VIEW_SWITCH_TO_TETHERING:
mode = DT_CAPTURE;
mode = "tethering";
break;
#endif
case DT_GUI_VIEW_SWITCH_TO_DARKROOM:
mode = DT_DEVELOP;
mode = "darkroom";
break;
case DT_GUI_VIEW_SWITCH_TO_LIBRARY:
mode = DT_LIBRARY;
case DT_GUI_VIEW_SWITCH_TO_LIGHTTABLE:
mode = "lighttable";
break;
#ifdef HAVE_MAP
case DT_GUI_VIEW_SWITCH_TO_MAP:
mode = DT_MAP;
mode = "map";
break;
#endif
case DT_GUI_VIEW_SWITCH_TO_SLIDESHOW:
mode = DT_SLIDESHOW;
mode = "slideshow";
break;
#ifdef HAVE_PRINT
case DT_GUI_VIEW_SWITCH_TO_PRINT:
mode = DT_PRINT;
mode = "print";
break;
#endif
}
/* try switch to mode */
if(mode != DT_MODE_NONE) dt_ctl_switch_mode_to(mode);
if(*mode) dt_ctl_switch_mode_to(mode);
return TRUE;
}
......@@ -1048,7 +1051,7 @@ int dt_gui_gtk_init(dt_gui_gtk_t *gui)
GINT_TO_POINTER(DT_GUI_VIEW_SWITCH_TO_TETHERING), NULL));
dt_accel_connect_global("lighttable view",
g_cclosure_new(G_CALLBACK(_gui_switch_view_key_accel_callback),
GINT_TO_POINTER(DT_GUI_VIEW_SWITCH_TO_LIBRARY), NULL));
GINT_TO_POINTER(DT_GUI_VIEW_SWITCH_TO_LIGHTTABLE), NULL));
dt_accel_connect_global("darkroom view",
g_cclosure_new(G_CALLBACK(_gui_switch_view_key_accel_callback),
GINT_TO_POINTER(DT_GUI_VIEW_SWITCH_TO_DARKROOM), NULL));
......
......@@ -29,16 +29,6 @@
* DPI */
#define DT_PIXEL_APPLY_DPI(value) ((value) * darktable.gui->dpi_factor)
typedef enum dt_gui_view_switch_t
{
DT_GUI_VIEW_SWITCH_TO_TETHERING = 1,
DT_GUI_VIEW_SWITCH_TO_LIBRARY,
DT_GUI_VIEW_SWITCH_TO_DARKROOM,
DT_GUI_VIEW_SWITCH_TO_MAP,
DT_GUI_VIEW_SWITCH_TO_SLIDESHOW,
DT_GUI_VIEW_SWITCH_TO_PRINT
} dt_gui_view_switch_to_t;
typedef struct dt_gui_widgets_t
{
......
......@@ -785,7 +785,6 @@ static void delete_matching_accels(gpointer current, gpointer mapped)
if(current_key.accel_key == mapped_key.accel_key // Key code matches
&& current_key.accel_mods == mapped_key.accel_mods // Key state matches
&& current_accel->views & mapped_accel->views // Conflicting views
&& !(current_accel->local && mapped_accel->local // Not both local to
&& strcmp(current_accel->module, mapped_accel->module))) // diff mods
gtk_accel_map_change_entry(current_accel->path, 0, 0, TRUE);
......
......@@ -53,9 +53,10 @@ const char *name(dt_lib_module_t *self)
return _("background jobs");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_LIGHTTABLE | DT_VIEW_TETHERING | DT_VIEW_DARKROOM | DT_VIEW_MAP | DT_VIEW_PRINT;
static const char *v[] = {"*", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -78,9 +78,10 @@ const char *name(dt_lib_module_t *self)
return _("camera settings");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_TETHERING;
static const char *v[] = {"tethering", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......@@ -210,7 +211,7 @@ static gboolean _bailout_of_tethering(gpointer user_data)
dt_camctl_unregister_listener(darktable.camctl, lib->data.listener);
/* switch back to library mode */
dt_ctl_switch_mode_to(DT_LIBRARY);
dt_ctl_switch_mode_to("lighttable");
return FALSE;
}
......
......@@ -200,9 +200,10 @@ int set_params(dt_lib_module_t *self, const void *params, int size)
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_LIGHTTABLE | DT_VIEW_MAP | DT_VIEW_PRINT;
static const char *v[] = {"lighttable", "map", "print", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -52,9 +52,10 @@ const char *name(dt_lib_module_t *self)
return _("color picker");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_DARKROOM;
static const char *v[] = {"darkroom", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -51,9 +51,10 @@ const char *name(dt_lib_module_t *self)
return _("history stack");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_LIGHTTABLE;
static const char *v[] = {"lighttable", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -64,9 +64,10 @@ const char *name(dt_lib_module_t *self)
return _("export selected");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_LIGHTTABLE;
static const char *v[] = {"lighttable", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -44,9 +44,10 @@ const char *name(dt_lib_module_t *self)
return _("geotagging");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_LIGHTTABLE;
static const char *v[] = {"lighttable", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -62,9 +62,10 @@ const char *name(dt_lib_module_t *self)
return _("histogram");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_DARKROOM | DT_VIEW_TETHERING;
static const char *v[] = {"darkroom", "tethering", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -63,9 +63,10 @@ const char *name(dt_lib_module_t *self)
return _("history");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_DARKROOM;
static const char *v[] = {"darkroom", NULL};
return v;
}
uint32_t container(dt_lib_module_t *self)
......
......@@ -51,9 +51,10 @@ const char *name(dt_lib_module_t *self)
return _("selected image[s]");
}
uint32_t views(dt_lib_module_t *self)
const char **views(dt_lib_module_t *self)
{
return DT_VIEW_LIGHTTABLE;
static const char *v[] = {"lighttable", NULL};
return v;
}