Tree view toggle and gtypes

2019-05-01 Thread Mike Martin via gtk-app-devel-list
Are there any gtypes that are compatible with both toggle and text
renderers?

Thanks
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Using different signals depending on which row of of a treeview

2019-05-01 Thread Mike Martin
This is more or less what I did except I added a signal_connect separately
to the visibilty (which is in a cell_data_function on first renderer)

ie: (perl)
my @cells=Treeview->get_column(n)->get_cells;
then
$cells[n]->signal_connect(blah
}
);
(where n is the appropriate number of column/renderer)





On Mon, 29 Apr 2019 at 22:57, Reuben Rissler  wrote:

>
>
> On 04/29/2019 10:36 AM, Mike Martin via gtk-app-devel-list wrote:
> > Has anyone done anything like this?
> I haven't, but you are welcome to my simple Glade mockup:
>
> 
> 
> 
>
>
>  
>
>
>
>
>  
>  
>
>  1
>  one
>
>
>  2
>  two
>
>
>  3
>  three
>
>  
>
>
>  
>
>
>
>
>
>
>
>
>  
>  
>
>  text
>  True
>  False
>  False
>
>
>  combo
>  False
>  True
>  False
>
>
>  toggle
>  False
>  False
>  True
>
>  
>
>
>  False
>  
>
>  
>  
>
>  True
>  True
>  tree_model
>  
>
>  
>  
>
>  column
>  
>
>  True
>
>
>  1
>  0
>
>  
>  
>
>  True
>  combo_model
>  1
>
>
>  2
>  0
>
>  
>  
>
>
>  3
>  3
>
>  
>
>  
>
>  
>
> 
> >
> > Basically the idea is that I push multiple renderers into a treeview
> column
> > , then depending on the row hide/show the appropriate renderer (text,
> > combo, toggle)
> So go ahead and add three different renderers, and use row values to set
> them visible or invisible. In this case we have three different
> column/row cells to set each widget visible.
> >
> > Then call the appropriate signal_connect (edited, changed, toggled)
> You can't really generate a signal on an invisible renderer, can you?
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Using different signals depending on which row of of a treeview

2019-04-30 Thread Mike Martin via gtk-app-devel-list
 This is more or less what I did except I added a signal_connect separately
to the visibilty (which is in a cell_data_function on first renderer)

ie: (perl)
my @cells=Treeview->get_column(n)->get_cells;
then
$cells[n]->signal_connect(blah
}
);
(where n is the appropriate number of column/renderer)

On Mon, 29 Apr 2019 at 22:57, Reuben Rissler  wrote:

>
>
> On 04/29/2019 10:36 AM, Mike Martin via gtk-app-devel-list wrote:
> > Has anyone done anything like this?
> I haven't, but you are welcome to my simple Glade mockup:
>
> 
> 
> 
>
>
>  
>
>
>
>
>  
>  
>
>  1
>  one
>
>
>  2
>  two
>
>
>  3
>  three
>
>  
>
>
>  
>
>
>
>
>
>
>
>
>  
>  
>
>  text
>  True
>  False
>  False
>
>
>  combo
>  False
>  True
>  False
>
>
>  toggle
>  False
>  False
>  True
>
>  
>
>
>  False
>  
>
>  
>  
>
>  True
>  True
>  tree_model
>  
>
>  
>  
>
>  column
>  
>
>  True
>
>
>  1
>  0
>
>  
>  
>
>  True
>  combo_model
>  1
>
>
>  2
>  0
>
>  
>  
>
>
>  3
>  3
>
>  
>
>  
>
>  
>
> 
> >
> > Basically the idea is that I push multiple renderers into a treeview
> column
> > , then depending on the row hide/show the appropriate renderer (text,
> > combo, toggle)
> So go ahead and add three different renderers, and use row values to set
> them visible or invisible. In this case we have three different
> column/row cells to set each widget visible.
> >
> > Then call the appropriate signal_connect (edited, changed, toggled)
> You can't really generate a signal on an invisible renderer, can you?
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Using different signals depending on which row of of a treeview

2019-04-29 Thread Mike Martin via gtk-app-devel-list
Has anyone done anything like this?

Basically the idea is that I push multiple renderers into a treeview column
, then depending on the row hide/show the appropriate renderer (text,
combo, toggle)

Then call the appropriate signal_connect (edited, changed, toggled)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: TreeView - set border on individual cells

