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(&argc, &argv);
>
> 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, &iter);
> gtk_list_store_set(store, &iter, ID, 0, PROGRAM, "Gedit", COLOR,
> "cyan",  -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, ID, 1, PROGRAM, "Gimp", COLOR,
> "yellow", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, ID, 2, PROGRAM, "Inkscape", COLOR,
> "cyan", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, ID, 3, PROGRAM, "Firefox", COLOR,
> "yellow", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, ID, 4, PROGRAM, "Calculator", COLOR,
> "cyan", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 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, &css_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, &iter, 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, &iter, 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  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&&row<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(&argc, &argv);
>
> 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, &iter);
> gtk_list_store_set(store, &iter, 0, "Yellow", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Purple", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Cyan", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Red", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Green", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 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=&run_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


How should I structure a full screen, modal kiosk app (newbie)

2015-05-09 Thread Mike South
I'm using Perl GTK on a debian-based distro.  My app is the only
user-visible thing running.

The app is logically organized into "screens".  A "run" screen (which is
showing most of the time), a "menu" screen (with buttons to change things),
a "help" screen (shows text describing app function).

I am an experienced perl programmer, but a complete GTK newbie.  When I
"switch screens", I hide/remove the widgets I had previously added, and
build the screen I need to show (by adding the appropriate widgets for that
screen to the window).

It's a pretty simple app, almost all of what it does is display text, so
the drawing time is not really an issue.

However, I'm pretty sure this is not how to do this.

Details of my (probably bad) current implementation:

I have a single window:

my $window = Gtk2::Window->new('toplevel');

I set that window to full screen:

$window->fullscreen;

Then, when I "switch screens" in the application, I remove/hide widgets
currently showing, and create and add the widgets for the current view (I'm
sorry if you just threw up in your mouth a little when reading that.)

There is no mouse or keyboard--I have to switch screens manually in
response to other things in the environment (voltage on gpio pins).

What should I be doing?  Should each "screen" of the app be its own
$window, with the widgets generated once, then ->show and ->hide on the
$windows to switch between screens?  Will multiple toplevel, fullscreen
windows coexist ok?  But, more importantly, is that "the way" to do it, as
in, the way an experienced GTK developer would do it?  Or is there
something like panes/views/whatever that are children of windows, and I
should be switching between them?

Thanks, and sorry for the complete newbieness of the question.

Pointers to documentation I may have missed in my searching are also
welcome.

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


Preferred method for updating the model behind a combobox?

2014-08-26 Thread Mike Fleetwood
To: gtk-app-devel-list@gnome.org
Subject: Preferred method for updating the model behind a combobox?

Hi,

Is there is a preferred method for updating the model behind a combobox
while it is displayed to avoid flicker?

Original code did:
1) Clear liststore model, changing the active item!
   > Combobox redrawn with empty contents
2) Repopulate liststore model
3) Reset active item
   > Combobox redrawn with active item selected

Found these 2 method which avoid flicker redraw:
1) Temporarly block the change signal while reconstructing the model;
2) Create a new model and assign it to the combobox replacing the
   original.
Is one method preferred over the other?  Is there another method I
should be using instead?

Thanks,
Mike

P.S.
If I appear vague it is because the code in in C++ using gtkmm, but I
don't think it matters, hence asking in this list.  Here's the current
broken code from GParted 0.19.1 Win_GParted::refresh_combo_devices()
https://git.gnome.org/browse/gparted/tree/src/Win_GParted.cc?id=GPARTED_0_19_1#n578
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: MSAA or UIA

2012-05-14 Thread Mike
Unfortunately I couldnt view the whole thread.  Your web page ends in 
the middle of the conversation, strangely.  The web site doesnt have 
links to view the whole thread; it's a horrible mailing list reader.


It helped though.  Thanks.  :)  I'll try asking M$.

On 5/14/2012 1:14 PM, Michael Cronenworth wrote:

Mike wrote:

Searches on the internet give me nothing.  Who knows when/if gtk+
applications will be accessible using MSAA or UIA?  What are the reasons
we're not there yet?


Googling for "uia gtk" brought me this up in 30 seconds:

http://comments.gmane.org/gmane.comp.gnome.gtk+.devel.general/22293

Ask Microsoft to fix their licenses.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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


MSAA or UIA

2012-05-14 Thread Mike
Searches on the internet give me nothing.  Who knows when/if gtk+ 
applications will be accessible using MSAA or UIA?  What are the reasons 
we're not there yet?

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


Re: "Program Files" folder

2011-04-21 Thread Mike Ma

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

John Emmas says:
> I know that glib offers a function called g_get_home_dir() which
returns the user's home folder on the relevant platform. Is there any
similar function that will give me the default folder for installing
applications? For example, on Windows this would return "C:\Program
Files". On Linux it might be "/bin" or "/usr/bin" or "/usr/local/bin"
etc. And on OS-X it would be "/Applications".

... if you like those:

const gchar *
get_unix_bin_dir ()
{static gchar dir[] = "/bin"; /* or /usr/bin, /usr/local/bin, /opt */
return dir;}

const gchar *
get_win_bin_dir ()
{static gchar dir[] = "/Program Files"; /* explorer.exe can read it,
but I am not sure it can work here */
return dir;}

const gchar *
get_macosx_bin_dir ()
{
static gchar dir[] = "/Applications";
return dir;
}

... I remember that there is a Windows API that can get it. You can
visit MSDN for that.

- -- 
Mike.
Blog: http://ekd123.org/
Fedora Project Contributor - Translator.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNsC/aAAoJEKaIeAmEWZo8MA4H/RkIXxll+iviQVuPc/p0fa7u
hM5YHFJJRdXOtZUCStwJJxljT9MZaO28tWPfYxT5YF1Ypfn5Pe+ugQhdD5JnLph4
6m+UxMdU5Q7wQk5wxksjpZ2Op4HM+dnEfD0OuhLmwO+F6P0UKcXnNsqI1k/6/jkY
HgrkgyT4tsM1Oa3+oC43juIIc9k1yNo4yhi4x21/wP/EX8WM2abFPUsLsbteFnQF
ksaw9jOwGasbkcDIIT5qIje4fD2/CspSDb8ZalbN0RslrOasA/fAt9S+TEW9qWrs
pCfJEFcGUj23UroOPJTtWb6Q0/xYzxmc5LDCyFmuIO83q8sMBuZ9bQlAicm4jDU=
=eXZa
-END PGP SIGNATURE-

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


Re: GTK3 porting problem (clipboard)

2011-03-10 Thread Mike Ma

于 2011年03月10日 20:44, Miroslav Rajcic 写道:
I resolved the majority of the the issues when porting my program from 
GTK 2.x to GTK 3.x.

Unfortunately I still have one issue left:

when compiling the program on Feodra 15 alpha (gcc 4.6, GTK3 v3.0.2) I 
get these errors:


./src/clipboard.cpp:442:38: error: invalid use of incomplete type 
'GtkTargetList'
/usr/include/gtk-3.0/gtk/gtkselection.h:48:16: error: forward 
declaration of 'GtkTargetList'
./src/clipboard.cpp:445:20: error: invalid use of incomplete type 
'GtkTargetList'
/usr/include/gtk-3.0/gtk/gtkselection.h:48:16: error: forward 
declaration of 'GtkTargetList'
./src/clipboard.cpp:447:3: error: 'GtkTargetPair' was not declared in 
this scope

./src/clipboard.cpp:447:18: error: 'pair' was not declared in this scope

The relevant code is this:

#include 

GtkTargetList *list = gtk_target_list_new (NULL, 0);
.. add text and other targets in the list

