mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Indent
This commit is contained in:
parent
4ac428bace
commit
9cd1e3fac2
9 changed files with 162 additions and 160 deletions
|
@ -268,7 +268,7 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
|||
GKeyFile *kf = g_key_file_new ();
|
||||
GError *error = NULL;
|
||||
gboolean res = g_key_file_load_from_file ( kf, path, 0, &error );
|
||||
if ( !res && error == NULL) {
|
||||
if ( !res && error == NULL ) {
|
||||
g_debug ( "Failed to parse desktop file: %s because: unknown.", path );
|
||||
g_key_file_free ( kf );
|
||||
return FALSE;
|
||||
|
@ -316,7 +316,7 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
|||
if ( g_key_file_has_key ( kf, "Desktop Entry", "OnlyShowIn", NULL ) ) {
|
||||
gsize llength = 0;
|
||||
show = FALSE;
|
||||
gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "OnlyShowIn", &llength, NULL);
|
||||
gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "OnlyShowIn", &llength, NULL );
|
||||
if ( list ) {
|
||||
for ( gsize lcd = 0; !show && pd->current_desktop_list[lcd]; lcd++ ) {
|
||||
for ( gsize lle = 0; !show && lle < llength; lle++ ) {
|
||||
|
@ -326,20 +326,20 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
|||
g_strfreev ( list );
|
||||
}
|
||||
}
|
||||
if ( show && g_key_file_has_key ( kf, "Desktop Entry", "NotShowIn", NULL )) {
|
||||
if ( show && g_key_file_has_key ( kf, "Desktop Entry", "NotShowIn", NULL ) ) {
|
||||
gsize llength = 0;
|
||||
gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "NotShowIn", &llength, NULL);
|
||||
gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "NotShowIn", &llength, NULL );
|
||||
if ( list ) {
|
||||
for ( gsize lcd = 0; show && pd->current_desktop_list[lcd]; lcd++ ) {
|
||||
for ( gsize lle = 0; show && lle < llength; lle++ ) {
|
||||
show = ! ( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 );
|
||||
show = !( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 );
|
||||
}
|
||||
}
|
||||
g_strfreev ( list );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! show ) {
|
||||
if ( !show ) {
|
||||
g_debug ( "Adding desktop file: %s to disabled list because: OnlyShowIn/NotShowIn", path );
|
||||
g_key_file_free ( kf );
|
||||
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
||||
|
@ -585,8 +585,9 @@ static void drun_icon_fetch ( gpointer data, gpointer user_data )
|
|||
const gchar *icon_path;
|
||||
gchar *icon_path_ = NULL;
|
||||
|
||||
if ( g_path_is_absolute ( dr->icon_name ) )
|
||||
if ( g_path_is_absolute ( dr->icon_name ) ) {
|
||||
icon_path = dr->icon_name;
|
||||
}
|
||||
else {
|
||||
icon_path = icon_path_ = nk_xdg_theme_get_icon ( pd->xdg_context, themes, NULL, dr->icon_name, dr->icon_size, 1, TRUE );
|
||||
if ( icon_path_ == NULL ) {
|
||||
|
@ -673,8 +674,7 @@ static int drun_mode_init ( Mode *sw )
|
|||
mode_set_private_data ( sw, (void *) pd );
|
||||
// current destkop
|
||||
const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" );
|
||||
pd->current_desktop_list = current_desktop? g_strsplit(current_desktop, ":", 0) : NULL;
|
||||
|
||||
pd->current_desktop_list = current_desktop ? g_strsplit ( current_desktop, ":", 0 ) : NULL;
|
||||
|
||||
// Theme
|
||||
pd->xdg_context = nk_xdg_theme_context_new ( drun_icon_fallback_themes, NULL );
|
||||
|
|
|
@ -93,9 +93,11 @@ static char ** __history_get_element_list_fields ( FILE *fd, unsigned int *lengt
|
|||
ssize_t l = 0;
|
||||
while ( ( l = getline ( &buffer, &buffer_length, fd ) ) > 0 ) {
|
||||
// Jump to the first space.
|
||||
const char *start = strchr( buffer, ' ');
|
||||
const char *start = strchr ( buffer, ' ' );
|
||||
// not found, skip.
|
||||
if ( start == NULL ) continue;
|
||||
if ( start == NULL ) {
|
||||
continue;
|
||||
}
|
||||
start++;
|
||||
// remove trailing \n
|
||||
buffer[l - 1] = '\0';
|
||||
|
@ -110,7 +112,6 @@ static char ** __history_get_element_list_fields ( FILE *fd, unsigned int *lengt
|
|||
retv[( *length ) + 1] = NULL;
|
||||
|
||||
( *length )++;
|
||||
|
||||
}
|
||||
return retv;
|
||||
}
|
||||
|
|
|
@ -537,7 +537,7 @@ static void rofi_collect_modi ( void )
|
|||
rofi_collect_modi_add ( &help_keys_mode );
|
||||
|
||||
if ( find_arg ( "-no-plugins" ) < 0 ) {
|
||||
find_arg_str ( "-plugin-path", &(config.plugin_path) );
|
||||
find_arg_str ( "-plugin-path", &( config.plugin_path ) );
|
||||
g_debug ( "Parse plugin path: %s", config.plugin_path );
|
||||
rofi_collect_modi_dir ( config.plugin_path );
|
||||
}
|
||||
|
@ -888,13 +888,13 @@ int main ( int argc, char *argv[] )
|
|||
}
|
||||
if ( rofi_theme_is_empty ( ) ) {
|
||||
GBytes *theme_data = g_resource_lookup_data (
|
||||
resources_get_resource(),
|
||||
resources_get_resource (),
|
||||
"/org/qtools/rofi/default_theme.rasi",
|
||||
G_RESOURCE_LOOKUP_FLAGS_NONE,
|
||||
NULL );
|
||||
if ( theme_data ) {
|
||||
const char *theme = g_bytes_get_data ( theme_data, NULL );
|
||||
if ( rofi_theme_parse_string ( (const char *)theme ) ) {
|
||||
if ( rofi_theme_parse_string ( (const char *) theme ) ) {
|
||||
g_warning ( "Failed to parse default theme. Giving up.." );
|
||||
if ( list_of_error_msgs ) {
|
||||
for ( GList *iter = g_list_first ( list_of_error_msgs );
|
||||
|
|
|
@ -142,7 +142,7 @@ void rofi_theme_free ( ThemeWidget *widget )
|
|||
inline static void printf_double ( double d )
|
||||
{
|
||||
char buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
g_ascii_formatd ( buf, G_ASCII_DTOSTR_BUF_SIZE,"%.4lf", d );
|
||||
g_ascii_formatd ( buf, G_ASCII_DTOSTR_BUF_SIZE, "%.4lf", d );
|
||||
fputs ( buf, stdout );
|
||||
}
|
||||
static void rofi_theme_print_distance ( RofiDistance d )
|
||||
|
@ -297,7 +297,8 @@ static void rofi_theme_print_index ( ThemeWidget *widget )
|
|||
fputs ( name, stdout );
|
||||
if ( iter->prev == NULL && iter->next ) {
|
||||
putchar ( ' ' );
|
||||
} else if ( iter->next ) {
|
||||
}
|
||||
else if ( iter->next ) {
|
||||
putchar ( '.' );
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +329,7 @@ static void rofi_theme_print_index ( ThemeWidget *widget )
|
|||
void rofi_theme_print ( ThemeWidget *widget )
|
||||
{
|
||||
if ( widget != NULL ) {
|
||||
printf("/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION);
|
||||
printf ( "/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION );
|
||||
rofi_theme_print_index ( widget );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -487,7 +487,7 @@ static int monitor_active_from_id_focused ( int mon_id, workarea *mon )
|
|||
xcb_window_t active_window;
|
||||
xcb_get_property_cookie_t awc;
|
||||
awc = xcb_ewmh_get_active_window ( &xcb->ewmh, xcb->screen_nbr );
|
||||
if ( ! xcb_ewmh_get_active_window_reply ( &xcb->ewmh, awc, &active_window, NULL ) ) {
|
||||
if ( !xcb_ewmh_get_active_window_reply ( &xcb->ewmh, awc, &active_window, NULL ) ) {
|
||||
g_debug ( "Failed to get active window, falling back to mouse location (-5)." );
|
||||
return retv;
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ static int monitor_active_from_id ( int mon_id, workarea *mon )
|
|||
}
|
||||
}
|
||||
else if ( mon_id == -2 || mon_id == -4 ) {
|
||||
if ( monitor_active_from_id_focused ( mon_id, mon ) ){
|
||||
if ( monitor_active_from_id_focused ( mon_id, mon ) ) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue