Re: multi line cell edition
On Thu, Feb 3, 2011 at 8:54 PM, Nicolas Soubeiran nicolas.soubei...@gmail.com wrote: Hi all, I need to edit a multi-line cell in a treeview. GtkCellRendererText can display a multi-line text, I need to be able to edit it and/or let the user set a multi line value in the cell. I look at GtkEntry APIs and I found gtk_entry_get_layout* API but I have no idea on how I can use it. Or have I to create a custom widget? How can I do this? I'm working on a GTK+ 2.18 version (RedHat 6) Generally I do that by popping up a dialog for anything editing of multi-line text from a treeview. GtkCellRendererText uses a GtkEntry and finishes the editing by way of the ENTER key (or cancels it by way of ESC key)... you could theoretically write your own GtkCellRendererText derived renderer that uses a derived GtkTextView to implement GtkCellEditable... but... if you did that I'm not sure it would be a good user experience (i.e. how would the user indicate that they finished editing the cell ?, you would have to put a button in there or something ?). In the end I recommend using a dialog that pops up from the treeview to edit multi-line text. 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: cannot launch project with glad file
a.) where did you install the .glade file b.) what path are you giving to the gtk_builder_add_from_file() api ? If you've answered those 2 questions, you've surely already solved the problem. Cheers, -Tristan On Fri, Jan 14, 2011 at 5:11 AM, craigbakalian craigbakal...@verizon.net wrote: Hi, I am unable to launch my built gtk+ application from the terminal because it cannot find the glad file, even if the glad file is right where it should be. Do I need to add something to the terminal statement when launching my application? Craig Bakalian ___ 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: Question about GtkCellAreaBox
On Mon, Dec 27, 2010 at 9:30 PM, Tomasz Jankowski tomc...@gmail.com wrote: Hello! So far (GTK+ 2.91.7) we can easily pack renderers vertically or horizontally in single GtkTreeViewColumn using GtkCellAreaBox. I want to achieve mixed structure of renderers, something like this (this is single row model): - | | B | | A |---| | | C | - were A, B and C are some cell renderers. I can implement my own class based on GtkCellRenderer to do this, but maybe you (I mean GTK+ team) are going to implement something like GtkCellAreaTable or make it possible to pack GtkCellAreaBox inside other GtkCellAreaBox object? I would like to do a GtkCellAreaTable for GTK+ yes, but I can't say when that will actually happen, most probably not by the time 3.0 is released. 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: GtkBuilder issue?
On Wed, Sep 29, 2010 at 4:10 AM, Lance Dillon riffraff...@yahoo.com wrote: I'm trying to add gtkbuilder support to pike (pike.roxen.com). In loading a glade3 file, it says Invalid Object 'blah', unless I create an instance of the object first. I narrowed it down to (in gtkbuilder.c): Unless your object is already in a dynamically linkable .so file linked in to the application; you need to compile your application with `pkg-config --cflags --libs gmodule-2.0` This will ensure your applications globally visible symbols are also exported (it boils down to the linker getting --export-dynamic) Otherwise GtkBuilder has no way to search your type name from your application. Cheers, -Tristan static GType gtk_builder_real_get_type_from_name (GtkBuilder *builder, const gchar *type_name) { GType gtype; gtype = g_type_from_name (type_name); if (gtype != G_TYPE_INVALID) return gtype; return _gtk_builder_resolve_type_lazily (type_name); } Which as you can see, calls _gtk_builder_resolve_type_lazily(). That function loads the module using GModule, using NULL to load the symbols of itself, find the *_get_type() function of the object, and calls it to get the type. The type, of course, is not created until the first time it is used. For some reason, my code doesn't do that. The binding is a .so file that is dynamically loaded into the pike interpreter, so I'm hazarding a guess that it gets the symbols to the current module, which is not libgtk-x11.so (on linux anyway), so it can't find the *_get_type() function, so it gets G_TYPE_INVALID. I've been trying different things and so far nothing is working. Does anybody have any idea how to get around this, to make it resolve properly? Thanks ___ 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: GtkTextView background image without tiling.
On Fri, Jul 30, 2010 at 5:35 AM, Kuang-Chun Cheng kcch...@linuxdaq-labs.com wrote: Hi, I can use gdk_window_set_back_pixmap() to set the background image of GtkTextView. But the image is tiling. My question is ... Is it possible to use background image without tiling for Gtk's widget ? You can set the image using GtkStyle, using engine pixbuf the image will scale to fit. Cheers, -Tristan Regards KC ___ 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: Treeview, different Cell-render per row
On Sat, Jul 10, 2010 at 2:19 AM, Arne Pagel a...@pagelnet.de wrote: Tadej Borovšak schrieb: Hi. My other Idea was to make a new column for the GtkCellRendererToggle, and just show it when needed. Is it possible to hide a one of the renderer? This is how I would do this. Just add one gboolean column to your data store and connect it to cell renderer's visible property. Tadej Hello, thank you for your answer, The first part is easy, but I don't know how I should connect it to the visible property. Do you know an example project where this is done? He just means connecting the attribute in the normal way, like with any property/liststore column. I.e. use something like this: http://library.gnome.org/devel/gtk/2.90/GtkTreeViewColumn.html#gtk-tree-view-column-add-attribute 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: word wrap in liststore column
On Fri, Jun 25, 2010 at 8:44 PM, Mick bare...@tpg.com.au wrote: I'm stuck again. I wish to set word-wrap for a single column in a treeview liststore, I've found the options I need to set but can't for the life of me find an example of how to do it. I think the catch is that you need to set an explicit wrap-width when specifying wrap-mode on the GtkCellRendererText. 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: How to make GtkLabel fills like GtkTextView?
On Sat, Jun 19, 2010 at 3:58 AM, Ardhan Madras aj...@knac.com wrote: Can anyone tell me what is the case to use 'GtkTextView' instead of 'GtkLabel' to display a text with several sentences( 100 words) in not editable way? Maybe for `beauty' looks, the author want the text wrapped as it's parent container width that GtkLabel can't do. How to make GtkLabel fill the entire range, just like what GtkTextView did? As the doc says: You can't not make the label wrap at its parent container's width, because GTK+ widgets conceptually can't make their requisition depend on the parent container's size. GtkLabel only wrap-able at a given specific position. Curiously which docs still say that ? FWIW, GTK+ 3.0 will wrap labels to their allocated width. Cheers, -Tristan Ardhan --- dancef...@gmail.com wrote: From: Tao Wang dancef...@gmail.com To: gtk-app-devel-list@gnome.org Subject: How to make GtkLabel fills like GtkTextView? Date: Thu, 10 Jun 2010 13:08:25 +1000 Hi, Some of the code I'm working on is using 'GtkTextView' to display text, which is just few sentences, rather than GtkLabel. I don't know why, Can anyone tell me what is the case to use 'GtkTextView' instead of 'GtkLabel' to display a text with several sentences( 100 words) in not editable way? I tried to replace those GtkTextView with GtkLabel, which set wrap to 'word', the result is different. Here is the screenshot: http://i48.tinypic.com/n1os9f.png . I put the GtkTextView and GtkLabel to seperate GtkScrolledWindow, which disabled both scrollbar. The above is the GtkTextView, it expend to entire GtkScrolledWindow, and the below is the GtkLabel, it's only in a small range in the middle of the GtkScrolledWindow. How to make GtkLabel fill the entire range, just like what GtkTextView did? Thanks. -- Regards Tao Wang ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _ Listen to KNAC, Hit the Home page and Tune In Live! --- http://www.knac.com ___ 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: GtkTextView and glade 3
On Tue, Jun 8, 2010 at 1:43 AM, Mick bare...@tpg.com.au wrote: On Mon, 07 Jun 2010 22:12:57 -0700 Steve Harrington steven.harring...@verizon.net wrote: On 06/07/2010 09:36 PM, Mick wrote: I've spent the last month struggling with glade to layout the interface for my app, especially creating an incoming text pane and placing the text into it. I regret your struggles. I currently have glade set to libglade mode and use gtk-builder-convert to turn the .glade into .xml after not being able to find how to get the output from gtkbuilder mode into a usable format. Perhaps if you could describe the format you desire we could suggest one or more solutions. A format that gtkbuilder can use. I drew my interface with glade set to gtkbuilder and saved it as app.glade, ran gtk-builder-convert app.glade app.xml and it crashed so I copied app.glade to app.xml, recompiled source and installed it and the app segfaulted in gtk_builder_add_from_file(builder, xml_dir, err); Dont use the conversion script to convert from GtkBuilder format to GtkBuilder format please, actually please dont use the converst script from GTK+ at all (it was originally created to help transition when Glade did not support the format/conversions at all). Note that recently there was a bug reported, the conversion process doesnt work from the little check-mark in the Save As dialog. If you are converting a file from libglade format you must use the project preferences dialog to convert. Cheers, -Tristan I have now recreated app.glade using libglade setting. this experience started when glade crashed when I hit the save button. the crash resulted in the disappearance of of my existing app.glade. ___ 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: Top down layout
On Tue, Jun 8, 2010 at 10:36 PM, Matthew Allen l...@sydneyband.com.au wrote: This sort of behaviour might not be possible with GTK. But at least I thought I'd ask. Actually whats the first signal generated when the user attempts to resize the GtkWindow? I should hook that and stop it get limited to the requested size... then my window is free to resize arbitrarily, and I can sort out the layout from there. Is there some way of seeing the signals being fired? Do you need to let the window be smaller than the space that its children occupy ? You could just put everything in a scrolled window and hide the scrollbars if thats what you wanted. Otherwise GTK+ should only restrict your window size to the smallest possible size needed to hold all visible child widgets. Assuming a sensible UI design; all the window contents easily fit on screen so you can then stretch/maximize your interface, at this point the bottom up method of requesting space allows you to further tweak out which child is going to be allocated extra space at resize time. Does that help at all ? maybe you can explain exactly what part of the application you are porting that you are having difficulty representing with a UI in GTK+. Cheers, -Tristan -- Matthew Allen ___ 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: Multi-platform dbus (was: Ige-mac-integration: New version with Cocoa interface available)
On Thu, May 20, 2010 at 3:56 PM, Shawn Bakhtiar shashan...@hotmail.com wrote: Sorry for my naivete But I have been building some of our application tool sets in native Cocoa (the printing industry is exclusively MAC, with little room for anything else). The question being, in the standard Cocoa application framework you never actually derive the NSApplication class, but instead you derive the NSApplicationDelegate. Would this not be more appropriate for this discussion. It receive all the signals for each interface object whos IBoutlet is set to this class, and all the functionality for the toolbar, menu, etc, is exposed in it. Shawn, Maybe I'm misreading you but are you suggesting that GTK+ should export proxy interfaces to be signalled by an internal GtkApplication in the code ? (i.e. applications would set the core's application delagate object ?). Personally I would much rather avoid that api and have the osx implementation of GtkApplication assign a delegate internally if it needs to; and in this way export IMO a saner api than Cocoa does. Cocoa may have a specific reason why they had to add a delegate object separate to the app object (maybe something tied to springboard...) Or maybe it is their preference to export such an api, i.e. see UIViewController vs. NSView (there is also no reason here I can see why one would rather implement a controller proxy than to implement the parent view, although I suspect this restriction is mearly imposed by the way they chose to implement nib files with Interface Builder). Best Regards, -Tristan IE this class actually receives the signal for the NSSearchField object, and process it. So should GTKApplication.c not really be GTKApplicationDelegate.c, or perhaps both. Last I recall of the MFC, there was something similar where you had a CCmdTarget which did a lot of what I guess GTKApplication.C is todo, but seems more inline with NSApplicationDelegate than NSApplication. I've noticed a lot of stuff like GTKTreeView implement its own displays, why is it not derived from NSTableView using NSDataSource for GTKTreeStore and GTKListStore? Or is the point to also make it all look alike? -- MY APP DELIGATIONS @interface isiod2AppDelegate : NSObject NSApplicationDelegate { /*Views */ NSWindow *window; AnalyzerView *view; SimpleCView *scView; /* Fields */ NSSearchField *searchField; NSTextField *startDate; NSTextField * endDate; /* Tables */ NSTableView *shippingTable; NSTableView *receivingTable; NSTableView *batchesTable; NSTableView *usageTable; /* Data sources */ isilistDataSource *shippingDS; isilistDataSource *receivingDS; isilistDataSource *batchesDS; isilistDataSource *usageDS; /* Internal objects */ IsiComponent *component; IsiDatabase *db; } /* Views */ @property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet AnalyzerView *view; @property (assign) IBOutlet SimpleCView *scView; /* Fields */ @property (assign) IBOutlet NSSearchField *searchField; @property (assign) IBOutlet NSTextField * startDate; @property (assign) IBOutlet NSTextField * endDate; /* Tables */ @property (assign) IBOutlet NSTableView *shippingTable; @property (assign) IBOutlet NSTableView *receivingTable; @property (assign) IBOutlet NSTableView *batchesTable; @property (assign) IBOutlet NSTableView *usageTable; /* Actions */ - (IBAction)filterSearch:(id)sender; @end Subject: Re: Multi-platform dbus (was: Ige-mac-integration: New version with Cocoa interface available) From: jra...@ceridwen.us Date: Tue, 18 May 2010 14:10:22 -0700 To: p...@linuxaudiosystems.com CC: gtk-devel-l...@gnome.org On May 18, 2010, at 1:36 PM, Paul Davis wrote: On Tue, May 18, 2010 at 4:12 PM, John Ralls jra...@ceridwen.us wrote: Sure. But dbus provides services which are provided by notifications and AppleEvents on OSX. If a supposedly cross-platform application supports only the dbus way, it turns out to be pretty autistic on OSX. I don't think that it's all that common for OSX users (aside from the few Fink and MacPorts users who are trying to replicate an entire Linux environement) to run more than one or two dbus-using apps, and they aren't able to communicate with other OSX application or OSX itself unless those channels are separately implemented. So maybe g_dbus isn't the right place for the abstraction layer; it could be one of the implementation layers. i think that is precisely what is being proposed: GApplication/GtkApplication as the abstaction that covers notifications etc, and an implementation for a given platform. the linux/X11/FD.org one would use DBus. apps that choose to use DBus directly will be assumed to want something specific that DBus offers, and not a generic platform-agnostic application abstraction. OK. I don't think that
Re: Callbacks when glade file is loaded using a dynamic library
On Fri, Apr 23, 2010 at 4:40 AM, dfg dfg abx...@msn.com wrote: Hi Tristan, I am not sure if the symbols need to be visible in myapp. Currently, myapp attaches a glade file to create its interface and uses dlopen to open the .so dynamic library. The .so library loads its own GTK Builder which loads a second glade file and attaches it to a container in myapp's glade file. Your app has callbacks that need to be looked up by GtkBuilder. Your plugin has also callbacks that need to be looked up by GtkBuilder The fact you have a plugin and an app is completely besides the point. You need to expose the symbols in your *_app_* so that GtkBuider can read those symbols from the global namespace... of your app... to load callbacks in your glade file that can only be found in your *app*, which needs to be compiled with --export-dynamic ... did you try that yet before writing back to the list please ? Thanks, -Tristan At present state, the callbacks in the .so library are not being found by the GTK Builder loaded by the dynamic library. However, callbacks contained in myapp works perfectly with the glade file loaded by myapp. I am quite new at this, so can you please explain what you mean by export the symbols of my app? Cheers :) Date: Thu, 22 Apr 2010 22:08:44 -0400 Subject: Re: Callbacks when glade file is loaded using a dynamic library From: t...@gnome.org To: abx...@msn.com CC: gtk-app-devel-list@gnome.org If you have symbols that need to be visible in 'myapp', they need to be exported to in order to by found by a g_module_lookup(); did you also export the symbols of you app ? Cheers, -Tristan On Thu, Apr 22, 2010 at 9:53 PM, dfg dfg abx...@msn.com wrote: Thank you Tristan. I actually tried the --export-dynamic flag before posting, but could not get it to work. I feel that it is most likely a problem in my makefile.am (I am using automake and libtool to generate the makefiles). Here is the make file for the compilation of the dynamic library: libmyplugin= / libmyplugin_LTLIBRARIES=libmyplugin.la libmyplugin_la_SOURCES=libmyplugin.c libmyplugincallbacks.c include_HEADERS = libmyplugincallbacks.h libmyplugin_la_LDFLAGS= -lc -lgcc -avoid-version @PACKAGE_LDFLAGS@ libmyplugin_la_LIBDADD = --export-dynamic @PACKAGE_LIBS@ INCLUDES = @PACKAGE_CFLAGS@ Here is my configure.ac AC_PREREQ(2.59) AC_INIT(myapp, 1.0) PKG_CHECK_MODULES(GTK, gtk+-2.0 gmodule-2.0 gmodule-export-2.0) PACKAGE_CFLAGS=-g -Wall $GTK_CFLAGS PACKAGE_LIBS=-g $GTK_LIBS -ltar PACKAGE_LDFLAGS=-Wl, --export-dynamic $GTK_LDFLAGS AC_SUBST(PACKAGE_CFLAGS) AC_SUBST(PACKAGE_LIBS) AC_SUBST(PACKAGE_LDFLAGS) AM_PROG_LIBTOOL AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE() AC_PROG_CC AC_CONFIG_FILES(Makefile src/Makefile src/modules/Makefile src/modules/libmyplugin/Makefile) AC_OUTPUT For some reason though, callbacks in myapp the main app that loads in the .so files work fine. Any ideas appreciated. :) Date: Thu, 22 Apr 2010 21:37:48 -0400 Subject: Re: Callbacks when glade file is loaded using a dynamic library From: t...@gnome.org To: abx...@msn.com CC: gtk-app-devel-list@gnome.org On Thu, Apr 22, 2010 at 7:21 PM, dfg dfg abx...@msn.com wrote: Hi everyone, Currently, I have built my main application using glade. This file is then loaded by a C application. I then created another interface using Glade. When my main application loads, it loads a .so library which contains code for this subsection (kind of like a plugin). The .so file loads in the second glade file and attaches it into the interface of the main application. This all works problem. The problem I am facing now is that gtk_builder_connect_signals (builder, NULL); does not work. For my .so file, i have 3 files: -libmyplugin.c -libmyplugincallbacks.h -libmyplugincallbacks.c My code for the libmyplugin.c file looks like this: #include stdlib.h #include gtk/gtk.h #include libmyplugincallbacks.h #define GUI libmyplugingui.ui int startplugin(){ extern *mainBuilder; GtkBuilder *subbuilder; //Do things like attach the glade file into the main glade file. gtk_builder_connect_signals (builder, NULL); } My libmyplugincallbacks.h #include gtk/gtk.h void myfunc (GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data); My libplugincallbacks.c #ifdef HAVE_CONFIG_H # include config.h #endif #include libmyplugincallbacks.h #include string.h void myfunc(GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data){ if (GTK_IS_ENTRY (editable)) { //Do stuff } } When I compile my program, the .so file compiles properly. However, when ever I run
Re: Callbacks when glade file is loaded using a dynamic library
On Thu, Apr 22, 2010 at 7:21 PM, dfg dfg abx...@msn.com wrote: Hi everyone, Currently, I have built my main application using glade. This file is then loaded by a C application. I then created another interface using Glade. When my main application loads, it loads a .so library which contains code for this subsection (kind of like a plugin). The .so file loads in the second glade file and attaches it into the interface of the main application. This all works problem. The problem I am facing now is that gtk_builder_connect_signals (builder, NULL); does not work. For my .so file, i have 3 files: -libmyplugin.c -libmyplugincallbacks.h -libmyplugincallbacks.c My code for the libmyplugin.c file looks like this: #include stdlib.h #include gtk/gtk.h #include libmyplugincallbacks.h #define GUI libmyplugingui.ui int startplugin(){ extern *mainBuilder; GtkBuilder *subbuilder; //Do things like attach the glade file into the main glade file. gtk_builder_connect_signals (builder, NULL); } My libmyplugincallbacks.h #include gtk/gtk.h void myfunc (GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data); My libplugincallbacks.c #ifdef HAVE_CONFIG_H # include config.h #endif #include libmyplugincallbacks.h #include string.h void myfunc(GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data){ if (GTK_IS_ENTRY (editable)) { //Do stuff } } When I compile my program, the .so file compiles properly. However, when ever I run the program, it loads the .so file. Once GTK builder gets to the stage where it connects the signals, it will complain that myfunc cannot be found. I have double checked the name of the function in my glade file and it is spelt and entered correctly. You generally need to export your symbols by linking the app with --export-dynamic flag: pkg-config --libs gmodule-2.0 Should do the right thing to make your symbols visible. 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: Callbacks when glade file is loaded using a dynamic library
If you have symbols that need to be visible in 'myapp', they need to be exported to in order to by found by a g_module_lookup(); did you also export the symbols of you app ? Cheers, -Tristan On Thu, Apr 22, 2010 at 9:53 PM, dfg dfg abx...@msn.com wrote: Thank you Tristan. I actually tried the --export-dynamic flag before posting, but could not get it to work. I feel that it is most likely a problem in my makefile.am (I am using automake and libtool to generate the makefiles). Here is the make file for the compilation of the dynamic library: libmyplugin= / libmyplugin_LTLIBRARIES=libmyplugin.la libmyplugin_la_SOURCES=libmyplugin.c libmyplugincallbacks.c include_HEADERS = libmyplugincallbacks.h libmyplugin_la_LDFLAGS= -lc -lgcc -avoid-version @PACKAGE_LDFLAGS@ libmyplugin_la_LIBDADD = --export-dynamic @PACKAGE_LIBS@ INCLUDES = @PACKAGE_CFLAGS@ Here is my configure.ac AC_PREREQ(2.59) AC_INIT(myapp, 1.0) PKG_CHECK_MODULES(GTK, gtk+-2.0 gmodule-2.0 gmodule-export-2.0) PACKAGE_CFLAGS=-g -Wall $GTK_CFLAGS PACKAGE_LIBS=-g $GTK_LIBS -ltar PACKAGE_LDFLAGS=-Wl, --export-dynamic $GTK_LDFLAGS AC_SUBST(PACKAGE_CFLAGS) AC_SUBST(PACKAGE_LIBS) AC_SUBST(PACKAGE_LDFLAGS) AM_PROG_LIBTOOL AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE() AC_PROG_CC AC_CONFIG_FILES(Makefile src/Makefile src/modules/Makefile src/modules/libmyplugin/Makefile) AC_OUTPUT For some reason though, callbacks in myapp the main app that loads in the .so files work fine. Any ideas appreciated. :) Date: Thu, 22 Apr 2010 21:37:48 -0400 Subject: Re: Callbacks when glade file is loaded using a dynamic library From: t...@gnome.org To: abx...@msn.com CC: gtk-app-devel-list@gnome.org On Thu, Apr 22, 2010 at 7:21 PM, dfg dfg abx...@msn.com wrote: Hi everyone, Currently, I have built my main application using glade. This file is then loaded by a C application. I then created another interface using Glade. When my main application loads, it loads a .so library which contains code for this subsection (kind of like a plugin). The .so file loads in the second glade file and attaches it into the interface of the main application. This all works problem. The problem I am facing now is that gtk_builder_connect_signals (builder, NULL); does not work. For my .so file, i have 3 files: -libmyplugin.c -libmyplugincallbacks.h -libmyplugincallbacks.c My code for the libmyplugin.c file looks like this: #include stdlib.h #include gtk/gtk.h #include libmyplugincallbacks.h #define GUI libmyplugingui.ui int startplugin(){ extern *mainBuilder; GtkBuilder *subbuilder; //Do things like attach the glade file into the main glade file. gtk_builder_connect_signals (builder, NULL); } My libmyplugincallbacks.h #include gtk/gtk.h void myfunc (GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data); My libplugincallbacks.c #ifdef HAVE_CONFIG_H # include config.h #endif #include libmyplugincallbacks.h #include string.h void myfunc(GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data){ if (GTK_IS_ENTRY (editable)) { //Do stuff } } When I compile my program, the .so file compiles properly. However, when ever I run the program, it loads the .so file. Once GTK builder gets to the stage where it connects the signals, it will complain that myfunc cannot be found. I have double checked the name of the function in my glade file and it is spelt and entered correctly. You generally need to export your symbols by linking the app with --export-dynamic flag: pkg-config --libs gmodule-2.0 Should do the right thing to make your symbols visible. Cheers, -Tristan Hotmail Messenger. Get them on your phone now. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Glade3: Setting TreeModel in GtkComboBox
On Sat, Mar 13, 2010 at 1:10 AM, Ardhan Madras aj...@knac.com wrote: From: Tristan Van Berkom t...@gnome.org To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Subject: Re: Glade3: Setting TreeModel in GtkComboBox Date: Tue, 9 Mar 2010 10:13:59 -0500 As the combo box implements GtkCellLayout, you can use that interface to add renderers (but you should be able to add renderers in Glade as well, did you hit the Edit.. button in the toolbar with the combo box selected ?). Ahh.., i use the right panel to modify the combo box, when I used the 'Edit..' button, i see a 'Hierarchy' tab to costumize it's cell-renderer. That's I'm looking for, the combo box is now display it's entries with GtkBuilder. But what you are missing is cell renderers (one will be implicitly created by setting the text column for the combo box, iirc). For manually creating a combo box in code, i still use gtk_combo_box_new_text() API, i have no success when writing combo box with GtkTreeModel API. Such this previous code: ... GtkWidget *combo = (GtkWidget*) gtk_builder_get_object (builder, Combo1); GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store)); gtk_list_store_append (store, iter); gtk_list_store_set (store, iter, 0, test, -1); ... How to create a column, a cell renderer and apply them into the combo-box? You dont use GtkTreeColumn, those are particular to GtkTreeView. You can add renderers to the combo by way of the GtkCellLayout interface which the combo box implements. Cheers, -Tristan - Ardhan _ Listen to KNAC, Hit the Home page and Tune In Live! --- http://www.knac.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Glade3: Setting TreeModel in GtkComboBox
On Tue, Mar 9, 2010 at 7:07 AM, Ardhan Madras aj...@knac.com wrote: Im using Glade 3.6.7 and GTK+ 2.18.7, build UI with Glade and save as GtkBuilder format. I don't understand how GtkBuilder implements GtkComboBox's TreeModel, in Glade i already add it's model, create a column and append some entries. But i didn't see anything listed in that combo box (empty). I try to manually create it's TreeModel in codes and apply: ... GtkTreeIter iter; GtkWidget *combo = (GtkWidget*) gtk_builder_get_object (builder, Combo1); GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store)); gtk_list_store_append (store, iter); gtk_list_store_set (store, iter, 0, test, -1); ... I still have an empty GtkComboBox. Did i miss something here? For a single column text store I believe there is a convenience function to tell the combo box which column to pull text from. But what you are missing is cell renderers (one will be implicitly created by setting the text column for the combo box, iirc). As the combo box implements GtkCellLayout, you can use that interface to add renderers (but you should be able to add renderers in Glade as well, did you hit the Edit.. button in the toolbar with the combo box selected ?). Cheers, -Tristan - Ardhan _ Listen to KNAC, Hit the Home page and Tune In Live! --- http://www.knac.com ___ 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: Array of arrays
On Sat, Feb 27, 2010 at 9:50 PM, Brian Lavender br...@brie.com wrote: I guess the list stripped the attachments. The code is included in this message. Hi, First of all it would be helpful if you told us what is the problem with your code, off the bat I could tell you that the way you pass a pointer to an array of pointers is foreign to me, I think I would have just used GArray ***arrays_p; for that argument. But on the other hand, you could just save yourself that headache and use a GPtrArray of GArrays (you could even get carried away and whip up an api that updates the values of ptrarray-pdata[i] = garray-data and have a real indexable array in C...). Cheers, -Tristan brian On Sat, Feb 27, 2010 at 06:47:30PM -0800, Brian Lavender wrote: I was experimenting with creating an array of arrays. Maybe I shouldn't be using GArray but something different such as pointer arrays and allocating memory for each element? I wrote two sample programs. The first one, just loads one array. The second, loads an array of arrays. I don't know if I have a problem with operator precedence or if the GArrays point to just one array. The two programs are the following. simplearray.c - loads just one array simplearray2.c - loads an array of arrays Any input is appreciated. === simplearray.c === #include glib.h #define NUM_ARYS 5 void load_array( GArray **garray) { gint i, storevalue; *garray = g_array_new (FALSE, FALSE, sizeof (gint)); for (i = 0; i 10; i++) { storevalue = (i + 103) % 45; g_array_append_val (*garray, storevalue); } } int main() { GArray *garray[NUM_ARYS]; gint i, storevalue; /* We create a new array to store gint values. We don't want it zero-terminated or cleared to 0's. */ load_array(garray[0]); for (i = 0; i 10; i++) g_print (index %d value %d\n, i, g_array_index (garray[0], gint, i)); g_array_free (garray[0], TRUE); } === simplearray2.c === #include glib.h #define NUM_ARYS 5 void load_array( GArray *(*garray)[NUM_ARYS] ) { gint i,j, storevalue; for (j=0; j NUM_ARYS; j++) { (*garray)[j] = g_array_new (FALSE, FALSE, sizeof (gint)); g_printf(Load Array %d\n, j); for (i = 0; i 10; i++) { storevalue = (i + 103) % ( (j +1) * 2 ); g_array_append_val ( (*garray)[j], storevalue ); g_print (load idx %d value %d\n, i, storevalue ); } } } int main() { GArray *garray[NUM_ARYS]; gint i,j, storevalue; /* We create a new array to store gint values. We don't want it zero-terminated or cleared to 0's. */ load_array(garray); for (j=0; j NUM_ARYS; j++) { g_printf(Array %d\n, j); for (i = 0; i 10; i++) g_print (index %d value %d\n, i, g_array_index (garray[1], gint, i)); } for (j=0; j NUM_ARYS; j++) g_array_free (garray[j], TRUE); } -- Brian Lavender http://www.brie.com/brian/ About 3 million computers get sold every year in China, but people don't pay for the software. Someday they will, though. As long as they are going to steal it, we want them to steal ours. They'll get sort of addicted, and then we'll somehow figure out how to collect sometime in the next decade. -- Bill Gates (Microsoft) 1998 ___ 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: Getting a Widget Choice
You should always prefer using either gtk_builder_get_object(), or also using trustable API's like gtk_button_get_image_widget() for instance. (not sure if thats an existing api, but you get the idea). I.e. the composition of opaque composite widgets from GTK+ can change, possibly breaking unwary code which walks through the hierarchy checking widget types. Also, the composition of your GtkBuilder file may change, if you always access the elements by the keys you provide (i.e. the name field right now) then you wont run into trouble when changing your interface in the future. Cheers, -Tristan On Sat, Feb 20, 2010 at 9:04 AM, dhk dhk...@optonline.net wrote: When a widget can be gotten by using GTK builder functions or GTK Widget functions, does it make a difference, or is one way better than the other, for finding the widget. For example when I can get the same widget using either of the following two calls, which one should I use and why? GtkWidget *nb=NULL; /* A notebook widget */ /* Call 1 */ nb=GTK_WIDGET(gtk_builder_get_object(gtk_builder, notebook_name)); /* Call 2 */ nb=gtk_widget_get_ancestor(widget, GTK_TYPE_NOTEBOOK); Thanks, dhk ___ 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: specify which child widget to be on top in GtkFixed?!
Widgets dont overlap in GTK+, instead one widget is packed into another widget and sits along side other widgets inside its container - who packs them in a way that they will not overlap. FYI, GtkFixed is a special case widget you dont want to be using if your application has any resize capabilities at all (yes, GtkFixed places widgets on top of eachother when you forgot to place them with enough space between them, because GtkFixed assumes you are using all the width/height available; but there is no conceptual Z coordinate). If you need to have widgets that overlap, you might consider using a canvas api (like goocanvas for instance), or maybe use clutter. Cheers, -Tristan On Tue, Feb 9, 2010 at 9:21 AM, ferar achkar fachkar.dataw...@gmail.com wrote: greetings, I'm having trouble with GtkFixed and their children, how can I specify which child widget to be on top. In the code snippet below no matter were I create the TextEntry it always get drawn on top of the other widgets! how can specify which child widget to be on top of the others at run time / or at compile time. regards, ferar /*** * Copyright (C) 2009 by ferar * * fe...@druid * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***/ #include gtk/gtk.h #include string using namespace std; GtkWidget* fixedviewo = NULL; GtkWidget* FocusEntry = NULL; GtkWidget* next_cache_page = NULL; GtkWidget* prev_cache_page = NULL; gint x=5; gint y=5; gint x2=5; gboolean OnLabelButtonPress ( GtkWidget *widget, GdkEventButton *event, gpointer user_data ) { // GList *children = gtk_container_get_children ( GTK_CONTAINER ( fixedviewo ) ); // // while ( children ) // { // string typeo (g_type_name( GTK_WIDGET_TYPE( children-data ) )); // if(typeo == GtkButton) // { // gint xx, yy; // gdk_window_get_origin(((GtkWidget*)( children-data ))-window,xx,yy); // const gchar* labelo = gtk_button_get_label ((GtkButton*)( children-data )) ; // printf(Type: %s, Label is: %s\n,typeo.c_str(), labelo); // } // // children = g_list_next ( children ); // } x+=4; x2+=6; gtk_fixed_move ( GTK_FIXED ( fixedviewo ), next_cache_page, x++, y++ ); gtk_fixed_move ( GTK_FIXED ( fixedviewo ), prev_cache_page, x2, y ); return FALSE; } int main ( int argc, char **argv ) { /* Initialization */ gtk_init ( argc, argv ); GtkWidget* splash_widget = gtk_window_new ( GTK_WINDOW_TOPLEVEL ); gtk_window_set_position ( GTK_WINDOW ( splash_widget ), GTK_WIN_POS_CENTER_ALWAYS ); gtk_window_set_gravity ( GTK_WINDOW ( splash_widget ), GDK_GRAVITY_CENTER ); g_signal_connect ( G_OBJECT ( splash_widget ), destroy, G_CALLBACK ( gtk_main_quit ), NULL ); GtkWidget* vbox = gtk_vbox_new ( FALSE, 0 ); gtk_container_add ( ( GtkContainer* ) splash_widget, vbox ); GtkWidget* progress_spitout = gtk_button_new_with_label ( move the buttons up ); g_signal_connect ( ( gpointer ) progress_spitout, pressed, G_CALLBACK ( OnLabelButtonPress ), NULL ); fixedviewo = gtk_fixed_new (); gtk_widget_show ( fixedviewo ); gtk_container_add ( GTK_CONTAINER ( vbox ), fixedviewo ); FocusEntry = gtk_entry_new (); gtk_fixed_put ( GTK_FIXED ( fixedviewo ), FocusEntry, 10, 0 ); prev_cache_page = gtk_button_new_with_label ( GTK_STOCK_GO_BACK ); gtk_fixed_put ( GTK_FIXED ( fixedviewo ), prev_cache_page, 30, 0 ); // gtk_widget_set_size_request ( prev_cache_page, 60, 26 ); gtk_widget_show ( prev_cache_page ); next_cache_page = gtk_button_new_from_stock (
Re: Problem swapping GtkScrolledWindow contents on the fly
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 ajw...@theiet.org 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 ___ 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
On Thu, Dec 24, 2009 at 6:40 PM, Andrew Wood ajw...@theiet.org wrote: 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. You mean it works or you mean the code executes and assigns a NULL pointer to your widget pointer the first time around ? From the warnings you printed, 'generalpage' is not a widget, so maybe it was not found in the glade file, or maybe it was somehow destroyed by some other code fragment in your app along the way. Cheers, -Tristan Cheers, -Tristan On Thu, Dec 24, 2009 at 11:29 AM, Andrew Wood ajw...@theiet.org 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 ___ 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
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 sinked the first time you add it somewhere, when you remove it the first time; its destroyed because you dont have a reference. Cheers, -Tristan On Thu, Dec 24, 2009 at 7:06 PM, Tristan Van Berkom t...@gnome.org wrote: On Thu, Dec 24, 2009 at 6:40 PM, Andrew Wood ajw...@theiet.org wrote: 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. You mean it works or you mean the code executes and assigns a NULL pointer to your widget pointer the first time around ? From the warnings you printed, 'generalpage' is not a widget, so maybe it was not found in the glade file, or maybe it was somehow destroyed by some other code fragment in your app along the way. Cheers, -Tristan Cheers, -Tristan On Thu, Dec 24, 2009 at 11:29 AM, Andrew Wood ajw...@theiet.org 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 ___ 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
On Tue, Dec 22, 2009 at 1:27 PM, Andrew Wood ajw...@theiet.org 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 No you cannot assign a value to the return value of gtk_bin_get_child(). Use: gtk_container_remove (GTK_CONTAINER (scrollview), gtk_bin_get_child(GTK_BIN(scrollview))); Cheers, -Tristan ___ 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: Creating an aggregating GtkContainer
On Wed, Nov 18, 2009 at 5:40 PM, Per Hermansson hermansson@bredband.net wrote: Brian J. Tarricone wrote: On Wed, Nov 18, 2009 at 10:35, Per Hermansson hermansson@bredband.net wrote: My question is if someone knows a good way to implement this. I've tested with estimating the widgets size and if the sum of all children is larger then the container the next sub-container is used. One problem is that the widget's size is not known until the widget gets visible so I need to workaround that. Without thinking about this too much (so this may not fit your code or use model), you could defer placing widgets in subcontainers until the container is realized. At that point you'll know their sizes. -brian Thanks, this is actually an requirement for me (which I forgot to mention) the widgets are created at runtime, after containers are realized (when a new printer is selected) but the subcontainers are placed by glade (before the window is realized). Is there a way to after the containers (but before widgets) are realized detect if a widget will overflow a container? Maybe a simple answer to your question is, since usually the base size request for your interface is going to depend on system preferences, such as if buttons will display icons, or the fonts used in labels and the default sizes that they are using, it is impossible to guess exactly the size of a widget before actually mapping it and going through the size-request rigamarole. You might consider using a scrolled window that may not appear in most cases, but will allow for some level of overflow tolerance in your dynamic UI. 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: Creating an aggregating GtkContainer
On Wed, Nov 18, 2009 at 7:22 PM, Per Hermansson hermansson@bredband.net wrote: Tristan Van Berkom wrote: On Wed, Nov 18, 2009 at 5:40 PM, Per Hermansson hermansson@bredband.net wrote: Thanks, this is actually an requirement for me (which I forgot to mention) the widgets are created at runtime, after containers are realized (when a new printer is selected) but the subcontainers are placed by glade (before the window is realized). Is there a way to after the containers (but before widgets) are realized detect if a widget will overflow a container? Maybe a simple answer to your question is, since usually the base size request for your interface is going to depend on system preferences, such as if buttons will display icons, or the fonts used in labels and the default sizes that they are using, it is impossible to guess exactly the size of a widget before actually mapping it and going through the size-request rigamarole. You might consider using a scrolled window that may not appear in most cases, but will allow for some level of overflow tolerance in your dynamic UI. Cheers, -Tristan Thanks, maybe I'm asking for the impossible :) Say I use a scroll window for the different subcontainers to allow some overflow. Would it be possible to listen for signals on the containers and when the widgets have gotten their size allocated move them if the scrollbars became visible as a result of this. The user will then probably experience some flicker as containers are repainted and widgets moved. Would this be reasonable/possible to implement? First lets clarify, you are writing a container implementation, technically you allocate space for the children, usually according to the size they requested. So best not hook onto signals before properly implementing -size_allocate() and -size_request() for your composite widget (from there you should be able to manage all the main children - when reparenting a child this should be all automatic, maybe theres a need for gtk_container_check_resize() in some corner cases I couldnt say off hand). Somehow I doubt that you want to move widgets around based on size reallocation, I think that a well designed application layout should just stand alone and widgets jumping around will confuse the user more than anything else. At any rate, there are nice things you can do like making sure an important widget in the undetermined size window gets focus and is visible inside the scrolled window - or remembering scroll positions of various tabs when they get replaced or reloaded or such. 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: using doxygen to document gobject/gtk classes?
On Tue, Nov 17, 2009 at 12:22 AM, Brian J. Tarricone bj...@cornell.edu wrote: Hi all, I'm in a situation where I'd like to use doxygen (and not gtk-doc) to document some GObject-derived classes. Does anyone have any experience with this and knows of any tricks to use to make the output more useful? I found one link via google[1] that referred to this, but it didn't have much useful info. Specifically, here are the problems I'm having: 1. If I have a final GObject class (only the typedef for the struct in the .h file, with the struct definition in the .c file), the symbol is showing up as struct _Foo in the doxygen docs, instead of just Foo. 2. I can't seem to figure out how to get documentation for signals and properties into the docs. 3. Possibly related to #1, I'm not sure how to make the docs understand the class hierarchy. The \extends command in doxygen doesn't seem to be working for me. I doubt that what you are trying to do is worth your while. For instance, signals and properties and I would dare say even the class hierarchy - is not at all derived from source code scanning; gtk-doc compiles a tool against your code to programmatically introspect the signals (Im sure at least about the signals), and probably also the properties and class hierarchy. The compiled tool creates some templates, and then, insert black magick with sgml scanners/lexers/forms and doxygen and html stuff that a simple C programmer like me would not understand ;-) ... THEN you get the docs. AFAICS, any attempt to get GObject documentation straight and objecty with doxygen, would be a world of work, that would be a direct duplication of the work already done on gtk-doc (which btw, works alot better than it did 4 years ago). Heres an off the wall idea: use gobject-introspection combined with some code generator and generate a C++ or javascript binding to your code, and run that stuff by doxygen instead ;-) 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: why do constructors return GtkWidget?
On Thu, Sep 10, 2009 at 2:12 PM, Thomas Stover tho...@wsinnovations.com wrote: [...] Indeed. Not building interfaces manually may save time now and then, but it hinders your understanding of what is happening. For instance when you want to dynamically make interface changes at run time your left with simple hide show tricks. I can remember more than once when I wanted to tweak someone else's UI so as to do something like add a button that breaks out some widgets into a new window or adds some more widget filled h/vboxes in the mix, only to start looking at the code and see no code. Simple things become intrusive. Using helper tools is fine and wonderful, just don't strive for oversimplifying everyone else's world. Im not exactly sure what your trying to say, my understanding is that in the modern world you create widget subclasses when you need composite/dynamic widgets, all widgets are generally layed out in some kind of form, or multiple forms. Thats my understanding of the bleeding edge of the GUI, I think the OSX tools (Xcode/Interface Builder) are a little bit ahead of us on this front ... but not by much, considering that what we can potentially pull off is not restricted to Obj-C or any particular platform. Ofcourse I dont always read the headlines, so I would love to hear what other people think is the bleeding edge to strive for in the world of GUI development, really. 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: why do constructors return GtkWidget?
On Thu, Sep 10, 2009 at 3:24 PM, Thomas Stover tho...@wsinnovations.com wrote: [...] Well that's pretty much how I see it, but creating new derived widgets is not always the same thing as dynamic interface manipulation. The issue that grabbed my attention more was the notion of always using GtkBuilder. I'm just saying I love the ability create and manipulate an entire interface in code the old fashion way. Being old and crusty (I'm 29), I take pleasure in questioning fashionable, main stream, sacred cow, gratuitously overused, technology. Near the top of that list is anything to do with XML. I miss the more agitated-old-timer-at-the-bar C code or die attitude that once was synonymous with the way I perceived FOSS. So while some articulate clearly of bleeding edge, I'll keep mumbling about often forgotten romantic concepts of yesteryear like fun. Gah, I turned 30 this year !!! haha My opinion here is that things change, the code we wrote in the last 10 years can be here to stay, like we dont have to go and write it again. Instead the tasks that used to take time can now be considered script monkey tasks, and the rest of us C code or die hackers can move on to more interesting things that give more leverage to the young and upcoming script monkeys which may one day mature into real hackers ;-) This is my sales pitch to get hackers to help me actually write Glade in C, which I bet is still alot more fun than writing up interfaces using Glade or straight C, ... any takers ;-P 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: why do constructors return GtkWidget?
On Wed, Sep 9, 2009 at 2:53 AM, Emmanuel Touzeryemmanuel.touz...@free.fr wrote: Hi, [...] You know what I'm thinking... I think that this is from times where people used to build GUIs in the code... When they were writing all the container embedding and all, in C, building their dialogs. At that time that convention surely helped, you were constantly adding widgets to containers and so on. Today this is done in gtkbuilder and so what we have left is code not doing so much embedding in code (though obviously it happens) but Yes I would say its a historical thing, and I certainly hope that using GtkBuilder can be the standard in the end (I guess we still have lots of ground to cover). 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: why do constructors return GtkWidget?
On Tue, Sep 8, 2009 at 12:54 PM, Emmanuel Touzeryemmanuel.touz...@free.fr wrote: Hi, Whatever type is returned, you'll have to do lots of casts, so whatever convention is used, there's no avoiding that. And returning GtkWidget* is just the current convention. I personally would prefer correct types to be used in the API, just to show exactly what type to expect at runtime. But that's a separate issue. Thank you for the answer. If it doesn't make a technical difference I think returning the actual type would be much more useful, for documentation purposes. In the case of gtk_menu_shell_append() from the prototype you would think that it can take any GtkWidget and only the comment tells you that only GtkMenuItem* will do. There is a technical difference when writing GTK+ code in C; for instance its quite often that you will access methods on the GtkWidgetClass (like show()/hide()/set_sensitive() etc), also many other apis take GtkWidget * argument, namely GtkContainer apis which operate on child widgets. From this standpoint its alot more convenient to cast all your widget variables as GtkWidget * (this way you keep casting to a minimum in your code) so GTK+ is only helping you by returning GtkWidget *, if only for a simple and practical reason to save you a little casting/typing. 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: csv (comma separated value) file
On Mon, Aug 3, 2009 at 12:03 PM, Andrea Zagliaza...@inwind.it wrote: i didn't find nothing about to manage (read/write) csv files with glib do you know about something that i didn't find? Currently its pretty easy using g_file_get_contents()/g_strsplit() if you can have it all in ram, or using GIO and again, g_strsplit() on a per line basis if you need to stream it. 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: csv (comma separated value) file
On Mon, Aug 3, 2009 at 1:21 PM, Liam R E Quinl...@holoweb.net wrote: On Mon, 2009-08-03 at 12:45 -0400, Tristan Van Berkom wrote: [...] Currently its pretty easy using g_file_get_contents()/g_strsplit() CSV files are not just comma separated, and in some cases can have column headers and other metadata. There's also escaping. a,b,c\d,e a,b,c,d,e a;b;c,d;e I see that was an uneducated comment on my part ;-) (I have been doing alot of *simple* csv parsing with glib lately that doesnt have these kind of requirements). Sorry for the noise ;-) Dont have much of an opinion if it should be in glib, we have GKeyFile wich does similar high-levelish stuff already so it might be a suitable addition. Cheers, -Tristan (interestingly my own use-case, would be a mix of both - a fixed length keyfile like header, with variable length trailing csv data). You also have to deal with differing line ending conventions. It's enough of a mess that both MS Office and most other office programs today seem o use XML instead :-) Probably gnumeric has code for this, though. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Is there any way to match a key event against key binding rules for GtkTextView class without creating a GtkTextView object?
On Sun, Jul 26, 2009 at 11:21 PM, Zhe Sujames...@gmail.com wrote: Can anybody give me some suggestions about this issue? Im not sure exactly how the keybindings are defined in the theme, but my guess is that you need to derive your custom object from GtkTextView if you want to inherit the keybindings. Think of it this way, the person who wrote the theme, wrote explicit style properties explicitly for textview classes, so the theme writers bindings to the textview should only apply to textview and subclasses. On the other hand, you *can* write completely different classes, and define style properties which you can later define in your own theme, if you dont care about picking up what people already put in the available stock GTK+ themes. Cheers, -Tristan On Fri, Jul 24, 2009 at 5:16 PM, Zhe Su james...@gmail.com wrote: Hi, GtkTextView widget can use key binding rules defined in gtkrc file. For example, when Emacs key theme is selected, ctrl-w will be mapped to cut-clipboard signal. Now, I'm developing a custom widget and want to handle those key bindings supported by GtkTextView. After reading the source code of gtkwidget, yI found that gtk_bindings_activate_event() is used for matching activating key bindings for a specific object. However this function can only match and activate key bindings explicitly defined for a specific object type. So if I want to match and activate all key bindings supported by GtkTextView, a GtkTextView object must be used when calling this function. Now the question is: is it possible to retrieve the information of all key bindings defined for GtkTextView and apply them to my custom widget, so that gtk_bindings_activate_event() can work with my custom widget object as if it's a GtkTextView object? Regards James Su ___ 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: Copying widgets
On Sun, Jul 12, 2009 at 3:27 PM, Jim Georgejimgeo...@gmail.com wrote: Hi all, I'm writing a program that, like gimp, has a control window, from which users can open one or more viewer windows that present different aspects of a data set (it's a weather radar display program). The sub-windows are identical, and I'm using libglade and glade-3 to do the interface layouts. Currently, I call glade_xml_new each time I want to create a new window. Is there a better way, which prevents libglade from having to parse the XML each time? Sure, you can build the dialog at startup time or on demand the first time, but just hide it and show it on demand. Also, I'm interested in moving to GtkBuilder. Do I use different xml files for each window and create a new GtkBuilder object for each new viewer window, or is there a smarter way? GtkBuilder works pretty much the same way, but GTK+ now inherits the parsing code, so you cannot build a GTK+ interface from a GtkBuilder format file without running the actual parsing code from the widgets (which I guess is one thing libglade provides that GtkBuilder does not; the ability to compile the glade file into a binary and completely replace the parser). 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: GtkBuilder and GtkHScale
On Thu, Jul 2, 2009 at 1:54 PM, Tadej Borovšaktadeb...@gmail.com wrote: Hello. hi all, i'm trying to develope a small application with the help of glade. Is it a normal behaviour that when i set the upper limit of a GtkHscale, i need tu use a value bigger than the needed one by 10 units? (if i need the upper bound to be 10, i need to set it to 20). I tought about a problem of glade, but the generated glade file contains the value used in the gui. I imagine it should be a problem of gtkbuilder. What do you think about this? My guess would be that you forgot to set page size property of scale to 0. Default page size is 10, and this is where the offset you experience comes. We also have a bug about what order we save properties for GtkAdjustment, we need to insert code to order them with care (set lower, then higher, then value), otherwise we sometimes load with bogus configurations. 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: What is Gtk builder?
On Mon, Jun 22, 2009 at 6:22 PM, dhkdhk...@optonline.net wrote: I hate to ask what everyone seems to know, but what is gtk builder? Is it part of Glade 3.4.5? I don't see any gtk builder packages or libraries in the Gentoo portage tree. Also does this mean all my Glade programs are obsolete? GtkBuilder is a new api in GTK+ since 2.12 and it does essentially what libglade did (libglade is now deprecated in favour of the builder). GtkBuilder also provides GtkBuildable interface allowing GTK+ widgets (or third party widgets) to handle the parsing phase in custom ways. No Glade 3.4 does not understand GtkBuilder format, you need 3.6 for that. (Glade 3.6 will also allow you to convert your old libglade projects into the new GtkBuilder format). 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: Call to gtk_main() crashes
On Wednesday, April 29, 2009, RNG rga...@gmail.com wrote: Hi, following your suggestion, I've added a call to gtk_init() at the beginning of main() but the program still crashes. The end of the stack trace now displays a different memory address but otherwise it's essentially the same All I read from the stack trace is a possible double free in a clicked handler, you say this happens at startup ? Do you programatically somehow send events from an idle or such? -Tristan -- snip -- #21 0xb7846036 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #22 0xb73f03c9 in ?? () from /usr/lib/libgobject-2.0.so.0 #23 0xb73f1c4b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #24 0xb7407d3d in ?? () from /usr/lib/libgobject-2.0.so.0 #25 0xb740962b in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #26 0xb7409c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #27 0xb795b33e in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #28 0xb783eb4c in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0 #29 0xb783fef7 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #30 0xb76d650a in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #31 0xb7364718 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #32 0xb7367dc3 in ?? () from /usr/lib/libglib-2.0.so.0 #33 0xb73682e2 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #34 0xb78403a9 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0 #35 0x0805688a in main (argc=Cannot access memory at address 0x ) at main.c: Any more ideas as to what could be wrong? Greetings/Thanks Robert 2009/4/29 Fernando Apesteguía fernando.apesteg...@gmail.com: On Wed, Apr 29, 2009 at 8:38 AM, RNG rga...@gmail.com wrote: Hi, I am trying to get an old application to work using glade2. I've managed to get it to compile but the call to gtk_main(); crashes the application. The backtrace looks like this: (gdb) bt #0 0xb8041422 in __kernel_vsyscall () #1 0xb7244880 in raise () from /lib/tls/i686/cmov/libc.so.6 #2 0xb7246248 in abort () from /lib/tls/i686/cmov/libc.so.6 #3 0xb728210d in ?? () from /lib/tls/i686/cmov/libc.so.6 #4 0xb72883f4 in ?? () from /lib/tls/i686/cmov/libc.so.6 #5 0xb73f8c26 in g_free () from /usr/lib/libglib-2.0.so.0 #6 0xb748b3d4 in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0 #7 0xb747dc4b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #8 0xb7494095 in ?? () from /usr/lib/libgobject-2.0.so.0 #9 0xb74957ac in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #10 0xb7495c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #11 0xb781deaa in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0 #12 0xb781ef58 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #13 0xb748b3d4 in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0 #14 0xb747c3c9 in ?? () from /usr/lib/libgobject-2.0.so.0 #15 0xb747dc4b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #16 0xb74938ee in ?? () from /usr/lib/libgobject-2.0.so.0 #17 0xb74957ac in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #18 0xb7495c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #19 0xb781df4a in gtk_button_released () from /usr/lib/libgtk-x11-2.0.so.0 #20 0xb781df83 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #21 0xb78d2036 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #22 0xb747c3c9 in ?? () from /usr/lib/libgobject-2.0.so.0 #23 0xb747dc4b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #24 0xb7493d3d in ?? () from /usr/lib/libgobject-2.0.so.0 #25 0xb749562b in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #26 0xb7495c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #27 0xb79e733e in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #28 0xb78cab4c in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0 #29 0xb78cbef7 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #30 0xb776250a in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #31 0xb73f0718 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #32 0xb73f3dc3 in ?? () from /usr/lib/libglib-2.0.so.0 #33 0xb73f42e2 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #34 0xb78cc3a9 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0 #35 0x08056842 in main (argc=Cannot access memory at address 0x12ff ) at main.c:278 (gdb) Any ides what may be causing this and how to fix it? Do you call gtk_init() before doing any other gtk related tasks? If you are using threads, do you call gdk_threads_init() and use gdk_threads_enter() and gdk_threads_leave()? Cheers Greetings/Thanks Robert ___ 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: Single letter accelerator and GtkEntry
On Tue, Apr 28, 2009 at 10:34 AM, Olivier Guilyardi m...@xung.org wrote: Hi, I'm working on an audio app. In my menu I have single letters accelerators such as Z or space, which are 100% needed for consistency with other audio applications around. These accelerators works. However, it isn't possible to enter the binded letters into a GtkEntry. Before I go and hack something... When the GtkEntry is focused, wouldn't there be a clean way to make it handle the keys and stop event propagation? Copy this code ;-) http://git.gnome.org/cgit/glade3/tree/gladeui/glade-utils.c : glade_utils_hijack_key_press() 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: Porting UIs to GtkBuilder
On Wed, Apr 15, 2009 at 9:59 AM, Zeeshan Ali (Khattak) zee...@gmail.com wrote: Hi, [...] Errr, try converting with Glade 3.6 instead of the conversion script ? I just tried glade3 from trunk[1]. One of the three UIs just work fine now but two others don't. One of them hits a fatal on startup: console $ gupnp-universal-cp Gtk-Message: Failed to load module atk-bridge: libatk-bridge.so: cannot open shared object file: No such file or directory ** (gupnp-universal-cp:12727): CRITICAL **: Unable to load the GUI file /opt/gnome2/share/gupnp-tools/gupnp-universal-cp.ui: Unknown internal child: image /console The other one has some minor issues that i might be able to figure on my own: console (gupnp-av-cp:13063): Gtk-WARNING **: Cannot add an object of type GtkMenu to a container of type GtkMenuItem (gupnp-av-cp:13063): Gtk-WARNING **: Cannot add an object of type GtkMenu to a container of type GtkMenuItem (gupnp-av-cp:13063): Gtk-WARNING **: No object called: (gupnp-av-cp:13063): Gtk-WARNING **: No object called: /console Did Glade at least give you a warning after loading the old Glade file, converting it and saving it (at save time) ? It looks like either a.) You did not convert the old Glade file using Glade and or b.) You are running an old version of GTK+ unsupported by your Glade file (there should be a requires tag specifying the minimum required version, configure this from your project's preferences dialog). Note that GTK+ 2.16 does not natively support building of menus and that Glade 3.6 only converts to native menu representation (i.e. no roundabout building of uimanagers that build menus). I am extra curious about how you ended up with an internal image in a GtkImageMenuItem (if I'm guessing your Glade file correctly), those are supposed to be internal only in libglade format and referenced (by object type property) in GtkBuilder format. 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: How to send user_data into callback function by glade only?
On Tue, Apr 14, 2009 at 10:46 AM, donglongchao donglongc...@163.com wrote: [...] And I want to show the value of myspinbutton by pass its point to callback function.But every time I click the button there is no response.Just left (gtk_toggle_button_get_active): assertion `GTK_IS_TOGGLE_BUTTON (toggle_button)' failed. But if i do not pass the spinbutton, and the function only have one para(GtkButton *checkbutton1), it works,no error,no warning. I do not know why.Any one could help?Thanks. With libglade, if you specify an object... it is like reffering to prehistoric gtk_signal_connect_object(), which swaps your instance/user-data arguments free-of-charge, allowing for direct hooking up of function calls from within Glade. i.e. connect to button1 clicked, specify window1 as the object, and then just put gtk_widget_hide as the callback... you just wrote a button that closes the window without any code... Yeah its a little awkard an unclear... just forget about it ;-) 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: Porting UIs to GtkBuilder
On Tue, Apr 14, 2009 at 4:50 PM, Zeeshan Ali (Khattak) zee...@gmail.com wrote: Hi, Reading through planet gnome and related mailing-lists recently, I got the impression that this would be a good time to port my UIs from libglade usage to GtkBuilder. So following the guidelines on this page: http://library.gnome.org/devel/gtk/stable/gtk-migrating-GtkBuilder.html I tried to do so: http://gitorious.org/projects/gupnp-tools/repos/mainline/commits/e8bb5436aa22009b5b312da5a459324382e889c5 Errr, try converting with Glade 3.6 instead of the conversion script ? Thanks in advance, -Tristan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: locking widgit sizes
On Mon, Apr 6, 2009 at 12:23 AM, mick mickh...@bigpond.net.au wrote: I'm using glade 2.12 to build an interface for a GTK based chat client and having trouble locking the size of buttons, text entry, etc. widgits. I've tried setting the height of the container, the height of the text entry the height width of the buttons but when I test the generated code the size of the widgets changes with the size of the 'parent window'. I read the tutorials and the references until my mind glazes over but I can't recognise the solution if its there. can anyone point me to a reference (manual section, web page, forum post) that could get me on track Hi, Please consider dropping generated code, one of the main reasons we dropped generating code was because people would reuse the generated code and it became example code, the other main reason is because our code becomes more managable this way - we dont have to recompile and deal with version conflicts on source files when interfaces change for instance. This code, along with your actual signal callback glue; is pretty much all you will ever need to load your GUI: static void load_ui (const gchar *filename, const gchar *window_name) { GtkBuilder *builder; GError *error = NULL; GtkWidget *window; builder = gtk_builder_new (); if (!gtk_builder_add_from_file (builder, filename, error)) { g_error (%s, error-message); g_error_free (error); return; } window = (GtkWidget *)gtk_builder_get_object (builder, window_name); gtk_window_present (GTK_WINDOW (window)); gtk_main (); g_object_unref (builder); } Now check out 3.6 and enjoy Actions and Treeviews and more :) Cheers, -Tristan thanks in advance, mick ___ 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: Speeding Up libglade
On Tue, Apr 7, 2009 at 1:07 AM, arne arne.pa...@gmx.de wrote: Hello, I am not sure if this solution will save time, If I understood everything right, the xml-parser of libglade must parse in both cases. but isn't it possible to store the output of glade_xml_new() to a file and just load it to memory at startup? People have been known to write binary parsers that replace libglade along with glade file converters for that purpose, but first of all, why arent you using GtkBuilder ? GtkBuilder should by my rough estimate speed things up by just a notch, its a one pass parser whereas libglade was populating an internal database of structures and then building objects in a second pass, using GtkBuilder will also save you memory at startup (no extra local copy of the strings in the interface) not to mention give you access to liststores and actions and sizegroups etc. 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: is this good code?
On Wed, Mar 18, 2009 at 8:25 AM, Dr. Michael J. Chudobiak m...@avtechpulse.com wrote: I've never fully understood the timing issues with signals and callbacks. Is this good or evil (vala) code? public bool ensureConnected () { /* try to connect, if not already connected */ if (!connectButton.get_active()) connectButton.set_active(true); /* are we connected now? */ return connectButton.get_active(); } The last line is support to report back whether or not the preceding set_active(true) was successful. Some error in the code call by the set_active signal could have caused it to revert to the false state. Anyway, I guess the question is: has all code tied to the set_active(true) signal executed before the last line? I dont know vala at all and I can tell you yes this code is perfectly safe, assuming the signal is implemented as a GSignal, which is a pretty safe assumption (someone will soon correct me if I'm wrong though ;-)). Signals in GObject execute synchronously so nothing to worry about. 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: ellipsize expander label
On Sun, Mar 1, 2009 at 9:48 AM, Vladimir Nadvornik nadvor...@suse.cz wrote: Hi, Is it possible to ellipsize expander label? The simple approach does not work for me. expander = gtk_expander_new(NULL); label = gtk_label_new(some longer text); gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); gtk_expander_set_label_widget(GTK_EXPANDER(expander), label); It shows just ... even if there is enough room for the whole text. The label will only request size for the ellipsis if you dont manually set a size request - you could just use a value... ...or... if you want an expand to fit label... I dont know if this is documented anywhere but just take a look at the size_request() and size_allocate_after() functions here: http://svn.gnome.org/viewvc/glade3/trunk/gladeui/glade-editor-property.c?revision=2034view=markup (note the calculation for the child label allocation will be alot simpler if you just wrap it alone in an hbox or something). Its a little evil and hackish but the technique will give you expand to fit allocation ellipsis (although personally I've only tried it for word wrapping). 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: Adding menu items dynamically
On Wed, Feb 18, 2009 at 9:43 AM, John Coppens j...@jcoppens.com wrote: Hello people. I'm still getting my feet wet with Glade3... I defined a menu, which works fine, but now I want to add items to one of the submenus by program, and I'm stuck. I did find several other people with similar problems though (no solutions). Glade3, via gtk-builder-convert, seems to convert the menu things to a series of GtkActions, and a structure which defines the menu format. I was able to create and add a new action. I can generate the menu widget for that action, but I cannot find a way to append it. (I cannot seem to access the menubar/menu structure) Sure, the gtk-builder-convert script comes from an era when gtk+ didnt support native building of menus with GtkBuilder - so the convert script makes a uimanager with actions instead, on the other hand the Glade tool never supported the UIManager object. At the risk of sounding redundant, this will work better without the conversion script and with the Glade tool conversion routine. 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: Adding menu items dynamically
On Wed, Feb 18, 2009 at 1:20 PM, John Coppens j...@jcoppens.com wrote: [...] But, the '*' bug reappeared! Saving as GtkBuilder doesn't save '*' as invisible character for a GtkEntry. (It finally did when saving as libglade, http://bugzilla.gnome.org/show_bug.cgi?id=572271) That is very strange, your telling me that the asterisk saves in libglade format but not in GtkBuilder format ? 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: many buttons, one handler with gtkbuilder
On Wed, Jan 21, 2009 at 1:19 PM, Peter F. Patel-Schneider p...@verizon.net wrote: [...] Actually a more general solution would be to allow glade/gtkbuilder to add properties to widget classes. I don't know whether this would fly. Glade lets you add properties and save them to the glade file, libglade let you register handlers for custom properties but I dont think GtkBuilder lets you use property tags for properties that are not really on the object - however, you can derive a widget class and add real properties, or parse custom xml constructs by implementing GtkBuildable (In which case, you would absolutely need code support in your glade plugin to tell the core how a widget class is written in xml). Cheers, -Tristan peter ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: many buttons, one handler with gtkbuilder
On Tue, Jan 20, 2009 at 7:27 AM, Peter F. Patel-Schneider p...@verizon.net wrote: [...] As I expected, I guess, but it sure would be nice to be able to easily build objects or handlers that have extra information in them in the form of integers or strings. Just being able to initialize the user-data property to a pointer to a string or integer using glade/gtkbuilder would be very useful. Its on my long long todo list, if you want to try your hand at it, I could tell you exactly what has to be done in GtkBuilder and in Glade and coach you through getting your patches reviewed correctly etc. I'm not certain but quite sure Matthias and Johan will not be against the idea (i.e. the GTK+ and GtkBuilder maintainers)... It would not make GNOME 2.26 but could be available in dev releases soon after... 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: Suggestions about g_signal_connect_data and/or g_object_set_data_full
On Fri, Jan 2, 2009 at 2:35 PM, Rodrigo Miguel rodrm...@gmail.com wrote: Hello all, I've the code below, so here are just a couple of questions: 1) I'm curious, if I close the app by clicking the button that calls gtk_main_quit, instead of forceing the window to be destroyed, it doesn't call my GClosureNotify/GDestroyNotify functions. So, I wrote a small code that list all toplevels and then destroy it, so it's working pretty well so far, just curious if that's the normal behavior. Thats normal behavior, you have to destroy your widgets if you want to free the memory (usually thats not important at quit time though). 2) in the line below: gtk_container_add(GTK_CONTAINER (window), button);, if I forget to create a relation between button widget to another container, the GClosureNotify/GDestroyNotify will not be called too. I know that's a bad programming practice, but it would happen in a large program and have a orphan widget. So, is there any way to overcome this issue? Gtk+ is not supposed to work if you forget to use it correctly ;-) Normally I would couple the signal_connect() and the container_add() in the same code segment, bottom line is you are responsible for knowing when to connect/disconnect/block your signal callbacks. (in the above situation it would be safe, to add the child at a later time, since you already know the button will not be clicked by a user until its added to the ui and shown). Cheers, -Tristan PS: Consider using GtkBuilder to build your widgets instead of writing that code by hand ;-) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Glade and Gtk 2.16.x
On Fri, Jan 2, 2009 at 2:47 PM, Rodrigo Miguel rodrm...@gmail.com wrote: Hi Tadej, Sorry, I think I wasn't clear in my question. In fact I'm already using the glade both windows and linux. So I'm asking, if it will be delivered with Gtk, not as separate project and not dependent of LibGlade. So my interesting is about to leave libglade and starting using only GtkBuilder and Glade. As far as the Glade tool goes, we are planning for a stable release that supports both formats + conversions with GNOME 2.26. I think Matthias plans to release a GTK+ 2.16 for the same time frame... which would be nice (I would depend on 2.16 from Glade right away...). 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: Menu bar items without icon indent
On Wed, Dec 24, 2008 at 2:18 PM, Peter Clifton pc...@cam.ac.uk wrote: Hi, I'm wanting to make a menu-bar item without any offset allocated due to toggle-size (space left to line up all GtkMenuItems icons / accelerators). What I want to implement is something which looks like the screen-shot here: http://live.gnome.org/UsabilityProject/Whiteboard/Menus Hmm, I reported a related bug... http://bugzilla.gnome.org/show_bug.cgi?id=564063 You may want to discuss your opinion about that behavior on the said bug, or on gtk-devel-list... personally I think it should be a configurable property of the GtkMenuItem, whether to add a default left margin even when there are no icons, or not. If we were really fancy we could allow you to group items between their separators and have some groups that had margins for icons or check marks, and some groups dont have margins (maybe I missed some functionality in gtk+ that already lets you do that...) 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: Building custom gtk+ lib then program doesn't follow system's default theme.
On Thu, Dec 11, 2008 at 12:07 AM, Keedi Kim ke...@perl.kr wrote: Hi guys, I just built gtk+-2.14.5 since 2.14.4 in Ubuntu 8.10 has a GtkCellRenderCombo bug (http://bugzilla.gnome.org/show_bug.cgi?id=558323) Anyway I got brand-new stable release of gtk+. and build my program again to linking new gtk+ Then I run my program, programs looks far more different from another programs. How could my program follows system's default theme? Is there a general way to achieve this? On ubuntu, to test, I do cp /usr/share/themes/Human/gtk-2.0/gtkrc /opt/share/themes/Default/gtk-2.0-key/ its probably not right - you have to have gtk installed and then the system them installed, the way the dist does it, on top. 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: Dynamically adding a wiget to a container created by glade
You can add your widget to glade instead of playing fancy container tricks. Here is an example where you add a completely virtual widget class: http://www.gnome.org/~tvb/testcatalog.xml You'll find the full documentation here: http://glade.gnome.org/docs These docs apply for dev glade (3.5.x), most of it applies to stable as well, if you need help getting your custom widget working, poke us in #glade3 on irc.gnome.org Cheers, -Tristan On Wed, Dec 10, 2008 at 6:08 PM, Ravee Kondrakunta [EMAIL PROTECTED] wrote: Yes, I had set it. Any other input. Is this the right way to do. Becase I am getting the instance created by glade and using that I was trying to add new widget. -Ravee From: Yu Feng [EMAIL PROTECTED] Sent: Wednesday, December 10, 2008 2:57 PM To: Ravee Kondrakunta Cc: gtk-app-devel-list@gnome.org Subject: Re: Dynamically adding a wiget to a container created by glade On Thu, 2008-12-11 at 03:52 +0530, Ravee Kondrakunta wrote: Hi, I created a dialog with glade. In this dialog, I have a HBox with two widgets, one is the label and the other widget will be determined at the runtime. In the code I got the reference to the HBox using get_widget after loading the glade file and then I am adding my widget to the HBox using the reference from the XML. The code compiles properly, but the widget is never shown. Here is sample code for that... xmlRef = Gnome::Glade::create(myglade.glade); Gtk::HBox *pMyHBox; xmlRef-get_widget(myHBox, pMyHBox); Lets us assume I need to add one more label the the myHBox Gtk::Label lab(new); pMyHBox-add(lab); or pMyHBox-pack_start(lab); or pMyHBox-pack_end(lab); etc.. I tried all possible ways to show it.. Unfortunately, I couldn't see it on my dialog. Please help me where I was wrong... you have to set the 'visible' property of your new widget to 'true'. -Ravee ___ 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: Building custom gtk+ lib then program doesn't follow system's default theme.
On Thu, Dec 11, 2008 at 12:22 AM, Tristan Van Berkom [EMAIL PROTECTED] wrote: On Thu, Dec 11, 2008 at 12:07 AM, Keedi Kim [EMAIL PROTECTED] wrote: Hi guys, I just built gtk+-2.14.5 since 2.14.4 in Ubuntu 8.10 has a GtkCellRenderCombo bug (http://bugzilla.gnome.org/show_bug.cgi?id=558323) Anyway I got brand-new stable release of gtk+. and build my program again to linking new gtk+ Then I run my program, programs looks far more different from another programs. How could my program follows system's default theme? Is there a general way to achieve this? On ubuntu, to test, I do cp /usr/share/themes/Human/gtk-2.0/gtkrc /opt/share/themes/Default/gtk-2.0-key/ its probably not right - you have to have gtk installed and then the system them installed, the way the dist does it, on top. oh yeah, and it will complain about missing modules, you'll just have to copy them into your prefix too... ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Is it possible having different GtkAdjustment values in GtkTreeView
On Mon, Dec 8, 2008 at 6:02 AM, Keedi Kim [EMAIL PROTECTED] wrote: Hi! :-) I have some question about GtkTreeView and GtkCellRenderer. Is it possible to have different GtkAdjustment values for each column(renderer?) in GtkTreeView? Is there any reason you cant just store the adjustment in the model and set it up as an attribute ? or am I missing what you want to accomplish ? 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: Emitting events to a non-visible widget
On Wed, Dec 3, 2008 at 2:38 PM, Zan Dobersek [EMAIL PROTECTED] wrote: Is there any way to emit events to a non-visible GtkWidget? By non-visible, I'm thinking of a GtkWidget that never gets shown, i.e. gtk_widget_show_all or similar never gets called on this widget. Just to clarify on the events - I'd like to emit button, emotion and key events. As far as I've tried, I saw that the problem occurs because no useful x_root or y_root can actually be set to event, when specifically talking about a GdkEventButton event. I also fairly doubt about widget's window validity when that widget is not visible, since a window needs to be set in a GdkEvent. Can anyone suggest a solution or an effective bypass? I thank you sincerely. Sure, lets start with why do you want to send an event to an invisible widget in the first place ? I'm sure we can figure something more appropriate than creating an invisible button... 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: Glade signal connect data and full
On Tue, Nov 11, 2008 at 6:32 AM, dhk [EMAIL PROTECTED] wrote: [...] Thanks, but this is a lot like the glade source. It doesn't explain the variables. I need to know what the parameters are and where they come from. I think the handler_name the one in the glade xml file and the GladeXMLConnectFunc some made up function to execute. Is this correct? I'm not sure if these are the functions I need to do what I want, but they seem correct. What I want to do is pass a value for user_data into a handler when a button is clicked. The glade_xml_signal_autoconnect() function doesn't let me do that. Indeed it doesnt, the autoconnect is only capable of passing alternate objects in (it does g_signal_connect_object() and uses SWAPPED flag), only when an object is specified for that handler (in the Glade tool, this will look confusing, we never finished improving that on our side). But, there is another libglade function to call for signal connections, I think its glade_signal_connect(), but I'm sure you'll find it in the headers. what it does is connects a signal to an object in the glade file by widget name (basically just a convenience api for g_signal_connect()), it should be a good alternative for you. 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: Glade signal connect data and full
Gah, my mail always misses the list ;-) On Tue, Nov 11, 2008 at 12:22 PM, Tristan Van Berkom [EMAIL PROTECTED] wrote: On Tue, Nov 11, 2008 at 6:32 AM, dhk [EMAIL PROTECTED] wrote: [...] Thanks, but this is a lot like the glade source. It doesn't explain the variables. I need to know what the parameters are and where they come from. I think the handler_name the one in the glade xml file and the GladeXMLConnectFunc some made up function to execute. Is this correct? I'm not sure if these are the functions I need to do what I want, but they seem correct. What I want to do is pass a value for user_data into a handler when a button is clicked. The glade_xml_signal_autoconnect() function doesn't let me do that. Indeed it doesnt, the autoconnect is only capable of passing alternate objects in (it does g_signal_connect_object() and uses SWAPPED flag), only when an object is specified for that handler (in the Glade tool, this will look confusing, we never finished improving that on our side). But, there is another libglade function to call for signal connections, I think its glade_signal_connect(), but I'm sure you'll find it in the headers. what it does is connects a signal to an object in the glade file by widget name (basically just a convenience api for g_signal_connect()), it should be a good alternative for you. 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: Layout Composite Widget Components Using Glade-3? / Pluggable widgets replacement for Glade custom widget?
On Tue, Oct 21, 2008 at 2:56 PM, Daniel Yek [EMAIL PROTECTED] wrote: [...] Hi Tristan, No, I think I got the pluggable term from the following Wikipedia page. Yeah, the term is probably too confusing to use besides serving as a general explanation in the article. ok for the sake of this conversation: you are trying to integrate your custom widget into glade, the fact that it is a composite widget is of little consequence; lets start by getting your instance running in glade and your properties introspected. Scratch my previous comment about a feature we never wrote, its irrelevant here... Think about creating a new GnomeDialog to be a composite widget. It would have to be Glade's custom widget if not plugged into Glade with catalog and support plugin, wouldn't it? That was what I was referring to when I said (custom) composite widget. http://developer.gnome.org/doc/GGAD/cha-widget.html#Z142 if you write a catalog for a real widget that you have written, a widget in C or another bound language, then you integrate it (or only fake it..) right into the glade palette - no need for a go between object. I found this posting to be informative and mostly answered my question: http://lists.ximian.com/pipermail/glade-users/2007-October/003647.html http://lists.ximian.com/pipermail/glade-users/2007-October/003648.html However, the testcatalog.xml in the blog is no longer available: http://www.gnome.org/~tvb/testcatalog.xml http://www.gnome.org/%7Etvb/testcatalog.xml http://blogs.gnome.org/tvb/2007/07/25/some-popular-features/ My fault I cleaned up my home dir... I posted on in its place just for you :) (I'll attach it to this mail also...) I am experimenting with the parent-class construct in the attached catalog, but not seeing any observable effect or errors (after debugged earlier catalog syntax errors.) If successful, do I get a new tool icon in Glade-palette? Only if you included the glade-widget-group portion of the catalog. This is how I start Glade-3: $ export GLADE_CATALOG_PATH=directory $ glade-3 project.glade Any idea how I can get started with the approach of creating a composite widget in Glade that is basically just a GtkVBox with signal handlers custom code hooked up? You should come join me in #glade3 on irc.gnome.org if you're having trouble it'll be easier for me to help you there... before I misread you again... what do you mean by with signal handlers custom code hooked up ? Do you mean your vbox does things with signals ? or it just provides new ones for the user ? 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: Layout Composite Widget Components Using Glade-3? / See Glade Only as Prototyping Tool?
On Tue, Oct 21, 2008 at 7:25 PM, Daniel Yek [EMAIL PROTECTED] wrote: [...] That (custom composite widget) is one approach I know of, but that doesn't allow me to manipulate the composite widget's children in Glade easily without more work. That is, if I stick to the standard GtkVBox, I can edit its children in Glade. Now, I am trying not to lose that ability when I subclass the standard GtkVBox to do minimal changes to it. If I subclass GtkVBox to add customized behavior in an object oriented/modular way, I am no longer using the standard GtkVBox and might not be able to use the same approach in manipulating this subclass's children. As it appears that there is a solution to allow subclassing of GtkVBox, but still fake it to be the standard GtkVBox, I will be able to use this technique to make my code more modular and reusable (within the project -- I'm not intending to create widget library with this) and not to be penalized just for subclassing. sigh, I am tired, I hope you have read the docs [1] thoroughly. Whether you publish a widget library or not, if you want code support in the plugin, the plugin will have to access your_object_get_type() and call it, whether you take a good modular approach and actually build a library with your app, is pretty much irrelevant. If you want your composite custom widget's children to be editable (i.e. allow the user to modify the properties of a child label or button ? or even allow the user to add widgets to a child GtkBox ?) then you have to sit in the post-create-function[2], and create a GladeWidget wrapper using glade_widget_adaptor_create_internal()[3]. Then, depending on your usage of either GtkBuilder or libglade, you will need to implement a get_internal_child(widget, internal_name) string so that the parser will be able to retrieve the child object to add children to/set properties on. [...] I am experimenting with the parent-class construct...If successful, do I get a new tool icon in Glade-palette? Only if you included the glade-widget-group portion of the catalog. OK. This is working now -- I am getting a plain Glade-palette tool icon. I have more follow up questions though. I'm now trying to figure out what to do next... What functions do I need to implement to enable instantiation of the 'glade-widget-class name=FooBar' composite widget? I.e., what libglade would call? Can that function be implemented to be compiled into the main application, so that I don't need to create a standalone .so file: requires lib=somelib.so? Ahh this works differently in GtkBuilder, so for libglade I have to say simply no, if you are instantiating your object from your app (compiled --export-dynamic ofcourse), from Glade from libglade, then you'll need to either just remove the requires string from the glade file, or in libglade, call glade_provides(). I'm thinking libglade would just treat the widget class as if it is a standard widget, so if the application registered the widget ahead of time, this will work. (I'm still experimenting with implementing this, but let me just send this email out to get answers on some of the questions.) libglade will still require you to write a one line glade_xml_register_widget() call to use your class is there a reason you cant use GtkBuilder ? Any idea how I can get started with the approach of creating a composite widget in Glade that is basically just a GtkVBox with signal handlers custom code hooked up? what do you mean by with signal handlers custom code hooked up ? Do you mean your vbox does things with signals ? or it just provides new ones for the user ? I goal is to create a source file for this composite widget and either overwrite the virtual functions to implement additional, customized, behavior, or hook up signal handlers to change the widget behavior, but keep the widget in its own source file to be modular. Does this goal make sense at all? Sure, but I dont see how it plays in to the role of a glade plugin, if your new object installs new signals, then glade will introspect them and allow the user to set handlers on it. One related thought/doubt in my mind was whether Glade should only be thought of as a GUI prototyping tool and that projects having more modularity requirement will fare better to code the subclasses using GTK+ API directly. I am assuming that you are doing just that, writing a widget subclass, using the gtk+ api directly, then compiling it - all we aim to do is put your widget in the palette. I suppose one way to analyze this is to look at Glade source code itself and questioning why Glade application interface wasn't composed using Glade itself, but coded directly using GTK+ API? (Again, just figuring out things...) I just havent taken the time, its a matter of writing a little catalog to support the editor widget, palette widget, inspector widget and design view widget, and have glade3/src use GtkBuilder to load the core
Re: Glade (Re: What widgets in TES Construction Set?)
On Mon, Oct 20, 2008 at 1:50 PM, Juhana Sadeharju [EMAIL PROTECTED] wrote: About Glade. I tried to create something simple (which I don't remember now) it didn't succeed. The menubar was simple, but this equally simple thing was too hard. I will check it again and post to glade lists someday. It would be nice if there would be complete examples which could be grabbed and dragged to the project. This equals to adding complete subgraph of widgets to the project. Yeah, weve discussed such a probable feature under the terms of widget templates, we would have offered a whole bunch of composite widgets and dialogs based on the feature, and also allow users to save a template so they could access it in the palette... ofcourse nobody came around to do the work ;-) Man the possibilities would be endless if we had more than 1.5 people working on Glade ! :D For other project, I need an audio waveform display with callbacks and with overdrawn controls (draggable selection edge) and displays (playhead time display moving with the pointer). It would be nice if I could grab an example of this kind of thing, and then modify it to my taste in Glade. Such an audio waveform display may require multiple pixmaps. If waveform is moved forward, only the new revealed waveform is drawn, and the rest are copied. One pixmap could contain the waveform and other the controls (which are widgets), the final rendering then composite of the two pixmaps. All the code making the framwork work could be part of the Glade (not the waveform drawing, not the audio reading). Then if I have an Open File dialog, I would want Glade to generate me a framework code for opening the audiofile at background thread, if necessary. If the waveform drawing LOD file is missing it needs to be generated and that may take time. At meanwhile user should be able to continue editing of other audio. Threads etc. are standard part of modern software so they should be easily available. If Glade searches for means to extends its cababilities, this would be the way. Hi, Currently using glade you could conceivably edit anything you want in glade - so long as you work with GObjects that have properties and signals (you can even invent properties that are loaded and saved in custom ways, like GtkListStore data for example). Now obviously I'm not going to write your toolkit of objects and your application for you, but I can offer you a dynamic way to edit save and load all your objects from an xml description, whether your objects are waveforms contained inside a track object which asks your waveforms to draw itself at specific locations, depending on the waveform properties or data, or whether your objects represent frames in an animation, or even singleton objects that may represent devices on the embedded system your writing your application for. Nothing is stopping you from writing a GThreadedObject that runs a thread when its in active state and the thread just fires a signal for the code to implement. As glade, we dont have the resources (and its not part of our task description) to go and write all the fancy toolkits that we could support, but I would love to see the envelope pushed, for instance, I dont see any reason why GStreamer pipelines coulnt be edited in glade and loaded by GtkBuilder. 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: What widgets in TES Construction Set?
On Sat, Oct 18, 2008 at 1:26 PM, Juhana Sadeharju [EMAIL PROTECTED] wrote: [...] I tried Glade but soon found that plain GTK is more for my taste. In Glade, good is that all the widget properties are listed, no guess work. Bad was that I could not do what I wanted. Hi, before you give up on Glade completely, let me make my sales pitch ;-) Remember that glade is not only a palette of widgets from the gtk+ toolkit; these screenshots are a couple years old, of a toolkit we wrote that uses mostly gdk api and some custom stuff for animations, but consider the same can be done for GL widgets or whatever customized gtk+ based widget toolkit framework: http://www.gnome.org/~tvb/gladett-fullscreen.png http://www.gnome.org/~tvb/glade-tt-screenies/ The docs to integrate your custom toolkit into glade are here, pretty straight forward, and you can always poke us if you need help. http://glade.gnome.org/docs/ Basically Im just saying, if you would like to use glade/gtkbuilder for your application, dont drop the idea just because you are using a 100% customized set of gtk+ based widgets ;-) 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: Layout Composite Widget Components Using Glade-3? / Pluggable widgets replacement for Glade custom widget?
On Thu, Oct 16, 2008 at 10:01 PM, Daniel Yek [EMAIL PROTECTED] wrote: Hi, I have been wondering, if I were to create a (custom) composite widget to contain several standard GTK+ widgets from within a larger Glade project, is there a way I can keep both the application layout and the composite widget layout in the same Glade-3 project? (It is nicer if all widgets appear in the same design view.) Do I have to use the custom widget in Glade (which is marked as deprecated) to create composite widget? Is pluggable widget the replacement mechanism for custom widget? I read a little about pluggable widgets, but I'm not familiar with creating pluggable widgets and I am likely not able to spend time on that. How much additional time is needed to turn a custom widget into a pluggable widget? Is there a generic mechanism that automatically turn a custom widget into a pluggable widget where it might be possible? :-) I'm just trying to figure out how to best create and use composite widgets. Ideas and advice are appreciated. Thanks. Well, in trunk you are allowed non GtkWindow toplevel objects, and you are allowed to use a more lax naming scheme - so it can be as easy as defining some widget layouts in glade... and then the art is how you parse it with gtkbuilder. you should be able to use builder first to build your main window, and then go back in the file and build your other composed widgets seperately, and just add them to your interface with gtk_container_add() yourself. Glade can also integrate your own real custom GtkWidget derived object into the runtime, thats why we deprecated the old custom widget hook. 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: Layout Composite Widget Components Using Glade-3? / Pluggable widgets replacement for Glade custom widget?
On Fri, Oct 17, 2008 at 2:10 AM, Daniel Yek [EMAIL PROTECTED] wrote: [...] This is done by installing custom widgets catalog into catalog directory, installing custom plugin libraries, loading optional/custom plugin libraries, installing and loading glade-3 custom widget icons, right? If so, is this not the pluggable widget that I referred to earlier? Actually no, I think you are getting mixed up the a GtkPlug widget is that the case ? If you want to design your composite widget layout in glade, that is one thing... but its not a custom widget ;-) if you write a catalog for a real widget that you have written, a widget in C or another bound language, then you integrate it (or only fake it..) right into the glade palette - no need for a go between object. 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: What strategy to use to deal with Glade-3's problem in removing pixbuf directory paths in .glade file!
On Thu, Oct 9, 2008 at 2:40 PM, Daniel Yek [EMAIL PROTECTED] wrote: Hi Tristan, Thanks for responding. My responses inlined below... [...] or in the specified pixbuf directory (you can add a search path with the libglade api). o gdk-pixbuf's gdk_pixbuf_new_from_file() requires absolute or relative paths without resource resolution based on any environment variables. So, application can't make libglade resolves resources by setting an environment variable. I seriously doubt it that application can add search path with libglade API, but I might be wrong. Could you kindly point out the API function to use? libglade-2.6.2/glade/glade-xml.c glade_xml_set_value_from_string() case G_TYPE_OBJECT: if (G_VALUE_HOLDS(value, GDK_TYPE_PIXBUF)) { ... filename = glade_xml_relative_file(xml, string); pixbuf = gdk_pixbuf_new_from_file(filename, error); ... } My mistake, I somehow had the notion that glade_xml_relative_file() would take user specified paths into consideration. 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: shared memory queue
2008/10/6 Luka Napotnik [EMAIL PROTECTED]: Hello. I have a problem that I need an GAsyncQueue shared among multiple processes. If I allocate a structure with shared memory and then allocate the GAsyncQueue with g_async_queue_new() to a structure member, is the queue shared or not? And if not, is there a way to do this? No. I guess it would be possible to design an IPC that had a similar api, but the root of the issue is that you need to use sockets/pipes to communicate between processes (while you might use a shared memory slab for the actual data, thats just a detail). 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: What strategy to use to deal with Glade-3's problem in removing pixbuf directory paths in .glade file!
On Mon, Oct 6, 2008 at 2:01 PM, Daniel Yek [EMAIL PROTECTED] wrote: Hi, I'm trying to find a way to deal with the problem with Glade-3 removing absolute or relative path from pixbuf property. Hi, since we are in the middle of adding builder support, this would be a great time to file a bug describing what would be the desired behavior for builder (patches also welcome ;-) ) That being said, the rationale behind libglade style pixbufs is that the pixbuf is either in the working directory, or in the specified pixbuf directory (you can add a search path with the libglade api). Glade 3 not allowing a full path is a shortcomming related to poor handling of external resources (i.e. pixbufs related to a glade file are tracked and copied with the glade file... poorly, also bug reports and patches welcome...) Cheers, -Tristan That is, given a .glade file containing: widget class=GtkImage id=image property name=pixbufrelativepath/image.png/property /widget Glade-3 would remove the path and generate this instead: widget class=GtkImage id=image property name=pixbufimage.png/property /widget Isn't it that, in general, when dealing with XML, it is a good idea not to regenerating everything, but to keep all XML tags/blocks that the application/tool doesn't understand? This is desired! In this case, isn't it that Glade-3 shouldn't be discarding data (directory paths) when that relevant tags/blocks in the xml file aren't even modified? The ideal case aside, is there a strategy to deal with the current, following, situation? o Glade-3 insists on removing directory path from pixbufs. (Problem.) o libglade is capable of supporting .glade-file-relative path. (Good.) o gdk-pixbuf's gdk_pixbuf_new_from_file() requires absolute or relative paths without resource resolution based on any environment variables. So, application can't make libglade resolves resources by setting an environment variable. Note that if Glade-3 were to not discard relative paths from pixbuf in .glade file, libglade would have worked. I think one clumsy way I can deal with this is to create a script that post-process .glade file touched by Glade-3 to explicitly restore the pixbuf directory paths. Is there another better way to deal with this problem? Thanks. -- Daniel Yek. ___ 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: shared memory queue
Oops first post missed the list... 2008/10/6 Luka Napotnik [EMAIL PROTECTED]: Hello. I have a problem that I need an GAsyncQueue shared among multiple processes. If I allocate a structure with shared memory and then allocate the GAsyncQueue with g_async_queue_new() to a structure member, is the queue shared or not? And if not, is there a way to do this? No. I guess it would be possible to design an IPC that had a similar api, but the root of the issue is that you need to use sockets/pipes to communicate between processes (while you might use a shared memory slab for the actual data, thats just a detail). BTW I think there is IPC in gnome, you might look into dbus, I'm not exactly sure what IPC is the one to use in gnome right now... 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: Private data problems
Hi Liam, It seems that the switch-page is a historical problem, its one of the oldest signals on the widget and fixing that issue would only be an api break in gtk+, although it might make sense to at least make sure there is a bug report active. I definitely suggest you go make sure there is a bug report for the second issue, people on gtk+ bugzilla are pretty responsive and will review your patches too :) Cheers, -Tristan On Mon, Sep 15, 2008 at 3:39 AM, Liam O'Boyle [EMAIL PROTECTED] wrote: Hi, I have two separate issues currently, both somewhat related to internal GTK structures. First up, the GtkNotebook switch-page event returns a GtkNotebookPage, which is of incredibly little use. I would like to get at the actual widget inside the page? I have copied the structure definition out of the GTK code, which allows me to get the correct widget as follows (GtkWidget *)((GtkNotebookPage *)notebookpage)-child but obviously this is far from ideal, as changes to the _GtkNotebookPage structure are likely to break my app. What's the correct way to get at this? It seems odd that a signal deliberately exposes the private data structure, why doesn't it just return the child? Another problem I have is behavioural. The GtkCellRendererText can be set to allow editing of the stored value. However, if the cell looses focus while editing is in place the editing-canceled signal is emitted, which causes the GtkEntry widget to be destroyed and the list to revert to the previous value. Again, after copying an internal structure, GtkCellRendererTextPrivate, into my code it's possible to correct this behaviour GtkCellRendererTextPrivate *priv; priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (GTK_CELL_RENDERER_TEXT(renderer)); if (priv-focus_out_id 0) { g_signal_handler_disconnect (priv-entry, priv-focus_out_id); priv-focus_out_id = 0; } Is there a correct way to do this, without referring to private structures? I assume that the behaviour in these two cases is deliberate, although I can't see why it isn't at least configurable behaviour; in the second instance, in particular, the behaviour doesn't seem like anything than anybody would want. In fact, gconf-editor seems to implement its own GtkCellEditable widget, possibly just to avoid this behaviour. If the behaviour is not deliberate, I am happy to provide a patch to fix it. Thanks for any help, Liam ___ 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: How to create unique widget when reusing widget id's from a GladeXML object.
oops this missed the list... On Tue, Aug 12, 2008 at 6:58 AM, Olivier Guilyardi [EMAIL PROTECTED] wrote: [...] About performance, from the liblglade manual : the XML parse tree is cached to speed up creating another GladeXML object for the same file. Yes, and for the same reasons outlined above its a good idea to unref your GladeXML objects as soon as your UI is built, so you dont have access to the hash map provided by the glade xml. dhk: Your theory about keeping track by pages is indeed sane, you can use a simple recursive algorythm to find a widget by name inside a page, I'll leave some pseudo code for you here, but IMO, using a structure in a list to hold pointers to the desired widgets and other page specific datas is cleaner and better programming practice - mostly because it maintains a cleaner split between business logic and user interface. Consider that when your UI and business logic become more complex; with your model you might end up using g_object_get/set_data() alot and working directly with widgets (which you may decide to rename, change in the UI) - and with structs in a list, you will be adding struct members instead - and possibly tweaking the code portion that loads the structs and builds the UI whenever the UI might change. Cheers, -Tristan Find widget in container by name recursively: container_foreach (container, widget) { if (!strcmp (gtk_widget_get_name (widget) , data.search)) data.widget = widget; if (is_container (widget)) gtk_container_foreach (widget, container_foreach, data); } GtkWidget *find_widget_in_container (container, name) { struct { gchar *search = name; GtkWidget *widget = NULL; } data; gtk_container_foreach (container, container_foreach, data); } ___ 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 create unique widget when reusing widget id's from a GladeXML object.
On Tue, Aug 12, 2008 at 6:58 AM, Olivier Guilyardi [EMAIL PROTECTED] wrote: [...] About performance, from the liblglade manual : the XML parse tree is cached to speed up creating another GladeXML object for the same file. Yes, and for the same reasons outlined above its a good idea to unref your GladeXML objects as soon as your UI is built, so you dont have access to the hash map provided by the glade xml. dhk: Your theory about keeping track by pages is indeed sane, you can use a simple recursive algorythm to find a widget by name inside a page, I'll leave some pseudo code for you here, but IMO, using a structure in a list to hold pointers to the desired widgets and other page specific datas is cleaner and better programming practice - mostly because it maintains a cleaner split between business logic and user interface. Consider that when your UI and business logic become more complex; with your model you might end up using g_object_get/set_data() alot and working directly with widgets (which you may decide to rename, change in the UI) - and with structs in a list, you will be adding struct members instead - and possibly tweaking the code portion that loads the structs and builds the UI whenever the UI might change. Cheers, -Tristan Find widget in container by name recursively: container_foreach (container, widget) { if (!strcmp (gtk_widget_get_name (widget) , data.search)) data.widget = widget; if (is_container (widget)) gtk_container_foreach (widget, container_foreach, data); } GtkWidget *find_widget_in_container (container, name) { struct { gchar *search = name; GtkWidget *widget = NULL; } data; gtk_container_foreach (container, container_foreach, data); } ___ 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 create unique widget when reusing widget id's from a GladeXML object.
On Tue, Aug 12, 2008 at 6:58 AM, Olivier Guilyardi [EMAIL PROTECTED] wrote: [...] About performance, from the liblglade manual : the XML parse tree is cached to speed up creating another GladeXML object for the same file. Yes, and for the same reasons outlined above its a good idea to unref your GladeXML objects as soon as your UI is built, so you dont have access to the hash map provided by the glade xml. dhk: Your theory about keeping track by pages is indeed sane, you can use a simple recursive algorythm to find a widget by name inside a page, I'll leave some pseudo code for you here, but IMO, using a structure in a list to hold pointers to the desired widgets and other page specific datas is cleaner and better programming practice - mostly because it maintains a cleaner split between business logic and user interface. Consider that when your UI and business logic become more complex; with your model you might end up using g_object_get/set_data() alot and working directly with widgets (which you may decide to rename, change in the UI) - and with structs in a list, you will be adding struct members instead - and possibly tweaking the code portion that loads the structs and builds the UI whenever the UI might change. Cheers, -Tristan Find widget in container by name recursively: container_foreach (container, widget) { if (!strcmp (gtk_widget_get_name (widget) , data.search)) data.widget = widget; if (is_container (widget)) gtk_container_foreach (widget, container_foreach, data); } GtkWidget *find_widget_in_container (container, name) { struct { gchar *search = name; GtkWidget *widget = NULL; } data; gtk_container_foreach (container, container_foreach, data); } ___ 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 create unique widget when reusing widget id's from a GladeXML object.
If you are using one glade file for the tab contents and parsing it again for each tab, then you get widgets in your runtime interface that have the same name, thats not an issue for gtk+ - but, as you named them yourself, its up to you to identify them some other way. Im not sure I understood properly what you wrote, but if I did, I would expect you to be using a list of structs or objects representing the data and widgets in that tab. Cheers, -Tristan On Mon, Aug 11, 2008 at 7:15 PM, dhk [EMAIL PROTECTED] wrote: dhk wrote: I'm adding tabs to a notebook by getting the tab (a vbox) out of a GladeXML object. The tab widget returned from glade_xml_build_widget() can be added to the notebook and everything works fine. The problem is when more tabs are added. It doesn't seem like the widget id's on each tab are exclusive to that tab. The last tab added behaves the best, but if a previous tab is clicked data entered and events on that tab appear on the last tab. This appears to be because the widget id's are the same in each tab because each tab was build from the same widget in the GladeXML file. What happens is when there are two tabs, the data placed in a field on tab one shows up in the field on both tabs. I thought the scope of the widget added to one tab would be out of scope for all other tabs. How can a unique widget be created by using the same widget from a GladeXML object multiple times? Thanks, dave ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Does this have to do with referencing? It looks like the same resources are being used by the new widgets. Any ideas? Thanks, dave ___ 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: Finding a widget in a Glade interface
for future reference, this could easily have been pulled out of the docs/header files: glade_xml_get_widget() type libglade and feel lucky its right there. -Tristan note, remember to unref your GladeXML object early (unlike shown in said example). On Wed, Jul 30, 2008 at 7:10 AM, dhk [EMAIL PROTECTED] wrote: How do you look up a widget when the interface is created with glade_xml_new()? There use to be a lookup_widget() function that worked if you called one of the two glade macros: GLADE_HOOKUP_OBJECT() or GLADE_HOOKUP_OBJECT_NO_REF(). Now unless you build the interface yourself and hook up each object it doesn't work. Is there another function embedded somewhere that will find an object after calling glade_xml_new()? Thanks, dave ___ 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: Finding a widget in a Glade interface
On Wed, Jul 30, 2008 at 3:40 PM, Tristan Van Berkom [EMAIL PROTECTED] wrote: for future reference, this could easily have been pulled out of the docs/header files: glade_xml_get_widget() type libglade and feel lucky its right there. oops, I obviously meant in google here... ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: glade in win xp
The win32 builds are maintained here http://sourceforge.net/projects/gladewin32/ its just a zip file that you have to unzip into your prefix of choice in your MinGW/MSYS environment. I wonder if static builds are a possibility, for users who dont need a dev environment but only want to manipulate the glade files. Cheers, -Tristan On Mon, Jul 28, 2008 at 2:09 AM, Embiza Tadesse [EMAIL PROTECTED] wrote: How do I install glade in win xp (clear steps pls) ___ 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: g_object_get_data changed data association
Hi, Check that your list store is properly refcounted, is there any reason why the list store may have been destroyed previous to this call ? Cheers, -Tristan On Fri, Jul 25, 2008 at 10:41 AM, YU WU [EMAIL PROTECTED] wrote: dear sir or madam, i am developing applications with GTK+ and have some problem, following is some digest of my code. = store = gtk_list_store_new(NUMS_MAX_FORCE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); g_object_set_data(G_OBJECT(window), staad_max_force_store, store); printf(## start store memory=%p\n, g_object_get_data(G_OBJECT(window), staad_max_force_store)); printf(## is store=%d\n, GTK_IS_LIST_STORE(store)); printf(## name store=%s\n, G_OBJECT_TYPE_NAME(store)); = i install a list store by above codes. then i want to update the list store somewhere later. = /* for debug */ if(g_object_get_data(G_OBJECT(widget), staad_max_force_store) == NULL) printf(NULL\n); else { printf(store memory=%p\n, g_object_get_data(G_OBJECT(widget), staad_max_force_store)); printf(## name store=%s\n, G_OBJECT_TYPE_NAME(g_object_get_data(G_OBJECT(widget), staad_max_force_store))); } while(curr_data) { i = 0; curr_item = curr_data-content; while(curr_item) { gtk_list_store_append(store, iter); if(++i == 1) { gtk_list_store_set(store, iter, MAX_FORCE_MEM_NUM, (local1 = char_to_utf8 (curr_data-mem_num)), MAX_FORCE_ITEM, (local2 = char_to_utf8 (curr_item-item)), MAX_FORCE_FX, (local3 = char_to_utf8 (curr_item-FX)), MAX_FORCE_FY, (local4 = char_to_utf8 (curr_item-FY)), MAX_FORCE_FZ, (local5 = char_to_utf8 (curr_item-FZ)), MAX_FORCE_MX, (local6 = char_to_utf8 (curr_item-MX)), MAX_FORCE_MY, (local7 = char_to_utf8 (curr_item-MY)), MAX_FORCE_MZ, (local8 = char_to_utf8 (curr_item-MZ)), -1); g_free(local8); } else gtk_list_store_set(store, iter, MAX_FORCE_ITEM, (local1 = char_to_utf8 (curr_item-item)), MAX_FORCE_FX, (local2 = char_to_utf8 (curr_item-FX)), MAX_FORCE_FY, (local3 = char_to_utf8 (curr_item-FY)), MAX_FORCE_FZ, (local4 = char_to_utf8 (curr_item-FZ)), MAX_FORCE_MX, (local5 = char_to_utf8 (curr_item-MX)), MAX_FORCE_MY, (local6 = char_to_utf8 (curr_item-MY)), MAX_FORCE_MZ, (local7 = char_to_utf8 (curr_item-MZ)), -1); g_free(local1); g_free(local2); g_free(local3); g_free(local4); g_free(local5); g_free(local6); g_free(local7); curr_item = curr_item-next; } curr_data = curr_data-next; } = after using g_object_get_data(G_OBJECT(widget), staad_max_force_store), i hope to get the store i defined at the beginning. but in fact i didn't get the list store, but something else -- instead of a list store. of course, the store can't be updated. from my debug info, the data gotten from g_object_get_data(G_OBJECT(widget), staad_max_force_store) has the same memory address with that defined g_object_set_data(G_OBJECT(window), staad_max_force_store, store);, but G_OBJECT_TYPE_NAME(store) changed. so, i would like to know if there is hint to be used for g_object_get_data and g_object_set_data. what could be the problem? p.s.: in my program, there is public area -- a gtkbox to be used by all sub-program. if i always run the above sub-program, the problem mentioned above won't come up. but, if i run the above sub-program first, then change to another sub-program, and later i come back to the above sub-program, the above problem comes up. during this process, i used gtk_widget_destroy to destroy the widget of the first sub-program in the public area and build the widget for the next coming sub-program. i am wondering if the gtk_widget_destroy disturbs the data associations table. i think my question is a little confusing because i could not describe the question clearly enough. i do hope you could read my words above and try to give me some suggestion. thanks a lot. looking forward to your reply. best regards, wu yu _ Keep your kids safer online with Windows Live Family Safety. http://www.windowslive.com/family_safety/overview.html?ocid=TXT_TAGLM_WL_family_safety_072008 ___ 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: GLADE or not GLADE???. gtk on rails
On Wed, Apr 30, 2008 at 7:11 PM, Martin (OPENGeoMap) [EMAIL PROTECTED] wrote: hi all: We have a insteresting discusion about use libglade or not. In OOP languajes like c++, c# or ruby it´s important find other methos to build GUIs: Please remember that Glade is not an IDE, its an interface designer, if you want an IDE, look into anjuta, which integrates Glade as a component. We've made explicit effort to make Glade as modular as possible so the small group that we are can focus of the task of abstracting interface design and implementation from the application. Regarding code generation, I'm not going over this subject anymore, anjuta will probably be focusing on generating the few lines of code it takes you to use libglade or gtkbuilder, package and load the xml file in a way that novice programmers can happily be ignorant of. 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: Learning Glade
On Sat, Apr 26, 2008 at 7:47 AM, Patrick Braga [EMAIL PROTECTED] wrote: [...] On 26/04/2008, Patrick Braga [EMAIL PROTECTED] wrote: Hi, I'm a relative newcomer to GTK+ programming, but I've been using GNU/Linux for about a year and a half, know it pretty well, and am enjoying writing applications for it. However, I feel it will be easier for me to write graphical applications with an interface designer. The GNOME Library (http://library.gnome.org/ ) wasn't very useful and I haven't been able to find any decent, up-to-date tutorials on Glade. this came up as google's third hit for libglade: http://library.gnome.org/devel/libglade/unstable/ The first chapter libglade programming basics displays the 3 or so lines of code it takes you to load a libglade interface, plus you have the refference manual that follows. The GtkBuilder manual, first hit on google for gtkbuilder: http://library.gnome.org/devel/gtk/2.12/GtkBuilder.html doesnt include a code example but its used in the same basic way as libglade was used. 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: GtkWindow from X window id
On Thu, Apr 10, 2008 at 3:15 PM, Brian J. Tarricone [EMAIL PROTECTED] wrote: Xavier Toth wrote: Is it possible to retrieve a GtkWindow using the native X window id? Something like this might work: GdkWindow *window = gdk_window_lookup(xid); GtkWidget *widget = gdk_window_get_user_data(window); Of course that only works if 'xid' corresponds to a GtkWindow that you yourself have created *in the same application* that you call this from. You can't use this, for example, to get a GtkWidget created in another application -- there's no way to do that. Cou could call gdk_window_foreign_new ;-) Setting up a GtkWindow around that would be pretty custom though... 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: How to know which signals go with which widgets
On Sun, Mar 30, 2008 at 7:51 AM, Gregory Hosler [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 HI all, if I look up the documentation on a particular widget, at the bottom of the devhelp page there is documentation on which signals it supports. I'm looking for the inverse. I have a UI and i need a leave-notify-event, so I wish to know which widgets can I attach this particular signal to. Hi, in the documentation you can find the object heirarchy and what objects that every object derive from, and what interfaces it implements. All signals of implemented interfaces and derived objects are valid for the given object. The *-event signals that originate from the base widget class (GtkWidgetClass) are ofcourse then, available for all widgets. The event signals are particular in the sense that they represent events that come from the Gdk backend - you must ensure that the widget has the proper event masks in order to receive the coresponding event signals. 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: g_connect_signal events. underscore vs dash
On Sat, Mar 29, 2008 at 10:20 PM, Gregory Hosler [EMAIL PROTECTED] wrote: [...] I have some old code, that in many places is using underscores instead of dashes. e.g. button_release_event; in fact I have cases where the same signal is g_connect'ed in different places in the code, one place with underscores (button_release_event) and the other place with dashes (button-release-event). My question: Is one preferred over the other ? is the underscore deprecated ? What's the best spelling to use ? They are synonymous, but afaik they are all defined as dashes, generally I always use dashes. One slightly relevent thing though, when dealing with the GObject notify signal, the dash and underscore are not synonymous for the property names (i.e. notify::button-style is not synonymous with notify::button_style) Through normal property accessors; dashes and underscores are also synonymous, i.e. g_object_get (object, button-style, style, NULL) is the same as g_object_get (object, button_style, style, NULL). I believe the only exception here really is the signal detail arguments that depict property names. 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: mixing widgets via glade and standard way ? (newbie)
On Feb 3, 2008 8:41 AM, Fred Müller [EMAIL PROTECTED] wrote: Dear folks, I'm wondering whether XML/glade based widget creation and 'standard' widget creation combine. All widgets are generated by libglade-2.0. Changing the text in an existing label works, adding a label to the table doesn't: { GtkWidget *l, *tl; if( !(tl=glade_xml_get_widget( pgcw.xml, table_mancontrol_lamps )) ) { fprintf(stderr,%s: can't get lamp table widget\n, __func__ ); return(-1); } l=gtk_label_new(foo); gtk_table_attach_defaults( GTK_TABLE(tl), l, 2,3,2,3 ); return(0); } Are standard gtk calls failing since glade changes some internal callbacks when creating the table, or am I missing something obvious ? (I wouldn't think its some buffer issue, since the above routine gets called once via g_idle_add and the label doesn't appear after resizing/iconify). table size is 4x4 in the XML file. Could it simply be that you forgot to gtk_widget_show() the label ? libglade doesnt do anything sinister that I know of to tables, the fact that you are modifying a constructed table may change things, could your widget be shown underneath another widget already on the table ? Second question: Entries to a notebook all use the same layout and different variable space. The layout for the first page is generated, amongst the rest of the GUI, using XML/libglade, the others are to be cloned at runtime (number of notebook pages is only kown at runtime). What's the good way to do this ? I realize one way is to use glade_xml_new with root and domain options and attached the tree at the notebook. Right ? Is there a general way to cut/paste a widget subtree to a different node within Gtk ? No there is no safe object copying mechanism in place, nor is there a recursive one, better to use the root node argument like you mentioned to build templates and just modify them as needed while adding to the interface. 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: Does libX11 use shared memory between several clients?
On Jan 29, 2008 5:35 AM, Bin Chen [EMAIL PROTECTED] wrote: [...] I can't see any code to transfer modified display structure to the server, this API is invoked by a XIM server so obviously the register stuff need to be accessed by other process, is there any shared memory trick in libX11? Yes, but this is not one of those tricks I would think. When connecting to the X server, XOpenDisplay establishes a connection and returns a locally allocated Display structure to be used for all your api calls. All commands to the X server are sent and queued so to speak on the display. I dont know much about the guts of XIM but it looks like _XRegisterFilterByType doesnt need to tell the server anything... only needs to tell Xlib locally how to handle input when it comes from the X server. 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: Weird problems: C library programs crashing in combination with GTK UI
2008/1/22 [EMAIL PROTECTED]: [...] Pseudo code for my call back function [for some button which will initiate action] is as follows: /***CALL BACK FUNCTION CODE SNIPPET ***/ g_timeout_add(1500,progress_timeout,progressbarwidget); f1();//THE BIG FUNCTION WHICH WILL RUN CLOSE TO A FEW HOURS while (gtk_events_pending ()) { g_print([.]); gtk_main_iteration (); }//THIS SO THAT THE TIME OUT FUNCTION WILL BE ABLE TO CALL ITSELF /END CALL BACK FUNCTION CODE SNIPPET**/ Gtk+ runs in a single thread, you must return to the mainloop that you are running (in gtk_main()) in order for your callbacks to be called. If you dont want to split up f1(); into iterations and run those short iterations from a timeout function, then you might consider using GThread. You can also use the old hack: while (gtk_events_pending ()) gtk_main_iteration (); to run the mainloop recursively so to speak, but if you never call gtk_main_iteration() until you are finished f1(); then you are not pushing progress bars. 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: Can GTK+ make use of XSHM extension from MIT
On Jan 10, 2008 11:38 PM, Bin Chen [EMAIL PROTECTED] wrote: [...] Ok, let me make the things clear, the content in a gdk window includes many widgets, such as label, entry, button. But from the perspective of X server, this widgets are just bitmaps with the states updated by GTK+, right? A kind of mix of the above, generally many widgets draw to the same GdkWindow yes, for the X server this is only one Window. Xshm will accelerate the client to server transfer for type of Image and Pixmap, but the GTK+ use XCopyArea to update the bitmap, can XCopyArea can benefit from the Xshm? Yes XCopyArea will do a different proceedure depending if you are using an XSHM Image or not. In more detail, I am using gdk_draw_image to draw an image to a gdk drawable, will this benefit the Xshm? Assuming the Images were created as shared memory segments then yes they will be transfered as shared memory, this can be faster than using unix sockets for _large_ images (for smaller images its probably the same considering there has to be task switching/locking involved anyway when updating a window from an image). 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: Can GTK+ make use of XSHM extension from MIT
On Jan 11, 2008 12:03 PM, Bin Chen [EMAIL PROTECTED] wrote: [...] Thanks for your reply, but I wonder how the Xlib or GDK knows the image is drawing in a shared memory segment? In detail can you show me some pseudo code to how to do it? Well Gdk does know because it created the backing Image, but doesnt need to because Xlib knows to treat normal images differently than shared ones when doing XCopyArea (Gdk needs to know that its shared only so that it can properly clean up its resources when destroying the GdkImage). See in the docs[1] you can even verify by explicitly trying to create a shared memory pixmap, it will fail if it was not possible to create a shared memory pixmap. For X, all Windows Pixmaps Images etc are resources and different casts of the XID (which is just a numeric resource identifier), if the underlying Image of the GdkImage is shared, the X server will know because the X server created/returned the resource identifier. Cheers, -Tristan [1] http://library.gnome.org/devel/gdk/unstable/gdk-Images.html#gdk-image-new ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can GTK+ make use of XSHM extension from MIT
On Jan 11, 2008 11:01 PM, Bin Chen [EMAIL PROTECTED] wrote: Gdk does all image operations in 32-bits, N800/N810 display is 16-bit. Whether you use SHM or not can be of less concern than this from the performance point of view. OK, so your point is because the convert process must be done on every operation, so the performance will be bad? But I think if the XSHM is used, at least the transfer overhead will be cut, right? What are you using to compose the image ? if you are doing direct pixel operations on the permanent GdkImage that you created and occasionally tell the X server to update a window based on your shared image, this should be fast. Data transfers over unix sockets generally go: while (not finished writing and no errors) write (8kb chunks of remaining data); If you are using shared memory, then you still need to wake up the X server process for it to copy the data internally in its own process - unless these are really huge images, you are not gaining much by using XSHM. Its really hard to say what will be optimal for your situation without a little more context on what you want to achieve. 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: Custom container widget - childs drawn in top-left corner of window
On Dec 15, 2007 8:46 AM, Stephan Arts [EMAIL PROTECTED] wrote: Hi, I am having an issue with a new container widget I am writing. I have overridden the size_request and size_allocate methods.[0] For some reason, the children are all rendered in the top-left corner of the main window. Not even near the container. [...] child_allocation.x = allocation-x + border_width; child_allocation.y = allocation-y + border_width; child_allocation.width = 70 - border_width; child_allocation.height = 70 - border_width; Looks like you ignored the allocation here and just assigned 70... /* if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (widget-window, allocation-x + border_width, allocation-y + border_width, allocation-width - border_width * 2, allocation-height - border_width * 2); } */ And your problem is here, since you never moved your GdkWindow to where it is supposed to be, it is infact still at its default location at the top-left corner of its parent window. 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: Custom container widget - childs drawn in top-left corner of window
On Dec 15, 2007 8:46 AM, Stephan Arts [EMAIL PROTECTED] wrote: Hi, I am having an issue with a new container widget I am writing. I have overridden the size_request and size_allocate methods.[0] For some reason, the children are all rendered in the top-left corner of the main window. Not even near the container. [...] child_allocation.x = allocation-x + border_width; child_allocation.y = allocation-y + border_width; child_allocation.width = 70 - border_width; child_allocation.height = 70 - border_width; Looks like you ignored the allocation here and just assigned 70... [...] /* if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (widget-window, allocation-x + border_width, allocation-y + border_width, allocation-width - border_width * 2, allocation-height - border_width * 2); } */ And your problem is here, since you never moved your GdkWindow to where it is supposed to be, it is infact still at its default location at the top-left corner of its parent window. 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: Question about the realize signal
On Dec 4, 2007 12:51 PM, Jim George [EMAIL PROTECTED] wrote: On Dec 4, 2007 3:06 AM, Dan H [EMAIL PROTECTED] wrote: Hello, Hi, first about your radio buttons, you can set them to be in container mode in the property editor, this will allow you to remove the label and put anything you want inside, if you just leave the placeholder then there will be nothing. If you have real custom widgets (i.e. they actually register a type in the GType system), then please read my blog post [1] about the simplest way to integrate custom widgets into glade. If you still find reasons that you absolutely must play with your hierarchy (surely there is always something), I would not recommend the realize handler. realizing widgets will normally never result in the creation of widgets, only thier backend screen resources are allocated in realize(), it just seems a weird place to do it (some things could be realized twice because of that). I would think the best place is somewhere around g_object_unref(GladeXml *xml), in otherwords after glade_xml_new() and somewhere before gtk_main(). Cheers, -Tristan [1] http://blogs.gnome.org/tvb/2007/07/25/some-popular-features/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Slow UI updates with GtkImage
On Nov 27, 2007 6:11 AM, David Brigada [EMAIL PROTECTED] wrote: Hi, I'm working on an audio player application. I currently have two elements that change on a frequent basis: a GtkHScale and a GtkImage. Whenever I update the data, I call gtk_widget_queue_draw on the widget that changed. With just the slider updating every 200ms, it works fine. If I add the GtkImage changing (by swapping out the GdkPixbuf with gtk_image_pixbuf_set) or I call gtk_widget_queue_draw on the widget, the UI waits about 2.5s in between redraws on both the slider and the image. This event happens about every 186ms. Is there something that I should be doing differently here? Is this method horribly inefficient? What should I change? You should not have to call gtk_widget_queue_draw() at all in this case (I'm sure the gtkimage gtkscale implementations do this themselves when you update the image or adjustment values). Rather, how is your application structured ? do you use a thread for the audio or are you processing audio data for 2.5s intervals before ever returning control to the gtk+ main loop ? (are you blocking or read or write maybe ?). Even if you get it all right though, remember that you can still get resource starvation when writing a media streaming app, probably your audio processing thread is a higher priority. 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: Set widget size in percentage
On Dec 8, 2007 4:50 AM, Prashant J Zaveri [EMAIL PROTECTED] wrote: Hello... I am writing a gtk application to run on some other display. I want to maintain the size and layout of widgets that I have set on my desktop.For that I would like to specify widget size in percentage. Any idea how can I do that... Using the containers provided by gtk+ (GtkBox/GtkTable etc) will do this automatically. If you have a specific need you might look at GtkAspectFrame, it uses aspect ratio to place one widget inside at specified size and coordinates (the contained widget could in turn be another container ofcourse). 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: Question about the realize signal
On Dec 4, 2007 12:51 PM, Jim George [EMAIL PROTECTED] wrote: On Dec 4, 2007 3:06 AM, Dan H [EMAIL PROTECTED] wrote: Hello, Hi, first about your radio buttons, you can set them to be in container mode in the property editor, this will allow you to remove the label and put anything you want inside, if you just leave the placeholder then there will be nothing. If you have real custom widgets (i.e. they actually register a type in the GType system), then please read my blog post [1] about the simplest way to integrate custom widgets into glade. If you still find reasons that you absolutely must play with your hierarchy (surely there is always something), I would not recommend the realize handler. realizing widgets will normally never result in the creation of widgets, only thier backend screen resources are allocated in realize(), it just seems a weird place to do it (some things could be realized twice because of that, I wonder if mucking about with the hierarchy in realize() could sometimes provoke some bugs). I would think the best place is after glade_xml_new() and before gtk_main(). Cheers, -Tristan [1] http://blogs.gnome.org/tvb/2007/07/25/some-popular-features/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Contents of VBox don't draw after putting it in Viewport
On Dec 2, 2007 3:07 PM, Jeffrey Barish [EMAIL PROTECTED] wrote: It's a long shot, but I am hoping that someone might recognize my problem from this general description. I tried to reduce my code to a test case, but it works there. After spending an entire day on this problem, I am stumped. Jeff, I dont know exactly what is going on but I can try to give you some hints. Notebooks are a kind of exception in gtk+ because they actually map()/unmap() widgets according to which page is showing. This effects the order in which widgets are initially realized. If for instance, your toplevel widget is already realized then adding pages to the notebook (and thier contents recursively) will result in all pages being realized at the start, on the other hand if your toplevel is invisible, or your notebook is not anchored at creation time (anchored means inside a toplevel somewhere), then the subhierarchies will only be realized when those pages are gtk_widget_show()n AND in an active notebook page. You might try making sure that all of your pages are realized at the startup, this would typically mean after glade_xml_new() with a visible toplevel, you would call gtk_notebook_set_page() for each page provoking a realize before ever entering gtk_main(). You also might try adding some gtk_widget_queue_draw() sugar. ofcourse these solutions, if they even turn out to be solutions are not ideal, but might help pinpoint what is foul in your current setup (or maybe help us to pinpoint a possible bug in gtk+). 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: Slow UI updates with GtkImage
On Nov 27, 2007 6:11 AM, David Brigada [EMAIL PROTECTED] wrote: Hi, I'm working on an audio player application. I currently have two elements that change on a frequent basis: a GtkHScale and a GtkImage. Whenever I update the data, I call gtk_widget_queue_draw on the widget that changed. With just the slider updating every 200ms, it works fine. If I add the GtkImage changing (by swapping out the GdkPixbuf with gtk_image_pixbuf_set) or I call gtk_widget_queue_draw on the widget, the UI waits about 2.5s in between redraws on both the slider and the image. This event happens about every 186ms. Is there something that I should be doing differently here? Is this method horribly inefficient? What should I change? You should not have to call gtk_widget_queue_draw() at all in this case (I'm sure the gtkimage gtkscale implementations do this themselves when you update the image or adjustment values). Rather, how is your application structured ? do you use a thread for the audio or are you processing audio data for 2.5s intervals before ever returning control to the gtk+ main loop ? (are you blocking or read or write maybe ?). Even if you get it all right though, remember that you can still get resource starvation when writing a media streaming app, probably your audio processing thread is a higher priority. 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: Maybe I need to use threads. I've been using gtk_main_iteration_do() but having problems
On Tue, 2007-10-16 at 16:12 -0600, Jeff Eberl wrote: [...] First is that the display doesn't do anything when my program is doing it's thing. So it looks like it freezes. I'm okay with that. I've never used threads before, and I'm not sure this is the best project to start with. ofcourse this can be fixed by splitting up whatever your app does into smaller less cpu/load intensive itterations thus updating the gui more often, but that involves work (just like integration your execution into timeout/idle callbacks would involve work). Second is the most annoying part. Since there is no loop, gtk_main_quit() doesn't work, and when I click the little [X] in the corner, the destruction begins, calls my WindowDestroyEvent that I set up in the signals, but my program has no idea that the window has been destroyed. How can your program have no idea that the window is being closed if you set the signal handler for delete-event ? Then the program keeps making the same calls to gtk. So gtk spits out a bunch of messages about how everything is failing. Is there a way to check to see if the window has been destroyed? I could put a member boolean that changes when WindowDestroyEvent gets called but that seems like a suspicious hack. However you do it, its definitely up to you to bookkeep that information (some might keep a pointer to the active display window and set it to NULL when the window is destroyed, I dont see how thats better than a boolean variable). For elegancy, you might want to add it to a structure that gets passed around to all callbacks instead of crudely packing it into global scope. 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: How to change root window coordinates
On Sun, 2007-08-12 at 19:09 -0700, Matthew Jiang wrote: I was porting gkt to an embeded system. The problem is that I always got unwanted display offset on LCD. I used gdk_window_get_root_origin function get origin position and found root_x equals a wiered number not zero. How could I fix this problem and can I reset coordinate by hand? I think you need to fix this in your hardware, usually the LCD these days will have an automatic calibration button or on older models you need to manually shift/resize the display. 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: Libglade resource consuming question.
On Thu, 2007-08-09 at 12:55 -0400, Carlos Savoretti wrote: Hi all! [...] Do I be clear ? (When doubt appears it's probably not...) Shortly: GladeXml objects with a moderate amount of widgets are very resource consuming ? or not compared against xmlDocDumpFormatMemory () result ? You can take a lot of different approaches depending on what your priorities are - parsing glade files can be time consuming as well as memory consuming. a buffer with glade file contents probably weighs around the same as a GladeXML tree - but remember - you NEVER have a GladeXML tree lying around (it only serves the purpose of creating the widget heirarcy, after that its useless). If you need to rebuild the hierarchy, you need to keep the buffer around, if you build everything at once, you can free the buffer *and the GladeXML object* and just gtk_widget_show/hide() the built widgets as needed. Cheers, -Tristan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list