// LINE 442: error: invalid use of incomplete type 'GtkTargetList'
int nTargetCnt = g_list_length (list->list);

//LINE 445: error: invalid use of incomplete type 'GtkTargetList'
for (GList *l=list->list; l; l=l->next, i++)

//LINE 447: error: 'GtkTargetPair' was not declared in this scope
GtkTargetPair *pair = (GtkTargetPair *)l->data;

This all works fine with GTK2.x.

What is the correct way to work with this on GTK 3.x ?

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

gtk3-devel package in Fedora 14 is too old (2.90.5).
Maybe you want to get latest version (I'm not sure).

--
Mike.
Blog: http://ekd123.org/
Fedora Project Contributor - Translator.

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

Re: Can g_error() write logs to files?

2011-03-05 Thread Mike Ma

于 2011年03月05日 17:33, David Nečas 写道:

On Sat, Mar 05, 2011 at 02:13:20PM +0800, Mike Ma wrote:

I want g_error() to write messages to files, because released edition
shouldn't to print any messages on terminal. But if find any bugs,
should to find error messages to send support team.
I have read'd GLib sources, but not find any useful information.
How do I use g_error () to write error log files?

See g_log_set_handler(), g_log_set_default_handler().

Yeti


Thank you very much!

--
Mike.
Blog: http://ekd123.org/
Fedora Project Contributor - Translator.

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

Can g_error() write logs to files?

2011-03-04 Thread Mike Ma
Hi, all!
I want g_error() to write messages to files, because released edition
shouldn't to print any messages on terminal. But if find any bugs,
should to find error messages to send support team.
I have read'd GLib sources, but not find any useful information.
How do I use g_error () to write error log files?
Thank you for all.

-- 
Mike.
Blog: http://ekd123.org/
Fedora Project Contributor - Translator.

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


OOP in C (A SIMPLE BUT EASY LIBRARY. NOT USEFUL FOR Professional APP)

2011-02-15 Thread Mike
HI, ALL.
I HAVE A FRIEND. HE WIRTES A OOP LIBRARY FOR C, LOOKS NICE AND LIKE CPP
(USEFUL FOR SIMPLE APP. Lack of FUNCTIONAL FOR Professional APP).

URL (RAR FORMAT): http://code.google.com/p/ooc-gcc/downloads/list

IF YOU CAN READ CHINESE (OR USE TRANSLATOR SUCH AS GOOGLE TRANSLATOR),
YOU CAN VISIT THIS PAGE: http://pingf.is-programmer.com/posts/24088.html

SORRY FOR MY POOR ENGLISH.
IF YOU DON'T LIKE IT, PLEASE REPORT YOUR REASON TO GOOGLE CODE, MY
FRIEND WILL THANK YOU. :-)

BEST WISHES.
MIKE.

-- 
Mike.
Blog: http://www.ekd123.org/
Fedora Project Contributor.

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


How to use GNOME Keyring?

2011-01-31 Thread Mike
How to use GNOME Keyring?
I want some examples.

Thx a lot.

-- 
Mike.
Blog: http://ekd123.is-programmer.com/
Fedora Project Contributor.

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


Re: Couldn't link my app with GTK+ 3

2011-01-31 Thread Mike

于 2011年01月31日 16:56, David Nečas 写道:

On Mon, Jan 31, 2011 at 04:03:04PM +0800, Mike wrote:

OS: Fedora 14 x86_64
GCC: 4.5.1 20100924

I have a app project, use GTK+2.
I want to move it to GTK+3.
So I git clone latest glib.
Compiled them.
(I use GTK3 in mirror, not compile by myself)

Does pkg-config know about the new GLib?  I.e. did you set
PKG_CONFIG_PATH?  If it does not you cannot expect it to do anything
else than give you the flags for the system GLib.

Yeti



there are results..
--
$ pkg-config --cflags --libs glib-2.0
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -lglib-2.0
$ echo $PKG_CONFIG_PATH

$
--

Latest glib will be install to /usr/lib...


There is /usr/lib/pkgconfig/glib-2.0.pc (compile by myself)
--
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums

Name: GLib
Description: C Utility Library
Version: 2.27.94
Libs: -L${libdir} -lglib-2.0
Libs.private:
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
--

And there is /usr/lib64/pkgconfig/glib-2.0.pc
--
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include

glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums

Name: GLib
Description: C Utility Library
Version: 2.26.0
Libs: -L${libdir} -lglib-2.0
Libs.private:
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
--

Well... How to modify PKG_CONFIG_PATH?
I try to:
--
$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
$ ./configure
.
$ make -j2
..
CCLD gkiu
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so: 
undefined reference to `g_application_add_action'
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so: 
undefined reference to `g_application_set_action_enabled'
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so: 
undefined reference to `g_application_get_type'
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so: 
undefined reference to `g_application_quit_with_data'
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so: 
undefined reference to `g_application_run'

..
--

--
Mike.
Blog: http://ekd123.is-programmer.com/
Fedora Project Contributor.

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

Couldn't link my app with GTK+ 3

2011-01-31 Thread Mike
OS: Fedora 14 x86_64
GCC: 4.5.1 20100924

I have a app project, use GTK+2.
I want to move it to GTK+3.
So I git clone latest glib.
Compiled them.
(I use GTK3 in mirror, not compile by myself)
(Point to GTK+3 in Makefile)
GCC Prints:
* CCLD gkiu
*
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so:
undefined reference to `g_application_add_action'
*
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so:
undefined reference to `g_application_set_action_enabled'
*
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so:
undefined reference to `g_application_get_type'
*
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so:
undefined reference to `g_application_quit_with_data'
*
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libgtk-x11-3.0.so:
undefined reference to `g_application_run'
* collect2: ld returned 1 exit status
May be I must to compile latest GTK+ by myself?

(Sorry for my poor English.)

-- 
Mike.
Blog: http://ekd123.is-programmer.com/
Fedora Project Contributor.

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


Re: GtkButton, enter-notify signal, and GdkWindow

2010-11-23 Thread Mike Massonnet
Hi,

2010/11/24 Brian Tietz :
> I am creating two widget subclasses, one which is a subclass of GtkContainer 
> and one which is a subclass of GtkButton.  Both need to receive the 
> enter-notify signal.  I can successfully obtain the enter-notify signal fot 
> GtkButton in my_button_subclass_init:
>
>     g_gtk_button_mouse_enter_notify_event = widget_class->enter_notify_event;
>     widget_class->enter_notify_event = my_button_subclass_enter_notify_event;
>
> That function does get called, I do my thing, and then call the GtkButton 
> class version.  When I try to do the same thing for my GtkContainer subclass 
> though, it doesn't happen.  I more or less understand this: my GtkContainer 
> subclass is GTK_NO_WINDOW, and according to the Gtk docs I need to put it 
> inside of a GtkEventBox.  Fair enough.  But I am studying gtkbutton.c so see 
> how to do this right and to copy its methodology, and it isn't creating 
> GtkEventBox.  I found a clue in gtk_button_realize: it's calling 
> gdk_window_new, so it seems that GtkButton has its own GdkWindow, which would 
> explain why it received enter-notify events.  Fair enough.  Here's the weird 
> part though.  I found that GtkButton has the GTK_NO_WINDOW flag set!  Any 
> help in understanding these behaviors and observations would be appreciated.

You need to call gtk_widget_add_events() on your widget and add the
event GDK_ENTER_NOTIFY_MASK.

  http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-add-events
  http://library.gnome.org/devel/gdk/2.22/gdk-Events.html#GdkEventMask


