Re: can't get touch-events from touchscreen

2015-10-29 Thread Olivier Sessink
2015-10-28 20:05 GMT+01:00 Olivier Sessink :

> Hi all,
>
> I have a PiTFT, a 2.8" capacitive touchscreen for the Raspberry Pi on
> raspbian (gtk 3.10.x). It works perfect, except that I only receive button
> events, and I fail to receive touch events. Also kinetic scrolling is not
> working. What can I do to fix this?
>

after discussing this with Peter Hutterer (author of lots of Xinput code),
we came to the idea that this might be caused by the fact that this is a
single-touch input device, which do not generate XITouchClass events, but
generate only XIButtonClass and XIValuatorClass events (with types ABS_X
ABS_Y and ABS_PRESSURE).

Is it possible for GTK to detect single-touch devices and enable kinetic
scrolling for them as well?

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


can't get touch-events from touchscreen

2015-10-28 Thread Olivier Sessink
Hi all,

I have a PiTFT, a 2.8" capacitive touchscreen for the Raspberry Pi on
raspbian (gtk 3.10.x). It works perfect, except that I only receive button
events, and I fail to receive touch events. Also kinetic scrolling is not
working. What can I do to fix this?

I tried various things to get more information. This is what is reported in
Xorg.log:

[   486.549] (II) config/udev: Adding input device stmpe-ts
(/dev/input/event0)
[   486.549] (**) stmpe-ts: Applying InputClass "evdev touchscreen catchall"
[   486.549] (**) stmpe-ts: Applying InputClass "calibration"
[   486.550] (II) LoadModule: "evdev"
[   486.552] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[   486.553] (II) Module evdev: vendor="X.Org Foundation"
[   486.553]compiled for 1.12.1, module version = 2.7.0
[   486.553]Module class: X.Org XInput Driver
[   486.553]ABI class: X.Org XInput driver, version 16.0
[   486.553] (II) Using input driver 'evdev' for 'stmpe-ts'
[   486.554] (**) stmpe-ts: always reports core events
[   486.554] (**) evdev: stmpe-ts: Device: "/dev/input/event0"
[   486.555] (--) evdev: stmpe-ts: Vendor 0 Product 0
[   486.555] (--) evdev: stmpe-ts: Found absolute axes
[   486.555] (--) evdev: stmpe-ts: Found x and y absolute axes
[   486.555] (--) evdev: stmpe-ts: Found absolute touchscreen
[   486.555] (**) Option "SwapAxes" "1"
[   486.556] (II) evdev: stmpe-ts: Configuring as touchscreen
[   486.556] (**) Option "EmulateThirdButton" "1"
[   486.556] (**) Option "EmulateThirdButtonTimeout" "750"
[   486.557] (**) Option "EmulateThirdButtonMoveThreshold" "30"
[   486.557] (**) evdev: stmpe-ts: YAxisMapping: buttons 4 and 5
[   486.557] (**) evdev: stmpe-ts: EmulateWheelButton: 4,
EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[   486.558] (**) Option "config_info"
"udev:/sys/devices/soc/20204000.spi/spi_master/spi0/spi0.1/stmpe-ts/input/input0/event0"
[   486.558] (II) XINPUT: Adding extended input device "stmpe-ts" (type:
TOUCHSCREEN, id 6)
[   486.559] (II) evdev: stmpe-ts: initialized for absolute axes.
[   486.561] (**) stmpe-ts: (accel) keeping acceleration scheme 1
[   486.561] (**) stmpe-ts: (accel) acceleration profile 0
[   486.561] (**) stmpe-ts: (accel) acceleration factor: 2.000
[   486.561] (**) stmpe-ts: (accel) acceleration threshold: 4
[   486.565] (II) config/udev: Adding input device stmpe-ts
(/dev/input/mouse0)
[   486.565] (**) stmpe-ts: Applying InputClass "calibration"

It seems that X does detect a touchscreen. The event also seems to generate
touch events, evtest shows touch events, pressure and absolute positioning
which I think correspond to a touchscreen:

$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:stmpe-ts
Select the device event number [0-0]: 0
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "stmpe-ts"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
Event code 0 (ABS_X)
  Value   3014
  Min0
  Max 4095
Event code 1 (ABS_Y)
  Value   2942
  Min0
  Max 4095
Event code 24 (ABS_PRESSURE)
  Value  0
  Min0
  Max  255
Properties:
Testing ... (interrupt to exit)
Event: time 1445753599.628119, type 3 (EV_ABS), code 0 (ABS_X), value 1681
Event: time 1445753599.628119, type 3 (EV_ABS), code 1 (ABS_Y), value 2933
Event: time 1445753599.628119, type 3 (EV_ABS), code 24 (ABS_PRESSURE),
value 113
Event: time 1445753599.628119, type 1 (EV_KEY), code 330 (BTN_TOUCH),
value 1
Event: time 1445753599.628119, -- SYN_REPORT 
Event: time 1445753599.637296, type 3 (EV_ABS), code 0 (ABS_X), value 1639
Event: time 1445753599.637296, type 3 (EV_ABS), code 1 (ABS_Y), value 2967
Event: time 1445753599.637296, type 3 (EV_ABS), code 24 (ABS_PRESSURE),
value 131

If I call device.get_source() after a button press event, I get  

If I add touch events with eventbox.add_events(Gdk.EventMask.TOUCH_MASK)
and connect to the touch-event I get no callback calls.

If I try the example code from
http://www.digitaloctave.com/pages/gtk3/tutorial14.htm I don't get a touch
output either..

So what could be wrong, and how could this be fixed?

Thank you for any help on this matter

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


Re: Synchronization of gtk_tree_store add/remove events

2012-09-19 Thread Olivier Sessink
On 09/19/2012 09:44 PM, Arne Pagel wrote:
> Dear all,
> 
> I have an application where I use a tree-view to display some data from
> an external hardware.
> Different Objects can be added or removed to the treestore, each
> existing object in the treestore has a specific
> id which is used to get data over some communication interface.
> 
> It can easily happen, the the user deselects an object in the treestore
> while this communication is ongoing.
> This means that my treepath or iter which I rembered befor is not valid
> anymore after the communication has finished (*1).

why not connect to the "row-deleted" signal of the model, and whenever a
row is deleted, look if there is any ongoing communication and kill it?

Olivier

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


Re: gtk_main() at level 0 and gtk_file_chooser_dialog_new

2012-09-19 Thread Olivier Sessink
On 09/19/2012 05:32 PM, Alan wrote:
> Hi,
> 
> I use a GTK+ application where we mainly enter (with gtk_main()) and leave 
> (with gtk_main_quit()) the gtk main event loop at level 0. That means that 
> most of time we don't increase the gtk main loop level by calling recursively 
> gtk_main(). We use gui between calls of gtk_main()/gtk_main_quit() and we do 
> other things between gtk_main_quit() and gtk_main().

instead of calling a new gtk main loop, you might as well register an
idle callback / idle timeout callback, and exit your current function.
That way you don't need a second/third etc. main loop.

Olivier


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


Re: populate gtk tree view from outside

2012-09-12 Thread Olivier Sessink
On 09/12/2012 06:30 PM, Rudra Banerjee wrote:
> Oliver,
> Thanks for your reply.
> The problem basically is to pass on the function argument from one to
> other.

you need to create a header file (main.h) that has the enum, and
extern GtkListStore *treestore;

in main.c define GtkListStore *treestore; somewhere in the top of fthe
file, *not* inside a function.

then include this both in main.c and in otherfile.c like #include "main.h"

Olivier

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


Re: populate gtk tree view from outside

2012-09-12 Thread Olivier Sessink
On 09/12/2012 12:21 PM, Rudra Banerjee wrote:
[..]
> 
>   strAuth = gtk_entry_get_text(GTK_ENTRY(e->entryAuth));
> strEditor = gtk_entry_get_text(GTK_ENTRY(e->entryEditor));
> 
> 
> Is it possible to add these strAuth, strEditor in those treeview's 1st
> and 2nd column?

just acquire an iterator at the right position, and set the columns, for
example

gtk_tree_model_get_iter_first(GTK_TREE_MODEL(treestore), &iter);
gtk_tree_store_set(treestore, &iter,
  COL_FIRST_NAME, strAuth,
  COL_LAST_NAME, strEditor,
  -1);

regards,
Olivier

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


Re: Howto make a Gtk.Buttonbox look like the path bar in Gtk.FileChooserDoalog?

2012-09-03 Thread Olivier Sessink
On 09/03/2012 11:57 AM, Moritz Renftle wrote:
> Hi,
> 
> I recently noticed the nice appearance of the path bar widget in the
> GtkFileChooserDialog:
> http://imagepaste.nullnetwork.net/viewimage.php?id=4889
> This look is also used for the top bar in the new GNOME system-settings.
> 
> I was wondering whether there is an easy way to turn a GtkButtonBox into
> something with this look.

have you looked into the GtkFileChooserDialog source, such as
http://git.gnome.org/browse/gtk+/tree/gtk/gtkfilechooserwidget.c ?

Olivier


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


Re: compile multiple source file

2012-08-31 Thread Olivier Sessink
On 08/31/2012 04:48 PM, Rudra Banerjee wrote:
> If they are in separate file, then,
> $ gcc `pkg-config --cflags --libs gtk+-3.0` hello.c main.c -c
> main.c: In function ‘main’:
> main.c:13:5: error: ‘hello’ undeclared (first use in this function)
> main.c:13:5: note: each undeclared identifier is reported only once for
> each function it appears in
> 
> But obviously, putting both of them together in a single file works.
> How to compile while keeping them seperate

first remove the 'static' keyword before function hello(), static
functions are only called from the file itself, they are not to be
called from other files.

now create a header file hello.h that contains:

void hello( GtkWidget *widget, gpointer   data );

and include that in main.c like #include "hello.h"

now you can compile each .c file, and then link the resulting .o files
to a binary.

Olivier


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

Re: button background color in gtk3

2012-08-29 Thread Olivier Sessink
On 08/29/2012 05:17 PM, Carlos Pereira wrote:
> Quite often widget colors are just a question of style but sometimes
> this is not the case. I can think of medical applications, for example,
> where colors can be critical.
> 
> In my case, I have a chemical periodic table made with GTK buttons, each
> one representing a chemical element, with its default color. Users can
> change these chemical element default colors directly from the interface
> or from XML config files:
> 
> http://www.gamgi.org/screenshots/screenshot13_5.html
> 
> Rewritting an entire CSS file and downloading it everytime users change
> the default color of a chemical element looks really depressing... I am
> sure button colors can be changed directly from the code in GTK 3??

