Re: GTK threads

2009-07-17 Thread Marshall Lake


Just to let everyone know ...

I discovered that I was having an issue with my socket logic which was the 
main cause of my problem outlined below.  Once I resolved that issue and 
incorporated g_idle_add() along with GCond  GMutex into my code 
everything is working.




(When you reply, please add CC to devel mailing list, so other peoples 
know it's progress and may help you more).


--- ml...@mlake.net wrote:

From: Marshall Lake ml...@mlake.net
To: Ardhan Madras aj...@knac.com
Subject: Re: GTK  threads
Date: Wed, 8 Jul 2009 12:21:34 -0400 (EDT)


Thanks for your feedback.  I think what you say is likely my problem.



On Wed, 8 Jul 2009, Ardhan Madras wrote:


Hi,

You should be aware when call GTK+ function in another thread, if you 
do this from another thread, GTK+ is likely not send commands to the X 
server. When you run a dialog in the main thread, main loop is blocked, 
so the dialog's window remain displayed until a response was given (eg. 
button was clicked). But in you code, you run the dialog outside the 
main loop (main thread) the main loop of course is not blocked, and it 
fails to show the dialog. See 
http://library.gnome.org/devel/gtk-faq/stable/x499.html on howto send 
GTK+ funcs to the main loop. Another way is to provide mechanism so you 
can run the dialog from the main thread by using such as condition 
variable (GCond).


-- ajhwb

--- ml...@mlake.net wrote:

From: Marshall Lake ml...@mlake.net
To: gtk-app-devel-list@gnome.org
Subject: GTK  threads
Date: Wed, 8 Jul 2009 09:38:30 -0400 (EDT)


I posted this on gtk-list but in the hope of catching a wider audience ...

I'm developing a program(s) which runs in the client/server environment.
I'm using GTK, sockets, and threads.  (GTK and threads only on the client
side.)  I don't have very much experience using threads and this is the
first time I've tried to call GTK functions within a thread, and I'm
having problems.  I've tried different ways of approaching the problem but
can't seem to get anywhere.  I suspect there's something I don't
understand about thread processing or I'm under some misconception.
Maybe someone can help me?  Any help is much appreciated.