HTH
Kind Regards
-- 
Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: g_value_type_transformable String to Enum fails

2010-09-28 Thread Mike Massonnet
I took the snippet a lil' further. If I use a custom implemented enum
type and use its get_type function instead of GEnum's it works fine.
But since I wished to use the transform function with a generic enum
type I had logically prefer to use GEnumType and not a custom one.

Nothing of this is important, it is out of curiosity.


Mike

2010/9/28 Mike Massonnet :
> Hi,
>
> By compiling the following code snippet, at execution it prints a
> critical message. Is this a bug or just normal?
>
> (process:1545): GLib-GObject-CRITICAL **: g_value_type_transformable:
> assertion `G_TYPE_IS_VALUE (dest_type)' failed
>
> // cc `pkg-config --cflags --libs gobject-2.0`
> #include 
>
> int main (int argc, char *argv[])
> {
>        g_type_init ();
>        g_value_type_transformable (G_TYPE_STRING, G_TYPE_ENUM);
>        return 0;
> }
>
>
> --
> Mike
>



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

g_value_type_transformable String to Enum fails

2010-09-28 Thread Mike Massonnet
Hi,

By compiling the following code snippet, at execution it prints a
critical message. Is this a bug or just normal?

(process:1545): GLib-GObject-CRITICAL **: g_value_type_transformable:
assertion `G_TYPE_IS_VALUE (dest_type)' failed

// cc `pkg-config --cflags --libs gobject-2.0`
#include 

int main (int argc, char *argv[])
{
       g_type_init ();
       g_value_type_transformable (G_TYPE_STRING, G_TYPE_ENUM);
       return 0;
}


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


Re: horizontal rule in GtkTextView?

2010-08-20 Thread Mike Massonnet
Hi Petr,

2010/8/12 Petr Tomasek :
>
> Hello!
>
> Is it possible to insert an horizontal rule into the GtkTextView?
> I tried to search the Google but found nothing.

I think the solution is to use a pixbuf, those can be inserted inside
GtkTextView (gtk_text_buffer_insert_pixbuf), have a look at gtk-demo.

> Thank You!
> Petr Tomasek

Regards


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


Re: putting icon on GtkImageMenuItem tutorial(ette)

2010-06-23 Thread Mike Massonnet
2010/6/23 Mick :
> can any one point me to a tutorial or clear example code that covers
> placing an icon on a GtkImageMenuItem with label. I've been trying all
> day and when I cast my way out of type mismatches I keep getting
> segfaults.

GtkWidget *image = gtk_image_new_...
GtkWidget *mi = gtk_image_menu_item_new...
gtk_image_menu_item_set_image (GTK_IMAGE_MENU (mi), image);

HTH

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


Multiple monitor embedded system

2010-03-31 Thread Mike Peterson

I am trying to use GTK for an embedded system.
(FYI, it is a gas pump...)

It always has 2 small 800x480 monitors, and sometimes has a larger 
1280x1024 monitor for development.

I have configured X correctly, and have a "screen" that is 2080x1024.

I need to create two main windows, one for each of the small displays.
Each small display needs to be completely filled with its window.

I am currently using GTK_WINDOW_POPUP, and it seems to work.
When I try to use GTK_WINDOW_TOPLEVEL, it appears that all attempts to 
move the windows to the correct place on the virtual screen are ignored.


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


Re: catching pressed in a dialog with entry and treeview

2009-10-13 Thread Mike Massonnet
Hi,

Right thing to do should be to connect the dialog to the signal
GtkWidget:"key-press-event", possibly filter on GDK_Escape, and return
true (see the api for more info on the return value, true will block
any further calls).

2009/10/12 Manu TM :
> Hi
>
> I'm having a problem with a gkt dialog. I have packed in this dialog a gtk
> entry and a gtk treeview, so the user can either enter an url or pick one
> from a list. Everything works fine, I've also added code to catch
> double-click on the list. But I can't achieve to catch  key pressed
> events to close/quit the dialog. I think that because of the other widgets
> packed in the dialog,  keybing has changed. I've then added the code:
>   g_signal_connect(G_OBJECT(dialog), "close", G_CALLBACK(esc_key_pressed),
> NULL);
> along with an appropriate signal handler, but this doesn't do anything.
> I have searched the web a lot but didn't find anything relevant so far. So,
> does anyone know of a way to do this or have a clue?
> Many thanks in advance.
>
> Manu Thomas-Maurin
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



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


Re: Unable to get Python/Gtk code to work...

2009-10-13 Thread Mike Massonnet
Hi,

>From a quick view there is no Gtk.init at the beginning (I don't know
python/gtk very well, but from a search it doesn't seem to be needed
there), and at the end it doesn't enter the main loop with gtk.main().

2009/10/12 Daniel B. Thurman :
> I am a first timer here and I am trying to get a
> basic TreeView application to work on Fedora-11
>
> I have gotten the following code from somewhere
> on the Internet and needed this type of application
> for a project I am working on.
>
> The code I had obtained had a couple of problems
> when dealing with file-types and was throwing an
> exception in the places where I have added my DBT
> comments, but even then, I was not able to get the
> code to display the application and there is no error
> thrown or reported as far as I can tell.
>
> Any pointers/help would be appreciated!
>
> Here is the following code:
> 
> #!/usr/bin/env python
>
> import os, stat, gtk
>
> # Instantiate the tree store and specify the data types
> store = gtk.TreeStore(str, gtk.gdk.Pixbuf, int, bool)
>
> def dirwalk(path, parent=None):
>  # Iterate over the contents of the specified path
>  for f in os.listdir(path):
>    # Get the absolute path of the item
>    fullname = os.path.join(path, f)
>    # Extract metadata from the item
>    # DBT: Added try/except because certain files will cause an exception!
>    try:
>       fdata = os.stat(fullname)
>    except:
>        continue
>
>    # Determine if the item is a folder
>    is_folder = stat.S_ISDIR(fdata.st_mode)
>    # Generate an icon from the default icon theme
>    img = gtk.icon_theme_get_default().load_icon(
>        "folder" if is_folder else "document",
>        gtk.ICON_SIZE_MENU, 0)
>    # Append the item to the TreeStore
>    # DBT: Added try/except because certain files will cause an exception!
>    try:
>        li = store.append(parent, [f, img, fdata.st_size, is_folder])
>    except:
>        continue
>    # If the item is a folder, descend into it
>    if is_folder:
>        dirwalk(fullname, li)
>
> #defautPath = os.path.expanduser('~')
> defaultPath = "/home/user/wherever"
> dirwalk(defaultPath)
>
> # Create a TreeViewColumn
> col = gtk.TreeViewColumn("File")
> # Create a column cell to display text
> col_cell_text = gtk.CellRendererText()
> # Create a column cell to display an image
> col_cell_img = gtk.CellRendererPixbuf()
> # Add the cells to the column
> col.pack_start(col_cell_img, False)
> col.pack_start(col_cell_text, True)
> # Bind the text cell to column 0 of the tree's model
> col.add_attribute(col_cell_text, "text", 0)
> # Bind the image cell to column 1 of the tree's model
> col.add_attribute(col_cell_img, "pixbuf", 1)
>
> col2 = gtk.TreeViewColumn("Size")
> col2_cell_text = gtk.CellRendererText()
> col2.pack_start(col2_cell_text)
> col2.add_attribute(col2_cell_text, "text", 2)
>
> # Create the TreeView and set our data store as the model
> tree = gtk.TreeView(store)
> # Append the columns to the TreeView
> tree.append_column(col)
> tree.append_column(col2)
>
> scroll = gtk.ScrolledWindow()
> scroll.add(tree)
>
> window = gtk.Window()
> window.connect("destroy", gtk.main_quit)
> window.add(scroll)
> window.show_all()
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



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


