aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-22 11:48:24 -0500
committerTed Gould <ted@gould.cx>2011-07-22 11:48:24 -0500
commit68ed5c051d18321bcc3504167e8c57b56840e186 (patch)
tree8a67185fcd20499aac1605657abb67a592f4f886
parentcb66d5b60dfef96523a90cfec42ff679b2c60065 (diff)
downloadayatana-indicator-messages-68ed5c051d18321bcc3504167e8c57b56840e186.tar.gz
ayatana-indicator-messages-68ed5c051d18321bcc3504167e8c57b56840e186.tar.bz2
ayatana-indicator-messages-68ed5c051d18321bcc3504167e8c57b56840e186.zip
Reworking found slightly to make clean up code nicer
-rw-r--r--src/default-applications.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/default-applications.c b/src/default-applications.c
index 3a8df60..339183d 100644
--- a/src/default-applications.c
+++ b/src/default-applications.c
@@ -49,11 +49,10 @@ get_default_helper (const gchar * desktop_path)
gboolean found = FALSE;
gint i;
gint length = sizeof(default_db)/sizeof(default_db[0]);
- for (i = 0; i < length; i++) {
+ for (i = 0; i < length && !found; i++) {
if (default_db[i].desktop_file) {
if (g_strcmp0(default_db[i].desktop_file, basename) == 0) {
found = TRUE;
- break;
}
} else if (default_db[i].uri_scheme) {
GAppInfo *info = g_app_info_get_default_for_uri_scheme(default_db[i].uri_scheme);
@@ -71,8 +70,6 @@ get_default_helper (const gchar * desktop_path)
g_object_unref(info);
if (g_strcmp0(default_basename, basename) == 0) {
found = TRUE;
- g_free(default_basename);
- break;
}
g_free(default_basename);
@@ -82,7 +79,7 @@ get_default_helper (const gchar * desktop_path)
g_free(basename);
if (found) {
- return &default_db[i];
+ return &default_db[i - 1];
}
return NULL;