you can modify bits of the CSS from your code like this (taken from
Bluefish code bftextview.c):

GString *str = g_string_new("");
GtkStyleContext *stc;
GtkCssProvider *cssp = gtk_css_provider_new();
str = g_string_append_printf(str, "GtkTextView.view {background-color:
%s;}", colors);
gtk_css_provider_load_from_data(cssp, str->str, -1, NULL);
stc = gtk_widget_get_style_context(GTK_WIDGET(mywidget));
gtk_style_context_add_provider(stc, GTK_STYLE_PROVIDER(cssp),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);


regards,
Olivier

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


Re: Trouble maximizing windows on MS Windows

2012-08-28 Thread Olivier Sessink
On 08/27/2012 06:27 AM, Jared Henley wrote:
> I have a Gtk application that needs windows to be maximised at their
> creation.  This is specifically because i) there's a lot of information
> in tables that needs maximisation in order to deal with sensibly, and
> ii) quite a lot of these windows are being opened (and closed) during
> normal use.  (It's a forms-based database app).  I'm using Gtk3 via Python.
> 
> So I use the Gtk.Window.maximize() method to maximise a window, and it
> works very well on native X11.  But if I run an X server on a Windows
> machine (XP and 7 tested), the window is not maximised.

possible (not tested) the window has to exist before you can maximize it.

so register an idle callback function with g_idle_add() and maximize the
window in that idle callback and return FALSE.

that way gtk first paints the window on screen, and when done your idle
callback will be called and it will be maximized.

Olivier


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


Re: Why doesn't my label show up in the window

2012-08-27 Thread Olivier Sessink
On 08/27/2012 09:30 AM, Frank Cox wrote:

> My mailserver is small and I need to pace the email that I send to it to avoid
> DOS-ing it.  Therefore, I inject a pause of a fixed number of seconds between
> sending each outbound email.
> 
> If I'm not allowed to pause the program, then how shall I create the delay
> between sending each message?
> 
> Perhaps if I can get past this issue then everything else will fall into 
> place.

many function calls in an event driven programs don't do anything
immediately. Which can be very confusing the first time you work with them.

--> gtk_widget_show() will not show the widget <--

so what does it do? it registers work-to-be-done in the event loop, so
once the event loop has finished working on higher priority things, it
will show the widget.

so that is the way you have to work with this: you register your
email-to-be-sent in the main event loop, and the event loop will call
the functions when it is time.

Lucky for you the event loop has more options than just a priority, you
can also register your function to be called after some time has passed.

So create a list or queue in your program, and create a function that
pops an item from the list and sends an email. register the function
with a timeout with g_timeout_add_full() keep returning TRUE (= call me
again) until there is no email to pop from the list.

Olivier



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


Re: Why doesn't my label show up in the window

2012-08-26 Thread Olivier Sessink
On 08/26/2012 07:13 PM, Frank Cox wrote:

> I have posted a complete copy of the program as it exists right now here so
> you can see what I'm trying to do:
> 
> http://www.melvilletheatre.com/listwrangler.c.bz2

your function test_email_button() shows a message 'sending', then starts
the sending, and then you want to show a message that the email is sent,
right?

the simple solution:

1) show the dialog (like you do now

2) at the end of that function, register a idle callback with
g_idle_add_full() with a low priority

3) in the callback, send the email, and show the second dialog, return
FALSE (otherwise glib will keep calling the idle function

this is how you work with an event loop. you basically you ask glib:
once you are ready with everything that is slightly higher priority
(like drawing the dialog), run my function.

Olivier



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


Re: auto refresh file in textview

2012-08-24 Thread Olivier Sessink
On 08/23/2012 02:45 PM, Rudra Banerjee wrote:
> 
> Dear friends,
> I am openning an existing file in textview from command line as:
> 
> textview = gtk_text_view_new();
> gtk_container_add(GTK_CONTAINER(scrolledwindow), textview);
> textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
> if (argc > 1 && argv[1] != NULL) {
> char *flnm = argv[1];
> read_view(flnm);
> }
> 
> 
> where the read_view is defined as:
> 
> static void read_view(char *inpfn) {
> char *buffer;
> stat(inpfn, &filestat);
> textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
> buffer = (char *) malloc(filestat.st_size * sizeof (char));
> efile = fopen(inpfn, "r");
> fread(buffer, filestat.st_size, 1, efile);
> gtk_text_buffer_set_text(textbuffer, buffer, filestat.st_size);
> free(buffer);
> }
> 
> 
> I am writing in the file that is opened as:
> 
>FILE *fop = fopen(filename, "a" );
> g_fprintf( fop, "@%s{%s,\n", strcombo, strkey );
> 
> where the fileopen is difined globally.
> 
> whenever I am writing, it is saved, but to see the change, I have to
> reopen the file(obviously).

instead of appending text to the file, you better append the text to the
GtkTextBuffer, and then save the GtkTextBuffer to a file once in a while.

if you need to append to the file (and not write the complete file once
in a while) I would try to append both to the file and to the
textbuffer, so you don't need to reload the entire file for every append.

Olivier


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


Re: GTK 2.24.10 memory leak on win32?

2012-07-02 Thread Olivier Sessink
On 07/02/2012 04:44 PM, Gabriele Greco wrote:
> We have found a regression that block us to migrate our existing apps from
> GTK 2.16.x to GTK 2.24.10 (20120208), it seems there is a memory leak in
> g_idle_add() use or something related to queue_draw(), anyway the following
> code (that I think is correct) do not leak in linux (ubuntu 12.04, gtk
> 2.24.10) nor on win32 (GTK 2.16) while it leaks about 12kbyte/sec with GTK
> 2.24.10 on win32.

have you tried running the code in valgrind on Linux to test this for
sure? try:

G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck
--num-callers=32 src/your-binary

I don't see any obvious problemin your code, but I have no experience
with the code you posted.

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


Re: Accelmap value

2012-06-20 Thread Olivier Sessink
after a bit of testing, it seems to me that the altgr key advertises
itself just as  to gtk...

Olivier

2012/6/19 drkmkzs :
> Hi,
>
> I'm using a gtk application with an accelmap file. All shortcuts with
> Control, Shift, or Alt are currently available.
>
> But if I want to add some shortcuts with AltGr key (key on the right
> of the spacebar) it doesn't work (I think i'm not using the good
> syntax in the accelmap because in the application menu, the modifier
> is skipped)
>
> For control, it's p
> For alt, it's p
>
> So I try p, but it doesn't work.
>
> Somebody could tell me which keyword I have to use in my Accelmap for
> a shortcut using AltGr key ?
>
> Thanks a lot,
> Jean
> ___
> 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: multiple GTKentry inside a GTKnotebook

2012-06-20 Thread Olivier Sessink
can you post a larger bit of the code? it is difficult to see what's going on.

b.t.w. gtk_combo_box_new_text() is deprecated, use gtk_combo_box_text_new()

Olivier

2012/6/20 Rudra Banerjee :
> Thanks for your reply jjacky. This is a mistake; but does not changeing
> the result.
> On Tue, 2012-06-19 at 22:13 +0200, jjacky wrote:
>> On 06/19/12 21:43, Rudra Banerjee wrote:
>> > Yeti, Thanks for your help. That is working now.
>
>> it should probably be GTK_COMBO_BOX(combo), not GTK_COMBO_BOX(widget)
>
>> ___
>> 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
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Setting the size of tabs in a Notebook?

2012-05-15 Thread Olivier Sessink
I haven't found a good way, but I'm looking to make them smaller. You
can use a different font in the labels, but with some themes (most
notably the gtk3 default) the tabs are still very large.

I have the feeling there was more possible with gtk 2
gtk_notebook_set_tab_border(), but I must admit that I haven't played
with the tab-curvature and tab-overlap style properties yet.

Olivier

2012/5/15 Olivier Sessink :
> I haven't found a good way, but I'm looking to make them smaller. You
> can use a different font in the labels, but with some themes (most
> notably the gtk3 default) the tabs are still very large.
>
> I have the feeling there was more possible with gtk 2
> gtk_notebook_set_tab_border(), but I must admit that I haven't played
> with the tab-curvature and tab-overlap style properties yet.
>
> Olivier
>
> 2012/5/15 Marc Balmer :
>> Hi
>>
>> is there a way to set the width and height of the tabs in a GtkNotebook
>> widget?  Or can I do it only indirectly by using enough text?
>>
>> Thanks,
>> mb
>> ___
>> 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: GTK program (a Gimp plugin) crashes only on Windows

2012-05-08 Thread Olivier Sessink
On 04/25/2012 06:58 PM, Alessandro Francesconi wrote:
> Hello everyone, I'm facing a problem with the development of a plug-in
> for The Gimp program.
> I'm writing here because it uses GTK libs and, actually, the problem
> regards a crash of a GTK widget.

my experience is that the memory allocator on windows works differently,
and thus memory errors in your program are less visible on Linux.

Use valgrind to find the errors on Linux:

G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck
--num-callers=32 ./myapp

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


Re: GtkTextView Sizing Issues

2012-05-08 Thread Olivier Sessink
On 04/26/2012 09:04 AM, Paul wrote:
> Hi there,
> 
> Sorry for the bump, but there's also another issue that's frustrating
> me. If I compile the test application with the gtk_widget_set_hexpand
> line uncommented I see more unexpected behaviour resizing the window
> horizontally.

which gtk version are you working on? 3.0 has serious problem with
resizing, many issues have been fixed in 3.2.

Olivier

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


Re: GtkButton bg color

2012-05-08 Thread Olivier Sessink
On 04/30/2012 11:36 PM, Steve wrote:
> 
>> If this doesn't work, you must be using a GTK theme that is overriding
>> the coloring of widgets.
> 
> Just confirmed that it is in fact the them preventing me from changing
> the bg color of the button.
> 
> I vaguely recall that when i read the GtkRcStyle and wrote it back
> (without changing anything) The theme was no longer applied to the
> button, but once again i could not find anything in the documentation
> that could explain it.
> 
> So, what options do i have to color a button when a theme is preventing
> such an action?  Changing themes is NOT an option.

on gtk3 you can load a specific stylesheet that has 'application
priority'. that will overrule the theme.