Fwd: Bug with g_file_load/replace_contents and utf-8

2009-06-30 Thread Mike Massonnet
Hello,

I have been porting a part of a program to GIO for file monitoring. By
this move I also switched g_file_get/set_contents to the ones
available in the GFile object, g_file_load/replace_contents.

At the first run I was surprised that it didn't work (of course errors
may always be introduced ;-)). Well looks like the code was ok. The
problem is that I read and save files with utf-8 characters and that
is kind of broken here. I reproduced the problem on two machines, one
with glib-2.20.1 and another with glib 2.20.3. I ran a smaller test
case, one in C as my program and another with Python. Turns out the
one in Python doesn't reproduce the problem and I really have no clue
what is going on. The test cases in C and Python are attached.

I hope I'm not the only one reproducing the problem :)

Mike
/* gcc `pkg-config --cflags --libs gio-2.0` test.c -o test */
#include 
int main (int argc, char *argv[]) {
g_type_init ();
char *text = "Text é";
GFile *file = g_file_new_for_path ("./test.txt");
g_file_replace_contents (file, text, -1, NULL, FALSE, 0, NULL, NULL, NULL);
//g_file_set_contents ("test.txt", text, -1, NULL); // Works fine
return 0;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: mouse enter/leave notifications for insenstive widgets

2009-04-09 Thread Mike Massonnet
Le Thu, 9 Apr 2009 14:28:11 +0530,
Praveen Innamuri  a écrit :

> I have a insensitive (disabled) widget (let's call it as widget-3)
> and is drawn over a GtkContainer (let's call it as widget-2).  Both
> widget-2 and widget-3 are children of a GtkContainer (let's call it
> as widget-1). So, the layout is something like -
> On top of widget-1, there is widget-2.
> widget-3 is placed over widget-2. I can say infact, widget-2 is partly
> covered by widget-3
> 
> all of these widgets are hooked to mouse enter/leave notifications.
> When the mouse is moved over widget-3, the *expected* behavior has to
> be either NO mouse enter/leave notifications should be signalled, or
> mouse enter/leave notifications should be triggered for widget-2 as
> it is drawn underneath of widget-3.
> However, GTK currently triggers mouse enter/leave notification of
> widget-1, which is parent of insensitive widget-3.
> My Problem is - when I get Mouse enter/leave notification of widget-1
> (due to mouse move over widget-3), is there any way to find out
> whether that mouse enter signal is due to the mouse movement over the
> insensitive widget-3 ? or is there any other way to prevent the mouse
> enter signal (of widget-1) when the mouse is moved over the
> insensitive widget-3 ?

I guess a simple
if (!GTK_WIDGET_IS_SENSITIVE (widget-3))
  return;
will do inside the callback of widget-1 for mouse enter/leave.

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


Re: How to realize a battery-indicator with a trayicon? How to show the current capacity

2008-11-16 Thread Mike Massonnet
Le Sun, 16 Nov 2008 10:56:40 -0700,
"Jim George" <[EMAIL PROTECTED]> a écrit :

> 2008/11/16 Rorschach <[EMAIL PROTECTED]>:
> > Hi,
> > I wanna write a little battery-indicator in C with GTK. It's
> > already working nicly in the console and I know how to write a
> > trayicon with gtk but what I don't know is: how can I show the
> > current capacity of the battery? I mean shall I do 100 pictures
> > (1-100%) and if the capacity changes just show the corresponding
> > new picture? This is imo a bad solution because I have to ship 100
> > pictures with my application.
> 
> Why not ship 10 images?

Have a look at the API for gdk_pixbuf_new_from_inline() if you want to
avoid shipping the images.

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

Re: Glade signal connect data and full

2008-11-10 Thread Mike Massonnet
Hi, and really quickly,

Le Mon, 10 Nov 2008 08:38:53 -0500,
dhk <[EMAIL PROTECTED]> a écrit :

> All,
> 
> Could some explain how to use glade_xml_signal_connect_data() and
> glade_xml_signal_connect_full()?  Some good examples would be helpful
> also.

http://www.google.com/codesearch?q=lang%3Ac+glade_xml_signal_connect_full

> Thanks,
> 
> dave

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

Re: Howto correctly generate "expandable void"?

2008-10-24 Thread Mike Massonnet
Hi,

Le Fri, 24 Oct 2008 21:01:04 +0200,
"Till Harbaum / Lists" <[EMAIL PROTECTED]> a écrit :

> Hi,
> 
> i have a vbox with a bunch of buttons. I want some of them to appear
> at the top and some of them at the bottom. The buttons should not be
> expanded and the space between them should also not expand except the
> space between the two groups. Something like this:

> How is this done correctly without having some invisible item i can
> place between both groups and which is set to expand/fill?

I don't look to answer you with a direct response, but yet, I want to
let you know about glade.  You can put your widgets easily in a window
and play with the positioning and so on.

One way would be to add items a,b,c inside one vbox that is put as
first element of the main vbox, and which is also set to expand/fill.
The latter rows, for items x,y,z, would be put at the bottom.

> Till

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

Re: how can i scale big pixbuf in realtime?

2008-10-07 Thread Mike Massonnet
Le Mon, 6 Oct 2008 16:13:25 +0800,
"chen zhixin" <[EMAIL PROTECTED]> a écrit :

> hello
> i have to scale the image i recived,NTSC,30f/s,yuyv->gray and 720*480
> because i need to do something on image,so i use gray->pixmap,and use
> cairo_t to do .
> then i must scale the 720*480,
> use gdk_pixbuf_scale make cpu to 100%.
> 
> is there a better way to do this?
> thanks

The better way would be gstreamer.  Now the question is can you receive
the image inside gstreamer?  Then you can build a pipeline with
gstreamer elements.

filesrc would be a start, then I don't know how to manipulate an
image.  There are other elements that may be interesting
like gdkpixbufscale, gdkpixbufsink, and gdkpixbufdec.

Look forward for gstreamer.

My 2 cents,
Mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: The menu popup direction

2008-09-24 Thread Mike Massonnet
Le Thu, 25 Sep 2008 09:00:21 +0800,
XiuHua Wu <[EMAIL PROTECTED]> a écrit :

> Yes, I know it can use this function to determine the position of the 
> menu. But if the menu is dynamic, I mean the length is not fixed and
> can be changed during the program running, so the menu position must
> be calculated every time. If the menu can be dropped from down to up,
> and it only needs to determine the menu start position just like
> dropped from up to down. So is there  any method to make the menu
> popup from up to down ?? Or I must do this by myself using the
> GtkMenuPositionFunc function ??

You still do this in the position func.  You must get the requisition
of your menu in this function with gtk_widget_size_request(), and to
get the bottom of menu at the cursor you would just have to substract
the req.height to y.

Hint: 
GtkRequisition req;
gtk_widget_size_request (menu, &req);
*y -= req.height;

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

Re: The menu popup direction

2008-09-24 Thread Mike Massonnet
Le Wed, 24 Sep 2008 16:16:20 +0800,
XiuHua Wu <[EMAIL PROTECTED]> a écrit :

> Hi All:
>Can GTK+ control the menu popup direction ?? When I create a 
> popup menu and use the function gtk_menu_popup to show the menu, and
> the menu alway pops from up to down. Is it possible to pop the menu
> from down to up ?? I try to find solution for this from the Google
> search and the GTK document, but with no luck. Any help is highly
> appreciated.

When you call gtk_menu_popup you can pass a GtkMenuPositionFunc.
Define such a function, and that's where you will be able to define
the x and y position of your menu.

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

Re: quarks

2008-09-01 Thread Mike

http://library.gnome.org/devel/glib/stable/glib-Quarks.html
The link works.  Is this some kind of weird joke?

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


Re: g_signal_emit and parameters

2008-08-30 Thread Mike Massonnet
Le Sat, 30 Aug 2008 17:45:32 +0200,
Salvatore De Paolis <[EMAIL PROTECTED]> a écrit :

> Hi all,
> 
> I have in a library such a signal emission
> 
> g_signal_emit(view, MY_SIGNAL, NULL, menu);
> 
> and from the program I'm connecting a callback to it in the way
> 
> gboolean my_callback_menu (TYPE_VIEW *view, TYPE_MENU *menu, gpointer
> userdata)
> 
> In this callback i basically do that
> 
> GtkMenuShell *_sh_menu;
> GtkWidget *item = gtk_menu_item_new_with_label ("foo");
> 
> _sh_menu = GTK_MENU_SHELL(menu);
> gtk_menu_shell_append(_sh_menu, item);
> 
> to override the menu on the library.
> What's wrong with this since i can't see the new item?

Completely random guess, gtk_widget_show (item) maybe.

> Regards
> Sal

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

Re: Poppler vs. LGPL

2008-07-29 Thread Mike

Ask the author[s] to release it also in LGPL?

John Boncek wrote:

The Poppler library has been recommended in this list for in-application
display of PDF files.  However, Poppler is issued under the Gnu General
Public License (GPL), unlike Gtk+, which is under the LGPL.  This makes it
unusable in a project using only LGPL and similarly-licensed works.  Is
there any LGPL solution?

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


Re: GtkTextView and GtkScrolledWindow

2008-02-24 Thread Mike Massonnet
Sorry, I misstyped around y (send) and t (To:).

- Forwarded message from Mike Massonnet <[EMAIL PROTECTED]> -

From: Mike Massonnet <[EMAIL PROTECTED]>
To: Barret Rennie <[EMAIL PROTECTED]>
Subject: Re: GtkTextView and GtkScrolledWindow

On Sun, Feb 24, 2008 at 10:47:22AM -0600, Barret Rennie wrote:
> 
> I have a Textview inside a ScrolledWindow. I set the ScrolledWindow to auto
> scroll vertical and never scroll horizontal. I also set the TextView to
> wrap with GTK_WRAP_WORD_CHAR. My problem is tha the control will resize
> itself horizontally instead of wrapping. It's the same problem as
> http://mail.gnome.org/archives/gtk-list/2003-April/msg00278.html

Just a random guess, would the horizontal scrollbar be set to AUTO, then
it would indeed wrap the chars.

mike

- End forwarded message -
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: question on using GtkCellRendererProgress

2008-02-18 Thread Mike Massonnet
On Mon, Feb 18, 2008 at 10:27:03PM +0800, Gregory Hosler wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Mike Massonnet wrote:
> | On Mon, Feb 18, 2008 at 09:29:26PM +0800, Gregory Hosler wrote:
> |> -BEGIN PGP SIGNED MESSAGE-
> |> Hash: SHA1
> |>
> |> Hi all,
> |>
> |> I've got a gtk_list_store, and one of the columns I want to make a 
> progress meter.
> |>
> |> I'm gathering that I use teh cell rendered GtkCellRendererProgress for 
> this column. But I
> |> have 2 points of confusion.
> |>
> |> 1) When I create the table (gtk_list_store_new()), what is the G_TYPE I 
> use for this
> |> particular column defn ?
> |>
> |> 2) How do I refer to this column in a gtk_list_store_set() (i.e. yes, I 
> know I refer to
> |> the column number, but what do I pass in for a value ?)
> |
> | Progress bars have two properties: value and text.  value should be of
> | G_TYPE_INT, while text is STRING and can print text onto the progress
> | bar.
> |
> | You can then set the values with:
> | gtk_list_store_set (..., COLUMN_PERCENT, new_value, COLUMN_TEXT, new_text);
>
> confusion again... :( COLUMN_PERCENT, and COLUMN_TEXT -- would these be the 
> same column or
> different columns. The progress bar is only 1 column, as I understand.

There can be several columns just for a single cell renderer.
Those are the column numbers, I use the next enum for a gtk list store:

> With your above example, what would my gtk_list_store_new() look like ? 2 
> columns for the
> progress bar ?
>
> any code snippets for the column(s) creation ?
>
> (or code / projects that you know use this ? (I can look it up if I know the 
> project... :)
>
> I looked at Pidghin, but they created their own custom cell render class. I 
> really prefer
> not to do that. :(

enum
{
  COLUMN_VALUE,
  COLUMN_TEXT,
  N_COLUMNS,
};

store = gtk_list_store_new (N_COLUMNS,
G_TYPE_INT,
G_TYPE_STRING);

cell = gtk_cell_renderer_progress_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
 -1, "progress", cell,
 "value", COLUMN_VALUE,
 "text", COLUMN_TEXT,
 NULL);

GtkTreeIter iter;
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COLUMN_VALUE, 40,
COLUMN_TEXT, "blah", /* see 
http://library.gnome.org/devel/gtk/unstable/GtkCellRendererProgress.html#GtkCellRendererProgress--text
 */
-1);

Voilà, something that uses these function.

> thx, and best rgds,
>
> - -Greg

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


Re: question on using GtkCellRendererProgress

2008-02-18 Thread Mike Massonnet
On Mon, Feb 18, 2008 at 09:29:26PM +0800, Gregory Hosler wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hi all,
> 
> I've got a gtk_list_store, and one of the columns I want to make a progress 
> meter.
> 
> I'm gathering that I use teh cell rendered GtkCellRendererProgress for this 
> column. But I
> have 2 points of confusion.
> 
> 1) When I create the table (gtk_list_store_new()), what is the G_TYPE I use 
> for this
> particular column defn ?
>
> 2) How do I refer to this column in a gtk_list_store_set() (i.e. yes, I know 
> I refer to
> the column number, but what do I pass in for a value ?)

