summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryetist <[email protected]>2018-05-20 11:52:44 +0800
committerraveit65 <[email protected]>2018-05-30 15:44:02 +0200
commitac2778a74663d0c47cbdff7f0d8608a5a8d45a89 (patch)
tree733934cf347861f5cebac3d3f246d4f40c84ac26
parent263157786e7881f1c98f0a6d839447d8f0c57dbd (diff)
downloadmate-panel-ac2778a74663d0c47cbdff7f0d8608a5a8d45a89.tar.bz2
mate-panel-ac2778a74663d0c47cbdff7f0d8608a5a8d45a89.tar.xz
panel-menu-button.c: Force use basename for compare
* matemenu_tree_get_canonical_menu_path () now return absolute file path, not basename like matemenu_tree_get_menu_file.
-rw-r--r--mate-panel/panel-menu-button.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c
index 9f57d139..4d8e2ad2 100644
--- a/mate-panel/panel-menu-button.c
+++ b/mate-panel/panel-menu-button.c
@@ -128,20 +128,33 @@ panel_menu_filename_to_scheme (const char *filename)
{
const char *retval;
int i;
+ gchar *basename;
retval = NULL;
if (!filename)
return retval;
+ /* Note:
+ * filename in root_items dose not have the parent directory,
+ * if filename passed is absolute path, this function will return NULL.
+ * so here use the basename for compare.
+ */
+ if (g_path_is_absolute (filename)) {
+ basename = g_path_get_basename (filename);
+ } else {
+ basename = g_strdup(filename);
+ }
+
for (i = 0; i < G_N_ELEMENTS (root_items); i++) {
if (root_items [i].filename &&
- !strncmp (filename, root_items [i].filename,
+ !strncmp (basename, root_items [i].filename,
strlen (root_items [i].filename))) {
retval = root_items [i].scheme;
break;
}
}
+ g_free(basename);
return retval;
}