diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/default-applications.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/default-applications.c b/src/default-applications.c index c389d32..ad63412 100644 --- a/src/default-applications.c +++ b/src/default-applications.c @@ -16,8 +16,22 @@ struct default_db_t default_db[] = { const gchar * get_default_name (gchar * desktop_path) { + g_return_val_if_fail(desktop_path != NULL, NULL); + gchar * basename = g_path_get_basename(desktop_path); + g_return_val_if_fail(basename != NULL, NULL); - return NULL; + gint i; + for (i = 0; default_db[i].desktop_file != NULL; i++) { + if (g_strcmp0(default_db[i].desktop_file, basename) == 0) { + break; + } + } + + g_free(basename); + if (default_db[i].name != NULL) { + return default_db[i].name; + } + return NULL; } |