Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get pinboard/panel icon name from .desktop files. #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions ROX-Filer/src/icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ GType icon_get_type(void)
*/
void icon_set_path(Icon *icon, const char *pathname, const char *name)
{
gchar *leafname = NULL;
GError *error = NULL;

if (icon->path)
{
icon_unhash_path(icon);
Expand All @@ -464,11 +467,34 @@ void icon_set_path(Icon *icon, const char *pathname, const char *name)

icon_hash_path(icon);

if (!name)
name = g_basename(icon->src_path);
if (!name) {
leafname = g_path_get_basename(icon->src_path);
name = leafname;
}

icon->item = diritem_new(name);
diritem_restat(icon->path, icon->item, NULL);

if (leafname)
g_free(leafname);

if (icon->item->mime_type == application_x_desktop)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to free the old leafname here?

leafname = get_value_from_desktop_file(
pathname, "Desktop Entry", "Name", &error);
if (leafname) {
if (error) {
g_free(leafname);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And g_free_error(error) too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, see ce2496a.

g_error_free(error);
} else {
if (icon->item->leafname)
g_free(icon->item->leafname);
icon->item->leafname = leafname;
}
} else if (error) {
g_error_free(error);
}
}
}
}

Expand Down