summaryrefslogtreecommitdiffstats
path: root/source/mode.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/mode.c')
-rw-r--r--source/mode.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/mode.c b/source/mode.c
index 2e2cdfa3..7cb070de 100644
--- a/source/mode.c
+++ b/source/mode.c
@@ -45,9 +45,16 @@ int mode_init(Mode *mode) {
g_return_val_if_fail(mode != NULL, FALSE);
g_return_val_if_fail(mode->_init != NULL, FALSE);
if (mode->type == MODE_TYPE_UNSET) {
- g_warning("Mode '%s' does not have a type set. Please update mode.",
+ g_warning("Mode '%s' does not have a type set. Please update mode/plugin.",
mode->name);
}
+ if ((mode->type & MODE_TYPE_COMPLETER) == MODE_TYPE_COMPLETER) {
+ if (mode->_completer_result == NULL) {
+ g_error(
+ "Mode '%s' is incomplete and does not implement _completer_result.",
+ mode->name);
+ }
+ }
// to make sure this is initialized correctly.
mode->fallback_icon_fetch_uid = 0;
mode->fallback_icon_not_found = FALSE;
@@ -229,4 +236,13 @@ ModeMode mode_completer_result(Mode *mode, int menu_retv, char **input,
return 0;
}
+gboolean mode_is_completer(const Mode *mode) {
+ if (mode) {
+ if ((mode->type & MODE_TYPE_COMPLETER) == MODE_TYPE_COMPLETER) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
/**@}*/