Re: How do I get the number



Hi, Chris,
On Mon, Oct 8, 2018 at 7:28 PM Chris Moller <moller mollerware com> wrote:

/
|
|-----> disk1
    |
    |
    |-------X-----------> folder1
    |--------------------> folder2
|-----> disk2
    |
    |--------------------> folder3
    |--------------------> folder4
    |--------------------> subdir
                              |
                              |--------------------> folder5
                              |--------------------> folder6




From that, folder1 would have an indices value of [0, 0], folder2 would be inidices[0, 1], folder3 [1,0], 
folder4 [1,1]

So folder1 will have row 0, column 0?

But that's wrong, because folder1 is at row 2 column 2.


By extension, folder5 would be indices[1,2,0] and folder6 [1, 2, 1]

And folder5 should be at row 8 column 3.

And what is the coordinate be for disk1?
It should be row 1, column 1, right?

So as you can see I'm trying to get a value of the column number.
On top of that I will need to get a column 1 if I click where the "X" is
on the diagram...

Thank you.


On 08/10/2018 18:25, Igor Korot wrote:

Ok.
Now let's get back.

Do you know how I can get the column from the screenshot I sent?

On Mon, Oct 8, 2018, 5:04 PM Chris Moller <moller mollerware com> wrote:

Sorry, I misunderstood you.

Actually, my daughter speaks pretty good Russian--she was a competitive figure skater for a lot of years 
and both her principal coaches were Russian.   The preferred Russian over English so my daughter learned 
Russian.  Anyway, she translated the songs years ago just to practise.

On 08/10/2018 17:15, Igor Korot wrote:

On Mon, Oct 8, 2018 at 4:09 PM Chris Moller <moller mollerware com> wrote:

The ones by the Soviet Army?  No.  They're from a recording made in London in about 1959.  Once upon a 
time, back in the 60s, I had an LP version that had some translations printed on the liner, but that LP 
vanished decades ago.  Other than Tipperary, Annie Laurie, and Oh no, John!, they're in Russian.

I understand.
And that's why I offer to translate them to English if you are interested.

Thank you.

On 08/10/2018 16:13, Igor Korot wrote:

Chris,

On Mon, Oct 8, 2018 at 3:08 PM Chris Moller <moller mollerware com> wrote:

Here's a more complex tree, some of  of the files in my music collection.  (It's not exactly how GTK would 
show it, but close enough.)

Do you want a translation for some those songs?

── misc
│   ├── PiSymphony
│   │   ├── Pi-and-e.ogg
│   │   └── The-Circle.ogg
│   └── SovietArmy
│       ├── 01 - Song of Youth.mp3
│       ├── 02 - A birch tree in a field did stand.mp3
│       ├── 03 - Far Away.mp3
│       ├── 04 - Song of the Volga Boatmen.mp3
│       ├── 05 - You are always beautiful.mp3
│       ├── 06 - Along Peter's Street.mp3
│       ├── 07 - Tipperary (sung in English).mp3
│       ├── 08 - Ah! Lovely Night.mp3
│       ├── 09 - Kamarinskaya [instrumental].mp3
│       ├── 10 - Annie Laurie (sung in English).mp3
│       ├── 11 - Song of the Plains (Meadowland).mp3
│       ├── 12 - Kalinka.mp3
│       ├── 13 - Bandura (sung in Ukrainian).mp3
│       ├── 14 - Oh no, John! (sung in English).mp3
│       ├── 15 - Snowflakes.mp3
│       ├── 16 - Ukrainian Poem.mp3
│       └── 17 - Soldiers' Chorus (from The Decembrists).mp3
└── synthesiser
    ├── Carlos
    │   ├── Aurora_Borealis.ogg
    │   ├── Midnight_Sun.ogg
    │   └── SonicSeasonings.ogg
    ├── Hyman
    │   ├── Evening_Thoughts.ogg
    │   ├── Four_Duets_in_Odd_Meter.ogg
    │   ├── Give_It_Up_or_Turn_It_Loose.ogg
    │   ├── Improvisation_in_Fourths.ogg
    │   ├── Kolumbo.ogg
    │   ├── Tap_Dance_in_the_Memory_Banks.ogg
    │   ├── The_Legend_of_Johnny_Pot.ogg
    │   ├── The_Minotaur.ogg
    │   ├── The_Moog_and_Me.ogg
    │   ├── Time_Is_Tight.ogg
    │   ├── Topless_Dancers_of_Corfu.ogg
    │   └── Total_Bells_and_Tony.ogg
    ├── Kitaro
    │   ├── Silk_Road_II.ogg
    │   └── Silk_Road_I.ogg
    ├── Tomita
    │   ├── Compilation


On 08/10/2018 14:48, Igor Korot wrote:

On Mon, Oct 8, 2018 at 12:11 PM Chris Moller <moller mollerware com> wrote:

Hi, Igor,

The row-activated handler calls:

void
user_function (GtkTreeView       *tree_view,
               GtkTreePath       *path,
               GtkTreeViewColumn *column,
               gpointer           user_data)
{

}

so what you need is :

gint *indices =  gtk_tree_path_get_indices (path);

which will return an integer vector ow the row, column, sub-column, subsub-column... depending on the 
topgraphy of your tree.  (You can get the depth of the tree--thus the number of entries in the 
vector--with:

gint len = gtk_tree_path_get_depth (path);

)

If it's a simple two-dimensional tree, the column number will be indices[1], but you  might want to make 
sure that the tree depth is at least two before doing that or you might be pointing past the end of the 
indices array.

BTW, what do you mean by saying: "simple 2-dimensional tree"?
Is there going to be n-dimensional tree? How it will be represented on
the screen? Do you have a screenshot?

Thank you.

By the way, don't try to free the indices array--it points to a GTK internal structure.

HTH,
Chris



On 08/10/2018 12:52, Igor Korot wrote:

Hi, Chris,

On Sun, Oct 7, 2018 at 3:34 PM Chris Moller <moller mollerware com> wrote:

Take a look at

gint * gtk_tree_path_get_indices (GtkTreePath *path);

with the  "GtkTreePath  *path"  parameter you get from the row-activated callback.

https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-get-indices

I tried to do:

int column = gtk_tree_path_get_indices( column );

but got an error:

Can't convert GtkTreeViewColumjn to GtkTreePath

The "row-activated" callback is defined as:

void user_function(GtkTreeView *tree_view, GtkTreePath *path,
GtkTreeViewColumn *column, gpointer user_data);

And so the types are unrelated.

What am I doling wrong?

Thank you.




On 07/10/2018 20:04, Igor Korot via gtk-list wrote:

Hi, ALL,
For the GtkTreeView there is a "row-activated" signal:
https://developer.gnome.org/gtk3/stable/GtkTreeView.html#GtkTreeView-row-activated.

That function receives as a parameter

column the GtkTreeViewColumn in which the activation occurred.

The problem is (at least as I see it) is that it is not a simple integer
for the column number.

Is there a simple way to get a column number on which I activated
the row from this signal?

Thank you.
_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list



_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list










[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]