Storing images in GtkTreeView model

2009-12-16 Thread Andrew Wood
Im using a GtkTreeView with a GtkListStore to display a list of rows 
with both text and a picture.


I can declare the model with just the text as follows:


/lhs_store=gtk_list_store_new(1,G_TYPE_STRING,); //1 cols(string)
/


but how do I decalre it to have a picture as well e.g the following- 
which doesnt work. What type do I use for the second col?




/lhs_store=gtk_list_store_new(2,G_TYPE_STRING,G_TYPE_PIXBUF); //2 cols, 
1st is string, 2nd is icon/




I can then add the text to the model easily with:


/gtk_list_store_set(lhs_store,&lhs_treeiter,0,"Subscribers",-1); //put 
string in col0/



what I also want to do is put an image file in the other column

I know how to set up a pixbuf renderer in the view to display it but I 
cant find an example showing how to store images in the model.

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


Re: Storing images in GtkTreeView model

2009-12-16 Thread Andrew Wood

Excellent thank you.

Tadej Borovšak wrote:

Hello.

  

/lhs_store=gtk_list_store_new(2,G_TYPE_STRING,G_TYPE_PIXBUF); //2 cols, 1st
is string, 2nd is icon/



Store creation should be done like this:

lhs_store = gtk_list_store_new( 2, G_TYPE_STRING, GDK_TYPE_PIXBUF );

Hint: For most of GTK+/GDK types, you can get tybe by this simple convention:
GtkWidget -> GTK_TYPE_WIDGET
GdkPixbuf -> GDK_TYPE_PIXBUF
...

  

/gtk_list_store_set(lhs_store,&lhs_treeiter,0,"Subscribers",-1); //put
string in col0/



To store pixbuf in second column, do something like this:
gtk_list_store_set( lhs_store, &lhs_treeiter, 0, "Subscribers", 1, pixbuf, -1 );

Tadej

  


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

GtkTreeView auto selecting row

2009-12-16 Thread Andrew Wood
Is there a way to pre-select a row when the tree  is first displayed. In 
other words if the user hasnt yet selected a row it defaults to one

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


Showing GtkButton in table view

2009-12-22 Thread Andrew Wood
Is there a way to show a standard GtkButton in a table view. I can  
find examples for toggle buttons but  I want a standard button in each  
row.



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


Re: Showing GtkButton in table view

2009-12-22 Thread Andrew Wood

OK thanks

On 22 Dec 2009, at 14:08, David Nečas wrote:


On Tue, Dec 22, 2009 at 01:25:18PM +, Andrew Wood wrote:

Is there a way to show a standard GtkButton in a table view.


I suppose you mean GtkTreeView.


I can find
examples for toggle buttons but  I want a standard button in each  
row.


No, that's not available and it is possible either, namely because
GtkCellRenderer has a relatively limited interface and do not receive
all events that are necessary to simulate a GtkButton.

You can write a cell renderer that will respond to clicks (or find an
already written one, people have done this) but it will not behave
like a real GtkButton.

Yeti


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
__


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

GtkScrollView contents & its GtkViewport contents

2009-12-22 Thread Andrew Wood
Am I right in thinking a GtkScrolledWindow can only have 1 child (a 
GtkViewPort) and that the GtkViewPort can only have one child also?


If this is correct.  Having added a widget a GtkVBox to a 
GtkScrolledWindow using:


gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollview),GTK_WIDGET(vbox));

How can I then remove the vbox and its viewport from the 
GtkScrolledWindow so the GtkScrolledWindow has no children, so that 
gtk_scrolled_window_add_with_viewport can be called again


Would it be correct to use

gtk_bin_get_child(GTK_BIN(scrollview))=NULL



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


Re: GtkScrollView contents & its GtkViewport contents

2009-12-22 Thread Andrew Wood
Perhaps I ought to add that Im trying to change the contents of the 
GtkScrolledWindow whilst the app is running but am  getting the error:


