diff options
author | Dave Davenport <qball@gmpclient.org> | 2015-11-25 09:26:38 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2015-11-25 09:26:38 +0100 |
commit | 3c411433b467dcc979213f139f1b11dd01ed32b0 (patch) | |
tree | d9b4d432605268af0a00321dc0a8162db19c0637 | |
parent | b7ec4fa6fb70b35f08bb09ee1328730efb44d71a (diff) |
Big rename from Switcher to Mode internal, to match with user terminology
-rw-r--r-- | config/config.def.c | 8 | ||||
-rw-r--r-- | include/dialogs/combi.h | 2 | ||||
-rw-r--r-- | include/dialogs/drun.h | 2 | ||||
-rw-r--r-- | include/dialogs/run.h | 2 | ||||
-rw-r--r-- | include/dialogs/script.h | 2 | ||||
-rw-r--r-- | include/dialogs/ssh.h | 2 | ||||
-rw-r--r-- | include/dialogs/window.h | 4 | ||||
-rw-r--r-- | include/rofi.h | 58 | ||||
-rw-r--r-- | source/dialogs/combi.c | 30 | ||||
-rw-r--r-- | source/dialogs/dmenu.c | 18 | ||||
-rw-r--r-- | source/dialogs/drun.c | 20 | ||||
-rw-r--r-- | source/dialogs/run.c | 18 | ||||
-rw-r--r-- | source/dialogs/script.c | 24 | ||||
-rw-r--r-- | source/dialogs/ssh.c | 18 | ||||
-rw-r--r-- | source/dialogs/window.c | 76 | ||||
-rw-r--r-- | source/rofi.c | 196 | ||||
-rw-r--r-- | source/xrmoptions.c | 4 |
17 files changed, 242 insertions, 242 deletions
diff --git a/config/config.def.c b/config/config.def.c index 4b4139bd..8ab8bf27 100644 --- a/config/config.def.c +++ b/config/config.def.c @@ -29,9 +29,9 @@ #include "rofi.h" Settings config = { - /** List of enabled switchers. */ - /** -switchers */ - .switchers = "window,run,ssh", + /** List of enabled modi. */ + /** -modi */ + .modi = "window,run,ssh", /** Set the default window opacity. */ /** This option only works when running a composite manager. */ /** -o */ @@ -118,7 +118,7 @@ Settings config = { .separator = '\n', /** Height of an element in #chars */ .element_height = 1, - /** Sidebar mode, show the switchers */ + /** Sidebar mode, show the modi */ .sidebar_mode = FALSE, /** Lazy mode setting */ .lazy_filter_limit = 15000, diff --git a/include/dialogs/combi.h b/include/dialogs/combi.h index d36c5a13..fc3a64ae 100644 --- a/include/dialogs/combi.h +++ b/include/dialogs/combi.h @@ -1,5 +1,5 @@ #ifndef __COMBI_DIALOG_H__ #define __COMBI_DIALOG_H__ -extern Switcher combi_mode; +extern Mode combi_mode; #endif diff --git a/include/dialogs/drun.h b/include/dialogs/drun.h index 2c50211f..ac493a6d 100644 --- a/include/dialogs/drun.h +++ b/include/dialogs/drun.h @@ -1,5 +1,5 @@ #ifndef __DRUN_DIALOG_H__ #define __DRUN_DIALOG_H__ -extern Switcher drun_mode; +extern Mode drun_mode; #endif diff --git a/include/dialogs/run.h b/include/dialogs/run.h index c95944f4..9a78605c 100644 --- a/include/dialogs/run.h +++ b/include/dialogs/run.h @@ -1,5 +1,5 @@ #ifndef __RUN_DIALOG_H__ #define __RUN_DIALOG_H__ -extern Switcher run_mode; +extern Mode run_mode; #endif diff --git a/include/dialogs/script.h b/include/dialogs/script.h index 68d5248c..aa73cb09 100644 --- a/include/dialogs/script.h +++ b/include/dialogs/script.h @@ -9,5 +9,5 @@ * * @returns NULL when it fails, a newly allocated ScriptOptions when successful. */ -Switcher *script_switcher_parse_setup ( const char *str ); +Mode *script_switcher_parse_setup ( const char *str ); #endif diff --git a/include/dialogs/ssh.h b/include/dialogs/ssh.h index d6fbe572..c5ff29dc 100644 --- a/include/dialogs/ssh.h +++ b/include/dialogs/ssh.h @@ -1,5 +1,5 @@ #ifndef __SSH_DIALOG_H__ #define __SSH_DIALOG_H__ -extern Switcher ssh_mode; +extern Mode ssh_mode; #endif diff --git a/include/dialogs/window.h b/include/dialogs/window.h index 096d475e..909e4cad 100644 --- a/include/dialogs/window.h +++ b/include/dialogs/window.h @@ -4,7 +4,7 @@ #include <config.h> #ifdef WINDOW_MODE -extern Switcher window_mode; -extern Switcher window_mode_cd; +extern Mode window_mode; +extern Mode window_mode_cd; #endif // WINDOW_MODE #endif // __WINDOW_DIALOG_H__ diff --git a/include/rofi.h b/include/rofi.h index 60fdf6b6..b46f6ce1 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -15,7 +15,7 @@ */ extern const char *cache_dir; -typedef struct _Switcher Switcher; +typedef struct _Mode Mode; /** * Enum used to sum the possible states of ROFI. */ @@ -29,7 +29,7 @@ typedef enum RELOAD_DIALOG = 1002, /** Previous dialog */ PREVIOUS_DIALOG = 1003 -} SwitcherMode; +} ModeMode; /** * State returned by the rofi window. @@ -96,7 +96,7 @@ typedef enum _WindowLocation } WindowLocation; /** - * @param sw the Switcher to show. + * @param sw the Mode to show. * @param lines An array of strings to display. * @param num_lines Length of the array with strings to display. * @param input A pointer to a string where the inputted data is placed. @@ -111,7 +111,7 @@ typedef enum _WindowLocation * * @returns The command issued (see MenuReturn) */ -MenuReturn menu ( Switcher *sw, char **input, char *prompt, unsigned int *selected_line, unsigned int *next_pos, const char *message ) +MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_line, unsigned int *next_pos, const char *message ) __attribute__ ( ( nonnull ( 1, 2, 3, 4 ) ) ); /** * Settings @@ -119,8 +119,8 @@ __attribute__ ( ( nonnull ( 1, 2, 3, 4 ) ) ); typedef struct _Settings { - /** List of enabled switchers */ - char *switchers; + /** List of enabled modi */ + char *modi; /** Window settings */ unsigned int window_opacity; /** Border width */ @@ -193,7 +193,7 @@ typedef struct _Settings char separator; /** Height of an element in #chars */ int element_height; - /** Sidebar mode, show the switchers */ + /** Sidebar mode, show the modi */ unsigned int sidebar_mode; /** Lazy filter limit. */ unsigned int lazy_filter_limit; @@ -203,7 +203,7 @@ typedef struct _Settings unsigned int parse_hosts; /** Knonw_hosts file parsing */ unsigned int parse_known_hosts; - /** Combi Switchers */ + /** Combi Modes */ char *combi_modi; /** Fuzzy match */ unsigned int fuzzy; @@ -243,11 +243,11 @@ extern Settings config; */ void error_dialog ( const char *msg, int markup ); -typedef void ( *switcher_free )( Switcher *data ); +typedef void ( *switcher_free )( Mode *data ); -typedef char * ( *switcher_get_display_value )( const Switcher *sw, unsigned int selected_line, int *state, int get_entry ); +typedef char * ( *switcher_get_display_value )( const Mode *sw, unsigned int selected_line, int *state, int get_entry ); -typedef char * ( *switcher_get_completion )( const Switcher *sw, unsigned int selected_line ); +typedef char * ( *switcher_get_completion )( const Mode *sw, unsigned int selected_line ); /** * @param tokens List of (input) tokens to match. * @param input The entry to match against. @@ -259,24 +259,24 @@ typedef char * ( *switcher_get_completion )( const Switcher *sw, unsigned int se * * @returns 1 when it matches, 0 if not. */ -typedef int ( *switcher_token_match )( const Switcher *data, char **tokens, int not_ascii, int case_sensitive, unsigned int index ); +typedef int ( *switcher_token_match )( const Mode *data, char **tokens, int not_ascii, int case_sensitive, unsigned int index ); -typedef void ( *switcher_init )( Switcher *sw ); +typedef void ( *switcher_init )( Mode *sw ); -typedef unsigned int ( *switcher_get_num_entries )( const Switcher *sw ); +typedef unsigned int ( *switcher_get_num_entries )( const Mode *sw ); -typedef void ( *switcher_destroy )( Switcher *sw ); +typedef void ( *switcher_destroy )( Mode *sw ); -typedef SwitcherMode ( *switcher_result )( Switcher *sw, int menu_retv, char **input, unsigned int selected_line ); +typedef ModeMode ( *switcher_result )( Mode *sw, int menu_retv, char **input, unsigned int selected_line ); -typedef int ( *switcher_is_not_ascii )( const Switcher *sw, unsigned int index ); +typedef int ( *switcher_is_not_ascii )( const Mode *sw, unsigned int index ); /** * Structure defining a switcher. * It consists of a name, callback and if enabled * a textbox for the sidebar-mode. */ -struct _Switcher +struct _Mode { // Name (max 31 char long) char name[32]; @@ -289,32 +289,32 @@ struct _Switcher /** * A switcher normally consists of the following parts: */ - // Initialize the Switcher - switcher_init init; + // Initialize the Mode + switcher_init init; // Destroy the switcher, e.g. free all its memory. - switcher_destroy destroy; + switcher_destroy destroy; // Get number of entries to display. (unfiltered). - switcher_get_num_entries get_num_entries; + switcher_get_num_entries get_num_entries; // Check if the element is ascii. - switcher_is_not_ascii is_not_ascii; + switcher_is_not_ascii is_not_ascii; // Process the result of the user selection. - switcher_result result; + switcher_result result; // Token match. - switcher_token_match token_match; + switcher_token_match token_match; // Get the string to display for the entry. switcher_get_display_value mgrv; // Get the 'completed' entry. - switcher_get_completion get_completion; + switcher_get_completion get_completion; // Pointer to private data. - void *private_data; + void *private_data; // Free SWitcher // Only to be used when the switcher object itself is dynamic. // And has data in `ed` - switcher_free free; + switcher_free free; // Extra fields for script - void *ed; + void *ed; }; #define color_reset "\033[0m" diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index 3b9d34a8..a106ec6e 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -32,7 +32,7 @@ #include <dialogs/dialogs.h> /** - * Combi Switcher + * Combi Mode */ typedef struct _CombiModePrivateData { @@ -43,10 +43,10 @@ typedef struct _CombiModePrivateData unsigned int *lengths; // List of switchers to combine. unsigned int num_switchers; - Switcher **switchers; + Mode **switchers; } CombiModePrivateData; -static void combi_mode_parse_switchers ( Switcher *sw ) +static void combi_mode_parse_switchers ( Mode *sw ) { CombiModePrivateData *pd = sw->private_data; char *savept = NULL; @@ -56,8 +56,8 @@ static void combi_mode_parse_switchers ( Switcher *sw ) for ( char *token = strtok_r ( switcher_str, ",", &savept ); token != NULL; token = strtok_r ( NULL, ",", &savept ) ) { // Resize and add entry. - pd->switchers = (Switcher * *) g_realloc ( pd->switchers, - sizeof ( Switcher* ) * ( pd->num_switchers + 1 ) ); + pd->switchers = (Mode * *) g_realloc ( pd->switchers, + sizeof ( Mode* ) * ( pd->num_switchers + 1 ) ); // Window switcher. #ifdef WINDOW_MODE @@ -82,7 +82,7 @@ static void combi_mode_parse_switchers ( Switcher *sw ) } else { // If not build in, use custom switchers. - Switcher *sw = script_switcher_parse_setup ( token ); + Mode *sw = script_switcher_parse_setup ( token ); if ( sw != NULL ) { pd->switchers[pd->num_switchers++] = sw; } @@ -98,7 +98,7 @@ static void combi_mode_parse_switchers ( Switcher *sw ) g_free ( switcher_str ); } -static void combi_mode_init ( Switcher *sw ) +static void combi_mode_init ( Mode *sw ) { if ( sw->private_data == NULL ) { CombiModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) ); @@ -120,12 +120,12 @@ static void combi_mode_init ( Switcher *sw ) } } } -static unsigned int combi_mode_get_num_entries ( const Switcher *sw ) +static unsigned int combi_mode_get_num_entries ( const Mode *sw ) { const CombiModePrivateData *pd = (const CombiModePrivateData *) sw->private_data; return pd->cmd_list_length; } -static void combi_mode_destroy ( Switcher *sw ) +static void combi_mode_destroy ( Mode *sw ) { CombiModePrivateData *pd = (CombiModePrivateData *) sw->private_data; if ( pd != NULL ) { @@ -140,7 +140,7 @@ static void combi_mode_destroy ( Switcher *sw ) sw->private_data = NULL; } } -static SwitcherMode combi_mode_result ( Switcher *sw, int mretv, char **input, unsigned int selected_line ) +static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line ) { CombiModePrivateData *pd = sw->private_data; if ( *input[0] == '!' ) { @@ -170,7 +170,7 @@ static SwitcherMode combi_mode_result ( Switcher *sw, int mretv, char **input, u } return MODE_EXIT; } -static int combi_mode_match ( const Switcher *sw, char **tokens, int not_ascii, +static int combi_mode_match ( const Mode *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) { CombiModePrivateData *pd = sw->private_data; @@ -203,7 +203,7 @@ static int combi_mode_match ( const Switcher *sw, char **tokens, int not_ascii, abort (); return 0; } -static char * combi_mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry ) +static char * combi_mgrv ( const Mode *sw, unsigned int selected_line, int *state, int get_entry ) { CombiModePrivateData *pd = sw->private_data; if ( !get_entry ) { @@ -226,7 +226,7 @@ static char * combi_mgrv ( const Switcher *sw, unsigned int selected_line, int * return NULL; } -static int combi_is_not_ascii ( const Switcher *sw, unsigned int index ) +static int combi_is_not_ascii ( const Mode *sw, unsigned int index ) { CombiModePrivateData *pd = sw->private_data; for ( unsigned i = 0; i < pd->num_switchers; i++ ) { @@ -236,7 +236,7 @@ static int combi_is_not_ascii ( const Switcher *sw, unsigned int index ) } return FALSE; } -static char * combi_get_completion ( const Switcher *sw, unsigned int index ) +static char * combi_get_completion ( const Mode *sw, unsigned int index ) { CombiModePrivateData *pd = sw->private_data; for ( unsigned i = 0; i < pd->num_switchers; i++ ) { @@ -257,7 +257,7 @@ static char * combi_get_completion ( const Switcher *sw, unsigned int index ) return NULL; } -Switcher combi_mode = +Mode combi_mode = { .name = "combi", .keycfg = NULL, diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index cb7e570d..6da5b4d3 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -64,7 +64,7 @@ typedef struct _DmenuModePrivateData static char **get_dmenu ( unsigned int *length ) { TICK_N ( "Read stdin START" ); - char **retv = NULL; + char **retv = NULL; unsigned int rvlength = 1; *length = 0; @@ -96,7 +96,7 @@ static char **get_dmenu ( unsigned int *length ) return retv; } -static unsigned int dmenu_mode_get_num_entries ( const Switcher *sw ) +static unsigned int dmenu_mode_get_num_entries ( const Mode *sw ) { const DmenuModePrivateData *rmpd = (const DmenuModePrivateData *) sw->private_data; return rmpd->cmd_list_length; @@ -137,9 +137,9 @@ static void parse_ranges ( char *input, struct range_pair **list, unsigned int * } } -static char *get_display_data ( const Switcher *data, unsigned int index, int *state, int get_entry ) +static char *get_display_data ( const Mode *data, unsigned int index, int *state, int get_entry ) { - Switcher *sw = (Switcher *) data; + Mode *sw = (Mode *) data; DmenuModePrivateData *pd = (DmenuModePrivateData *) sw->private_data; char **retv = (char * *) pd->cmd_list; for ( unsigned int i = 0; i < pd->num_active_list; i++ ) { @@ -206,7 +206,7 @@ static void dmenu_output_formatted_line ( const char *format, const char *string fputc ( '\n', stdout ); fflush ( stdout ); } -static void dmenu_mode_free ( Switcher *sw ) +static void dmenu_mode_free ( Mode *sw ) { if ( sw->private_data == NULL ) { return; @@ -227,7 +227,7 @@ static void dmenu_mode_free ( Switcher *sw ) } } -static void dmenu_mode_init ( Switcher *sw ) +static void dmenu_mode_init ( Mode *sw ) { if ( sw->private_data != NULL ) { return; @@ -279,19 +279,19 @@ static void dmenu_mode_init ( Switcher *sw ) pd->cmd_list = get_dmenu ( &( pd->cmd_list_length ) ); } -static int dmenu_token_match ( const Switcher *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) +static int dmenu_token_match ( const Mode *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) { DmenuModePrivateData *rmpd = (DmenuModePrivateData *) sw->private_data; return token_match ( tokens, rmpd->cmd_list[index], not_ascii, case_sensitive ); } -static int dmenu_is_not_ascii ( const Switcher *sw, unsigned int index ) +static int dmenu_is_not_ascii ( const Mode *sw, unsigned int index ) { DmenuModePrivateData *rmpd = (DmenuModePrivateData *) sw->private_data; return is_not_ascii ( rmpd->cmd_list[index] ); } -Switcher dmenu_mode = +Mode dmenu_mode = { .name = "dmenu", .keycfg = NULL, diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 8d27617d..0bb76e99 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -226,7 +226,7 @@ static void get_apps ( DRunModePrivateData *pd ) } } -static void drun_mode_init ( Switcher *sw ) +static void drun_mode_init ( Mode *sw ) { if ( sw->private_data == NULL ) { DRunModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) ); @@ -235,10 +235,10 @@ static void drun_mode_init ( Switcher *sw ) } } -static SwitcherMode drun_mode_result ( Switcher *sw, int mretv, char **input, unsigned int selected_line ) +static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line ) { DRunModePrivateData *rmpd = (DRunModePrivateData *) sw->private_data; - SwitcherMode retv = MODE_EXIT; + ModeMode retv = MODE_EXIT; int shift = ( ( mretv & MENU_SHIFT ) == MENU_SHIFT ); @@ -260,7 +260,7 @@ static SwitcherMode drun_mode_result ( Switcher *sw, int mretv, char **input, un return retv; } -static void drun_mode_destroy ( Switcher *sw ) +static void drun_mode_destroy ( Mode *sw ) { DRunModePrivateData *rmpd = (DRunModePrivateData *) sw->private_data; if ( rmpd != NULL ) { @@ -275,7 +275,7 @@ static void drun_mode_destroy ( Switcher *sw ) } } -static char *mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry ) +static char *mgrv ( const Mode *sw, unsigned int selected_line, int *state, int get_entry ) { DRunModePrivateData *pd = (DRunModePrivateData *) sw->private_data; *state |= MARKUP; @@ -296,7 +296,7 @@ static char *mgrv ( const Switcher *sw, unsigned int selected_line, int *state, dr->generic_name ); } } -static char *drun_get_completion ( const Switcher *sw, unsigned int index ) +static char *drun_get_completion ( const Mode *sw, unsigned int index ) { DRunModePrivateData *pd = (DRunModePrivateData *) sw->private_data; /* Free temp storage. */ @@ -309,7 +309,7 @@ static char *drun_get_completion ( const Switcher *sw, unsigned int index ) } } -static int drun_token_match ( const Switcher *data, +static int drun_token_match ( const Mode *data, char **tokens, int not_ascii, int case_sensitive, @@ -329,12 +329,12 @@ static int drun_token_match ( const Switcher *data, return 0; } -static unsigned int drun_mode_get_num_entries ( const Switcher *sw ) +static unsigned int drun_mode_get_num_entries ( const Mode *sw ) { const DRunModePrivateData *pd = (const DRunModePrivateData *) sw->private_data; return pd->cmd_list_length; } -static int drun_is_not_ascii ( const Switcher *sw, unsigned int index ) +static int drun_is_not_ascii ( const Mode *sw, unsigned int index ) { DRunModePrivateData *pd = (DRunModePrivateData *) sw->private_data; if ( pd->entry_list[index].generic_name ) { @@ -343,7 +343,7 @@ static int drun_is_not_ascii ( const Switcher *sw, unsigned int index ) return is_not_ascii ( pd->entry_list[index].name ); } -Switcher drun_mode = +Mode drun_mode = { .name = "drun", .keycfg = NULL, diff --git a/source/dialogs/run.c b/source/dialogs/run.c index 81a3609b..944301db 100644 --- a/source/dialogs/run.c +++ b/source/dialogs/run.c @@ -267,7 +267,7 @@ typedef struct _RunModePrivateData unsigned int cmd_list_length; } RunModePrivateData; -static void run_mode_init ( Switcher *sw ) +static void run_mode_init ( Mode *sw ) { if ( sw->private_data == NULL ) { RunModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) ); @@ -276,16 +276,16 @@ static void run_mode_init ( Switcher *sw ) } } -static unsigned int run_mode_get_num_entries ( const Switcher *sw ) +static unsigned int run_mode_get_num_entries ( const Mode *sw ) { const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; return rmpd->cmd_list_length; } -static SwitcherMode run_mode_result ( Switcher *sw, int mretv, char **input, unsigned int selected_line ) +static ModeMode run_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line ) { RunModePrivateData *rmpd = (RunModePrivateData *) sw->private_data; - SwitcherMode retv = MODE_EXIT; + ModeMode retv = MODE_EXIT; int shift = ( ( mretv & MENU_SHIFT ) == MENU_SHIFT ); @@ -316,7 +316,7 @@ static SwitcherMode run_mode_result ( Switcher *sw, int mretv, char **input, uns return retv; } -static void run_mode_destroy ( Switcher *sw ) +static void run_mode_destroy ( Mode *sw ) { RunModePrivateData *rmpd = (RunModePrivateData *) sw->private_data; if ( rmpd != NULL ) { @@ -326,23 +326,23 @@ static void run_mode_destroy ( Switcher *sw ) } } -static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) +static char *mgrv ( const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) { const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL; } -static int run_token_match ( const Switcher *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) +static int run_token_match ( const Mode *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) { const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; return token_match ( tokens, rmpd->cmd_list[index], not_ascii, case_sensitive ); } -static int run_is_not_ascii ( const Switcher *sw, unsigned int index ) +static int run_is_not_ascii ( const Mode *sw, unsigned int index ) { const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; return is_not_ascii ( rmpd->cmd_list[index] ); } -Switcher run_mode = +Mode run_mode = { .name = "run", .keycfg = NULL, diff --git a/source/dialogs/script.c b/source/dialogs/script.c index ec136b57..7a1f41f9 100644 --- a/source/dialogs/script.c +++ b/source/dialogs/script.c @@ -69,7 +69,7 @@ static char **get_script_output ( const char *command, unsigned int *length ) return retv; } -static char **execute_executor ( Switcher *sw, const char *result, unsigned int *length ) +static char **execute_executor ( Mode *sw, const char *result, unsigned int *length ) { char **retv = NULL; @@ -81,7 +81,7 @@ static char **execute_executor ( Switcher *sw, const char *result, unsigned int return retv; } -static void script_switcher_free ( Switcher *sw ) +static void script_switcher_free ( Mode *sw ) { if ( sw == NULL ) { return; @@ -97,7 +97,7 @@ typedef struct _ScriptModePrivateData unsigned int cmd_list_length; } ScriptModePrivateData; -static void script_mode_init ( Switcher *sw ) +static void script_mode_init ( Mode *sw ) { if ( sw->private_data == NULL ) { ScriptModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) ); @@ -105,16 +105,16 @@ static void script_mode_init ( Switcher *sw ) pd->cmd_list = get_script_output ( (const char *) sw->ed, &( pd->cmd_list_length ) ); } } -static unsigned int script_mode_get_num_entries ( const Switcher *sw ) +static unsigned int script_mode_get_num_entries ( const Mode *sw ) { const ScriptModePrivateData *rmpd = (const ScriptModePrivateData *) sw->private_data; return rmpd->cmd_list_length; } -static SwitcherMode script_mode_result ( Switcher *sw, int mretv, char **input, unsigned int selected_line ) +static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line ) { ScriptModePrivateData *rmpd = (ScriptModePrivateData *) sw->private_data; - SwitcherMode retv = MODE_EXIT; + ModeMode retv = MODE_EXIT; char **new_list = NULL; unsigned int new_length = 0; @@ -147,7 +147,7 @@ static SwitcherMode script_mode_result ( Switcher *sw, int mretv, char **input, return retv; } -static void script_mode_destroy ( Switcher *sw ) +static void script_mode_destroy ( Mode *sw ) { ScriptModePrivateData *rmpd = (ScriptModePrivateData *) sw->private_data; if ( rmpd != NULL ) { @@ -156,27 +156,27 @@ static void script_mode_destroy ( Switcher *sw ) sw->private_data = NULL; } } -static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) +static char *mgrv ( const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) { ScriptModePrivateData *rmpd = sw->private_data; return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL; } -static int script_token_match ( const Switcher *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) +static int script_token_match ( const Mode *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) { ScriptModePrivateData *rmpd = sw->private_data; return token_match ( tokens, rmpd->cmd_list[index], not_ascii, case_sensitive ); } -static int script_is_not_ascii ( const Switcher *sw, unsigned int index ) +static int script_is_not_ascii ( const Mode *sw, unsigned int index ) { ScriptModePrivateData *rmpd = sw->private_data; return is_not_ascii ( rmpd->cmd_list[index] ); } -Switcher *script_switcher_parse_setup ( const char *str ) +Mode *script_switcher_parse_setup ( const char *str ) { - Switcher *sw = g_malloc0 ( sizeof ( *sw ) ); + Mode *sw = g_malloc0 ( sizeof ( *sw ) ); char *endp = NULL; char *parse = g_strdup ( str ); unsigned int index = 0; diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index 3c4fe4c8..c505194d 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -322,7 +322,7 @@ typedef struct _SSHModePrivateData unsigned int cmd_list_length; } SSHModePrivateData; -static void ssh_mode_init ( Switcher *sw ) +static void ssh_mode_init ( Mode *sw ) { if ( sw->private_data == NULL ) { SSHModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) ); @@ -331,14 +331,14 @@ static void ssh_mode_init ( Switcher *sw ) } } -static unsigned int ssh_mode_get_num_entries ( const Switcher *sw ) +static unsigned int ssh_mode_get_num_entries ( const Mode *sw ) { const SSHModePrivateData *rmpd = (const SSHModePrivateData *) sw->private_data; return rmpd->cmd_list_length; } -static SwitcherMode ssh_mode_result ( Switcher *sw, int mretv, char **input, unsigned int selected_line ) +static ModeMode ssh_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line ) { - SwitcherMode retv = MODE_EXIT; + ModeMode retv = MODE_EXIT; SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data; if ( mretv & MENU_NEXT ) { retv = NEXT_DIALOG; @@ -366,7 +366,7 @@ static SwitcherMode ssh_mode_result ( Switcher *sw, int mretv, char **input, uns return retv; } -static void ssh_mode_destroy ( Switcher *sw ) +static void ssh_mode_destroy ( Mode *sw ) { SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data; if ( rmpd != NULL ) { @@ -376,24 +376,24 @@ static void ssh_mode_destroy ( Switcher *sw ) } } -static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) +static char *mgrv ( const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) { SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data; return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL; } -static int ssh_token_match ( const Switcher *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) +static int ssh_token_match ( const Mode *sw, char **tokens, int not_ascii, int case_sensitive, unsigned int index ) { SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data; return token_match ( tokens, rmpd->cmd_list[index], not_ascii, case_sensitive ); } -static int ssh_is_not_ascii ( const Switcher *sw, unsigned int index ) +static int ssh_is_not_ascii ( const Mode *sw, unsigned int index ) { SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data; return is_not_ascii ( rmpd->cmd_list[index] ); } -Switcher ssh_mode = +Mode ssh_mode = { .name = "ssh", .keycfg = NULL, diff --git a/source/dialogs/window.c b/source/dialogs/window.c index 99ea2d42..1e383c1f 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -308,7 +308,7 @@ static client* window_client ( Display *display, Window win ) return c; } -typedef struct _SwitcherModePrivateData +typedef struct _ModeModePrivateData { unsigned int id; char **cmd_list; @@ -318,19 +318,19 @@ typedef struct _SwitcherModePrivateData // Current window. unsigned int index; char *cache; -} SwitcherModePrivateData; +} ModeModePrivateData; -static int window_match ( const Switcher *sw, char **tokens, +static int window_match ( const Mode *sw, char **tokens, __attribute__( ( unused ) ) int not_ascii, int case_sensitive, unsigned int index ) |