diff options
author | Dave Davenport <qball@gmpclient.org> | 2020-02-02 13:56:37 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2020-02-02 13:56:37 +0100 |
commit | b1692899969b89b8478e403957e266437e07d9e9 (patch) | |
tree | 0b2a7665e151e3ffe2f8ce8c32f2e3ad2f0aac91 | |
parent | 83c2e467d5b34f9e74e2c55b1e9df2b715be175e (diff) |
Indent all the code.
-rw-r--r-- | config/config.c | 84 | ||||
-rw-r--r-- | include/dialogs/dmenuscriptshared.h | 3 | ||||
-rw-r--r-- | include/helper.h | 1 | ||||
-rw-r--r-- | include/theme.h | 8 | ||||
-rw-r--r-- | include/view-internal.h | 4 | ||||
-rw-r--r-- | include/widgets/listview.h | 2 | ||||
-rw-r--r-- | include/widgets/textbox.h | 32 | ||||
-rw-r--r-- | include/widgets/widget.h | 1 | ||||
-rw-r--r-- | source/dialogs/dmenu.c | 60 | ||||
-rw-r--r-- | source/dialogs/drun.c | 213 | ||||
-rw-r--r-- | source/dialogs/script.c | 78 | ||||
-rw-r--r-- | source/dialogs/ssh.c | 132 | ||||
-rw-r--r-- | source/dialogs/window.c | 6 | ||||
-rw-r--r-- | source/helper.c | 46 | ||||
-rw-r--r-- | source/keyb.c | 2 | ||||
-rw-r--r-- | source/rofi.c | 46 | ||||
-rw-r--r-- | source/theme.c | 428 | ||||
-rw-r--r-- | source/timings.c | 9 | ||||
-rw-r--r-- | source/view.c | 108 | ||||
-rw-r--r-- | source/widgets/icon.c | 16 | ||||
-rw-r--r-- | source/widgets/listview.c | 136 | ||||
-rw-r--r-- | source/widgets/textbox.c | 25 | ||||
-rw-r--r-- | source/widgets/widget.c | 2 | ||||
-rw-r--r-- | source/xcb.c | 68 | ||||
-rw-r--r-- | source/xrmoptions.c | 164 |
25 files changed, 841 insertions, 833 deletions
diff --git a/config/config.c b/config/config.c index 5f7cdf66..e3cf8356 100644 --- a/config/config.c +++ b/config/config.c @@ -36,39 +36,39 @@ Settings config = { /** List of enabled modi. */ /** -modi */ #ifdef WINDOW_MODE - .modi = "window,run,ssh", + .modi = "window,run,ssh", #else - .modi = "run,ssh", + .modi = "run,ssh", #endif /** Border width around the window. */ - .menu_bw = 1, + .menu_bw = 1, /** The width of the switcher. (0100 in % > 100 in pixels) */ - .menu_width = 50, + .menu_width = 50, /** Maximum number of options to show. */ - .menu_lines = 15, + .menu_lines = 15, /** Number of columns */ - .menu_columns = 1, + .menu_columns = 1, /** Font */ - .menu_font = "mono 12", + .menu_font = "mono 12", /** Whether to load and show icons */ - .show_icons = FALSE, + .show_icons = FALSE, /** Terminal to use. (for ssh and open in terminal) */ .terminal_emulator = "rofi-sensible-terminal", .ssh_client = "ssh", /** Command when executing ssh. */ - .ssh_command = "{terminal} -e {ssh-client} {host} [-p {port}]", + .ssh_command = "{terminal} -e {ssh-client} {host} [-p {port}]", /** Command when running */ - .run_command = "{cmd}", + .run_command = "{cmd}", /** Command used to list executable commands. empty -> internal */ - .run_list_command = "", + .run_list_command = "", /** Command executed when running application in terminal */ - .run_shell_command = "{terminal} -e {cmd}", + .run_shell_command = "{terminal} -e {cmd}", /** Command executed on accep-entry-custom for window modus */ - .window_command = "wmctrl -i -R {window}", + .window_command = "wmctrl -i -R {window}", /** No default icon theme, we search Adwaita and gnome as fallback */ - .icon_theme = NULL, + .icon_theme = NULL, /** * Location of the window. * Enumeration indicating location or gravity of window. @@ -80,61 +80,61 @@ Settings config = { * WL_SOUTH_WEST WL_SOUTH WL_SOUTH_EAST * */ - .location = WL_CENTER, + .location = WL_CENTER, /** Padding between elements */ - .padding = 5, + .padding = 5, /** Y offset */ - .y_offset = 0, + .y_offset = 0, /** X offset */ - .x_offset = 0, + .x_offset = 0, /** Always show config.menu_lines lines, even if less lines are available */ - .fixed_num_lines = TRUE, + .fixed_num_lines = TRUE, /** Do not use history */ - .disable_history = FALSE, + .disable_history = FALSE, /** Programs ignored for history */ - .ignored_prefixes = "", + .ignored_prefixes = "", /** Sort the displayed list */ - .sort = FALSE, + .sort = FALSE, /** Use levenshtein sorting when matching */ - .sorting_method = SORT_NORMAL, + .sorting_method = SORT_NORMAL, /** Case sensitivity of the search */ - .case_sensitive = FALSE, + .case_sensitive = FALSE, /** Cycle through in the element list */ - .cycle = TRUE, + .cycle = TRUE, /** Height of an element in #chars */ - .element_height = 1, + .element_height = 1, /** Sidebar mode, show the modi */ - .sidebar_mode = FALSE, + .sidebar_mode = FALSE, /** auto select */ - .auto_select = FALSE, + .auto_select = FALSE, /** Parse /etc/hosts file in ssh view. */ - .parse_hosts = FALSE, + .parse_hosts = FALSE, /** Parse ~/.ssh/known_hosts file in ssh view. */ - .parse_known_hosts = TRUE, + .parse_known_hosts = TRUE, /** Modi to combine into one view. */ .combi_modi = "window,run", .tokenize = TRUE, .matching = "normal", .matching_method = MM_NORMAL, /** Desktop entry fields to match*/ - .drun_match_fields = "name,generic,exec,categories,keywords", - .drun_categories = NULL, + .drun_match_fields = "name,generic,exec,categories,keywords", + .drun_categories = NULL, /** Desktop format display */ - .drun_display_format = "{name} [<span weight='light' size='small'><i>({generic})</i></span>]", + .drun_display_format = "{name} [<span weight='light' size='small'><i>({generic})</i></span>]", /** Desktop entry show actions */ - .drun_show_actions = FALSE, + .drun_show_actions = FALSE, /** Desktop entry show actions */ /** Window fields to match in window mode*/ - .window_match_fields = "all", + .window_match_fields = "all", /** Monitor */ - .monitor = "-5", + .monitor = "-5", /** set line margin */ .line_margin = 2, .line_padding = 1, /** Set filter */ - .filter = NULL, + .filter = NULL, /** Separator style: dash/solid */ - .separator_style = "dash", + .separator_style = "dash", /** Hide scrollbar */ .hide_scrollbar = FALSE, .fullscreen = FALSE, @@ -156,10 +156,10 @@ Settings config = { .max_history_size = 25, .combi_hide_mode_prefix = FALSE, - .matching_negate_char = '-', + .matching_negate_char = '-', - .cache_dir = NULL, - .window_thumbnail = FALSE, - .drun_use_desktop_cache = FALSE, + .cache_dir = NULL, + .window_thumbnail = FALSE, + .drun_use_desktop_cache = FALSE, .drun_reload_desktop_cache = FALSE }; diff --git a/include/dialogs/dmenuscriptshared.h b/include/dialogs/dmenuscriptshared.h index 31e8aae5..12423869 100644 --- a/include/dialogs/dmenuscriptshared.h +++ b/include/dialogs/dmenuscriptshared.h @@ -1,7 +1,8 @@ #ifndef ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H #define ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H -typedef struct { +typedef struct +{ /** Entry content. (visible part) */ char *entry; /** Icon name to display. */ diff --git a/include/helper.h b/include/helper.h index 900817ee..9554c712 100644 --- a/include/helper.h +++ b/include/helper.h @@ -337,7 +337,6 @@ void parse_ranges ( char *input, rofi_range_pair **list, unsigned int *length ); */ void rofi_output_formatted_line ( const char *format, const char *string, int selected_line, const char *filter ); - /** * @param string The string with elements to be replaced * @param ... Set of {key}, value that will be replaced, terminated by a NULL diff --git a/include/theme.h b/include/theme.h index aff116d5..751d83b3 100644 --- a/include/theme.h +++ b/include/theme.h @@ -35,7 +35,8 @@ /** * Describe the media constraint type. */ -typedef enum { +typedef enum +{ /** Minimum width constraint. */ THEME_MEDIA_TYPE_MIN_WIDTH, /** Maximum width constraint. */ @@ -57,9 +58,10 @@ typedef enum { /** * Theme Media description. */ -typedef struct ThemeMedia { +typedef struct ThemeMedia +{ ThemeMediaType type; - double value; + double value; } ThemeMedia; /** diff --git a/include/view-internal.h b/include/view-internal.h index a6f7a632..af6e130f 100644 --- a/include/view-internal.h +++ b/include/view-internal.h @@ -103,9 +103,9 @@ struct RofiViewState textbox **modi; /** Total rows. */ - textbox *tb_total_rows; + textbox *tb_total_rows; /** filtered rows */ - textbox *tb_filtered_rows; + textbox *tb_filtered_rows; /** Settings of the menu */ MenuFlags menu_flags; diff --git a/include/widgets/listview.h b/include/widgets/listview.h index c10e1831..0aa6fab0 100644 --- a/include/widgets/listview.h +++ b/include/widgets/listview.h @@ -61,7 +61,7 @@ typedef enum * * Update callback, this is called to set the value of each (visible) element. */ -typedef void ( *listview_update_callback )( textbox *tb,icon *ico, unsigned int entry, void *udata, TextBoxFontType *type, gboolean full ); +typedef void ( *listview_update_callback )( textbox *tb, icon *ico, unsigned int entry, void *udata, TextBoxFontType *type, gboolean full ); /** * Callback when a element is activated. diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index 452be594..229e34d9 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -49,27 +49,27 @@ */ typedef struct { - widget widget; - unsigned long flags; - short cursor; - char *text; - const char *placeholder; - int show_placeholder; - PangoLayout *layout; - int tbft; - int markup; - int changed; + widget widget; + unsigned long flags; + short cursor; + char *text; + const char *placeholder; + int show_placeholder; + PangoLayout *layout; + int tbft; + int markup; + int changed; - int blink; - guint blink_timeout; + int blink; + guint blink_timeout; - double yalign; - double xalign; + double yalign; + double xalign; - PangoFontMetrics *metrics; + PangoFontMetrics *metrics; PangoEllipsizeMode emode; // - const char *theme_name; + const char *theme_name; } textbox; /** diff --git a/include/widgets/widget.h b/include/widgets/widget.h index abe0c4f6..dd4a5d7e 100644 --- a/include/widgets/widget.h +++ b/include/widgets/widget.h @@ -142,7 +142,6 @@ void widget_move ( widget *widget, short x, short y ); */ WidgetType widget_type ( widget *widget ); - /** * @param widget Handle to widget * @param type The widget type. diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index 96eddf57..eeef4dba 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -53,7 +53,6 @@ #include "dialogs/dmenuscriptshared.h" - static int dmenu_mode_init ( Mode *sw ); static int dmenu_token_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index ); static cairo_surface_t *dmenu_get_icon ( const Mode *sw, unsigned int selected_line, int height ); @@ -90,7 +89,7 @@ typedef struct unsigned int num_selected_list; unsigned int do_markup; // List with entries. - DmenuScriptEntry *cmd_list; + DmenuScriptEntry *cmd_list; unsigned int cmd_list_real_length; unsigned int cmd_list_length; unsigned int only_selected; @@ -123,14 +122,14 @@ static void read_add ( DmenuModePrivateData * pd, char *data, gsize len ) pd->cmd_list[pd->cmd_list_length].icon_fetch_uid = 0; pd->cmd_list[pd->cmd_list_length].icon_name = NULL; pd->cmd_list[pd->cmd_list_length].meta = NULL; - char *end = strchr(data, '\0'); + char *end = strchr ( data, '\0' ); if ( end != NULL ) { - data_len = end-data; - dmenuscript_parse_entry_extras ( NULL, &(pd->cmd_list[pd->cmd_list_length]), end+1, len-data_len); + data_len = end - data; + dmenuscript_parse_entry_extras ( NULL, &( pd->cmd_list[pd->cmd_list_length] ), end + 1, len - data_len ); } char *utfstr = rofi_force_utf8 ( data, data_len ); - pd->cmd_list[pd->cmd_list_length].entry = utfstr; - pd->cmd_list[pd->cmd_list_length + 1].entry = NULL; + pd->cmd_list[pd->cmd_list_length].entry = utfstr; + pd->cmd_list[pd->cmd_list_length + 1].entry = NULL; pd->cmd_list_length++; } @@ -250,17 +249,21 @@ static gchar * dmenu_format_output_string ( const DmenuModePrivateData *pd, cons static inline unsigned int get_index ( unsigned int length, int index ) { - if ( index >= 0 ) return index; - if ( ((unsigned int)-index) <= length ) return (length+index); + if ( index >= 0 ) { + return index; + } + if ( ( (unsigned int) -index ) <= length ) { + return length + index; + } // Out of range. return UINT_MAX; } static char *get_display_data ( const Mode *data, unsigned int index, int *state, G_GNUC_UNUSED GList **list, int get_entry ) { - Mode *sw = (Mode *) data; - DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw ); - DmenuScriptEntry *retv = (DmenuScriptEntry *) pd->cmd_list; + Mode *sw = (Mode *) data; + DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw ); + DmenuScriptEntry *retv = (DmenuScriptEntry *) pd->cmd_list; for ( unsigned int i = 0; i < pd->num_active_list; i++ ) { unsigned int start = get_index ( pd->cmd_list_length, pd->active_list[i].start ); unsigned int stop = get_index ( pd->cmd_list_length, pd->active_list[i].stop ); @@ -433,18 +436,18 @@ static int dmenu_mode_init ( Mode *sw ) static int dmenu_token_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index ) { DmenuModePrivateData *rmpd = (DmenuModePrivateData *) mode_get_private_data ( sw ); - if ( rmpd->do_markup) { + if ( rmpd->do_markup ) { /** Strip out the markup when matching. */ char *esc = NULL; - pango_parse_markup(rmpd->cmd_list[index].entry, -1, 0, NULL, &esc, NULL, NULL); + pango_parse_markup ( rmpd->cmd_list[index].entry, -1, 0, NULL, &esc, NULL, NULL ); if ( esc ) { - int retv = helper_token_match ( tokens, esc); - g_free (esc); + int retv = helper_token_match ( tokens, esc ); + g_free ( esc ); return retv; } return FALSE; - - } else { + } + else { return helper_token_match ( tokens, rmpd->cmd_list[index].entry ); } } @@ -460,7 +463,7 @@ static cairo_surface_t *dmenu_get_icon ( const Mode *sw, unsigned int selected_l { DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw ); g_return_val_if_fail ( pd->cmd_list != NULL, NULL ); - DmenuScriptEntry *dr = &( pd->cmd_list[selected_line] ); + DmenuScriptEntry *dr = &( pd->cmd_list[selected_line] ); if ( dr->icon_name == NULL ) { return NULL; } @@ -471,7 +474,6 @@ static cairo_surface_t *dmenu_get_icon ( const Mode *sw, unsigned int selected_l return rofi_icon_fetcher_get ( dr->icon_fetch_uid ); } - static void dmenu_finish ( RofiViewState *state, int retv ) { if ( retv == FALSE ) { @@ -491,19 +493,19 @@ static void dmenu_finish ( RofiViewState *state, int retv ) static void dmenu_print_results ( DmenuModePrivateData *pd, const char *input ) { DmenuScriptEntry *cmd_list = pd->cmd_list; - int seen = FALSE; + int seen = FALSE; if ( pd->selected_list != NULL ) { for ( unsigned int st = 0; st < pd->cmd_list_length; st++ ) { if ( bitget ( pd->selected_list, st ) ) { seen = TRUE; - rofi_output_formatted_line ( pd->format, cmd_list[st].entry , st, input ); + rofi_output_formatted_line ( pd->format, cmd_list[st].entry, st, input ); } } } if ( !seen ) { const char *cmd = input; if ( pd->selected_line != UINT32_MAX ) { - cmd = cmd_list[pd->selected_line].entry ; + cmd = cmd_list[pd->selected_line].entry; } rofi_output_formatted_line ( pd->format, cmd, pd->selected_line, input ); } @@ -514,7 +516,7 @@ static void dmenu_finalize ( RofiViewState *state ) int retv = FALSE; DmenuModePrivateData *pd = (DmenuModePrivateData *) rofi_view_get_mode ( state )->private_data; unsigned int cmd_list_length = pd->cmd_list_length; - DmenuScriptEntry *cmd_list = pd->cmd_list; + DmenuScriptEntry *cmd_list = pd->cmd_list; char *input = g_strdup ( rofi_view_get_user_input ( state ) ); pd->selected_line = rofi_view_get_selected_line ( state );; @@ -647,9 +649,9 @@ int dmenu_switcher_dialog ( void ) get_dmenu_sync ( pd ); } } - char *input = NULL; - unsigned int cmd_list_length = pd->cmd_list_length; - DmenuScriptEntry *cmd_list = pd->cmd_list; + char *input = NULL; + unsigned int cmd_list_length = pd->cmd_list_length; + DmenuScriptEntry *cmd_list = pd->cmd_list; pd->only_selected = FALSE; pd->multi_select = FALSE; @@ -667,7 +669,7 @@ int dmenu_switcher_dialog ( void ) } } if ( config.auto_select && cmd_list_length == 1 ) { - rofi_output_formatted_line ( pd->format, cmd_list[0].entry , 0, config.filter ); + rofi_output_formatted_line ( pd->format, cmd_list[0].entry, 0, config.filter ); return TRUE; } if ( find_arg ( "-password" ) >= 0 ) { @@ -694,7 +696,7 @@ int dmenu_switcher_dialog ( void ) unsigned int i = 0; for ( i = 0; i < cmd_list_length; i++ ) { if ( tokens == NULL || helper_token_match ( tokens, cmd_list[i].entry ) ) { - rofi_output_formatted_line ( pd->format, cmd_list[i].entry , i, config.filter ); + rofi_output_formatted_line ( pd->format, cmd_list[i].entry, i, config.filter ); } } helper_tokenize_free ( tokens ); diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 943741b0..0a0d7ff2 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -55,7 +55,7 @@ #include "rofi-icon-fetcher.h" -#define DRUN_CACHE_FILE "rofi3.druncache" +#define DRUN_CACHE_FILE "rofi3.druncache" #define DRUN_DESKTOP_CACHE_FILE "rofi-drun-desktop.cache" char *DRUN_GROUP_NAME = "Desktop Entry"; @@ -142,8 +142,7 @@ struct _DRunModePrivateData unsigned int disabled_entries_length; unsigned int expected_line_height; - - char **show_categories; + char **show_categories; // Theme const gchar *icon_theme; @@ -234,11 +233,10 @@ static void exec_cmd_entry ( DRunModeEntry *e ) } if ( e->key_file == NULL ) { - GKeyFile *kf = g_key_file_new (); + GKeyFile *kf = g_key_file_new (); GError *error = NULL; gboolean res = g_key_file_load_from_file ( kf, e->path, 0, &error ); - if ( res ) - { + if ( res ) { e->key_file = kf; } else { @@ -282,11 +280,10 @@ static void exec_cmd_entry ( DRunModeEntry *e ) g_free ( str ); } - static gboolean rofi_strv_contains ( const char * const *categories, const char *const *field ) { - for ( int i = 0; categories && categories[i] ; i++ ){ - for ( int j = 0; field[j] ; j++ ){ + for ( int i = 0; categories && categories[i]; i++ ) { + for ( int j = 0; field[j]; j++ ) { if ( g_str_equal ( categories[i], field[j] ) ) { return TRUE; } @@ -314,7 +311,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const // Check if item is on disabled list. if ( g_hash_table_contains ( pd->disabled_entries, id ) && !parse_action ) { g_debug ( "[%s] [%s] Skipping, was previously seen.", id, path ); - return ; + return; } GKeyFile *kf = g_key_file_new (); GError *error = NULL; @@ -324,14 +321,14 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const g_debug ( "[%s] [%s] Failed to parse desktop file because: %s.", id, path, error->message ); g_error_free ( error ); g_key_file_free ( kf ); - return ; + return; } if ( g_key_file_has_group ( kf, action ) == FALSE ) { // No type? ignore. g_debug ( "[%s] [%s] Invalid desktop file: No %s group", id, path, action ); g_key_file_free ( kf ); - return ; + return; } // Skip non Application entries. gchar *key = g_key_file_get_string ( kf, DRUN_GROUP_NAME, "Type", NULL ); @@ -339,13 +336,13 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const // No type? ignore. g_debug ( "[%s] [%s] Invalid desktop file: No type indicated", id, path ); g_key_file_free ( kf ); - return ; + return; } if ( g_strcmp0 ( key, "Application" ) ) { g_debug ( "[%s] [%s] Skipping desktop file: Not of type application (%s)", id, path, key ); g_free ( key ); g_key_file_free ( kf ); - return ; + return; } g_free ( key ); @@ -353,7 +350,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const if ( !g_key_file_has_key ( kf, DRUN_GROUP_NAME, "Name", NULL ) ) { g_debug ( "[%s] [%s] Invalid desktop file: no 'Name' key present.", id, path ); g_key_file_free ( kf ); - return ; + return; } // Skip hidden entries. @@ -361,7 +358,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const g_debug ( "[%s] [%s] Adding desktop file to disabled list: 'Hidden' key is true", id, path ); g_key_file_free ( kf ); g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) ); - return ; + return; } if ( pd->current_desktop_list ) { gboolean show = TRUE; @@ -396,7 +393,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const g_debug ( "[%s] [%s] Adding desktop file to disabled list: 'OnlyShowIn'/'NotShowIn' keys don't match current desktop", id, path ); g_key_file_free ( kf ); g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) ); - return ; + return; } } // Skip entries that have NoDisplay set. @@ -404,13 +401,13 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const g_debug ( "[%s] [%s] Adding desktop file to disabled list: 'NoDisplay' key is true", id, path ); g_key_file_free ( kf ); g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) ); - return ; + return; } // We need Exec, don't support DBusActivatable if ( !g_key_file_has_key ( kf, DRUN_GROUP_NAME, "Exec", NULL ) ) { g_debug ( "[%s] [%s] Unsupported desktop file: no 'Exec' key present.", id, path ); g_key_file_free ( kf ); - return ; + return; } if ( g_key_file_has_key ( kf, DRUN_GROUP_NAME, "TryExec", NULL ) ) { @@ -420,7 +417,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const if ( fp == NULL ) { g_free ( te ); g_key_file_free ( kf ); - return ; + return; } g_free ( fp ); } @@ -428,7 +425,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const if ( g_file_test ( te, G_FILE_TEST_IS_EXECUTABLE ) == FALSE ) { g_free ( te ); g_key_file_free ( kf ); - return ; + return; } } g_free ( te ); @@ -437,10 +434,10 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const char **categories = NULL; if ( pd->show_categories ) { categories = g_key_file_get_locale_string_list ( kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL ); - if ( !rofi_strv_contains( (const char * const *)categories, (const char *const *)pd->show_categories ) ){ - g_strfreev(categories); + if ( !rofi_strv_contains ( (const char * const *) categories, (const char *const *) pd->show_categories ) ) { + g_strfreev ( categories ); g_key_file_free ( kf ); - return ; + return; } } @@ -478,23 +475,25 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const pd->entry_list[pd->cmd_list_length].generic_name = gn; if ( matching_entry_fields[DRUN_MATCH_FIELD_KEYWORDS].enabled ) { - pd->entry_list[pd->cmd_list_length].keywords = g_key_file_get_locale_string_list ( kf, DRUN_GROUP_NAME, "Keywords", NULL, NULL, NULL ); - } else { + pd->entry_list[pd->cmd_list_length].keywords = g_key_file_get_locale_string_list ( kf, DRUN_GROUP_NAME, "Keywords", NULL, NULL, NULL ); + } + else { pd->entry_list[pd->cmd_list_length].keywords = NULL; } if ( matching_entry_fields[DRUN_MATCH_FIELD_CATEGORIES].enabled ) { if ( categories ) { pd->entry_list[pd->cmd_list_length].categories = categories; - categories = NULL; - } else { + categories = NULL; + } + else { pd->entry_list[pd->cmd_list_length].categories = g_key_file_get_locale_string_list ( kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL ); } } else { pd->entry_list[pd->cmd_list_length].categories = NULL; } - g_strfreev(categories); + g_strfreev ( categories ); pd->entry_list[pd->cmd_list_length].exec = g_key_file_get_string ( kf, action, "Exec", NULL ); @@ -530,7 +529,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const } g_strfreev ( actions ); } - return ; + return; } /** @@ -641,86 +640,88 @@ static gint drun_int_sort_list ( gconstpointer a, gconstpointer b, G_GNUC_UNUSED if ( da->sort_index < 0 && db->sort_index < 0 ) { return g_utf8_collate ( da->name, db->name ); - } else { + } + else { return db->sort_index - da->sort_index; } } /******************************************* - * Cache voodoo * - *******************************************/ +* Cache voodoo * +*******************************************/ -#define CACHE_VERSION 1 +#define CACHE_VERSION 1 static void drun_write_str ( FILE *fd, const char *str ) { - size_t l = (str == NULL? 0 : strlen(str)); - fwrite ( &l, sizeof(l),1, fd ); + size_t l = ( str == NULL ? 0 : strlen ( str ) ); + fwrite ( &l, sizeof ( l ), 1, fd ); // Only write string if it is not NULL or empty. if ( l > 0 ) { // Also writeout terminating '\0' - fwrite ( str, 1, l+1, fd ); + fwrite ( str, 1, l + 1, fd ); } } static void drun_read_string ( FILE *fd, char **str ) { size_t l = 0; - if ( fread ( &l, sizeof(l), 1, fd ) != 1 ){ - g_warning( "Failed to read entry, cache corrupt?" ); + if ( fread ( &l, sizeof ( l ), 1, fd ) != 1 ) { + g_warning ( "Failed to read entry, cache corrupt?" ); return; } - (*str) = NULL; + ( *str ) = NULL; if ( l > 0 ) { // Include \0 l++; - (*str) = g_malloc(l); - if ( fread ( (*str), 1, l, fd ) != l ){ - g_warning( "Failed to read entry, cache corrupt?" ); + ( *str ) = g_malloc ( l ); + if ( fread ( ( *str ), 1, l, fd ) != l ) { + g_warning ( "Failed to read entry, cache corrupt?" ); } } } static void drun_write_strv ( FILE *fd, char **str ) { - guint vl = (str == NULL? 0 : g_strv_length ( str )); - fwrite ( &vl, sizeof(vl),1, fd ); - for ( guint index = 0; index < vl ; index++ ) { + guint vl = ( str == NULL ? 0 : g_strv_length ( str ) ); + fwrite ( &vl, sizeof ( vl ), 1, fd ); + for ( guint index = 0; index < vl; index++ ) { drun_write_str ( fd, str[index] ); } } static void drun_read_stringv ( FILE *fd, char ***str ) { guint |