Progress bars have two properties: value and text.  value should be of
G_TYPE_INT, while text is STRING and can print text onto the progress
bar.

You can then set the values with:
gtk_list_store_set (..., COLUMN_PERCENT, new_value, COLUMN_TEXT, new_text);

> Many thanks, and kind regards,
> 
> - -Greg Hosler

HTH,
mike
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Mouse wheel events

2008-01-03 Thread Mike Melanson
Tom Trebisky wrote:
> Hello,
> 
> I have a GTK 2 application I have been developing that I would like
> to have use mouse wheel events.  I have a mouse event handler that
> gets left and right button events just fine, (being connected to the
> button release event).  Naturally, it doesn't get a thing when I
> rotate the center wheel on the mouse.  Can anyone tell me what
> to do, or direct me to appropriate documentation?

Investigate the GDK_SCROLL event. It gives you a GdkEventScroll event
structure that contains a direction field with GDK_SCROLL_UP or
GDK_SCROLL_DOWN.

Of course, this is different from the X11 event model which maps scroll
wheel events to mouse buttons 4 and 5.

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


Re: I can't understand the difference output of only a line differ

2007-12-06 Thread Mike Melanson
Binary Chen wrote:
> Hi,
> 
> I tried gdk_draw_image with a small program, but the behavior is very
> confusing, please help me find out whats happening.

[...]