something like this (copied from bluefish sourcecode):

GtkCssProvider *cssp = gtk_css_provider_new();
gtk_css_provider_load_from_data(cssp, my_css_string, -1, NULL);
stc = gtk_widget_get_style_context(GTK_WIDGET(btv));
gtk_style_context_add_provider(stc, GTK_STYLE_PROVIDER(cssp),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

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


Re: Table not visible

2012-05-08 Thread Olivier Sessink
On 05/09/2012 07:10 AM, Rudra Banerjee wrote:
> Dear friends,
> I am a newbie in GTK and also in C itself. I am trying to develop a
> table (thanks to awesome tutorials available). I am currently facing a
> problem. 
> In the given code, its working fine. Posted is a minimal example I
> managed to generate. The problem is in line 88 and 89, either of table
> or menu is working. If I comment one line, other one is working. Where I
> went wrong? Please show.

the window can only hold 1 widget.

so add a vbox to the window,

add the menubar to the vbox
add the table also to the vbox

Olivier


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


Re: memory lead while using Glib regexp

2012-03-05 Thread Olivier Sessink

On 03/05/2012 04:56 PM, Bernhard Schuster wrote:

No it does, not I already cross-read it and it looks fine, did you
give it a shot with valgrind?


no I did not, the comment was based just on your code. What does 
valgrind report on your code?


Olivier


Regards

Bernhard Schuster

Am 5. März 2012 15:43 schrieb Olivier Sessink:

On 03/02/2012 04:00 AM, Xi Yang wrote:


Hi, everyone!


I use Glib's regular expression in a cycle, and find a rapid memory
consumption increase. Did I forget to release anything?



since nobody replied I'll give it a shot (without any C++ knowledge):

does seq.header.c_str() return a newly allocated string?


Olivier





Thanks a lot!


= code below ==


GRegex* regex_illumina = g_regex_new(
 "@(.+):(\\d+):(\\d+):(\\d+):(\\d+)#(\\d+)/([12])",
 G_REGEX_OPTIMIZE,
 GRegexMatchFlags(0),
 NULL
);


GRegex* regex_casava_1p8 = g_regex_new(
 "@(.+):(.+):(.+):(\\d+):(\\d+):(\\d+):(\\d+)
([12]):([YN]):\\d+:(\\w*)",
 G_REGEX_OPTIMIZE,
 GRegexMatchFlags(0),
 NULL
);


// inside cycle body
 gchar* tile_str;
 int tile;
 GMatchInfo* what;

 // match and fetch something
 if ( g_regex_match(regex_illumina, seq.header.c_str(),
GRegexMatchFlags(0),&what) ) {
 tile_str = g_match_info_fetch(what,3);
 }
 else if ( g_regex_match(regex_casava_1p8, seq.header.c_str(),
GRegexMatchFlags(0),&what) ) {

 tile_str = g_match_info_fetch(what,5);
 }
 else {
 throw runtime_error("failed to parse header
line:\n"+seq.header);
 }


 // parse a number
 if (sscanf(tile_str,"%d",&tile)!=1)
 throw runtime_error("failed to fetch tile from "+seq.header);


 // release match info and fetched string
 g_match_info_free(what);
 g_free(tile_str);
// end of cycle body
___
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: memory lead while using Glib regexp

2012-03-05 Thread Olivier Sessink

On 03/02/2012 04:00 AM, Xi Yang wrote:

Hi, everyone!


I use Glib's regular expression in a cycle, and find a rapid memory consumption 
increase. Did I forget to release anything?


since nobody replied I'll give it a shot (without any C++ knowledge):

does seq.header.c_str() return a newly allocated string?


Olivier





Thanks a lot!


= code below ==


GRegex* regex_illumina = g_regex_new(
 "@(.+):(\\d+):(\\d+):(\\d+):(\\d+)#(\\d+)/([12])",
 G_REGEX_OPTIMIZE,
 GRegexMatchFlags(0),
 NULL
);


GRegex* regex_casava_1p8 = g_regex_new(
 "@(.+):(.+):(.+):(\\d+):(\\d+):(\\d+):(\\d+) ([12]):([YN]):\\d+:(\\w*)",
 G_REGEX_OPTIMIZE,
 GRegexMatchFlags(0),
 NULL
);


// inside cycle body
 gchar* tile_str;
 int tile;
 GMatchInfo* what;

 // match and fetch something
 if ( g_regex_match(regex_illumina, seq.header.c_str(), 
GRegexMatchFlags(0),&what) ) {
 tile_str = g_match_info_fetch(what,3);
 }
 else if ( g_regex_match(regex_casava_1p8, seq.header.c_str(), 
GRegexMatchFlags(0),&what) ) {
 tile_str = g_match_info_fetch(what,5);
 }
 else {
 throw runtime_error("failed to parse header line:\n"+seq.header);
 }


 // parse a number
 if (sscanf(tile_str,"%d",&tile)!=1)
 throw runtime_error("failed to fetch tile from "+seq.header);


 // release match info and fetched string
 g_match_info_free(what);
 g_free(tile_str);
// end of cycle body
___
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: Push button with enter

2012-02-22 Thread Olivier Sessink

On 02/21/2012 10:14 AM, Stefan Sauer wrote:

On 02/13/2012 03:18 PM, Manuel Ferrero wrote:

I'd like to have a button pushed every time I press the Enter key,
even if that button is not selected.
Let say I click on a text box, I write some text and then when I press
Enter the button is pressed.
Is it possible?
Right now the button is pressed only if it's selected, but the
GtkButton pressed signal is not triggered.

gtk_window_set_default()


or use the 'activate' signal on the entry

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


Re: GtkTree and GtkThread: update and refresh

2011-09-23 Thread Olivier Sessink

On 09/21/2011 10:53 PM, Paolo wrote:

Hi! I have a problem about the update and refresh of a tree. This is the
situation: I have a populated tree and a button that update the tree. The
button's event calls a function that permorfs the following things:
1) Reset the treemodel appending a single text row "Loading"
2) Execute a db query
3) Reset the treemodel appending the results of the query
No errors, but a refresh problem. I can't see the text row "Loading" (1st
step); I can just see the new populated tree (3th step).

I could put the following code between the step 1 and 2:

   while(gtk_events_pending())
   gtk_main_iteration();


or start step 2 from an idle callback, use g_idle_add_full() to register 
a function that will call step 2.



This solution works but it blocks the whole GUI.
A thread can help me for the GUI block and the pending events, but I have
another problem: after several clicks of the button the program blocks. I
don't know what happen: no errors, no segmentation fault.

Is it correct create a thread for each event of the button in that way?

 g_thread_create((GThreadFunc) loading_tree_and_the_fill_tree,
NULL, FALSE,&err)


as suggested elsewhere read about gtk and threads. GTK calls should be 
made from the main thread, so do your db query in a thread, load the 
results in a datastructure, use g_idle_add() again to register a 
function that will be called from the mean thread and in *that* function 
load the data in the treemodel.


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


Re: GList empty after iteration?

2011-09-21 Thread Olivier Sessink
On 09/12/2011 11:33 PM, Craig wrote:
> On Mon, 2011-09-12 at 22:20 +0200, Florian Müllner wrote:
>> You are modifying the list in the loop until g_list_next() returns
>> NULL ... 
> 
> Right.  I understand this now.  However, I thought using g_list_first()
> would set GList *events back to the first object.  But, as you state,
> the darn thing is pointing to NULL, so getting the first object of NULL
> is problematic.
> 
> Thanks for helping me hack through this.  I have created a solution.
> 
> 

if you want such a data structure use a GQueue. The data inside the
GQueue is still a list, but the GQueue manages the pointers to the tail
and the head for you (so append() and prepend() have equal speed as well).

Olivier

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

Re: memory leak in PangoLayout?

2011-05-11 Thread Olivier Sessink

On 05/06/2011 09:28 AM, Olivier Sessink wrote:

Hi all,

valgrind reports a memory leak in the following code:

gint
widget_get_string_size(GtkWidget * widget, gchar * string)
{
PangoLayout *layout;
gint retval = -1;
layout = gtk_widget_create_pango_layout(widget, string);
if (layout != NULL) {
pango_layout_get_pixel_size(layout, &retval, NULL);
g_object_unref(G_OBJECT(layout));
}
return retval;
}


in a testcase with only this bit of code running in a loop it doesn't 
seem to leak memory, so that was a false positive from valgrind.


Olivier

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


Re: g_idle_add source & memory leaks

2011-05-10 Thread Olivier Sessink

On 05/09/2011 01:36 PM, Gabriele Greco wrote:

just a note on your example code: use the GPOINTER_TO_INT and 
GINT_TO_POINTER macro's to avoid 64bit portability problems:


gboolean mycbk(gpointer data)
{
  gint val = GPOINTER_TO_INT(data);
  char buffer[16];
  sprintf(buffer, "%09d", val);
  gtk_label_set_text(l, buffer);
  return FALSE;
}


void threadfunc(void *unused) {
  gint msec = 0;
  while (1) {
  msec++;
  g_usleep(1000);
  g_idle_add((GSourceFunc)mycbk, GINT_TO_POINTER(msec));
  }
}


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


Re: destroying an unparented widget

2011-05-07 Thread Olivier Sessink

On 05/05/2011 09:37 PM, Allin Cottrell wrote:

There's one thing I've never quite understood: the correct
mechanism for destroying a gtk widget that is never parented or
shown.

The context is that I'm creating a temporary widget with
gtk_label_new(), just for the purpose of getting hold of its
PangoContext so I can figure something out about the font in use
(whether it supports the UTF-8 minus sign, 0x2212). Once I've got
that info I'm using gtk_widget_destroy on the label. And valgrind
is showing me a leak, which I take to mean that I haven't managed
to destroy the widget. If I try using g_object_unref() instead I
get an error message from GTK saying I can't do that on an object
which has only a floating reference.

Would the correct sequence be

label = gtk_label_new("");
g_object_ref_sink(G_OBJECT(label));
/* do pango stuff */
g_object_unref(G_OBJECT(label));

? And if so, is there an equivalent in GLib<  2.10? Thanks.



I think this is the correct way yes. a widget is created with a floating 
reference. With ref_sink() you now own the reference, and after the 
unref the reference count should be 0.


you can debug this with the LD_PRELOAD GObject lifetime debugging tool, 
see 
http://blogs.gnome.org/danni/2011/02/17/ld_preload-gobject-lifetime-debugging-tool/


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


