Re: Correct way to deallocate an unix signal source

2019-03-18 Thread Philip Withnall
Hi,

On Thu, 2019-03-14 at 00:09 +0100, Enrico Mioso wrote:
> I am facing an issue, where it seems I am not deallocating correctly
> an UNIX signal source. I use
> my_state->unix_signals_src = g_unix_signal_source_new(SIGINT);
> g_source_set_callback(my_state->unix_signals_src, my_unix_signals_cb,
> my_state, NULL);
> my_state->unix_signals_src_tag = g_source_attach(my_state-
> >unix_signals_src, my_state->ctx);
> g_source_unref(my_state->unix_signals_src);
> 
> then, on the exit path of my program, I have something like:
> 
> if (!my_state->sigint_received)
>g_source_destroy(my_state->unix_signals_src);
> 
> my_state->unix_signals_src_tag = 0;

This code seems fine to me, within the context you’ve provided. I
assume you’re also correctly unreffing the GMainContext at the end of
your program.

> This output can be obtained even using the glib.supp file as found in
> glib repository.
> Looking at the file specified by valgrind, glib-unix.c, line 222, I
> can see:
> return _g_main_create_unix_signal_watch (signum);

That valgrind trace looks like an intentional one-time leak, since the
allocation is within pthread_create().

I’d be very happy to accept a patch to GLib to add this to glib.supp. ☺

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

Re: Correct way to deallocate an unix signal source

2019-03-19 Thread Philip Withnall
On Mon, 2019-03-18 at 14:38 +0100, Enrico Mioso wrote:
> Regarding the code, at exit I do the following:
> if (my_state->mainloop) {
>   g_main_loop_unref(my_state->mainloop);
>   my_state->mainloop = NULL;
> }
> 
> if (my_state->ctx) {
>   g_main_context_unref(my_state->ctx);
>   my_state->ctx = NULL;
> }

That looks fine. If you depend on GLib ≥ 2.34, you can instead do:

g_clear_pointer (&my_state->mainloop, g_main_loop_unref);
g_clear_pointer (&my_state->ctx, g_main_context_unref);

which is equivalent, but simplifies things a bit.

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

GtkEntryCompletion on a GtkCellRendererText

2007-03-03 Thread Philip Withnall
Hi all,

I've got a table of database rows set up using a GtkTreeView with a
GtkListStore backend, and GtkCellRendererTexts for the table cells. This
is all working nicely.

What I'd like to do is have auto-completion available when editing the
text cells, with a GtkEntryCompletion, but I can't figure out how to add
one. The most likely way would be to get a pointer to the
GtkCellRendererText's GtkEntry, but I can't find a way to do that. I
also can't find any gtk_cell_renderer_text_* methods for adding a
GtkEntryCompletion, or an object equivalent to a GtkEntryCompletion for
use on GtkCellRendererTexts.

What's the obvious thing I've missed? :-P

Cheers,
Philip Withnall

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


Getting maximum possible window size

2007-04-10 Thread Philip Withnall
Hi,

I need to find the maximum possible size of a window (i.e. when it's
maximised). So far I've come up with gdk_screen_get_width() and
gdk_screen_get_height(), but I presume they don't take the panels into
account (and thus return sizes which are too big). What else is there?

Thanks,
Philip Withnall
___
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 display an animated pop-up when ever a certain event occur?

2007-04-12 Thread Philip Withnall
Hi,

You probably want to look at libnotify, hosted on the Galago project's
site:
http://galago-project.org/news/index.php

Regards,
Philip Withnall

On Thu, 2007-04-12 at 16:08 +0530, suman rapolu wrote:
> Hi,
> 
>   I want to develop a system tray application that checks for some
> events and when ever a new event occurs it should display an animated popup
> with some messages.
> 
> I don't know how to display an animated pop-up with some message in
> it?. So, can anybody tell me how to do it or give me any links regarding
> this topic. I am using Gtk-C API's for developing this application.
> 
> Thanks in advance,
> Suman.
> ___
> gtk-app-devel-list mailing list
> [EMAIL PROTECTED]
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 
> 
___
gtk-app-devel-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtk_file_chooser_widget problem

2007-04-13 Thread Philip Withnall
Try looking at how evince does it:
http://svn.gnome.org/viewcvs/evince/trunk/shell/ev-window.c?view=markup

You want the ev_window_cmd_file_open function.

Philip Withnall

On Thu, 2007-04-12 at 08:03 -0700, bajone wrote:
> I have a problem when I call gtk_file_chooser_widget_new() or
> gtk_file_chooser_dialog_new()... in both cases a dialog apears(in first case
> a widget is in the box) but I can't choose a file and I can't browse
> directories... the cursor turns into load cursor and everything stops, I
> have to kill window to return from dialog. With gtk_file_selection_new()
> everything works perfectly.
> 
> Where am I wrong? I searched in all tutorials (gtk official tutorial  too)
> but I can't find a simple example to make this thing work. Can somebody post
> a code for loading a file with gtk_file_chooser? I use Visual 2005 on
> windows, and I have installed the last gtk environement and libraries.
> 
> Thanks for any advice
___
gtk-app-devel-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: cairo & pixmap