I've read through the thread detailing your GTK troubles. I also know
you are trying to write a custom GTK player for a particular multimedia
format.

I just wanted to throw out the possibility of asking your client whether
they have any interest in open sourcing the video codec itself? Take
this step and there is a community of fanatical open source multimedia
enthusiasts (myself included) who would try to incorporate the codec
into FFmpeg (ffmpeg.org), at which point it would be accessible to a
huge number of existing media players.

Think about it...
-- 
-Mike Melanson
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: When g_timeout_add doesn't seem to be enough

2007-11-28 Thread Mike Melanson
Rafał Mużyło wrote:
> Should problably add that I'm rewriting the app to use libao (so esd
> would be covered) and audio is generated, not played from a file.

I am not familiar with libao and whether or not the PCM output
functionality is blocking or not (or configurable). If its behavior is
blocking:

audio_thread:
  while (running)
mix_audio()
output_audio()

If the behavior is non-blocking (i.e., the output_audio() function
returns immediately), you will have to go through the trouble of waiting
somehow until the device is ready to receive more data.

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

Re: memory leak in gtk

2007-11-24 Thread Mike
Junior Polegato - GTK+ & GTKmm wrote:
> Vincent Torri escreveu:
>> On Sat, 24 Nov 2007, Junior Polegato - GTK+ & GTKmm wrote:
>>> Vincent Torri escreveu:
 On Sat, 24 Nov 2007, Michael Lamothe wrote:
>> From what I've heard about memory leaking, this is not unique to the
> GTK library.  If the rumours are correct, applications like `ls` are
> notorious for leaking memory, safe in the knowledge that the OS will
> clean up after them.
 and if someone calls 'ls' iteratively in his program ?
>>> When a process finish, the OS clean up memory. However, on some 
>>> cases, the cost to freeing the memory is greater than let to the OS.
>> and ? You have definitely a leak there. Calling, in your program (with 
>> the exec() functions family), iteratively and infinitely a program 
>> that leaks can crash your system. 'ls' is maybe not a good example, 
>> but i'm sure you see what I mean ;)
> I said "on some cases", like "ls". On this case you have described, the 
> cost is the system crash.
Generally, programming without leaks can take more time and is also the 
best code solution, but sometimes leaks are okay and you'll get your 
program done sooner.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to draw a UYVY Image

2007-10-05 Thread Mike Melanson
Evans Magaoga wrote:
> I am capturing video frames using the using video for Linux function. 
>  
> Is possible to display a frame (Image) in UYVY format on the screen directly 
> using GTK. 
>  
> I am display RGB frame fine. I would like to know if I can display UYVY 
> grames without converting it into RGB 

Perhaps use an Xv overlay? That's outside the purview of GTK, but I know
it's still possible since there are GTK movie players that use Xv
overlays. And you get hardware scaling for free.

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


Re: How to convert a jpg image to a GtkImage ?

2007-08-31 Thread Mike Melanson
Gregory Hosler wrote:
> Hi all,
> 
> I have an application, that amoung other things, is receiving a jpg file
> from a network connection. Once that file is in memory (it's relatively
> small), I wish to load it into a GtkImage (so that I can display it,
> e.g. by adding the GtkImage to a vbox, or something like that).
> 
> I've been thru the Dev Help pages, and I have some questions:
> 
> 1) If the image were in an actual file, I could load it e.g. with
>gtk_image_new_from_file(). It's not intuitive to me which
>function to use to load my in memory file into a GtkImage,
>and I am reluctant to save the image to a file, just to load it,
>and then delete the file...
> 
> 2) I'm seeing the following fnctions, and, well, I'm confused.
> 
>   I see GtkImage & the related gtk_image functions.
>   I see GdkPixbuf & the related gdk_pixbuf functions.
>   I see GtkPixmap & the related gtk_pixmap functions.
> 
>When do I use which ?
> 
> (and in order to display my jpg image in a v/h-box, is GtkImage really
> the proper widget to use ?)

My first impulse is that you will need to drag libjpeg into this (pretty
standard everywhere) and delegate image decoding over to that module.
Then create a new image in memory with gdk_image_new() and copy the
decoded RGB data over.

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


Re: Difference between GdkPixbuf and GdkPixmap

2007-08-23 Thread Mike Melanson
Gianni Moschini wrote:
> Basicly I'm developing a GtkDrawingArea based application. As far as I
> understand, a GdkPixbuf is stored on the client, and a Pixmap on the
> server.
> 
> Of course there are many more differences, but technically that's all
> I need to know.

What is this program intended to do? Something that has to update the
frame often, like a video player? Or an image viewing app where things
don't change often.

> The results were pretty slow. Good looking[1], but slow. I suppose
> this is caused by the the client->server traffic for the pixbuf to be
> drawn each frame.

What facility are you using for profiling? 'top'? Some other tool? Or
does it just 'feel' slower?



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


Re: Accelerator keys and popup menus?

2007-08-19 Thread Mike Melanson
Stefan Kost wrote:
> Hi,
> 
> Daniel Pekelharing wrote:
>> Hi all,
>>
>> Sorry to be posting yet more questions about accel keys...
>>
>> I have created a popup menu and assigned accelerator keys to some of the
>> items,
>>
>> I assigned a GtkAccelGroup to the menu using
>> gtk_menu_set_accel_group(..),
>>
>> I attached the same GtkAccelGroup to the main window with
>> gtk_window_add_accel_group(..),
>>
>> I assigned each item an accel path gtk_menu_item_set_accel_path(..),
>> and finally I set an accelerator key with gtk_accel_map_add_entry(..).
>>
>> The problem is that the accelerator keys don't work on the popup menu,
>> using the exact same functions they work fine on the main menu..
>>
>> Am I missing something somewhere?
>>
>> Thanks!
> 
> I seem to have the same problem. Have you found a solution in the last 2 
> years?

I had this same problem at one point. The details are a little fuzzy,
but the key is getting the terminology straight. Perhaps what you are
looking for is a "mnemonic" vs. an "accelerator". Look that up. It might
be what you're looking for.

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


Re: Fake pushing a GTK+ button

2007-05-22 Thread Mike Melanson
danielg RHCE wrote:
> I'm pulling my hair out over something that I believe should be easy but I
> cannot see it.
> 
> I have a program that has your basic set of buttons, windows, switches and
> adjustables.  I have added a listener to tell me if a directory has been added
> to or changed.  The printf statement works great and says, "Directory changed"
> at all the right times and is silent at all the right other times.
> 
> All I wanted to do was to refresh the directory listing inside the program,
> unfortunately, I don't know the data structure it uses to create the directory
> tree.  
> 
> Easy enough, right?  All I have to do is tell the program that the refresh
> button has been clicked whenever the directory changes.
> 
> No, I don't know enough to know what to put in this post to help, but I've got
> the code and I do have a decent idea how to read it, ask all the questions you
> like, I'll be happy to answer.  I'm stuck. 

Perhaps gtk_button_pressed() is what you are looking for?

http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html#gtk-button-pressed
"Emits a GtkButton::pressed signal to the given GtkButton."

There's also one for a clicked signal; not sure about the diff.

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


Re: Gtk+ icon compiled into executable

2007-05-19 Thread Mike Melanson
brad smith wrote:
> Hello,
> I am new to Gtk+ and writing a small application with glade. I have my
> source file and glade file and icon for the dialog. My question is how
> can I include the icon in the final binary so it does not have to
> included in the same folder as the binary.

Perhaps convert the icon file to textual data that can be #include'd in
the source code?

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


Querying Key State

2007-05-18 Thread Mike Melanson
Hi,

>From my GTK app, I need to query the state of a key. E.g., I need to
check if the up-arrow is currently down or up. Is there a clean GTK/GDK
way to do this? I know that X11 has XQueryKeymap() but I don't want to
have to fall back on that if I can help it.

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


Re: Can A Drawable Canvas Receive Key Events?

2007-04-02 Thread Mike Melanson
Mike Melanson wrote:
> I found that when I put a big text widget inside the XEmbed'ed GtkPlug 
> container instead of a big drawable canvas, it was able to receive 
> focus. Digging into the GTK source code, I noticed that it calls 
> gtk_widget_grab_focus() when it receives a button press event. So I did 
> the same for my canvas widget when the user clicks in it, and it seems 
> to work. The widget retains focus until the user clicks outside of the 
> window.

I missed a crucial step here. You also need to specify that the 
ordinarily non-focusable widget can receive focus by setting its 
"can-focus" property:

   GTK_WIDGET_SET_FLAGS (GTK_WIDGET(my_widget), GTK_CAN_FOCUS);

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


Re: Can A Drawable Canvas Receive Key Events?

2007-04-02 Thread Mike Melanson
Mike Melanson wrote:
> Tristan Van Berkom wrote:
>> Did you add the events to the event mask before the widget was
>> realized ?
>>
>> Does the widget in question have keyboard focus at the time
>> you want to recieve the keyboard events ?
>>
>> Is the widget in question marked to be focus-capable ?
>> (i.e. the can-focus bit/property)
> 
> This last item did the trick. I set the can-focus property and the 
> GtkDrawingArea now registers key presses and releases. Thanks.
> 
> Now that it works in the contrived standalone app, I need to figure out 
> how to get key events in an XEmbed'ed application. I apply the same 
> can-focus property change but I'm afraid I might be fighting with the 
> hosting app for the key events.

Answering my own question since I know there are interested people out 
there...

I found that when I put a big text widget inside the XEmbed'ed GtkPlug 
container instead of a big drawable canvas, it was able to receive 
focus. Digging into the GTK source code, I noticed that it calls 
gtk_widget_grab_focus() when it receives a button press event. So I did 
the same for my canvas widget when the user clicks in it, and it seems 
to work. The widget retains focus until the user clicks outside of the 
window.

Wow, I can't believe that looking at the source actually helped. :)

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


Re: Can A Drawable Canvas Receive Key Events?

2007-03-31 Thread Mike Melanson
Tristan Van Berkom wrote:
> Did you add the events to the event mask before the widget was
> realized ?
> 
> Does the widget in question have keyboard focus at the time
> you want to recieve the keyboard events ?
> 
> Is the widget in question marked to be focus-capable ?
> (i.e. the can-focus bit/property)

This last item did the trick. I set the can-focus property and the 
GtkDrawingArea now registers key presses and releases. Thanks.

Now that it works in the contrived standalone app, I need to figure out 
how to get key events in an XEmbed'ed application. I apply the same 
can-focus property change but I'm afraid I might be fighting with the 
hosting app for the key events.

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


Can A Drawable Canvas Receive Key Events?

2007-03-30 Thread Mike Melanson
Hi,

I have a standalone test app that has nothing inside the main window but 
a big, drawable RGB canvas (GtkDrawingArea). I can receive nearly any 
kind of event via the canvas: Expose, mouse motion, button 
press/release, scroll wheel, etc. However, I *cannot* figure out how to 
get key press events. I even added the key up/down events to the 
widget's event list using the GDK_KEY_PRESS_MASK and 
GDK_KEY_RELEASE_MASK flags passed to gtk_widget_add_events().

Is it even supposed to be possible to get key events for the canvas? Is 
a non-text widget forbidden from receiving key events? When I swap the 
canvas out for a more text-oriented widget, I get all the key events I want.

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


Getting Keyboard Events In GtkPlug

2007-03-05 Thread Mike Melanson
Hi,

I have an app contained inside of a GtkPlug widget that's communicating
with hosting app via the Xembed protocol. This seems to be working
pretty well except that my app never gets any key up/down events. The
hosting app hogs them all. What's the policy for the GtkPlug application
receiving keyboard events? Is it entirely up to the hosting app?

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


BGR vs. RGB in GTK/GDK

2007-02-20 Thread Mike Melanson
Hi,

I have an app that has been drawing bitmaps to the screen using X11
facilities. I'm trying to convert it to use GTK/GDK. This app has always
rendered bitmaps in blue-green-red (BGR) pixel order which, per my
understanding, is the native order that the hardware expects. Now, I am
using gdk_draw_rgb_image()/gdk_draw_rgb_32_image() which clearly states
that it wants data in RGB order.

Is there a facility I am overlooking for rendering the BGR bitmap?

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


Passing events to an SDL app embedded in a GTK Widget

2006-11-11 Thread Mike Cruse
Hi,

I am writing a python app that needs to embed an SDL app in a GTK
widget. I am using an eventbox widget because it has it's own window.

I set the SDL_WINDOWID environment variable with the window id of the
eventbox and run the app. SDL apps look at this variable and use that
window id as the target for display.

It all works nicely except no mouse events get delivered to the embedded
app.

I thought that when the eventbox window contents gets focus, that is
where the events would go but I am missing something.

Is there a way to let the mouse events get through?

Here is an (incomplete) example of the kind of thing I am trying to do.

evb = xml.get_widget('event_box1')
evb.realize()
os.environ['SDL_WINDOWID'] = '%d' % evb.window.xid
os.spawnl(os.P_NOWAIT, '/usr/bin/neverball')

back to GTK event processing.

Thanks for any help.




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


Passing events to an SDL app embedded in a GTK Widget

2006-11-11 Thread Mike Cruse
Hi,

sorry if this is a duplicate. I sent it from a non subscribed email
the first time.


I am writing a python app that needs to embed an SDL app in a GTK
widget. I am using an eventbox widget because it has it's own window.

I set the SDL_WINDOWID environment variable with the window id of the
eventbox and run the app. SDL apps look at this variable and use that
window id as the target for display.

It all works nicely except no mouse events get delivered to the embedded
app.

I thought that when the eventbox window contents gets focus, that is
where the events would go but I am missing something.

Is there a way to let the mouse events get through?

Here is an (incomplete) example of the kind of thing I am trying to do.

evb = xml.get_widget('event_box1')
evb.realize()
os.environ['SDL_WINDOWID'] = '%d' % evb.window.xid
os.spawnl(os.P_NOWAIT, '/usr/bin/neverball')

back to GTK event processing.

Thanks for any help.




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


Re: GTK+ 2.10.4 released

2006-09-26 Thread Mike Emmel
OSX was missed also btw the change Behdad had me make effected it too.

On 9/25/06, Loïc Minier <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 25, 2006, Attilio Fiandrotti wrote:
> > And the DFB backend was indeed found to be broken by the gtk-gnome
> > Debian team when they tried to build a DFB flavour of GTK for use in the
> > debian-installer.
>
>  I just cvs updated the gtk-2-10 branch, and it's still lacking these
>  fixes:
>  - replace "stuc" with "stub" in gtk/Makefile.am
>  - missing gtk/gtkplug-stub.c and gtksocket-stub.c files in the tarball
>  - fixes from this commit:
> 2006-09-13 Michael Emmel <[EMAIL PROTECTED]>
>* gdk/directfb/gdkcolor-directfb.c small clean ups include order
>* gdk/directfb/gdkwindow-directfb.c fixed beep compile error
>* gdk/directfb/Makefile.am removed GDK_PIXBUF_DISABLE_DEPRECATED
>GDK_DISABLE_DEPRECATED to allow compile per Behdad
>
>  (I've backported these files from HEAD:
>  gtk+2.0-2.10.4/gdk/directfb/gdkcolor-directfb.c
>  gtk+2.0-2.10.4/gdk/directfb/gdkwindow-directfb.c
>  gtk+2.0-2.10.4/gdk/directfb/Makefile.am
>  )
>
> > Is there a way to check if the DirctFB backend builds correctly before a
> > major GTK relase, like (i guess) is done for X and win32 backends?
>
>  Would be nice.
>
> --
> Loïc Minier <[EMAIL PROTECTED]>
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+ 2.10.4 released

