mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -05:00
Add debug output.
This commit is contained in:
parent
5646adc34d
commit
c099aaeabf
6 changed files with 44 additions and 41 deletions
|
@ -47,6 +47,7 @@
|
|||
#include "dialogs/drun.h"
|
||||
|
||||
#define DRUN_CACHE_FILE "rofi2.druncache"
|
||||
#define LOG_DOMAIN "Dialogs.DRun"
|
||||
|
||||
static inline int execsh ( const char *cmd, int run_in_term )
|
||||
{
|
||||
|
@ -231,7 +232,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
|
|||
g_key_file_load_from_file ( kf, path, 0, &error );
|
||||
// If error, skip to next entry
|
||||
if ( error != NULL ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Failed to parse desktop file: %s because: %s", path, error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to parse desktop file: %s because: %s", path, error->message );
|
||||
g_error_free ( error );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
|
@ -240,12 +241,12 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
|
|||
gchar *key = g_key_file_get_string ( kf, "Desktop Entry", "Type", NULL );
|
||||
if ( key == NULL ) {
|
||||
// No type? ignore.
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: No type indicated", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: No type indicated", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
if ( g_strcmp0 ( key, "Application" ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Not of type application (%s)", path, key );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Not of type application (%s)", path, key );
|
||||
g_free ( key );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
|
@ -253,25 +254,25 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
|
|||
g_free ( key );
|
||||
// Skip hidden entries.
|
||||
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "Hidden", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Hidden", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Hidden", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
// Skip entries that have NoDisplay set.
|
||||
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "NoDisplay", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: NoDisplay", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: NoDisplay", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
// Name key is required.
|
||||
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Name", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Invalid DesktopFile: '%s', no 'Name' key present.\n", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Invalid DesktopFile: '%s', no 'Name' key present.\n", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
// We need Exec, don't support DBusActivatable
|
||||
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Exec", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Unsupported DesktopFile: '%s', no 'Exec' key present.\n", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Unsupported DesktopFile: '%s', no 'Exec' key present.\n", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
* Name of the history file where previously choosen commands are stored.
|
||||
*/
|
||||
#define RUN_CACHE_FILE "rofi-3.runcache"
|
||||
#define LOG_DOMAIN "Dialogs.Run"
|
||||
|
||||
/**
|
||||
* The internal data structure holding the private data of the Run Mode.
|
||||
|
@ -249,7 +250,7 @@ static char ** get_apps ( unsigned int *length )
|
|||
gsize l = 0;
|
||||
gchar *homedir = g_locale_to_utf8 ( g_get_home_dir (), -1, NULL, &l, &error );
|
||||
if ( error != NULL ) {
|
||||
fprintf ( stderr, "Failed to convert homedir to UTF-8: %s\n", error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to convert homedir to UTF-8: %s", error->message );
|
||||
g_clear_error ( &error );
|
||||
g_free ( homedir );
|
||||
return NULL;
|
||||
|
@ -259,12 +260,13 @@ static char ** get_apps ( unsigned int *length )
|
|||
for ( const char *dirname = strtok ( path, sep ); dirname != NULL; dirname = strtok ( NULL, sep ) ) {
|
||||
DIR *dir = opendir ( dirname );
|
||||
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Checking path %s for executable.", dirname );
|
||||
if ( dir != NULL ) {
|
||||
struct dirent *dent;
|
||||
gsize dirn_len = 0;
|
||||
gchar *dirn = g_locale_to_utf8 ( dirname, -1, NULL, &dirn_len, &error );
|
||||
if ( error != NULL ) {
|
||||
fprintf ( stderr, "Failed to convert directory name to UTF-8: %s\n", error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to convert directory name to UTF-8: %s", error->message );
|
||||
g_clear_error ( &error );
|
||||
continue;
|
||||
}
|
||||
|
@ -291,7 +293,7 @@ static char ** get_apps ( unsigned int *length )
|
|||
gsize name_len;
|
||||
gchar *name = g_filename_to_utf8 ( dent->d_name, -1, NULL, &name_len, &error );
|
||||
if ( error != NULL ) {
|
||||
fprintf ( stderr, "Failed to convert filename to UTF-8: %s\n", error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to convert filename to UTF-8: %s", error->message );
|
||||
g_clear_error ( &error );
|
||||
g_free ( name );
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue