about main event loop

2010-01-12 Thread Zhang Wei
hello,
I don't know how to deal with the signal
when I clicked the icon on taskbar with
right button of the mouse

the program runs ok,
but it gives the warnings in the console:
GLib-WARNING **: g_main_context_prepare() called recursively from within a
source's check() or prepare() member.
GLib-WARNING **: g_main_context_check() called recursively from within a
source's check() or prepare() member.

should i use a callback function to deal
with the signal button_press_eventor
create a thread to run in the idle time?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: about main event loop

2010-01-12 Thread Dov Grobgeld
No, you don't create threads to handle events. Instead you connect to
callbacks through g_signal_connect().

But in order to get an intelligent reply from this list, you should provide
a complete compilable program that exhibit the problem that you experience.

Regards,
Dov

On Tue, Jan 12, 2010 at 11:02, Zhang Wei zwi...@gmail.com wrote:

 hello,
 I don't know how to deal with the signal
 when I clicked the icon on taskbar with
 right button of the mouse

 the program runs ok,
 but it gives the warnings in the console:
 GLib-WARNING **: g_main_context_prepare() called recursively from within a
 source's check() or prepare() member.
 GLib-WARNING **: g_main_context_check() called recursively from within a
 source's check() or prepare() member.

 should i use a callback function to deal
 with the signal button_press_eventor
 create a thread to run in the idle time?
 ___
 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: GtkTreeView in VBox

2010-01-12 Thread Rhishikesh Joshi

Hi,
I have also faced a similar situation in which case i need to pack a 
treeview inside a VBox.
I would not mind the treeview apis not working but the packing is 
something i am looking to keep. The scrolling of the VBox works fine for 
smaller sizes of the TreeView. But when the treeview consists of 
elements greater than a certain number of elements (450) in my case, the 
scrolling goes awry between adjustment values 16000 and 27000 (sounds 
strange, i know.).


Please help. Any suggestion is welcome.
Thank you for your time.


Kristian Rietveld wrote:

On Thu, Jan 7, 2010 at 1:24 PM, Amol Kulkarni amolgkulka...@gmail.com wrote:
  

Is it possible to add GtkTreeView inside VBox and then add that VBox to
ScrolledWindow using gtk_scrolled_window_add_with_viewport(sw,vbox).



  

Is this expected/supported use case or am i doing something wrong here?
Thanks for your time.



No, it's not a supported use case.  GtkTreeView and other scrolling
widgets such as GtkIconView are meant to be placed directly in a
GtkScrolledWindow.  Not doing so will, for example, break scroll
commands given by GtkTreeView itself, since it is not directly
connected to the GtkScrolledWindow anymore.  Such scroll commands are
given when you are setting a cursor on a row and want to make that row
visible, automatic scrolling during drag selection, or by the
application programmer using the gtk_tree_view_scroll_to_cell() and
related functions, etc.

Another reason why this is a bad idea is memory usage, although I
cannot tell for sure whether this still holds for GTK+ 2.18 and later.
 For earlier versions of GTK+ a large X window has to be allocated if
you are placing a GtkTreeView with a large number of rows in a VBox or
similar container.


regards,

-kris.
___
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


Nobody ever used GTK_STOCK_FILE?

2010-01-12 Thread Pavel A. da Mek

I wonder why

GTK_STOCK_COLOR_PICKER
GTK_STOCK_DIALOG_AUTHENTICATION
GTK_STOCK_DIRECTORY
GTK_STOCK_DND
GTK_STOCK_DND_MULTIPLE
GTK_STOCK_FILE
GTK_STOCK_MISSING_IMAGE

are not included in the array
GtkStockItem builtin_items
in the source file
gtkstock.c

How they are expected to be used when they cannot be found by 
gtk_stock_lookup?


Should not be added at least
 { GTK_STOCK_FILE, NC_(Stock label, _File), 0, 0, 
GETTEXT_PACKAGE },

and maybe also
 { GTK_STOCK_DIRECTORY, NC_(Stock label, Folder), 0, 0, 
GETTEXT_PACKAGE },

?


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


Re: Nobody ever used GTK_STOCK_FILE?

2010-01-12 Thread Tadej Borovšak
Hello.

 How they are expected to be used when they cannot be found by
 gtk_stock_lookup?

 Should not be added at least
  { GTK_STOCK_FILE, NC_(Stock label, _File), 0, 0, GETTEXT_PACKAGE },
 and maybe also
  { GTK_STOCK_DIRECTORY, NC_(Stock label, Folder), 0, 0, GETTEXT_PACKAGE
 },
 ?

As far as I can understand this, some stock icons are not meant to be
used as items. For example, having File stock item doesn't make much
sense, since files usually carry their own name and this is what
should be displayed. Another example are DND icons. I really cannot
imagine situation where menu item with DND stock icon would make
sense.

BTW, I'm not the one who decides what becomes item and what not.

Tadej

-- 
Tadej Borovšak
tadeboro.blogspot.com
tadeb...@gmail.com
tadej.borov...@gmail.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

simple internalisation (was: Nobody ever used GTK_STOCK_FILE?)

2010-01-12 Thread Pavel A. da Mek

For example, having File stock item doesn't make much

sense, since files usually carry their own name and this is what
should be displayed.

Most programs have the File menu item in the tool bar.
To create menu items from stock items is a simple way to present 
translated labels for all languages supported by gtk at least for the 
frquently used items,  without need to manage translations to all those 
languages for the application.


What I am doing is this:

GtkWidget* menu_item_new_from_stock (const gchar *stock_id) {
GtkStockItem item;

if (gtk_stock_lookup (stock_id, item)) {
 return gtk_menu_item_new_with_mnemonic (item.label);
}
return gtk_menu_item_new_with_mnemonic (stock_id);
}

...
// *** menu items in menu bar
editMBMenuItem = menu_item_new_from_stock (GTK_STOCK_EDIT);
preferencesMBMenuItem = menu_item_new_from_stock 
(GTK_STOCK_PREFERENCES);

helpMBMenuItem = menu_item_new_from_stock (GTK_STOCK_HELP);
...

But because this does not work for GTK_STOCK_FILE,
I am using this:

#include libintl.h
#define T_(String) dgettext (gtk20, String)
...
fileMBMenuItem = gtk_menu_item_new_with_mnemonic (T_(_Files));
...

Other frequently used words are available too, for example

searchMBMenuItem = gtk_menu_item_new_with_mnemonic (T_(Search));

Some other words are translated for gtk properties and for glib,
so I am using also this:

#define L_(String) dgettext (glib20, String)
#define P_(String) dgettext (gtk20-properties, String)

for example:

settingsMBMenuItem = gtk_menu_item_new_with_mnemonic (P_(Settings));

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