2006-09-25 Thread Mike Emmel
It looks like this build does not include my changes to allow the OSX
and directfb
backends to build.



On 9/22/06, Matthias Clasen <[EMAIL PROTECTED]> wrote:
> GTK+ 2.10.4 is now available for download at:
>
>  http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.10/
>
> gtk+-2.10.4.tar.bz2   md5sum: ecfcbdc0d23eb7a596b1d58b48838b18
> gtk+-2.10.4.tar.gzmd5sum: 9721c3d769d6e8a9ef1905c90e3aee85
>
> This is a bug fix release and is source and binary compatible
> with 2.10.0.
>
>
> What is GTK+
> 
>
> GTK+ is a multi-platform toolkit for creating graphical user
> interfaces. Offering a complete set of widgets, GTK+ is suitable for
> projects ranging from small one-off tools to complete application
> suites.
>
> GTK+ has been designed from the ground up to support a range of
> languages, not only C/C++. Using GTK+ from languages such as Perl and
> Python (especially in combination with the Glade GUI builder) provides
> an effective method of rapid application development.
>
> GTK+ is free software and part of the GNU Project. However, the
> licensing terms for GTK+, the GNU LGPL, allow it to be used by all
> developers, including those developing proprietary software, without
> any license fees or royalties.
>
>
> Where to get more information about GTK+
> 
>
> Information about GTK+ including links to documentation can be
> found at:
>
> http://www.gtk.org/
>
> An installation guide for GTK+ 2.10 is found at:
>
>  http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html
>
> Common questions:
>
> http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html
> http://www.gtk.org/faq/
>
>
> Overview of Changes from GTK+ 2.10.3 to 2.10.4
> ==
>
> * GtkFileChooser works better with remote bookmarks
>
> * Windows theme engine improvements
>
> * Bugs fixed:
>  116626 Use keyboard map contents to detect RTL groups
>  353772 Add doc blurb for GtkWidget::parent-set
>  353803 GtkEntry unneccesarily resets im context at commit
>  353914 Leak of to_reset list from _gtk_settings_reset_rc_values
>  354043 Renew the typeahead search timeout when using scrollwheel
>  354687 PLT-reduction stuff not quite working
>  354887 GtkFileChooserButton displays unnecessary authentication
> dialogs
>  355308 gtk_tree_view_set_grid_lines notifies wrong property
>  355732 Combobox leaks treeview in list mode
>  355134 Type in string
>  355961 Typo in documentation for GtkPrintContext
>  340201 Enhancement of Wimp theme engine.
>  357132 Setting an RGBA colormap using gtk_widget_set_colormap()
> on any widget at application start (before other widgets
> are used) causes the running app to revert to the stock
> icon theme
>
> * Updated translations (bg,bn,bn_IN,de,dz,el,
>   en_GB,et,fi,gu,hi,id,ka,lt,lv,mk,nb,nl,nn,or,
>   ru,sl,sv,ta,th)
>
>
> Thanks to all contributors:
> Mariano Suárez-Alvarez, Alex Larsson, Chris Wilson,
> David Lodge, Nelson Benitez, Behdad Esfahbod,
> Hong Jen Yee, Torsten Schoenfeld, Richard Hult,
> Dennis Cranston, Behnam Esfahbod, Claudio Saavedra
>
>
> Matthias Clasen
> September 23, 2006
>
>
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


arm-llinux-gcc cross compile

2005-06-20 Thread Mike Gilorma
I'm trying to develop an application to run on a pxa-255 based system, so I 
need to use a cross complier.  When I try to cross compile, I get an error 
message that says "gtk/gtk.h: No such file or directory."  The test program 
I have written complies fine normally, and I have used the cross compiler 
successfully before, any ideas what I might try?



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


RE: gtk-app-devel-list Digest, Vol 10, Issue 51

2005-02-24 Thread Mike Rosenlof

Marc Santhoff's application sounds very much like what I'm trying to do.

My status 24 hours later:

I am receiving events over a socket, translating them to key events.

I insert the events with gdk_event_put()  both the GDK_KEY_PRESS and
GDK_KEY_RELEASE
events!

I had to grab the keyboard in order to get the events to be reflected
immediately.  Before I added the keyboard grab, it took an enter/leave
of the mouse to see things happen.

So far, the events don't get directed to my application unless it has
focus.  I haven't added a grab-focus yet (which one??).

I think the XTest approach sounds reasonable also, but I'm going to head
down this path for a while.

Thanks everybody!



-Original Message-
Message: 3
Date: Thu, 24 Feb 2005 13:39:04 +0100
From: Marc Santhoff <[EMAIL PROTECTED]>
Subject: Re: GTK app with no keyboard/mouse
To: "gtk-app-devel-list@gnome.org" 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain

Am Do, den 24.02.2005 schrieb Olexiy Avramchenko um 10:10:
> Marc Santhoff wrote:
> > According to some postings on this list, some people tried to 
> > synthesize GDK events from their code and failed.

> What exactly did you try to do ? I use gdk_event_put to simulate
> keyboard events from GIOChannel that reads data from keyboard on
serial 
> port. Works well (maybe my case is just simplier?).

Nothing, it's already done. ;) But I appreciate your help.

At the start of this project I had to decide for one method of:

- getting events from a USB controller sending key-like events on a
generic device
- write some code for setting up the contoller and sending commands to
it
- translate the key-like events into real key events and propagate them
to my program

I decided to use XTest because it was the simplest thing to use and I
have one central point of translation (custom keycodes have to be
mangled, table driven translation). One more cause is to have an option
for steering other X11 programmes than my own GTK thingy.

Btw. I'm using GTK+1.2 and will continue doing so. The hardware running
the prog is somewhat weak, so I have to be careful in pulling in more
ressources.

But I would in fact like to see a piece of code synthesizing key events
(and mouse movements) from arbitrary sources like a GIOChannel. Maybe
the hardware or some decisions change in the future...
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GTK app with no keyboard/mouse

2005-02-23 Thread Mike Rosenlof

Hello,

I'm starting design work on an application which will run on a system
with no keyboard or mouse.  I'm not an experienced GTK programmer, I'm
very experienced in embedded systems development FWIW.


This system will have a display, and a remote control device.  I'm
planning on a separate thread from the GUI which receives the remote
codes, interprets them, and injects appropriate events into the GUI.

Let's assume for the moment that the remote has just six buttons.  Menu,
up, down, left, right, select.  Any thoughts on the best way to inject
events?  So far I have found that a "move-focus" signal on the window
containing a bunch of button and slider widgets is not the answer (for
direction navigation).  Neither does gtk_window_propagate_key_event()
seem to be what I want.  I, of course, want to use the GTK
infrastructure instead of rolling my own.  Any suggestions?

thanks for any light you can shed on this!
-mike

---

Mike Rosenlof
Brillian Corporation
5490 Conestoga Court
Boulder, Colorado  80301

phone 720-406-8400 x30
fax   303-545-2633
 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list