static void
fsearch_window_action_invert_selection (GSimpleAction *action,
                                        GVariant      *variant,
                                        gpointer       user_data)
{
    // TODO: can be very slow. Find a way how to optimize that.
    FsearchApplicationWindow *self = user_data;
    GtkTreeSelection *selection = fsearch_application_window_get_listview_selection (self);
    if (!selection) {
        return;
    }
    GtkTreeModel *model = NULL;
    GList *selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
    if (!selected_rows) {
        return;
    }
    if (!model) {
        return;
    }
    gtk_tree_selection_select_all (selection);

    GList *temp  = selected_rows;
    while (temp) {
        GtkTreePath *path = temp->data;
        GtkTreeIter iter = {0};
        if (gtk_tree_model_get_iter (model, &iter, path)) {
            gtk_tree_selection_unselect_iter (selection, &iter);
        }
        temp = temp->next;
    }
    g_list_free_full (selected_rows, (GDestroyNotify) gtk_tree_path_free);
}
Exemple #2
0
static void uri_opener_select_all_cb(GtkWidget *widget, 
				     gpointer data)
{
	GtkTreeSelection *selection = gtk_tree_view_get_selection(
						GTK_TREE_VIEW(opener.urilist));
	gtk_tree_selection_select_all(selection);
}
Exemple #3
0
static void
banlist_crop (GtkWidget * wid, banlist_info *banl)
{
	session *sess = banl->sess;
	GtkTreeSelection *select;
	GSList *list = NULL, *node;
	int num_sel;

	/* remember which bans are selected */
	select = gtk_tree_view_get_selection (get_view (sess));
	/* gtk_tree_selected_get_selected_rows() isn't present in gtk 2.0.x */
	gtk_tree_selection_selected_foreach (select, banlist_add_selected_cb,
	                                     &list);

	num_sel = g_slist_length (list);
	/* select all, then unselect those that we remembered */
	if (num_sel)
	{
		gtk_tree_selection_select_all (select);

		for (node = list; node; node = node->next)
			gtk_tree_selection_unselect_iter (select, node->data);

		g_slist_foreach (list, (GFunc)g_free, NULL);
		g_slist_free (list);

		banlist_unban (NULL, banl);
	} else
		fe_message (_("You must select some bans."), FE_MSG_ERROR);
}
Exemple #4
0
/* notes_note_select_all */
void notes_note_select_all(Notes * notes)
{
	GtkTreeSelection * sel;

	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(notes->view));
	gtk_tree_selection_select_all(sel);
}
Exemple #5
0
/* trash_on_select_all */
static void _trash_on_select_all(gpointer data)
{
	Trash * trash = data;
	GtkTreeSelection * treesel;

	treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(trash->view));
	gtk_tree_selection_select_all(treesel);
}
Exemple #6
0
void
list_store_select_all(GtkWidget *w)
{
  GtkTreeSelection *sel;

  sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
  gtk_tree_selection_select_all(sel);
}
Exemple #7
0
TILP_EXPORT void action_select_all_clicked(GtkButton * button, gpointer user_data)
{
	GtkTreeView *view = GTK_TREE_VIEW(clist);
	GtkTreeSelection *sel;
	
	sel = gtk_tree_view_get_selection(view);
	gtk_tree_selection_select_all(sel);
} 
Exemple #8
0
static void
gftpui_gtk_trans_selectall (GtkWidget * widget, gpointer data)
{
  gftp_transfer * tdata;
  tdata = data;

  GtkTreeSelection * select = gtk_tree_view_get_selection (GTK_TREE_VIEW(tdata->clist));
  gtk_tree_selection_select_all (select);
}
Exemple #9
0
static void
action_select_all (GtkAction *action, gpointer callback_data)
{
    GtkTreeSelection *s;
    GtkamMain *m = GTKAM_MAIN (callback_data);

    s = gtk_tree_view_get_selection (GTK_TREE_VIEW (m->priv->list));
    gtk_tree_selection_select_all (s);
    gtkam_main_update_sensitivity (m);
}
Exemple #10
0
void gTree::selectAll()
{
	GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
	
	if (!sel) 
		return;
	
	_no_click++;
	gtk_tree_selection_select_all(sel);
	_no_click--;
}
// Select specified tracks
static void select_tracks(int type) {
	switch (type) {
	case MID_SELALL:
		gtk_tree_selection_select_all(g_sels[TAB_TRACKS]);
		break;
	case MID_SELNONE:
		gtk_tree_selection_unselect_all(g_sels[TAB_TRACKS]);
		break;
	default:
		about_box("Sorry - not implemented");
		return;
	}
}
Exemple #12
0
static void
banlist_clear_cb (GtkDialog *dialog, gint response, gpointer sess)
{
	GtkTreeSelection *sel;

	gtk_widget_destroy (GTK_WIDGET (dialog));

	if (response == GTK_RESPONSE_OK)
	{
		sel = gtk_tree_view_get_selection (get_view (sess));
		gtk_tree_selection_select_all (sel);
		banlist_unban (NULL, sess);
	}
}
static void
fsearch_window_action_select_all (GSimpleAction *action,
                                  GVariant      *variant,
                                  gpointer       user_data)
{
    FsearchApplicationWindow *self = user_data;
    GtkTreeSelection *selection = fsearch_application_window_get_listview_selection (self);
    GtkEntry *entry = fsearch_application_window_get_search_entry (self);
    if (entry && gtk_widget_is_focus (GTK_WIDGET (entry))) {
        gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
    }
    else if (selection) {
        gtk_tree_selection_select_all (selection);
    }
}
Exemple #14
0
void fm_folder_view_select_all(FmFolderView* fv)
{
    GtkTreeSelection * tree_sel;
    switch(fv->mode)
    {
    case FM_FV_LIST_VIEW:
        tree_sel = gtk_tree_view_get_selection((GtkTreeView*)fv->view);
        gtk_tree_selection_select_all(tree_sel);
        break;
    case FM_FV_ICON_VIEW:
    case FM_FV_COMPACT_VIEW:
    case FM_FV_THUMBNAIL_VIEW:
        exo_icon_view_select_all((ExoIconView*)fv->view);
        break;
    }
}
Exemple #15
0
/**
 * Cette fonction (dé)sélectionne toutes les lignes du tree_view.
 * Le libellé du bouton est modifié en conséquence.
 *
 * \param le button de commande
 * \param le tree_view considéré
 *
 * \return
 */
