Skip to content
Permalink
Browse files

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.
  • Loading branch information...
yetist authored and raveit65 committed May 20, 2018
1 parent 2631577 commit ac2778a74663d0c47cbdff7f0d8608a5a8d45a89
Showing with 14 additions and 1 deletion.
  1. +14 −1 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;
}

0 comments on commit ac2778a

Please sign in to comment.
You can’t perform that action at this time.