diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-07-25 17:08:36 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-07-25 17:09:53 +0200 |
commit | a25a21c65e9dd27e140ceef7ee8a80c213cea55c (patch) | |
tree | eef97d1ec4f86467b878cb06109222c4b6360082 /source | |
parent | f87696322045caefc6b6719e673ee289da2aa1fd (diff) |
Improve error message a little when bindings collide.
Issue: #640
Diffstat (limited to 'source')
-rw-r--r-- | source/dialogs/dmenu.c | 4 | ||||
-rw-r--r-- | source/keyb.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index ed54f448..691b79b9 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -452,7 +452,7 @@ static int dmenu_mode_init ( Mode *sw ) g_free ( estr ); } // If input is stdin, and a tty, do not read as rofi grabs input and therefor blocks. - if ( ! ( fd == STDIN_FILENO && isatty ( fd ) == 1 ) ) { + if ( !( fd == STDIN_FILENO && isatty ( fd ) == 1 ) ) { pd->cancel = g_cancellable_new (); pd->cancel_source = g_cancellable_connect ( pd->cancel, G_CALLBACK ( async_read_cancel ), pd, NULL ); pd->input_stream = g_unix_input_stream_new ( fd, fd != STDIN_FILENO ); @@ -734,7 +734,7 @@ int dmenu_switcher_dialog ( void ) find_arg_str ( "-p", &( dmenu_mode.display_name ) ); RofiViewState *state = rofi_view_create ( &dmenu_mode, input, menu_flags, dmenu_finalize ); // @TODO we should do this better. - if ( async && (pd->cancel != NULL ) ) { + if ( async && ( pd->cancel != NULL ) ) { rofi_view_set_overlay ( state, "Loading.. " ); } rofi_view_set_selected_line ( state, pd->selected_line ); diff --git a/source/keyb.c b/source/keyb.c index 04d498dd..243d12b3 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -156,7 +156,10 @@ gboolean parse_keys_abe ( NkBindings *bindings ) const char *const sep = ","; for ( char *entry = strtok_r ( keystr, sep, &sp ); entry != NULL; entry = strtok_r ( NULL, sep, &sp ) ) { if ( !nk_bindings_add_binding ( bindings, b->scope, entry, binding_trigger_action, GUINT_TO_POINTER ( b->id ), NULL, &error ) ) { - g_string_append_c ( g_string_append ( error_msg, error->message ), '\n' ); + char *str = g_markup_printf_escaped ( "Failed to set binding <i>%s</i> for: <i>%s (%s)</i>:\n\t<span size=\"smaller\" style=\"italic\">%s</span>\n", + b->binding, b->comment, b->name, error->message ); + g_string_append ( error_msg, str ); + g_free ( str ); g_clear_error ( &error ); } } |