summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-12-24 11:35:09 +0100
committerraveit65 <[email protected]>2018-12-27 14:26:03 +0100
commite7b68e08a5dacacc0a35049422a40a03f95aba4a (patch)
treebc2f7229c0a99efd4fbdd9b2300ddcfb932d3140
parent1846d75ba9b18d4017973d79b15045693ff8baac (diff)
downloadcaja-e7b68e08a5dacacc0a35049422a40a03f95aba4a.tar.bz2
caja-e7b68e08a5dacacc0a35049422a40a03f95aba4a.tar.xz
Fix: weird item in bookmarks if the folder was removed
Fixes https://github.com/mate-desktop/caja/issues/1099
-rw-r--r--libcaja-private/caja-bookmark.c9
-rw-r--r--src/caja-navigation-action.c42
2 files changed, 40 insertions, 11 deletions
diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c
index af7a899e..22fb58a5 100644
--- a/libcaja-private/caja-bookmark.c
+++ b/libcaja-private/caja-bookmark.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
diff --git a/src/caja-navigation-action.c b/src/caja-navigation-action.c
index a1171153..8fbecfe9 100644
--- a/src/caja-navigation-action.c
+++ b/src/caja-navigation-action.c
@@ -139,6 +139,7 @@ fill_menu (CajaNavigationWindow *window,
GtkWidget *menu_item;
int index;
GList *list;
+ gboolean list_void;
g_assert (CAJA_IS_NAVIGATION_WINDOW (window));
@@ -146,21 +147,44 @@ fill_menu (CajaNavigationWindow *window,
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