Re: memory leak in PangoLayout?

2011-05-07 Thread Olivier Sessink

On 05/07/2011 12:00 AM, Bill C wrote:

On 06/05/11 17:28, Olivier Sessink wrote:

Hi all,

valgrind reports a memory leak in the following code:

gint
widget_get_string_size(GtkWidget * widget, gchar * string)
{
PangoLayout *layout;
gint retval = -1;
layout = gtk_widget_create_pango_layout(widget, string);
if (layout != NULL) {
pango_layout_get_pixel_size(layout, &retval, NULL);
g_object_unref(G_OBJECT(layout));
}
return retval;
}

but it seems 100% perfect to me. Why would this leak memory??

anybody a clue?



Just a thought, GTK could be using slab memory allocation, so the memory
is still allocate to GTK, but can be used later by gtk as required,
without inefficiencies caused by memory fragmentation.


I'm running valgrind with G_SLICE=always-malloc to avoid this false 
positive.



I have not seriously programmed with GTK for about a year and am not
saying that GTK has no leaks, but IMHO, nearly all the complaints about
GTK leaking memory are due to the inexperience of the posters, rather
than GTK itself.


that's why I posted the code


However if there is a valid fault, then the track record states it will
be fixed fast.

Also are you using GTK2+ or GTK3 and what version.


this is on both GTK 2.20.1 (Ubuntu 10.04) and GTK 2.24.2 (Fedora 14).

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


memory leak in PangoLayout?

2011-05-06 Thread Olivier Sessink

Hi all,

valgrind reports a memory leak in the following code:

gint
widget_get_string_size(GtkWidget * widget, gchar * string)
{
PangoLayout *layout;
gint retval = -1;
layout = gtk_widget_create_pango_layout(widget, string);
if (layout != NULL) {
pango_layout_get_pixel_size(layout, &retval, NULL);
g_object_unref(G_OBJECT(layout));
}
return retval;
}

but it seems 100% perfect to me. Why would this leak memory??

anybody a clue?

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


Re: large performance difference between gtktextview and gtksourceview

2010-11-05 Thread Olivier Sessink

On 11/05/2010 11:47 AM, Paolo Borelli wrote:

Actually, gtksourceview is a subclass of gtktextview so it supports BiDi
and i18n as good as gtktextview does. If it doesn't it is a bug.

With regard to the performance differences, it seems very strange that
you see a difference, especially one where gtksourceview is faster.

Are you sure you are comparing apples to apples? (E.g is the program is
exactly the same except for using sourceview/buffer? Or do thay load the
content differently and one feeds it in chunks to the buffer while the
other doesn't or other things).

[..]

no I'm not, so after reading this I'll write a testcase so I can be sure 
what's going on. Perhaps the difference was coming from another part of 
the application.


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


large performance difference between gtktextview and gtksourceview

2010-11-04 Thread Olivier Sessink
Hi all,

loading 1Mb of UTF-8 encoded text into a gtk text view seems to take
much more time than loading the same buffer into gtksourceview. Since
gtksourceview has all of the functionality of gtktextview and more,
where is this difference coming from? And does this mean that we can
improve the performance of gtktextview?

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


Re: DGSEAL_ENABLE: replace direct addressing in statusbar

2010-09-16 Thread Olivier Sessink
On 07/04/2010 07:57 AM, Carlos Pereira wrote:
> On 07/04/10 06:17, Nader Morshed wrote:
>> statusbar = gtk_statusbar_new ();
>> label = gtk_statusbar_get_message_area (GTK_STATUSBAR (statusbar));
>> gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
>>
> Thanks Nader, I believe you are in the right path (although the
> documentation actually says this returns a box, not a label):
> 
> http://library.gnome.org/devel/gtk/stable/GtkStatusbar.html#gtk-statusbar-get-message-area
> 
> 
> Anyway this has been added in Gtk 2.20, I am still running 2.18.3, lots
> of users also, it might be better to wait...

I use these in bluefish.h for backwards compatibility.

regards,
Olivier

#if !GTK_CHECK_VERSION(2,18,0)
#define gtk_widget_set_can_focus(arg, arg2) do {if (arg2)
GTK_WIDGET_SET_FLAGS(arg, GTK_CAN_FOCUS); else
GTK_WIDGET_UNSET_FLAGS(arg, GTK_CAN_FOCUS);} while(0)
#define gtk_widget_get_allocation(arg1, arg2) (*(arg2) = arg1->allocation)
#define gtk_dialog_get_content_area(arg) (GTK_DIALOG(arg)->vbox)
#define gtk_widget_get_window(arg) (GTK_WIDGET(arg)->window)
#define gtk_widget_get_visible(arg) (GTK_WIDGET_VISIBLE(arg))
#define gtk_widget_set_can_default(arg, arg2) do {if (arg2)
GTK_WIDGET_SET_FLAGS(arg, GTK_CAN_DEFAULT); else
GTK_WIDGET_UNSET_FLAGS(arg, GTK_CAN_DEFAULT);} while(0)
#define gtk_dialog_get_action_area(arg) (GTK_DIALOG(arg)->action_area)
#define gtk_selection_data_get_data(arg) (arg->data)
#define gtk_selection_data_get_length(arg) (arg->length)
#define gtk_selection_data_get_format(arg) (arg->format)
#define gtk_selection_data_get_target(arg) (arg->target)
#define gtk_widget_get_state(arg) GTK_WIDGET_STATE(arg)
#define gtk_widget_is_sensitive(arg) GTK_WIDGET_IS_SENSITIVE(arg)
#define gtk_adjustment_get_upper(arg) (GTK_ADJUSTMENT(arg)->upper)
#endif /* GTK_CHECK_VERSION(2,18,0) */
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Plot an XML file into a tree with GTK+

2010-08-04 Thread Olivier Sessink

On 08/04/2010 07:11 PM, Monchai Lertsutthiwong wrote:




Hi,

I am quite new for GTK+. What I try to do now is to plot all details
in an XML file into a tree-structured view.  For a big tree, there
may be a "+" button to expand the tree. Is there any good example
code for it?


not 100% relevant (it plots only certain attributes of the XML into the 
tree) but 
http://bluefish.svn.sourceforge.net/viewvc/bluefish/trunk/bluefish/src/plugin_snippets/snippets_load.c?revision=5862&view=markup 
loads XML data into a tree


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


Re: How can I read contents from applications' buffer by programming ?

2010-08-03 Thread Olivier Sessink

On 08/03/2010 03:55 AM, a qi wrote:

HI,ALL


for example:

I use firefox to open a webpage,  how can I  read contents of that
page ?  so that I can filter out unwanted information  by programming


you probably want to ask this on a Firefox development mailinglist. 
Firefox has it's own libraries and API's to do these kind of things.


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


Re: Hardware accelerated 2D graphics (with gtk-osx)

2010-08-01 Thread Olivier Sessink

On 07/28/2010 09:15 AM, John Emmas wrote:

This morning I've come across this mailing list which has got me
confused:-

http://sourceforge.net/mailarchive/forum.php?forum_name=gtk-osx-users

 Up until now I'd assumed that gtk-osx was produced / administered by
gnome.org but the above mailing list makes it look like it's possibly
an independent project.  Should I have posted my question there
instead of here?  Or are there two different gtk-osx projects?


That list focuses on more tight integration on the Mac OSX desktop. For 
example having the menu on top of the screen and not in your 
application, opening your app from the finder, etc. There's also quite 
some OSX and GTK knowledge there, so it's a good list to join if you're 
going to do some GTK app programming on a mac.


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


Re: central 'library' of self-contained real world examples of code for gtkwidgets

2010-06-30 Thread Olivier Sessink
2010/6/27 Mick :
> In veiw of the nightmare I've had finding non-trivial example code for
> assembling/implimenting gtk widgets recently I have decided to attempt
> to assemble a library of functions that impliment a task at a more
> advanced level than your typical 'Hello world' that abound.
>
> Some examples would be:
> A menubar that uses each type of GtkMenuItem - simple text, stock item,
>        label & icon, check box, radio buttons, a button that calls a
>        dialog, ...
>
> A 'command help' dialog, with dismiss button that uses a liststore to
>        show command short form, long form and description.
>
> Anyone who follows this list will have seen many of these are beyond my
> current capabilities so I'm calling on the list to offer up some of
> their own little gems to make this a worthwhile resource.

php.net has 'user annotations' in its on-line manual. this contains a
lot of good examples. it would be cool if library.gnome.org could have
such a feature.

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

Re: multithreading gtk app

2010-06-30 Thread Olivier Sessink
it would be good if the gtk tutorial would spent some pages on
threads. In these days where multicore cpu's are becoming the standard
a lot of programs can benefit from threads.

I'm willing to help with that, I contacted the webmasters from gtk.org
about it some time ago but I never received a reply.

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


gtk_action_block_activate fails to block ?!?

2010-06-29 Thread Olivier Sessink
Hi all,

I have a GtkToggleAction in a menu that I need to synchronize with the
state in the application. I don't want the callback called when I
update the state from within the application. According to the
documentation this is what gtk_action_block_activate should do, but
the callback is still called !?

GtkAction *action = gtk_action_group_get_action(actiongroup, 
actionname);
if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))!=value) {
gtk_action_block_activate(action);
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), value);
gtk_action_unblock_activate(action);
}

is this a bug or do I misunderstand something?

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


gtk_ui_manager_add_ui_from_string on inline string vs. _from_file

2010-06-25 Thread Olivier Sessink
Hi all,

what are the advantages of using gtk_ui_manager_add_ui_from_string()
using a inline compiled string vs. gtk_ui_manager_add_ui_from_file() ?

from_string() enlarges the executable, but the executable is one file
that is read from disk as a contiguous block,  from_file() makes the
executable smaller, but involves runtime an extra file seek / open /
read / close.

Any opinions?

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


Re: using GdkPixbuf icons in GtkUIManager ?