void utils_togglebutton_select_unselect_all_rows ( GtkToggleButton *togglebutton,
                        GtkWidget *tree_view )
{
    gchar *label;

    if ( gtk_toggle_button_get_active ( togglebutton ) )
    {
        gtk_tree_selection_select_all ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) ) );
        label = g_strdup ( _("Unselect all") );
    }
    else
    {
        gtk_tree_selection_unselect_all ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) ) );
        label = g_strdup ( _("Select all") );
    }

    gtk_button_set_label ( GTK_BUTTON ( togglebutton ), label );

    g_free ( label );
}
Exemple #16
0
static void
debug_logger_select_clicked(GtkWidget *widget, DebugLogger *logger)
{
    GtkTreeView *view;
    GtkTreeSelection *selection;
    gint current_page;

    g_return_if_fail(IS_DEBUG_LOGGER(logger));

    if (gtk_notebook_get_n_pages(logger->priv->notebook) == 0)
        return;

    current_page = gtk_notebook_get_current_page(logger->priv->notebook);

    view =
        GTK_TREE_VIEW(gtk_bin_get_child(
                GTK_BIN(gtk_notebook_get_nth_page(
                        GTK_NOTEBOOK(logger->priv->notebook),
                        current_page))));

    selection = gtk_tree_view_get_selection(view);

    gtk_tree_selection_select_all(selection);
}
void GtkTreeSelection_::select_all()
{
	gtk_tree_selection_select_all (GTK_TREE_SELECTION(instance));

}
Exemple #18
0
/* Apply filter manually by copying iters from romFullList model to romDisplay model
 * if they match filter criteria. Optimized to just do a sort on romDisplaymodel if
 * filter is empty twice in a row.
 */
