Skip to content
Permalink
Browse files

Fix: weird item in bookmarks if the folder was removed

Fixes #1099
  • Loading branch information...
sc0w authored and raveit65 committed Dec 24, 2018
1 parent 1846d75 commit e7b68e08a5dacacc0a35049422a40a03f95aba4a
Showing with 40 additions and 11 deletions.
  1. +7 −2 libcaja-private/caja-bookmark.c
  2. +33 −9 src/caja-navigation-action.c
@@ -649,9 +649,14 @@ caja_bookmark_menu_item_new (CajaBookmark *bookmark)

image_cairo = create_image_cairo_for_bookmark (bookmark);

menu_item = bookmark_image_menu_item_new_from_surface (image_cairo, bookmark->details->name);
if (strlen (bookmark->details->name) > 0)
{
menu_item = bookmark_image_menu_item_new_from_surface (image_cairo, bookmark->details->name);

return menu_item;
return menu_item;
}
else
return NULL;
}

gboolean
@@ -139,28 +139,52 @@ fill_menu (CajaNavigationWindow *window,
GtkWidget *menu_item;
int index;
GList *list;
gboolean list_void;

g_assert (CAJA_IS_NAVIGATION_WINDOW (window));

slot = CAJA_NAVIGATION_WINDOW_SLOT (CAJA_WINDOW (window)->details->active_pane->active_slot);

list = back ? slot->back_list : slot->forward_list;
index = 0;
list_void = TRUE;

while (list != NULL)
{
menu_item = caja_bookmark_menu_item_new (CAJA_BOOKMARK (list->data));
g_object_set_data (G_OBJECT (menu_item), "user_data", GINT_TO_POINTER (index));
gtk_widget_show (GTK_WIDGET (menu_item));
g_signal_connect_object (menu_item, "activate",
back
? G_CALLBACK (activate_back_menu_item_callback)
: G_CALLBACK (activate_forward_menu_item_callback),
window, 0);

gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);

if (menu_item) {
list_void = FALSE;
g_object_set_data (G_OBJECT (menu_item), "user_data", GINT_TO_POINTER (index));
gtk_widget_show (GTK_WIDGET (menu_item));
g_signal_connect_object (menu_item, "activate",
back
? G_CALLBACK (activate_back_menu_item_callback)
: G_CALLBACK (activate_forward_menu_item_callback),
window, 0);

gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
}

list = g_list_next (list);
++index;
}

if (list_void)
{
gtk_menu_shell_append (GTK_MENU_SHELL (menu),
eel_image_menu_item_new_from_icon ("dialog-error", _("folder removed")));
if (back)
{
caja_navigation_window_slot_clear_back_list (slot);
caja_navigation_window_allow_back (window, FALSE);
}
else
{
caja_navigation_window_slot_clear_forward_list (slot);
caja_navigation_window_allow_forward (window, FALSE);
}
}
}

static void

0 comments on commit e7b68e0

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