gtk_scrolled_window_add_with_viewport: assertion `GTK_BIN 
(bin->child)->child == NULL' failed




Andrew Wood wrote:
Am I right in thinking a GtkScrolledWindow can only have 1 child (a 
GtkViewPort) and that the GtkViewPort can only have one child also?


If this is correct.  Having added a widget a GtkVBox to a 
GtkScrolledWindow using:


gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollview),GTK_WIDGET(vbox)); 



How can I then remove the vbox and its viewport from the 
GtkScrolledWindow so the GtkScrolledWindow has no children, so that 
gtk_scrolled_window_add_with_viewport can be called again


Would it be correct to use

gtk_bin_get_child(GTK_BIN(scrollview))=NULL



___
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


Problem swapping GtkScrolledWindow contents on the fly

2009-12-24 Thread Andrew Wood
The following function is called to display a vbox, which is read from a 
glade file, in a scrollview.


If the  vbox or 'page' hasnt been displayed before then 
generalpageinitialised will be false.


There are other 'pages' in the app which are vboxes read from a glade 
file in the same way. The app always shows the vbox called rightpanevbox 
and it swaps this variable to point to the appropriate one read from glade.


The first time the function is called the page shows perfectly. The 
second time I get errors such as:


Showing General Page
doing gtk_container_remove

(a.out:21153): Gtk-CRITICAL **: gtk_container_remove: assertion 
`GTK_IS_WIDGET (widget)' failed

done gtk_container_remove


