[Thunar-dev] Select all files from select_path

Fernando Maróstica fmarostica at fmarostica.org
Wed Oct 24 20:07:19 CEST 2007


I want select all files using the standard_view->select_path. But I
don't want using the standart_view->selec_all.

'Cause I want compare all select files with a criteria. The Firt thing
is get all files from current directory (List of ThunarFiles). So, The
second thing is compare every item with every selected items (List of
GtkTreePath) and select only unselect item yet. 

Bellow follow the code:

static void
thunar_standard_view_action_foo (GtkAction          *action,
                                 ThunarStandardView *standard_view)
  ThunarFolder *folder;
  GList        *files;
  GList        *lp;

  _thunar_return_if_fail (GTK_IS_ACTION (action));
  _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));

  folder = thunar_list_model_get_folder (standard_view->model);

  if (G_LIKELY(folder != NULL)) {
      files = g_list_copy (thunar_folder_get_files (folder));
      selected_files = THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items (standard_view);

      THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->unselect_all

      for (lp = files; lp != NULL; lp = lp->next) {
          /* files is a list of ThunarFiles */
          /* I need convert files in a list of GtkTreePath */
          /* ??????? */

          GtkTreePath *path;
          path = gtk_tree_path_new();
          /* file doesn't work, 'cause is ThunarFile I need GtkTreePath */
          THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->select_path (standard_view, path);

      g_list_free (files);
      g_list_free (lp);

Is there any way or sample to convert ThunarFile into GtkTreePath?

Best Regards.
Fernando Maróstica.

More information about the Thunar-dev mailing list