2019-04-05 Thread Mike Martin via gtk-app-devel-list
On Fri, 5 Apr 2019, 12:36 Mike Martin,  wrote:

> Update, I worked out how to get rid of highlight
>
> 1 treeview->set selection mode(none)
> 2 treeview->signal_connect(row_activated =>sub{
> Treeview->set_cursor_on_cell(path,column,cell,true)
> }
> )
>
> Not exact code, but this is process that worked for me
>
> Would still be useful if I could find out about borders though
>
>
>
> On Fri, 5 Apr 2019, 08:03 ,  wrote:
>
>> Am Donnerstag, den 04.04.2019, 23:04 +0100 schrieb Mike Martin via gtk-
>> app-devel-list:
>> > Is this possible?
>> >
>> > I did originally plan to have certain cells have a background colour
>> > to
>> > emphasize that there is a value to change. However as soon as the row
>> > is
>> > selected this is all wiped out by the highlight from selected row
>> >
>> > So is it possible to set the borders on a cell by cell basis, all I
>> > can
>> > find is overall properties for the trreview
>> >
>> > Mike
>>
>> I don't have a definitive answer for you. But just as a headsup: you
>> can inspect every GTK component's CSS properties interactively while
>> running the program. You can even live edit the properties.
>>
>> Here's a guide:
>>
>> https://blog.gtk.org/2017/04/05/the-gtk-inspector/
>>
>>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: TreeView - set border on individual cells

2019-04-05 Thread Mike Martin
Update, I worked out how to get rid of highlight

1 treeview->set selection mode(none)
2 treeview->signal_connect(row_activated =>sub{
Treeview->set_cursor_on_cell(path,column,cell,true)
}
)

Not exact code, but this is process that worked for me

Would still be useful if I could find out about borders though



On Fri, 5 Apr 2019, 08:03 ,  wrote:

> Am Donnerstag, den 04.04.2019, 23:04 +0100 schrieb Mike Martin via gtk-
> app-devel-list:
> > Is this possible?
> >
> > I did originally plan to have certain cells have a background colour
> > to
> > emphasize that there is a value to change. However as soon as the row
> > is
> > selected this is all wiped out by the highlight from selected row
> >
> > So is it possible to set the borders on a cell by cell basis, all I
> > can
> > find is overall properties for the trreview
> >
> > Mike
>
> I don't have a definitive answer for you. But just as a headsup: you
> can inspect every GTK component's CSS properties interactively while
> running the program. You can even live edit the properties.
>
> Here's a guide:
>
> https://blog.gtk.org/2017/04/05/the-gtk-inspector/
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


TreeView - set border on individual cells

2019-04-04 Thread Mike Martin via gtk-app-devel-list
Is this possible?

I did originally plan to have certain cells have a background colour to
emphasize that there is a value to change. However as soon as the row is
selected this is all wiped out by the highlight from selected row

So is it possible to set the borders on a cell by cell basis, all I can
find is overall properties for the trreview

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Problem with grids and items spanning more than one column

2019-04-04 Thread Mike Martin
I resolved it by applying
set_halign('start') to only the textview in the layout

Looks like some interaction between the textview and the multicolumn
liststore

On Wed, 3 Apr 2019 at 12:53, Reuben Rissler  wrote:

> On 04/02/2019 05:09 AM, Mike Martin via gtk-app-devel-list wrote:
> > I am using an embedded Gtk grid within a grid , which contains numerous
> > widgets
> > However if I have a widget that spans more than one column it messes up
> the
> > layout of all other widgets , which seem to position themseleves randomly
> > along the width of this widget, causing horribly jagged widget placement
> >
> > Has anyone had this and come up with a solution
> Could you post an example? Post the example inline, because attachments
> are scrubbed.
> >
> > Row 1 Liststore spanning multiple columns
> > Row 2 liststore spanning 1 column and 2 rows , textview , then two
> buttons
> > the textview should line up on the right with the liststore in row 1
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Setting attributes per cell in treeview (list store)

2019-04-03 Thread Mike Martin via gtk-app-devel-list
Hi I have a simple tree view based on a list store

What is the best way to set attributes per row/column is for a specific
cell not for a row or column?

Basically it is used to set various options and some cells are not used, so
I want them to be non-activatable /selectable to prevent any confusion

It a 12 by two table so performance not an issue