(a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer in 
cast to `GtkWidget'


(a.out:21153): Gtk-CRITICAL **: gtk_scrolled_window_add_with_viewport: 
assertion `GTK_IS_WIDGET (child)' failed



(a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer in 
cast to `GtkWidget'


(a.out:21153): Gtk-CRITICAL **: gtk_widget_show_all: assertion 
`GTK_IS_WIDGET (widget)' failed



I cant understand why its happy the first time its called but not on 
subsequent calls. If anyone can enlighten me Id be very grateful


Thanks


void showGeneralPage()
{
   g_print("Showing General Page\n");
   if (generalpageinitialised==false)
   {
   generalpage= glade_xml_get_widget(generalpagexml,"mainvbox");
   glade_xml_signal_autoconnect(generalpagexml);
   generalpageinitialised=true;
   
   }
  
   if (pagedisplayed!="INIT")

   {
  //a previous page is shown so we need to remove it first
   g_print("doing gtk_container_remove\n");
   gtk_container_remove (GTK_CONTAINER 
(rightpanescrollview),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));

   g_print("done gtk_container_remove\n");
   }
   rightpanevbox=generalpage; //make generalpage the one currently on show
   pagedisplayed = "General";


gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(rightpanescrollview),GTK_WIDGET(rightpanevbox));

   gtk_widget_show_all(GTK_WIDGET(rightpanevbox));
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Problem swapping GtkScrolledWindow contents on the fly

2009-12-24 Thread Andrew Wood
But that bit of code only runs the first time and the first time it  
works.



On 24 Dec 2009, at 19:09, Tristan Van Berkom wrote:


From the assertions it *looks* like glade_xml_get_widget() is
returning NULL for "mainvbox".

Cheers,
  -Tristan

On Thu, Dec 24, 2009 at 11:29 AM, Andrew Wood   
wrote:
The following function is called to display a vbox, which is read  
from a

glade file, in a scrollview.

If the  vbox or 'page' hasnt been displayed before then
generalpageinitialised will be false.

There are other 'pages' in the app which are vboxes read from a  
glade file
in the same way. The app always shows the vbox called rightpanevbox  
and it

swaps this variable to point to the appropriate one read from glade.

The first time the function is called the page shows perfectly. The  
second

time I get errors such as:

Showing General Page
doing gtk_container_remove

(a.out:21153): Gtk-CRITICAL **: gtk_container_remove: assertion
`GTK_IS_WIDGET (widget)' failed
done gtk_container_remove


(a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer  
in cast to

`GtkWidget'

(a.out:21153): Gtk-CRITICAL **:  
gtk_scrolled_window_add_with_viewport:

assertion `GTK_IS_WIDGET (child)' failed


(a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer  
in cast to

`GtkWidget'

(a.out:21153): Gtk-CRITICAL **: gtk_widget_show_all: assertion
`GTK_IS_WIDGET (widget)' failed


I cant understand why its happy the first time its called but not on
subsequent calls. If anyone can enlighten me Id be very grateful

Thanks


void showGeneralPage()
{
  g_print("Showing General Page\n");
  if (generalpageinitialised==false)
  {
  generalpage= glade_xml_get_widget(generalpagexml,"mainvbox");
  glade_xml_signal_autoconnect(generalpagexml);
  generalpageinitialised=true;
}
if (pagedisplayed!="INIT")
  {
 //a previous page is shown so we need to remove it first
  g_print("doing gtk_container_remove\n");
  gtk_container_remove (GTK_CONTAINER
(rightpanescrollview 
),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));

  g_print("done gtk_container_remove\n");
  }
  rightpanevbox=generalpage; //make generalpage the one currently  
on show

  pagedisplayed = "General";


  
gtk_scrolled_window_add_with_viewport 
(GTK_SCROLLED_WINDOW(rightpanescrollview),GTK_WIDGET(rightpanevbox));

  gtk_widget_show_all(GTK_WIDGET(rightpanevbox));
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
__


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


Re: Problem swapping GtkScrolledWindow contents on the fly

2009-12-24 Thread Andrew Wood

Thanks Tristan. I think I follow what you're saying...

The call to  gtk_container_remove is decrementing the ref count so 
generalpage becomes NULL?


Is there a way to "up" the count immediately prior to calling  
gtk_container_remove





Tristan Van Berkom wrote:

Ahh you mean it shows up and everything the first time, I see.

I think you are missing a reference to the generalpage widget.

Its initially built as a floating, and then the floating reference is
"sink"ed the first time you add it somewhere, when you remove it
the first time; its destroyed because you dont have a reference.

Cheers,
-Tristan
  


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


Re: Problem swapping GtkScrolledWindow contents on the fly

2009-12-25 Thread Andrew Wood
I thought it was probably gtk_widget_ref but although that has cleared 
the warnings the widgets dont display themselves the 2nd or 3rd time the 
function is called, only the first time. The code is now:


void showGeneralPage()
{
   g_print("Showing General Page\n");
   if (generalpageinitialised==false)
   {
   generalpage= glade_xml_get_widget(generalpagexml,"mainvbox");
   glade_xml_signal_autoconnect(generalpagexml);
   generalpageinitialised=true;
   gtk_widget_ref(generalpage);
  
   }
  
  
  


   if (pagedisplayed!="INIT")
   {
  
   gtk_container_remove (GTK_CONTAINER 
(rightpanescrollview),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));


   }

   pagedisplayed = "General";

   
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(rightpanescrollview),GTK_WIDGET(generalpage));

gtk_widget_show_all(GTK_WIDGET(generalpage));
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread Andrew Wood

Still getting strange results with this.

Ive posted a skeleton app at  www.simple.org/TCSAdminGTK.tar which 
is a single source file which can be comiled with g++ ./main.cpp 
`pkg-config --cflags --libs libgnome-2.0 libgnomeui-2.0 libglade-2.0`


When you click one of the options on the left the contents changes on 
the right. At present only 'General' and 'Calls' are implemented. As you 
can see the first time you click one of these the widgets show correctly 
but the second time you click it they don't but you get no error on the 
console either.



The guts of the issue are contained in the functions showGeneralPage() 
and showCallsPage()



The closest explaination Ive been able to find is that the call to

gtk_container_remove (GTK_CONTAINER 
(rightpanescrollview),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));


is deleting the widgets as well as just removing them from the 
container, but theres no error to suggest this, and I would have thought 
the calls to gtk_widget_ref(callspage) or gtk_widget_ref(generalpage) 
would have prevented this.


There must be something very simple Im overlooking here. Any ideas?

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


Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread Andrew Wood

Great thanks


On 13 Jan 2010, at 11:05, David Nečas wrote:


On Wed, Jan 13, 2010 at 10:33:07AM +, Andrew Wood wrote:

Still getting strange results with this.

Ive posted a skeleton app at  www.simple.org/TCSAdminGTK.tar  
which

is a single source file which can be comiled with g++ ./main.cpp
`pkg-config --cflags --libs libgnome-2.0 libgnomeui-2.0 libglade-2.0`

When you click one of the options on the left the contents changes on
the right. At present only 'General' and 'Calls' are implemented.  
As you
can see the first time you click one of these the widgets show  
correctly
but the second time you click it they don't but you get no error on  
the

console either.


The guts of the issue are contained in the functions  
showGeneralPage()

and showCallsPage()


The closest explaination Ive been able to find is that the call to

gtk_container_remove (GTK_CONTAINER
(rightpanescrollview 
),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));


is deleting the widgets as well as just removing them from the
container, but theres no error to suggest this, and I would have  
thought

the calls to gtk_widget_ref(callspage) or gtk_widget_ref(generalpage)
would have prevented this.

There must be something very simple Im overlooking here. Any ideas?


Indeed, the children get removed from the container when the page is
removed so the next time it's show it's empty.  This is somehow caused
by the widget being constructed by libglade because if you construct
it manually, it does no happen.

I can't help with libglade and it's already obsolete...

BTW please don't use things like gtk_widget_ref() that were  
deprectated

many years ago.

Yeti


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
__


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

Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread Andrew Wood
Just tried it with a simple vbox and label created manually and am 
getting exactly the same problem so its not specific to libglade



David Nečas wrote:

On Wed, Jan 13, 2010 at 10:33:07AM +, Andrew Wood wrote:
  

Still getting strange results with this.

Ive posted a skeleton app at  www.simple.org/TCSAdminGTK.tar which  
is a single source file which can be comiled with g++ ./main.cpp  
`pkg-config --cflags --libs libgnome-2.0 libgnomeui-2.0 libglade-2.0`


When you click one of the options on the left the contents changes on  
the right. At present only 'General' and 'Calls' are implemented. As you  
can see the first time you click one of these the widgets show correctly  
but the second time you click it they don't but you get no error on the  
console either.



The guts of the issue are contained in the functions showGeneralPage()  
and showCallsPage()



The closest explaination Ive been able to find is that the call to

gtk_container_remove (GTK_CONTAINER  
(rightpanescrollview),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));


is deleting the widgets as well as just removing them from the  
container, but theres no error to suggest this, and I would have thought  
the calls to gtk_widget_ref(callspage) or gtk_widget_ref(generalpage)  
would have prevented this.


There must be something very simple Im overlooking here. Any ideas?



Indeed, the children get removed from the container when the page is
removed so the next time it's show it's empty.  This is somehow caused
by the widget being constructed by libglade because if you construct
it manually, it does no happen.

I can't help with libglade and it's already obsolete...

BTW please don't use things like gtk_widget_ref() that were deprectated
many years ago.

Yeti


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
  


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

Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-15 Thread Andrew Wood
Ive just copied and pasted that code in and am getting exactly the same 
symptoms, so I dont know why what you're seeing is different. It shows 
the FIRST time showGeneralPage() is called but not the second or third. 
The second time its called the label is invisible


David Nečas wrote:

On Wed, Jan 13, 2010 at 08:26:57PM +0000, Andrew Wood wrote:
  
Just tried it with a simple vbox and label created manually and am  
getting exactly the same problem so its not specific to libglade



If I do this:

--- main.cpp.orig   2010-01-13 22:36:25.0 +0100
+++ main.cpp2010-01-13 22:36:38.0 +0100
@@ -116,10 +116,10 @@
g_print("Showing General Page\n");
if (generalpageinitialised==false)
{
-   generalpage= glade_xml_get_widget(generalpagexml,"mainvbox");
-   glade_xml_signal_autoconnect(generalpagexml);
-   generalpageinitialised=true;
-   gtk_widget_ref(generalpage);
+generalpage = gtk_vbox_new(FALSE, 0);
+gtk_container_add(GTK_CONTAINER(generalpage),
+  gtk_label_new("Just testing..."));
+g_object_ref(generalpage);

}
 


the General page content (i.e. the label) no longer disappears and stays
there -- and this is the behaviour I'd expect.

Yeti


P.S.: If you post a tarball it is more helpful to include a two-line
Makefile than Glade backup files and a.out that no one sane will run...

P.P.S: The code looks like a parade of obsolete and deprecated libraries
and functions (see http://live.gnome.org/LibgnomeMustDie).  I hope it is
not a new project...

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
  


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

Errors creating GdkPixbuf

2010-09-05 Thread Andrew Wood

Im getting errors when trying to create a GdkPixbuf using:

GdkPixbuf* unviewedicon = 
gdk_pixbuf_new_from_file("/home/andrew/txe2mdr/unviewedicon.png", NULL);


When it runs it spews out:

(process:2153): GLib-GObject-CRITICAL **: 
/build/buildd/glib2.0-2.24.0/gobject/gtype.c:2706: You forgot to call 
g_type_init()


(process:2153): GLib-CRITICAL **: g_once_init_leave: assertion 
`initialization_value != 0' failed


(process:2153): GLib-GObject-CRITICAL **: g_object_new: assertion 
`G_TYPE_IS_OBJECT (object_type)' failed



before throwing a segmentation fault.

The path is accessible from the programs current working directory. If I 
give it a path which doesnt exist then its silent.


Any suggestions please?

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


Detecting Ctrl Esc in GTK app

2011-08-29 Thread Andrew Wood
Is there a way to regiser a handler function which will be called 
whenever the user presses Ctrl-Esc in a GTK app?


Thanks

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


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread Andrew Wood
Thanks for the tip.  Can accelerators only be used with menu items, only 
Ive just tried doing it by linking it to the clicked signal on a 
(hidden) GtkButton but it doesnt work?


My idea was when the key combo was pressed the accelerator would emit a 
clicked signal on the button and the buttons handler would then be called.


On 30/08/11 09:52, jcup...@gmail.com wrote:

That lets you detect ctrl-esc anywhere on the desktop. If you only
need to detect crtl-ecs within your window you can just set
"Escape" as an accelerator, see:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html

On 30 August 2011 06:33, czk  wrote:

try gdk_window_add_filter or gtk_key_snooper_install

2011/8/30 Andrew Wood


Is there a way to regiser a handler function which will be called whenever
the user presses Ctrl-Esc in a GTK app?

Thanks

__**_
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-list<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



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


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread Andrew Wood

How would you link it directly to the window then rather than to a widget?

As far as I can see you need to associate it with a signal, but looking 
down the list of signals for windows I cant really see one suitable, 
hence I was using this:


gtk_widget_add_accelerator(quitbutton,"clicked",accelgroup,GDK_Q,GDK_CONTROL_MASK,GTK_ACCEL_LOCKED);
g_signal_connect(G_OBJECT(quitbutton),"clicked",G_CALLBACK(handleControlQ),NULL);

Im using Ctrl Q for the time being as I havent worked out how to set it 
up for Esc yet.


The reason for doing this is Im writing an app for a public kiosk which 
will take over the whole screen and not provide any way for the user to 
exit the app.  The admin will press Ctrl Esc (or Ctrl Q for the moment) 
which will pop up a dialog for a password to exit the app.


On 30/08/11 14:19, jcup...@gmail.com wrote:

Hi Andrew,

You can add an accelerator to a window and it'll be called when that
key combination is pressed. It doesn't need to be associated with a
widget.

However I think it's generally considered good form to have a menu
item somewhere with the accelerator as a shortcut. That way the user
can discover your handy keypress and get some idea what it does.

John

On 30 August 2011 14:03, Andrew Wood  wrote:

Thanks for the tip.  Can accelerators only be used with menu items, only Ive
just tried doing it by linking it to the clicked signal on a (hidden)
GtkButton but it doesnt work?

My idea was when the key combo was pressed the accelerator would emit a
clicked signal on the button and the buttons handler would then be called.

On 30/08/11 09:52, jcup...@gmail.com wrote:

That lets you detect ctrl-esc anywhere on the desktop. If you only
need to detect crtl-ecs within your window you can just set
"Escape" as an accelerator, see:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html

On 30 August 2011 06:33, czkwrote:

try gdk_window_add_filter or gtk_key_snooper_install

2011/8/30 Andrew Wood


Is there a way to regiser a handler function which will be called
whenever
the user presses Ctrl-Esc in a GTK app?

Thanks

__**_
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org

http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-list<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


___
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


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread Andrew Wood
Thanks John thats solved that one. Now onto the next issue to do with 
the window type for which I will start a new thread


On 30/08/11 15:50, jcup...@gmail.com wrote:

On 30 August 2011 15:22, Andrew Wood  wrote:

How would you link it directly to the window then rather than to a widget?

You can link a GClosure to a key press with this:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html#gtk-accel-group-connect

Parse "esc" to key/mod with

gtk_accelerator_parse( "esc",&key,&mods );

(I've not actually done this, I always use a widget, but I think it should work)

John


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


How to achieve functionality of GTK_WINDOW_POPUP but with keyboard input

2011-08-30 Thread Andrew Wood
How can I achieve the same 'screen invasion' effect (i.e covers 
everything including the Gnome Panels and prevents other windows being 
brought to the front with Alt-Tab) that GTK_WINDOW_POPUP has but also 
allow keyboard input to the widgets in the window.


Ive tried  GDK_WINDOW_TYPE_HINT_DOCK  which invades screen ok but has no 
keyboard input


GDK_WINDOW_TYPE_HINT_SPLASHSCREEN doesnt invade screen - other windows 
can be placed on top, alt-tab works, but keyboard input works


GDK_WINDOW_TYPE_HINT_DESKTOP no display

GDK_WINDOW_TYPE_HINT_UTILITY
doesnt invade screen - other windows can be placed on top, alt-tab 
works

GDK_WINDOW_TYPE_HINT_TOOLBAR
doesnt invade screen - other windows can be placed on top, alt-tab 
works

GDK_WINDOW_TYPE_HINT_MENU
doesnt invade screen - other windows can be placed on top, alt-tab 
works


The reason is Im trying to write a program for a public kiosk hence I 
effectively want to lock the screen.

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


How to detect when user scrolls

2011-09-05 Thread Andrew Wood
Im writing some code which will call a function (userActive) when the 
user does something, for mouse moves, clicks and keyboard presses this 
is working fine:


g_signal_connect(G_OBJECT(mainwindow),"motion-notify-event",G_CALLBACK(userActive),NULL); 
//will be called when a mouse move occurs
g_signal_connect(G_OBJECT(mainwindow),"button-press-event",G_CALLBACK(userActive),NULL); 
//will be called when a mouse click occurs
g_signal_connect(G_OBJECT(mainwindow),"key-press-event",G_CALLBACK(userActive),NULL); 
//will be called when a key press occurs


However in the mainwindow is a GtkScrolledWindow, and although its 
detecting mouse movement over the display area, if the user is just 
moving the scrollbarsandnot doing anything else, as they would if 
reading through some text, it doesnt detect it.


I've tried the following, on both the GtkScrolledWindow 
(browserscrolledview) and the mainwindow (GtkWindow) but to no avail:


g_signal_connect(G_OBJECT(browserscrolledview),"scroll-event",G_CALLBACK(userActive),NULL); 
//will be called when user scrolls in display area


How do I detect when the scrollbars move?

Thanks
___
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 detect when user scrolls

2011-09-05 Thread Andrew Wood

Excellent. Thank you


On 05/09/11 15:37, David Nečas wrote:

On Mon, Sep 05, 2011 at 02:37:32PM +0100, Andrew Wood wrote:

However in the mainwindow is a GtkScrolledWindow, and although its
detecting mouse movement over the display area, if the user is just
moving the scrollbarsandnot doing anything else, as they would if
reading through some text, it doesnt detect it.

I've tried the following, on both the GtkScrolledWindow
(browserscrolledview) and the mainwindow (GtkWindow) but to no avail:




g_signal_connect(G_OBJECT(browserscrolledview),"scroll-event",G_CALLBACK(userActive),NULL);
//will be called when user scrolls in display area

How do I detect when the scrollbars move?

Connect to "value-changed" signal of the GtkScrolledWindow's
adjustments.

Yeti



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

Forcing a G Timeout to be handled by a specific thread

2011-10-05 Thread Andrew Wood
Is there a way to ensure a timeout callback set with g_timeout_add is 
always executed by a specific pthread?


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