Re: GTK window winthout main iterator
Add your logic to a function given to glib_idle_add(), and to trigger new drawings call queue_draw and then return from your function. GTK+ will call your draw signal handler. As soon as GTK+ is idle again, your function will be called again. It isn't the usual way of doing things, but it will work. On Tue, Sep 04, 2018 at 07:09:13PM -0300, Juan Ignacio Donoso via gtk-app-devel-list wrote: > I'm trying to create a GUI using gtk I already have a loop that runs my > logic. I was using cairo to draw to a png and flush to /dev/fb0 but now I > want to instantiate a Gtk::Window to draw on it. > > I don't want to run Gtk::Main because just want to trigger new drawings > when my logic trigger it.. > The app is real only there aren't going to be any interactions from the app > ui, only from the internal logic I want to draw. > > Any idea where to look to implement that approach. I was thinking on using > Gtk::main_iteration_do with Gtk::Queue_draw. But I'm not getting it work. > > Do I need to ask for a cairo context on every on_draw signal call? > Do I need to "draw" on the "draw" signal? > > thanks > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- James Cameron http://quozl.netrek.org/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: PyGObject: pep8 konform
Code that uses PyGObject can't be PEP8 conformant without generating version warnings. My practice is to minimise E402 by moving imports, then add .flake8 file with; [flake8] # E402 module level import not at top of file # gi.require_version() is required before later imports ignore = E402 -- James Cameron http://quozl.netrek.org/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Using a TextView as a sort of Hbox with wrapping
Chris, If I interpret what you are trying to do correctly (not necessarily a given), then I would have thought that GtkScrolledWindow (possibly in conjunction with GtkViewport) would be the tool for the job. James On 26 January 2014 14:50, Chris Angelico ros...@gmail.com wrote: My application has a status bar which can have an arbitrary number of items added to it. Currently, I use an Hbox with no padding, which works fine as long as there aren't too many statusbar elements added; but if there are a lot, the tail starts wagging the dog, in that the size of the window becomes dictated by the status bar (which normally is supposed to be subtle, not intrusive/controlling). So I figured that wrapping elements onto another line of status bar would be a more useful way to lay them out, but that's really tricky. Enter TextView: it's a widget designed to handle wrapping, and it can have child widgets embedded in it. Here's some proof of concept code. (This is in Pike, so you may not be able to run it directly.) int main() { GTK2.setup_gtk(); object buf=GTK2.TextBuffer(),view=GTK2.TextView(buf)-set_editable(0)-set_wrap_mode(GTK2.WRAP_WORD)-set_cursor_visible(0); view-modify_base(GTK2.STATE_NORMAL,GTK2.GdkColor(240,240,240)); foreach (({Asdf asdf,Qwer qwer,Zxcv zxcv,Testing, testing,1, 2, 3, 4}),string x) { view-add_child_at_anchor(GTK2.Frame()-add(GTK2.Label(x))-set_shadow_type(GTK2.SHADOW_ETCHED_OUT), buf-create_child_anchor(buf-get_end_iter())); buf-insert(buf-get_end_iter(), ,-1); } GTK2.Window(GTK2.WindowToplevel)-set_default_size(500,300)-add(GTK2.Vbox(0,0) -add(GTK2.Label(Blah blah blah, this\nhas lots and\nlots of content\n\nLorem ipsum dolor sit\namet)) -pack_start(GTK2.Button(This sets the base width),0,0,0) -pack_start(view,0,0,0) )-show_all()-signal_connect(delete-event,lambda() {exit(0);}); return -1; } Two questions. Firstly: Is this a really REALLY stupid thing to do? When I Googled for a wrapping layout manager, nothing mentioned this possibility, so I'm wondering if this is somehow fundamentally bad and I just haven't seen it. And secondly: The TextArea defaults to having a white background, but I want to use the window's default background. On my system, setting the color to (240,240,240) does that, but that means I'm explicitly setting a color, so it's going to be grey even if the UI theme specifies that a window's background should be vibrant orange. Is there a way to tell the TextView not to draw its background, or alternatively, a way to query the default background color for a window? Thanks in advance! ChrisA ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Get column no. of edited cell.
Another possibility would be to use g_object_set_data to give the renderer a column number, and g_object_get_data in the handler. On 2 June 2013 07:15, dE de.tec...@gmail.com wrote: On 06/02/13 00:27, Arnel A. Borja wrote: On Sunday, 02 June, 2013 01:44 AM, dE wrote: I've set the editable property of GtkCellRenderer to true, and set the call back for the edited signal. This particular signal tells the node/row in which the edit has occurred, but not the column/filed. How can I get that? Thanks! Use a different renderer for each column. Then check in the edited signal which renderer was edited. I'm trying this out, but isnt this also possible with gtk_tree_view_get_cursor clubbed with gtk_tree_view_column_get_sort_** column_id. Cause I'm getting segfault with -- gtk_tree_view_get_cursor ( detect_object ( DataDisplay, build_object ), tree_path, focus_column ); Where -- GtkTreeViewColumn **focus_column; GtkTreePath **tree_path; __**_ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/**mailman/listinfo/gtk-app-**devel-listhttps://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
g_timeout handling, is this the best way?
I have a program that uses a g_timeout loop to control the display of a sequence of plots (produced via plplot), and I need to be able to change the delay between displaying the plots. The method I am using is this: 1. Use g_timeout_add_full to create the timeout, with the GSourceFunc as a routine that checks whether a termination flag has been set, and either displays the next frame and returns TRUE or just returns FALSE. 2. Set up a GDestroyNotify function that checks if a restart flag is set and if it has then starts a new timeout loop. 3. The callback that changes the speed, updates the delay and then sets both the termination and restart flags, so that on the next timeout call, the loop is destroyed and recreated with the new delay. Is this the best way to do it or is there a more convenient way? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Lack of gtk_application_get_window_by_id function despite of documentation
On 17 November 2012 16:05, Jakub Kucharski dexc...@gmail.com wrote: I was trying to compile my application and it appears that one documented function called 'gtk_application_get_window_**by_id' ( http://developer.gnome.org/**gtk3/stable/GtkApplication.** html#gtk-application-get-**window-by-idhttp://developer.gnome.org/gtk3/stable/GtkApplication.html#gtk-application-get-window-by-id) doesn't exist. I run Debian Sid on my machine and I've installed 'libgtk-3-dev' package, so I don't really see what's wrong. Maybe this output will be useful for you: According to the Debian package list they are still at 3.4 in Sid, and the routine is marked Since 3.6. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Examples of ComboBox using an explicit model?
Thanks to those who send examples on or off list. With the guidance of those I was able to figure out how the different bits fit together and get a working code. James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Examples of ComboBox using an explicit model?
I am currently trying to implement combobox cell renderers in the high-level gtk-fortran code. Unfortunately unlike normal comboboxes where there is the convenience type of GtkComboBoxText this is not available for cell renderers. I have hunted for examples of a working combobox that uses an explicit tree model without any success. Does anybody on this list have such an example (or even better, of a CellRendererCombo) that they would be willing to share. James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
g_value_set_instance -- how to use?
There is very little documentation that I can find explaining how g_value_set_instance is supposed to work. Is the following anywhere near correct? void my_gvalue_setter( const GValue *gv, gpointer val, Gtype type) { g_value_unset(gv); g_value_init(gv, type); g_value_set_instance(gv, val); } Then provided val is a pointer to a quantity of type type, it's equivalent to using the specific setting routine or am I barking up quite the wrong tree? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Threads and idle functions
(sorry forgot list) On 3 July 2012 01:50, David Buchan pdbuc...@yahoo.com wrote: My understanding is that child threads must never alter the UI in any way. If I have a program which spawns a child thread to download some data and I want to be able to have a dialog pop up should an error occur, is it correct to say that I need an idle function to be running concurrently to monitor some global variable which would contain the status (set by the download thread), and then the idle function would create the dialog pop-up? Put another way, if only the GTK+ main iteration is allowed to alter the GUI, then how does someone get information out of a child thread and to the UI? Well from what I hear, g_idle_add offers some form of thread safety so a child thread can communicate some item of data via a callback executed in the GUI thread. The documentation also seems to support this view: http://developer.gnome.org/glib/2.31/glib-The-Main-Event-Loop.html#glib-The-Main-Event-Loop.description your child/download thread does the monitoring of the error status and when an error is found, use g_idle_add to wait some moments and then communicate the error to a callback. HTH, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Threads and idle functions
On 3 July 2012 02:10, James Morris jwm.art@gmail.com wrote: (sorry forgot list) On 3 July 2012 01:50, David Buchan pdbuc...@yahoo.com wrote: My understanding is that child threads must never alter the UI in any way. If I have a program which spawns a child thread to download some data and I want to be able to have a dialog pop up should an error occur, is it correct to say that I need an idle function to be running concurrently to monitor some global variable which would contain the status (set by the download thread), and then the idle function would create the dialog pop-up? Put another way, if only the GTK+ main iteration is allowed to alter the GUI, then how does someone get information out of a child thread and to the UI? Well from what I hear, g_idle_add offers some form of thread safety so a child thread can communicate some item of data via a callback executed in the GUI thread. The documentation also seems to support this view: http://developer.gnome.org/glib/2.31/glib-The-Main-Event-Loop.html#glib-The-Main-Event-Loop.description Forgive me if I speak as if the thread safety of g_idle_add is something to be doubted. Multi-threaded applications are typically complicated affairs and the ease of use of g_idle_add rather contrasts with my (non-professional) experience. That being said, there are probably limits to what can be accomplished using it but for basic use-cases such as these it is perfect. your child/download thread does the monitoring of the error status and when an error is found, use g_idle_add to wait some moments and then communicate the error to a callback. HTH, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
custom widget theme change problem
Hi, I have a custom GTK widget which renders using Cairo. In the expose callback gtk_widget_get_style is called to obtain colours to render the widget with some theme consistency. When a theme is changed (ie using gtk-chtheme) any of my custom widgets that are visible are not updated. However, after switching to a different notebook tab, I can see previously hidden instances of the custom widget have been updated (switching notebook tabs back again does not trigger update). Can anyone give any pointers as to what might be happening? Thanks, James. GTK 2.24.10 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: custom widget theme change problem
Hello again, Seems to be a habit of mine here, I ask a question, don't get an immediate response and then look further into it and find some sort of solution... On 21 June 2012 10:42, James Morris jwm.art@gmail.com wrote: Hi, I have a custom GTK widget which renders using Cairo. In the expose callback gtk_widget_get_style is called to obtain colours to render the widget with some theme consistency. When a theme is changed (ie using gtk-chtheme) any of my custom widgets that are visible are not updated. However, after switching to a different notebook tab, I can see previously hidden instances of the custom widget have been updated (switching notebook tabs back again does not trigger update). Can anyone give any pointers as to what might be happening? I've found the culprit, or put another way, I've found what to comment out to fix the problem. In my custom_widget_realize callback it has the following code which if I comment out the last three lines of, the problem resolves: window = gtk_widget_get_parent_window (widget); gtk_widget_set_window(widget, window); g_object_ref (window); style = gtk_widget_get_style(widget); style = gtk_style_attach(style, window); gtk_widget_set_style(widget, style); It is code I updated from this old code (which won't compile with GTK_DISABLE_DEPRECATED etc): widget-window = gtk_widget_get_parent_window (widget); g_object_ref (widget-window); widget-style = gtk_style_attach (widget-style, widget-window); This old code (which uses GDK rather than Cairo) doesn't have any problem with theme changes... but without it the widgets aren't updated after theme changes. Scratching head.. James. Thanks, James. GTK 2.24.10 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: custom widget theme change problem
On 22 June 2012 01:50, James Morris jwm.art@gmail.com wrote: Can anyone give any pointers as to what might be happening? I've found the culprit, or put another way, I've found what to comment out to fix the problem. In my custom_widget_realize callback it has the following code which if I comment out the last three lines of, the problem resolves: window = gtk_widget_get_parent_window (widget); gtk_widget_set_window(widget, window); g_object_ref (window); style = gtk_widget_get_style(widget); style = gtk_style_attach(style, window); gtk_widget_set_style(widget, style); Ok I discovered that solution to cause an alternative problem: Gtk-CRITICAL **: IA__gtk_style_detach: assertion `style-attach_count 0' failed Which caused me to the first two of the last three lines (ie without gtk_widget_set_style). The docs for gtk_style_attach say: Since this function may return a new object, you have to use it in the following way: style = gtk_style_attach (style, window) So what am I meant to do with it? thanks james. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkFileChooser selection-changed signal emission on gtk_dialog_run()
Hi, I've got a problem with the selection-changed signal being emitted as soon as gtk_dialog_run is called on a GtkFileChooserDialog. I tried delaying connection of the callback until right before calling gtk_dialog_run but there were still four calls (in a row AFAICT) to the callback. I am now using g_timeout_add as a work-around to delay connection of the signal to my callback and thus prevent the four initial selection-changed emissions activating the callback. Is this normal? Is there a more standard way of doing this? I'm using GTK 2.24.10 in 64bit Arch Linux. Thanks, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkFileChooser selection-changed signal emission on gtk_dialog_run()
On 14 June 2012 16:54, James Morris jwm.art@gmail.com wrote: Hi, I've got a problem with the selection-changed signal being emitted as soon as gtk_dialog_run is called on a GtkFileChooserDialog. I tried delaying connection of the callback until right before calling gtk_dialog_run but there were still four calls (in a row AFAICT) to the callback. I am now using g_timeout_add as a work-around to delay connection of the signal to my callback and thus prevent the four initial selection-changed emissions activating the callback. To put this in context, it's for auto-previewing audio files. The simple implementation causes an audio file to be previewed when gtk_dialog_run is called* or when the current folder is changed in the chooser. By using a dont_preview boolean and connecting the current-folder-changed signal to a callback I can then use g_timeout_add to cancel the dont_preview flag. The flag must be set before gtk_dialog_run is called, and will always be set when the folder is changed. *provided the item initially selected in the chooser is an audio file. Is this normal? Is there a more standard way of doing this? I'm guessing it is normal/standard and that work-a-rounds are necessary if you want to do something like this. I'm using GTK 2.24.10 in 64bit Arch Linux. Thanks, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How do I fix the window size?
On 5 June 2012 11:00, Ferdinand Ramirez ramirez.ferdin...@yahoo.com wrote: I have a treeview and a scrollbar which are both within a hbox. The hbox is within a window. When I expand the treeview, the window resizes itself to include the whole treeview. The biggest problem is when the treeview has more elements than what can be seen on a single screen. The window size becomes larger than the display. I want the window size to remain the same and use my scrollbar to navigate my treeview. How do I achieve this? gtk_window_resize does not seem to be the solution. I think the solution is to place the treeview in a gtk_scrolled_window rather than using an hbox and an explicit scrollbar. You may also need to make a call to gtk_widget_set_size_request on the scrolled window to get what you want. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How do I fix the window size?
On 5 June 2012 12:50, Ferdinand Ramirez ramirez.ferdin...@yahoo.com wrote: --- On Tue, 6/5/12, James Tappin jtap...@gmail.com wrote: I think the solution is to place the treeview in a gtk_scrolled_window rather than using an hbox and an explicit scrollbar. The reason for trying out with an explicit hbox is that the column headers scroll out of view with a gtk_scrolled_window. I'm puzzled as it doesn't do that in my RPN calculator stack and registers display. This uses a list model (i.e. no sub-rows). Here are the key bits of code (in Fortran 2003 -- I'm not a C programmer). The list creator function: function hl_gtk_listn_new(scroll, ncols, types, changed, data, multiple, width, titles, height, swidth, align, ixpad, iypad, sensitive, tooltip, sortable, editable, colnos, edited, data_edited) result(list) type(c_ptr) :: list type(c_ptr), intent(out) :: scroll integer(kind=c_int), intent(in), optional :: ncols integer(kind=type_kind), dimension(:), intent(in), optional :: types . . . ! Create the storage model model = gtk_list_store_newv(ncols_all, c_loc(types_all)) ! Create the list in the scroll box scroll = gtk_scrolled_window_new(C_NULL_PTR, C_NULL_PTR) call gtk_scrolled_window_set_policy(scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC) list = gtk_tree_view_new_with_model(model) call gtk_container_add(scroll, list) . . . And in the calculator itself: ! Registers. jbase = hl_gtk_box_new() idx = hl_gtk_notebook_add_page(mstabs, jbase, label=Registers//c_null_char) fmemory = hl_gtk_listn_new(smemory, changed=c_funloc(memsel), height=300, titles= (/ Index//c_null_char, Value//c_null_char /), types = (/ g_type_int, g_type_double /)) call hl_gtk_listn_set_cell_data_func(fmemory, memcol, func=c_funloc(show_list), data=c_loc(memcol)) call hl_gtk_box_pack(jbase, smemory) I hope that this will at least give some clues as to how the bits fit together. P.S. hl_gtk_* routines are Fortran routines that bundle settings together and use Fortran's optional argument system to hide much of the complexity of the raw gtk_* calls. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Multiple selections in list/treeview widgets and accelerator groups?
Is it possible that having an accelerator group associated with the top-level window of a hierarchy could prevent multiple selections in a list widget within that window from working? I have an application that is supposed to have multiple selections enabled (gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE) has been called on the selection object associated with the treeview). But when I do a control-click or shift-click on the list nothing happens [I don't expect Ctrl-A to work as that is bound to a button]. The only significant difference I can see from a demo program that does work is that the top-level window has an accelerator group in the application and not in the demo. James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk-app to search google scholar
On 22 May 2012 21:20, Rudra Banerjee bnrj.ru...@yahoo.com wrote: Dear friends, I am trying to make a gtk application that will create a bibtex. The problem is I am a novice in C/gtk programming(this will be only my 2nd programme in gtk). To do that, First and foremost, I need to search google scholar from the code. I tried using lynx and failed. Can anyone kindly show me a simple code in C that can fetch data from google scholar with Import into bibtex entry on? According to http://en.wikipedia.org/wiki/Google_Scholar#Features_and_specifications As of March 2012, Google Scholar is not yet available to the Google AJAX API. So I would guess there will not be any simple C code to achieve what you want. James. Best and Regards, -- Rudra Banerjee If possible, plz. don't send me MsWord/PowerPoint mails. Why? See http://www.gnu.org/philosophy/no-word-attachments.html ___ 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 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkTable cells resizing
On 15/05/12 14:45, Tristan Van Berkom wrote: On Mon, May 14, 2012 at 10:29 PM, James Steward jamesstew...@optusnet.com.au wrote: On 15/05/12 11:56, Tristan Van Berkom wrote: ... perhaps it's worth trying an extra call to gtk_widget_queue_resize() after modifying your table. I'm trying that. I have signals connected thus; g_signal_connect(G_OBJECT(p-canvas), expose-event, G_CALLBACK(plot_expose_event), p); g_signal_connect(G_OBJECT(p-canvas), select-item, G_CALLBACK(plot_select_event), p); and get the plot_select_event() routine to calculate and set new canvas sizes with gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(p-canvas), width, height); then call gtk_widget_queue_resize(GTK_WIDGET(p-table)); This causes plot_expose_event() to get called, which calls gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas)); But the table rows seem to expand to the largest canvas and don't seem to take on variable heights. Feel I've been around and around the mulberry bush on this ;-) Hard to say whats going on here, I wonder who is responding to the size requests for these items which are getting drawn. It seems you connect to a signal to draw on a widget, which means the content is not the widget, so probably you need to also connect a signal to override the size request of the said widget you intend painting onto ? Perhaps you are using forced size requests to accomplish this (using gtk_widget_set_size_request() or such), and have somehow mixed up the size requests while swapping your content onto new rows/columns ? Other than that, child 'expand' properties will be considered by the GtkTable (if all children can expand, then it's quite possible that after reaching a large window size the content will be evenly spread). Thanks for your ideas. I had another. I could define the table as having twice as many rows, then (hopefully) just reassigning the attach points. I.e. where I now have; gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 1); gtk_table_attach_defaults(table1, canvas2, 0, 1, 1, 2); gtk_table_attach_defaults(table1, canvas3, 0, 1, 2, 3); instead I'll define a 6 row table and initialise as; gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 2); gtk_table_attach_defaults(table1, canvas2, 0, 1, 2, 4); gtk_table_attach_defaults(table1, canvas3, 0, 1, 4, 6); Then to zoom canvas2, I can hopefully somehow move the attachment points to; gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 1); gtk_table_attach_defaults(table1, canvas2, 0, 1, 1, 5); gtk_table_attach_defaults(table1, canvas3, 0, 1, 5, 6); I'd obviously need to fix the row size by making the table homogeneous. What do you think? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: probable gtk_window_present and pango help
Also consider hiding your window (with a call to window-hide()) instead of destroying it, and making it reappear with a call to window-show(). Jim Tilton -Original Message- From: gtk-app-devel-list-boun...@gnome.org [mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of David Necas Sent: Friday, May 18, 2012 2:19 PM To: Rudra Banerjee Cc: gtk-app-devel-list Subject: Re: probable gtk_window_present and pango help On Fri, May 18, 2012 at 09:12:45PM +0530, Rudra Banerjee wrote: Here is a minimal example of a program, where if i click the button, a pop up window appears. I am posting both the call back function and the main routine (table.c). I am facing 2 problem. Unfortunately, you are facing much more problems. For start gtk_container_add(GTK_CONTAINER(window1), vbox1); is called with an unitialised variable window1 (i.e. no window1 is ever created). This leads to a CRITICAL message to console and/or crash. And if window1 existed then vbox1 would be packed into two different containers (window1 and window) which is not possible. So I'm ignoring that part altogether. The callback should look like void callback_it(GtkWidget *button, gpointer user_data) { ... } where in user_data the callback receives the last argument you passed to g_signal_connect(). It is rarely useful to pass a constant such as Call there. The callback is *not* another main() function; it should *not* call gtk_init() again, etc. Please read the signals section in the Gtk+ tutorial http://developer.gnome.org/gtk-tutorial/2.90/x159.html There are several other highly suspicious things: - redeclaration of global variables (such as window) inside a function; are you aware this creates a new local variable window that has nothing to do with the global one? - inclusion of .c files instead of separate compilation + linking them together - calling gtk_widget_show() on individual widgets and then again showing everything using gtk_widget_show_all() - not terminating the Gtk+ main loop when the main window is destroyed; this is usually the first thing to set up in a Gtk+ program, see http://developer.gnome.org/gtk-tutorial/2.90/c39.html#SEC-HELLOWORLD etc. 1) The problem is evry time I click the button main, a new window appears(obviously). What I want to achive is, if the window is already present, it should not open again; rather it should focus that window. I believe, this can be achived by gtk_window_present(may be I am wrong). But I don't know how to use it. You use it just by calling gtk_window_present() on the window object. To that meaningfully you need not only to keep the window object around but also get notified when the window is destroyed. Either by connecting to the destroy signal or, if you just want to set a pointer to NULL once it is gone, by using g_object_add_weak_pointer(). 2) In the callback function, I have C_1 and C_2. What I want to achive is Csub1/sub etc via pango(or any other). For simple things you can sometimes just use UTF-8. But generally, you need to use Pango markup. If the widget does not have function to set the markup it has a function to obtain the label widget so that you can use gtk_label_set_markup() on that. See the attached code with main problems fixed (and merged to one file). Please go through the Gtk+ tutorial farther that you perhaps have done. Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkTable cells resizing
Hi, I have an application with a tabbed view. On two tabs I have a table, one is a 2x2 table, the other a 3x1 table (3 rows). In each cell is a canvas that has a gtk plot. I want to be able to click one of the plots in the 3x1 table and change the canvas size to 2/3 the original, with the other two canvases being 1/6 the original size. After redrawing and resizing and mucking about, I can't get the table rows to be different sizes, accommodating the different sized canvases properly, even though I have gtk_table_set_homogeneous (table, FALSE); Any clues how to do this? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkTable cells resizing
On 15/05/12 11:56, Tristan Van Berkom wrote: Are you using GTK+ 3 ? Still on GTK+ 2.0. If so, use GtkGrid instead... possibly just that will fix things for you. Short of that, if I understand correctly, you have a target state/configuration of a GtkTable (or GtkGrid), if you construct the table in the target configuration from scratch, I take it things work as you want... but dont work properly after performing some kind of a transformation to reach your target state... That's about it. ... perhaps it's worth trying an extra call to gtk_widget_queue_resize() after modifying your table. I'm trying that. I have signals connected thus; g_signal_connect(G_OBJECT(p-canvas), expose-event, G_CALLBACK(plot_expose_event), p); g_signal_connect(G_OBJECT(p-canvas), select-item, G_CALLBACK(plot_select_event), p); and get the plot_select_event() routine to calculate and set new canvas sizes with gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(p-canvas), width, height); then call gtk_widget_queue_resize(GTK_WIDGET(p-table)); This causes plot_expose_event() to get called, which calls gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas)); But the table rows seem to expand to the largest canvas and don't seem to take on variable heights. Feel I've been around and around the mulberry bush on this ;-) Regards, James. On Mon, May 14, 2012 at 9:21 PM, James Steward jamesstew...@optusnet.com.au wrote: Hi, I have an application with a tabbed view. On two tabs I have a table, one is a 2x2 table, the other a 3x1 table (3 rows). In each cell is a canvas that has a gtk plot. I want to be able to click one of the plots in the 3x1 table and change the canvas size to 2/3 the original, with the other two canvases being 1/6 the original size. After redrawing and resizing and mucking about, I can't get the table rows to be different sizes, accommodating the different sized canvases properly, even though I have gtk_table_set_homogeneous (table, FALSE); Any clues how to do this? Regards, James. ___ 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
Trouble with button mask
Hi, I've been trying to get a canvas select item event to fire for a gtk_plot_canvas. Upon left clicking inside a plot canvas, I can see that gtk_plot_canvas_button_press(...) gets called, and the following lines near the beginning of that function (in the gtkextra lib) cause the function to exit without anything being selected. gdk_window_get_pointer(widget-window, NULL, NULL, mods); if(!(mods GDK_BUTTON1_MASK)) return FALSE; Upon inspection of the variable mods, it appears to have a value of GDK_MOD2_MASK, according to GDB. Anyone know why a GDK_BUTTON1_MASK isn't read when I left click? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Trouble with button mask
Stupid question below. Please ignore. James. On 14/05/12 15:47, James Steward wrote: Hi, I've been trying to get a canvas select item event to fire for a gtk_plot_canvas. Upon left clicking inside a plot canvas, I can see that gtk_plot_canvas_button_press(...) gets called, and the following lines near the beginning of that function (in the gtkextra lib) cause the function to exit without anything being selected. gdk_window_get_pointer(widget-window, NULL, NULL, mods); if(!(mods GDK_BUTTON1_MASK)) return FALSE; Upon inspection of the variable mods, it appears to have a value of GDK_MOD2_MASK, according to GDB. Anyone know why a GDK_BUTTON1_MASK isn't read when I left click? Regards, James. ___ 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 the busy cursor to display.
On 11 April 2012 04:36, jcup...@gmail.com wrote: On 10 April 2012 18:33, James Tappin jtap...@gmail.com wrote: Thanks for the suggestion. Unfortunately in this case it doesn't help. (I have also tried gdk_display_flush and gdk_window_flush, but still the same story). Here's a tiny test program that works for me with gtk2. It just uses: gdk_window_set_cursor( win-window, busy_cursor ); gdk_flush(); J That program works, as does a translation into Fortran. But I'm still not having any joy with my display monitor. Maybe the only convenient fix is to show a window with a message Reading database during the read and then create the monitor afterwards. To Igor: I thought that a progress bar in activity mode had to be prodded to show the animation, which is not possible while I'm doing the read. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting the busy cursor to display.
On 11 April 2012 09:25, James Tappin jtap...@gmail.com wrote: On 11 April 2012 04:36, jcup...@gmail.com wrote: On 10 April 2012 18:33, James Tappin jtap...@gmail.com wrote: Thanks for the suggestion. Unfortunately in this case it doesn't help. (I have also tried gdk_display_flush and gdk_window_flush, but still the same story). Here's a tiny test program that works for me with gtk2. It just uses: gdk_window_set_cursor( win-window, busy_cursor ); gdk_flush(); J That program works, as does a translation into Fortran. But I'm still not having any joy with my display monitor. Maybe the only convenient fix is to show a window with a message Reading database during the read and then create the monitor afterwards. To Igor: I thought that a progress bar in activity mode had to be prodded to show the animation, which is not possible while I'm doing the read. I'm now really confused -- I've reordered some of the code so that the set_cursor call precedes putting a message in the status bar. And the status bar updates but not the cursor. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting the busy cursor to display.
On 11 April 2012 10:51, James Tappin jtap...@gmail.com wrote: I'm now really confused -- I've reordered some of the code so that the set_cursor call precedes putting a message in the status bar. And the status bar updates but not the cursor. OK: I think I've figured it. The problem is/was that since the pointer was not normally inside the monitor window when the cursor change was made AND there was no event polling during the read, the cursor was stuck in what ever state it entered the window. Since other parts of the program use openmp for parallel DO loops, I've put a parallel section so that one thread polls events while the other does the reads. Thanks for all the comments, they did help getting me thinking down the right lines. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: Making a cursor (cross hair) track between image displays
Hi again, I've made a lot of progress on this task - but I still am having trouble with manipulating the appearance of the Cursor. Apparently the approach for doing this has changed between gtkmm 2 and 3, and apparently all the solutions I can find via Google are for gtkmm 2. How can I change the default appearance of my cursor from the default cursor to something else (e.g. a CrossHair) in gtkmm 3? Thanks. Jim Tilton -Original Message- From: gtk-app-devel-list-boun...@gnome.org [mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of Tilton, James C. (GSFC-6063) Sent: Monday, April 02, 2012 12:00 PM To: gtk-app-devel-list@gnome.org Subject: Making a cursor (cross hair) track between image displays Hi GTK+ application developers! I have developed an application using gtkmm in which I display related images in multiple Gtk::Window's. I have two types of display images. One is based on Gtk::Image and the other is based on Gtk::DrawingArea. For the Gtk::Image case I add the Gtk::Image to a Gtk::EventBox, which in turn I add to a Gtk::ScrolledWindow. For the Gtk::DrawingArea, is directly add the Gtk::DrawingArea to a Gtk::ScrolledWindow (without the intervening Gtk::EventBox). When the image sizes exceed the ScrolledWindow display area, I use the Gtk::Adjustment associated with each Gtk::ScrolledWindow to have the pan-scrolling of each window track each other. When I place the cursor in one of the display images, I would like to have a cross hair appear at the cursor location of the window in which the cursor is placed at the location currently pointed to by the cursor. I would ALSO like to have a similar cross hair appear in each of the other associated display images. How can I make this happen with GTK+/gtkmm? I've looked for examples of this and haven't found any. Can anyone point me in the right direction for implementing this feature in my application? (In my current application, the normal arrow cursor appears in just one window, and if I hold the either the left or right mouse button down, I have the column and row location and image data value(s) appear in text below the Scrolled Window image display.) Thanks. Jim Tilton Dr. James C. TiltonVoice: 301-286-9510 NASA Goddard Space Flight Center FAX: 301-286-1776 Mail Code 606.3E-Mail: james.c.til...@nasa.govmailto:james.c.til...@nasa.gov (Computational Information Sciences and Technology Office) Greenbelt, MD 20771 URLs: http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and http://science.gsfc.nasa.gov/606.3/TILTON/ ___ 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
Getting the busy cursor to display.
I have a gtk (fortran) application that displays a progress monitor while computing, and I would like to display the busy cursor while the program is reading a large data file. Right now what I have is: To define the busy cursor and GDK window (module [global] variables). draw_window = gtk_widget_get_window(window) busy_cursor = gdk_cursor_new_for_display(gdk_display_get_default(), GDK_WATCH) and then to activate/deactivate it: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Set a busy cursor on the progress monitor (for reading the database) subroutine set_monitor_busy(is_busy) logical, intent(in) :: is_busy if (is_busy) then call gdk_display_sync(gdk_display_get_default()) call gdk_window_set_cursor(draw_window, busy_cursor) call gdk_display_sync(gdk_display_get_default()) else call gdk_display_sync(gdk_display_get_default()) call gdk_window_set_cursor(draw_window, NULL) call gdk_display_sync(gdk_display_get_default()) end if end subroutine set_monitor_busy The just before I start to read the big file I have: call set_monitor_busy(.TRUE.) and after reading: call set_monitor_busy(.FALSE.) However, even with both gdk_display_sync calls as shown, sometimes the busy cursor appears and sometimes it doesn't (in fact sometimes the whole window shows blank until after the file read). The commonest case is that the monitor window renders but still keeps the regular cursor. Is there some other call (or calls) I should be making to force the updates to take place? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting the busy cursor to display.
On 10 April 2012 10:09, jcup...@gmail.com wrote: On 10 April 2012 16:58, James Tappin jtap...@gmail.com wrote: call gdk_display_sync(gdk_display_get_default()) call gdk_window_set_cursor(draw_window, busy_cursor) call gdk_display_sync(gdk_display_get_default()) My gtk2 program does this with: gdk_window_set_cursor( window, cursor ); gdk_flush(); If that's any help :( I've not tried gtk3 yet. J Thanks for the suggestion. Unfortunately in this case it doesn't help. (I have also tried gdk_display_flush and gdk_window_flush, but still the same story). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: Making a cursor (cross hair) track between image displays
Hi GTK+ application developers: As it often happens, the inquirer often answers his own question. I finally found clear enough example of something similar in gtkmm 3 and through a little trial and error found the solution. Here it is for gtkmm 3: Glib::RefPtr Gdk::Window ref_Gdk_window = get_window(); Glib::RefPtrGdk::Cursor display_cursor = Gdk::Cursor::create(ref_Gdk_window-get_display(), Gdk::CROSSHAIR); ref_Gdk_window-set_cursor(display_cursor); Now, to complete my application, I just need to draw a cursor clone (crosshair) at the corresponding location in the associated gtkmm windows. Jim Tilton -Original Message- From: gtk-app-devel-list-boun...@gnome.org [mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of Tilton, James C. (GSFC-6063) Sent: Tuesday, April 10, 2012 9:28 AM To: gtk-app-devel-list@gnome.org Subject: RE: Making a cursor (cross hair) track between image displays Hi again, I've made a lot of progress on this task - but I still am having trouble with manipulating the appearance of the Cursor. Apparently the approach for doing this has changed between gtkmm 2 and 3, and apparently all the solutions I can find via Google are for gtkmm 2. How can I change the default appearance of my cursor from the default cursor to something else (e.g. a CrossHair) in gtkmm 3? Thanks. Jim Tilton -Original Message- From: gtk-app-devel-list-boun...@gnome.org [mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of Tilton, James C. (GSFC-6063) Sent: Monday, April 02, 2012 12:00 PM To: gtk-app-devel-list@gnome.org Subject: Making a cursor (cross hair) track between image displays Hi GTK+ application developers! I have developed an application using gtkmm in which I display related images in multiple Gtk::Window's. I have two types of display images. One is based on Gtk::Image and the other is based on Gtk::DrawingArea. For the Gtk::Image case I add the Gtk::Image to a Gtk::EventBox, which in turn I add to a Gtk::ScrolledWindow. For the Gtk::DrawingArea, is directly add the Gtk::DrawingArea to a Gtk::ScrolledWindow (without the intervening Gtk::EventBox). When the image sizes exceed the ScrolledWindow display area, I use the Gtk::Adjustment associated with each Gtk::ScrolledWindow to have the pan-scrolling of each window track each other. When I place the cursor in one of the display images, I would like to have a cross hair appear at the cursor location of the window in which the cursor is placed at the location currently pointed to by the cursor. I would ALSO like to have a similar cross hair appear in each of the other associated display images. How can I make this happen with GTK+/gtkmm? I've looked for examples of this and haven't found any. Can anyone point me in the right direction for implementing this feature in my application? (In my current application, the normal arrow cursor appears in just one window, and if I hold the either the left or right mouse button down, I have the column and row location and image data value(s) appear in text below the Scrolled Window image display.) Thanks. Jim Tilton Dr. James C. TiltonVoice: 301-286-9510 NASA Goddard Space Flight Center FAX: 301-286-1776 Mail Code 606.3E-Mail: james.c.til...@nasa.govmailto:james.c.til...@nasa.gov (Computational Information Sciences and Technology Office) Greenbelt, MD 20771 URLs: http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and http://science.gsfc.nasa.gov/606.3/TILTON/ ___ 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: Getting the busy cursor to display.
On 10 April 2012 11:36, Michael Cronenworth m...@cchtml.com wrote: James Tappin wrote: Is there some other call (or calls) I should be making to force the updates to take place? I use the following for widget updates during background processing: while ( gtk_events_pending( ) ) gtk_main_iteration( ); Not sure if it will work for cursor drawing though. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list I have tried that as well -- and still no joy. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: Making a cursor (cross hair) track between image displays
Thanks John, Your response is very helpful. The one key question that remains for me is: How do I draw a floating crosshair? Thanks. Jim Dr. James C. TiltonVoice: 301-286-9510 NASA Goddard Space Flight Center FAX: 301-286-1776 Mail Code 606.3E-Mail: james.c.til...@nasa.govmailto:james.c.til...@nasa.gov (Computational Information Sciences and Technology Office) Greenbelt, MD 20771 URLs: http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and http://science.gsfc.nasa.gov/606.3/TILTON/ -Original Message- From: jcup...@gmail.com [mailto:jcup...@gmail.com] Sent: Wednesday, April 04, 2012 4:00 AM To: Tilton, James C. (GSFC-6063) Cc: gtk-app-devel-list@gnome.org Subject: Re: Making a cursor (cross hair) track between image displays Hi Jim, On 2 April 2012 17:00, Tilton, James C. (GSFC-6063) james.c.til...@nasa.gov wrote: When I place the cursor in one of the display images, I would like to have a cross hair appear at the cursor location of the window in which the cursor is placed at the location currently pointed to by the cursor. I would ALSO like to have a similar cross hair appear in each of the other associated display images. Add an event handler to the eventbox and listen for GDK_MOTION_NOTIFY. You need to use gtk_widget_add_events() and turn on motion events with GDK_POINTER_MOTION_MASK, gtk will not deliver motion events to windows by default to try to cut down on unnecessary signalling. (gtk used to support motion event compression, where it would just report the most recent position rather than all positions since the last event delivery, but I think this has been deprecated ... perhaps an expert knows) Once you have a motion events, use motion.x and motion.y to get the mouse position, map this to image space, then map out to the coordinate space for your other image windows. On those other displays, draw a floating crosshair at the right spot. My program does something like this, you're welcome to look at the source if it might help. Though it's a large, hairy thing and perhaps not a clear example. http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Making a cursor (cross hair) track between image displays
Hi GTK+ application developers! I have developed an application using gtkmm in which I display related images in multiple Gtk::Window's. I have two types of display images. One is based on Gtk::Image and the other is based on Gtk::DrawingArea. For the Gtk::Image case I add the Gtk::Image to a Gtk::EventBox, which in turn I add to a Gtk::ScrolledWindow. For the Gtk::DrawingArea, is directly add the Gtk::DrawingArea to a Gtk::ScrolledWindow (without the intervening Gtk::EventBox). When the image sizes exceed the ScrolledWindow display area, I use the Gtk::Adjustment associated with each Gtk::ScrolledWindow to have the pan-scrolling of each window track each other. When I place the cursor in one of the display images, I would like to have a cross hair appear at the cursor location of the window in which the cursor is placed at the location currently pointed to by the cursor. I would ALSO like to have a similar cross hair appear in each of the other associated display images. How can I make this happen with GTK+/gtkmm? I've looked for examples of this and haven't found any. Can anyone point me in the right direction for implementing this feature in my application? (In my current application, the normal arrow cursor appears in just one window, and if I hold the either the left or right mouse button down, I have the column and row location and image data value(s) appear in text below the Scrolled Window image display.) Thanks. Jim Tilton Dr. James C. TiltonVoice: 301-286-9510 NASA Goddard Space Flight Center FAX: 301-286-1776 Mail Code 606.3E-Mail: james.c.til...@nasa.govmailto:james.c.til...@nasa.gov (Computational Information Sciences and Technology Office) Greenbelt, MD 20771 URLs: http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and http://science.gsfc.nasa.gov/606.3/TILTON/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Trouble with TreeView
Hi All, I've built a TreeModel by creating a new TreeStore, and populating it with; for (rp = parent; rp; rp = rp-next) { gtk_tree_store_append(store, iter, NULL); gtk_tree_store_set(store, iter, 0, rp-number, -1); for (ep = rp-child; ep; ep = ep-next) { gtk_tree_store_append(store, child, iter); gtk_tree_store_set(store, child, 0, ep-number, 1, ep-name, 2, ep-mean, 3, ep-std_dev, -1); } } Then created a new view, associated the model with it, and inserted columns. I add the view to a scrolled window, which is in turn added to a dialog content area. When I display the dialog, the tree is not quite what I expect. In the first row (0), the values for name, mean and std_dev have not been defined, yet the mean and std_dev (which are floats) are shown as 0.00. I don't want them to be displayed at all. So to clarify, the first part of the tree looks like 1 | | 0.00 | 0.00 5 | Fu Bar | 0.345123 | 0.051234 3 | Snafu | 0.765432 | 0.145678 Is there a way to suppress the display of some columns that don't make sense for the parent node, I.e. columns 1, 2, 3 in row 0? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
An issue with Qt styling and/or threads?
I have a problem running a Gtk program when using the Qt style as supplied via gtk-qt-engine and kde-config-gtk-style. The program is a fairly heavy duty computation that uses openmp for parallel computation and has a gtk progress monitor (which is updated from within a critical section so it can never be accessed by more than one thread at a time). When the Qt style is selected, the progress bars (gtk_progress_bar) are corrupted and the errors below are displayed repeatedly: (th_run:2015): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed (th_run:2015): Gdk-CRITICAL **: gdk_draw_drawable: assertion `GDK_IS_DRAWABLE (src)' failed (th_run:2015): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed QPixmap: It is not safe to use pixmaps outside the GUI thread QPixmap: It is not safe to use pixmaps outside the GUI thread QPainter::begin: Paint device returned engine == 0, type: 2 QPixmap: It is not safe to use pixmaps outside the GUI thread QPainter::end: Painter not active, aborted The problem does not occur with other Gtk style settings (e.g. Nuvola). I'm not sure if the problem is with the Qt wrapper, Gtk+ or my code. FWIW I'm running Debian stable, with Gtk+ 2.20. Any ideas? James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: misc and a question...
On 29/12/11 11:05, Gary Kline wrote: ... due to people on this list who have been patient and 'splained things ... and who have NOT said: 'go read the man page' --well, nutshell, in ~ 3 weeks, i'm starting to see how gtk works. i just learned that TRUE == 1 and not 0. i haven't used the access() call in awhile. i am trying to catch catch errors before they crop up. the way i see my application being used, there won't be any xterms or konsoles open to print a stderr or stdout. So: is there a way in gtk to have a message dialog open that prints warning or whatever to the new user? #define eprintf(...) do { \ GtkWidget *dialog; \ dialog = gtk_message_dialog_new ((GtkWindow *)window, \ GTK_DIALOG_DESTROY_WITH_PARENT, \ GTK_MESSAGE_ERROR, \ GTK_BUTTONS_CLOSE, \ __VA_ARGS__); \ gtk_dialog_set_default_response(GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); \ gtk_dialog_run (GTK_DIALOG (dialog)); \ gtk_widget_destroy (dialog); \ } while (0) -- JS. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: no luck with dialogs and ecrooolbars, and gtktext..
n Tue, Dec 20, 2011 at 02:52:10PM -0800, Gary Kline wrote: text = gtk_text_view_new(); gtk_container_add(GTK_CONTAINER(window),text); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); and fopen some file and display the text in the buffer. The question remains: how? what am i missing to display some miscellaneous words in the text window? http://www.gtk.org/documentation.php ___ 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 use hbox?
2011/12/11 Gary Kline kl...@thought.org: can somebody help me figure out how to pack the buttons horizontally, or is is not possible to mix hbox and vbox? It should be as simple as: make the vbox put the various items in it, including the hbox put the increase decrease buttons in the hbox. That certainly works in one of the example codes in gtk-fortran (hl_containers.f90). [An alternative might be to use a 2xn table and make most of the items span 2 columns.] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Alignment of markup labels in menu items
I'm trying to add the capability to add a label formatted with Pango markup to buttons and menu items in the high-level interface to gtk-fortran. While the following is successful in producing subscripts in labels when the markup flag is set, there is a problem with alignment: while a plain text label is correctly centred in the pulldown menu, a markup label begins at the centre (even if it does not actually include any markup). if (markup) then item=gtk_menu_item_new() label_w=gtk_label_new(label) call gtk_label_set_markup(label_w, label) call gtk_container_add(item,label_w) else item = gtk_menu_item_new_with_label(label) end if Am I missing something, or is that a fundamental limitation? I'm using Gtk+-3.2.0, in Ubuntu 11.10, with gcc gfortran 4.6.1. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Alignment of markup labels in menu items
On 30 November 2011 11:31, James Tappin jtap...@gmail.com wrote: there is a problem with alignment: while a plain text label is correctly centred in the pulldown menu, a markup label begins at the centre (even if it does not actually include any markup). I should add, the problem does not manifest itself for simple gtk buttons. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error
On 30/11/11 20:04, Tadej Borovšak wrote: Hi. 2011/11/30 James Stewardjamesstew...@optusnet.com.au: col = gtk_tree_view_insert_column_with_attributes ( GTK_TREE_VIEW (view), -1, Title, renderer, text, i, strikethrough, j, background, k, background-set, TRUE, NULL); gtk_tree_view_column_set_cell_data_func( gtk_tree_view_get_column(GTK_TREE_VIEW(view), col), renderer, render_float, GINT_TO_POINTER(i), NULL); IIRC, gtk_tree_view_insert_column_with_attributes() returns number of columns and gtk_tree_view_get_column() expects to get column number where first column is 0. So you may be off-by-one in your call to gtk_tree_view_column_set_cell_data_func(). Well spotted! Thanks very much. Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error
Hi, Wanting to display floats with a particular format in a tree view. void render_float(GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) { gfloat f; gchar buf[20]; int col = GPOINTER_TO_INT(user_data); gtk_tree_model_get(model, iter, col, f, -1); g_snprintf(buf, sizeof(buf), %.2f, f); g_object_set(renderer, text, buf, NULL); } G_MODULE_EXPORT gboolean on_menu_show_results_activate( GtkWidget *w, GdkEvent *event, gpointer user_data) { ... renderer = gtk_cell_renderer_text_new (); col = gtk_tree_view_insert_column_with_attributes ( GTK_TREE_VIEW (view), -1, Title, renderer, text, i, strikethrough, j, background, k, background-set, TRUE, NULL); gtk_tree_view_column_set_cell_data_func( gtk_tree_view_get_column(GTK_TREE_VIEW(view), col), renderer, render_float, GINT_TO_POINTER(i), NULL); ... } When I run the app I get: Gtk-CRITICAL **: gtk_cell_layout_set_cell_data_func: assertion `GTK_IS_CELL_LAYOUT (cell_layout)' failed Can anyone spot what I've done wrong? There's no compiler warnings, just this runtime error. -- James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: 'irregular shaped' windows without deprecated gdk code or compositing
On 31 July 2011 23:24, James Morris jwm.art@gmail.com wrote: Hi, It appears that the 'irregularly shaped' windows which used to be possible by using now-deprecated GDK code even without full compositing available, are no longer possible using non-deprecated code. Using the old deprecated code, a GdkRegion could be created with the desired window shape (with the region defining fully transparent and fully opaque areas) and a call to gdk_window_shape_combine_region to bring it about. I've been trying to work around this but feel like a dog running in circles chasing my tail. gdk_window_shape_combine_region is not deprecated, but GdkRegion will be replaced in GTK3.0 with cairo_region_t for which there is no gdk_window_shape_combine_region equivalent. Furthermore the gdk_region_polygon call necessary to create the GdkRegion of the desired shape, is deprecated without replacement. So I look into gdk_window_shape_combine_mask instead, but gdk_bitmap_create_from_data is of course deprecated. The docs do at least suggest cairo alternatives, but none of which are compatible with gdk_window_shape_combine_mask. I'm just going to start looking into these functions: cairo_xlib_surface_create_for_bitmap as they *might* do what I wish. Please please tell me if there's anyway around this mess. I can't force or assume use of compositing. Cheers, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
'irregular shaped' windows without deprecated gdk code or compositing
Hi, It appears that the 'irregularly shaped' windows which used to be possible by using now-deprecated GDK code even without full compositing available, are no longer possible using non-deprecated code. Using the old deprecated code, a GdkRegion could be created with the desired window shape (with the region defining fully transparent and fully opaque areas) and a call to gdk_window_shape_combine_region to bring it about. I've been trying to work around this but feel like a dog running in circles chasing my tail. gdk_window_shape_combine_region is not deprecated, but GdkRegion will be replaced in GTK3.0 with cairo_region_t for which there is no gdk_window_shape_combine_region equivalent. Furthermore the gdk_region_polygon call necessary to create the GdkRegion of the desired shape, is deprecated without replacement. So I look into gdk_window_shape_combine_mask instead, but gdk_bitmap_create_from_data is of course deprecated. The docs do at least suggest cairo alternatives, but none of which are compatible with gdk_window_shape_combine_mask. Please please tell me if there's anyway around this mess. I can't force or assume use of compositing. Cheers, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Append to list store doesn't get all column attributes
Hi, (Sorry if this appears twice. I sent it from the wrong address earlier.) In a dialog with a scrolled window displaying a list, with one column in the view, where the cells are editable; gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, Name, renderer, text, 0, editable, TRUE, NULL); A button in the dialog allows the user to add to the list with; gtk_list_store_append(store, iter); gtk_list_store_set(store, iter, 0, New, 1, 0, -1); p = gtk_tree_model_get_path(model, iter); c = gtk_tree_view_get_column(GTK_TREE_VIEW (view), 0); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW (view), p, NULL, FALSE, 0.0, 0.0); gtk_tree_view_set_cursor(GTK_TREE_VIEW (view), p, c, TRUE); gtk_widget_grab_focus (view); The item New is indeed appended to the list, and it scrolls to the correct cell, however New is not editable, and no matter what I've tried, I can't make it editable. Can anyone offer a clue as to why? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Append to list store doesn't get all column attributes
On Thu, 2011-07-28 at 07:08 +0200, Florian Müllner wrote: Hey, 2011/7/28 James jamesstew...@optusnet.com.au In a dialog with a scrolled window displaying a list, with one column in the view, where the cells are editable; gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, Name, renderer, text, 0, editable, TRUE, NULL); This links the text (content) attribute of the tree view column to the first column of the model, and the editable attribute to the second one (TRUE == 1). Well, that's embarrassing. It is so obvious when you point it out. Can I claim tired eyes? ;-) A button in the dialog allows the user to add to the list with; gtk_list_store_append(store, iter); gtk_list_store_set(store, iter, 0, New, 1, 0, -1); Here you add a row with (New, 0) to the list - whatever the intention of the second column, the tree view will use it to determine whether the cell should be editable, and given that 0 == FALSE, it won't be :-) If you want all cells to be editable, the easiest way is to call g_object_set (renderer, editable, TRUE, NULL); when setting up the tree view (assuming that you are using a GtkCellRendererText). Of course, changing the gtk_list_store_set() call to set the second column to TRUE would work as well ... Yup, all fixed now. Thanks, Florian. Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Making widgets visible outside their containing window
2011/7/13 Felix H. Dahlke f...@ubercode.de: Thanks for your answers. I did fool around with a popup, but it would also overlap other windows, transient or not. Furthermore, I need it to move relative to the window if that is moved. Maybe it's best if I tell you what I'm trying to do in particular: I'm working on something like a tooltip. However, I don't think I can use normal tooltips, since I need to position it manually (actually, I need it to move out of the way if the mouse cursor approaches it). A popup sounds like the right way to do this, but I need to somehow wire the popup's movement to the window's movement. Is there an easy way to do that? Take a look at PHAT fan sliders. These are sliders which vertical-mouse-movement brings up a fan through which the user gains more precision in the slider position. The fans are not bounded by any window the widget is associated with. There might be some pointers in there for how to do what you want, but note it's unmaintained code by now, and also contains some deprecated code. http://phat.berlios.de/ James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gobject and gtk_widget_set_sensitive
Hi, I have a custom widget I've created which uses widgets from a 3rd party library. When I use gtk_widget_set_sensitive(my_widget, FALSE), some of the widgets from the other library remain sensitive. Is this a bug in the 3rd party library? Or should I be using a callback to handle the state-changed signal to set_sensitive on all the widgets? Cheers, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Changing a GtkToolButton icon_widget on the fly
On 22 June 2011 05:43, James jamesstew...@optusnet.com.au wrote: Hi, I've been trying to change the icon_widget that's displayed for a toolbar button while the main window is displayed. I can't seem to get the actual image to change, although the functions that call gtk_tool_button_set_icon_widget(0 do get called. There's no warnings either. I do something like... GtkWidget *eject_widget; GtkWidget *eject_red_widget; GtkToolButton *eject_button; void green(void) { gtk_tool_button_set_icon_widget(eject_button, eject_widget); } void red(void) { gtk_tool_button_set_icon_widget(eject_button, eject_red_widget); } int main(int argc, char **argv) { snip GtkBuilder *builder; builder = gtk_builder_new(); gtk_builder_add_from_file(builder, stridemaster.xml, NULL); eject_widget = GTK_WIDGET(gtk_builder_get_object(builder, eject_tracker_image)); eject_red_widget = GTK_WIDGET(gtk_builder_get_object(builder, eject_tracker_red_image)); eject_button = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, toolbutton_eject_tracker)); g_object_unref(G_OBJECT(builder)); gtk_widget_show(window); gtk_main(); snip } What am I missing? The problem might be to do with floating versus fixed references. GTK will usually unreference the images once it thinks they're finished with - ie when you change the icon, it will think you no longer wish to use the previous icon. Try calling g_object_ref_sink on all of the widget icons once you've created them, and then g_object_unref after you're done. James. Regards, James. ___ 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
Changing a GtkToolButton icon_widget on the fly
Hi, I've been trying to change the icon_widget that's displayed for a toolbar button while the main window is displayed. I can't seem to get the actual image to change, although the functions that call gtk_tool_button_set_icon_widget(0 do get called. There's no warnings either. I do something like... GtkWidget *eject_widget; GtkWidget *eject_red_widget; GtkToolButton *eject_button; void green(void) { gtk_tool_button_set_icon_widget(eject_button, eject_widget); } void red(void) { gtk_tool_button_set_icon_widget(eject_button, eject_red_widget); } int main(int argc, char **argv) { snip GtkBuilder *builder; builder = gtk_builder_new(); gtk_builder_add_from_file(builder, stridemaster.xml, NULL); eject_widget = GTK_WIDGET(gtk_builder_get_object(builder, eject_tracker_image)); eject_red_widget = GTK_WIDGET(gtk_builder_get_object(builder, eject_tracker_red_image)); eject_button = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, toolbutton_eject_tracker)); g_object_unref(G_OBJECT(builder)); gtk_widget_show(window); gtk_main(); snip } What am I missing? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Cairo, Gtk+, Gdk GdkPixbuf -- making a pixel-based backing store for vector graphics
Just to let folks know that the pointers here have given me the lead in that I needed and I've got a working code. (A bit more elegant in the Gtk3 case than Gtk2 but both work). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Cairo, Gtk+, Gdk GdkPixbuf -- making a pixel-based backing store for vector graphics
I would like to be able to make a code that draws some (possibly very complex) vector graphics, copies it to an off-screen backing store and then when an expose-event (Gtk2) or draw signal (Gtk3) is received, the backing store is copied to the screen rather than doing a complete redraw of all the vectors which could potentially take several seconds. Unfortunately all the potential model codes I've been able to find use the obsolete Gdk Pixmap as backing store. Likewise the routine that looks promising gdk_pixbuf_render_to_drawable () is marked as deprecated (since 2.4) and suggests gdk_draw_pixbuf () as an alternative. However that is also marked deprecated (since 2.22) and recommends gdk_cairo_set_source_pixbuf() and cairo_paint() or cairo_rectangle() and cairo_fill() but it is not at all clear how to combine those routines to produce the required effect. I have searched many times for suitable examples and come up empty. So does anybody here have any suggestions, examples or link that provide pointers to the following operations?: 1) Getting cairo to draw to a pixmap or pixbuf, or draw to a window and then copy the resulting window contents to an in-memory storage. 2) Making the expose handler copy that pixbuf (or whatever) to the visible window (while only copying the affected region would be the best option I can live with copying the whole window). 3) (Less important for now) Adding new material to the plot and updating the backing store -- my guess is that once I crack 1 2 then 3 will be fairly obvious. James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Cairo, Gtk+, Gdk GdkPixbuf -- making a pixel-based backing store for vector graphics
On 14 June 2011 15:00, Stefan Salewski m...@ssalewski.de wrote: On Tue, 2011-06-14 at 14:30 -0600, James Tappin wrote: I would like to be able to make a code that draws some (possibly very complex) vector graphics, A better place for asking may be the cairo mailing list? At least there was some discussion about such tasks in the past. One recommended way was using cairos create_similar() function for creating the backup surface. I did a small demo in Ruby some time ago, see http://www.ssalewski.de/PetEd-Demo.html.en I found this related thread with some helpful replies: http://lists.freedesktop.org/archives/cairo/2009-March/016756.html It looks as if this example: http://www.gtkforums.com/viewtopic.php?t=5204, may at least provide part of the answer to (1) in my original posting -- I'm still trying to disentangle the housekeeping and the real logic, to figure exactly what it does. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Maximize on Windows 7 seems broken.
On 11/05/2011 8:07 AM, James Steward wrote: Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. I have a v small test case. Can I attach it here? Let's find out... I also have a screenshot if anyone is interested. Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Maximize on Windows 7 seems broken.
On 13/05/2011 8:03 AM, James Steward wrote: On 11/05/2011 8:07 AM, James Steward wrote: Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. I have a v small test case. Can I attach it here? Let's find out... I also have a screenshot if anyone is interested. Well, that didn't seem to work very well. In the meantime I've found the answer. I had these properties set on the main window. property name=window_positioncenter-always/property property name=default_width1024/property Removing them and the window maximizes properly. The hint came from bug https://bugzilla.gnome.org/show_bug.cgi?id=587591 . Hope this helps someone else. Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GdkEvent question (is it a bug?)
While working on a script to convert the GdkEvent structures to Fortran derived types for the GtkFortran project I came across the following struct _GdkEventClient { GdkEventType type; GdkWindow *window; gint8 send_event; GdkAtom message_type; gushort data_format; union { char b[20]; short s[10]; long l[5]; } data; }; This looks to me like a 32-bit-specific construct as (a) there's no int type and (b) on a 64-bit system the long tag in the union will be twice as long as the short char tags, should this be regarded as a bug? Also, since Fortran's iso_c_binding does not have any support for unions so any attempt to include this will be at best a kludge, is this an important event ? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Maximize on Windows 7 seems broken.
Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Maximize on Windows 7 seems broken.
On 11/05/2011 8:19 AM, Matteo Landi wrote: On Wed, May 11, 2011 at 12:07 AM, James Steward jamesstew...@optusnet.com.au wrote: Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. Is it maybe a problem with the window manager? I had problem trying to raise a window up if covered. Just guessing... Whether a problem with Bill's window manager or not, there must be a solution from Gtk. JS. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk_tree_view_column query.
Hello, I'm working on some aspects of gtk-fortran (an interface of GTK+ to Fortran95/2003), and so need to implement things without using varargs routines. However I'm getting unexpected behaviours. I don't think the problem is in the Fortran interface as I can reproduce the errors in C-examples. The first is in setting up the column attributes, the original C code was: column = gtk_tree_view_column_new_with_attributes(#, renderer, text, 0, NULL); Which if I interpret the manual correctly ought to be replaceable by: column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, #); gtk_tree_view_column_add_attribute(column, renderer, text, 0); But the latter gives an assertion error: (list1:6044): Gtk-CRITICAL **: gtk_tree_view_column_cell_layout_add_attribute: assertion `info != NULL' failed The second comes when trying to add a value to a column, the original was: gtk_list_store_set(store,iter, 0, nrow, -1); /* The index column */ Which (again if I'm interpreting the manual right) should be equivalent to: gtk_list_store_set_value(store, iter, 0, (Gvalue *) nrow); but instead the latter gives a segfault 0x755effc9 in type_check_is_value_type_U (value=0x7fffdcac) at /build/buildd/glib2.0-2.26.1/gobject/gtype.c:4073 Does anybody see a grave error in interpreting the manual or is there a real problem with some of these routines? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_tree_view_column query.
On 17 March 2011 15:55, James Tappin jtap...@gmail.com wrote: Hello, I'm working on some aspects of gtk-fortran (an interface of GTK+ to Fortran95/2003), and so need to implement things without using varargs routines. However I'm getting unexpected behaviours. I don't think the problem is in the Fortran interface as I can reproduce the errors in C-examples. I should have added: I'm running 64-bit Linux and using gcc ___ 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 the toolbar button flashing
On 1 March 2011 08:20, Miroslav Rajcic raj...@sokrates.hr wrote: I am trying to make the Pause button flash (or show any similar behaviour similar to that) when the pause state is active. So far I tried many things, but none of these seem to work: - changing the button background color - changing the button stock icon Alternating between two different stock items is quite easy when you know how, but I had to ask here for help. If you have two images, --8--- img1 = gtk_image_new_from_stock( GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_SMALL_TOOLBAR); img2 = gtk_image_new_from_stock( GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_SMALL_TOOLBAR); /* convert img1 and img2 from floating references which are deleted when no longer in use, to a normal reference. this prevents either of the images being deleted when we swap the play/stop button images. unref'd after gtk_main. */ g_object_ref_sink(img1); g_object_ref_sink(img2); --8--- then in your idle callback simply use gtk_button_set_image, alternating between the two images every time the function is called (ie you could use a static gboolean to track which button to show each time). then once gtk_main returns: --8--- gtk_main(); /* free the play stop images */ g_object_unref(img1); g_object_unref(img2); --8--- http://github.com/jwm-art-net/BoxySeq/blob/master/boxyseq_gui/gui_main.c - changing the button relief style Relevant code is following: //start timer to alternate the button state nBlinkButtonTimerID = g_timeout_add (900, flash_pause_button_timer, NULL); gboolean flash_pause_button_timer(gpointer data) { static bool bFlipFlop = false; bFlipFlop = !bFlipFlop; //get pointers to the relevant buttons GtkToolbar *toolbar2 = (GtkToolbar *)lookup_widget(window1, toolbar2); GtkWidget *tool_pause = (GtkWidget *)gtk_toolbar_get_nth_item(toolbar2, 2); GList *children1 = gtk_container_get_children(GTK_CONTAINER(tool_pause)); GtkButton *button = (GtkButton *)g_list_nth_data (children1, 0); g_list_free(children1); GtkWidget *tool_stop = (GtkWidget *)gtk_toolbar_get_nth_item(toolbar2, 1); //create two alternating colors (standard bkg and black bkg) GtkStyle* style = gtk_rc_get_style(tool_stop); GdkColor rgbStart = style-bg[GTK_STATE_NORMAL]; GdkColor rgbEnd = { 0, 0, 0, 0 }; //modify color gtk_widget_modify_bg (GTK_WIDGET(button), GTK_STATE_NORMAL, (bFlipFlop)? rgbEnd : rgbStart); gtk_widget_modify_bg (GTK_WIDGET(button), GTK_STATE_ACTIVE, (bFlipFlop)? rgbEnd : rgbStart); gtk_widget_modify_base (GTK_WIDGET(button), GTK_STATE_NORMAL, (bFlipFlop)? rgbEnd : rgbStart); gtk_widget_modify_base (GTK_WIDGET(button), GTK_STATE_ACTIVE, (bFlipFlop)? rgbEnd : rgbStart); gtk_widget_queue_draw (GTK_WIDGET(button)); #if GTK_CHECK_VERSION(2,18,0) gdk_window_process_updates (gtk_widget_get_window(GTK_WIDGET(button)), TRUE); #else gdk_window_process_updates (GTK_WIDGET(button)-window, TRUE); #endif /* GtkWidget *w1 = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(tool_pause)); gtk_widget_modify_bg (w1, GTK_STATE_NORMAL, (bFlipFlop)? rgbEnd : rgbStart); gtk_widget_modify_bg (w1, GTK_STATE_ACTIVE, (bFlipFlop)? rgbEnd : rgbStart); gtk_widget_modify_base (w1, GTK_STATE_NORMAL, (bFlipFlop)? rgbEnd : rgbStart); gtk_widget_modify_base (w1, GTK_STATE_ACTIVE, (bFlipFlop)? rgbEnd : rgbStart); */ //modify relief style gtk_button_set_relief(button, (bFlipFlop)? GTK_RELIEF_NORMAL:GTK_RELIEF_NONE); //modify stock icon gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(tool_pause), (bFlipFlop)? GTK_STOCK_MEDIA_PAUSE : GTK_STOCK_MEDIA_RECORD); gtk_tool_item_toolbar_reconfigured (GTK_TOOL_ITEM(tool_pause)); return TRUE; } Why doesn't any of these work ? Any tips ? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- _ : http://jwm-art.net/ -audio/image/text/code/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: g_remove
On 17 February 2011 12:27, Craig Bakalian craigbakal...@verizon.net wrote: Hi, I am using g_remove to remove some temporary files from the /tmp folder. It is working as expected. Yet, gcc is complaining that I am making an implicit declaration. What is up with this? You've not #include-ed the necessary files? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: adding button events to a gtkdrawingarea based gobject
On 14 February 2011 13:20, James Morris jwm.art@gmail.com wrote: Hi, (forgive some imprecise names here, am writing from memory and in a rush before work) I'm adapting some code which uses gobject to create a widget. The code previously used GtkWidget as the parent_class but I am trying to adapt it to GtkDrawingArea as the parent_class. However, the button_press_event code is no longer activated within the custom widget now that it's a drawing area. How do I activate it? I know with an ordinary GtkDrawingArea if I want to add button-press-events to use gtk_add_events, but the code that uses the custom widget shouldn't need to do this and besides the widget needs to connect to it's own internal private implementation code anyway so gtk_add_events is obviously wrong. Can anyone provide some pointers please? Yes James, just add the call to gtk_widget_add_events into the yourwidget_init function. HTH! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
adding button events to a gtkdrawingarea based gobject
Hi, (forgive some imprecise names here, am writing from memory and in a rush before work) I'm adapting some code which uses gobject to create a widget. The code previously used GtkWidget as the parent_class but I am trying to adapt it to GtkDrawingArea as the parent_class. However, the button_press_event code is no longer activated within the custom widget now that it's a drawing area. How do I activate it? I know with an ordinary GtkDrawingArea if I want to add button-press-events to use gtk_add_events, but the code that uses the custom widget shouldn't need to do this and besides the widget needs to connect to it's own internal private implementation code anyway so gtk_add_events is obviously wrong. Can anyone provide some pointers please? Thanks, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Memory leaks
On 9 February 2011 11:13, Tor Lillqvist t...@iki.fi wrote: With the right tool there is no problem at all in finding such true leaks. How does one gain this mysterious tool for Linux? I have used Valgrind but as mentioned by numerous souls at numerous times in the past, a suppressions file is needed for GTK/GLIB. And creating a suppressions file is more work than actually writing the code of the program I'm trying to debug in the first place is. james. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Memory leaks
On 9 February 2011 16:10, Michael Cronenworth m...@cchtml.com wrote: James Morris wrote: How does one gain this mysterious tool for Linux? It's called Google. There's a web page[1] that details how to setup valgrind to debug gtk/glib apps and even a preliminary suppression file. [1] http://live.gnome.org/Valgrind That's called patronising. I have been there already. What good is a work in progress when the progress stopped over two years ago? Not only do we have to write our own code, we have to put work into making other peoples code ignore the errors in other peoples code so we can see the errors in our own code. It's a bloody outrage! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gobject construction with parameter
On 1 February 2011 00:39, James Morris jwm.art@gmail.com wrote: On 31 January 2011 13:32, Jannis Pohlmann jan...@xfce.org wrote: Can anyone point me in the direction of code examples where the construction of the g object requires a parameter so I can see how to do it please? - I can't make sense of the documentation. I usually do this by adding a construct or construct-only property to the object class and creating a my_object_new() function that takes a parameter for this property that I can then pass to g_object_new(). Here's a simple example from Xfce's XDG menu library garcon: GarconMenu is the object and it needs a menu file (a GFile object) to be constructed properly. So what we did is to to install a construct-only property like this: http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n246 It looks straight forward at first glance but soon becomes apparent it's not at all :/ I want to pass a const char** null terminated list of C strings - which is obviously not a G_TYPE_FILE! I thought maybe I could use G_TYPE_ARRAY but that results in: GLib-GObject-CRITICAL **: g_param_spec_object: assertion `g_type_is_a (object_type, G_TYPE_OBJECT)' failed So I've no idea what to do there. It's as clear as mud; I'm a GObject newb. I've solved it in a way. Have gone back to using a parameter-less constructor, and a much simplified init function. Instead the code to generate the widgets is in an 'add' style function in which I do all the things intended. It works. Thanks, James. -- _ : http://jwm-art.net/ -audio/image/text/code/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gobject construction with parameter
Hi, I'm trying to modify some existing code which uses gobject so that the function to create a new object can take a parameter. The existing code is quite simple, and my modifications simplify it further so I don't want to spend a great deal of time messing about with Gobject things. Can anyone point me in the direction of code examples where the construction of the g object requires a parameter so I can see how to do it please? - I can't make sense of the documentation. Cheers, James. -- _ : http://jwm-art.net/ -audio/image/text/code/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gobject construction with parameter
On 31 January 2011 13:32, Jannis Pohlmann jan...@xfce.org wrote: Can anyone point me in the direction of code examples where the construction of the g object requires a parameter so I can see how to do it please? - I can't make sense of the documentation. I usually do this by adding a construct or construct-only property to the object class and creating a my_object_new() function that takes a parameter for this property that I can then pass to g_object_new(). Here's a simple example from Xfce's XDG menu library garcon: GarconMenu is the object and it needs a menu file (a GFile object) to be constructed properly. So what we did is to to install a construct-only property like this: http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n246 It looks straight forward at first glance but soon becomes apparent it's not at all :/ I want to pass a const char** null terminated list of C strings - which is obviously not a G_TYPE_FILE! I thought maybe I could use G_TYPE_ARRAY but that results in: GLib-GObject-CRITICAL **: g_param_spec_object: assertion `g_type_is_a (object_type, G_TYPE_OBJECT)' failed So I've no idea what to do there. It's as clear as mud; I'm a GObject newb. and write a _new() function that takes a GFile for this property and passes it to g_object_new(): http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n459 This property will not be available in the init function (e.g. garcon_menu_init) but if you want to do something with it before the object can be used by the outside world, you can do that by overriding the GObject constructed function like you do with finalize or get_property. In constructed, the construct and construct-only properties will be set and you can do something with them. Anyway, thanks for making an effort to help. I think the only way anyone could provide any further help here would be to show me an example that works using a const char ** null terminated list of c strings as a parameter to the constructor. I will most likely avoid GObject all together and do it the old fashioned C way as this only seems to be making it more complex than necessary. Thanks, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: newbie question about g_object unref()
On Thu, 2010-11-18 at 22:11 +, N James Bridge wrote: It seems that g_object_unref (ptr) doesn't set ptr to NULL when it frees the allocated memory. Have I got something wrong here? Do I have to do it explicitly? Thanks for all your contributions. I have now found G_IS_OBJECT(), which is obviously the way to test whether the memory has been released or not. -- N James Bridge ja...@xmas.demon.co.uk ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
newbie question about g_object unref()
It seems that g_object_unref (ptr) doesn't set ptr to NULL when it frees the allocated memory. Have I got something wrong here? Do I have to do it explicitly? Thanks, James Bridge ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
bug in Cairo or Gtk - peculiar behaviour on resizing or exposing window
I am hoping someone will have the time to look at this. I have been developing a gtk/cairo program to draw views of the Mandelbrot set. I wanted to show how the usual iteration progressed for an arbitrary starting point; it worked but occasionally seemed to misbehave. Below is a cut-back version which illustrates the problem. A left click with the mouse sets a starting point which behaves correctly; a right click sets a nearby point which produces a very similar figure but which misbehaves. To see this first try resizing the window - for some sizes it is drawn correctly but for others not. With a bad version, slide another window in front and then away to the side, when the picture is redrawn correctly. Then try minimising it and restoring it, which makes it go wrong again. I am using gtk2-2.22.0-1.fc14.1.x86_64, cairo-1.10.0-2.fc14.x86_64 and gcc-4.5.1-4.fc14.x86_64 So, first: have I done something wrong (probably in draw_iter())? If not, is there a bug in gtk or gdk or cairo ? Many thanks for any help James Bridge === /* mbrot.c compile with: cc `pkg-config --cflags gtk+-2.0 --libs gtk+-2.0` mbrot.c -lm */ #include gtk/gtk.h #include math.h typedef struct {gdouble x, y;} complex_t; GtkWidget *map; complex_t cc = {0., 0.}; /**/ static gdouble step (complex_t* z, const complex_t* c); void draw_iter (GtkWidget *area, const complex_t *c); static void destroy( GtkWidget *widget, gpointer data ); static gboolean expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data ); static gboolean button_pressed (GtkWidget* widget, GdkEventButton* event, gpointer data); static gboolean motion_notify (GtkWidget* map, GdkEventMotion* event, GtkLabel *z_label); /**/ static gdouble step (complex_t* z, const complex_t* c) { gdouble xsq = z-x * z-x; gdouble ysq = z-y * z-y; z-y = 2 * z-x * z-y + c-y; z-x = xsq - ysq + c-x; return xsq + ysq; } /**/ void draw_iter (GtkWidget *area, const complex_t *c) { GtkAllocation alloc; gtk_widget_get_allocation (area, alloc); gdouble scale = 3.5 / alloc.width; gint n; gdouble r; complex_t z = cc; cairo_t *cra = gdk_cairo_create (gtk_widget_get_window (area)); cairo_translate (cra, 0.5, 0.5); cairo_set_source_rgb (cra, .2, .2, .2); cairo_set_line_width (cra, 1.0); cairo_move_to (cra, (z.x + 2.5) / scale, - (z.y - 1.4) / scale); for (n = 0; n 70; n++) if ((r = step (z, c)) 9.0) return; for (; n 100; n++) { if ((r = step (z, c)) 9.0) break; cairo_line_to (cra, (z.x + 2.5) / scale, - (z.y - 1.4) / scale); } cairo_stroke (cra); cairo_destroy (cra); return; } /**/ static void destroy( GtkWidget *widget, gpointer data ) { gtk_main_quit (); } /**/ static gboolean expose_event( GtkWidget *area, GdkEventExpose *event, gpointer data ) { if (cc.x != 0) draw_iter (area, cc); return FALSE; } /**/ static gboolean button_pressed (GtkWidget* map, GdkEventButton* event, gpointer data) { if (event-button == 1) { cc.x = -.99439; cc.y = 0.2626584; gdk_window_invalidate_rect (gtk_widget_get_window (map), NULL, FALSE); } else if (event-button == 3) { cc.x = -.99063; cc.y = 0.26797; gdk_window_invalidate_rect (gtk_widget_get_window (map), NULL, FALSE); } return FALSE; } /**/ gint main (gint argc, char* argv[]) { GtkWidget *window, *vbox, *hbox, *z_label, *start_button; gtk_init (argc, argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); map = gtk_drawing_area_new (); gtk_widget_set_can_focus (map, TRUE); gtk_widget_set_size_request (map, 500, 400); gtk_widget_add_events (map, GDK_BUTTON_PRESS_MASK ); gtk_container_add (GTK_CONTAINER (window), map); g_signal_connect (G_OBJECT (window), delete-event, G_CALLBACK (destroy), NULL); g_signal_connect (G_OBJECT (map), expose-event, G_CALLBACK (expose_event), NULL); g_signal_connect (G_OBJECT (map), button-press-event, G_CALLBACK (button_pressed
Re: bug in Cairo or Gtk - peculiar behaviour on resizing or exposing window
On 13 November 2010 22:18, N James Bridge ja...@xmas.demon.co.uk wrote: I am hoping someone will have the time to look at this. I have been developing a gtk/cairo program to draw views of the Mandelbrot set. I wanted to show how the usual iteration progressed for an arbitrary starting point; it worked but occasionally seemed to misbehave. Below is a cut-back version which illustrates the problem. A left click with the mouse sets a starting point which behaves correctly; a right click sets a nearby point which produces a very similar figure but which misbehaves. To see this first try resizing the window - for some sizes it is drawn correctly but for others not. With a bad version, slide another window in front and then away to the side, when the picture is redrawn correctly. Then try minimising it and restoring it, which makes it go wrong again. I am using gtk2-2.22.0-1.fc14.1.x86_64, cairo-1.10.0-2.fc14.x86_64 and gcc-4.5.1-4.fc14.x86_64 So, first: have I done something wrong (probably in draw_iter())? I can't see anything wrong exactly. I tried explicitly initializing z in draw_iter with z.x = cc.x; z.y = cc.y, and used gtk_widget_queue_draw instead of gdk_window_invalidate_rect but both of these made no difference. I also added some printf statements to check what's happening. For the values of cc, the code never returns in the first for loop, and the values of z.x and z.y after both loops never changes other than when cc does. In other words, the drawing may change, but z.x and z.y after both loops does not. The next thing I'd try would be to run it through valgrind but I need to reboot to do that as valgrind is unusable on my current system. james. If not, is there a bug in gtk or gdk or cairo ? Many thanks for any help James Bridge === /* mbrot.c compile with: cc `pkg-config --cflags gtk+-2.0 --libs gtk+-2.0` mbrot.c -lm */ #include gtk/gtk.h #include math.h typedef struct {gdouble x, y;} complex_t; GtkWidget *map; complex_t cc = {0., 0.}; /**/ static gdouble step (complex_t* z, const complex_t* c); void draw_iter (GtkWidget *area, const complex_t *c); static void destroy( GtkWidget *widget, gpointer data ); static gboolean expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data ); static gboolean button_pressed (GtkWidget* widget, GdkEventButton* event, gpointer data); static gboolean motion_notify (GtkWidget* map, GdkEventMotion* event, GtkLabel *z_label); /**/ static gdouble step (complex_t* z, const complex_t* c) { gdouble xsq = z-x * z-x; gdouble ysq = z-y * z-y; z-y = 2 * z-x * z-y + c-y; z-x = xsq - ysq + c-x; return xsq + ysq; } /**/ void draw_iter (GtkWidget *area, const complex_t *c) { GtkAllocation alloc; gtk_widget_get_allocation (area, alloc); gdouble scale = 3.5 / alloc.width; gint n; gdouble r; complex_t z = cc; cairo_t *cra = gdk_cairo_create (gtk_widget_get_window (area)); cairo_translate (cra, 0.5, 0.5); cairo_set_source_rgb (cra, .2, .2, .2); cairo_set_line_width (cra, 1.0); cairo_move_to (cra, (z.x + 2.5) / scale, - (z.y - 1.4) / scale); for (n = 0; n 70; n++) if ((r = step (z, c)) 9.0) return; for (; n 100; n++) { if ((r = step (z, c)) 9.0) break; cairo_line_to (cra, (z.x + 2.5) / scale, - (z.y - 1.4) / scale); } cairo_stroke (cra); cairo_destroy (cra); return; } /**/ static void destroy( GtkWidget *widget, gpointer data ) { gtk_main_quit (); } /**/ static gboolean expose_event( GtkWidget *area, GdkEventExpose *event, gpointer data ) { if (cc.x != 0) draw_iter (area, cc); return FALSE; } /**/ static gboolean button_pressed (GtkWidget* map, GdkEventButton* event, gpointer data) { if (event-button == 1) { cc.x = -.99439; cc.y = 0.2626584; gdk_window_invalidate_rect (gtk_widget_get_window (map), NULL, FALSE); } else if (event-button == 3) { cc.x = -.99063; cc.y = 0.26797; gdk_window_invalidate_rect (gtk_widget_get_window (map), NULL, FALSE); } return FALSE
Re: bug in Cairo or Gtk - peculiar behaviour on resizing or exposing window
On Sun, 2010-11-14 at 11:17 +, James Morris wrote: On 13 November 2010 22:18, N James Bridge ja...@xmas.demon.co.uk wrote: I am hoping someone will have the time to look at this. I have been developing a gtk/cairo program to draw views of the Mandelbrot set. ... I am using gtk2-2.22.0-1.fc14.1.x86_64, cairo-1.10.0-2.fc14.x86_64 and gcc-4.5.1-4.fc14.x86_64 So, first: have I done something wrong (probably in draw_iter())? I can't see anything wrong exactly. I tried explicitly initializing z in draw_iter with z.x = cc.x; z.y = cc.y, and used gtk_widget_queue_draw instead of gdk_window_invalidate_rect but both of these made no difference. I also added some printf statements to check what's happening. For the values of cc, the code never returns in the first for loop, and the values of z.x and z.y after both loops never changes other than when cc does. In other words, the drawing may change, but z.x and z.y after both loops does not. The next thing I'd try would be to run it through valgrind but I need to reboot to do that as valgrind is unusable on my current system. james. Thanks for input. I assume you did see the same error in drawing - some areas inside the drawing come out solid black? I will have to look up valgrind. All of this is a big learning exercise! NJB ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: bug in Cairo or Gtk - peculiar behaviour on resizing or exposing window
On 14 November 2010 12:40, N James Bridge ja...@xmas.demon.co.uk wrote: Thanks for input. I assume you did see the same error in drawing - some areas inside the drawing come out solid black? Yes. I will have to look up valgrind. All of this is a big learning exercise! Valgrind sometimes spots initialization errors that just looking at the code does not, but I'm doubtful it will in this case, but I don't know what else to try. James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: bug in Cairo or Gtk - peculiar behaviour on resizing or exposing window
On Sun, 2010-11-14 at 12:48 +, James Morris wrote: On 14 November 2010 12:40, N James Bridge ja...@xmas.demon.co.uk wrote: Thanks for input. I assume you did see the same error in drawing - some areas inside the drawing come out solid black? Yes. I will have to look up valgrind. All of this is a big learning exercise! Valgrind sometimes spots initialization errors that just looking at the code does not, but I'm doubtful it will in this case, but I don't know what else to try. James. Valgrind with memcheck doesn't show anything in my code (lots of possible leaks in gtk). I have noticed that changing the constant 1.4 in draw_iter() makes a difference, though all it should do is to shift the drawing up or down in the window. ___ 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
Using RTL variants of GTK_STOCK_* icons
Hi, Is it possible to use an RTL variant of a stock icon (in an LTR language, without breaking RTL languages)? ta james ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Shortcut for GtkEntry Icon?
How can I make the icon for GtkEntry activiated by pressing enter/return within the entry itself? I can't switch focus to it using tab. Cheers, james. -- _ : http://jwm-art.net/ -audio/image/text/code ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
moving message on a gtk dialog
On 19 October 2010 11:01, Guruprasad Bhat guruprasad...@gmail.com wrote: Hi all, I was thinking of a application for showing moving message. In gtk is it possible to do that? I want a small gtk dialog displaying moving message. Can any one suggest in this regard. *Regards,* * Guruprasad Bhat.* The simplest form would scroll the message string itself by placing the first character of the message string at the end of the message string and repeating. You'll need a few extra spaces at the end of the message. Then you'll need an idle callback or timeout to call the string scrolling routine and then to redisplay it as a label. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk filechooser dialog error
On 1 October 2010 07:22, Nagaraja nagar...@ncoretech.com wrote: Hi all, I supposed use gtk_wdget_hide instead of gtk_widget_destroy in this case,now it is working as expected. What about all the errors/warnings, have they gone, or do they still appear? Did the errors appear the first time the dialog was opened, or only when the dialog was re-opened? Using gtk_widget_hide instead of gtk_widget_destroy is quite likely only hiding the errors - the errors are still there and just waiting to crash your code more seriously. Take a look at the typical usage examples of the GtkFileChooserDialog[1] in the documentation. If you still have problems we'll probably need to see the code. James. [1] http://library.gnome.org/devel/gtk/stable/GtkFileChooserDialog.html Best regards, Nagaraja. Hi all, I am running glade-3.6.7, my gtk application have main window with buttons and File Menu to open and save a file . I build it from glade file. For File/Open and File/Save operation the filechooser dialog works fine it brings up the file chooser dialog window , where I can select the desired file or edit the defaut filename which appares in text entry of file save dialog. Upon selecting or editing the default filename the dialog disappears as expected and filename in gchar *filename. The callback for menuitem to open/save calls open_dialog() and save_dialog() which return a gchar * pointer to the filename. But what is hapennig is that am able Open/Save first time wihout any problem but if I try to open filechooser dialog window again it is not providing me the filechooser dialog window any more. More over when I try to open second time it is giving the below error. Can any one here suggest me how do I implement( Desing gtk GUI) gtk app for File Operation. your valuable suggest and help is greatly appriciated. Thanks in advance. Nagaraja. Enter the file save (recorder:3747): Gtk-CRITICAL **: gtk_widget_grab_default: assertion `GTK_WIDGET_CAN_DEFAULT (widget)' failed FILE IS /root/oop.wav Enter the file save (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkWindow' (recorder:3514): Gtk-CRITICAL **: gtk_window_set_title: assertion `GTK_IS_WINDOW (window)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkFileChooser' (recorder:3514): Gtk-CRITICAL **: gtk_file_chooser_set_do_overwrite_confirmation: assertion `GTK_IS_FILE_CHOOSER (chooser)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkFileChooser' (recorder:3514): Gtk-CRITICAL **: gtk_file_chooser_set_current_folder: assertion `GTK_IS_FILE_CHOOSER (chooser)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkFileChooser' (recorder:3514): Gtk-CRITICAL **: gtk_file_chooser_set_current_name: assertion `GTK_IS_FILE_CHOOSER (chooser)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkDialog' (recorder:3514): Gtk-CRITICAL **: gtk_dialog_run: assertion `GTK_IS_DIALOG (dialog)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkWidget' (recorder:3514): Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed inside open (recorder:3514): Gtk-CRITICAL **: gtk_widget_grab_default: assertion `GTK_WIDGET_CAN_DEFAULT (widget)' failed The file name in open /root/001.wav The Selected file in call back /root/001.wav inside open (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkFileChooser' (recorder:3514): Gtk-CRITICAL **: gtk_file_chooser_set_select_multiple: assertion `GTK_IS_FILE_CHOOSER (chooser)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkFileChooser' (recorder:3514): Gtk-CRITICAL **: gtk_file_chooser_set_current_folder: assertion `GTK_IS_FILE_CHOOSER (chooser)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkDialog' (recorder:3514): Gtk-CRITICAL **: gtk_dialog_run: assertion `GTK_IS_DIALOG (dialog)' failed (recorder:3514): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkWidget' (recorder:3514): Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed The Selected file in call back (null) (recorder:3514): GLib-CRITICAL **: g_stpcpy: assertion `src != NULL' failed ___ 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 -- _ : http://jwm-art.net
obtaining current viewport/scrolled window dimensions
Hi, I have a GtkDrawingArea within a GtkViewport within a GtkScrolledWindow. I need the viewport dimensions so I can center the contents of the drawing area when the drawn contents are smaller than the viewport/window. There is a vague mention of page_size in the documentation for scrolled window but no other clues. How do I get these dimensions please? Cheers, James. -- _ : http://jwm-art.net/ -audio/image/text/code ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: obtaining current viewport/scrolled window dimensions
On 22 September 2010 23:49, James Morris jwm.art@gmail.com wrote: Hi, I have a GtkDrawingArea within a GtkViewport within a GtkScrolledWindow. I need the viewport dimensions so I can center the contents of the drawing area when the drawn contents are smaller than the viewport/window. There is a vague mention of page_size in the documentation for scrolled window but no other clues. How do I get these dimensions please? Sorry for the noise, I figured it out once I wrote the email and clicked send: width = gtk_adjustment_get_page_size(gtk_scrolled_window_get_hadjustment(my_scrolled_window)); height = gtk_adjustment_get_page_size(gtk_scrolled_window_get_vadjustment(my_scrolled_window)); ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
scrolled window adjustment 'changed' signal question
Hi, As from my previous email, I require the dimensions of the scrolled window. I decided to detect when they change (due to the top level window being resized) by using the 'changed' signal emitted by the hadjustment and vadjustment respectively. So I create two user functions one for when window width is changed, and the other for when window height is changed. Using g_signal_connect I connect the scrolled window's hadjustment and vadjustments respectively (to the user functions). The behaviour seems a little odd though: if I only change width OR height (NOT both) then BOTH adjustments emit the 'changed' signal. Is this supposed to happen like this? (gtk version 2.20) Thanks, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Windows printing problem
On Fri, 2010-08-20 at 15:55 +1000, James wrote: Hi, I've refined the code a bit. This I can print to PDF using pdfFactory Pro, and it is displayed in the pdfFactory Pro preview window properly, but Windows always errors out on the actual printing. Printing direct to the printer (HP laserjet) also causes windows to report an error trying to print. (The printer works fine for every other app on Windows and Ubuntu). Draw page code below. snip Ok, I think I found the reason the darn thing wont print under windows. It seems that because I have about 1 lines drawn in cairo onto the print surface, the printer chucks a fit. Now I draw to a separate cairo surface and copy to the print context, which generates somewhat fuzzy lines, but at least works. Is there something I can do to improve the fuzzy lines? James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Windows printing problem
Hi, I have an app that prints 2 pages with an image in one corner of the page, and some plotted data in the middle, the rest is text. The page is oriented in landscape. On Ubuntu the printing works fine. On Windows XP I can get the text only to work. Printing the image creates blank pages. Printing the plotted data causes printing errors. I'm using gtk+-bundle_2.18.7-20100213_win32 Any clues? Code below. Regards, James. pb = gdk_pixbuf_new_from_file(./Logo.jpg, gerror); if(!pb) { eprintf(error message: %s\n, gerror-message); return; } int pb_width = gdk_pixbuf_get_width (pb); int pb_height = gdk_pixbuf_get_height (pb); //set to 1 makes the whole page blank on Win32, Linux fine. #if 0 cairo_surface_t *image = cairo_image_surface_create_for_data( gdk_pixbuf_get_pixels(pb), CAIRO_FORMAT_RGB24, pb_width, pb_height, gdk_pixbuf_get_rowstride(pb)); do { int rowstride, n_channels, x, y; guchar *pixels, *p, tmp; pixels = gdk_pixbuf_get_pixels (pb); rowstride = gdk_pixbuf_get_rowstride(pb); n_channels = gdk_pixbuf_get_n_channels (pb); for (y = 0; y pb_height; y++) { for (x = 0; x pb_width; x++) { p = pixels + y * rowstride + x * n_channels; tmp = p[0]; p[0] = p[2]; p[2] = tmp; } } } while (0); cairo_save (cr); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_set_source_surface(cr, image, 0, 0); cairo_paint (cr); cairo_restore (cr); cairo_surface_destroy(image); #endif ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Windows printing problem
Hi, I've refined the code a bit. This I can print to PDF using pdfFactory Pro, and it is displayed in the pdfFactory Pro preview window properly, but Windows always errors out on the actual printing. Printing direct to the printer (HP laserjet) also causes windows to report an error trying to print. (The printer works fine for every other app on Windows and Ubuntu). Draw page code below. Regards, James. static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data) { g_print(Draw page %d\n, page_nr); int i; char text[256]; int len; PangoLayout *layout; PangoFontDescription *desc; GError *gerror = NULL; GdkPixbuf *pb; cairo_t *cr; gdouble width, height; cr = gtk_print_context_get_cairo_context (context); width = gtk_print_context_get_width (context); height = gtk_print_context_get_height (context); pb = gdk_pixbuf_new_from_file(./Logo.jpg, gerror); if(!pb) { eprintf(error message: %s\n, gerror-message); return; } int pb_width = gdk_pixbuf_get_width (pb); int pb_height = gdk_pixbuf_get_height (pb); cairo_operator_t op = cairo_get_operator(cr); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); gdk_cairo_set_source_pixbuf(cr, pb, 0.0, 0.0); cairo_paint (cr); cairo_set_operator(cr, op); cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); layout = gtk_print_context_create_pango_layout (context); desc = pango_font_description_from_string (sans 14); pango_layout_set_font_description (layout, desc); sprintf(text, Title details); cairo_move_to(cr, pb_width+10, 0); pango_layout_set_text (layout, text, -1); pango_cairo_update_layout (cr, layout); pango_cairo_show_layout (cr, layout); pango_layout_set_text (layout, text, -1); pango_font_description_free (desc); g_object_unref (layout); for (i = 0; i 6; i++) { layout = gtk_print_context_create_pango_layout (context); len = 0; len += sprintf(text[len], Stuff\n); len += sprintf(text[len], More stuff\n); pango_layout_set_text (layout, text, -1); desc = pango_font_description_from_string (sans 9); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); pango_cairo_update_layout (cr, layout); cairo_move_to(cr, (5 - i) * (width - GAP_X_AXIS) / 6, height - 80); pango_cairo_show_layout (cr, layout); g_object_unref (layout); } cairo_translate(cr, 0, pb_height); if (page_nr == 0) { #if 1 //Various text and line drawing //with pango and cairo functions. #endif } else if (page_nr == 1) { #if 1 //Various text and line drawing //with pango and cairo functions. #endif } } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Performance issues of GDK deprecation in favour of Cairo
On 18 August 2010 15:57, Stefan Kost enso...@hora-obscura.de wrote: hi, On 17.08.2010 12:01, James Morris wrote: Hi, I see that some GDK drawing functions and graphics contexts have been deprecated in favour of using Cairo. Yesterday I spent a few hours *removing* Cairo code from my fledgling GTK application and replacing it with gdk_draw_rectangle, gdk_gc_set_rgb_fg_color, and gdk_gc_set_function. I did this for performance reasons[1] I am wondering if my approach to drawing is wrong however and if a better approach might yield less CPU usage? It begins with a 33ms timeout. The timeout callback calls gtk_widget_queue_draw on the window and the drawing area. Would it be possible to isolate this into a standalone demo. Or could you point us to the actual code? Hi Stefan, The actual code is here: http://github.com/jwm-art-net/BoxySeq/blob/97f6d674a2a182a143ef82b03bde11689fedcf18/gui_grid.c I'm probably not going to work on it for a while. Probably going to make the back-end into a library first and then investigate the possibility of using FLTK. Cheers, James. Stefan (Imagine rectangles appearing each time a note is played in a piece of music and disappearing when that note ends.) In the expose event callback a linked-list of rectangles is maintained. Rectangles are added to the list and removed from the list as notes start and end (The application is an experimental MIDI sequencer/arpeggiator operating in real time). Each and every time the expose event callback is called (every 33ms) the background and the entire list of rectangles is drawn as well as various maintenance functions performed on the list. The documentation of gdk_cairo_create seems to suggest this is the only way of doing it when it says: Note that due to double-buffering, Cairo contexts created in a GTK+ expose event handler cannot be cached and reused between different expose events. Is it possible to do this any other way? Cheers, James. [1]My machine is a 64bit 3.0ghz dual core desktop. Using GDK for drawing, the CPU usage is at worst 5% on both cores. Using Cairo on the other hand, the CPU usage can reach as much as 20% on both cores. The project is here: http://github.com/jwm-art-net/BoxySeq Cairo routines is here: http://github.com/jwm-art-net/BoxySeq/tree/97f6d674a2a182a143ef82b03bde11689fedcf18 GDK routines is here: http://github.com/jwm-art-net/BoxySeq/tree/29f412b41b2371ec136aa86da50d858f5892bfa0 ___ 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
text on a curved baseline?
Hi this is a beginner's question... can you make text follow a curved baseline? Looks like no. James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Accessor function for application.width ?
It's useful to blank out a drawing area by drawing a filled rectangle with the same size as the window. The examples I have seen get the dimensions from widget-allocation.width but Devhelp says that the GtkAllocation structure is GSEALed. At present the method works but is there an accessor function to use instead? I can't find one. TIA James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
custom widgets - advice on where to start?
Hi, I need to create some complex widgets for my program. The first of which is the main widget which will show static rectangles within which other rectangles appear and disappear at musical rates (think fast electronic dance music rates). The static rectangles may overlap each other, but the other rectangles may not. I'm working in C. Can anyone recommend a good tutorial for this kind of thing? I've looked over http://zetcode.com/tutorials/cairographicstutorial/ but it doesn't explain much about creating custom widgets, nor am I sure if I should use Cairo or not. While I want the display to be colourful and attractive, I also want lightweight resource requirements and speed. Thanks, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: custom widgets - advice on where to start?
On 7 July 2010 17:34, Staffan Gimåker staf...@gimaker.se wrote: Is there a particular reason that you need a custom widget? Can you not just use a GtkDrawingArea and use Cairo to draw things in it? That's the thing I'm unsure of, when to use a GtkDrawingArea and when to use a custom widget. I've never required anything beyond the standard widgets before now. I'll look at the Cairo documentation. Cheers, James. The official Cairo documentation (the tutorial is here: http://cairographics.org/tutorial/) and the Gtk documentation are probably good places to start. /Staffan On Wed, 2010-07-07 at 13:05 +0100, James Morris wrote: Hi, I need to create some complex widgets for my program. The first of which is the main widget which will show static rectangles within which other rectangles appear and disappear at musical rates (think fast electronic dance music rates). The static rectangles may overlap each other, but the other rectangles may not. I'm working in C. Can anyone recommend a good tutorial for this kind of thing? I've looked over http://zetcode.com/tutorials/cairographicstutorial/ but it doesn't explain much about creating custom widgets, nor am I sure if I should use Cairo or not. While I want the display to be colourful and attractive, I also want lightweight resource requirements and speed. Thanks, James. ___ 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: drawing colored lines
On Mon, 2010-06-14 at 21:15 +0100, N James Bridge wrote: Hi all I have been experimenting with GtkDrawingArea, drawing mathematical functions. Can anyone tell me how to change the foreground color (to red, say)? I have found the answer... gtk_widget_modify_fg () Supplementary question - is there any way of getting an alpha channel, other than with Cairo? -- N James Bridge ja...@xmas.demon.co.uk ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: drawing colored lines
sorry - wrong code! -- N James Bridge ja...@xmas.demon.co.uk ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
drawing colored lines
Hi all I have been experimenting with GtkDrawingArea, drawing mathematical functions. Can anyone tell me how to change the foreground color (to red, say)? I want to do this in the program, not with the color chooser widget. It's easy enough with Cairo but I can't figure out how to do it with GDK. I've tried gdk_gc_set_rgb_fg_color () and can get it to compile but the program then crashes. thanks... James Bridge ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_button_new_from_stock () does not find icons.
The settings under GNOME are in GConf's /desktop/gnome/interface/, the keys buttons_have_incons and menus_have_icons. You can change them with gconf-editor or using gconftool-2(1). Regards, Colomban Success! Thanks a lot - very helpful to know about gconf-editor. James ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk_button_new_from_stock () does not find icons.
I don't know if this is a fedora problem or a gtk one... I have been writing some short gtk programs, as a learning exercise. So far as I can see, I should be able to add items from stock, but the images are missing and all I get are the default items as mnemonics. I have attached a short example. It compiles with: gcc stock.c `pkg-config --cflags gtk+-2.0 --libs gtk+-2.0` It seems that gtk can't find the directory with the images. The files needed seem to be in /usr/share/icons/gnome and show up in the gtk-demo program. However, Glade buttons selected from stock do not have the icons either. Any suggestions most welcome! -- N James Bridge ja...@xmas.demon.co.uk ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Building gtkmm for 64-bit Windows
I am attempting to build gtkmm for a computer with a 64-bit Windows 7 operating system. For this attempt I am using the compiler from the mingw-w64 project (as a native compiler for the Windows 7 system, in the msys environment). It appears that I have been successful in building all the packages that gtkmm depends on (libsigc++, glibmm, cairomm, and pangomm), and I used the all-in-one bundle from GTK+ (gtk+-bundle_2.16.6-20090912_win64.zip). Configure runs for gtkmm with no complaint, and the make proceeds happily along for a long time, but fails at a link statement near the end of the build. Can anyone give me advice on what is causing this problem and how to solve it? Thanks! Here is an abridged version of the terminal output: Making all in demos make[2]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos' Making all in gtk-demo make[3]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo' /bin/sh ../../libtool --tag=CXX --mode=link x86_64-w64-mingw32-g++ -g -O2 -mms-bitfields -Wall -o gtkmm-demo.exe example_appwindow.o example_buttonbox.o example_change_display.o example_colorsel.o example_dialog.o example_drawingarea.o example_images.o example_iconview.o example_menus.o example_panes.o example_pixbufs.o example_sizegroup.o example_stockbrowser.o example_uimanager.o example_textview.o example_treeview_editable_cells.o example_treeview_liststore.o example_treeview_treestore.o demowindow.o main.o textwidget.o demo-common.o ../../gdk/gdkmm/libgdkmm-2.4.la ../../gtk/gtkmm/libgtkmm-2.4.la -LC:/msys/1.0/local/lib -Lc:/GTK+/lib -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl x86_64-w64-mingw32-g++ -g -O2 -mms-bitfields -Wall -o .libs/gtkmm-demo.exe example_appwindow.o example_buttonbox.o example_change_display.o example_colorsel.o example_dialog.o example_drawingarea.o example_images.o example_iconview.o example_menus.o example_panes.o example_pixbufs.o example_sizegroup.o example_stockbrowser.o example_uimanager.o example_textview.o example_treeview_editable_cells.o example_treeview_liststore.o example_treeview_treestore.o demowindow.o main.o textwidget.o demo-common.o ../../gdk/gdkmm/.libs/libgdkmm-2.4.a -LC:/msys/1.0/local/lib -Lc:/GTK+/lib ../../gtk/gtkmm/.libs/libgtkmm-2.4.a /home/JamesCTilton/Downloads/gtkmm-2.16.0/gdk/gdkmm/.libs/libgdkmm-2.4.a /home/JamesCTilton/Downloads/gtkmm-2.16.0/atk/atkmm/.libs/libatkmm-1.6.dll.a /usr/local/lib/libgiomm-2.4.dll.a /usr/local/lib/libpangomm-1.4.a /usr/local/lib/libglibmm-2.4.dll.a /usr/local/lib/libcairomm-1.0.a -lfreetype -lfontconfig -lpng12 -lz /usr/local/lib/libsigc-2.0.dll.a -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -L/usr/local/lib example_buttonbox.o: C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/example_buttonbox.cc:83: undefined reference to `_imp___ZN3Gtk5Stock2OKE' example_buttonbox.o: C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/example_buttonbox.cc:86: undefined reference to `_imp___ZN3Gtk5Stock6CANCELE' (Many other similar messages) demowindow.o: C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/demowindow.cc:144: undefined reference to `_imp___ZN3Gtk14TreeViewColumnC1ERKN4Glib7ustringERNS_12CellRendererE' demowindow.o: C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/demowindow.cc:146: undefined reference to `_imp___ZN3Gtk14TreeViewColumn13add_attributeERKN4Glib18PropertyProxy_BaseERKNS_19TreeModelColumnBaseE' collect2: ld returned 1 exit status make[3]: *** [gtkmm-demo.exe] Error 1 make[3]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0' make: *** [all] Error 2 Dr. James C. Tilton Voice: 301-286-9510 NASA Goddard Space Flight Center FAX: 301-286-1776 Mail Code 606.3 E-Mail: james.c.til...@nasa.gov (Computational Information Sciences and Technology Office) Greenbelt, MD 20771 URLs: http://ipp.gsfc.nasa.gov/RHSEG/ and http://cisto.gsfc.nasa.gov/TILTON/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list