Re: Can g_file_monitor_file () report events from before it was created?
On Wed, 2011-09-07 at 03:18 +0100, Peter Clifton wrote: > --=-RBhkyZn6RRXPH6Tyg7fR > Content-Type: text/plain; charset="UTF-8" > Content-Transfer-Encoding: quoted-printable > > On Tue, 2011-09-06 at 01:42 +0100, Peter Clifton wrote: > > --=3D-1PQvPQuhjpa09GLvybFI > > Content-Type: text/plain; charset=3D"UTF-8" > > Content-Transfer-Encoding: quoted-printable > >=20 > > Hi, > >=20 > > I'm working on some code to monitor for file changes in our application, > > and ran into a bit of a problem today with the Save-As case. > >=20 > > The order of operations is something like: > >=20 > > 1. File monitor exists on the document file which was loaded last > > 2. User hits File->Save as.. (and enters a filename) > > ^__ Just as an interesting (and probably critical note), I don't see > this bug if I hard-code a Save-as filename. > > I only get unexpected file-monitor events if I use a > gtk_file_chooser_dialog to select the new filename to save into. Futhermore - it only breaks if the dialog is set to an initial location with something like: gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), *path); (Or left to pick the current working directory, where the file is). If I set the current folder to "/", e.g.: gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), "/"); Then navigate to the directory I'm going to save into from within the GUI, the problem does not occur. -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can g_file_monitor_file () report events from before it was created?
On Tue, 2011-09-06 at 01:42 +0100, Peter Clifton wrote: > --=-1PQvPQuhjpa09GLvybFI > Content-Type: text/plain; charset="UTF-8" > Content-Transfer-Encoding: quoted-printable > > Hi, > > I'm working on some code to monitor for file changes in our application, > and ran into a bit of a problem today with the Save-As case. > > The order of operations is something like: > > 1. File monitor exists on the document file which was loaded last > 2. User hits File->Save as.. (and enters a filename) ^__ Just as an interesting (and probably critical note), I don't see this bug if I hard-code a Save-as filename. I only get unexpected file-monitor events if I use a gtk_file_chooser_dialog to select the new filename to save into. I'm presuming that this dialog (or some IO plugin) may use g_file_monitor, or threads, or SOMETHING - which is causing issues with my own usage of g_file_monitor. If anyone could help shed some light on this, it would be much apprecaited. > 3. Core of app saves file into the new file name > 4. File monitor does not fire, as the saved file is not the one being monit= > ored > 5. Core of app notifies the GUI (with the file monitor) that the document w= > e should be watching is now in the new filename. > 6. g_object_unref() the old file monitor > 7. Create new file monitor on the new file. > > After this happens, I actually get a change event fire from the new file > monitor - despite the changes having been saved by the app's core > (fopen / fclose directly to the file in question), before I even created > the file monitor. > > Is it possible that Glib / GIO is caching some state incorrectly, and > spotting on-disk changes from _before_ I created the file monitor, or is > it more likely that the file doesn't "hit the disk" until some time > after I fclose() it - and that it spots the change at this point in > time? > > Any ideas what I might be doing wrong here? > > (PS. I got the feeling GLib / GIO is using polling, not anything clever > like inotify to spot changes - is this correct?) > > Best regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Can g_file_monitor_file () report events from before it was created?
Hi, I'm working on some code to monitor for file changes in our application, and ran into a bit of a problem today with the Save-As case. The order of operations is something like: 1. File monitor exists on the document file which was loaded last 2. User hits File->Save as.. (and enters a filename) 3. Core of app saves file into the new file name 4. File monitor does not fire, as the saved file is not the one being monitored 5. Core of app notifies the GUI (with the file monitor) that the document we should be watching is now in the new filename. 6. g_object_unref() the old file monitor 7. Create new file monitor on the new file. After this happens, I actually get a change event fire from the new file monitor - despite the changes having been saved by the app's core (fopen / fclose directly to the file in question), before I even created the file monitor. Is it possible that Glib / GIO is caching some state incorrectly, and spotting on-disk changes from _before_ I created the file monitor, or is it more likely that the file doesn't "hit the disk" until some time after I fclose() it - and that it spots the change at this point in time? Any ideas what I might be doing wrong here? (PS. I got the feeling GLib / GIO is using polling, not anything clever like inotify to spot changes - is this correct?) Best regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me) ___ 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 Mon, 2008-12-29 at 22:56 -0500, Yu Feng wrote: > I've just written a similar widget. > > You should subclass GtkMenuItem, > override toggle_size_request, return zero to the *requistion parameter. > > implement the creation methed > new_with_label(), > put a GtkLabel as the child of the bin in the creation method. > > You may also need to override size_allocate and size_request method. Thanks! I've been away, but I will try to see if there is any interest in getting additional flexibility in the stock GtkMenuItems, along the lines of Tristan Van Berkom's suggestion. -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Menu bar items without icon indent
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 For gnome-panel. Am I right in thinking that I'll have to make a GtkMenuItem subclass to override the allocation I give to my label child? Secondly, is there any easy way to use the existing widgets and achieve the indenting effect as shown in the above linked screenshot? (If not - custom subclass again, right?) -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Scroll wheel events not working under WindowsXP
On Sun, 2008-11-23 at 08:02 +0100, Giuseppe Torelli wrote: > On Fri, Nov 21, 2008 at 9:10 PM, Peter Clifton <[EMAIL PROTECTED]> wrote: > > On Linux, and built for Win32, tested under wine, scrolling works. > > Hi, > I want to develop an application both under Linux and Windows with Gtk+2. > I wonder how is it possible to compile a .exe for Windows under a > Linux platform. > > Can you please give me a link explaining how this could be achieved? I'm using the mingw32 cross compiler. A Google search for that term should help. I found this: http://ricardo.ecn.wfu.edu/~cottrell/cross-gtk/ It is a little out of date, since it describes a method where you change the CC environment variable to point at the cross compiler. With recent GNU autotools, you can just configure with flags such as: host=i586-mingw32msvc build=i686-pc-linux-gnu CFLAGS='-O3 -s -mms-bitfields -march=i686' CXXFLAGS=$CFLAGS (Or similar). You need the -mms-bitfields, and if you want to get rid of the console window on your app (after debugging probably), add -mwindows to the CFLAGS. I'm not doing this directly, I'm using a set of scripts and recipes written by a collegue in the gEDA project to fetch and build all our prerequisites (including GTK) from source. http://archives.seul.org/geda/dev/Oct-2008/msg00170.html Hope that helps get you started. Best regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Scroll wheel events not working under WindowsXP
On Fri, 2008-11-21 at 15:22 -0500, Daniel Atallah wrote: > > > Is this a "real" scrollwheel or a simulated scrollwheel in a touchpad? > > See http://bugzilla.gnome.org/show_bug.cgi?id=542777 Got it in one, I think.. its a touchpad. I'll try with a real mouse. Uncanny,.. its almost the same model laptop as in the bug report. Thanks! > -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Scroll wheel events not working under WindowsXP
Hi, I'm developing a CAD application which uses a GtkDrawingArea for its schematic page view, and handles scroll wheel events to pan the schematic being viewed. On Linux, and built for Win32, tested under wine, scrolling works. Under WindowsXP, the scroll events seem to be eaten somehow. The mouse icon changes to the pointer+scroll-bar icon which you get when scrolling (for example), a console window, but my signal handler isn't being called (or at least, my schematic isn't scrolling). Does anyone have any ideas (given the above description), what might be going wrong on WinXP? Does anyone have any working example-code which shows scroll events working on Win32? Can you think of any GTK using applications on Win32, which definitely do have working scroll wheel handling? Best regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Best practices for laying out controls
On Tue, 2008-05-13 at 13:24 -0400, Dave Foster wrote: > Hi, > > I'm currently developing an application which has a lot of input widgets to > it. After consulting the HIG [1], specifically the portion about Window > Layout [2], it left me quite confused with exactly how I should implement > the guidelines it suggests. I understand the importance of alignment and > good visual flow here, but I'm not sure which containers/widgets I should be > using in order to achieve a nice, aligned layout. > > Originally, I was using a GtkTable but I am not convinced that it is the > proper container. I was led to use this by the fact that I wanted labels > (in a column) to be all aligned based on the largest size of the labels, and > the controls on the right (in another column) to be aligned to the left > there, all making a neat line. However, working with a GtkTable in glade-3 > has been a bit problematic, and I'm seeking suggestions as to how other > people would lay out a dialog, using what containers, etc. GtkSizeGroup might be of interest: http://library.gnome.org/devel/gtk/2.12/GtkSizeGroup.html I'm afraid I'm not so current on GTK stuff that I can offer a more detailed explanation. Best regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Keep window on top?
On Fri, 2008-01-11 at 10:18 -0500, Randy Poe wrote: > I'm experimenting with a modal dialog and finding that it > has an unfortunate behavior. There is nothing forcing the > window to stay on top. As a result, you can click on the > underlying window to bring it up, but because there is > an active modal dialog the main window is unresponsive, > and the user has no clue why. > > This is in Linux. > > Is there a call which will force the window to stay on top? gtk_window_set_transient_for (window, parent); http://library.gnome.org/devel/gtk/stable/GtkWindow.html#gtk-window-set-transient-for -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Switch contents in the same window
On Mon, 2007-10-01 at 10:54 +0200, [EMAIL PROTECTED] wrote: > Sorry Yeti, but it's not what I'm searching for: I cannot implement > GtkAssistant > because I'm working on GTK+ 2.6 on an embedded system... > Is there another way to obtain what I deserve? > Thanks in advance, Take a look at using a GtkNotebook for your "pages", and hide the tabs. You should then be able to introduce buttons at the bottom of your dialog to pragmatically switch between the pages. This has been a common way to implement GtkAssistant like interfaces before the new API in 2.10 Regards, Peter Clifton ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Switch contents in the same window
On Mon, 2007-10-01 at 10:11 +0200, David Nečas (Yeti) wrote: > On Mon, Oct 01, 2007 at 10:10:57AM +0200, [EMAIL PROTECTED] wrote: > > How can I switch two contents in the same main window? > > I have a tabbed application, and I want to create a searching page where, > > when I > > click the "find" button, it switches and showes the search results, and > > when I > > click the "Back" button it returns to the searching page again (for a new > > search). > > Look at GtkAssistant. I've not had any replies to my query regarding GtkAssistant, which has some tangential relevance to this suggestion. Is there an accepted way of finishing on a button which isn't a stock apply or close? (I believe if the OP were to use GtkAssistant, they may want to replace the stock "Forward" button on their search page with a "Find" button, for example. The C API exposes these GtkWidgets as part of its public structure, but the PyGTK binding doesn't. As it is, I've not found the GTK assistant API sufficiently helpful to warrant its GTK 2.10+ dependency, unfortunately the software suite I'm writing for has to build on GTK 2.4+ (accepting some features may be degraded / absented with #ifdef). Regards, Peter Clifton ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Theory of good signal/event API design?
On Tue, 2007-09-25 at 22:16 +0200, Sander Marechal wrote: [snip] > Actually, I am not interested in the underlying technology at all. What > I am interested in is: When you write a signal/event driven program or a > widget or whatever, how do you figure out what signals to send out, so > other people can actually do something useful with it? > > It's a purely theoretical software engineering question. So far I have > been adding events to my application whenever I needed them myself, but > I would like to have a nice, complete set of events so other people can > do useful things with them too. > > I had hoped that the GTK community, having built so many widget and > event driven applications, would have some kind of guidelines, theory, > policy or just general good advice on that. As far as I could tell, the GTK + GLib design (and other similar libraries) seems to be based on expected use-cases of the API, so asking what potential users of the library code might want to do with its objects and API. So I guess for your code, you need to think about the objects you're exporting, and what people might think to do with them. Then write API which facilitates that. The tricky thing is getting this right - especially if your ABI / API has to be set in stone (like that for released versions of GTK + GLib). I'm sure there are many things which would be changed in GTK if they were written again now without the requirement to keep ABI / API frozen. -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkAssistant ending with a custom button
Hi, I'm trying to use a GtkAssistant for a "Create new project" interaction where the user picks a project template, then a file-name and location (With a GtkFileChooserWidget in the assistant page). >From here, I'd like to finish the interaction, so this is the last page of the assistant with a type of ASSISTANT_PAGE_CONFIRM. What I'd like to change however, is the stock "Apply" button which this ends on, as the interaction dictates it would be best to have a button, perhaps labelled "Create", and with the stock "new" icon. The application I'm working on is in Pygtk, so is this an issue of incomplete binding, is it impossible in general, or have I missed how to do it? Kind regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gobject constructor question
On Tue, 2007-09-04 at 20:34 +0800, Binary Chen wrote: > > > I have a doubt of GObject's constructor machnism, do i need to > explicit > to invoke the parent's constructor in a chiild constructor? Yes, call that first, something along these lines: /* chain up to constructor of parent class */ object = G_OBJECT_CLASS (myobject_parent_class)-> constructor (type, n_construct_properties, construct_params); myobject = MYOBJECT (object); The variable saving the parent class is at the toplevel of the file: static GObjectClass *myobject_parent_class = NULL; And you'll have saved the parent class in the class init function: myobject_parent_class = g_type_class_peek_parent (klass); -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: dynamic gtk_list_store
On Tue, 2007-08-21 at 22:20 +0200, Martijn Bos wrote: > Hi list, > > I'm wondering whether it's possible to create a gtk_list_store at runtime. > > Sometimes my data has (for instance) 1 column and sometimes my data has (for > instance) 8 columns. (It will be read from file) > > As far as I have seen in he documentation, the model is "designed" when > programming. > > Is there a possibility to create the model (and the necessary views) at > runtime? > > If yes can you please point me to some documentation or hints? Look at gtk_list_store_newv (), it takes an array of GTypes rather than being a vararg function. You should be able to construct the array at run-time. http://library.gnome.org/devel/gtk/stable/GtkListStore.html#gtk-list-store-newv Or use "devhelp", which displays the same help content locally if you have the appropriate -doc packages installed for your distribution. Regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Creating object based on GObject
On Mon, 2007-08-13 at 13:07 +0200, Tomasz Jankowski wrote: > Hello! > > I want to do such thing: Object, during create process, should be added to > objects' table (GHashTable). In this table I use one of objects' properties > as key (each object have other value of this property). This property is set > only during 'g_object_new' execution and it can't be changed later by user. > The problem is that object should be added to that list during > 'g_object_new' call too and I don't know how can I do it. I tried to do it > in 'instance_init', but it was bad idea, because properties are still set > with default values, they are set with values passed to 'g_object_new' after > 'instance_init'. > > Is there any way to do it during 'g_object_new' run? Override the construct method of GObject, In your construct function: 1. Chain up to the parent (GObject) class's construct method 2. Act upon your construct properties. Regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkTextView insensitive color?
Hi, I've got a GtkTextView widget (made insensitive under various conditions), however the text is always rendered black. All other widgets grey out text when made insensitive. This is with the Clearlooks theme, however it happens the same for all themes I have installed. I've tried: GdkColor color; gdk_color_parse ("red", &color); gtk_widget_modify_text( textview, GTK_STATE_NORMAL, &color ); gdk_color_parse ("green", &color); gtk_widget_modify_text( textview, GTK_STATE_INSENSITIVE, &color ); which correctly changes the normal text color, however when the widget is made insensitive, it stays red. Is this behaviour intentional? If so, what is the cleanest way to override it and get a "standard" (theme dependent) insensitive color. -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Not show selection of a tree view column
On Thu, 2007-07-26 at 15:06 +0100, Dave Howorth wrote: > Peter Clifton wrote: > > I think a brand new widget might be needed - one which has a more > > "table" like rendering model. > > I presume a GtkTable isn't table-like enough :) GtkTable is a container for widgets, and (as far as I know) doesn't support cell renderers, nor a model based backend. I think what both use-cases want is a GtkTreeView which supports certain cells spanning multiple columns or rows. Obviously this doesn't fit well into the existing MVC + API. Thanks for the thought though. Another thing I briefly considered was GtkSheet, but its a bit too spread-sheet like, and again IIRC, doesn't support standard GtkCellRenderers which would be a big plus. -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Not show selection of a tree view column
On Thu, 2007-07-26 at 09:35 -0400, Dave Foster wrote: > Hi folks, > > Was wondering if it was possible to have a column omitted from the selection > bar in a gtk treeview. I've made a custom renderer which displays a strip > of an image, so you can split that image over a number of rows. It looks > terrible with selection rectangles behind it, even worse with the dotted > highlight rectangle that occurs when using the keyboard to focus a row. I'd > like to be able to tell gtk to not select that row at all. Any ideas? > > Another possible idea would be that I have my custom renderer wrong, drawing > on the wrong thing or wrong layer, not too sure about that. Maybe it is > possible to use the custom renderer to draw the selection rectangle too? > > More description and (pretty?) screenshots can be found on my blag: > http://d.minuslab.net/?p=43 I love the screen-shots, but I fear doing this properly is something which GtkTreeView can't do. In an application I'm working on, I would really love to use a row which spans columns for the purpose of rendering a: "Click here to add new field" row. I unfortunately ended up having to put a (much shorter) text in the first column. I get the feeling that too much of GtkTreeView's implementation is private to be able to subclass it and provide this additional functionality, not to mention that its rendering model is very specific to columns. I think a brand new widget might be needed - one which has a more "table" like rendering model. It might be possible to start from GtkTreeView's code - but its a scary "C" file, and I quickly realised I didn't have the time / knowledge to write the new widget myself. Regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Vector screen capture with Cairo
Hi, This may be a dumb question, but I've got cause to want vector-based a screen capture for inclusion in user-documentation. This produces a nice scalable, (and hopefully memory efficient) way to show a screen capture of a program. Since GTK and Gdk use Cairo, and Cairo supports Postscript output, it seems logical to think it might be possible to use a suitably modified Gdk library to produce such output. Does anyone know of similar attempts? I presume the place to start is in the backends of Gdk, along the lines of the x11, or quartz directories. There would also presumably be need to ensure the program starts up and displays its-self as intended for the screen shot, then exits. I realise this isn't "easy", but does any one have any suggestions how it might be possible to proceed? Regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: spec for accelerator string
On Fri, 2007-02-16 at 00:42 -0500, Dan McMahill wrote: > quoting from: > > http://developer.gnome.org/doc/API/2.0/gtk/gtk-Keyboard-Accelerators.html#gtk-accelerator-parse > > > "Parses a string representing an accelerator. The format looks like > "a" or "F1" or "z" (the last one is for > key release). The parser is fairly liberal and allows lower or upper > case, and also abbreviations such as "" and "". > > If the parse fails, accelerator_key and accelerator_mods will be set to > 0 (zero). > > accelerator : string representing an accelerator > accelerator_key : return location for accelerator keyval > accelerator_mods :return location for accelerator modifier mask > " > > Ok, so I give up. Where exactly is this format documented? For > example, I can't seem to get "F1", "F2", etc to work and I'm not sure > what to enter for the tab, space, page up/down, backspace, delete, etc keys. > > Also, is there a list of non-allowed keys for menu accelerators? Hi Dan, I've not spotted any docs anywhere for that either, and as per standard GTK and GLib development requirements, keep a copy of the full source-code to trawl through... I hope your request for better documentation doesn't get shot down in flames like the last one. If you grab the source tarball, and look under gdk/gtkkeynames.c, you will find an array which defines all the key names. The ones mentioned: ':' -> "colon" '=' -> "equal" "=" -> (I'd guess equal, or similar?) '/' -> "slash" I've no idea which the square brackets are... Looking at the character codes in Gnome's charmap, I think it is: { 0x5b, "bracketleft" }, { 0x5d, "bracketright" }, Af first skim, my guess was that these were for round brackets though. > Evidentally these cause problems: > > (pcb:4288): Gtk-WARNING **: Unable to parse accelerator ':' for action > 'MenuItem66' > (pcb:4288): Gtk-WARNING **: Unable to parse accelerator '=' for > action 'MenuItem133' > (pcb:4288): Gtk-WARNING **: Unable to parse accelerator '=' for action > 'MenuItem139' > (pcb:4288): Gtk-WARNING **: Unable to parse accelerator '/' for action > 'MenuItem187' > (pcb:4288): Gtk-WARNING **: Unable to parse accelerator '[' for action > 'MenuItem188' > (pcb:4288): Gtk-WARNING **: Unable to parse accelerator ']' for action > 'MenuItem189' > > Thanks > -Dan > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Autocompletion with GtkComboBoxEntry
On Sun, 2006-11-05 at 00:03 -0500, David Hampton wrote: > On Sun, 2006-11-05 at 02:52 +0000, Peter Clifton wrote: > > Hi, > > > > I have been browsing the docs (and Google) to see if I can use an > > GtkEntryCompletion with a GtkComboBoxEntry widget. So far, it looks like > > the answer is "perhaps". > > I implemented GtkComboBoxEntry completion for GnuCash. Take a look at > the functions in > > http://svn.gnucash.org/trac/browser/gnucash/trunk/src/core-utils/gnc-gtk-utils.c > > and see if they do what you want. > > David I've not compiled it, but from reading the code, it looks like _exactly_ what I want. (There was me thinking: entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cbe))); was crazy talk when I posted a similar line to see if it was a possible starting point!.. I must be getting better acquainted with GTK if I can figure such things out now!) Many thanks for your reply, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Autocompletion with GtkComboBoxEntry
Hi, I have been browsing the docs (and Google) to see if I can use an GtkEntryCompletion with a GtkComboBoxEntry widget. So far, it looks like the answer is "perhaps". I found this post, and the code does (in principle) what I want: http://mail.gnome.org/archives/gtk-perl-list/2004-May/msg00145.html However, it uses the deprecated GtkCombo widget (which I of course don't want to use). (Oh.. my language is C, that example was just one I found) Can I get a pointer to the GtkEntry widget used in the combo-box, and start from there? I couldn't see any API to get it explicitly. Would gtk_bin_get_child( GTK_BIN( combo_box_entry_pointer ) return the entry widget? Any help or advice on how to auto-complete with a GtkComboBoxEntry would be much appreciated. Regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Rendering bug after GTK+2.10.1 with GtkTreeViewCellRenderer
Hi, I'm working on a project which uses a subclassed GtkTextView as a custom cell renderer for displaying and editing multi-line text in a tree view column. I didn't write the code, but it appears plausible. It simply implements the GtkCellEditable interface. Since GTK+-2.10.1, there is a rendering bug, where the widget to edit a cell gets allocated zero height, and of course then doesn't display very usefully. (Version number was inferred from the tags in the CVS viewer at this change: http://cvs.gnome.org/viewcvs/gtk%2B/gtk/gtktreeview.c?r1=1.562&r2=1.563 """ 2006-07-18 Kristian Rietveld <[EMAIL PROTECTED]> Fix for #335012, reported by Matteo Nastasi. * gtk/gtktreeview.c (gtk_tree_view_real_start_editing): if the requested space of the editable is smaller than the cell area, put it up above the middle of the cell area. """ ) Since this change, as the tree view handles the initialisation of the custom renderer, it asks the size of the widget. GtkTextView (incorrectly?) returns zero height and width, which causes me to get a zero/one(?) pixel high cell renderer when editing the cell. (Displaying the cell works fine). Could there be a "race" between the gtktreeview wanting to know the size before realising / displaying the widget, and the gtktextview not knowing its size until afterwards? Breakpoint 2, gtk_text_view_size_request (widget=0x82fba20, requisition=0xbfcf4960) at gtktextview.c:2764 2764in gtktextview.c (gdb) print *(GtkTextView *)0x82fba20 $1 = {parent_instance = {widget = {object = {parent_instance = { g_type_instance = {g_class = 0x8313c78}, ref_count = 1, qdata = 0x8370910}, flags = 2100738}, private_flags = 13312, state = 0 '\0', saved_state = 0 '\0', name = 0x0, style = 0x8146098, requisition = {width = 0, height = 0}, allocation = {x = -1, y = -1, width = 1, height = 1}, window = 0x0, parent = 0x0}, focus_child = 0x0, border_width = 0, need_resize = 0, resize_mode = 0, reallocate_redraws = 0, has_focus_chain = 0}, layout = 0x8311720, buffer = 0x83758d0, selection_drag_handler = 0, scroll_timeout = 0, pixels_above_lines = 0, pixels_below_lines = 0, pixels_inside_wrap = 0, wrap_mode = GTK_WRAP_NONE, justify = GTK_JUSTIFY_LEFT, left_margin = 0, right_margin = 0, indent = 0, tabs = 0x0, editable = 1, overwrite_mode = 0, cursor_visible = 1, need_im_reset = 0, accepts_tab = 1, width_changed = 0, onscreen_validated = 0, mouse_cursor_obscured = 0, text_window = 0x8371a80, left_window = 0x0, right_window = 0x0, top_window = 0x0, bottom_window = 0x0, hadjustment = 0x0, vadjustment = 0x0, xoffset = 0, yoffset = 0, width = 0, height = 0, virtual_cursor_x = -1, virtual_cursor_y = -1, first_para_mark = 0x836e270, first_para_pixels = 0, dnd_mark = 0x836e420, blink_timeout = 0, first_validate_idle = 160, incremental_validate_idle = 161, im_context = 0x8351660, popup_menu = 0x0, drag_start_x = -1, drag_start_y = -1, children = 0x0, pending_scroll = 0x0, pending_place_cursor_button = 0} It looks like the widget is fairly uninitialised at this point: requisition = {width = 0, height = 0}, allocation = {x = -1, y = -1, width = 1, height = 1}, window = 0x0, parent = 0x0}, focus_child = 0x0, border_width = 0, need_resize = 0, resize_mode = 0, reallocate_redraws = 0, has_focus_chain = 0} admittedly, gtk_text_view_size_request actually sets some of these rather than reading them, but I'm unsure whether the layout member actually has any sensible value at this point. It contains: (gdb) print *((GtkTextView *)0x82fba20)->layout $4 = {parent_instance = {g_type_instance = {g_class = 0x82fd748}, ref_count = 2, qdata = 0x0}, screen_width = 0, width = 0, height = 0, buffer = 0x83758d0, default_style = 0x0, ltr_context = 0x0, rtl_context = 0x0, one_style_cache = 0x0, one_display_cache = 0x0, wrap_loop_count = 0, cursor_visible = 0, cursor_direction = 0, keyboard_direction = 0, preedit_string = 0x0, preedit_attrs = 0x0, preedit_len = 0, preedit_cursor = 0} Since I'm not particularly familiar with the (perhaps necessarily) complicated way which GTK handles widget allocation, I'm not sure exactly what is going on here. Any thoughts? Is it a bug in GTK, or simply a new "feature" which needs working around since bug #335012 was fixed? Should I take this to the gtk-devel-list? Regards, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list