From 9121732e36c0299f586a1948696aa1f4f329bac4 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 19 Feb 2016 21:16:35 +0100 Subject: Cleanups. --- source/dialogs/dmenu.c | 22 ++++++++++------------ source/rofi.c | 3 --- source/view.c | 3 +-- source/x11-helper.c | 1 - 4 files changed, 11 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index cd10dac5..7e0104c5 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -44,9 +44,6 @@ // We limit at 1000000 rows for now. #define DMENU_MAX_ROWS 1000000 -// TODO HACK TO BE REMOVED -extern Display *display; - struct range_pair { unsigned int start; @@ -359,7 +356,7 @@ Mode dmenu_mode = .free = NULL }; -static void dmenu_finish ( RofiViewState *state, int retv) +static void dmenu_finish ( RofiViewState *state, int retv ) { if ( retv == FALSE ) { rofi_set_return_code ( EXIT_FAILURE ); @@ -378,7 +375,7 @@ static void dmenu_finish ( RofiViewState *state, int retv) static void dmenu_finalize ( RofiViewState *state ) { int retv = FALSE; - DmenuModePrivateData *pd = (DmenuModePrivateData *) (Mode *) ( rofi_view_get_mode ( state ) )->private_data; + DmenuModePrivateData *pd = (DmenuModePrivateData *) rofi_view_get_mode ( state )->private_data; unsigned int cmd_list_length = pd->cmd_list_length; char **cmd_list = pd->cmd_list; @@ -389,7 +386,6 @@ static void dmenu_finalize ( RofiViewState *state ) int restart = 0; // Special behavior. - // TODO clean this up! if ( pd->only_selected ) { /** * Select item mode. @@ -406,9 +402,9 @@ static void dmenu_finalize ( RofiViewState *state ) retv = TRUE; if ( ( mretv & MENU_QUICK_SWITCH ) ) { retv = 10 + ( mretv & MENU_LOWER_MASK ); - } + } g_free ( input ); - dmenu_finish(state, retv); + dmenu_finish ( state, retv ); return; } pd->selected_line = next_pos - 1; @@ -417,7 +413,7 @@ static void dmenu_finalize ( RofiViewState *state ) rofi_view_restart ( state ); rofi_view_set_selected_line ( state, pd->selected_line ); if ( !restart ) { - dmenu_finish(state, retv); + dmenu_finish ( state, retv ); } return; } @@ -479,7 +475,7 @@ static void dmenu_finalize ( RofiViewState *state ) rofi_view_set_selected_line ( state, pd->selected_line ); } else { - dmenu_finish(state,retv); + dmenu_finish ( state, retv ); } } @@ -539,8 +535,10 @@ int dmenu_switcher_dialog ( void ) g_strfreev ( tokens ); return TRUE; } - // TODO remove - RofiViewState *state = rofi_view_create ( &dmenu_mode, input, pd->prompt, pd->message, menu_flags, dmenu_finalize ); + RofiViewState *state = rofi_view_create ( + &dmenu_mode, input, + pd->prompt, pd->message, + menu_flags, dmenu_finalize ); rofi_view_set_selected_line ( state, pd->selected_line ); rofi_view_set_active ( state ); diff --git a/source/rofi.c b/source/rofi.c index fad1d027..66b10f32 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -270,9 +270,6 @@ int show_error_message ( const char *msg, int markup ) return EXIT_FAILURE; } rofi_view_error_dialog ( msg, markup ); - //teardown ( pfd ); - // TODO this looks incorrect. - // g_main_loop_quit ( main_loop ); return EXIT_SUCCESS; } diff --git a/source/view.c b/source/view.c index 7bebdd8d..6cf44f1f 100644 --- a/source/view.c +++ b/source/view.c @@ -1665,8 +1665,7 @@ void rofi_view_error_dialog ( const char *msg, int markup ) state->update = TRUE; state->border = config.padding + config.menu_bw; state->x11_event_loop = __error_dialog_event_loop; - // TODO fix - state->finalize = process_result_error; + state->finalize = process_result_error; // Try to grab the keyboard as early as possible. // We grab this using the rootwindow (as dmenu does it). diff --git a/source/x11-helper.c b/source/x11-helper.c index 7137c55d..6e18c802 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -509,7 +509,6 @@ void x11_parse_key ( char *combo, unsigned int *mod, KeySym *key ) KeySym sym = XStringToKeysym ( combo + i ); if ( sym == NoSymbol || ( !modmask && ( strchr ( combo, '-' ) || strchr ( combo, '+' ) ) ) ) { - // TODO popup g_string_append_printf ( str, "Sorry, rofi cannot understand the key combination: %s\n", combo ); g_string_append ( str, "\nRofi supports the following modifiers:\n\t" ); g_string_append ( str, "Shift,Control,Alt,AltGR,SuperL,SuperR," ); -- cgit v1.2.3