2010-06-24 Thread Olivier Sessink
2010/6/24 Tadej Borovšak :
> I think the simplest thing to do here would be to add your images to
> icon theme (you can use inlined images, but it would probably be
> better to shell them out now that you're updating application).

why is it better not to use inline images? file based images will take
much more I/O (much more filesystem seeks) compared to inline compiled
images. What is the drawback of inline images?

adding the image to an icon theme also involves an extra lookup,
instead of using a direct pointer to the right image, you need to
lookup something by a name, hopefully a hashtable, to get the right
pointer to the image. But if there is no way to use the pixbufs
directly it's probably the best way.

> BTW, can you provide a link to one of the outdated files?

http://bluefish.svn.sourceforge.net/viewvc/bluefish/trunk/bluefish/src/plugin_htmlbar/htmlbar_gui.c?revision=5871&view=markup

thanks,

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

using GdkPixbuf icons in GtkUIManager ?

2010-06-24 Thread Olivier Sessink
Hi all,

I have a large set of menu items and toolbar items (multiple toolbars
in tabs) that have a custom icon. The icons are currently compiled
into the application. I currently still use GtkItemFactory for the
menu, which works fine with GdkPixbuf icons. I'm working towards gtk 3
and thus I have to drop GtkItemFactory. How can I use the same icons
in GtkUiManager?

(FYI: the app is Bluefish, and it has several tabs with HTML toolbars
that focus on different areas of HTML)

thanks,

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


Re: gthreads and file operations

2010-04-13 Thread Olivier Sessink
Nischal Rao wrote:
> is there any way to listen to signals without calling gtk_main() (which
> never returns) ? If so, then i ll be able to get rid of
> threads(happily!!) I am new to glib threads and gnome signals.. i
> have just been following examples that i found on the net.

What kind of signals?
If they are file/socket events, use g_io_add_watch() to do so:
http://library.gnome.org/devel/glib/stable/glib-IO-Channels.html

the gtk mainloop will then call your callback whenever data is available.

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


Re: gthreads and file operations

2010-04-13 Thread Olivier Sessink
Nischal Rao wrote:
> the sample code is:
[..]

your use of threading doesn't make sense. All your threads are within a
lock, so you have three threads (main + two threads) but they can never
execute any instructions in parallel, because they all wait for the
global gdk lock.

Everything you want to do in this code should be done without threads,
it will have more performance and less complexity.

Olivier


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


Re: gthreads and file operations

2010-04-12 Thread Olivier Sessink
2010/4/12 Nischal Rao :
> Hi,
>
> Within a gnome thread i need to read as well as write to a file. I tried
> using the regular fprintf() etc but they don't seem to work.
> Can somebody please help me out since I am new to gnome threads.

see if you can use the GIO _async() calls, they use threads in the
background while keeping the diffucult things away for you.

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


script to convert gtkitemfactory translations to gtkuimanager translations?

2010-04-06 Thread Olivier Sessink
Hi all,

we still use gtkitemfactory code, and one of the main reasons not to
switch to gtkuimanager is the translation strings that all will
change. Now I wonder if it is possible to automatically convert the
translations? Did anyone ever try that?

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


make GtkTextView use CRLF

2010-04-02 Thread Olivier Sessink
Hi all,

GtkTextView defaults to linefeeds as newlines, which is good for Unix
users, but not the default on DOS/Windows. In a document that has CRLF,
gtktextview handles this very good. But an empty document always uses
LF, also on windows. Is there a way to set this to CRLF ?

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


Re: Searching a GtkTreeView

2010-03-20 Thread Olivier Sessink
Micheal Smith wrote:

> That could work.  I've thought of similar tricks already myself.  I just
> figured that had to be the wrong way to go about it.  Is there nothing
> supplied by the API to support something like this?

you can use a filter, and make the treeview refilter for every key press
in the search box?

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


Re: gtk window accelerator process problem.

2010-03-16 Thread Olivier Sessink
what works and what does not? if your focus is in the text widget I
guess you get the 'textview copy' action, and if your focus is
elsewhere you get the menu callback ? Or is it different?

b.t.w.: do your users expect that  works differently in a
different context?

Olivier

2010/3/1 Xiaoyu Du :
> I have a problem about gtk keybindings.
> I have a menu in main window , and add CTRL+C accelerator,
> but in the same window, I have a text view use ctrl+c too
> I want user text view built-in CTRL+C to process my key press
> event, but for others widgets in main window, I want use the
> menu ctrl+c singal. Can anyone help me to solve this?
>
>
>
> ___
> 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


threading choices

2010-03-02 Thread Olivier Sessink
Hi all,

it seems that are two (or more) choices how to work with threads in
gtk. You can #1 use a global lock and call gtk from any thread, or you
can #2 limit your gtk calls to the main loop and not use the global
lock. As far as I understood, method #2 is portable to win32, and
method #1 is not? Is that correct? What are other reasons to choose
for one of these approaches? Are there any other important approaches
that need attention?

regards,
   Olivier
--method #1 -
#include 
#include 
#include 

/* this example can call gtk functions from different threads and uses
the global lock.
 * this is *not* portable to win32 !!
 */

static gboolean thread_finished(gpointer data) {
GtkWidget *w=data;

/* because this is called by gdk_threads_idle_add_full the code
 * in this function is executed within the global lock. Call gtk
 * whenever you want, no need to call gdk_threads_enter() / 
gdk_threads_leave()
 */


return FALSE; /* we're done, return FALSE */
}


static gpointer handle_thread(gpointer data) {

/* do things that take a lot of time
you can do anything GTK here provided that you
get the global lock first */

gdk_threads_enter();
/* do anything gtk here */
gdk_threads_leave();

/* an example to call an idle function that will automatically get
the global lock for you */
gdk_threads_idle_add_full(G_PRIORITY_LOW,thread_finished_lcb, 
data,NULL);
}

int main(int argc, char **argv) {
GtkWidget *w
GError *gerror=NULL;
g_thread_init();
gdk_threads_init(); /* call gdk_threads_init() if you want to call
gtk from multiple threads */


g_thread_create_full(handle_thread,w,0,FALSE,FALSE,G_THREAD_PRIORITY_LOW,&gerror);

gdk_threads_enter(); /* do gtk things inside the gtk lock */
gtk_init(&argc, &argv);
w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show_all(w);
gtk_main();
gdk_threads_leave();
return 0;
}

--method #2 -
#include 
#include 
#include 

/* this example calls gtk functions only in the main loop, and
never calls gtk functions from a thread. */


static gboolean thread_finished(gpointer data) {
GtkWidget *w=data;

/* this is executed in the main loop, not in the thread */

return FALSE; /* we're done, return FALSE */
}


static gpointer handle_thread(gpointer data) {

/* do things that take a lot of time
but don't do anything GTK here */

g_idle_add_full(G_PRIORITY_LOW,thread_finished_lcb, data,NULL);
}

int main(int argc, char **argv) {
GtkWidget *w
GError *gerror=NULL;
g_thread_init();
gtk_init(&argc, &argv);
w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show_all(w);

g_thread_create_full(handle_thread,w,0,FALSE,FALSE,G_THREAD_PRIORITY_LOW,&gerror);
gtk_main();
return 0;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: g_spawn_async_with_pipes on windows

2010-02-11 Thread Olivier Sessink
2010/2/10 Tor Lillqvist :
>> g_spawn_async_with_pipes() to launch an other executable (firefox in this 
>> case).
>
> Do you expect to provide input to Firefox's stdin, or get output from
> its stdout, through the pipes then? (That would be a bit strange for a
> GUI app like a web browser, wouldn't it?)

true. firefox was just the most simple example that we tried to get
working. We integrate a lot more utilities, and those often need
pipes. We better get the simple one working first before we try
further.

> If not, instead of g_spawn_*,  just use one of the "normal" _spawn*()
> family of functions in the Microsoft C library (declared in
> ) with P_NOWAIT as the first parameter if you don't want to
> wait for it to finish. Much simpler, and less chance that some bug or
> misfeature in GLib is confusing you.

is there any reason to believe that the glib functions are not working
correctly?

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

g_spawn_async_with_pipes on windows

2010-02-10 Thread Olivier Sessink
Hi all,

we're porting a gtk application to windows, and we're using
g_spawn_async_with_pipes() to launch an other executable (firefox in
this case). For some reason it fails to execute the binary, locks the
gtk application, and nothing happens anymore. We've tested with a full
path to the executable and having the executable in the path.

Does anyone have a clue how this is supposed to work? The documentaion
has a lot of references to win32, so I guess this is supposed to work !?

Thanks,

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


Re: Multi-threaded "gtk_main()"s

2006-01-16 Thread Olivier Sessink
Nikolaj Kiær Thygesen wrote:
> Hey list,
> 
> I'm currently writing a multi threaded gtk-app, and knowing that
> calling gtk_main() simultaneously from different threads is a no-go,

it's more subtle: calling gtk functions simultaneous from different
threads is a no-go. gtk (and X) is not thread-safe. So as long as your
app does not call multiple gtk functions simultaneously it will work.

> I was quite surprised to find that the following fragment seemed to
> work when being accidentally called from a thread different from the
> one which originally called gtk_main()!! I have initialized the
> threading support properly before the initial call to gtk_main() in
> the main thread, so I guess gdk_threads_enter() momentarily exits the
> original gtk_main() - yes??? Is this really supposed to work, or did
> I just get lucky???
> 
> gdk_threads_enter();
> ...
> gtk_main();
> gdk_threads_leave();

if I understand things correctly, gdk_threads_enter(); just makes sure
there is no other thread at that moment doing something inside a
not-thread-safe-function, and executes your block if that condition is
OK. So you can do anything inside the
gdk_threads_enter();/gdk_threads_leave(); block, except another call to
gdk_threads_enter();

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


building modules/plugins (GModule) in a portable way

2005-12-29 Thread Olivier Sessink
Hi all,

we have excellent portable GModule functions for module loadingin glib,
but how do we compile them in a portable way? I thought libtool was the
solution, but I have little success there.

My plugin uses symbols that are exported by the application, and the
plugin exports a single symbol to the application.

I therefore, compile my application with

libtool -mode=compile $CC blabla compile flags

and then I link it with

libtool -mode=link $CC -export-dynamic blabla link flags

I compile the plugin with

libtool -mode=compile $CC blabla compile flags

and I link the plugin with

libtool -mode=link $CC -module -export-dynamic blabla link flags

but linking fails If I add '-shared' to this command, it succeeds on
Linux, but it fails on OSX...

So what is the portable way to compile plugins?

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


cleanup data set with g_object_set_data()

2005-12-17 Thread Olivier Sessink
Hi all,

if data is set with g_object_set_data(), is that automatically freed if
the object is unreffed?

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


Re: Reading from a block device without permission

2005-12-07 Thread Olivier Sessink
Marc O'Morain wrote:
> Hi there,
> 
> I am currently writing an application that I want to run as
> unprivileged user, but I want to read raw data from a block device
> such as /dev/sda (the usual block device for USB memory sticks).

sda is also the usual device if your primary harddisk is a SATA or SCSI
disk, so don't assume it is always sda!

> The problem is that users do not have privileges to read from
> /dev/sda.

on modern Linux systems with udev, the udev daemon should (if configured
properly) use different permissions for sda if sda happens to a USB
memory stick. Other platforms might use a different way to change the
permissions. The permission issue, however, is not an issue that should
be solved on the application level, but is an issue that the platform
should resolve.

> So I will need my application to gain root privileges to
> read from this device.

you could, as temporary solution for old systems, call a script with
sudo that changes the permissions of the device. This way you do not
need any complex architecture in your application (which is prone to
security bugs). Your application would, furthermore, integrate better
with modern systems on which the permission of devices may dynamically
change with the type of device connected.

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


Re: change condition on io_watch

2005-12-02 Thread Olivier Sessink
Christoph Simon wrote:
> Hi,
> 
> I'm trying to write a gtk+ program which is chatting with a server
> while allowing the user to do other things. Initially I'm using
> g_io_add_watch() which works fine while waiting for read and write
> events. The problem is, that the server is always write-ready, thus,
> even if I don't want to write anything yet, the callback is executed

if you do not want to write anything you should not watch if the channel
is ready for write.

A better solution would be to watch for read events only, and when you
want to write something change the watch to read+write, and when all
data is written, change it back again to watch only for read events.

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


Re: combo rant

2005-11-28 Thread Olivier Sessink
Freddie Unpenstein wrote:
>> It is the trade-off of the policy that "the selected item is under 
>> the pointer in the just shown popup, period." I think it is 
>> generally good, but this is an example of where it shows its 
>> drawbacks. However, for the sake of UI consistency, I believe it 
>> should _not_ be changed. I.e. it be "under the pointer, period", 
>> not "under the pointer, but only if..."
> 
> 
> So, why can't we just move the mouse?

because that would cause 90% of the users and developers to immediately
switch away from gtk. Users expect the pointer to be connected to their
mouse, they expect it to be almost a mechanical link. If a program moves
the pointer, users start to move their mouse wildly to find out where
the pointer did go, and they may have to start all over again locating
the correct entry in the combo.

[..]
> These kinds of functionality SHOULD be optional.

such that other people are not comfortable on your computer because it
works different from their own?

It's not such an easy task to improve the combo behavior, many of the
proposals in this thread would make general usability worse compared to
the minor improvement of the proposal.

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


Re: Problem sending data to gtk_button on "clicked" event

2005-11-09 Thread Olivier Sessink
Evan Behar wrote:
> I've been getting seg-faults when I try to work with data in my button
> "clicked" callback functions, so as a test, I compiled and ran the
> following program:
> 
> #include 
> 
> gchar m1[] = "button 1";
> gchar m2[] = "button 2";
> 
> static void callback(GtkWidget* widget, GdkEvent *event, gpointer data) {
>   g_print ("Hello again - %08X was pressed\n", data);
> }

I'm not 100% sure, but I think this is not the proper callback for a
"clicked" event. I think the documentation has

static void callback(GtkWidget* widget, gpointer data);

as the prototype.

regards,
Olivier

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


Re: call back problems

2005-11-07 Thread Olivier Sessink
Dennis Morgan wrote:

> Hi Olivier,
> Can you explain something. the g_signal_handler_block function, am i right in 
> thinking
> it goes inside the call back function itself? 

no, you when you call _block(), from that moment on the signal handler
will not be called anymore for that signal, until you call _unblock()

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


Re: GTK+ programming and session managment

2005-11-07 Thread Olivier Sessink
Kurucz Istvan wrote:
> Hy !
> 
> 'I'm developing an application in GTK+ under Linux using programming
> language 'C' and I'd like to create an option which allowes cooperation
> with the 'Session Saver' function.
> I'd like something like the 'gnome terminal'- so if the user asks for the
> 'Session Saver' function when logging off the Window Manager, it would
> save and re-present the same number of copies in the same position, with
> the previous settings (number of tabs, starting directory, etc.) during
> the next log in.
> Can this be done by using only GTK+ tools?'

that is a feature of gnome applications, using the gnome libraries. So
the answer is: if you want gnome functionality, you cannot use only gtk
and not gnome libraries.

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


Re: call back problems

2005-11-07 Thread Olivier Sessink
Dennis Morgan wrote:
> Hi,
> i am just wondering if there is a way to halt a call back till  another one 
> has finished using a function?

there is a g_signal_handler_block() function which does this

store the return value of g_signal_connect() in your data structures,
and use it to block or unblock the signal handler.

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


Re: optimal way to use Memory Chunks

2005-11-07 Thread Olivier Sessink
Gus Koppel wrote:
> Using such a feature like GMemChunk makes sense only if the size of the
> objects (atoms) isn't too small (less than about 16 bytes as a rule of
> thumb). Your atoms appear to be the smallest ones possible at all.
> GMemChunks are especially helpful for linked lists of any sort. Your
> atoms are apparently not big enough to contain such information.

hmm I must have been in some zombie state when I wrote that message. The
smallest struct has 1 pointer, 2 unsigned integers and 1 short unsigned
int, so I suppose that corresponds to 16 bytes (?)

[..]
> What sort of 4 byte information is to be stored, if I may ask? Is it to
> be referenced mainly by entry numbers (1st, 2nd, 3rd, ... atom) or by
> contents, i.e. locating atoms that contain particular values? Possibly
> for your app GMemChunks are not only inefficient but unsuitable at all.

so not 4 bytes, but anyway, what they are: they are changes in an editor
(Bluefish), to be used by the 'undo' function. Each struct has a pointer
with a buffer holding the change, a start and end position, and a state
'insert' or 'delete'.

As you can imagine, with 20 documents open, and doing heavy editing, the
number of instances may go up to 5000. They can be freed whenever some
document is closed, so the G_ALLOC_AND_FREE mode may be more
appropriate. I could associate a GMemChunk to each document so I can use
G_ALLOC_ONLY, but people often open many documents (100+), and edit only
a few of them. Having a GMemChunk prepared for each document would then
be quite some overload..

b.t.w.: I saw that GMemChunk is being deprecated in gtk-cvs, why is that?

regards,
Olivier
___
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 get a widget from a dialog widget

2005-11-02 Thread Olivier Sessink
[EMAIL PROTECTED] wrote:
> Hi all,
> 
> In function 1, I have created a a dialog widget which has 5 check buttons
> and I am check marking first 2 check buttons.
> 
> The dialog widget is being passed as an argument for this function 2. How
> will I see which check buttons are checked and which are not.

what I normally do, is to create a struct which holds a pointer to all
relevant widgets, and pass that as 'data' argument to the callbacks.

but don't forget to free the struct after you destroy the dialog.

regards,

Olivier Sessink


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


optimal way to use Memory Chunks

2005-11-01 Thread Olivier Sessink
Hi all,

I was considering to use the GMemChunk infrastructure for some of my
code, where often 50 till 5000 structs of 4 bytes are allocated. I will
use the G_ALLOC_AND_FREE mode, because many items are not used after a
while, but not all.

I am, however, wondering if GMemChunk has much overhead. Is there much
searching time involved looking for the next free element if the number
of items become large? And how large would that be? And if the number of
elements is at a time actually very little, is there much overhead using
GMemChunk instead of g_malloc() ?

Summarizing: the question is when *not* to use GMemChunk, and when *to
use* GMemChunk.

thanks,
Olivier Sessink

___
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 pixel size of a Pango layout

2005-11-01 Thread Olivier Sessink
Rob Chansky wrote:
> Hi all,
> 
> I've been trying to get the size of a Pango layout and I am having
> problems. My code is doing roughly this:
> 
> string text = "1";
> text = "" + text.text + "";
> 
> pango_layout_set_markup (mTextObjLayout, text.c_str(), -1);
> 
> PangoRectangle ext;
> pango_layout_get_pixel_extents (mMapTextLayout, NULL, &ext);
> 
> 
> When I look at ext, I see width = 189 for the small bit of (actual) text
> that exists in the string. The "ink" and "logical" values are roughly
> the same too-large size.
> 
> Is the huge size because of the extra markup language in the string?
> (But when I go into gdb and just use the straight string "1", I get the
> same size.)
> 
> Is it because mMapTextLayout is being reused to store the layouts of a
> number of strings? (Then shouldn't it be reset whenever I set a new
> markup?)

I'm not sue if it answers your complete question, but are you aware of
http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html
question 1.13 ?

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


Re: Meaning of G_IO_STATUS_AGAIN apart from resource temporarily unavailable ?

2005-10-27 Thread Olivier Sessink
Colossus wrote:
> Hi,
> 
> I red the docs on GIOChannels but I'm stuck regarding what means
> "resource temporarily available"

with non-blocking I/O that means that the buffers are full, so the call
will not process all your data, and to avoid that this function will
block your application, it will return.

this is what non-blocking I/O is all about: returning if it would
otherwise take too long

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


Re: *UPDATE* Binary writing to an input pipe and ASCII reading from an output one

2005-10-27 Thread Olivier Sessink
Colossus wrote:

> The red bytes do not correspond to the written ones:
> Bytes letti: 65536  Bytes scritti: 65536
> Bytes letti: 65536  Bytes scritti: 2015
> Bytes letti: 65536  Bytes scritti: 0
> Bytes letti: 65536  Bytes scritti: 0
> Bytes letti: 65536  Bytes scritti: 0
> Bytes letti: 12288  Bytes scritti: 0
> 
> The strangeness is that I do not have any error, the status of operation
> is always G_IO_STATUS_NORMAL; any clue ?

in non-blocking I/O, it is not guaranteed that a call handles all of the
supplied bytes. If you request 4000 bytes, you may receive 3000. Same if
you try to write 4000 bytes, the call may process 3000. Your code should
thus track which bytes are already processed, and offer the remaining
bytes to the function another time.

This is the essention on "non-blocking": the function will stop
processing data if the call would ake too much time, and it will tell
you how far it went. So you may then update your GUI, and present the
remaining data again.

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


Re: strange problem with radiomenuitem

2005-10-27 Thread Olivier Sessink
Alexander Nagel wrote:

> 1. During compilation i get a warning about
> 'cast to pointer from integer of different size'
> for the g_signal_connect line. How can i avoid this?

use the GINT_TO_POINTER() macro

> 2. It is normal that the callback is called twice?
> For example if group 3 is marked and i change to 5 i get
> Gruppe 3
> Gruppe 5
> then marking group 9
> Gruppe 5
> Gruppe 9
> Is that normal?

you get both a callback when a toggle is unset, and when it is set. So
if you add a `if (toggle->active) ` statement in your callback you only
handle the one that bcomes active.

regards,
Olivier

(b.t.w. which programming language is this?)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: re-filter GtkFileChooser widget after changing custom GtkFileFilter

2005-10-27 Thread Olivier Sessink
Iago Rubio wrote:
>>I've tried to simply set the filter function in the callback:
>>
>>GtkFileFilter *filter =
>>gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog));
>>gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
>>
>>but that doesn't trigger the refiltering...