Is setting a cell_data_func based on row the best way to go? Or is there a
better way to achieve what I want?

Thanks

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Problem with grids and items spanning more than one column

2019-04-02 Thread Mike Martin
I am using an embedded Gtk grid within a grid , which contains numerous
widgets
However if I have a widget that spans more than one column it messes up the
layout of all other widgets , which seem to position themseleves randomly
along the width of this widget, causing horribly jagged widget placement

Has anyone had this and come up with a solution

example png attached
The multicolumn widget is is the file liststore
Then I have the second liststore on the next row with other widgets on the
same row

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Problem with grids and items spanning more than one column

2019-04-02 Thread Mike Martin via gtk-app-devel-list
I am using an embedded Gtk grid within a grid , which contains numerous
widgets
However if I have a widget that spans more than one column it messes up the
layout of all other widgets , which seem to position themseleves randomly
along the width of this widget, causing horribly jagged widget placement

Has anyone had this and come up with a solution

Row 1 Liststore spanning multiple columns
Row 2 liststore spanning 1 column and 2 rows , textview , then two buttons
the textview should line up on the right with the liststore in row 1
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Treeview (liststore) CSS question

2019-03-22 Thread Mike Martin
Resolved my issue, turns out I needed some voodoo with properties

$widgetpage{file_scroll}->set('propagate_natural_height','1');
 $widgetpage{file_scroll}->set_vexpand(0);

On Mon, 18 Mar 2019 at 16:01, Mike Martin  wrote:

> Is it possible to set different background for a treestore, with a
> liststore, for populated rows v blank area.
>
> ie: If I have a dynamic treeview I would like to have one background
> colour for the rows and another for the treestore where there are no rows
>
> The particular example has the following tree
> Grid,Notebook,grid,scrolledwindow,treeview
>
> thanks
> Mike
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Treeview (liststore) CSS question

2019-03-21 Thread Mike Martin via gtk-app-devel-list
apologies I did resolve my issue , posted as wrong person

Resolved my issue, turns out I needed some voodoo with properties

$widgetpage{file_scroll}->set('propagate_natural_height','1');
 $widgetpage{file_scroll}->set_vexpand(0);

On Tue, 19 Mar 2019 at 18:53,  wrote:

