diff -up cheese-2.29.5/src/cheese-window.c.trash-menu cheese-2.29.5/src/cheese-window.c --- cheese-2.29.5/src/cheese-window.c.trash-menu 2009-12-23 09:08:40.000000000 -0500 +++ cheese-2.29.5/src/cheese-window.c 2010-01-12 22:53:55.606104369 -0500 @@ -168,6 +168,7 @@ typedef struct GtkActionGroup *actions_burst; GtkActionGroup *actions_fullscreen; GtkActionGroup *actions_wide_mode; + GtkActionGroup *actions_trash; GtkUIManager *ui_manager; @@ -610,6 +611,7 @@ cheese_window_cmd_close (GtkWidget *widg g_object_unref (cheese_window->actions_video); g_object_unref (cheese_window->actions_burst); g_object_unref (cheese_window->actions_fullscreen); + g_object_unref (cheese_window->actions_trash); g_object_unref (cheese_window->gconf); g_free (cheese_window); @@ -1091,6 +1093,39 @@ cheese_window_selection_changed_cb (GtkI } } +static void +cheese_window_thumbnails_changed (GtkTreeModel *model, + CheeseWindow *cheese_window) +{ + GtkTreeIter iter; + + if (gtk_tree_model_get_iter_first (model, &iter)) + { + gtk_action_group_set_sensitive (cheese_window->actions_trash, TRUE); + } + else + { + gtk_action_group_set_sensitive (cheese_window->actions_trash, FALSE); + } +} + +static void +cheese_window_thumbnail_inserted (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + CheeseWindow *cheese_window) +{ + cheese_window_thumbnails_changed (model, cheese_window); +} + +static void +cheese_window_thumbnail_deleted (GtkTreeModel *model, + GtkTreePath *path, + CheeseWindow *cheese_window) +{ + cheese_window_thumbnails_changed (model, cheese_window); +} + static gboolean cheese_window_button_press_event_cb (GtkWidget *iconview, GdkEventButton *event, CheeseWindow *cheese_window) @@ -1480,8 +1515,6 @@ static const GtkActionEntry action_entri {"Cheese", NULL, N_("_Cheese") }, {"Edit", NULL, N_("_Edit") }, - {"RemoveAll", NULL, N_("Move All to Trash"), NULL, NULL, - G_CALLBACK (cheese_window_move_all_media_to_trash)}, {"Help", NULL, N_("_Help") }, @@ -1491,6 +1524,11 @@ static const GtkActionEntry action_entri {"About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK (cheese_window_cmd_about)}, }; +static const GtkActionEntry action_entries_trash[] = { + {"RemoveAll", NULL, N_("Move All to Trash"), NULL, NULL, + G_CALLBACK (cheese_window_move_all_media_to_trash)}, +}; + static const GtkToggleActionEntry action_entries_countdown[] = { {"Countdown", NULL, N_("Countdown"), NULL, NULL, G_CALLBACK (cheese_window_set_countdown), FALSE}, }; @@ -1799,6 +1837,10 @@ cheese_window_create_window (CheeseWindo "ActionsMain", action_entries_main, G_N_ELEMENTS (action_entries_main)); + cheese_window->actions_trash = cheese_window_action_group_new (cheese_window, + "ActionsTrash", + action_entries_trash, + G_N_ELEMENTS (action_entries_trash)); cheese_window->actions_toggle = cheese_window_radio_action_group_new (cheese_window, "ActionsRadio", action_entries_toggle, @@ -1918,6 +1960,13 @@ cheese_window_create_window (CheeseWindo G_CALLBACK (cheese_window_selection_changed_cb), cheese_window); g_signal_connect (cheese_window->thumb_view, "button_press_event", G_CALLBACK (cheese_window_button_press_event_cb), cheese_window); + + g_signal_connect (gtk_icon_view_get_model (GTK_ICON_VIEW (cheese_window->thumb_view)), "row-inserted", + G_CALLBACK (cheese_window_thumbnail_inserted), cheese_window); + g_signal_connect (gtk_icon_view_get_model (GTK_ICON_VIEW (cheese_window->thumb_view)), "row-deleted", + G_CALLBACK (cheese_window_thumbnail_deleted), cheese_window); + + cheese_window_thumbnails_changed (gtk_icon_view_get_model (GTK_ICON_VIEW (cheese_window->thumb_view)), cheese_window); } void