Re: Gtk+3 application Internationalization
How is localisation done in the new system? In the same way you localize your application's strings For simple programs, I do not bother to do my own localization, because most of needed words are already available in localization files of GTK and its components. Thus I define: #define A_(String) g_dpgettext ("atk10", String, 0) #define L_(String) g_dpgettext ("glib20", String, 0) #define G_(String) g_dpgettext ("gtk20", String, 0) #define P_(String) g_dpgettext ("gtk20-properties", String, 0) and then I can use for example: G_("File"), P_("Image"), A_("paragraph") and so on. But of course, some of these words are not available in all versions. Another possibility is to use localization files of other programs which also use .mo files (for example GIMP). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting a pointer to a dialog's 'Cancel' button
how do I obtain a pointer to the dialog's 'Cancel' button so that I can connect a signal handler to it? I think that you can also connect to the response signal of the dialog and check the response ID. I looked for functions like gtk_dialog_get_child() or gtk_window_get_child_with_id() or something similar but I couldn't find anything. dialog-action_area is GtkHButtonBox, so you can get GList of its childrens and browse through it with g_list_foreach ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk3: FileChooser schema not found
I downloaded the mingw32-gtk3-3.0.6-1.6.noarch.rpm and everthing would work fine, except that there is this unfortunate affair with Glib-GIO-ERROR **: Settings schema 'org.gtk.Settings.FileChooser' is not installed Shall I copy the org.gtk.Settings.FileChooser.gschema.xml to some other place or how I force Glib to find it? ___ 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?
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
simple internalisation (was: Nobody ever used GTK_STOCK_FILE?)
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
Re: Close GTK Main window
Is it possible to close a GTK main window through the code? gtk_widget_destroy (mainWindow); The application can continue running after the window is destroyed, if you simply omit the usual g_signal_connect (G_OBJECT (mainWindow), destroy, G_CALLBACK (gtk_main_quit), NULL); P.A. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: cairo context for pixbuf
- Original Message - Subject: Re: goocanvas vs crcanvas,which better? Is there standard facility for creating cairo context for pixbuf? Like gdk_cairo_create() for drawables. pixels = gdk_pixbuf_get_pixels (pixbuf); width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); surface = cairo_image_surface_create_for_data ( pixels, CAIRO_FORMAT_ARGB32, width, height, rowstride ); This works if the the pixbuf has alpha; the only flaw is that the red and blue component are exchanged, so the function cairo_set_source_rgb (cr, red, green, blue); must be used as if it would be cairo_set_source_rgb (cr, blue, green, red); P.A. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Toolbar text makes toolbar very, very wide
When I turn on toolbar button labels Text Below Items (System Preference Appearance Interface), the toolbar gets much, much wider than it seems it should. There's lots of wasted space and it makes the toolbar for the app I'm working on almost useless on smaller screens. Does anyone have ideas for how to make the text use space more efficiently? There's lots of wasted space if the items are homogeneous (which is their default state), so I recommend gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM(tool_item), FALSE); P.A. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtktextview with gdkpixbuf saving into file
anyone know a way to save a gtktextview/gtktextbuffer with embedded gdkpixbuf into a file. A correction to the suggested solution: In the procedure void open_gtb (GtkTextView *textView, const gchar *srcFileName) delete the call: gtk_text_buffer_deserialize_set_can_create_tags ( buffer, grtDeserializeFormat, TRUE); I thought that only the tags which do not exist will be created, but in the reality if a tag with the same name allready exist, the deserialize procedure changes the name of the inserted tag by adding -1 at the end of the name. Another possibility would be to retain the enabling of the inserting and after the deleting of the content by the call gtk_text_buffer_delete (buffer, startIter, endIter); to add the deleting of all tags this way: gtk_text_tag_table_foreach ( textTagTable, remove_tag_foreach, textTagTable // gpointer data ); where the callback funcion remove_tag_foreach is defined: void remove_tag_foreach (GtkTextTag *tag, gpointer data) { gtk_text_tag_table_remove ( data, // GtkTextTagTable *table, tag ); } But this variant cannot be used if there are other buffers sharing the same tag table, because the markup in them would be lost. P.A. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Building and packaging for Windows
Can someone share ideas about how to compile a GTK application for Windows and package it so it includes GTK and its dependencies? To develop GTK applications under Windows I am using Dev-C++ which includes Mingw compiler http://sourceforge.net/projects/dev-cpp/ GTK is usually already installed with GIMP; if not, the packages are on http://gimp-win.sourceforge.net/old.html GTK+ 2 Runtime Environment (version 2.6.10-20050823, for Windows 98/ME and NT4) GTK+ 2 Runtime Environment (version 2.10.13, for Windows 2000 and newer) P.A. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Building and packaging for Windows
GTK is usually already installed with GIMP; Presumably not everyone is interested in installing GIMP just to get a copy of GTK+. Is there a better choice of bitmap graphic editor than GIMP? (I am just curious, not starting flamewar :-) Of course, there may be some people who are not at all interested in image editing, but it seems to me that this is a basic tool, alike vector editor (my choice is Inscape) and text editor (my choice is Notepad++). if not, the packages are on http://gimp-win.sourceforge.net/old.html That old should tell you that the versions there are already obsolete, and will become increasingly so. The old versions are good enough for my purposes. I do not use features newer than 2.6.10 because I got the impression that it is not possible to run the new versions also on Win98. Or am I wrong? Also I suppose that it is not possible to write applications which would in run-time decide, depending on GTK version, whether they can call new functions or not. It is so? Nowadays the GIMP installer bundles the GTK+ runtime and dependencies, so it is not possible to find an installer for just a fresh GTK+ from the gimp-win site. That is the reason why I use the old versions. The main, some may even say official, distribution for prebuilt binaries of each version of GTK+ and dependencies is on ftp.gnome.org. (In the form of zip archives, from which it should be a small matter of scripting to construct installers if one likes.) I only thougt that for those like me, with less skill and time, it would be helpful to know that there is also the quick and easy way with the old packages. P.A. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
serial ports
When I want to use serial ports, shall I write separate code for Windows and for Linux, or is there some library function which would allow to do it in the platform independent way? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list