>
> Hi Mike,
>
> Have you tried
>
> gtk_widget_set_vexpand(tree, FALSE);
>
> on the treeview? This might work to show a different background color on
> the unused space of the treeview.
>
> I don't know if this is of any help but also remember that you can set
> individual row colors in a treeview by having a color column. That way you
> can add some logic into what color the row is. Also, a selection color is
> easy to set with CSS.
>
> Eric
>
>
> //gcc -Wall stripe_list1.c -o stripe_list1 `pkg-config --cflags --libs
> gtk+-3.0`
>
> #include
>
> enum
> {
>ID,
>PROGRAM,
>COLOR,
>COLUMNS
> };
>
> int main(int argc, char *argv[])
>   {
> gtk_init(, );
>
> GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_window_set_title(GTK_WINDOW(window), "Stripes");
> gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
> gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
> gtk_widget_set_name(window, "main_window");
> g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
>
> GtkTreeIter iter;
> GtkListStore *store=gtk_list_store_new(COLUMNS, G_TYPE_UINT,
> G_TYPE_STRING, G_TYPE_STRING);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , ID, 0, PROGRAM, "Gedit", COLOR,
> "cyan",  -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , ID, 1, PROGRAM, "Gimp", COLOR,
> "yellow", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , ID, 2, PROGRAM, "Inkscape", COLOR,
> "cyan", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , ID, 3, PROGRAM, "Firefox", COLOR,
> "yellow", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , ID, 4, PROGRAM, "Calculator", COLOR,
> "cyan", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , ID, 5, PROGRAM, "Devhelp", COLOR,
> "yellow", -1);
>
> GtkWidget *tree=gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
> gtk_widget_set_name(tree, "tree_select");
> gtk_widget_set_hexpand(tree, TRUE);
> gtk_widget_set_vexpand(tree, FALSE);
>
> GtkCellRenderer *renderer1=gtk_cell_renderer_text_new();
> g_object_set(renderer1, "editable", FALSE, NULL);
>
> //Bind the COLOR column to the "cell-background" property.
> GtkTreeViewColumn *column1 =
> gtk_tree_view_column_new_with_attributes("ID", renderer1, "text", ID,
> "cell-background", COLOR, NULL);
> gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column1);
> GtkTreeViewColumn *column2 =
> gtk_tree_view_column_new_with_attributes("Program", renderer1, "text",
> PROGRAM, "cell-background", COLOR, NULL);
> gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column2);
>
> GtkWidget *grid=gtk_grid_new();
> gtk_grid_attach(GTK_GRID(grid), tree, 0, 0, 1, 1);
> gtk_container_add(GTK_CONTAINER(window), grid);
>
> GError *css_error=NULL;
> gchar css_string[]="#main_window{background: purple;}
> #tree_select:selected{background: green;}";
> GtkCssProvider *provider = gtk_css_provider_new();
> GdkDisplay *display = gdk_display_get_default();
> GdkScreen *screen = gdk_display_get_default_screen(display);
> gtk_style_context_add_provider_for_screen(screen,
> GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
> gtk_css_provider_load_from_data(provider, css_string, -1, _error);
> if(css_error!=NULL) g_print("CSS loader error %s\n",
> css_error->message);
> g_object_unref(provider);
>
> gtk_widget_show_all(window);
> gtk_main();
> return 0;
>   }
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Treeview (liststore) CSS question

2019-03-19 Thread Mike Martin via gtk-app-devel-list
Its not whether the row is empty, its whether it exists

On Mon, 18 Mar 2019 at 23:25, Daniel Kasak  wrote:

> On Tue, Mar 19, 2019 at 3:01 AM Mike Martin via gtk-app-devel-list <
> gtk-app-devel-list@gnome.org> wrote:
>
>> Is it possible to set different background for a treestore, with a
>> liststore, for populated rows v blank area.
>>
>> ie: If I have a dynamic treeview I would like to have one background
>> colour
>> for the rows and another for the treestore where there are no rows
>>
>> The particular example has the following tree
>> Grid,Notebook,grid,scrolledwindow,treeview
>>
>
> Use set_cell_data_func:
>
> https://developer.gnome.org/gtk3/stable/GtkTreeViewColumn.html#gtk-tree-view-column-set-cell-data-func
>
> You'd have to do this for every GtkTreeViewColumn you wanted to colour.
> Your callback would then fetch whatever value you want to use as a test (
> ie to test whether the row is 'empty' or not ), and set the renderer's
> "background' property to whatever colour you're after ( the callback get's
> passed the renderer ).
>
> Dan
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Treeview (liststore) CSS question

2019-03-19 Thread Mike Martin
Is it possible to set different background for a treestore, with a
liststore, for populated rows v blank area.

ie: If I have a dynamic treeview I would like to have one background colour
for the rows and another for the treestore where there are no rows

The particular example has the following tree
Grid,Notebook,grid,scrolledwindow,treeview

thanks

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Treeview (liststore) CSS question

2019-03-19 Thread Mike Martin
Its not whether the row is empty, its whether it exists

On Mon, 18 Mar 2019 at 23:25, Daniel Kasak  wrote:

> On Tue, Mar 19, 2019 at 3:01 AM Mike Martin via gtk-app-devel-list <
> gtk-app-devel-list@gnome.org> wrote:
>
>> Is it possible to set different background for a treestore, with a
>> liststore, for populated rows v blank area.
>>
>> ie: If I have a dynamic treeview I would like to have one background
>> colour
>> for the rows and another for the treestore where there are no rows
>>
>> The particular example has the following tree
>> Grid,Notebook,grid,scrolledwindow,treeview
>>
>
> Use set_cell_data_func:
>
> https://developer.gnome.org/gtk3/stable/GtkTreeViewColumn.html#gtk-tree-view-column-set-cell-data-func
>
> You'd have to do this for every GtkTreeViewColumn you wanted to colour.
> Your callback would then fetch whatever value you want to use as a test (
> ie to test whether the row is 'empty' or not ), and set the renderer's
> "background' property to whatever colour you're after ( the callback get's
> passed the renderer ).
>
> Dan
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Treeview (liststore) CSS question

2019-03-18 Thread Mike Martin via gtk-app-devel-list
Is it possible to set different background for a treestore, with a
liststore, for populated rows v blank area.

ie: If I have a dynamic treeview I would like to have one background colour
for the rows and another for the treestore where there are no rows

The particular example has the following tree
Grid,Notebook,grid,scrolledwindow,treeview

thanks
Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: liststore issue 1 - iter points to wrong row after sort of column with cellrenderercombo

2019-03-02 Thread Mike Martin via gtk-app-devel-list
On Thu, 28 Feb 2019 at 18:05, Nicolas Soubeiran 
wrote:

> As you noticed "editing-started" is used at the beginning of editing a
> cell as the documentation states and is defined on the base class
> GtkCellRenderer:
>
> This signal gets emitted when a cell starts to be edited. The intended use
> of this signal is to do special setup on *editable* , e.g. adding a
> GtkEntryCompletion
> <https://developer.gnome.org/gtk3/stable/GtkEntryCompletion.html> or
> setting up additional columns in a GtkComboBox
> <https://developer.gnome.org/gtk3/stable/GtkComboBox.html>.
> https://developer.gnome.org/gtk3/stable/GtkCellRenderer.html#GtkCellRenderer-editing-started
>
> While "edited" is only available on  GtkCellRendererText and is mainly to
> be used for "simple" edition of text (called when user validates
> https://developer.gnome.org/gtk3/stable/GtkCellRendererText.html#GtkCellRendererText-edited
> In case you have a GtkCellRendererText the signals will be called like
> this:
> - editing-started
> if user validates
>- edited with new_text the string the user entered
> else (user cancel edition)
>- editing-canceled
> In all cases you only have the path of the edited row, since the
> cellrenderer does not "know" the model it is displaying : you have to pass
> it through the signal user_data (then you can build the iter and do your
> edition code)
>
>
> Le jeu. 28 févr. 2019 à 18:43, Mike Martin  a écrit :
>
>> Thanks
>> Though what I don't quite get is the difference in behaviour between
>> editing-started and edited (both using path to get the ITER)
>> On my particular scenario I use editing-started to setup some stuff so I
>> can use the iter created
>>
>> On Thu, 28 Feb 2019, 12:30 Nicolas Soubeiran via gtk-app-devel-list, <
>> gtk-app-devel-list@gnome.org> wrote:
>>
>>> Hello,
>>> after you sort the model, you shall consider that all iter and path
>>> previously stored are wrong :
>>> A path is a representation of the position of the row in the current case
>>> (which you can read by using gtk_tree_path_to_string).
>>>
>>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-to-string
>>>
>>>  Iter are quite the same (but link to a particular GtkTreeModel), such as
>>> list::iterator of C++ STL : they are pointer to row that you can use to
>>> access to data or walk through the models.  You can make an iter from a
>>> path and a model :
>>>
>>> GtkTreePath *path;GtkTreeIter iter;
>>>
>>> GtkTreeModel* model;
>>>
>>> GtkListStore store = gtk_list_store_new(3, G_TYPE_INT,
>>> G_TYPE_STRING,G_TYPE_STRING)
>>>
>>> model = GTK_TREE_MODEL(store);
>>>
>>> path = gtk_tree_path_new_from_string
>>> <
>>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-new-from-string
>>> >
>>> ("3"); // third rowgtk_tree_model_get_iter
>>> <
>>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-model-get-iter
>>> >
>>> (model, , path); // may be invalid (check return value)
>>>
>>>  If you really want to keep track of a particular row, you have to use
>>> GtkTreeRowReference
>>>
>>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#GtkTreeRowReference
>>> But GTK will have to keep the reference up to date, so each time your
>>> model change (inserting, deleting, sorting...)
>>> GTK will triggered signal to update your GtkTreeRowReference which may
>>> cause an overhead in your application
>>>
>>> Hope this helps you to understand better the GtkTreeModel paradigm
>>> ___
>>> gtk-app-devel-list mailing list
>>> gtk-app-devel-list@gnome.org
>>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>>
>>

What I suspect is happening is that once a column is sorted, the column is
resorted as soon as a change is made so path never points to the current
row. Though doesn't happen with a plain text renderer.

I have tested this with my code, and this is exactly what is happening

Before the edited function is called, the liststore is sorted again, so the
path string points to the row that is now at the previous position (ie:the
next row)

If the change made does not mean the row is sorted to a different position
then the same row is referenced, example
(where the first is value in column 0 and second is a fixed row indicator)
in both cases this the first row

Sort reorders the rows
/data/staging -> /data/staging2
/data/1staging   2

Sort does not reorder row
/data/staging -> /data/1staging
/data/1staging   1


Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: liststore issue 1 - iter points to wrong row after sort of column with cellrenderercombo

2019-02-28 Thread Mike Martin via gtk-app-devel-list
Thanks
Though what I don't quite get is the difference in behaviour between
editing-started and edited (both using path to get the ITER)
On my particular scenario I use editing-started to setup some stuff so I
can use the iter created

On Thu, 28 Feb 2019, 12:30 Nicolas Soubeiran via gtk-app-devel-list, <
gtk-app-devel-list@gnome.org> wrote:

> Hello,
> after you sort the model, you shall consider that all iter and path
> previously stored are wrong :
> A path is a representation of the position of the row in the current case
> (which you can read by using gtk_tree_path_to_string).
>
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-to-string
>
>  Iter are quite the same (but link to a particular GtkTreeModel), such as
> list::iterator of C++ STL : they are pointer to row that you can use to
> access to data or walk through the models.  You can make an iter from a
> path and a model :
>
> GtkTreePath *path;GtkTreeIter iter;
>
> GtkTreeModel* model;
>
> GtkListStore store = gtk_list_store_new(3, G_TYPE_INT,
> G_TYPE_STRING,G_TYPE_STRING)
>
> model = GTK_TREE_MODEL(store);
>
> path = gtk_tree_path_new_from_string
> <
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-new-from-string
> >
> ("3"); // third rowgtk_tree_model_get_iter
> <
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-model-get-iter
> >
> (model, , path); // may be invalid (check return value)
>
>  If you really want to keep track of a particular row, you have to use
> GtkTreeRowReference
>
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#GtkTreeRowReference
> But GTK will have to keep the reference up to date, so each time your
> model change (inserting, deleting, sorting...)
> GTK will triggered signal to update your GtkTreeRowReference which may
> cause an overhead in your application
>
> Hope this helps you to understand better the GtkTreeModel paradigm
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


liststore issue 2 - which 'path' comes from signal

2019-02-27 Thread Mike Martin via gtk-app-devel-list
according to the docs the path reference is

edited signal = path
editing-started = path
changed = path_string

which I thought meant that path would be a treepath (ie: an object) and
path_string would be a reference to the row (an integer in the case of a
simple liststore)

However in all three cases the value is the same ie: an integer, not an
object

Can anyone clarify this

thanks

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


liststore issue 1 - iter points to wrong row after sort of column with cellrenderercombo

2019-02-27 Thread Mike Martin via gtk-app-devel-list
I have come across an issue where the iter points to the wrong row on
edited signal after sorting the column (via clicking header).

This only happens with edited signal and not editing-started (which is
correct)

The edited iter is obtained via
treeview->get_model->get_iter_from_string($path_str), which is obtained
from the path variable given by signal

This is pre sort (and correct)
Gtk3::CellRendererCombo=HASH(0x55938bc4f418)0
/mnt/progs/programs/DS9a-- array from edited signal
Gtk3::TreeIter=SCALAR(0x55938b3dc050) -- iter from editing-started signal
Gtk3::TreeIter=SCALAR(0x55938bc46d50)-- iter from edited signal
/mnt/progs/programs/DS9ads9_101_envs.mp41 --result using   iter
from editing-started signal
/mnt/progs/programs/DS9ads9_101_envs.mp41 --result using iter from
edited signal

This is post sort (and wrong)

Gtk3::CellRendererCombo=HASH(0x55938bc4f418)0
/mnt/progs/programs/DS9b-- array from edited signal
2836 Gtk3::TreeIter=SCALAR(0x55938b44c938) -- iter from editing-started
signal
2836a Gtk3::TreeIter=SCALAR(0x55938bc46d68) -- iter from edited signal
/mnt/progs/programs/DS9bds9_102_envs.mp42--result using   iter
from editing-started signal and is correct
/mnt/progs/programs/DS9ds9_103_envs.mp43 --result using iter from
edited signal and is wrong row

Any ideas why this is happening?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Force liststore to update when leaving treeview

2019-02-12 Thread Mike Martin via gtk-app-devel-list
Is this possible?

I have a (for example) a grid which contains
Various action widgets
And a Treeview based on a liststore

Is there any way to make sure that the changes made to a cell in the
liststore are "committed" if I click on one of the other widgets

I cant find anything to do this and if I leave the cell without pressing
enter or clicking on another cell, all changes are lost

thanks

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Liststore and editing cancelled event

2018-11-26 Thread Mike Martin via gtk-app-devel-list
Is there any way to disable the editing-cancelled event on cellrenderertext.

Background

When I have a liststore contained within a treestore I want the value to be
be saved if I click on a button not contained within the treeview, so that
it does not just dissapear
Focus events dont seem to work as the treeview still has focus

thanks

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Multi page widgets in Gtk

2017-09-03 Thread Mike Martin
Hi
For one of my apps I want to setup a multi page widget with next  previous
navigation.

Is this possible? I cant seem to find an appropriate widget?

What I want to do is set up a preview widget based on a db query, so that
based on the query each entry would be shown ie:
$sql = select fname,lname from table
Then a text view with the appropriate data for each record, with
next/previous buttons for navigation

thanks

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Preferred width/height warning

2017-07-29 Thread Mike Martin
I am trying to eliminate this warning ie:

(membership_gui.pl:4729): Gtk-WARNING **: Allocating size to GtkWindow
0x44d4260 without calling gtk_widget_get_preferred_width/height(). How does
the code know the size to allocate?

(membership_gui.pl:4729): Gtk-WARNING **: Allocating size to GtkWindow
0x44d4260 without calling gtk_widget_get_preferred_width/height(). How does
the code know the size to allocate?

(membership_gui.pl:4729): Gtk-WARNING **: Allocating size to GtkWindow
0x44d4260 without calling gtk_widget_get_preferred_width/height(). How does
the code know the size to allocate?

This happens in the following scenario

Notebook containing gtkgrid, which contains gtkScrolledWindow containg
GtkScrolledWindow

If I run a different sub-routine, which doesn't have a treeview/scrolled
window first the message does not appear
Gtk version 3.22

Any ideas
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Preferred height/width error message

2017-07-24 Thread Mike Martin
Anyone?

On 23 July 2017 at 18:30, Stefan Salewski <m...@ssalewski.de> wrote:

> On Sun, 2017-07-23 at 17:46 +0100, Mike Martin wrote:
> > Gtk version 3.22
>
> I see a similar message for evince pdf viewer whenever I use it since
> some months. But I have no idea for the reason unfortunately
>
> (evince:5623): Gtk-WARNING **: Allocating size to EvSidebar 0x12dd6c0
> without calling gtk_widget_get_preferred_width/height(). How does the
> code know the size to allocate?
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Preferred height/width error message

2017-07-23 Thread Mike Martin
I am trying to eliminate this warning ie:

(membership_gui.pl:4729): Gtk-WARNING **: Allocating size to GtkWindow
0x44d4260 without calling gtk_widget_get_preferred_width/height(). How does
the code know the size to allocate?

(membership_gui.pl:4729): Gtk-WARNING **: Allocating size to GtkWindow
0x44d4260 without calling gtk_widget_get_preferred_width/height(). How does
the code know the size to allocate?

(membership_gui.pl:4729): Gtk-WARNING **: Allocating size to GtkWindow
0x44d4260 without calling gtk_widget_get_preferred_width/height(). How does
the code know the size to allocate?

This happens in the following scenario

Notebook containing gtkgrid, which contains gtkScrolledWindow containg
GtkScrolledWindow

If I run a different sub-routine, which doesn't have a treeview/scrolled
window first the message does not appear
Gtk version 3.22

Any ideas
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Combobox disable item

2017-06-23 Thread Mike Martin
I am trying to make entries "greyed-out" ie: disabled, rather than hidden


eg the Combobox model contains ('Scandvb','DVB module','DVDb5-Scan')
There is another comboox with a configuration file chosen

I want to be able to make one or more of the entries unselectable if
prerequites are not available or the wrong type of config file is selected,
but still show the option as a prompt

thanks

On 22 June 2017 at 21:09,  wrote:

>
>
> Hi Mike,
>
> What part of the combo box are you trying to disable? If you want to
> filter rows or columns you can set up a tree model filter to do so. Maybe
> something like the following?
>
> Eric
>
>
> /*
> gcc -Wall combo_filter1.c -o combo_filter1 `pkg-config --cflags --libs
> gtk+-3.0`
> Tested on GTK3.18 and Ubuntu16.04
> */
> #include
> #include
>
> static gint combo_row=0;
>
> static void change_combo(GtkComboBox *combo2, gpointer *data)
>   {
> combo_row=gtk_combo_box_get_active(combo2);
> gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(data[1]));
> gtk_combo_box_set_active(GTK_COMBO_BOX(data[0]), 0);
>   }
> static gboolean show_rgb(GtkTreeModel *model, GtkTreeIter *iter, gpointer
> data)
>   {
> gchar *string=gtk_tree_model_get_string_from_iter(model, iter);
> gint row=atoi(string);
> g_free(string);
>
> if(combo_row==1&<3)
>   {
> g_print("Combo1 Don't Show %i\n", row);
> return FALSE;
>   }
> else
>   {
> g_print("Combo1 Show %i\n", row);
> return TRUE;
>   }
>   }
> int main(int argc, char *argv[])
>   {
> gtk_init(, );
>
> GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_window_set_title(GTK_WINDOW(window), "Combo Filter");
> gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
> gtk_window_set_default_size(GTK_WINDOW(window), 300, 100);
> g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
>
> GtkTreeIter iter;
> GtkListStore *store=gtk_list_store_new(1, G_TYPE_STRING);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , 0, "Yellow", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , 0, "Purple", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , 0, "Cyan", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , 0, "Red", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , 0, "Green", -1);
> gtk_list_store_append(store, );
> gtk_list_store_set(store, , 0, "Blue", -1);
>
> GtkTreeModel *model=gtk_tree_model_filter_new(GTK_TREE_MODEL(store),
> NULL);
> gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model), (
> GtkTreeModelFilterVisibleFunc)show_rgb, NULL, NULL);
>
> GtkCellRenderer *renderer=gtk_cell_renderer_text_new();
>
> GtkWidget *combo1=gtk_combo_box_new_with_model(model);
> gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo1), renderer, TRUE);
> gtk_widget_set_hexpand(combo1, TRUE);
> gtk_widget_set_vexpand(combo1, TRUE);
> gtk_combo_box_set_active(GTK_COMBO_BOX(combo1), 0);
> gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo1),
> GTK_CELL_RENDERER(renderer), "text", 0, NULL);
>
> GtkWidget *combo2=gtk_combo_box_text_new();
> gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo2), 0, "1", "Show
> All");
> gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo2), 1, "2", "Show
> RGB");
> gtk_combo_box_set_active(GTK_COMBO_BOX(combo2), 0);
> gtk_widget_set_hexpand(combo2, TRUE);
> gtk_widget_set_vexpand(combo2, TRUE);
> gpointer data[]={combo1, model};
> g_signal_connect(combo2, "changed", G_CALLBACK(change_combo), data);
>
> g_object_unref(G_OBJECT(store));
>
> GtkWidget *grid=gtk_grid_new();
> gtk_grid_attach(GTK_GRID(grid), combo1, 0, 0, 1, 1);
> gtk_grid_attach(GTK_GRID(grid), combo2, 0, 1, 1, 1);
> gtk_container_add(GTK_CONTAINER(window), grid);
>
> gtk_widget_show_all(window);
> gtk_main();
> return 0;
>   }
>
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Combobox disable item

2017-06-22 Thread Mike Martin
Hi

Is it possible to disable an item in a combobox?

I cant find anything about this, set_sensitive only seems to apply to
either cell-renderer or widget

thanks

Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Seperating Multiple processes

2017-03-10 Thread Mike Martin
Hi
I have a weird issue on an application I am developing

The application is fully tabbed and runs loops to transcode video files,
and I would like to be able to run the main transcoding loop fully in
parrellel, ie: the process running in one tab is totally seperate to that
running in another tab

I have tried this on the key sub (simplified)


sub encode_loop {
my ($optsi,$prog,$ext,$action_grid,$dvb,$type_g,$files,$video_type)=@_;
my $mainloop = Glib::MainLoop->new;
my $subname='encode';
Gtk3::main_iteration_do(0);

my
$progrun=_cmd($files->{$file_id},$opts,$prog,$ext,$subname,$action_grid,,0)
;#if $dvb!~/ogg/ ;
$mainloop->quit
return 1
}

However this is what happens.

I start one loop running, then open another tab and set another loop
running.

For the first file every works fine.

Then however

When the first file finishes encoding, the loop stops until the second loop
is finished.

AND

The second loop transcodes multiple files at the same time instead of
sequentially. The number is equal to the number of loops running, ie: if
two tabs are running the encode process, then two files are encoded
simultaneously, tree tabs than three files

Any ideas would be appreciated

thanks
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list