I get the following errors when trying to run the code below (the errors
show up when the program calls gtk_dialog_run() in the thread
(Wait4Challenge()):

src/xcb_io.c:242: process_responses: Assertion `(((long) (dpy-last_request_read) - 
(long) (dpy-request)) = 0)' failed.
Fatal IO error 0 (Success) on X server :0.0.


void *
Wait4Challenge () {
  int wsock, x, port = 0, listensock, connected;
  char buffer[5000], *msg[5], challenger[50];

  listensock = -1;
  for (x = 0; x  5; x++)
  msg[x] = NULL;

  wsock = get_connection (SOCK_STREAM, port, listensock);

  connected = 1;
  while (connected) {
  GtkWidget *dialog;
  int response;

  if (sock_gets (wsock, buffer[0], sizeof (buffer))  0) {
  msg[0] = There is a problem with the server.\n\n;
  outMessage (msg);
  connected = 0;
  }

  if (buffer[0] == 'R')
  connected = 0;

  if (buffer[0] != 'C')
  continue;

  strcpy (challenger[0], buffer[1]);

  gdk_threads_enter ();

  dialog = gtk_message_dialog_new (GTK_WINDOW (mainwin), 
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
  GTK_BUTTONS_YES_NO, %s has challenged you to a game.  
Do you wish to play?, challenger);
  gtk_window_set_title (GTK_WINDOW (dialog), Play Challenger?);
  response = gtk_dialog_run (GTK_DIALOG (dialog));
  gtk_widget_destroy (dialog);

  gdk_flush();
  gdk_threads_leave ();

  if (response == GTK_RESPONSE_YES) {
  sock_puts (wsock, OK\n);
  connected = 0;
  }
  else {
  sock_puts (wsock, NO\n);
  for (x = 0; x  5; x++)
  msg[x] = NULL;
  continue;
  }
  }

  shutdown (wsock, SHUT_RDWR);
  close (wsock);
  return (NULL);
}

int
main (int argc, char *argv[]) {
  g_thread_init (NULL);
  gdk_threads_init ();

  gtk_init (argc, argv);

  mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_usize (mainwin, WINSIZEX, WINSIZEY);
  gtk_widget_realize (mainwin);

  gtk_widget_add_events (mainwin, GDK_BUTTON_PRESS_MASK);
  gtk_signal_connect (GTK_OBJECT (mainwin), delete_event, GTK_SIGNAL_FUNC 
(delete_event), 0);

  gtk_widget_show_all (mainwin);

  if (!g_thread_create (Wait4Challenge, NULL, FALSE, NULL))
  syslog (LOG_INFO, error trying to create new thread);

  gdk_threads_enter ();

  gtk_main ();

  gdk_flush();
  gdk_threads_leave ();

  return 0;
}

--
Marshall Lake -- ml...@mlake.net -- http://mlake.net



--
Marshall Lake -- ml...@mlake.net -- http://mlake.net

GLib 2.21.4 released

2009-07-17 Thread Matthias Clasen
GLib 2.21.4 is now available for download at:

  ftp://ftp.gtk.org/pub/glib/2.21/
  http://download.gnome.org/sources/glib/2.21/

md5 sums:
5092c5b479ba80065dc164d27e63000f  glib-2.21.4.tar.bz2
83a51a4d0bc540b4b1c9f5c0d2921623  glib-2.21.4.tar.gz

sha1 sums:
849e2e1d96b4e779891c2ddba06e9939b03a9032  glib-2.21.4.tar.bz2
d2d9db815db109d505b87554e535e0fcebc7b11c  glib-2.21.4.tar.gz

This is a development release leading up to GLib 2.22.

Notes:

 * This is unstable development release. While it has had
  a bit of testing, there are certainly plenty of bugs
  remaining to be found. This release should not be used
  in production.

 * Installing this version will overwrite your existing
  copy of GLib 2.20. If you have problems, you'll need
  to reinstall GLib 2.20.

 * GLib 2.22 will be source and binary compatible with
  the GLib 2.20 series; however, the new API additions
  in GLib 2.21 are not yet finalized, so there may be
  incompatibilities between this release and the final
  2.22 release.

 * Bugs should be reported to http://bugzilla.gnome.org.


About GLib
==

GLib is the low-level core library that forms the basis for projects
such as GTK+ and GNOME. It provides data structure handling for C,
portability wrappers, and interfaces for such runtime functionality as
an event loop, threads, dynamic loading, and an object system.

More information about GLib is available at:

 http://www.gtk.org/

An installation guide for the GTK+ libraries, including GLib, can
be found at:

 http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html


Overview of Changes from GLib 2.21.3 to GLib 2.21.4
===

* GTree is now refcounted

* Bugs fixed:
 587938 Undocumented limitation for g_str_equal
 587773 refcounts for GTree

* Updated translations:
 French
 Hebrew
 Norwegian bokmål
 Spanish
 Swedish
 Traditional Chinese
 Ukrainian

Thanks to our contributors:
Tor Lillqvist
Ryan Lortie
Benjamin Otte
Martin Nordholts


July 17, 2009
Matthias Clasen


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

GTK clipboard on OS X

2009-07-17 Thread Allin Cottrell
In some contexts my GTK app offers the user the opportunity to
copy chunks of output to the clipboard as RTF.  This is primarily
intended for use on MS Windows, but it also works fine for pasting
into (e.g.) an OpenOffice text document on Linux.  The chunk is
advertised via the relevant GtkTargetEntry as application/rtf.

But this doesn't work on OS X (using GTK 2.14.N under X11).  All
paste targets, even ones that are certainly RTF-aware such as
OpenOffice, seem to ignore application/rtf and request plain text,
so that if pasting succeeds at all, it is just a raw dump of the
RTF code.

If this a known issue of GTK/X11 on the Mac?  Is there a
workaround?  Or does it look as if I'm doing something wrong?
Thanks.

Allin Cottrell



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


GTK+ 2.17.5 released

2009-07-17 Thread Matthias Clasen
GTK+ 2.17.5 is now available for download at:

 ftp://ftp.gtk.org/pub/gtk/2.17/
 http://download.gnome.org/sources/gtk+/2.17/

md5 sums:
549fe72768e2d3e6a9553d45622134d2  gtk+-2.17.5.tar.bz2
d7810abeba598160b24724373fde4b83  gtk+-2.17.5.tar.gz

sha1 sums:
1064433144fa5766913b5969313c20ea5f26b8db  gtk+-2.17.5.tar.bz2
03db55fe02ee1d7b1c4dcd285f27b3fb53f042d6  gtk+-2.17.5.tar.gz

This is a development release leading up to GTK+ 2.18.

Notes:

 * This is an unstable development release.
   It has had only little testing and there are unfinished
   features and plenty of bugs in this release. It should
   definitively not be used in production.

 * Installing this version will overwrite your existing
   copy of GTK+ 2.16. If you have problems, you'll need
   to reinstall GTK+ 2.16.

 * GTK+ 2.18 will be source and binary compatible with
   the GTK+ 2.16 series; however, the new API additions
   are not yet finalized, so there may be incompatibilities
   between this release and the final 2.18 release.

 * Bugs should be reported to http://bugzilla.gnome.org.


What is GTK+


GTK+ is a multi-platform toolkit for creating graphical user
interfaces. Offering a complete set of widgets, GTK+ is suitable for
projects ranging from small one-off tools to complete application
suites.

GTK+ has been designed from the ground up to support a range of
languages, not only C/C++. Using GTK+ from languages such as Perl and
Python (especially in combination with the Glade GUI builder) provides
an effective method of rapid application development.

GTK+ is free software and part of the GNU Project. However, the
licensing terms for GTK+, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without
any license fees or royalties.


Where to get more information about GTK+


Information about GTK+ including links to documentation can be
found at:

http://www.gtk.org/

An installation guide for GTK+ 2.x is found at:

 http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html

Common questions:

http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html
http://www.gtk.org/faq/


Contributing


GTK+ is a large project and relies on voluntary contributions.
We are actively searching for new contributors in various areas
and invite everyone to help project development.
If you are willing to participate, please subscribe to the project
mailing lists to offer your help and read over our list of vacant
project tasks:
   http://live.gnome.org/GtkTasks


Overview of Changes from GTK+ 2.17.4 to 2.17.5
==

* Client-side windows:
 - Quite a few fixes have happened for the win32 and directfb backends

* GSEAL:
 - Accessors have been added for sealed members in GtkCellRenderer and
   GtkWidget

* Changes that are relevant for distributors:
 - The jpeg2000 pixbuf loader is now optional. Pass --with-libjasper
   to configure to build it

* Bugs fixed
 588373 Menus broken by client-side-windows
 588379 testgtk::panes does not change the cursor on mouse over
 588388 shape rendering is back
 588461 gtk_editable_get_chars() behaviour change in 2.17.4
 588666 Incorrect clamping of max_length
 588665 insert-text signal is not emitted
 588395 Crash when opening a GtkBuilder file
 524066 Mandatory jpeg2000?
 527583 GtkAssistant should set buttons as default widget
 588694 Missing % in C code
 588484 Iconview DnD fails when Destination is empty
 583522 Trivial error in GtkBuilder migration documentation
 150951 collapsed save dialog needs to indicate filesystem...

* Updated translations:
 Brazilian Portuguese
 Norwegian bokmål
 Spanish
 Traditional Chinese


Thanks to all contributors:
Hans Breuer
Cody Russell
Michael Natterer
Tor Lillqvist
Tristan Van Berkom
Marek Kasik


July 17, 2009
Matthias Clasen


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

GTK+ 2.16.5 released

2009-07-17 Thread Matthias Clasen
GTK+ 2.16.5 is now available for download at:

 ftp://ftp.gtk.org/pub/gtk/2.16/
 http://download.gnome.org/sources/gtk+/2.16/

md5 sums:
8d1ea0b9b0400224d25b0cc2750b438d  gtk+-2.16.5.tar.bz2
4d7f18d70c3fc7a372c1c5bb850248fb  gtk+-2.16.5.tar.gz

sha1 sums:
4482e698730c8ea88239512a49306dc27a661145  gtk+-2.16.5.tar.bz2
7972f911da3066b1cb8d35e70939ec689fda8eae  gtk+-2.16.5.tar.gz

This is a bug fix release in the stable 2.16 series.



GTK+ is a multi-platform toolkit for creating graphical user
interfaces. Offering a complete set of widgets, GTK+ is suitable for
projects ranging from small one-off tools to complete application
suites.

GTK+ has been designed from the ground up to support a range of
languages, not only C/C++. Using GTK+ from languages such as Perl and
Python (especially in combination with the Glade GUI builder) provides
an effective method of rapid application development.

GTK+ is free software and part of the GNU Project. However, the
licensing terms for GTK+, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without
any license fees or royalties.


Where to get more information about GTK+


Information about GTK+ including links to documentation can be
found at:

http://www.gtk.org/

An installation guide for GTK+ 2.x is found at:

 http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html

Common questions:

http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html
http://www.gtk.org/faq/


Contributing


GTK+ is a large project and relies on voluntary contributions.
We are actively searching for new contributors in various areas
and invite everyone to help project development.
If you are willing to participate, please subscribe to the project
mailing lists to offer your help and read over our list of vacant
project tasks:
   http://live.gnome.org/GtkTasks


Overview of Changes from GTK+ 2.16.4 to 2.16.5
==

* Fix a side-effect introduced by the fix for bug 586330 that
  caused all stock buttons to loose their mnemonics.

* Bugs fixed:
 582025 Accelerators fail for submenus
 150951 collapsed save dialog needs to indicate filesystem...
 527583 GtkAssistant should set buttons as default widget
 588484 Iconview DnD fails when Destination is empty

* Updated translations:
 Gujarati
 Hindi


Thanks to all contributors


Jul 18, 2009
Matthias Clasen


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