aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-04 00:20:22 -0600
committerTed Gould <ted@gould.cx>2010-03-04 00:20:22 -0600
commit4665a089117f7fc0eb537aedcca0d7d10168b12d (patch)
treeb0bdee095c764b56d8ebf5bd2eb8ac44baa5a5c1 /src
parentd63d3929de9f53c33f7de4f1c75d9bcc5846fa70 (diff)
downloadayatana-indicator-messages-4665a089117f7fc0eb537aedcca0d7d10168b12d.tar.gz
ayatana-indicator-messages-4665a089117f7fc0eb537aedcca0d7d10168b12d.tar.bz2
ayatana-indicator-messages-4665a089117f7fc0eb537aedcca0d7d10168b12d.zip
Actually searching through the list
Diffstat (limited to 'src')
-rw-r--r--src/default-applications.c16
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;
}