mirror of
https://github.com/lbonn/rofi
synced 2024-11-26 22:00:20 +00:00
drun: Standardize debug messages
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
parent
9cd1e3fac2
commit
955cdf5ba5
1 changed files with 11 additions and 15 deletions
|
@ -262,20 +262,15 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
|
|
||||||
// Check if item is on disabled list.
|
// Check if item is on disabled list.
|
||||||
if ( g_hash_table_contains ( pd->disabled_entries, id ) ) {
|
if ( g_hash_table_contains ( pd->disabled_entries, id ) ) {
|
||||||
g_debug ( "Skipping: %s, was previously seen.", id );
|
g_debug ( "[%s] [%s] Skipping, was previously seen.", id, path );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
GKeyFile *kf = g_key_file_new ();
|
GKeyFile *kf = g_key_file_new ();
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean res = g_key_file_load_from_file ( kf, path, 0, &error );
|
gboolean res = g_key_file_load_from_file ( kf, path, 0, &error );
|
||||||
if ( !res && error == NULL ) {
|
|
||||||
g_debug ( "Failed to parse desktop file: %s because: unknown.", path );
|
|
||||||
g_key_file_free ( kf );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
// If error, skip to next entry
|
// If error, skip to next entry
|
||||||
if ( error != NULL ) {
|
if ( !res ) {
|
||||||
g_debug ( "Failed to parse desktop file: %s because: %s", path, error->message );
|
g_debug ( "[%s] [%s] Failed to parse desktop file because: %s.", id, path, error->message );
|
||||||
g_error_free ( error );
|
g_error_free ( error );
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -284,12 +279,12 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
gchar *key = g_key_file_get_string ( kf, "Desktop Entry", "Type", NULL );
|
gchar *key = g_key_file_get_string ( kf, "Desktop Entry", "Type", NULL );
|
||||||
if ( key == NULL ) {
|
if ( key == NULL ) {
|
||||||
// No type? ignore.
|
// No type? ignore.
|
||||||
g_debug ( "Skipping desktop file: %s because: No type indicated", path );
|
g_debug ( "[%s] [%s] Invalid desktop file: No type indicated", id, path );
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ( g_strcmp0 ( key, "Application" ) ) {
|
if ( g_strcmp0 ( key, "Application" ) ) {
|
||||||
g_debug ( "Skipping desktop file: %s because: Not of type application (%s)", path, key );
|
g_debug ( "[%s] [%s] Skipping desktop file: Not of type application (%s)", id, path, key );
|
||||||
g_free ( key );
|
g_free ( key );
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -298,14 +293,14 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
|
|
||||||
// Name key is required.
|
// Name key is required.
|
||||||
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Name", NULL ) ) {
|
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Name", NULL ) ) {
|
||||||
g_debug ( "Invalid DesktopFile: '%s', no 'Name' key present.", path );
|
g_debug ( "[%s] [%s] Invalid desktop file: no 'Name' key present.", id, path );
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip hidden entries.
|
// Skip hidden entries.
|
||||||
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "Hidden", NULL ) ) {
|
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "Hidden", NULL ) ) {
|
||||||
g_debug ( "Adding desktop file: %s to disabled list because: Hdden", path );
|
g_debug ( "[%s] [%s] Adding desktop file to disabled list: 'Hidden' key is true", id, path );
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -340,7 +335,7 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !show ) {
|
if ( !show ) {
|
||||||
g_debug ( "Adding desktop file: %s to disabled list because: OnlyShowIn/NotShowIn", path );
|
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_key_file_free ( kf );
|
||||||
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -348,14 +343,14 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
}
|
}
|
||||||
// Skip entries that have NoDisplay set.
|
// Skip entries that have NoDisplay set.
|
||||||
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "NoDisplay", NULL ) ) {
|
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "NoDisplay", NULL ) ) {
|
||||||
g_debug ( "Adding desktop file: %s to disabled list because: NoDisplay", path );
|
g_debug ( "[%s] [%s] Adding desktop file to disabled list: 'NoDisplay' key is true", id, path );
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// We need Exec, don't support DBusActivatable
|
// We need Exec, don't support DBusActivatable
|
||||||
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Exec", NULL ) ) {
|
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Exec", NULL ) ) {
|
||||||
g_debug ( "Unsupported DesktopFile: '%s', no 'Exec' key present.", path );
|
g_debug ( "[%s] [%s] Unsupported desktop file: no 'Exec' key present.", id, path );
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -419,6 +414,7 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
pd->entry_list[pd->cmd_list_length].key_file = kf;
|
pd->entry_list[pd->cmd_list_length].key_file = kf;
|
||||||
// We don't want to parse items with this id anymore.
|
// We don't want to parse items with this id anymore.
|
||||||
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
|
||||||
|
g_debug ( "[%s] Using file %s.", id, path );
|
||||||
( pd->cmd_list_length )++;
|
( pd->cmd_list_length )++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue