GList * nemo_image_converter_get_file_items (NemoMenuProvider *provider, GtkWidget *window, GList *files) { NemoMenuItem *item; GList *file; GList *items = NULL; for (file = files; file != NULL; file = file->next) { if (image_converter_file_is_image (file->data)) { item = nemo_menu_item_new ("NemoImageConverter::resize", _("_Resize Images..."), _("Resize each selected image"), "stock_position-size"); g_signal_connect (item, "activate", G_CALLBACK (image_resize_callback), nemo_file_info_list_copy (files)); items = g_list_prepend (items, item); item = nemo_menu_item_new ("NemoImageConverter::rotate", _("Ro_tate Images..."), _("Rotate each selected image"), "stock_rotate"); g_signal_connect (item, "activate", G_CALLBACK (image_rotate_callback), nemo_file_info_list_copy (files)); items = g_list_prepend (items, item); items = g_list_reverse (items); return items; } } return NULL; }
static GList * nemo_fr_get_file_items (NemoMenuProvider *provider, GtkWidget *window, GList *files) { GList *items = NULL; GList *scan; gboolean can_write = TRUE; gboolean one_item; gboolean one_archive = FALSE; gboolean one_derived_archive = FALSE; gboolean one_compressed_archive = FALSE; gboolean all_archives = TRUE; gboolean all_archives_derived = TRUE; gboolean all_archives_compressed = TRUE; if (files == NULL) return NULL; if (unsupported_scheme ((NemoFileInfo *) files->data)) return NULL; for (scan = files; scan; scan = scan->next) { NemoFileInfo *file = scan->data; FileMimeInfo file_mime_info; file_mime_info = get_file_mime_info (file); if (all_archives && ! file_mime_info.is_archive) all_archives = FALSE; if (all_archives_compressed && file_mime_info.is_archive && ! file_mime_info.is_compressed_archive) all_archives_compressed = FALSE; if (all_archives_derived && file_mime_info.is_archive && ! file_mime_info.is_derived_archive) all_archives_derived = FALSE; if (can_write) { NemoFileInfo *parent; parent = nemo_file_info_get_parent_info (file); can_write = nemo_file_info_can_write (parent); g_object_unref (parent); } } /**/ one_item = (files != NULL) && (files->next == NULL); one_archive = one_item && all_archives; one_derived_archive = one_archive && all_archives_derived; one_compressed_archive = one_archive && all_archives_compressed; if (all_archives && can_write) { NemoMenuItem *item; item = nemo_menu_item_new ("NemoFr::extract_here", _("Extract Here"), /* Translators: the current position is the current folder */ _("Extract the selected archive to the current position"), "extract-archive"); g_signal_connect (item, "activate", G_CALLBACK (extract_here_callback), provider); g_object_set_data_full (G_OBJECT (item), "files", nemo_file_info_list_copy (files), (GDestroyNotify) nemo_file_info_list_free); items = g_list_append (items, item); } if (all_archives && (!can_write || always_show_extract_to)) { NemoMenuItem *item; item = nemo_menu_item_new ("NemoFr::extract_to", _("Extract To..."), _("Extract the selected archive"), "extract-archive"); g_signal_connect (item, "activate", G_CALLBACK (extract_to_callback), provider); g_object_set_data_full (G_OBJECT (item), "files", nemo_file_info_list_copy (files), (GDestroyNotify) nemo_file_info_list_free); items = g_list_append (items, item); } if (! one_compressed_archive || one_derived_archive) { NemoMenuItem *item; item = nemo_menu_item_new ("NemoFr::add", _("Compress..."), _("Create a compressed archive with the selected objects"), "add-files-to-archive"); g_signal_connect (item, "activate", G_CALLBACK (add_callback), provider); g_object_set_data_full (G_OBJECT (item), "files", nemo_file_info_list_copy (files), (GDestroyNotify) nemo_file_info_list_free); items = g_list_append (items, item); } return items; }