> Not quite elegant and untested but, have you tried to re-set the
> directory before to set the new filter ?
> 
> gtk_file_chooser_set_filter (chooser, filter);
> gtk_file_chooser_set_current_folder (chooser,current_folder);

thanks, it makes the dialog flash, but at least it triggers refiltering.

regards,
Olivier


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


Re: memprof problem

2005-10-25 Thread Olivier Sessink
Allin Cottrell wrote:
> I've successfully used memprof for leak-checking my app in the past, but
> on trying it recently something odd happens: memprof starts up OK, and
> it also starts up the target program, but the target program is not
> visible (doesn't appear on screen) and memprof records no memory usage.

I'm not sure if memprof is still actively maintained. A good alternative
is 'valgrind'.

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


Re: Binary writing to an input pipe and ASCII reading from an output one

2005-10-24 Thread Olivier Sessink
Colossus wrote:
> Hi,
> 
> I'm trying without success to implement cat /tmp/file.cpio | cpio -tv
> with g_spawn family and giochannels. My code is to use
> "g_spawn_async_with_pipes" with both input and output pipes the "cpio
> -tv" command and then I open in read mode the binary cpio archive (I
> don't spawn cat just use g_io_channel_new_file):
> 
> gchar buffer[65536];
> gsize bytes_read;
> GError *error = NULL;
> GIOChannel *ioc , *input_ioc;
> 
>  compressor_pid = SpawnAsyncProcess ( "cpio -tv" , 0 , 1);

what does that function do? I guess it calls g_spawn_async_with_pipes(),
right? does it correctly create pipes for stdin and stdout? And do you
convert those into GIOChanells?

I suppose you have 3 IO channels for your code:
- one to read the file
- one pipe to pass that data to cpio
- one to read the result from cpio

is that correct?

and are they all non-blocking?

the best trick for debugging is probably to spawn 'cat', read some text
file, and print everything you read from the stdout of the process to
the terminal. The terminal should then show exactly the contents of your
text file if everything is OK.

regards,
Olivier Sessink


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


re-filter GtkFileChooser widget after changing custom GtkFileFilter

2005-10-24 Thread Olivier Sessink
Hi all,

I have a custom GtkFileFilter, some check buttons in the
GtkFileChooserDialog affect the filtering.

However, after one of the checkboxes have been changed, the
GtkFileChooser widget has to refilter (my custom filter func will return
a different value). How do I do that??

I've tried to simply set the filter function in the callback:

GtkFileFilter *filter =
gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog));
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);