static void apply_filter()
{
    int g_iNumRoms;
    static short resort = 0;
    GtkTreeModel* destination;
    const gchar* filter;

    filter = gtk_entry_get_text(GTK_ENTRY(g_MainWindow.filter));
    if(filter[0]!='\0'||resort==1)
        {
        if(filter[0]!='\0')
            resort=1;
        else
            resort=0;

        GtkTreeModel *model, *source;
        GtkTreeIter sourceiter, destinationiter;
        gboolean validiter;

        char *country, *goodname, *usercomments, *filename, *md5hash, *crc1, *crc2, *internalname, *savetype, *players, *size, *compressiontype, *imagetype, *cicchip, *rumble;
        GdkPixbuf *status[5];
        GdkPixbuf *flag;
        cache_entry* entry; 
        short int counter;

        /* Clear the display model. */
        GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(g_MainWindow.romDisplay));
        gtk_tree_selection_select_all(selection);
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romDisplay));
        gtk_list_store_clear(GTK_LIST_STORE(model));

        source = gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romFullList));
        g_iNumRoms = gtk_tree_model_iter_n_children(source, NULL);
        validiter = gtk_tree_model_get_iter_first(source, &sourceiter);

        destination = gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romDisplay));
        gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(destination), g_MainWindow.romSortColumn,  return_zero, (gpointer)NULL, (gpointer)NULL);

        if(validiter)
            {
            for(counter = 0; counter < g_iNumRoms; ++counter)
                {
                if(filter_function(source, &sourceiter, (gpointer)NULL))
                    {
                    gtk_tree_model_get(GTK_TREE_MODEL(source), &sourceiter, 0, &country, 1, &goodname, 3, &usercomments, 4, &filename, 5, &md5hash, 6, &crc1, 7, &crc2, 8, &internalname, 9, &savetype, 10, &players, 11, &size, 12, &compressiontype, 13, &imagetype, 14, &cicchip, 15, &rumble, 16, &status[0], 17, &status[1], 18, &status[2], 19, &status[3], 20, &status[4], 21, &flag, 22, &entry, -1);

                    gtk_list_store_append(GTK_LIST_STORE(destination), &destinationiter);
                    gtk_list_store_set(GTK_LIST_STORE(destination), &destinationiter, 0, country, 1, goodname, 2, NULL, 3, usercomments, 4, filename, 5, md5hash, 6, crc1, 7, crc2, 8, internalname, 9, savetype, 10, players, 11, size, 12, compressiontype, 13, imagetype, 14, cicchip, 15, rumble, 16, status[0], 17, status[1], 18, status[2], 19, status[3], 20, status[4], 21, flag, 22, entry, -1);
                    }
                if(!gtk_tree_model_iter_next(source, &sourceiter))
                     break;
                }
           }
        }
    else
        destination = gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romDisplay));

        /* Always sort romDisplay, otherwise regular column sorting won't work. */
        gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(destination), g_MainWindow.romSortColumn,  rombrowser_compare, (gpointer)NULL, (gpointer)NULL);
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(destination), g_MainWindow.romSortColumn, g_MainWindow.romSortType);
}
Exemple #19
0
/* Load a GtkTreeModel after re-scanning directories. */
void rombrowser_refresh(unsigned int roms, unsigned short clear)
{
    int arrayroms;
    GtkTreeModel* model;

    /* If clear flag is set, clear the models. */
    if(clear)
        {
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romFullList));
        GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(g_MainWindow.romFullList));
        gtk_tree_selection_select_all(selection);
        gtk_list_store_clear(GTK_LIST_STORE(model));

        model = gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romDisplay));
        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(g_MainWindow.romDisplay));
        gtk_tree_selection_select_all(selection);
        gtk_list_store_clear(GTK_LIST_STORE(model));
        }

    model =  gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romFullList));
    arrayroms = gtk_tree_model_iter_n_children(model, NULL); 

    /* If there are currently more ROMs in cache than in the rombrowser, add them. */
    if(roms>arrayroms)
        {
        gboolean fullpaths;

        GtkTreeIter* iter = (GtkTreeIter*)malloc(sizeof(GtkTreeIter));
        char *country, *goodname, *usercomments, *md5hash, *crc1, *crc2, *internalname, *savetype, *players, *size, *compressiontype, *imagetype, *cicchip, *rumble;
        char* filename = NULL; /* Needs to be NULLed if fullpaths and zero roms are updated, for free. */
        GdkPixbuf* flag;
        GdkPixbuf* status[5];
        unsigned int romcounter;
        int counter;

        country = (char*)calloc(32, sizeof(char));
        md5hash = (char*)calloc(33, sizeof(char));
        crc1 = (char*)calloc(9, sizeof(char));
        crc2 = (char*)calloc(9, sizeof(char));
        savetype = (char*)calloc(16, sizeof(char));
        players = (char*)calloc(16, sizeof(char));
        size = (char*)calloc(16, sizeof(char));
        compressiontype = (char*)calloc(16, sizeof(char));
        imagetype = (char*)calloc(32, sizeof(char));
        cicchip = (char*)calloc(16, sizeof(char));
        rumble = (char*)calloc(8, sizeof(char));

        if(iter==NULL||country==NULL||md5hash==NULL||crc1==NULL||crc2==NULL||size==NULL||compressiontype==NULL||imagetype==NULL||cicchip==NULL)
            {
            fprintf(stderr, "%s, %d: Out of memory!\n", __FILE__, __LINE__); 
            return;
            }

        fullpaths = config_get_bool("RomBrowserShowFullPaths", FALSE);
        cache_entry* entry;
        entry = g_romcache.top;

        /* Advance cache pointer. */
        for(romcounter=0; romcounter < arrayroms; ++romcounter)
            {
            entry = entry->next;
            if(entry==NULL)
                return;
            }

        for(romcounter=0; (romcounter < roms) && (entry != NULL); ++romcounter)
          {
          countrycodestring(entry->countrycode, country);
          countrycodeflag(entry->countrycode, &flag);
          goodname = entry->inientry->goodname;

          for(counter = 0; counter < 5; ++counter)
                {
                if(entry->inientry->status>counter)
                    status[counter] = star;
                else
                    status[counter] = staroff;
                }
            usercomments = entry->usercomments;
            if(fullpaths)
                filename = entry->filename;
            else
                filename = filefrompath(entry->filename);

            for(counter = 0; counter < 16; ++counter) 
                sprintf(md5hash+counter*2, "%02X", entry->md5[counter]);
            sprintf(crc1, "%08X", entry->crc1);
            sprintf(crc2, "%08X", entry->crc2);
            internalname=entry->internalname;
            savestring(entry->inientry->savetype, savetype);
            playersstring(entry->inientry->players, players);
            sprintf(size, "%.1f MBits", (float)(entry->romsize / (float)0x20000));
            compressionstring(entry->compressiontype, compressiontype);
            imagestring(entry->imagetype, imagetype);
            cicstring(entry->cic, cicchip);
            rumblestring(entry->inientry->rumble, rumble);

            /* Actually add entries to models. */
            model =  gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romFullList));
            gtk_list_store_append(GTK_LIST_STORE(model), iter);

            gtk_list_store_set(GTK_LIST_STORE(model), iter, 0, country, 1, goodname, 2, NULL, 3, usercomments, 4, filename, 5, md5hash, 6, crc1, 7, crc2, 8, internalname, 9, savetype, 10, players, 11, size, 12, compressiontype, 13, imagetype, 14, cicchip, 15, rumble, 16, status[0], 17, status[1], 18, status[2], 19, status[3], 20, status[4], 21, flag, 22, entry, -1);

            model = gtk_tree_view_get_model(GTK_TREE_VIEW(g_MainWindow.romDisplay));
            gtk_list_store_append(GTK_LIST_STORE(model), iter);
            gtk_list_store_set(GTK_LIST_STORE(model), iter, 0, country, 1, goodname, 2, NULL, 3, usercomments, 4, filename, 5, md5hash, 6, crc1, 7, crc2, 8, internalname, 9, savetype, 10, players, 11, size, 12, compressiontype, 13, imagetype, 14, cicchip, 15, rumble, 16, status[0], 17, status[1], 18, status[2], 19, status[3], 20, status[4], 21, flag, 22, entry, -1);

            /*printf("Added: %s\n", goodname);*/
            entry = entry->next;
            }

        free(country);
        free(md5hash);
        free(crc1);
        free(crc2);
        free(savetype);
        free(players);
        free(size);
        free(compressiontype);
        free(imagetype);
        free(cicchip);
        free(rumble);
        if(!fullpaths)
           {
           if(filename!=NULL)
              free(filename);
           }
       free(iter);

        /* Do an initial sort. */
        gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), g_MainWindow.romSortColumn, rombrowser_compare, (gpointer)NULL, (gpointer)NULL);
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), g_MainWindow.romSortColumn, g_MainWindow.romSortType);
        gtk_tree_view_set_model(GTK_TREE_VIEW(g_MainWindow.romDisplay), model);
        }
}
Exemple #20
0
static void
debug_logger_save_clicked(GtkWidget *widget, DebugLogger *logger)
{
    GladeXML *glade;
    GtkWidget *dialog;
    gint result;
    GList *selected_rows = NULL, *entry;
    GtkTreeView *view;
    GtkTreeModel *model;
    GtkTreeSelection *selection;
    gint current_page;
    GString *copy_data;

    g_return_if_fail(IS_DEBUG_LOGGER(logger));

    if (gtk_notebook_get_n_pages(logger->priv->notebook) == 0)
        return;

    glade = glade_xml_new(GLADEDIR "/main.glade", "save_dialog", NULL);
    dialog = glade_xml_get_widget(glade, "save_dialog");

    copy_data = g_string_new(NULL);

    gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), "debug.log");
    result = gtk_dialog_run(GTK_DIALOG(dialog));

    if(result == GTK_RESPONSE_OK)
    {
        gchar *filename;

        filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
        current_page = gtk_notebook_get_current_page(logger->priv->notebook);

        view =
            GTK_TREE_VIEW(gtk_bin_get_child(
                        GTK_BIN(gtk_notebook_get_nth_page(
                                GTK_NOTEBOOK(logger->priv->notebook),
                                current_page))));

        model = gtk_tree_view_get_model(view);
        selection = gtk_tree_view_get_selection(view);

        gtk_tree_selection_select_all(selection);

        selected_rows =
            gtk_tree_selection_get_selected_rows(selection, &model);

        for(entry = selected_rows; entry != NULL; entry = g_list_next(entry))
        {
            GtkTreeIter iter;
            gchar *message;

            gtk_tree_model_get_iter(model, &iter, entry->data);
            gtk_tree_model_get(model, &iter, MSG_COLUMN, &message, -1);

            copy_data = g_string_append(copy_data, message);
            copy_data = g_string_append_c(copy_data, '\n');

            g_free(message);
        }

        gtk_tree_selection_unselect_all(selection);

        g_file_set_contents(filename, copy_data->str, copy_data->len, NULL);

        g_free(filename);
    }

    g_string_free(copy_data, TRUE);

    g_list_foreach(selected_rows, (GFunc)gtk_tree_path_free, NULL);
    g_list_free(selected_rows);

    gtk_widget_destroy(dialog);
    g_object_unref(glade);
}
Exemple #21
0
void
gftpui_ask_transfer (gftp_transfer * tdata)
{
  GtkWidget * dialog, * tempwid, * scroll, * hbox;
  gftp_file * tempfle;
  GList * templist;
  GtkTreeIter iter;

  dialog = gtk_dialog_new_with_buttons (_("Transfer Files"), GTK_WINDOW(window), 0,
                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                        GTK_STOCK_OK, GTK_RESPONSE_OK,
                                        NULL);
  gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), 10);
  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), 5);

  tempwid = gtk_label_new (_("The following file(s) exist on both the local and remote computer\nPlease select what you would like to do"));
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), tempwid, FALSE,
              FALSE, 0);
  gtk_widget_show (tempwid);

  scroll = gtk_scrolled_window_new (NULL, NULL);
  gtk_window_set_default_size(GTK_WINDOW (dialog), 450, 350);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  GtkListStore * l = gtk_list_store_new (1, G_TYPE_POINTER);
  tdata->clist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(l));
  GtkCellRenderer * cell = gtk_cell_renderer_text_new();
  gtk_tree_view_insert_column_with_data_func(GTK_TREE_VIEW(tdata->clist), -1, _("Filename"), cell, data_col_0, tdata, NULL);
  gtk_tree_view_insert_column_with_data_func(GTK_TREE_VIEW(tdata->clist), -1, tdata->fromreq->hostname, cell, data_col_1, NULL, NULL);
  gtk_tree_view_insert_column_with_data_func(GTK_TREE_VIEW(tdata->clist), -1, tdata->toreq->hostname, cell, data_col_2, NULL, NULL);
  gtk_tree_view_insert_column_with_data_func(GTK_TREE_VIEW(tdata->clist), -1, _("Action"), cell, data_col_3, NULL, NULL);

  gtk_container_add (GTK_CONTAINER (scroll), tdata->clist);
  GtkTreeSelection * select = gtk_tree_view_get_selection (GTK_TREE_VIEW(tdata->clist));
  gtk_tree_selection_set_mode (select, GTK_SELECTION_MULTIPLE);
  GtkTreeViewColumn * c;
  c = gtk_tree_view_get_column(GTK_TREE_VIEW(tdata->clist), 0);
  gtk_tree_view_column_set_fixed_width(c, 100);
  c = gtk_tree_view_get_column(GTK_TREE_VIEW(tdata->clist), 1);
  gtk_tree_view_column_set_fixed_width(c, 85);
  c = gtk_tree_view_get_column(GTK_TREE_VIEW(tdata->clist), 2);
  gtk_tree_view_column_set_fixed_width(c, 85);
  c = gtk_tree_view_get_column(GTK_TREE_VIEW(tdata->clist), 3);
  gtk_tree_view_column_set_fixed_width(c, 85);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), scroll, TRUE, TRUE, 0);
  gtk_widget_show (tdata->clist);
  gtk_widget_show (scroll);

  for (templist = tdata->files; templist != NULL;
       templist = templist->next)
    {
      tempfle = templist->data;
      if (tempfle->startsize == 0 || S_ISDIR (tempfle->st_mode))
        {
           tempfle->shown = 0;
           continue;
        }
      tempfle->shown = 1;
      gftp_get_transfer_action (tdata->fromreq, tempfle);
      gtk_list_store_append (l, &iter);
      gtk_list_store_set (l, &iter, 0, tempfle, -1);
    }

  gtk_tree_selection_select_all (select);

  hbox = gtk_hbox_new (TRUE, 20);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
  gtk_widget_show (hbox);

  tempwid = gtk_button_new_with_label (_("Overwrite"));
  gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (tempwid), "clicked",
              G_CALLBACK (gftpui_gtk_overwrite), (gpointer) tdata);
  gtk_widget_show (tempwid);

  tempwid = gtk_button_new_with_label (_("Resume"));
  gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (tempwid), "clicked",
              G_CALLBACK (gftpui_gtk_resume), (gpointer) tdata);
  gtk_widget_show (tempwid);

  tempwid = gtk_button_new_with_label (_("Skip File"));
  gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (tempwid), "clicked",
                      G_CALLBACK (gftpui_gtk_skip), (gpointer) tdata);
  gtk_widget_show (tempwid);

  hbox = gtk_hbox_new (TRUE, 20);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
  gtk_widget_show (hbox);

  tempwid = gtk_button_new_with_label (_("Select All"));
  gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (tempwid), "clicked",
              G_CALLBACK (gftpui_gtk_trans_selectall), (gpointer) tdata);
  gtk_widget_show (tempwid);

  tempwid = gtk_button_new_with_label (_("Deselect All"));
  gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (tempwid), "clicked",
              G_CALLBACK (gftpui_gtk_trans_unselectall), (gpointer) tdata);
  gtk_widget_show (tempwid);

  gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);
  gint response = gtk_dialog_run (GTK_DIALOG(dialog));

  g_static_mutex_lock (&tdata->structmutex);
  if (response == GTK_RESPONSE_OK)
    {
      for (templist = tdata->files; templist != NULL; templist = templist->next)
        {
          tempfle = templist->data;
          if (tempfle->transfer_action != GFTP_TRANS_ACTION_SKIP)
            break;
        }

      tdata->ready = 1;
      if (templist == NULL)
        {
          tdata->show = 0;
          tdata->done = 1;
        }
      else
        tdata->show = 1;
    }
  else
    {
      tdata->show = 0;
      tdata->done = tdata->ready = 1;
    }
  g_static_mutex_unlock (&tdata->structmutex);

  gtk_widget_destroy (dialog);
}
Exemple #22
0
gint display_action_dbox(gchar *target)
{
	GtkBuilder *builder;
	GError* error = NULL;
	GtkWidget *dbox;
	GtkWidget *data;
	GtkTreeIter iter;
	GList *sel;
	int button = 0;
	gint result;
	gboolean empty = TRUE;

	// update folder listing (if supported)
	if (!(ticalcs_calc_features(calc_handle) & FTS_SILENT) )
		return BUTTON1;
	else
	{
		if(remote.var_tree == NULL)
		{
			if (tilp_dirlist_remote())
				return BUTTON1;

			ctree_refresh();
			labels_refresh();
		}
	}

	// box creation
	builder = gtk_builder_new();
	if (!gtk_builder_add_from_file (builder, tilp_paths_build_builder("action.ui"), &error))
	{
		g_warning (_("Couldn't load builder file: %s\n"), error->message);
		g_error_free (error);
		return 0; // THIS RETURNS !
	}
	gtk_builder_connect_signals(builder, NULL);

	dbox = GTK_WIDGET (gtk_builder_get_object (builder, "action_dbox"));
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);
	clist = data = GTK_WIDGET (gtk_builder_get_object (builder, "treeview1"));

	// clist creation
	create_clist(data);

	// fill model
	for (sel = local.selection1; sel != NULL; sel = sel->next) 
	{
		FileEntry *f = (FileEntry *)sel->data;
		FileContent *c = (FileContent *)f->content1;

		if(f->content1 == NULL)	// file can't be loaded
			continue;

		// we have now 1 VarEntry per FileContent
		{
			VarEntry *v = c->entries[0];
			VarEntry *w;
			gchar **row_text = g_malloc0(5 * sizeof(gchar *));
			char *trans;
			char full_name[260];

			// modify attr or folder if target is specified
			if(strcmp(target, ""))
			{
				if(!strcmp(target, "<FLASH>"))
				{
					v->attr = ATTRB_ARCHIVED;
				}
				else
				{
					strcpy(v->folder, target);
				}
			}

			// search for matching var
			tifiles_build_fullname(options.calc_model, full_name, v->folder, v->name);
			trans = ticonv_varname_to_utf8(options.calc_model, (const char *)full_name, v->type);

			w = ticalcs_dirlist_ve_exist(remote.var_tree, v);
			if (w == NULL)
				continue;

			if(w->attr == ATTRB_LOCKED || w->attr == ATTRB_ARCHIVED)
				v->action = ACT_SKIP;
			else
				v->action = ACT_SKIP;	//don't overwrite as default behaviour

			// file contains an already existing var: add it to the window
			row_text[0] = trans;
			row_text[1] = g_strdup(tifiles_attribute_to_string(v->attr));
			row_text[2] = g_strdup(f->name);
			row_text[3] = g_strdup(action2string(v->action));
			tilp_vars_translate(row_text[0]);

			gtk_list_store_append(list, &iter);
			gtk_list_store_set(list, &iter,
					   COLUMN_VAR,  row_text[0],
					   COLUMN_ATTR, row_text[1],
					   COLUMN_FILE, row_text[2],
					   COLUMN_ACTION, row_text[3],
					   COLUMN_DATA_F, (gpointer)f,
					   COLUMN_DATA_V, (gpointer)v,
					   -1);
			g_strfreev(row_text);

			empty = FALSE;
		}
	}		

	if (empty == TRUE) 
	{
		button = BUTTON1; // skip box as ok
		goto out_clean;
	}

	// select all vars
	{
		GtkTreeView *view = GTK_TREE_VIEW(clist);
		GtkTreeSelection *sel2;

		sel2 = gtk_tree_view_get_selection(view);
		gtk_tree_selection_select_all(sel2);
	}

	// box running
	gtk_dialog_set_default_response(GTK_DIALOG(dbox), GTK_RESPONSE_CANCEL);
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		button = BUTTON1;
		break;
	case GTK_RESPONSE_CANCEL:
		button = BUTTON2;
	default:
         button = BUTTON2;
		break;
	}

out_clean:
	gtk_widget_destroy(dbox);

	return button;
}
void SelectBooksDialog::on_button_all()
{
    gtk_tree_selection_select_all(selectbooks);
}
Exemple #24
0
static void
fm_list_view_select_all (FMDirectoryView *view)
{
    gtk_tree_selection_select_all (gtk_tree_view_get_selection (FM_LIST_VIEW (view)->tree));
}
Exemple #25
0
void rc_gui_list2_select_all()
{
    gtk_tree_selection_select_all(rc_ui->list2_selection);
}