2007-05-19 Thread Philip Withnall
Hi,

On Sat, 2007-05-19 at 13:41 +0200, control H wrote:
> Hi,
> 
> I'm planning to make my app use cairo instead of GDK based functions.
> I'm using a drawing area, which draws into a pixmap when the
> "configure" event is emitted, and copies the relevant part of the
> pixmap back on the screen on the "expose" event.
> 
> When I'm doing the same with cairo, a black screen is the result. The
> ref. manual says in the FAQ that I should either turn off double
> buffering, or draw in the expose signal. This is also what the example
> testcairo (coming along with Gtk) does.
> 
> I'm confused. Does this mean that drawing using cairo is slower since
> it has to redraw the whole thing again on each expose signal? Or is
> there some smart thing in Gtk that somehow knows that when the expose
> event is a result of a configure event, it doesn't really do the
> drawing but copies the invalidated part back?

The signal handler for the expose event is passed some parameters
specifying which part of the screen has become invalidated. If you use
these in a Cairo drawing mask, then redraw your canvas, it should be
quite fast, as Cairo will ignore all operations to areas outside the
mask.

Philip

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

Re: cairo & pixmap

2007-05-19 Thread Philip Withnall
On Sat, 2007-05-19 at 14:12 +0200, control H wrote:
> > The signal handler for the expose event is passed some parameters
> > specifying which part of the screen has become invalidated. If you use
> > these in a Cairo drawing mask, then redraw your canvas, it should be
> > quite fast, as Cairo will ignore all operations to areas outside the
> > mask.
> 
> But this means -if I understand correctly- that I still have to redraw
> "from scratch", be it not the complete drawing area but only the
> invalidated part. Therefore, it will still be slower than in my old
> "GDK based" situation, especially when the to be drawn picture becomes
> more complex (which in my situation is the case).

That's how I've done it in programs I've written, but I'm far from an
expert on the subject. There may well be a way to double-buffer the
canvas, and just blit the exposed area from the buffer.

> Do you/does anybody know what the technical reason is why cairo
> contexts fail outside the expose signal? I'm just curious.

I'm not sure what you mean here, sorry.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Is there any way to populate the treeview from glade3 WITHOUT going to coding

2007-07-08 Thread Philip Withnall
In short, there's no way of doing it from glade3 (or libglade at all),
but with the new GtkBuilder code in GTK trunk, you can. It uses an XML
format for describing UIs which is similar to glade's, but has some
differences, and allows population of treeview models. I think there's
some example XML in the GtkBuilder files in the "tests" directory of GTK
trunk.

Philip

On Sat, 2007-07-07 at 19:54 +0100, Ravi kumar Singh wrote:
> First of all :- if this message appears again please excuse me as i have 
> earlier posted this WITHOUT subscription..and that is still is being 
> moderated...
> 
> What i need to know that is there any way to populate the treeview with 
> treemodels RIGHT from glade3. I have created treeviews before using coding in 
> C++, Java and Pythonbut i think it will be much more convenient if we 
> could create models and columns DIRECTLY IN GLADE3.
> 
> On creating treeview widget in glade3 there is an option of adding treemodels 
> in the properties panel..but it asks for to select a model from the 
> projectHow to ADD models in a project ?
> 
> Please do tell me if you are sure that there is no way to do that ...yet.
> 
> 
>  Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download 
> Now! http://messenger.yahoo.com/download.php
> ___
> 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: Compiling GTK, GLIB,PANGO ???

2007-08-08 Thread Philip Withnall
Hi,

You might want to use Jhbuild [1], which takes care of this
automatically, and helps you build everything straight from SVN.

[1] http://live.gnome.org/Jhbuild

Philip

On Wed, 2007-08-08 at 18:55 +0200, [EMAIL PROTECTED] wrote:
> Sorry I don't know if this is the right mailing list.
> 
> I want to install the newest versions of GDK ; GLIB PANGO   etc.
> for testing purpose.  I do not want to overwrite the existing
> libraries of my SuSE 10.1 installation to be sure not to damage the 
> whole system
> I thought to do
> first I build glib with
> configure --prefix=/opt/glib
> this works fine
> than I tried to
> configure --prefix=/opt/gtk as an example
> now configure complains about the not up todate  glib version
> because I know  pkgconfig uses the PKG_CONFIG_PATH
> what can I do to force configure to test against the 
> /opt/glib/lib/pkgconfig  Path
> 
> Suggestions to do wellcome
> 
> mfg
> g.rapp
> 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list