but that doesn't trigger the refiltering...

Anybody an idea?

thanks,
    Olivier Sessink


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


Re: multiple calls to g_io_channel_read_line and g_free question

2005-10-18 Thread Olivier Sessink
Colossus wrote:
[..]
> g_io_channel_read_line ( ioc, &line, NULL, NULL, NULL );
> //do some things on line
> //shall I g_free (line) here ?
> g_io_channel_read_line ( ioc, &line, NULL, NULL, NULL );
> //ecc
> 
> My doubt is: shall I free line before the second call to
> g_io_channel_read_line or I can call g_free ONCE when I don't need to
> read anymore ?

see

http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html#g-io-channel-read-line

"Reads a line, including the terminating character(s), from a GIOChannel
into a newly-allocated string."

"newly allocated string" means that for every call to
g_io_channel_read_line() new memory is allocated, so for every call you
have to free the string.

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


Re: Implementing "cpio -tv < file.cpio" with glib routines

2005-10-17 Thread Olivier Sessink
Colossus wrote:
> - Messaggio originale  Da: Olivier Sessink
> <[EMAIL PROTECTED]>
> 
>> 1) spawn 'cpio -tv' with a pipe in and a pipe out 2) create
>> non-blocking g_io_channels from these pipes 3) register callbacks
>> with g_io_add_watch() for the io channels, one of these functions
>> should write, the other one read
> 
> 
> Thank you, but about the cat command ? cpio -tv alone doesn't work
> because it needs the input from a piped command.

if you have the data in memory:
use g_spawn to pipe the data to cpio

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


compiling g_module plugin on (cygwin) win32

2005-10-15 Thread Olivier Sessink
Hi all,

slightly off-topic, but I have plugins that work fine on Linux, They are
linked using:

$(LIBTOOL) --mode=link $(CC) -module $(LIBS) -shared -o $@ $(LOBJECTS)

the plugins call functions from the main binary. This is no problem on
Linux.

But on cygwin/win32 the linking stage fails because of unresolved
symbols, and these symbols are the stymbols from the main application.
How can I fix the linking stage on cygwin/win32 ??

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


Re: Implementing "cpio -tv < file.cpio" with glib routines

2005-10-14 Thread Olivier Sessink
Colossus wrote:
> Hi,
> 
> How can I code with g_spawn_* glib routines the command in the subject
> line ? Alternatively I noticed that
> 
> "cat file.cpio | cpio -tv" also works but how to implement also this
> with g_spawn family ?

1) spawn 'cpio -tv' with a pipe in and a pipe out
2) create non-blocking g_io_channels from these pipes
3) register callbacks with g_io_add_watch() for the io channels, one of
these functions should write, the other one read

you might want to look at 'external_commands.c' from the Bluefish source
code, it can process data through external commands, using pipes, fifo's
or temporary files.

regards,
Olivier

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


Re: getting input each frame

2005-10-13 Thread Olivier Sessink
flood wrote:
> Hello, I have been developing an app using GTK to make the interface. The
> problem I'm facing is that the program needs to check for input each frame
> and based on that it needs to alter a few objects such as labels, however, I
> don't know how to check for external input because If I would say make an
> infinite loop than I wouldn't be able to run gtk_main() without it returning
> control to my loop. What can I do to check for external input and gtk input?

extrnal input as in files/pipes ?

check the GIO_Channel stuff in glib, it provides an event-driven
interface for such things

regards,
Olivier Sessink

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


Re: g_spawning three processes: one after another only when...

2005-10-11 Thread Olivier Sessink
Colossus wrote:
> Colossus wrote:
> 
>> Olivier Sessink wrote:
>>
>>> you could also spawn '/bin/sh cat archive.tar.bz2 |bzip2 -d | tar
>>> --delete -v file_to_del | bzip2 > archive.tar,bz2'
> 
> 
> There is a problem in the set of piped command above. The last filename
> (the one in bzip2) must be different from the first one (the one in cat)
> otherwise I get a bzip2 unexpected file end error.

hmm good point, so you need a temporary filename, and after the new
files is written, you need to move it.

b.t.w.: since you are writing some kind of file manager for tar.bz2
files, you could also keep the unzipped tar in memory (read it once),
and do all your modifications in memory, and each time you need to save,
you only need to pipe through bzip2, instead of both unzipping, doing
the operation and zipping at the same time (which is very cpu intensive).

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


Re: position changed signal for paned widgets?

2005-10-09 Thread Olivier Sessink
Michael Matthews wrote:
> I wish to store the position of my paned widgets in GConf. On startup
> I set their initial position from the database, but when their
> position is changed with the mouse, I would like to update their
> position in the database.
> 
> Is there some kind of "position changed" signal for paned widgets?
> I've tried connecting several signals, but none are being called when
> the position is changed. I've read through the GtkPaned docs several
> times but cannot find it.

copy and paste from Bluefish code:

static void hpane_notify_position_lcb(GObject *object,GParamSpec
*pspec,gpointer data){
gint position;
g_object_get(object, pspec->name, &position, NULL);
/* do something */
}

g_signal_connect(G_OBJECT(hpane),"notify::position",G_CALLBACK(hpane_notify_position_lcb),
NULL);

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


Re: Editable cells in a treeview

2005-10-09 Thread Olivier Sessink
Will Luesley wrote:

> I had thought this might be a design problem I was trying to solve with
> code.  I've got a long list of items with a single attribute to set for
> each, e.g
> 
> | Field Name One |  Some static info | User editable value
> | Field Name Two |  Static info | User editable value
> 
> the number of fields will range from one to a couple of hundred.  What
> would you recommend as the best way of displaying the data?

a list together with a search field so you can quickly find the correct
field is what comes in my mind first... Are there any other apps that
solve such a problem in some way?

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


Re: g_spawning three processes: one after another only when...

2005-10-09 Thread Olivier Sessink
Colossus wrote:
> Hi,
> 
> I need to launch these three processes:
> 1) bzip2 -dc archive.tar.bz2 > /tmp/foo.tar
> 2) tar --delete -vf /tmp/foo.tar file_to_del
> 3) bzip2 -c /tmp/foo.tar > archive.tar,bz2
> 
> only when each of them exits. Shall I use g_spawn_sync ?
> How to code the run of all of them ?
> The GUI must not freeze while these three processes are
> operating on the file.
> 
> Any clue please ?

you could also spawn '/bin/sh cat archive.tar.bz2 |bzip2 -d | tar
--delete -v file_to_del | bzip2 > archive.tar,bz2'

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


Re: Editable cells in a treeview

2005-10-06 Thread Olivier Sessink
Will Luesley wrote:
> I've got a TreeView which has four columns, one of which is editable.
> 
> There are two things I am trying to do to make editing easier for the
> user, but I can't see how to achieve either:
> 
> 1) Starting editing with a single click on the editable cell.  That is,
> if a user clicks on the editable cell, even if the row is not selected,
> editing will start.  The default behaviour is that the row must be
> selected (one click) and then another click to start editing.
> 
> 2) If the user completes editing by pressing return, the next row is
> selected and editing is started on the new row.  The default behaviour
> is to just finish editing, and leave the same row selected

