Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 30, 2018
1 parent 2631577 commit ac2778a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mate-panel/panel-menu-button.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit ac2778a

Please sign in to comment.