static void
add_callback (NemoMenuItem *item,
	      gpointer          user_data)
{
	GList            *files, *scan;
	NemoFileInfo *file;
	char             *uri, *dir;
	GString          *cmd;

	files = g_object_get_data (G_OBJECT (item), "files");
	file = files->data;

	uri = nemo_file_info_get_uri (file);
	dir = g_path_get_dirname (uri);

	cmd = g_string_new ("file-roller");
	g_string_append_printf (cmd," --default-dir=%s --add", g_shell_quote (dir));

	g_free (dir);
	g_free (uri);

	for (scan = files; scan; scan = scan->next) {
		NemoFileInfo *file = scan->data;

		uri = nemo_file_info_get_uri (file);
		g_string_append_printf (cmd, " %s", g_shell_quote (uri));
		g_free (uri);
	}

	g_spawn_command_line_async (cmd->str, NULL);

	g_string_free (cmd, TRUE);
}
示例#2
0
static void
extract_here_callback (NemoMenuItem *item,
		       gpointer          user_data)
{
	GList            *files, *scan;
	GString          *cmd;

	files = g_object_get_data (G_OBJECT (item), "files");

	cmd = g_string_new ("file-roller --extract-here");

	for (scan = files; scan; scan = scan->next) {
		NemoFileInfo *file = scan->data;
		char             *uri;
		char             *quoted_uri;

		uri = nemo_file_info_get_uri (file);
		quoted_uri = g_shell_quote (uri);
		g_string_append_printf (cmd, " %s", quoted_uri);
		g_free (uri);
		g_free (quoted_uri);
	}

	g_spawn_command_line_async (cmd->str, NULL);

#ifdef DEBUG
	g_print ("EXEC: %s\n", cmd->str);
#endif

	g_string_free (cmd, TRUE);
}
static void
extract_to_callback (NemoMenuItem *item,
		     gpointer          user_data)
{
	GList            *files;
	NemoFileInfo *file;
	char             *uri, *default_dir;
	GString          *cmd;

	files = g_object_get_data (G_OBJECT (item), "files");
	file = files->data;

	uri = nemo_file_info_get_uri (file);
	default_dir = nemo_file_info_get_parent_uri (file);

	cmd = g_string_new ("file-roller");
	g_string_append_printf (cmd,
				" --default-dir=%s --extract %s",
				g_shell_quote (default_dir),
				g_shell_quote (uri));

#ifdef DEBUG
	g_print ("EXEC: %s\n", cmd->str);
#endif

	g_spawn_command_line_async (cmd->str, NULL);

	g_string_free (cmd, TRUE);
	g_free (default_dir);
	g_free (uri);
}
示例#4
0
static GList *gtkhash_properties_get_pages(
#if IN_NAUTILUS_EXTENSION
	G_GNUC_UNUSED NautilusPropertyPageProvider *provider,
#elif IN_CAJA_EXTENSION
	G_GNUC_UNUSED CajaPropertyPageProvider *provider,
#elif IN_NEMO_EXTENSION
	G_GNUC_UNUSED NemoPropertyPageProvider *provider,
#elif IN_THUNAR_EXTENSION
	G_GNUC_UNUSED ThunarxPropertyPageProvider *provider,
#endif
	GList *files)
{
	// Only display page for a single file
	if (!files || files->next)
		return NULL;

#if IN_NAUTILUS_EXTENSION
	GFileType type = nautilus_file_info_get_file_type(files->data);
	char *uri = nautilus_file_info_get_uri(files->data);
#elif IN_CAJA_EXTENSION
	GFileType type = caja_file_info_get_file_type(files->data);
	char *uri = caja_file_info_get_uri(files->data);
#elif IN_NEMO_EXTENSION
	GFileType type = nemo_file_info_get_file_type(files->data);
	char *uri = nemo_file_info_get_uri(files->data);
#elif IN_THUNAR_EXTENSION
	GFileInfo *info = thunarx_file_info_get_file_info(files->data);
	GFileType type = g_file_info_get_file_type(info);
	g_object_unref(info);

	char *uri = thunarx_file_info_get_uri(files->data);
#endif

	// Only display page for regular files
	if (type != G_FILE_TYPE_REGULAR)
		return NULL;

	struct page_s *page = gtkhash_properties_new_page(uri);
	if (!page)
		return NULL;

#if IN_NAUTILUS_EXTENSION
	NautilusPropertyPage *ppage = nautilus_property_page_new(
		"GtkHash::properties", gtk_label_new(_("Digests")), page->box);
#elif IN_CAJA_EXTENSION
	CajaPropertyPage *ppage = caja_property_page_new(
		"GtkHash::properties", gtk_label_new(_("Digests")), page->box);
#elif IN_NEMO_EXTENSION
	NemoPropertyPage *ppage = nemo_property_page_new(
		"GtkHash::properties", gtk_label_new(_("Digests")), page->box);
#elif IN_THUNAR_EXTENSION
	GtkWidget *ppage = thunarx_property_page_new(_("Digests"));
	gtk_container_add(GTK_CONTAINER(ppage), page->box);
#endif

	GList *pages = g_list_append(NULL, ppage);

	return pages;
}
示例#5
0
/*--------------------------------------------------------------------------*/
static void
get_share_info_for_file_info (NemoFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
{
  char		*uri;
  char		*local_path = NULL;
  GFile         *f;

  *share_info = NULL;
  *is_shareable = FALSE;

  uri = nemo_file_info_get_uri (file);
  f = nemo_file_info_get_location(file);
  if (!uri)
    goto out;

#define NETWORK_SHARE_PREFIX "network:///share-"

  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
    {
      const char *share_name;

      share_name = uri + strlen (NETWORK_SHARE_PREFIX);

      /* FIXME: NULL GError */
      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
	{
	  *share_info = NULL;
	  *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what gnome-vfs thinks */
	}
      else
	{
	  *is_shareable = TRUE;
	}

      goto out;
    }

  if (!nemo_file_info_is_directory(file))
    goto out;

  local_path = g_file_get_path(f);
  if (!local_path || !g_file_is_native(f))
    goto out;

  /* FIXME: NULL GError */
  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
    goto out;

  *is_shareable = TRUE;

 out:

  g_object_unref(f);
  g_free (uri);
  g_free (local_path);
}
static void
load_location (NemoImagePropertiesPage *page,
	       NemoFileInfo	       *info)
{
	GFile *file;
	char *uri;
	FileOpenData *data;

	g_assert (NEMO_IS_IMAGE_PROPERTIES_PAGE (page));
	g_assert (info != NULL);

	page->details->cancellable = g_cancellable_new ();

	uri = nemo_file_info_get_uri (info);
	file = g_file_new_for_uri (uri);

#ifdef HAVE_EXEMPI
	{
		/* Current Exempi does not support setting custom IO to be able to use Gnome-vfs */
		/* So it will only work with local files. Future version might remove this limitation */
		XmpFilePtr xf;
		char *localname;

		localname = g_filename_from_uri (uri, NULL, NULL);
		if (localname) {
			xf = xmp_files_open_new (localname, 0);
			page->details->xmp = xmp_files_get_new_xmp (xf); /* only load when loading */
			xmp_files_close (xf, 0);
			g_free (localname);
		}
		else {
			page->details->xmp = NULL;
		}
	}
#endif /*HAVE_EXEMPI*/

	data = g_new0 (FileOpenData, 1);
	data->page = page;
	data->info = info;
	
	g_file_read_async (file,
			   0,
			   page->details->cancellable,
			   file_open_callback,
			   data);

	g_object_unref (file);
	g_free (uri);
}
GtkWidget *
nemo_desktop_item_properties_make_box (GtkSizeGroup *label_size_group,
                                           GList *files)
{
	NemoFileInfo *info;
	char *uri;
	GtkWidget *box;

	g_assert (nemo_desktop_item_properties_should_show (files));

	box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	g_object_set_data_full (G_OBJECT (box), "label-size-group",
				label_size_group, (GDestroyNotify) g_object_unref);

	info = NEMO_FILE_INFO (files->data);

	uri = nemo_file_info_get_uri (info);
	nemo_desktop_item_properties_create_begin (uri, box);
	g_free (uri);

	return box;
}
static GList *mate_mplayer_properties_get_pages(NemoPropertyPageProvider * provider, GList * files)
{
    GList *pages = NULL;
    NemoFileInfo *file;
    GtkWidget *page, *label;
    NemoPropertyPage *property_page;
    guint i;
    gboolean found = FALSE;
    gchar *uri;

    /* only add properties page if a single file is selected */
    if (files == NULL || files->next != NULL)
        return pages;

    file = files->data;

    /* only add the properties page to these mime types */
    for (i = 0; i < G_N_ELEMENTS(mime_types); i++) {
        if (nemo_file_info_is_mime_type(file, mime_types[i])) {
            found = TRUE;
            break;
        }
    }

    if (found) {
        uri = nemo_file_info_get_uri(file);
        label = gtk_label_new(dgettext(GETTEXT_PACKAGE, "Audio/Video"));
        page = gtk_table_new(20, 2, FALSE);
        gtk_container_set_border_width(GTK_CONTAINER(page), 6);
        if (get_properties(page, uri)) {
            gtk_widget_show_all(page);
            property_page = nemo_property_page_new("video-properties", label, page);
            pages = g_list_prepend(pages, property_page);
        }
        g_free(uri);
    }
    return pages;
}