remember that if your app works different then other apps, users might
actually find your app more difficult to work with. Just think of that
before you start customizing things like this.

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


Re: redirecting output to a file with g_spawn_async

2005-10-06 Thread Olivier Sessink
Colossus wrote:

>>> I tried with g_spawn_async_with_pipes and with gspawn_async
>>> but it does not work. In the first case the output (the decompressed
>>> bzip2 file) is redirected to a GTK window so I used g_spawn_async (no
>>> pipes) but the output is directed to the shell window from which I ran
>>> my program. How can I have the output redirected to the file /mnt/foo ?

>> open a file in write mode, and while reading from the pipe from
>> _spawn_async, write data to that file.

> I did it but the file written is not the same as the original !
> I opened with fwrite with "w" since wb does not care on Unix.
> I read the data from the pipe in a gchar *line with and write it to the
> file with fwrite ( line , 1 , strlen ( line ), fd ) but the dimension of
> the written file are not the same of the one extracted
> with bzip2 -d file.bz2 and it corrupteded. Where am I wrong ?

The only thing I can think of: are you keeping track of the number of
bytes, or do you rely on a '\0' as end-of-string? If your data is
binary, you cannot rely on the end-of-string, you have to keep track of
the number of bytes.

Try replacing the bzip2 with 'cat', and then test your code, much easier
for debugging. Start with a simple file with a single character or so.

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


Re: Size of text entries

2005-10-05 Thread Olivier Sessink
flood wrote:
>> use gtk_widget_set_size_request ()
>>
>> but if the user doesn't change the data, why not use a GtkLabel ?

> Thank you. As far as the label goes, I would use it if you could
> change the background color to white.

that is a little tricky: a label doesn't have a background, so you will
have to pack it into an event-box for example, because the event-box
allows you to change the background color.

regards,
Olivier

(b.t.w. please reply *below* the answer, so the discussion is easier to
follow for other people)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Size of text entries

2005-10-04 Thread Olivier Sessink
flood wrote:
> Hello, In my app I have a text entry widget that will display a small
> number, usually 1-10. However, when I added the entry widget I noticed it
> was very big compared to the amount of text that will be stored in it. Also
> I should mention the user will not be changing the text inside the entry but
> the computer will. My question to you is, is there a way I can change the
> size of the entry? 

use
gtk_widget_set_size_request ()

but if the user doesn't change the data, why not use a GtkLabel ?

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


Re: redirecting output to a file with g_spawn_async

2005-10-01 Thread Olivier Sessink
Colossus wrote:
> Hi,
> 
> I tried with g_spawn_async_with_pipes and with gspawn_async
> but it does not work. In the first case the output (the decompressed
> bzip2 file) is redirected to a GTK window so I used g_spawn_async (no
> pipes) but the output is directed to the shell window from which I ran
> my program. How can I have the output redirected to the file /mnt/foo ?

open a file in write mode, and while reading from the pipe from
_spawn_async, write data to that file.

regards,
Olivier

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


Re: long line in GtkTextBuffer

2005-09-12 Thread Olivier Sessink
Nick Watts wrote:
> I would probably never have realised except that I tried to open a very 
> complex svg file made with inkscape in my editor and it opened fine 
> but when the text was rendered, the really long line (one extremely complex 
> path element generated with the trace bitmap function) was simply invisible 
> and the whole application started moving at a snails pace. It's a fairly 
> fast computer so I don't think resources are the issue (the whole svg file 
> is only 12Kb). Anyone have any ideas?

this is a known issue with the gtktextview widget, and there seems to be
no fix ATM. Should be in bugzilla somewhere already.

regards,
Olivier Sessink

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


Re: gspawn_async_with_pipes questions

2005-05-27 Thread Olivier Sessink
On Thu, 26 May 2005 07:59:17 +0200
Colossus <[EMAIL PROTECTED]> wrote:

> Olivier Sessink wrote:
> 
> > I use this for example to close the stderr of the child and make it a
> > copy of the stdout.
> 
> Thank you Olivier, but how to read the output of the command unzip -l
> so to put it into the gtk_tree_view ?

provide a variable for the standard output, and open that as g_io_channel
(g_io_channel_unix_new or something like that), make it non-blocking,
register a callback, and read the contents from the callback into the listmodel.

regards,
Olivier Sessink

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


Re: GtkTreeModelFilter

2005-05-25 Thread Olivier Sessink
Andrusky wrote:
> What's the best way to change the virtual root of a GtkTreeModelFilter?
> 
> I did a g_object_unref it to it (it has only 1 reference now) and then
> tried to just replace the filter with a new one. After I did this, the
> reference count drop to 0, so I'm assuming it is supposed to be deleted.
> When I run valgrind on the program however, I leak memory every time
> I replace the filter.

as far as I know, there is no way to change it (the property is
read-only, and there is no _set() function), and you'll have to
construct a new filter, and unref the old one..

That is at least what I do.

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


Re: gspawn_async_with_pipes questions

2005-05-25 Thread Olivier Sessink
Colossus wrote:
> Hi,
> 
> I need gspawn_async_with_pipes to run the unzip command this way: unzip
> -l foo
> 
> The output should go in a gtk_tree_view. My questions:
> 1) May I pass NULL to the last 5 arguments of gspawn_async_with_pipes
> for the purpose of filling
> the gtk_tree_view ?

yes, no problem, although the last argument is the error, you might want
to look at it..

> 2) Child setup and user data ? What do I have to give
> to these arguments ??

use NULL if you don't need any child setup.

I use this for example to close the stderr of the child and make it a
copy of the stdout.

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


Re: launching web-browser

2005-05-22 Thread Olivier Sessink
On Sat, 21 May 2005 14:51:05 +0200
Gyözö Both <[EMAIL PROTECTED]> wrote:

> thanks for your answers. if possible, i'd like to have a solution that
> only uses gtk/glib, i wouldn't want to have a gnome-dependency in my
> app. is there a way?

http://developer.gnome.org/doc/API/2.0/glib/glib-Spawning-Processes.html#g-spawn-async-with-pipes

is pretty much portable.

a command string like 
/bin/sh -c mozilla -remote 'openURL(%s, new-window)' || mozilla %s&
will work on unix 

regards,
Olivier

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


possible to detect if window is on active desktop, or not?

2005-05-12 Thread Olivier Sessink
Hi all,

is it possible to detect if a window is on the current desktop of the
user? (if the user is using virtual desktops?).

I have an application that can have different documents open in diffeent
windows, and each of these windows could be on a different virtual
desktop. And I want to avoid that a dialog box is shown for a document
that is not on the current virtual desktop. So I only want to give dialogs
for windows that are on the current desktop.

thanks,
Olivier Sessink

___
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_model_get() --> when to free results???

2005-05-11 Thread Olivier Sessink
Stefan Kost wrote:
> Hi Olivier,
> 
> I've just browsed over the docs from glib, gobject and gtk. I though
> these rules are somwhere in there, but I didn't found them. I've also
> looked at
> http://developer.gnome.org/doc/guides/
> http://developer.gnome.org/doc/tutorials/
> 
> Now the question is where do the belong?
> 
> I fancy the idea of having a rules and conventions document (coding
> practice) and install that among the other docs. Then libs that adhere
> to these guide-line and just link that document in there introduction.

that would make sense indeed, especially if we can refer to the
conventions from any place where this is appropriate.

> This only makes sense if we can come up with some more such conventions.
> What do others think of this? Ideas?

many FAQ type things could be there. Such as how to pass multiple values
with a callback (with a struct or object), show some code conventions
how to work with that (quite recently somebody posted a short howto how
to do this).

Basically the framework of gtk applications could be explained.

regards,
Olivier
___
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_model_get() --> when to free results???

2005-05-10 Thread Olivier Sessink
Stefan Kost wrote:
> Hi Olivier,
> 
> I am afraid this report is invalid. It is common behaviour in
> glib/gobject based applications that when returning data
> * gobjects are reffed and need to be unreffed when done
> * strings are strdup'ed and should be freed (unless they are marked as
> const)
> such can't be done for pointers as they are opaque to the system.

your claim may be 100% true, it probably is, but it doesn't affect my
bug report.

I'm claiming that from a app-developer point of view, the documentation
could be improved such that coding will be more productive.

The documentation is there to facilitate app-developers to make good use
of gtk, and exploit all the possibilities of gtk in the right way. The
better the documentation, the better the app-developers can make use of
gtk, the more and better gtk apps we will get. Documentation is *very*
important, and every improvement of the documentation is thus an
important improvement.

regards,
Olivier

___
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_model_get() --> when to free results???

2005-05-10 Thread Olivier Sessink
Peter Bloomfield wrote:
> On 05/10/2005 10:11:40 AM, Olivier Sessink wrote:
> [ snip ]
> 
>> thanks for the clarification. where did you find this  information?
> 
> 
> I don't recall--certainly not from the docs!  Partly  experimentation--I
> noticed that some objects weren't getting  finalized.

I'll file a bugreport in bugzilla then, this is quite annoying if every
programmers has to find this by debugging:

http://bugzilla.gnome.org/show_bug.cgi?id=303675

thanks for your help!

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


Re: gtk folder path

2005-05-10 Thread Olivier Sessink
srinivas wrote:
> hi all;
> 
> i have an application in which when i selected the particular file or
> folder the file/folder path has to be displayed in the list widget. the
> number of file/folders i selected, the path of those files to be
> displayed in separate rows. how can i get this functionality, any
> samples.

this might give you some ideas, using asynchronous gnome_vfs calls to
fill the widget:

http://cvs.sourceforge.net/viewcvs.py/bluefish/bluefish-gtk2/src/filebrowser2.c?rev=1.115&view=log

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


gtk_tree_model_get() --> when to free results???

2005-05-10 Thread Olivier Sessink
Hi all,

in the documentation from gtk_tree_model_get() at
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModel.html#gtk-tree-model-get
I read:
"If appropriate, the returned values have to be freed or unreferenced."

my question is: when is it appropriate?

I expect the model always to return the same pointer I used to fill the
model. Am I wrong in this assumption? And is there some documentation
explaining this behavior?

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


Re: sort list_store

2005-02-08 Thread Olivier Sessink
ALLs soft wrote:
how to sort a list_store?
you can put a GtkTreeSortModel on top of your listmodel, and then 
connect the GtkTreeView to the sort model instead of your list_store.

beware that you have to convert any iter or path you retrieve from the 
treeview from the sort model back to the list_store

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


  1   2   >