Re: Cross platform development

2017-03-18 Thread Tomas Hlavaty
"pelzflorian (Florian Pelz)" <pelzflor...@pelzflorian.de> writes:
> On 03/18/2017 08:41 AM, Tomas Hlavaty wrote:
>> nixos already supports cross-compilation using mingw out-of-the box.
> I did not know. Sounds interesting.

It also creates an $out directory with bin dir and symlinks for all
dependencies (exe and dll) which you can zip (or automate also zip) and
get a complete zip tarball.

> Your mail did not go to the list btw.

Thanks for letting me know.  Now it's there.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


questions about introspection

2015-08-25 Thread Tomas Hlavaty
Hi,

1) I have a pointer to gobject (say OBJ) which I got by calling
   Gtk.Builder.get_object on a UI built from a glade file.

   From that OBJ, how can I get a GIBaseInfo pointer (say CLS) which I
   could then use for other things, e.g. to call
   g_object_info_find_method?

   There are G_OBJECT_GET_CLASS or g_type_info_get_interface but I
   haven't found a way yet to achieve, what I need.

2) The class names in glade files are something like GtkButton.
   However, introspection splits that to Gtk (namespace) and Button
   (class).  Is there a function, which does this splitting into
   namespace and introspection class?

Thank you,

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


Re: GtkSearchEngineTracker

2010-12-08 Thread Tomas Bzatek
On Tue, 2010-12-07 at 22:02 +, Martyn Russell wrote:
 I have created a branch for the updated tracker backend used for 
 searching in the GtkFileChooser. Any comments?
 
http://git.gnome.org/browse/gtk+/log/?h=tracker-with-libtracker-sparql
 
 I blogged about it with a video to demonstrate the functionality:
 
http://blogs.gnome.org/mr/2010/12/07/gtksearchenginetracker/
 
 If no one objects I will merge this branch by the end of the week.

On the first sight it looks good. I'm for disabling FTS by default, it
makes people confused. Tried to convince people in bug 612725 [1] some
time ago. Perhaps the changes made to GtkSearchEngineTracker should be
backported to Nautilus so that users will get consistent experience. And
perhaps we could come up with an unified public class so that we stop
modifying two different places.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=612725
-- 
Tomas Bzatek tbza...@redhat.com



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


GTK deadlock in gtk_main

2010-08-03 Thread Tomas Soltys
Hi all,

I am not sure if this is a bug or just my misunderstanding of how the
synchronization is done in GTK.

Below is a simple test.c example in which the deadlock occurs.

Basically program deadlocks itself when idle_func is done and control is
returned to gtk_main.

Thanks for your help in advance,
Tomas


#include stdlib.h
#include glib.h
#include gtk/gtk.h
#include gdk/gdk.h

static GStaticMutex customMutex = G_STATIC_MUTEX_INIT;

static void custom_enter (void) {
g_print (LOCK\n);
g_static_mutex_lock (customMutex);
}

static void custom_leave (void) {
g_static_mutex_unlock (customMutex);
g_print (UNLOCK\n);
}

static gboolean on_delete_event (GtkWidget *widget,
 GdkEvent  *event,
 gpointer   user_data) {
gtk_widget_destroy (widget);
gtk_main_quit ();
return TRUE;
}

static gboolean idle_func (gpointer user_data) {
/* Do something */
g_print (IDLE start\n);
gtk_main_iteration_do (FALSE);
g_print (IDLE end\n);
return FALSE;
}

int main (int argc, char *argv[]) {
GtkWidget *window;

gdk_threads_set_lock_functions (custom_enter, custom_leave);
g_thread_init (NULL);
gdk_threads_init ();

gdk_threads_enter ();
gtk_init (argc, argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

g_signal_connect (G_OBJECT(window), delete-event,
  G_CALLBACK(on_delete_event),
  NULL);

g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, idle_func, NULL, NULL);

gtk_widget_show (window);

gtk_main ();

gdk_threads_leave ();

return EXIT_SUCCESS;
}

compile command: gcc test.c -o gtkTest `pkg-config --cflags --libs gtk+-2.0`
LINUX dist.: Fedora 13
GTK version: 2.20.1


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


Re: GTK deadlock in gtk_main

2010-08-03 Thread Tomas Soltys
Hi,

So what you suggest is to have gdk_threads_enter and gdk_threads_leave at
the beginning and at the end of the idle function?

Is this really intended?

Anyway, thanks for your help.

Regards,
Tomas

 Hi.

 You're having troubles because gtk_main_iteration_do() does it's own
 unlock/lock cycle.

 When your idle callback is executed, your mutex is unlocked.
 gtk_main_iteration_do() unlocks it again, executes whatever is there
 to be executed and locks it. Now control returns back to main loop,
 which tries to lock mutex and here you have your lock.

 Tadej

 --
 Tadej Borovšak
 tadeboro.blogspot.com
 tadeb...@gmail.com
 tadej.borov...@gmail.com



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


Re: GtkSearchEngine Tracker backend updates

2010-04-13 Thread Tomas Bzatek
On Tue, 2010-04-13 at 08:50 +0100, Martyn Russell wrote:
 On 13/04/10 00:34, Matthias Clasen wrote:
  On Mon, Apr 12, 2010 at 12:59 PM, Martyn Russellmar...@lanedo.com  wrote:
  Hi all,
 
  I have created a branch with some updates to support the new 0.9 branch and
  also to return results sorted much more accurately.
 
  Any problems with me committing this work:
 
http://git.gnome.org/browse/gtk+/log/?h=tracker-0.8
 
  It's the top 3 commits only.
 
  I don't speak sparql, so I can't really judge the query changes, but I
  very much welcome the tracker team taking an interest in the GTK+
  integration bits. Please merge those commits, if you are happy with
  them.
 
 Thanks Matthias, the SPARQL works, I tested with JHBuild using the 2.30 
 moduleset (watching tracker-store.log to make sure the new queries work).

Cool, thanks for working on this, the changes look good.

For the record, Nautilus shares most of the code
(libnautilus-private/nautilus-search-engine-tracker.c), it's somewhat
duplicated and slightly modified. Your changes are applicable there as
well (but please take bug 612725 in account).

And just to attract your attention, the following bug is related to
GtkFileChooser: https://bugzilla.gnome.org/show_bug.cgi?id=614971


Thanks,
-- 
Tomas Bzatek tbza...@redhat.com



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


Re: GtkNotebook scrolling usability

2010-03-11 Thread Tomas Bzatek
On Thu, 2010-03-11 at 10:16 +0100, Christian Dywan wrote:
 Using the mouse wheel that way in a web browser or text editor is a
 very convenient feature. It is much quicker than having to move the
 pointer to one of the sides only to switch tabs.
 
 Please don't break it just because you never used it :-)

I second that, this is highly addictive feature and I use it all the
time, mostly in web browser (Galeon).

I was waiting for a long time to finally see this feature in Qt.

Cheers,
-- 
Tomas Bzatek tbza...@redhat.com



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


GdkPixbuf animation

2010-02-02 Thread Tomas Soltys
Hi all,

I have noticed that there is a way to load an animation using
gdk_pixbuf_animation_new_from_file.

But is there a way to save already loaded/created animation to a file?

For example GdkPixbuf has a method gdk_pixbuf_save

Thanks in advance,

Tomas Soltys

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


setting the attachment point when adding one container to another

2009-10-28 Thread Tomas R
Hi,

First here is a small excerpt from my code:
http://pastebin.com/m31e6a3c8

The problem is that when text is set, the beginning of the text is
hidden instead of the ending. Here is a screen:
http://img39.imageshack.us/img39/4592/screenshot1tm.png

In this case I want that it would show Power Of instead of ower
Off. Now it cuts the beginning and I want that it would cut the ending.

Is it possible to do that without increasing the adjustment? The
viewport should be scrollable and workaround with initial adjustment
doesn't look good :|

Any help is really appreciated!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


[GTK BUG] Flickering in a gtk_socket

2009-10-23 Thread Tomas R
Writing here so that some gtk core dev would take a look at this
SERIOUS gtk bug:
https://bugzilla.gnome.org/show_bug.cgi?id=598050
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: setlocale gtk

2009-09-01 Thread Tomas Soltys
I forgot to write that this behaviour apply only on Windows not on Linux.

Cheers

Tomas Soltys

 Hi all,

 Recently I have ran into a problem with locale settings.

 1. I need my application to have disabled locale settings. This is mainly
 for the number representation.
 2. If I call gtk_disable_setlocale () then I will not get a modification
 time and date in a filechooser dialog.

 Is there a way how to get around this?

 Thanks

 Tomas Soltys

 ___
 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


setlocale gtk

2009-08-31 Thread Tomas Soltys
Hi all,

Recently I have ran into a problem with locale settings.

1. I need my application to have disabled locale settings. This is mainly
for the number representation.
2. If I call gtk_disable_setlocale () then I will not get a modification
time and date in a filechooser dialog.

Is there a way how to get around this?

Thanks

Tomas Soltys

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


Re: GZip{In,Out}putStream in GIO?

2009-08-03 Thread Tomas Bzatek
On Mon, 2009-08-03 at 07:58 -0400, Freddie Unpenstein wrote:
 From: Steve Fr-23;cinaux, Date: 03/08/2009 19:38, Wrote:
 
  Bastien Nocera wrote:
   I could think of at least 5 types of compressions that would be
 useful
   to have without having to use a command-line tool to decompress:
   - gzip for anything and everything that can come from a web server
 (in
   my case, iTunes Music Store playlist parsing, or more widely,
 GOffice
   file formats)
   - zip for OpenOffice.org documents and Comic Books (evince)
   - 7zip/LZMA/Xz formats for Comic Books
   - Rar for the same as above
  Aren't there two classes of file types there ? Compression vs
 Archiving
 
 Archiving formats would be better supported by GVFS, wouldn't they...?
 Treating an archive as a virtual directory.
 
 However, zip has a few compression formats, rar compression can be
 applied both before and after bundling of the files (a rar solid
 archive is similar to a tar.gz archive). There may be some value to
 supporting those compression formats even without supporting the
 entire archive format. The compression is pretty much the hard part of
 handling these archives.
 
 
 Going the extra step further, though, the next obvious idea would be
 to do the same thing that gunzip does when you concatenate together a
 series of gzipped files - it simply returns the uncompressed content
 of each file sequentially.
 
 I guess, though, you still need to understand the archive format, for
 at least some of those formats. So I suppose some kind of archive
 handler would be needed to pick out the individual streams for
 concatenation. Given that, reading a zip file as a compressed stream
 could instantiate a concatenation object that sets up the appropriate
 archive handler and just iterates over the available files, joining
 the uncompressed data of each individual decompression stream together
 as a single continuous stream. Which would give you the option to set
 up the archive handler yourself and extract the one(s) you want
 individually. This would be a boon even for gzipped files, giving you
 the option to extract concatenated compressed streams individually
 rather than as a solid indistinguishable stream.
 
 The ability to manipulate archives as well as simple compression would
 be fantastic. I did at one stage need to apply a filter to the files
 matching a certain mask within a tgz archive. With support like that,
 I could uncompress the tgz, split the tar, pass through files I'm not
 interested in, apply the filtering to the ones I am, and then
 repackage and re-compress the lot on the way out, without having to
 mess around with spawning external commands and correctly handling the
 myriad of things that can go wrong.
 


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


Re: GZip{In,Out}putStream in GIO?

2009-08-03 Thread Tomas Bzatek
On Mon, 2009-08-03 at 07:58 -0400, Freddie Unpenstein wrote:
 Archiving formats would be better supported by GVFS, wouldn't they...?
 Treating an archive as a virtual directory.

We already have gvfsd-archive for some time, based on libarchive, able
to handle TAR and ZIP archiving formats with GZIP, BZ2 compression,
easily extendable to LZMA and XZ (available from libarchive, not yet
enabled by default in gvfs).

 However, zip has a few compression formats, rar compression can be
 applied both before and after bundling of the files (a rar solid
 archive is similar to a tar.gz archive).

Remember we can't build anything around RAR format due to incompatible
licensing, except of the file-roller way (spawning external commands).

 I guess, though, you still need to understand the archive format, for
 at least some of those formats. So I suppose some kind of archive
 handler would be needed to pick out the individual streams for
 concatenation. Given that, reading a zip file as a compressed stream
 could instantiate a concatenation object that sets up the appropriate
 archive handler and just iterates over the available files, joining
 the uncompressed data of each individual decompression stream together
 as a single continuous stream. Which would give you the option to set
 up the archive handler yourself and extract the one(s) you want
 individually. This would be a boon even for gzipped files, giving you
 the option to extract concatenated compressed streams individually
 rather than as a solid indistinguishable stream.

libarchive can be easily used as a filter between two streams,
transparently decoding incoming data. This should be really implemented
as an extension, we don't want to have another dependency in glib.


P.S.: sorry for the previous empty e-mail, key shortcuts are sometimes
dangerous in Evolution...
-- 
Tomas Bzatek tbza...@redhat.com



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


Re: Embed theme with a gtk app?

2009-01-29 Thread Tomas Soltys
Yes there is a way.

Here is how I have done it.

gchar *rc_files[] = { path to your rc file, NULL};
gtk_rc_set_default_files (rc_files);

Regards,

Tomas Soltys

 Is there any way to either embed or make a gtk program load a theme
 that comes with the program, without the user having to install
 anything else. I have some programs mainly for windows that look like
 absolute rubbish when on the default theme, but alot of my users on
 the windows version have the DLL's all over the place.
 ___
 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


WIN32: Spawning a command-line process

2009-01-27 Thread Tomas Soltys
Hi,

I am writing a GUI application which executes a command-line executable
and reads its output from stdout.
For this I am using function g_spawn_async_with_pipes.

If command-line program is linked with -mswindows then everything works
fine, but I can not execute prog in command line. Stdout is lost.
So -mswindows is not an option.

Does anybody have an idea how to solve this problem?

Thanks.

Tomas Soltys

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


Re: An 'oldie' question... GtkCList anyone?

2009-01-27 Thread Tomas Soltys
Hi,

try to declare str as:

  char *str[4];

Regards,

Tomas

 Hello people.

 In the process of converting an old program from mSQL to MySQL, I found a
 couple of potential traps and optimized a couple of functions. I now have
 a problem with adding lines into a GtkCList using gtk_clist_append. The
 code is like this:

 char *bff, str[4];

 bff = strdup(abc|def|ghi|etc); Just to show bff has to freed later
 splitline(bff, str);  This puts pointers into str to each of
   the substrings (at the start and
   after each |, converting them to \0 )
 gtk_clist_append(clist, str); Add the line,
 g_free(bff);

 It looks as if the g_free happens before the append, because gibberish
 appears on the screen.

 Is there a way to assure the append is finished before the g_free?

 John
 ___
 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: An 'oldie' question... GtkCList anyone?

2009-01-27 Thread Tomas Soltys
Hi,

try to declare str as:

  char *str[4];

Regards,

Tomas

 Hello people.

 In the process of converting an old program from mSQL to MySQL, I found a
 couple of potential traps and optimized a couple of functions. I now have
 a problem with adding lines into a GtkCList using gtk_clist_append. The
 code is like this:

 char *bff, str[4];

 bff = strdup(abc|def|ghi|etc); Just to show bff has to freed later
 splitline(bff, str);  This puts pointers into str to each of
   the substrings (at the start and
   after each |, converting them to \0 )
 gtk_clist_append(clist, str); Add the line,
 g_free(bff);

 It looks as if the g_free happens before the append, because gibberish
 appears on the screen.

 Is there a way to assure the append is finished before the g_free?

 John
 ___
 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


GtkFileChooserDialog position

2008-10-16 Thread Tomas Soltys
Hi,

I have a question about positioning of the file-chooser dialog.
The position of the dialog is not correct. I'm using the latest stable
version of GTK 2.14.3. The code is compiled on win32.

--- CODE --

GtkWidget *dialog;

dialog = gtk_file_chooser_dialog_new (Open File,
  parent_window,
  GTK_FILE_CHOOSER_ACTION_OPEN,
  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
  GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
  NULL);

if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
  {
char *filename;

filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
open_file (filename);
g_free (filename);
  }

gtk_widget_destroy (dialog);

---

Result is that the dialog is moved towards the lower left corner. It seems
to me that the size of the window is not correct. Could it be?

Can someone explain me why is this happening.

Regards,
Tomas Soltys

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


Re: glib-2.81 /live-g-file/test_copy_move failed

2008-09-18 Thread Tomas Bzatek
Can you please let us know more? I.e. what operating system you run and
which filesystem are the glib sources on.

And in order to track this issue, can you please file a bug at
http://bugzilla.gnome.org/

Also, the live-g-file test is a standalone executable with several
options (posix tests, ...), you might want to experiment a little bit.

-- 
Tomas Bzatek [EMAIL PROTECTED]


On Thu, 2008-09-18 at 12:56 +0200, Klaus Dittrich wrote:
 make check results :
 
 
 /live-g-file/test_copy_move:
 do_copy_move: 'dir1/subdir' -- 'dir-target'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir1/subdir' -- '.'
res = 0, error code 2 = Target file exists
 do_copy_move: 'dir1/subdir' -- 'target-file'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir1/subdir' -- 'not_exists'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir1/subdir' -- 'dir_no-access'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir1/subdir' -- 'dir_no-write'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir2' -- 'dir-target'
 do_copy_move: 'dir-target' -- 'dir-target'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir-target' -- '.'
res = 0, error code 2 = Target file exists
 do_copy_move: 'dir-target' -- 'target-file'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir-target' -- 'not_exists'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir-target' -- 'dir_no-access'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'dir-target' -- 'dir_no-write'
res = 0, error code 25 = Can't recursively copy directory
 do_copy_move: 'target-file' -- 'dir-target'
 do_copy_move: 'target-file' -- '.'
res = 0, error code 2 = Error opening file 
 '/mnt/md0/sources/glib-2.18.1/gio/tests/testdir_live-g-file/target-file': 
 File exists
 do_copy_move: 'target-file' -- 'target-file'
res = 0, error code 4 = Error opening file 
 '/mnt/md0/sources/glib-2.18.1/gio/tests/testdir_live-g-file/target-file/target-file':
  
 Not a directory
 do_copy_move: 'target-file' -- 'not_exists'
res = 0, error code 1 = Error opening file 
 '/mnt/md0/sources/glib-2.18.1/gio/tests/testdir_live-g-file/not_exists/target-file':
  
 No such file or directory
 do_copy_move: 'target-file' -- 'dir_no-access'
 **
 ERROR:live-g-file.c:702:do_copy_move: assertion failed (res == FALSE): 
 (1 == 0)
 FAIL
 
 Any idea what went wrong? Possibly on my side.
 --
 Klaus
 ___
 gtk-devel-list mailing list
 gtk-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-devel-list

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


GLib - Spawning Processes

2008-09-09 Thread Tomas Soltys

Hi all,

I have spent some time trying to create an application that would use GLib 
to spawn a process. The function I want to use is 
g_spawn_async_with_pipes. The following code is just simplified version of 
the real one, but the behavior is the same. On Linux it works but on the 
Windows it gives following error:


- output -
Command: C:\Windows\notepad.exe
Failed to execute helper program (Invalid argument)
Press any key to continue . . .
- output -

Thanks for help.

- spawn.c -

#include stdio.h
#include stdlib.h
#include glib.h

static void watch_pid (GPid pid, gint status, gpointer data);

static GMainLoop* main_loop;

int main (int argc, char *argv[]) {
 GPid pid;
 GError *error = NULL;
 gboolean status;
 gchar *args[2];

 args[0] = g_build_filename (C:, Windows, notepad.exe, NULL);
 args[1] = NULL;

 status = g_spawn_async_with_pipes ( NULL,
 args,
 NULL,
 G_SPAWN_DO_NOT_REAP_CHILD,
 NULL,
 NULL,
 pid,
 NULL,
 NULL,
 NULL,
 error);

 g_print (Command: %s\n, args[0]);
 if (status == FALSE) {
   g_print (%s\n, error-message);
   g_free (args[0]);

   system(PAUSE);

   return EXIT_FAILURE;
 }

 g_child_watch_add (pid, watch_pid, (gpointer)args[0]);
 main_loop = g_main_loop_new (NULL, FALSE);
 g_main_loop_run (main_loop);

 g_free (args[0]);

 system(PAUSE);

 return EXIT_SUCCESS;
}

static void watch_pid (GPid pid, gint status, gpointer data) {
 char *cmd = (char *)data;

 if (status != 0) {
   /* error */
   g_print (Command \'%s\' failed\n, cmd);
 }
 else {
   /* success */
   g_print (Command \'%s\' exited\n, cmd);
 }
 g_spawn_close_pid(pid);

 g_main_loop_quit (main_loop);
}

- spawn.c - 


___
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 set the font's size of the GtkLabel?

2008-08-28 Thread Tomas Carnecky
Dov Grobgeld wrote:
 Hi Lazy (great name),
 
 The way to do it is to set the name of the label through:
 
 gtk_widget_set_name(label, foo);
 
 and then define a style for the name foo, that includes a font
 specification:
 
 gtk_rc_parse_string(style \foo\ {\n
   font = \Serif 32\\n
   }\n
   );
 

Ugh, that's complicated. An easier way is:

GtkLabel *label = gtk_label_new();
gtk_label_set_markup(label, span font_desc=\10.0\This is a
label/span);

See http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html
how to use the pango markup language.

 
 2008/8/28 Lazy Fox [EMAIL PROTECTED]
 
 I wrote the following statememts to set a GtkLabel's font size.
 But it seems don't work?
 I'm not good at Pango, can anybody help me?

 +---
 | PangoAttrList *pg_attr_list = pango_attr_list_new();
 | PangoAttribute *pg_attr = pango_attr_size_new(10);
 |
 | label = gtk_label_new(This is a label);
 | pango_attr_list_change(pg_attr_list, pg_attr);
 | gtk_label_set_attributes(GTK_LABEL(label), pg_attr_list);

 +--

 ___
 gtk-list mailing list
 [EMAIL PROTECTED]
 http://mail.gnome.org/mailman/listinfo/gtk-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: How to set the font's size of the GtkLabel?

2008-08-28 Thread Tomas Carnecky
Dov Grobgeld wrote:
 Hi Lazy (great name),
 
 The way to do it is to set the name of the label through:
 
 gtk_widget_set_name(label, foo);
 
 and then define a style for the name foo, that includes a font
 specification:
 
 gtk_rc_parse_string(style \foo\ {\n
   font = \Serif 32\\n
   }\n
   );
 

Ugh, that's complicated. An easier way is:

GtkLabel *label = gtk_label_new();
gtk_label_set_markup(label, span font_desc=\10.0\This is a
label/span);

See http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html
how to use the pango markup language.

 
 2008/8/28 Lazy Fox [EMAIL PROTECTED]
 
 I wrote the following statememts to set a GtkLabel's font size.
 But it seems don't work?
 I'm not good at Pango, can anybody help me?

 +---
 | PangoAttrList *pg_attr_list = pango_attr_list_new();
 | PangoAttribute *pg_attr = pango_attr_size_new(10);
 |
 | label = gtk_label_new(This is a label);
 | pango_attr_list_change(pg_attr_list, pg_attr);
 | gtk_label_set_attributes(GTK_LABEL(label), pg_attr_list);

 +--

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


 ___
 gtk-app-devel-list mailing list
 [EMAIL PROTECTED]
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 

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


Re: returning a string to d-bus

2008-08-06 Thread Tomas Carnecky

Luka Napotnik wrote:

Hello.

I have a D-BUS listener with a GObject method which should send a string
back to D-BUS. My d-bus listener method is:

gboolean
some_object_get_name(GObject *object, gchar *str, GError **error)
{
str = g_strdup(Hello);
return TRUE;
}

But when the client connect to this d-bus interface and calls the
get_name() method, the method doesn't return the string. I'm guessing
I'm passing the string the wrong way. Please help.


You probably want:

gboolean
some_object_get_name(GObject *object, gchar **str, GError **error)
{
*str = g_strdup(Hello);
return TRUE
}

and call that function this way:

gchar *str = NULL;
if (some_object_get_name(object, str, error) == TRUE)
gprintf(name: %s\n, str);
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Finding a widget in a Glade interface

2008-07-31 Thread Tomas Carnecky

dhk wrote:

Tristan Van Berkom wrote:
On Wed, Jul 30, 2008 at 3:40 PM, Tristan Van Berkom [EMAIL PROTECTED] 
wrote:

for future reference, this could easily have been pulled out
of the docs/header files: glade_xml_get_widget()

type libglade and feel lucky its right there.


oops, I obviously meant in google here...


I should have mentioned that by time I want to call
glade_xml_get_widget() the GladeXML *xml created by xml =
glade_xml_new(filename.glade, NULL, NULL); is out of scope.  If I call
 open the file again to get the widget it has no affect on the running
window.  I need to get the widget from the running window from some
callback.  Any ideas?


Make 'GladeXML *xml' static or otherwise accessible from all parts of 
the sourcecode.


tom

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


Re: Profiler for GTK+

2008-07-21 Thread Tomas Carnecky

Vinod Alat wrote:

Can anyone suggest me a profiler that shows the CPU time used by
functions in code accumulating the time used in the functions that it
calls (from GTK+ or application), which will help determine what
functions of code take the most time to fulfill, I want to see what
functions of GTK+ are slowing down the application and see if I can
optimize that
functions in GTK+ itself.


gprof or oprofile

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


Re: Callback Parameters are Switched

2008-07-21 Thread Tomas Carnecky

dhk wrote:
I'm using glade for a front end which has a button that when clicked 
passes a notebook as the user_data to the callback.


I'm using the gdb debugger to look at the two parameters in the callback 
and they are switched.  The first parameter, the button, is the notebook 
object and the second parameter, the user_data, is the button object. If 
I don't use user_data in Glade the parameter are correct, the first is 
the button and the second is NULL.


Why is this happening?


http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-connect-swapped

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


Re: Callback Parameters are Switched

2008-07-21 Thread Tomas Carnecky

dhk wrote:

Tomas Carnecky wrote:

dhk wrote:
I'm using glade for a front end which has a button that when clicked 
passes a notebook as the user_data to the callback.


I'm using the gdb debugger to look at the two parameters in the 
callback and they are switched.  The first parameter, the button, is 
the notebook object and the second parameter, the user_data, is the 
button object. If I don't use user_data in Glade the parameter are 
correct, the first is the button and the second is NULL.


Why is this happening?


http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-connect-swapped 

Ok, I think that explains it, but how was I suppose to know that was 
happening?  . . . and what is the purpose in swapping the parameters? 
Why do that?


There are circumstances where swapping the params is useful. But I have 
no idea why glade does it automatically for you.


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


Re: newbie Question

2008-07-16 Thread Tomas Carnecky
These questions were just examples. Have you read gtk tutorials? Have 
you looked at the gtk examples? Do you know how the glib object system 
(gobject) works? Have you even started writing the code? I doubt it. 
Don't ask the question unless you actually need the answers. When you 
start writing the code other problems will come up, much simpler 
problems. And you'll have to ask much simpler questions. The two 
questions I took as an example are quite advanced ones, you'll need to 
ask those after you have figured out the UI layout and code for it written.


tom

Craig Petty wrote:

how to list available wireless networks and create a custom widget?



--- On Tue, 7/15/08, Tomas Carnecky [EMAIL PROTECTED] wrote:


From: Tomas Carnecky [EMAIL PROTECTED]
Subject: Re: newbie Question
To: [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Date: Tuesday, July 15, 2008, 11:40 AM
Craig Petty wrote:

How would i make a gtk+ for a wireless networking?

First read gtk tutorials. Then compile, run and modify some
gtk samples, 
just so you get into how gtk works. Then you can read the
sourcecode of 
other gtk applications to understand how a 'big'
application is 
structured. And then, if you have a specific question about
for example 
how to create a custom widget, or how to list available
wireless 
networks, you can get back to this mailinglist and ask it.


tom



  
___

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: newbie Question

2008-07-15 Thread Tomas Carnecky

Craig Petty wrote:

How would i make a gtk+ for a wireless networking?


First read gtk tutorials. Then compile, run and modify some gtk samples, 
just so you get into how gtk works. Then you can read the sourcecode of 
other gtk applications to understand how a 'big' application is 
structured. And then, if you have a specific question about for example 
how to create a custom widget, or how to list available wireless 
networks, you can get back to this mailinglist and ask it.


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


Re: font size gtk_*_new_with_label

2008-07-13 Thread Tomas Carnecky

Luis Ariel Lecca wrote:

Hi All ! I will appreciate very much any help :)

I'm using 

gtk_widget_modify_font()  and 


style = gtk_rc_style_new();
pango_font_description_free( style-font_desc );
style-font_desc = pfont;
gtk_widget_modify_style( widget, style );

to change the font size of my labels, but I can't do it on created
buttons with gtk_*_new_with_label() and neither in my statusbar.

I couldn't find any example on the net. I understand that I dont have the 
reference to the labels... , but when gtk refresh the screen needs the 
reference to the labels...

So how to get the reference pointer or directly how to change the font size on 
these objects ?

I have custom labels with my widgets...
Now, I'd rather change as less as possible the Glade code (Glade use 
_with_label in generation code).
I think that would be better using with_label than a custom button (I'm not 
completetly sure about it on gtk).

Could any body give me some help about this problem? I need to solve it



Why don't you use pango markup?

button = gtk_button_new();
label = gtk_label_new();
gtk_label_set_markup(GTK_LABEL(label), span size='large'A/span);
gtk_container_add(GTK_CONTAINER (button), label);

tom


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


Re: [compiz] color management spec

2008-06-10 Thread Tomas Carnecky
Added gtk-devel-list@gnome.org to hear their opinion about this matter. 
For reference, this is what I proposed:

http://lists.freedesktop.org/archives/xorg/2008-May/035772.html

Danny Baumann wrote:

Hi,
 
I strongly dislike supporting subwindow ID/profile tuples. 
The task of 
window and compositing managers is and always has been to 
manage and 
draw _toplevel_ windows, not subwindows. I don't really think that 
adding a subwindow management infrastructure to compositing 
managers 
just for saving some lines of code in the toolkit (and not 
even all of 

them) is an overly good idea.
It's not just for 'saving some lines of code in the toolkit'. 
Color management would require significantly more code in the 
toolkit and would most likely be slower then if it is done in 
the compositing manager.


I was just talking about communicate using subwindow id/profile tuples vs.
communicate using toplevel window region/profile tuples. The former would
save a bit of code in the toolkit, but would complicate compositing managers
significantly; which is why I strongly prefer the latter.


The compositing manager would never actually draw subwindows, just 
merely use them to identify regions.


When using properties on the top level window, the toolkit would have to 
explicitly update those whenever the window is resized. But when using 
subwindows, the toolkit (at least gtk) wouldn't have to do anything 
special. In gtk, each widget that uses a subwindow resizes it when the 
top level window is resized. The compositing manager would just 
subscribe to ConfigureNotify events of the subwindows and be done.


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


Re: glib and Xlib

2008-06-06 Thread Tomas Carnecky
jaafar EL GONNOUNI wrote:
 Hello;
 
 What is *glib *adding that the GTK + compared to *Xlib *?
 
 All what is possible with glib with Xlib is feasible, then why create a new
 library.

 From http://library.gnome.org/devel/glib/stable/glib.html :

GLib is a general-purpose utility library, which provides many useful 
data types, macros, type conversions, string utilities, file utilities, 
a main loop abstraction, and so on. It works on many UNIX-like 
platforms, Windows, OS/2 and BeOS. GLib is released under the GNU 
Library General Public License (GNU LGPL).


 From http://tronche.com/gui/x/xlib/introduction/ :

The X Window System is a network-transparent window system that was 
designed at MIT. X display servers run on computers with either 
monochrome or color bitmap display hardware. The server distributes user 
input to and accepts output requests from various client programs 
located either on the same machine or elsewhere in the network. Xlib is 
a C subroutine library that application programs (clients) use to 
interface with the window system by means of a stream connection. 
Although a client usually runs on the same machine as the X server it is 
talking to, this need not be the case.


I hope you can see the difference.

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


Re: glib and Xlib

2008-06-06 Thread Tomas Carnecky
jaafar EL GONNOUNI wrote:
 Hello;
 
 What is *glib *adding that the GTK + compared to *Xlib *?
 
 All what is possible with glib with Xlib is feasible, then why create a new
 library.

 From http://library.gnome.org/devel/glib/stable/glib.html :

GLib is a general-purpose utility library, which provides many useful 
data types, macros, type conversions, string utilities, file utilities, 
a main loop abstraction, and so on. It works on many UNIX-like 
platforms, Windows, OS/2 and BeOS. GLib is released under the GNU 
Library General Public License (GNU LGPL).


 From http://tronche.com/gui/x/xlib/introduction/ :

The X Window System is a network-transparent window system that was 
designed at MIT. X display servers run on computers with either 
monochrome or color bitmap display hardware. The server distributes user 
input to and accepts output requests from various client programs 
located either on the same machine or elsewhere in the network. Xlib is 
a C subroutine library that application programs (clients) use to 
interface with the window system by means of a stream connection. 
Although a client usually runs on the same machine as the X server it is 
talking to, this need not be the case.


I hope you can see the difference.

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


Re: The core of GTK++

2008-05-29 Thread Tomas Carnecky
jaafar EL GONNOUNI wrote:
 Good morning;
 
 What are the source files that formed the *core *of GTK++ ?

How do you define the core? What belongs to your 'core'?

 
 *According to my research I found the following files :
 
 *  gtkobject.c / gtkobject.h
   gtkwidget.c / gtkwidget.h
   gtkcontainer.c / gtkcontainer.h
   gtkmain.c / gtkmain.h
   gtksignal.c / gtksignal.h
   gtktypeutils.c / gtktypeutils.h
   gtkdata.c / gtkdata.h
 
 Can you confirm this ?

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


Re: The core of GTK++

2008-05-29 Thread Tomas Carnecky
jaafar EL GONNOUNI wrote:
 Good morning;
 
 What are the source files that formed the *core *of GTK++ ?

How do you define the core? What belongs to your 'core'?

 
 *According to my research I found the following files :
 
 *  gtkobject.c / gtkobject.h
   gtkwidget.c / gtkwidget.h
   gtkcontainer.c / gtkcontainer.h
   gtkmain.c / gtkmain.h
   gtksignal.c / gtksignal.h
   gtktypeutils.c / gtktypeutils.h
   gtkdata.c / gtkdata.h
 
 Can you confirm this ?

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


Re: GtkContainer problems

2008-04-29 Thread Tomas Carnecky
AlannY wrote:
 Hello.
 
 I'm writing a custom widget. It's inherits from GtkContainer. So:
 
 typedef struct _MyWidgetMyWidget;
 typedef struct _MyWidgetClass   MyWidgetClass;
 
 struct _MyWidget
 {
GtkContainer parent;
 };
 
 struct _MyWidgetClass
 {
GtkContainerClass parent_class;
 };
 
 I'm wrote a small test program:
 
 [...]
 mywidget = mywidget_new ();

Where is this function defined? How does that function look? Post _all_ 
code for MyWidget and not just the parts you think are important.

 gtk_container_add (GTK_CONTAINER (mywidget), button);
 [...]
 
 But I got a message:
 
 Gtk-CRITICAL **: gtk_container_add: assertion `GTK_IS_CONTAINER 
 (container)' failed
 
 Why?

tom


-- 
So Long, and Thanks for All the Fish
___
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 put widget in CUSTOM GtkContainer

2008-04-29 Thread Tomas Carnecky
AlannY wrote:
 Hi there, my name is Alan and I have some troubles with GtkContainer.
 
 It's about 2 days, I already have spent trying to solve it, but I (i 
 guess) can't.
 
 I'm writing a program, which looks like:
 +-+
 | Main Window (GtkWindow) |
 | +-+ |
 | | My custom widget| |
 | | +-+ | |
 | | | GtkButton   | | |
 | | +-+ | |
 | +-+ |
 +-+
 
 I need some approach to place a GtkButton in my custom widget. I found 
 (from GTK+ sources) that GtkTreeView, GtkNotebook (and others) inherits 
 from GtkContainer . So, I decide to inherit my widget not from 
 GtkWidget, but from GtkContainer.
 
 typedef struct _GridGrid;
 typedef struct _GridClass   GridClass;
 
 struct _Grid
 {
GtkContainer parent;
 };
 
 struct _GridClass
 {
GtkContainerClass parent_class;
 };
 
 And my _get_type function looks like:
 
 GtkType
 grid_get_type ()
 {
static GtkType grid_type = 0;
 
if (!grid_type)
  {
const GTypeInfo object_info =
{
   sizeof (GtkContainerClass),
   NULL,
  NULL,
   (GClassInitFunc) grid_class_init,

That still isn't the whole code! What does grid_class_init() do? Attach 
both the whole grid header and source file to the email.

   NULL,
   NULL,
   sizeof (Grid),
   0,
   (GInstanceInitFunc) grid_init,
   NULL,
};
 
grid_type = g_type_register_static (GTK_TYPE_CONTAINER, 
 g_intern_static_string (Grid), object_info, 0);
  }
 
return grid_type;
 }
 
 The main feature of this function is GTK_TYPE_CONTAINER ;-) You see ;-)
 
 Next in my program, I'm creating my widget (grid) with that:
 
 [...]
 grid = grid_new ();
 gtk_container_add (GTK_CONTAINER (window), grid);
 [...]
 
 So, my problem starts here: at _new() function. I want to create 
 GtkButton and place it in my widget.
 
 GtkWidget*
 grid_new ()
 {
Grid *grid;
 
grid = g_object_new (grid_get_type (), NULL);
 
button = gtk_button_new_with_label (Test);
gtk_widget_set_parent (button, GTK_WIDGET (grid));
gtk_widget_show (button);
 
return GTK_WIDGET (grid);
 }
 
 Everything right and works without errors ;-) But nothing happens. I 
 can't see a GtkButton ;-)
 
 How to solve it? I need some way for draw (expose) GtkButton in my 
 custom widget ;-) How to do it?
 
 P.S. I extremely think, that I just forgot something. But there are no 
 tutorials about it ;-) Information vacuum, so I decide to ask in 
 mailing-lists.
 P.P.S. Only information about custom widget creation is a GTK sources, 
 but (even with it) I can't solve my problem. ;-)
 P.P.P.S. Also, I really want to understand how GtkBox works ;-)

And stop creating new threads... This is your third thread in 
gtk-app-devel where you ask the same question.

tom

___
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 put widget in CUSTOM GtkContainer

2008-04-29 Thread Tomas Carnecky
AlannY wrote:
 Tomas Carnecky wrote:
 AlannY wrote:
 That still isn't the whole code! What does grid_class_init() do? Attach 
 both the whole grid header and source file to the email.
 
 /* ** */
 
 static void
 grid_class_init (GridClass *class)
 {
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
 
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
 
parent_class = gtk_type_class (gtk_widget_get_type ());
 
object_class-destroy = grid_destroy;
 
widget_class-realize = grid_realize;
widget_class-expose_event = grid_expose;

here you have to set GtkContainerClass-add, remove, forall and 
child_type. See 
http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/gtkbin.c?revision=19491view=markup
 
as an example of a widget that derives from GtkContainer.

 }
 
 /* ** */
 static void
 grid_init (Grid *grid)
 {
 }
 
 /* ** */
 static void
 grid_realize (GtkWidget *widget)
 {
Grid *grid;
GdkWindowAttr attributes;
gint attributes_mask;
 
g_return_if_fail (widget != NULL);
g_return_if_fail (IS_GRID (widget));
 
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
grid = GRID (widget);
 
attributes.x = widget-allocation.x;
attributes.y = widget-allocation.y;
attributes.width = widget-allocation.width;
attributes.height = widget-allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) | 
 GDK_EXPOSURE_MASK;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
 
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget-window = gdk_window_new (widget-parent-window, attributes, 
 attributes_mask);
 
widget-style = gtk_style_attach (widget-style, widget-window);
 
gdk_window_set_user_data (widget-window, widget);
 
gtk_style_set_background (widget-style, widget-window, 
 GTK_STATE_ACTIVE);
 }
 
 /* ** */
 static gboolean
 grid_expose (GtkWidget *widget,
   GdkEventExpose *event)
 {
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (IS_GRID (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
 
if (event-count  0)
  return FALSE;
 
return FALSE;
 }
 
 /* ** */
 static void
 grid_destroy (GtkObject *object)
 {
g_return_if_fail (object != NULL);
g_return_if_fail (IS_GRID (object));
 
if (GTK_OBJECT_CLASS (parent_class)-destroy)
  (* GTK_OBJECT_CLASS (parent_class)-destroy) (object);
 }
 
 /* ** */
 
 That's all I have ;-)
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 


-- 
So Long, and Thanks for All the Fish
___
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 put widget in CUSTOM GtkContainer

2008-04-29 Thread Tomas Carnecky
AlannY wrote:
  Tomas Carnecky wrote:
  here you have to set GtkContainerClass-add, remove, forall and
  child_type. See
  
http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/gtkbin.c?revision=19491view=markup
 

  as an example of a widget that derives from GtkContainer.
 
  Since now, Yes ;-) I have ;-) But nothing changes ;-)
 

It's mighty difficult to help you. You still haven't showed us something 
that compiles, something we could run and test ourselves...

tom
___
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 put widget in CUSTOM GtkContainer

2008-04-29 Thread Tomas Carnecky
AlannY wrote:
 Hi there, my name is Alan and I have some troubles with GtkContainer.
 
 It's about 2 days, I already have spent trying to solve it, but I (i 
 guess) can't.
 
 I'm writing a program, which looks like:
 +-+
 | Main Window (GtkWindow) |
 | +-+ |
 | | My custom widget| |
 | | +-+ | |
 | | | GtkButton   | | |
 | | +-+ | |
 | +-+ |
 +-+
 
 I need some approach to place a GtkButton in my custom widget. I found 
 (from GTK+ sources) that GtkTreeView, GtkNotebook (and others) inherits 
 from GtkContainer . So, I decide to inherit my widget not from 
 GtkWidget, but from GtkContainer.
 
 typedef struct _GridGrid;
 typedef struct _GridClass   GridClass;
 
 struct _Grid
 {
GtkContainer parent;
 };
 
 struct _GridClass
 {
GtkContainerClass parent_class;
 };
 
 And my _get_type function looks like:
 
 GtkType
 grid_get_type ()
 {
static GtkType grid_type = 0;
 
if (!grid_type)
  {
const GTypeInfo object_info =
{
   sizeof (GtkContainerClass),
   NULL,
  NULL,
   (GClassInitFunc) grid_class_init,

That still isn't the whole code! What does grid_class_init() do? Attach 
both the whole grid header and source file to the email.

   NULL,
   NULL,
   sizeof (Grid),
   0,
   (GInstanceInitFunc) grid_init,
   NULL,
};
 
grid_type = g_type_register_static (GTK_TYPE_CONTAINER, 
 g_intern_static_string (Grid), object_info, 0);
  }
 
return grid_type;
 }
 
 The main feature of this function is GTK_TYPE_CONTAINER ;-) You see ;-)
 
 Next in my program, I'm creating my widget (grid) with that:
 
 [...]
 grid = grid_new ();
 gtk_container_add (GTK_CONTAINER (window), grid);
 [...]
 
 So, my problem starts here: at _new() function. I want to create 
 GtkButton and place it in my widget.
 
 GtkWidget*
 grid_new ()
 {
Grid *grid;
 
grid = g_object_new (grid_get_type (), NULL);
 
button = gtk_button_new_with_label (Test);
gtk_widget_set_parent (button, GTK_WIDGET (grid));
gtk_widget_show (button);
 
return GTK_WIDGET (grid);
 }
 
 Everything right and works without errors ;-) But nothing happens. I 
 can't see a GtkButton ;-)
 
 How to solve it? I need some way for draw (expose) GtkButton in my 
 custom widget ;-) How to do it?
 
 P.S. I extremely think, that I just forgot something. But there are no 
 tutorials about it ;-) Information vacuum, so I decide to ask in 
 mailing-lists.
 P.P.S. Only information about custom widget creation is a GTK sources, 
 but (even with it) I can't solve my problem. ;-)
 P.P.P.S. Also, I really want to understand how GtkBox works ;-)

And stop creating new threads... This is your third thread in 
gtk-app-devel where you ask the same question.

tom

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


Re: Simple Questions.

2008-04-19 Thread Tomas Carnecky
Schumi Imor wrote:
 I'm thinking of using GTK+ for one of my projects and I'm really impressed
 with the level of support and example code out there. But what I haven't
 been able to find is how to create an application without a frame (no name,
 no close, no maximize, no edges). Any help or example code would be
 appreciated...

http://library.gnome.org/devel/gtk/stable/GtkWindow.html#gtk-window-set-decorated

tom
___
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 find out what is the gtk development version?

2008-04-10 Thread Tomas Carnecky
ying lcs wrote:
 On Thu, Apr 10, 2008 at 11:12 AM, Kevin DeKorte [EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1


  ying lcs wrote:
  | Hi,
  |
  | How can I find out what is the gtk development version that I am using
  on linux?


  ~ pkg-config --modversion gtk+-2.0


  Should give you the version

  Kevin

 
 Thanks you. I just did it, but I get:
 
 # pkg-config --modversion gtk+2.0
 Package gtk+2.0 was not found in the pkg-config search path.
 Perhaps you should add the directory containing `gtk+2.0.pc'
 to the PKG_CONFIG_PATH environment variable
 No package 'gtk+2.0' found
 
 But I am running gnome, so I must have gtk+.
 
 Is that a setting issue?

Do you have the -devel package installed?

tom
___
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 find out what is the gtk development version?

2008-04-10 Thread Tomas Carnecky
ying lcs wrote:
 On Thu, Apr 10, 2008 at 11:12 AM, Kevin DeKorte [EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1


  ying lcs wrote:
  | Hi,
  |
  | How can I find out what is the gtk development version that I am using
  on linux?


  ~ pkg-config --modversion gtk+-2.0


  Should give you the version

  Kevin

 
 Thanks you. I just did it, but I get:
 
 # pkg-config --modversion gtk+2.0
 Package gtk+2.0 was not found in the pkg-config search path.
 Perhaps you should add the directory containing `gtk+2.0.pc'
 to the PKG_CONFIG_PATH environment variable
 No package 'gtk+2.0' found
 
 But I am running gnome, so I must have gtk+.
 
 Is that a setting issue?
 

err.. try this:

pkg-config --modversion gtk+-2.0

(it's $package-$version and the package is 'gtk+' and version '2.0', 
hence you get 'gtk+-2.0', the '+-' can be a bit confusing)

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


Re: GTK app to change pic on click

2008-03-18 Thread Tomas Carnecky
Midhun A wrote:
 Hi All,
 
   I am very new to GTK+ (started out yesterday). I am writing a simple
 application which will show pictures one by one on button click.
 Although I am able to get my first picture, the picture does not
 change on click of the button (next or previous). The full code is as
 below.
 
 #include stdio.h
 #include gtk/gtk.h
 #include string.h
 #include unistd.h
 #include /usr/include/stdio.h
 #include glib.h
 
 GtkWidget *image2;
 GtkWidget *window;
 GtkWidget *vbox;
 GtkWidget *prev_button, *next_button;
 
 
 
 gchar *files[6] =
 {
 /home/pics/1.jpg,
 /home/pics/2.jpg,
 /home/pics/3.jpg,
 /home/pics/4.jpg,
 /home/pics/5.jpg,
 /home/pics/6.jpg
 };
 
 typedef struct{
 gint data;
 } data;
 
 void prev_callback (GtkWidget *widget, data *v )
 {
   gint cnt = v-data;
   if (cnt == 0)
   cnt = 5;
   else
   cnt = cnt - 1;
   
   image2 = gtk_image_new_from_file (files[cnt]);
 }

This callback only creates the new image, it doesn't display it in the 
window. You seem to lack basic C understanding, especially about pointers.

To replace the current image, you have to remove the image widget from 
the vbox and replace it with the new image. Like this:

 void next_callback (GtkWidget *widget, data *v)
 {
   int cnt = v-data;
   if (cnt == 5)
   cnt = 0;
   else
   cnt = cnt + 1;
   
gtk_container_remove(GTK_CONTAINER(vbox), image2);
   image2 = gtk_image_new_from_file (files[cnt]);
gtk_container_add(GTK_CONTAINER(vbox), image2);
 }
 
 
 int main (int argc, char *argv[])
 {
 
   data *w = g_slice_new(data);
   w-data = 0;
 
   gtk_init(argc,argv);
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_maximize (window);
   
   vbox = gtk_vbox_new(FALSE, 1);
 
   image2 = gtk_image_new_from_file (files[w-data]);
   gtk_container_add(GTK_CONTAINER(vbox), image2);
   
   prev_button = gtk_button_new_with_mnemonic (Previous);
   next_button = gtk_button_new_with_mnemonic (Next);
 
   gtk_widget_set_name(prev_button,prev_button);
   gtk_widget_set_name(next_button,next_button); 
 
   gtk_container_add(GTK_CONTAINER(vbox), prev_button);
   gtk_container_add(GTK_CONTAINER(vbox), next_button);
   gtk_container_add(GTK_CONTAINER(window), vbox); 
 
   g_signal_connect (G_OBJECT (prev_button), clicked, G_CALLBACK
 (prev_callback),(gpointer)w);
   g_signal_connect (G_OBJECT (next_button), clicked, G_CALLBACK
 (next_callback),(gpointer)w);
 
   gtk_widget_show (image2);
   gtk_widget_show (prev_button);
   gtk_widget_show (next_button);  
   gtk_widget_show (vbox); 
   gtk_widget_show (window);
   
   gtk_main();
   return 0;
 }
 
 
 This is very primitive code to test the functionality.  Whats wrong
 with the code? I would like to see the previous picture on click of
 previous button and the next picture on click of next button.
 

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


Re: Does libX11 use shared memory between several clients?

2008-01-29 Thread Tomas Carnecky
Bin Chen wrote:
 Currently I am looking at libX11's source code, I am curios many
 libX11 doesn't send the message to the server but only modify some
 structure in the local memory, such as:

This is the gtk-app-devel list, not the place where you'd discuss libX11 
issues! You'll have more luck asking in [EMAIL PROTECTED]

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


widgets in cell renderer

2008-01-25 Thread Tomas Carnecky
I'm working on a fairly complex cell renderer, with text, progress bars, 
buttons, etc. Since th cell renderer is not a widget, but only a simple 
renderer, I have to paint it all by myself, using gtk_paint_box(), 
gdk_draw_pixbuf(), gtk_paint_layout() etc. Now it's getting ugly and I 
thought about creating a normal GtkButton and then call the _paint() 
function to paint it into the cell renderer. But that is not easy since 
no _paint function is exposed through the official API. So I though 
about calling klass-expose_event() but that leads to problems and/or 
crashes. I really don't want to duplicate button and other paint code 
inside my cell renderer, is there really no way of using the standard 
gtk widgets and draw them inside a cell area?

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


Re: XF86AudioNext

2008-01-03 Thread Tomas Carnecky
Kevin DeKorte wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi,
 
 I'm trying to capture the keypress when a user hits a key like XF86AudioNext
 
 I have a keyboard handler for my window and I get events for keys like
 F10 and 'a' and the Ctrl-x keys, but keys like XF86AudioNext don't seem
 to be passed at all to my keyboard handler.
 
 Is there something special I need to do in order to capture that keypress?
 

Maybe gnome intercepts it, look into gnome-control-center - Personal - 
Keyboard Shortcuts. That is done so you can always press the key, no 
matter which app has focus, and gnome automatically reroutes the key to 
the currently active sound player (sonata in my case, not sure whether 
rhythmbox or amarok supports that).

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


Re: gtk.image

2007-12-25 Thread Tomas Carnecky
brad smith wrote:
 Hello everyone,
 
 I am using gtk.Image() and filling it with set_from_file with a random

I assume you're using the python bindings..

 image in a directory. I am trying to use gtk.get_image() to get the
 name of the image currently being displayed but I get:
 gImage = self.rImage.get_image()
 ValueError: image should be a GdkImage or empty
 
 There is a image being displayed when I try to get image name.
 Thanks for your time,

RTFM, especially what get_image() returns:
http://www.pygtk.org/pygtk2reference/class-gtkimage.html#method-gtkimage--get-image

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


Re: gtk.image

2007-12-25 Thread Tomas Carnecky
brad smith wrote:
 thanks for the reply, I tried everything I can think of, but still get
 the error.

Your problem is that get_image() does _not_ return the filename, but the 
gdk pixbuf for the image - as described in the pygtk reference. So if 
you want to get the filename, you have to use another function.

 On Dec 25, 2007 11:33 AM, Tomas Carnecky [EMAIL PROTECTED] wrote:
 brad smith wrote:
 Hello everyone,

 I am using gtk.Image() and filling it with set_from_file with a random
 I assume you're using the python bindings..

 image in a directory. I am trying to use gtk.get_image() to get the
 name of the image currently being displayed but I get:
 gImage = self.rImage.get_image()
 ValueError: image should be a GdkImage or empty

 There is a image being displayed when I try to get image name.
 Thanks for your time,
 RTFM, especially what get_image() returns:
 http://www.pygtk.org/pygtk2reference/class-gtkimage.html#method-gtkimage--get-image


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


Re: gtk.image

2007-12-25 Thread Tomas Carnecky
brad smith wrote:
 ok, thanks:) Any ideas on that?
 Happy Holidays

So you did not RTFM, eh? I suggest to look there from time to time, it 
really helps.

Sorry, no, I have no idea. But after roughly reading the gtk.Image class 
reference, I don't see any way of extracting the filename, because it 
apparently isn't saved in gtk.Image. That's probably because the image 
may also come from other sources such as memory or is copied over from a 
gdk drawable etc. The image isn't always tied to a particular file. 
You'd have to do that yourself.

I'm not a pygtk expert, but that's what I could find out from the link I 
gave you and my experience with gtk+.

 
 On Dec 25, 2007 1:03 PM, Tomas Carnecky [EMAIL PROTECTED] wrote:
 brad smith wrote:
 thanks for the reply, I tried everything I can think of, but still get
 the error.
 Your problem is that get_image() does _not_ return the filename, but the
 gdk pixbuf for the image - as described in the pygtk reference. So if
 you want to get the filename, you have to use another function.


 On Dec 25, 2007 11:33 AM, Tomas Carnecky [EMAIL PROTECTED] wrote:
 brad smith wrote:
 Hello everyone,

 I am using gtk.Image() and filling it with set_from_file with a random
 I assume you're using the python bindings..

 image in a directory. I am trying to use gtk.get_image() to get the
 name of the image currently being displayed but I get:
 gImage = self.rImage.get_image()
 ValueError: image should be a GdkImage or empty

 There is a image being displayed when I try to get image name.
 Thanks for your time,
 RTFM, especially what get_image() returns:
 http://www.pygtk.org/pygtk2reference/class-gtkimage.html#method-gtkimage--get-image



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


Re: Button Callbacks

2007-12-19 Thread Tomas Carnecky
Vroni wrote:
 Hi guys,
 
 I have this really dumb problem, but I can´t get my head around it. My 
 program should do the following:
 
 - When a button is pressed, a specific playlist[m3u]-file should be 
 opened in the media player.
 
 Sure, the first part is to add a callback for the buttons, but how do I 
 open the file (and with it the media player. It should do the same as a 
 double click on the file would)?
 Is it even possible to do do it this way?

In a terminal, you'd do:
  $ xdg-open /path/to/playlist.m3u

In your callback you'd probably want to use system() or g_spawn_async(), 
see the man pages and
http://www.gtk.org/api/2.6/glib/glib-Spawning-Processes.html

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

Re: [n00b] what's a smooth_draw_box?

2007-12-18 Thread Tomas Carnecky
Daniel Fetchinson wrote:
 Hi list,
 
 I've just started with GTK and been going through the tutorial and
 examples. My first small application is working all right but the
 following (I guess) warning keeps being written to the console:
 
 CRITICAL **: smooth_draw_box: assertion `width = -1'
 
 and strangely enough Google doesn't return any pages for the queries
 
 http://www.google.com/search?q=smooth_draw_box+site%3Agtk.org
 http://www.google.com/search?q=smooth_draw_box+site%3Alibrary.gnome.org
 

Try dropping the 'site:gtk.org' part, you'll get lots of hits.

tom
___
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 UI Freezes on GDK Call

2007-12-18 Thread Tomas Carnecky
Michael McCann wrote:
 Michael R. Head wrote:
 On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote:
   
 I assume you meant

 g_threads_init();
 gdk_threads_init();
 gtk_init();
 
 gdk_threads_enter();
 gtk_main();
 gdk_threads_leave();

 right?
 
 Yes, that is correct. :)
 Does your special function take time to do its job? If so, then that
 would be why. For example:

 ...
 while(1) {
 gdk_threads_enter();
 sleep(1)
 gdk_threads_leave();
 sleep(10)
 };
 ...

 you'd freeze your app for a second every 10 seconds.


   
 
 Ahh, ok. How else can I accomplish my goal, then? I need to give GTK the 

Which goal? Describe what your app is supposed to do.

 lock, as I'm calling GDK from another function not in the main GTK loop. 
 I tried leaving out gdk_threads_enter()/leave() in the CPU-intensive 
 function, but X gives me errors.

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


Re: I can't understand the difference output of only a line differ

2007-12-06 Thread Tomas Carnecky
Binary Chen wrote:
 You don't know my situation. I am writing a media player which need to
 copy the decoded bitmap into screen.
 I am using gdk_draw_image to draw a GdkImage to the drawing area.
 g_timeout_add is too slow because it need to update the screen   20
 times/sec.
 So I need to use a FAST blit to screen, which is only possible using
 busy while... but only if the delay is very small using usleep(1), the
 result is - no things on screen.
 Image a situation that a thread is doing decoding and put the result in
 somewhere memory, another thread drawing to GTK+ widget.

You don't seem to understand: You can not use a while loop. At all.
Ever! It simply won't work! Use something else, but _not_ the while loop!

tom

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


Re: C vs C++ for GTK

2007-11-25 Thread Tomas Carnecky
Allin Cottrell wrote:
 One reason for going with C is that the great bulk of free 
 software is in C, including GLib and GTK.  The main exception 
 is Qt, the basis for KDE.  So if you might want to get into KDE 
 programming, maybe learning C++ would be better.

You can use gtk in C++, there's gtkmm which is a thin wrapper on top of
gtk! Many good gtk apps are written in gtk. So actually when using gtk
you are less restricted in your programing language choice than with Qt.

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


Re: C vs C++ for GTK

2007-11-25 Thread Tomas Carnecky
Tomas Carnecky wrote:
 Allin Cottrell wrote:
 One reason for going with C is that the great bulk of free 
 software is in C, including GLib and GTK.  The main exception 
 is Qt, the basis for KDE.  So if you might want to get into KDE 
 programming, maybe learning C++ would be better.
 
 You can use gtk in C++, there's gtkmm which is a thin wrapper on top of
 gtk! Many good gtk apps are written in gtk. So actually when using gtk
 ^^^
 C++

 you are less restricted in your programing language choice than with Qt.
 
 tom

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


Re: C vs C++ for GTK

2007-11-24 Thread Tomas Carnecky
Patrick wrote:
 is C++ to complicated? 
C++ is more complex than C, and thus harder to fully understand.

 Is C going out of date?
No, it's still being used for lots of projects.

 Am I limited with C?
No, there are very few features in C++ that are hard/impossible to
imitate in C, but you usually won't need those for small projects.

What people prefer mostly depends on their taste. I do C, my brother
does C++, I can't say why that is.

Since you worked with python which is object oriented I would imagine
going with C++ will be easier for you during the first weeks.

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


Re: exec application in windows

2007-11-20 Thread Tomas Carnecky
Michael Lamothe wrote:
 
 gboolean ii=g_spawn_comand_line_async  (C:/Archivos de
 programa/GlobalMapper8/global_mapper8.exe,error);
 
 gboolean ii=g_spawn_comand_line_async  (C:/Archivos de
 programa/GlobalMapper8/global_mapper8.exe,error);


The two are exactly the same, C (preprocessor?) concatenates strings.

tom
___
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 stuff out of a GValue?

2007-11-19 Thread Tomas Carnecky
Dan H wrote:
 OK, I've got something in the form of a GValue (in this case, integer numeric 
 data
 obtained with gtk_container_child_get()), and I'd like to get access to the 
 actual number inside. How is this done? I've looked into GValue's 
 documentation, but all I see is stuff that deals only with GValues and no 
 interface to the outside world of regular C types.
 

http://developer.gimp.org/api/2.0/gobject/gobject-Standard-Parameter-and-Value-Types.html

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


no device event controller found

2007-11-10 Thread Tomas KRAMAR
Hello,

I am developing an application using a gstreamer backend and pygtk.

I create the gstreamer bus and connect a message signal:
bus.connect('message', self.on_message)

However, several people reported, that self.on_message is never
called, and they see following warnings in the output:

atk-bridge-WARNING **: failure: no device event controller found.

I thought this is something related to gstreamer and already asked on
their mailing list, but they told me the warning has nothing to the
with gstreamer, but rather with atk.

I'd like to know what is causing this error, and what is the way to
fix it. Is there some package missing?

Thank you

Regards
Tomas
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


embedding widgets

2007-10-24 Thread Tomas Carnecky
I have created a modification to transmission that changes the look:

http://dbservice.com/ftpdir/tom/screenshot19.png

each line is one custom widget, with a few pango text layouts and the
progressbar in the background. That was quite easy, but how would I go
about embedding for example a whole GtkButton in my custom widget
without having to create a box? Is it somehow possible to access the
GtkButton render() and get_size() functions and use those?

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


Re: combobox internal padding

2007-03-01 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Feb 28, 2007 at 10:56:28AM -0600, Medora Schauer wrote:

 [...]  The problem I'm having
 is that the rendering is resulting in a widget that is much bigger than
 the font it is required to display.  Using a Sans 8 font the amount of
 dead space within the widget is proportionally large enough to be
 aesthetically unpleasing. It is the same number of pixels as when using
 a larger font but is proportionally more. I understand there needs to be
 some reserved space (focus line, focus padding) but that should only be
 2 or 3 pixels (right?).  I'm seeing much more (5 maybe).

Stupid question: maybe there's something wrong with the font metrics of
this particular font?

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF5qgpBcgs9XrR2kYRAvvbAJ9PztBsTqmRpv46hOtf4COsLBzrFgCdEGqO
I6qrQwnYrluaHby8a7df00s=
=qSLx
-END PGP SIGNATURE-

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

Re: integrating Gtk with Artoolkit

2007-03-01 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, Mar 01, 2007 at 10:02:04AM -0800, lucks wrote:
 
 hi.sorry i sent an incomplete message.it was an error.well, am trying to
 build a gui that will interact with ARtoolkit which also uses C as language
 and contain OpenGl libraries as well.i`ve manage to copy some of the header
 files (e.g callback.h, interface.h,etc)
 
 ARToolKit is a software library for building Augmented Reality (AR)
 applications
 
 when i compile the files from ARtoolkit, there is no error. the result
 should have shown my Interface which i`ve created in gtk+. according to me,
 i think i am not able to call main.c which is a source file which have been
 created by glade. if main.c can be called, then i think it should work.

Sorry. It seems still difficult to understand what you try to tell us.
Let me try:

  * you have generated a GTK+ application with glade. One of the files
is main.c.

  * You compile this GTK application (somehow mixing in the ARtoolkit.
Since I don't know ARtoolkit, I just have a very vague idea of what
that means). This seems to work OK, whatever this means.

  * Now you are not able to call main.c. I am not sure I understand
what you mean by that. main.c seems to be a C source file. You don't
call C source files, you call C functions (from other C functions).
The only meaningful things you can do to a C source file is edit it
and compile it.

Sorry if I sound so stupid, but my understanding of your posts is so
incomplete that I _feel_ a bit stupid (don't worry, I feel stupid now
and then, it doesn't really hurt ;-)

Maybe step by step we find a way to help you.

Are you able to make a stand-alone GTK+ application without ARtoolkit?
Perhaps this would be a good place to begin with.

Ragards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF5xwJBcgs9XrR2kYRAuwcAJ44YUvG1s6hKrrqN8cO+/C7cdtSWQCfSsuz
kwSpLjCBNMQP2xL//RoqzoQ=
=t9ZE
-END PGP SIGNATURE-

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

Re: libglade frustration

2007-02-14 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, Feb 15, 2007 at 12:00:37AM +0100, David Nečas (Yeti) wrote:
 On Wed, Feb 14, 2007 at 02:44:21PM -0800, [EMAIL PROTECTED] wrote:
[...]
 libglade developers do not produce any binary packages.
 
 Their product does come with examples.
 
 Requiring that the examples have to be included in full in
 the text of the manual instead of in a compilable form as
 standalone files is silly.

You took it back to the point. I think metaphors don't help much here.
The question is whether usage examples belong to the documentation or
not. As we see, this question is debatable. Personally, I'd side clearly
with the yes side.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF0/XYBcgs9XrR2kYRAi3BAJ4g3E/refaqwbtgEX921oO6UwLWagCZAeUe
BHC3UYcdCnaVUBJ4vGi3Zq8=
=36mv
-END PGP SIGNATURE-

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

Re: GObject docs improvements

2007-02-13 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, Feb 12, 2007 at 09:49:46PM +0100, David Nečas (Yeti) wrote:
 On Mon, Feb 12, 2007 at 02:05:27PM -0600, Shixin Zeng wrote:

[...]

  2)How its intefaces handled, when a class is derived? Will the child
  classes possess the same interfaces, if they don't want to reimplement
  them?
 
 Yes, it will (a non-transitive is-a relation would be very
 very strange).

Ha! Gotcha. When talking about interfaces you might rather say
implements-a rather that is-a :-)

I do belong to the camp that believes that interfaces are just poor man's
multiple inheritance (whether you believe that or not deends, I think,
on whether you maintain that an object is defined by its behaviour).

But don't take me all too seriously here, I tend to be an OO heretic and
risk every time getting burnt .-)

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF0eKUBcgs9XrR2kYRAlfXAJwNLH77FITeugw9UG0v3HC/LOnPJACfVa43
AOGxRJF92AgXVDIPvsRVkBU=
=Oqsg
-END PGP SIGNATURE-

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

Re: how to make an animation ;)

2007-02-10 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Feb 09, 2007 at 01:39:17PM +0100, Enrico Sardi wrote:
 [EMAIL PROTECTED] pronuncio' le seguenti parole il 09/02/2007 10:19:
 
 Hi Tomas!
[...]
  Even better: pixbufs know about animations and do it for you! [...]

 I saw  gdk_pixbuf_animation_new_from_file but it  only works with  an 
 animated file as input while I need to build the animation from a series 
 of indipendent files...thanks for the help!

Yes. Well, either you go Olivier's path (concoct an animated GIF with
all your images -- you can even embed timing info in that), or you start
with

  gdk_pixbuf_simple_anim_new()
  -- Creates a new, empty animation.

and add frame by frame with:

  gdk_pixbuf_simple_anim_add_frame()
  -- Adds a new frame to animation. 

In a timeout function (or possibly in an idle handler) you might have to
call gdk_pixbuf_animation_iter_advance() (I don't know if that's done
for you). The whole page

  http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-animation.html

is worth a read.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFzq6hBcgs9XrR2kYRAmE1AJ97E0EFY5IhTWerRPFCiCjJm/GmgQCfSDY6
fYb3nfhBh0DKznBgv2lazu0=
=FGBc
-END PGP SIGNATURE-

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

Re: how to make an animation ;)

2007-02-09 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Feb 09, 2007 at 01:02:20AM +0100, Olivier Ramare wrote:
 Enrico Sardi wrote:
  Hi all!
 
  I want to make a simple animation in gtk with a pixbuf that rotates, how 
  can I make it?

 For every change of state of my application, the image changes.
 I have 10 files with the rotated images (I've created them with
 a repeated use of gimp) and I use the following code:
 --
 #define GTK_FLUSH while (gtk_events_pending()) gtk_main_iteration();
 void wait_fine(float intervalle)
 {
 float lheure = (clock()/CLOCKS_PER_SEC);
 while(((clock()/CLOCKS_PER_SEC) - lheure)  intervalle){;};
 }

The problem with this is that it'll keep your program (and most of your
computer ;) busy with the job. Better use a timer (or an idle) callback.

Even better: pixbufs know about animations and do it for you! With
gdk_pixbuf_animation_new_from_file()[1] you can load an animation from a
file (there are other functions aroud there if you want to build-up the
anim frame-by-frame). You can put this animated pixbuf in a GtkImage the
usual way with gtk_image_set_from_pixbuf()[2]

I'm too bogged down to cook up an example right now, but this might
help.

- 
[1] 
http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-animation.html#gdk-pixbuf-animation-new-from-file
[2] 
http://developer.gnome.org/doc/API/2.0/gtk/GtkImage.html#gtk-image-set-from-pixbuf

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFzDy9Bcgs9XrR2kYRAvvaAJ0RUkyetf/UJV0A0fI6pwddCq9xdQCfaPg3
rzNrjOoa0qgtF4N+0DWx4pw=
=wasb
-END PGP SIGNATURE-

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

Re: scrolledview

2007-02-07 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Feb 07, 2007 at 10:06:26AM +0100, [EMAIL PROTECTED] wrote:
 Selon James Scott Jr [EMAIL PROTECTED]:
 
  If you have caused the GtkVBox to be Realized, meaning all the widget
  have done their size negotiations
 
 OK, so I just need to catch the realized signal.
 
 Another question : suppose I'm adding gtktextviews to a GtkVbox which is 
 already
 visible (realized and mapped).
 how can I know that all the widget have done their size negotiations ?
 I can't rely on the realized signal since the gtkvbox is already realized 
 ...

I'd put my bets on the widget's size-allocate signal -- but I don't know
for sure.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFyfn9Bcgs9XrR2kYRAgR+AJ9/gGo5y0j5sSZkU9/mPJkOkEvncACfU0Jj
AcjLCWaSvKk6Pr4thAkYSDI=
=S5oU
-END PGP SIGNATURE-

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

Re: gtk_text_buffer_insert() problem character code transfer

2007-02-03 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Feb 02, 2007 at 05:03:20PM +0800, 杨宇 wrote:
 hi everyone,
 
 I have a GtkTextView to display the data in the buffer  *buffer.
 
 The buffer i received from a socket  consists of English and Chinese
 Characters.
 
  How to display this Characters one by one using the API :
 gtk_text_buffer_insert()?

I think I don't understand quite what you mean with one by one.
Typically you'd add as much as you got from the socket -- like so:

  /* at the beginning */
  GtkTextBuffer *tb = gtk_text_buffer_new(NULL); /* or create a tag table */


  /* everytime you get a load full of chars,
 typically in a callback function */
  int len;
  char buf[1024];
  if( (len=read(socket, buf, sizeof(buf)))  0 ) {
GtkTextIter it;
gtk_text_buffer_get_end_iter(tb, it); /* position it at end of text */
gtk_text_buffer_insert(tb, it, buf, len); /* insert at end */
  }

CAVEATS:
 * this is totally untested code.
 * you'll probably want a more intelligent function than read() to fetch
   a bufferfull: the input will come in utf-8 (I assume), and read()
   might brutally split multi-byte sequences; I'd expect
   gtk_text_buffer_insert() to get upset about this: not what you want.
   See g_io_channel_read_chars()  friends for a more robust soultion.
   You'll find there also functions to use different encodings should
   your input be other than utf-8.

HTH
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFxHpuBcgs9XrR2kYRAlVNAJ98ALAMDC8XfPxEosj5yjsj/njggwCfUV6d
k8/IkimivncOo3o5H8uoDik=
=t9J7
-END PGP SIGNATURE-

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

Re: instal gtk on windows

2007-02-03 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, Feb 03, 2007 at 01:40:28PM +0100, nostradamo wrote:
 I installed gtk2 on windows. I want 
 compile with gcc. but compiler can not find the hedaer files. 
 
 For example gtk.h
 
 Ich i make a include with
 dir direkt to gtk.h a list of a lot of unknow files und dirs will be showed.
 
 What is wront. or what does i have to do that compiler can work correct

I don't know about Windows, but typically the gcc has a set of standard
places where it looks for the include files. Typically, the places where
the includes of an add-on package live (like gtk) aren't there. You cann
add some to gcc with the -I option, like so:

  gcc -I/usr/local/include/gtk2 blah.c

Moreover you might have to add path to library places with the option -L
(again, I afford the luxury of knowing zilch about Windows).

Hope that helps
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFxW6hBcgs9XrR2kYRApjRAJkBzP7guGxiRH1P1/z1/i9OcSOSNgCaAzEg
uK4DoAD2gO/zEQoKKnSBb6U=
=04ob
-END PGP SIGNATURE-

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

Re: delete-event of GtkWidget

2007-01-21 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, Jan 20, 2007 at 03:52:24PM +0100, Enrico Tröger wrote:
 On Sat, 20 Jan 2007 05:34:27 +, [EMAIL PROTECTED] wrote:
 
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  On Fri, Jan 19, 2007 at 06:52:03PM +0100, Enrico Tröger wrote:
   Hi all,
  
   when I write big dialogs, I create it only once, keep the pointer to
   the dialog [...]
[...]
  I didn't understand exactly. Do you mean that you *don't* handle the
  delete event [...]

 I connected to the delete-event and registered gtk_widget_hide as
 callback.

Ah-hah. Now I think I got it.

   Re-showing(gtk_widget_show) worked in Debian and crashed in
 PuppyLinux. Now, I register gtk_widget_hide_on_delete as callback and
 then the widget won't be destroyed and all is fine.

So basically it boils down to the difference in behaviour between
gtk_widget_hide() (used as a callback for the delete event) and
gtk_widget_hide_on_delete(). Did I get it right this time?

Note that the delete event *wants* a callback returning a boolean. If it
returns TRUE, the following chain of events leading to the widget's
destruction is stopped (this is what you want). OTOH gtk_widget_hide()
is declared as a VOID. If the caller tries to call it as a boolean, bets
are up whether it sees TRUE or FALSE. It might be very architecture,
compiler (and may be moon phase) dependent.

OTOH Yeti's interpretation is at least as likely: the widget gets
destroyed anyway, but its guts still lie around on the heap, so it is
seemingly functional.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFs1uNBcgs9XrR2kYRAj9uAJkB0rY9KrPZfoYl1+HrRk92z5E+2gCbBJ4R
G8NBP+tF6soosPWg0xkv4TU=
=hkV3
-END PGP SIGNATURE-

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

Re: question on gdkpixbuf

2007-01-19 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Jan 19, 2007 at 07:46:01PM +0530, Sudharshan S wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi everyone,
[...]
 the image is not persistent. Any idea as to  why this is happening?
 To draw the pixbuf, i use
 gdk_draw_pixbuf(GDK_DRAWABLE(drawing_area-window), NULL,
 GDK_PIXBUF(image_buffer), 0, 0, 0, 0, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);

This is supposed to be that way :-)

To have a persistent image, you'll have to redraw on each expose event
(expose events tell you which area has to be redrawn). Or just use a
GtkImage widget[1], which is designed to do that for you.

Using a drawing area might be the right approach when you have special
drawing algorithms/strategies based on your own representation of
images.

[1] http://www.gtk.org/api/2.6/gtk/GtkImage.html

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFsObxBcgs9XrR2kYRAqtkAJ9JqL1Ufz/Cu/Z9yI67ToPDz18HVQCdF78w
pk93Gd1N7WrqJJX0gxOFQPI=
=Lotq
-END PGP SIGNATURE-

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

Re: delete-event of GtkWidget

2007-01-19 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Jan 19, 2007 at 06:52:03PM +0100, Enrico Tröger wrote:
 Hi all,
 
 when I write big dialogs, I create it only once, keep the pointer to
 the dialog and show it everytime I need it. In the response callback I
 just use gtk_widget_hide to let the dialog disappear. This works as
 expected and all is fine.
 
 On my Debian Etch(same for Sarge) I don't need to handle the
 delete-event signal of the dialog. If it is triggered the dialog just
 disappears and until now I thought it is just hidden. But according to
 the API documenation the dialog should be actually destroyed [...]

I didn't understand exactly. Do you mean that you *don't* handle the
delete event and still keep a pointer to the widget? And then the widget
is hidden for you and you can re-show it later?

If that's the case, well -- you got what you asked for: undefined
behaviour ;-)

If you don't handle the delete event, the widget gets marked for
destroy. Later it gets the destroy event (at this point the widget is no
longer quite functional: think of it as a last cleanup thing). Then it
goes away. Nobody guarantees you that all those things happen
immediately.

But then maybe I didn't understand your post correctly.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFsanjBcgs9XrR2kYRApzCAJwPUl4wZS2o+2cRiowpcSw0oj/KigCfRDbE
CGiBIRoxAI0Wwp+JLdDidBs=
=+wuu
-END PGP SIGNATURE-

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

Re: SOLVED: Re: Need to restore a window to last size/position on restart

2007-01-16 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tue, Jan 16, 2007 at 10:31:16AM -0800, Russell Markus wrote:
 Thanks for the help.  I was trying to get the window size and position after
 the user clicked the X in the upper right corner, but I guess the window was
 already destroyed before my handler was called.  I installed a handler for a
 resize request and configuration events and store the size and position
 there.

I might be barking up the wrong tree, but if you hook into the delete
evet, the widget is still alive (so much alive that you even could
thwart the destruction by returning TRUE in the handler).

Of course, if the widget is unrelaized (not shown on screen) it still
might have bogus dimensions.

Note that this size business is a quite complex one: the geometry of
a widget results from negotiations among its children and ancestors
and depends on many issues which only are known when things hit the X
server (font sizes, for example). And an X app might show on several
X servers (or window managers, or...), thus resulting in different
geometries for one and the same widget (even maybe on the same run of
the app!). The price of flexibility.

OTOH, the few times I look at a Windows app, I pity those who can't
resize the simplest of dialogs :-)

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFrdP7Bcgs9XrR2kYRArYeAJ9Nxl5qt3JKN3xEVIe4x9SzcfhutgCfYGjP
kQ7IHOdD9N5YcnwG139KD+M=
=8uMU
-END PGP SIGNATURE-

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

Re: move cursor with keyboard in a window

2007-01-13 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Jan 12, 2007 at 10:52:41AM -0800, Micah Carrick wrote:
 [EMAIL PROTECTED] wrote:
[...]

 Here is example code using C/GTK+ (and GDK):
 http://www.gtkforums.com/viewtopic.php?p=462

Nice. So I don't have to cook up an example now :-)

Micah -- I see you are collecting short GTK+ examples. Feel free to
recycle the grab example I posted the other day (if it fits in your
collection).

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFqKBHBcgs9XrR2kYRApMEAJ48yXb2mjL0KmbaLQNkKbmy4botZACfU/U7
rbpI24kzXU3TRcj+F5h3Xic=
=PleB
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2007-01-11 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, Jan 11, 2007 at 09:45:49AM +0100, [EMAIL PROTECTED] wrote:
 
 
 Thanks a lot!!
 it seems good...but...can you tell me about where to find examples of using
 it??

I'd like to cook up something, but it'll take a while. At the mopment
I'm a bit overwhelmed with other (less nice) things

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFpimKBcgs9XrR2kYRAuZxAJ9yPpxZPlBZTvRibEaQWdEgp7UUnQCdHIds
90sb8WykvRm0wwMFnEdLY6k=
=Jxg8
-END PGP SIGNATURE-

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

Re: Button - Launch context menu? ^^

2007-01-10 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tue, Jan 09, 2007 at 10:33:34AM -0800, briansteffens wrote:
 
 Hi everyone.. I'm just getting my feet wet developing with Gtk+, a recent
 convert from Win32/.NET. I'm developing on Debian Etch + Xorg + Gnome in
 C++. I'm having trouble finding many Gtk+ resources (API lists and
 examples), so if you happen to know of a good website, please pass that on
 =)

The API refs are here [1]. Look around there for some tutorials. As you
are on Debian, they should be there [2] as well, provided you install
the relevant libgtk*doc packages (say lib{glib,gdk,gtk,atk...}2.0-doc
(did I miss any)?

HTH
[1] http://www.gtk.org/api/
[2] file:///usr/share/doc/libgtk2.0-doc/glib/index.html,
...
file:///usr/share/doc/libgtk2.0-doc/gtk/index.html
   
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFpNFSBcgs9XrR2kYRAjiIAJ4wEtIlcPmO8WD7JzmV7qLT3RghBgCfb0xH
3s2/MkWJ8nDYuVJf9s/xvjQ=
=904B
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2007-01-08 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sun, Jan 07, 2007 at 10:56:48PM +0100, Andreas Stricker wrote:
 [EMAIL PROTECTED] wrote:

[fourth argument]

 I should have RTFM more attentive [...]

I sometimes turn screaming to the list too before having found the
relevant bit in the FM. Luckily there are quite friendly folks around
here.

  Maybe there is a function to place the cursor in the middle of the window?
  
  You might move the pointer with gdk_display_warp_pointer() after each
  received movement event.
 
 Yes, that's the function I need. (but move it each time is not a good idea)

[re-center dursor when within 100px of root window]

Sounds quite workable. I was wondering myself about some weird form of
optical feedback: not hide the cursor completely, but show it as a small
dot or ring. Then re-center it based on a falling exponential function
or similar (i.e. add the movement of the cursor and substract on regular
time intervals alpha*(z - z0), when z are the mouse coordinates and z0
is the chosen center. Alpha will be a suitable constant 1 (e.g. 1/2).
So if you don't move, you'll see the pointer falling towards the
center.

But I'll shut up now. Holidays are over, after all...

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFog+tBcgs9XrR2kYRAk44AJ4m+vjPt2DGnbjysl10siJe8pQSRACZAZCy
4PRIrzscE5H5RtLcOoqIdVM=
=Hn/S
-END PGP SIGNATURE-

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

Re: Information required

2007-01-08 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, Jan 08, 2007 at 03:27:09PM +0530, Sarath Potharaju wrote:
 Hi Michael,
 
 Sorry for the delayed Response, the field widget is some thing which allows
 the user information into a form.The field widget allows for entering a
 single line of date. For information on entering multiple, wrapping lines of
 data.
 
 Do we have this kind of widget in GTK??
 
 Any information this will be really helpful.

Sarath,

I'm sorry to say that I don't understand at all what you are asking. May
be it's because I don't know Qt too well.

Maybe others have that problem too, that would be why you get so few
responses.

 - What is the field widget? (a widget, I suppose, that is a GUI
   element).

 - How does it look like?

 - What is its user interface (how does it behave towards the user)?

 - What is its API (how does it behave towards the program)?

 - What is it used for?

Thanks
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFokQcBcgs9XrR2kYRAr16AJ4rNhPvzP1I9D3pWdOxT6Y0yIzGTQCbBpQe
ydsilc8d3PmZUYa50988Rfg=
=bb6s
-END PGP SIGNATURE-

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

Re: Do we have a date control widget in gtk??

2007-01-08 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, Jan 08, 2007 at 03:33:09PM +0530, Sarath Potharaju wrote:
 Hi ALL,
 
 I am relatively new and learning GTK, i am looking for a date control widget
 which can do the following functionality,
 
 The date control will provide an indication of current date and launches a
 popup which allows the user to pick up the date .

Seems the best fit would be a GtkCalendar. If yu want to go with Gnome
widgets, maybe GnomeDateEdit is for you:

  http://developer.gnome.org/doc/API/2.4/libgnomeui/GnomeDateEdit.html

HTH
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFokXbBcgs9XrR2kYRAkKrAJ0Vo94tHoKsYwgeKuGo59XZ0XQIKACdEHwD
q97XSZ6RFbshw2WzQzcxY2o=
=Mc65
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2007-01-04 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Dec 29, 2006 at 05:08:49PM +0100, Andreas Stricker wrote:
 Yo tomas!

Yo! hope you started well the new year.

 But the main problem remains: Once the pointer (Pirate!!) touch the border
 or the window, the mouse coordinate don't change anymore.

Well, that's what the fourth argument of GdkPointerGrab is for. If you
pass in a (pointer to a) GdkWindow, then the cursor is confined to the
window. If you pass in NULL, it'll allowed to move freely (I haven't
tested whether the X root window limits its movements: this might bite
you).

 Remember: I need to get the relative mouse movement independend of the
 absolute cursor position.
 
 Maybe there is a function to place the cursor in the middle of the window?

You might move the pointer with gdk_display_warp_pointer() after each
received movement event.

Ah, btw -- gdk_pointer_grab() lives in the General subsection of (my
version of) the GDK docs. That might trip others up (I'd expect it to be
in the GdkDisplay subsection, along with gdk_pointer_ungrab().

 I've tested your application and rewrote it in PyGTK. (This one you can
 even give to children, the pointer is released after 15 seconds ;-) )

:-)

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFnO0mBcgs9XrR2kYRAtwIAJ45sfB5Ng3yPcJ0/w07nlm96ZydJwCePGoT
fOcZu/aHWPq3g9VqgUIIkXY=
=9olb
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2007-01-04 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Jan 03, 2007 at 02:05:25PM +0100, [EMAIL PROTECTED] wrote:
 Hi again!!

Hi -- please, keep the list in Cc: so that others may comment/learn.

 I think i didn't exlain well in my last mail...excuse me!
 The thing i want to do, is to saw a cursor, each time i'm inside the window, 
 and
 hide it, each time i leave it...

So you want the cursor to disappear when it leaves the window? I think
you'll need a grab (one that doesn't confine the cursor to the window,
so you pass NULL as the fourth parameter to gdk_grab_cursor(), see other
postings in this thread). Then, set up a callback on
leave-notify-event (you can re-use the same callback as the one to
enter-notify-event.

Then somehow you'll have to keep some memory on the status of affairs:

  - first time entered: grab pointer, change if necessary.
  - leave: change pointer to invisible
  - enter (for second time, while holding grab): make pointer visible
again.

It would make sense to build the invisible cursor just once (and not
everytime you leave the window.

 i'm asking you for the new event function which relesases the grab...

Have a look at the code by Andreas Stricker elsewhere in this thread. He
chose to use a timer event to release the grab. You first will have to
decide on what event you want to release the grab.

Regards y próspero año nuevo :)

- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFnPCTBcgs9XrR2kYRAinnAJ4+run9R0KXHEibzF6i/twg51zzqACfT3ze
Q6JyaC+M261olVA8cbkoOiw=
=JpDH
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2007-01-04 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, Jan 04, 2007 at 01:18:51PM +0100, [EMAIL PROTECTED] wrote:
 Hello!!
 I was trying to create a cursor on my window...and i did it thanks to 
 Tomas,and
 to gdk_pointer_grab(). the problem is that i want to add the cursor, over a
 GdkWidget plot, not over a GtkWindow

I don't understand: what is a GdkWidget plot?

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFnPDeBcgs9XrR2kYRAp2PAJ0RJ+FnPgvD0HcpR1+lNaLb/zVLUACfYXS4
i9Iyq49WE6g51MaUAnSmTmw=
=DteH
-END PGP SIGNATURE-

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

Re: Using GLib main loop to free up temporary memory

2007-01-04 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Jan 03, 2007 at 01:02:39PM -0200, Leandro A. F. Pereira wrote:
 Greetings!

[idle_free]

Cute. But as Iago points out, you'll have to make sure that your app
doesn't go into idle until the object is used. Tough call. I'd think
it's more dangerous than it is worth.

Try alloca() if you are into that sort of thing. It's frowned upon,
because it is a BSD extension (the GNU CC supports it). With that you
allocate the space in the stack and it gets freed on exit from the
function. Much safer. Just don't return a pointer to this mem ;-)

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFnQhuBcgs9XrR2kYRAgVGAJ9O6Ep3jqdxMQ4zR3ZxMBw3xZYzxQCfavzv
rsRLztPEyh6t+HkC6mT41Lo=
=9mEF
-END PGP SIGNATURE-

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

Re: Using GLib main loop to free up temporary memory

2007-01-04 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, Jan 04, 2007 at 03:15:10PM +0100, David Nečas (Yeti) wrote:
 On Thu, Jan 04, 2007 at 02:00:14PM +, [EMAIL PROTECTED] wrote:
  
  Try alloca() if you are into that sort of thing. It's frowned upon,
  because it is a BSD extension...
 
 g_newa() should work on all platforms GLib works on.

Thanks, Yeti. Didn't know about that.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFnQyFBcgs9XrR2kYRAjoAAJ9vEgTY2RlV3UDV444i504Y9Zxd8ACfeyNu
fiiWwI1wB7Gkld0cP3J6eV8=
=j1wK
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2007-01-03 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Jan 03, 2007 at 12:18:17PM +0100, [EMAIL PROTECTED] wrote:
 Hello!!

hello!

(please, keep the list CC'ed so that others may lurk/chime-in)

 I'm new in this treatment, but your help is good for me.

Glad it is :)

 I compile your code in a good way, but i want to add a cursor, just being 
 inside
 the window(like the code), but with the option of deleting it,just ,leaving 
 the
 window.

So you just want to hide the cursor? What you do is to create an
invisible pixmap. Instead of:

  GdkCursor *cursor = gdk_cursor_new(GDK_PIRATE);

you can do (Warning: untested code):

  GdkCursor *cursor = gdk_cursor_new_from_pixmap(NULL, /* pixmap */
 NULL, /* mask */
 NULL, /* foreground */
 NULL, /* background */
 0,/* xoff */
 0);   /* yoff */

 In your code, i can't left main window..
 please, can you help me??

This is supposed to work this way. That's why I warned that this is a
trap :-) For a real application, you'd have to make another event
function which releases the grab.

I did it for two reasons: (1) simplicity (I didn't want to complicate the
sample program with irrelevant stuff) (2) to convey that pointer grabs
in X are a sharp tool: use them sparingly or your users will curse at
you (and for very good reasons).

I seem to remember that it was late Netscape 4.x which used to
half-crash, closing all the windows and keeping the grab. Boy, that was
obnoxious.

 thanks a lot

You are welcome
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFm6flBcgs9XrR2kYRAvArAJ4ogflb75SFjCzuFvfJU2qdaHEt+ACfQM7p
xugyedsu/UoYZ0VuC7/eZGA=
=0KpM
-END PGP SIGNATURE-

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

Re: Reg: seg fault

2006-12-31 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, Dec 30, 2006 at 01:08:30PM +0530, Prasad Achar wrote:

[130 lines]

 Here...
 
   My  problem is that ...when  I  enter disburse button  in Fuction 1
 (disburse_loan ) ...the  ( func 2)  the fetch_entry is executed..but
 
  my  problem is  that  when call fun3 from fun2..fun 3 is failing..tells
 seg fault!!!

Sorry, Prasad. I think you'll have to present your things better for us
to be able to help you. Just skimming over your longisch code snippet I
realized that this isn't even enough information to adventure a guess on
what is going wrong.

As a tip: start your program under gdb (on the command line type gdb
program name, then run). When the program segfaults, then type
backtrace at the gdb prompt. You will get a printout of the stack
(i.e. which function  calls are active at this point in time). This may
point you to the problem.

Maybe if you shorten your test case a bit someone will try and get a
plunge into your code.

Regards -- and happy new year
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFl9RnBcgs9XrR2kYRAvtiAJ410EfqqEbUvXTBPn8ePZxiSXw2UwCfWM0Y
53xN2R6w4KXIxOcUFItqZ90=
=zpOV
-END PGP SIGNATURE-

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

Re: How does one pipe output from process to text buffer? -- FIXED

2006-12-31 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sun, Dec 31, 2006 at 10:45:59AM -0500, Tony Freeman wrote:
 On Sun, 2006-12-31 at 05:43 +, [EMAIL PROTECTED] wrote:

[NONBLOCK]

 Thank you again!  That was exactly the answer :-)  The application does
 not freeze at all now.
 
 Excellent!

Great. And I learnt in the process: I'd expected spawn_async_with_pipes
to give us nonblocking file descs :-)

Regards -- and happy new year
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFl90DBcgs9XrR2kYRAg1wAJ9JuuN8Ax+PdTsC3vWaGZsbPPTN1gCbBtwH
GKeG++Bqxyw31FS81BYtgPo=
=JEFD
-END PGP SIGNATURE-

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

Re: How does one pipe output from process to text buffer? -- FIXED

2006-12-30 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, Dec 30, 2006 at 12:15:33AM -0500, Tony Freeman wrote:
 Thanks everyone, I have this working now :-)  Special thanks to Tomas!

happy it helped :-)

Still strange that it blocks, though. Perhaps
g_spawn_async_with_pipes(...) gives you channels in blocking mode (I'd
doubt that, but I don't know for sure).

You might try this out e.g. with

  g_io_channel_set_flags(gioout,
 G_IO_FLAG_NONBLOCK | g_io_channel_get_flags(gioout)),
 err); /* or NULL, if you live on the edge */

right after the gioout = g_io_channel_unix_new(...)

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFl04NBcgs9XrR2kYRAlG+AJ9LCauFArjjFzraf0GTLQ4Z+6oOUQCdFYt6
US5gnFcIbPS44N0OoxYrvA4=
=8p1T
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2006-12-29 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Dec 29, 2006 at 09:01:57AM +0100, Andreas Stricker wrote:
  I try to do something that is similar to some 3D projection plan
  window rotating/shifting function: When a key is pressed, the relative
  mouse movement should be recorded.
  
  I'm primary interested if somebody solved a similar problem or got
  an idea how to solve this.
 
 If you think it's impossible, you can just say so...

I think gdk_pointer_grab() is your friend here. I'll try to cook up an
example (but don't hold your breath :-)

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFlO1MBcgs9XrR2kYRAlgHAJ4zUhg19LRi5ONbWe7OwbxdyWiI6wCeLcYa
xXSUFHuVao/zRFaKFNMzqGs=
=rDe4
-END PGP SIGNATURE-

___
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 capture mouse movements independend of a Window?

2006-12-29 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Dec 29, 2006 at 09:01:57AM +0100, Andreas Stricker wrote:
  I try to do something that is similar to some 3D projection plan
  window rotating/shifting function: When a key is pressed, the relative
  mouse movement should be recorded.
  
  I'm primary interested if somebody solved a similar problem or got
  an idea how to solve this.

OK, here is a rough sketch (tested). As soon as the pointer crosses the
window boundary (inward), it is grabbed (the app changes the cursor's
appearance to show it). WARNING! IT IS A TRAP! Once your pointer is
inside, you won't be let out. See to it that you have a console around
(a virtual console wth ctrl-alt-Fn will do) to kill the app. Keep out of
reach of children ;-)

+ Makefile
| grab: grab.c
|   gcc -Wall -g $ -o $@ \
|   `pkg-config --cflags gtk+-2.0` \
|   `pkg-config --libs gtk+-2.0`
+

+ grab.c
| /* grab.c
|test mouse grabs
| */
| #include gtk/gtk.h
| 
| static void destroy(GtkWidget *widget, gpointer udata)
| {
|   gtk_main_quit ();
| }
| 
| static gboolean entered(GtkWidget *widget, GdkEventCrossing *ev, gpointer 
udata)
| {
|   if(ev-type == GDK_ENTER_NOTIFY) {
| GdkCursor *cursor = gdk_cursor_new(GDK_PIRATE);
| gdk_pointer_grab(widget-window, FALSE, GDK_POINTER_MOTION_MASK,
|  widget-window, cursor, ev-time);
| gdk_cursor_unref(cursor); /* X has it now */
| cursor = NULL;
|   }
|   else { /* leaving: won't happen */
| gdk_pointer_ungrab(ev-time);
|   }
|   return FALSE;
| }
| 
| int main(int argc, char *argv[])
| {
|   GtkWidget *window;
| 
|   gtk_init (argc, argv);
|   
|   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|   g_signal_connect (G_OBJECT(window), destroy,
| G_CALLBACK(destroy), NULL);
|   g_signal_connect (G_OBJECT(window), enter-notify-event,
| G_CALLBACK(entered), NULL);
| 
|   gtk_widget_show_all(window);
| 
| 
|   gtk_main ();
|   /* in the current setting, this is never reached.
|  We put it there to remind us to be good citizens.
|  Oh well
|   */
|   gdk_pointer_ungrab(GDK_CURRENT_TIME);
|   return 0;
| }
+

Enjoy
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFlPErBcgs9XrR2kYRAjgxAJ9m8Ax3uDhiAyg77TXbKndITtlSRgCeI4sU
NHQZE707PFJn+nGNiurluQA=
=Q8Zx
-END PGP SIGNATURE-

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

Re: How does one pipe output from process to text buffer?

2006-12-28 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, Dec 28, 2006 at 08:10:57PM -0500, Tony Freeman wrote:

[...]

 Thanks!
 
 I'm getting really close now!  Thanks for your help.

Glad it was useful. I'm keeping Zeeshan cc'ed -- he proposed using
libgtk. Many things apply whether you spawn a process or use a lib (but
tend to be easier with the lib; among other things you have less fds to
watch ;-)

 Currently, I have the program doing what I want but for one thing ... it
 freezes until all my ssh commands have returned.  Once control is
 returned, all the notebook pages have all the proper ssh output
 associated with it :-)
 
 I'd like to be able to click on each notebook page as the ssh commands
 are running, and be able to see real-time output being written.

This somehow smells like your app is waiting (or even spinning) in a
callback. You can easily distinguisch waiting and spining based on how
much CPU your process hogs :-)

 Anyway ... 
 
 This is what I have so far:
 
 [...]
 
 GPid pid;
 gint stdout;
 GIOChannel *gioout;
 g_spawn_async_with_pipes( NULL, 
ssh_command, 
NULL, 
G_SPAWN_SEARCH_PATH,
NULL,
NULL,
pid,
NULL, stdout, NULL,

Where does the subprocess get its input from? I don't think it'll be
doing anything useful this way. Maybe (just for testing purposes, and if
you want to get the subproces's putput part right first) you might want
to substitute the ssh command by some process which just procuces output
(e.g. a shell script with echoes constantly).

NULL );
 gioout = g_io_channel_unix_new(stdout);
 g_io_channel_set_encoding(gioout, NULL, NULL);
 g_io_add_watch(gioout, 
 (G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_NVAL),
 (GIOFunc)watch_out, 
 textview);
 
 [...]
 
 Note ... if I replace G_SPAWN_SEARCH_PATH with NULL I get a compiler
 error ... so I keep it at G_SPAWN_SEARCH_PATH.
 
 Also ... it took me all day and night to finally brew up the combination
 of (G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_NVAL).

IMHO GIO_IN should suffice -- but I haven't the docs here.

   I was under the die-hard
 impression that I wanted to watch for G_IO_OUT (after all I want ssh
 output), but it turns out I was thinking completely opposite of what
 really needs to be thought?  Anyway, this combination finally started
 putting output in the notebook text buffers.

The shell's output is *your* input :-) (note that your proces's
perspective is relevant here).

 
 Here is the watch_out callback function:
 
 gboolean watch_out (GIOChannel *channel, GIOCondition condition,
 gpointer data)
 {
 GIOStatus status = G_IO_STATUS_NORMAL;
 GtkTextView *textview;
 GtkTextBuffer *buffer;
 gchar buf[1024];
 gchar *buftext;
 gsize bytes_read;
 
 /* set up pointers to our textbuffer */
 textview = GTK_TEXT_VIEW((GtkWidget *)data);
 buffer = gtk_text_view_get_buffer(textview);
 
 /* send ssh output to our gui */
 status = g_io_channel_read_chars(channel, buf, sizeof(buf), 
  bytes_read, NULL);
 buftext = g_strdup_printf(%s, buf); /*creates null-term str*/

No need for that. And besides, you are leaking mem. gtk_buffer_set_text
accepts a length param, if I remember correctly:

 gtk_text_buffer_set_text(buffer, buftext, -1);

| if (bytes_read  0) gtk_text_buffer_set_text(buff, buf, bytes_read);

 
 /* decide if we should close the channel */
 switch (status) {
  case G_IO_STATUS_NORMAL:
   return TRUE;
  default:
   return FALSE;
 }
 }
 
 
 I've spent some time experiementing with the buf.  I've reduced it down
 to 64 (buf[64]) ... when the application becomes un-frozen and I can
 click around in the notebook pages, I see that only the last couple of
 lines of ssh output has been written to the page.
 
 It seems the buf[] is filling up with data and then being discarded
 without writing that data to my textbuffer - until the end - at which
 point it writes the data to the textbuffer as it dies away.
 
 Sound reasonable?  How do I fix this?

The callback itself looks harmless to me. I'd expect the ssh subprocess
doing funny things when it doesn't get input.

Besides, an ssh wants a tty (or pty; it tries to set it in raw mode to
ask for a password). No idea what it'll do when fed via pipes. This is,
btw where Zeeshan's proposal to use libssh makes most sense (it makes
sense for other reasons as well).

The flag combination G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_NVAL looks a bit
strange to me.

I'd put my bet in spinning: your callback is being called too often and
there is nothing to read.

Maybe later more, when I have access to the doc

regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFlKprBcgs9XrR2kYRAtb8AJ0TI8P05C6aCuMrZBHCbRWAf57ggACfafMu
kQ0kDofeXwtVKGOuF2I3/zs=
=yUNp
-END PGP SIGNATURE-

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org

Re: How does one pipe output from process to text buffer?

2006-12-27 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Dec 27, 2006 at 10:33:38AM +0200, Zeeshan Ali wrote:
 On 12/27/06, Tony Freeman [EMAIL PROTECTED] wrote:
  Hello,
 
Hi!
 
  I need some example code or a tutorial for how to pipe output from a
  process to a GtkTextBuffer.
 
  The idea of this program is to spawn off 6 or more ssh commands and have
  the output go to it's own textbuffer in it's assigned notebook page.
 
 Just a thought: Wouldn't it be a better idea to use a library
 instead of a command when one is available: libssh
 (http://www.0xbadc0de.be/libssh:libssh).

Thanks. Didn't know about that. Just from a cursory glance at the doc:

 * what I like
   clean, abstract interface

 * what I don't
   namespace pollution (besides the prefix ssh_ they use options_
   channel_ and what not).

In Tony's case, he might have to extract the fd from the SSH_SESSION
object (is there an interface for that?) to be able to stuff it into a
GIOChannel (not very difficult. I've done it with a database socket). On
the plus side, Tony would just have *one* socket to watch (read and
write side), and errors would (assumedly) come through call results or
whatever.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFkj8cBcgs9XrR2kYRAlN0AJwKODpdT3BJZ9F2UExgZH2k+0tU5wCfZp/E
g0VzNvQRfiGJr8tt1Iu6jJ8=
=cyCm
-END PGP SIGNATURE-

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

Re: How does one pipe output from process to text buffer?

2006-12-27 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Dec 27, 2006 at 12:02:01PM +0200, Zeeshan Ali wrote:
 Hello Tomas!
 
  Just a thought: Wouldn't it be a better idea to use a library

[...]

 2. The API is a bit different in the upcoming release: 0.2.

Yes, it seemed to me too that the author was eliminating side tracks.

 In Tony's case, he might have to extract the fd from the SSH_SESSION
 object [...]

   I have already thought of implementing a GIOChannel based on the
 libssh's CHANNEL object [...]

Tough call :-)

It'd be a foreigner in both lands. That's why I'd go for extracting the
fd from the CHANNEL object and stuffing it into a GIOChannel. They can
co-exist peacefully (of course you will use the ssh_* functions to
operate the CHANNEL when GIO* signals any conditions. It's not really
that much code and I prefer to have that explicit in my app.

I've done it already with an asynchronous libpq interface. It's quite
feasible to keep things neat and clean.

Regarding your other post... for non-POSIX systems, I dunno (lucky me!).
How does Windows select()?

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFkmEMBcgs9XrR2kYRApK+AJ0WQ4XXs2WXV4IlLQNIkiEHXS5N2gCfVndI
0CGLQcxkzWl96oKO8noqeBM=
=/uY7
-END PGP SIGNATURE-

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

Re: How does one pipe output from process to text buffer?

2006-12-26 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tue, Dec 26, 2006 at 10:41:33PM -0500, Tony Freeman wrote:
 Hello,
 
 I need some example code or a tutorial for how to pipe output from a
 process to a GtkTextBuffer.
 
 The idea of this program is to spawn off 6 or more ssh commands and have
 the output go to it's own textbuffer in it's assigned notebook page.
 
 This is what I have so far.  Now I need the output from the process to
 go to it's respective text buffer.
 
 
 void on_confirm_okbutton_clicked (GtkWidget *widget, gpointer data)
 {
   /* 
* Globals used:
*  serverlist : string array of server names
*  command: the options to send to mainscript program
*  notebook1  : notebook widget
*/
[...]
   /* now fire off the process and redirect output
* to our textbuffer */
   GPid pid;
   g_spawn_async_with_pipes( NULL,
 ssh_command, 
 NULL, 
 G_SPAWN_CHILD_INHERITS_STDIN,
 NULL,
 NULL,
 pid,
 NULL, NULL, NULL,
 NULL );
   }

This looks like the interesting part. First of all, I doubt
G_SPAWN_CHILD_INHERITS_STDIN is what you are after. I guess you'll have
to give each child its own file descriptors (possibly all three, to let
the user see possible errors), like so:

|   GPid pid;
|   gint stdin, stdout, stderr;
|   g_spawn_async_with_pipes( NULL,/* workdir */
| ssh_command, /* argv */
| NULL,/* envp */
| NULL,/* flags */
| NULL,/* child setup func */
| NULL,/* --- udata */
| pid,
| stdin, stdout, stderr,
| NULL );  /* error */

Now you'll have to catch whatever comes from stdout and stderr and
append it to the text buffer of the text widget (possibly making sure
that the in and err part don't get too messed up, and possibly making
nifty things like painting the errors in red :-). Likewise, you'll have
to (somehow) collect user input, sending it via stdin to the process
(when it is ready to take input).

To this purpose, you may wrap the descriptors in GIOChannels and watch
the channels with g_io_add_watch(), which is just a fancy way to use the
select() system call. I'll sketch this with stdin (the others work
analogously). In a full-fledged version you'll typically want to collect
all this stuff in a struct which you may attach to the corresponding
notebook widget, so you may easily find all those thingies in callbacks,
etc -- like so:

|  typedef struct {
|GIOChannel *stdin;
|GIOChannel *stdout;
|GIOChannel *stderr;
|/* other useful things like the text widget go here */
|  } ssh_slave;

Now comes the fun part. After the spawn_async() (and after checking for
errors ;-) you do:

|  ssh_slave *slave = g_new(ssh_slave, 1);
|  slave-stdin = g_io_channel_unix_new(stdin);
|  GIOFunc watch_slave;
|  g_io_channel_add_watch_full(ch_stdin, G_IO_IN, watch_slave, slave);


Then you define your watch function (I'd use the same function for all
three channels, but I'm a really, really lazy person ;-)

| gboolean watch_slave(GIOChannel *src, GIOCondition *cond, gpointer udata)
| {
|   ssh_slave *slave = (ssh_slave *) udata; /* hopefully ;-) */
|   gchar buf[1024]; /* or another meaningful size */
|   GIOstatus st;
|   GIOError *err;
| 
|   /* this is for stdin, stderr: */
|   st = g_io_channel_read_chars(src, buf, sizeof(buf), got, err);
|   /* handle errors */
|   ...
|   /* append whatever you got to the text widget, which you can hopefully
|  pull from slave */
|   ...
|   /* Do likewise for stdout. You might have a buffer of pending chars
|  hidden in slave-xxx and add/remove the write watch depending
|  on whether there is write pending (otherwise the program will hog
|  CPU spinning here). */
|   ...
|   return TRUE; /* typically. Return FALSE if you want the watch removed */
| }

That's at least how I go about this. Hope it gives you some ideas.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFkhAHBcgs9XrR2kYRAhHNAJ49QPnWhdsb6pq/E+U2IZZM4HNeTQCeLnWv
tG4pXP/VVo+bJpjOp4DTQ0k=
=je6g
-END PGP SIGNATURE-

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

Re: Proper way to show unique icon in treeview --with code

2006-12-18 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sun, Dec 17, 2006 at 11:06:14PM -0500, Tony Freeman wrote:
  Hello,
  

[...]

 void build_server_list (GtkWidget *treeview)
 {
   GtkListStore *liststore;
   GtkTreeIter iter;
   GtkCellRenderer *text_renderer;
   GtkCellRenderer *icon_renderer;
   gint i = 0;
   gint count = 0;
   
 
   icon_renderer = gtk_cell_renderer_pixbuf_new();
   gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview),
0,  
 ,  
icon_renderer,
NULL);
   
   text_renderer = gtk_cell_renderer_text_new();
   gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview),
1,  
 ,  
text_renderer,
NULL);
   
   liststore = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
   
   /* workstations */
   count = g_strv_length(workstations);
   g_object_set(icon_renderer, stock-id, gtk-close, NULL);
   for (i=0; icount; i++) {
   gtk_list_store_append(liststore, iter);
   gtk_list_store_set(liststore, iter,
   0, icon_renderer,
   ^

So the icon slot of each row in the store points to the same icon
renderer. Hm. I don't have the ref ready (I'd expect an image to go
here, not a renderer), but it's no surprise that the image in each row
is equal. You'd have to put a different image in each row's image slot.

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFhlkJBcgs9XrR2kYRAlrHAJsFB6HUMXA3GFIBLXXR8bCQwk126ACfUaxZ
MzBdhBoejyd/8bqr4nabwjU=
=Xtxq
-END PGP SIGNATURE-

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

Re: Problem with gtk

2006-12-16 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, Dec 16, 2006 at 04:55:48PM +0530, Naveen Kumar wrote:
 Hi all,
 
 I am using an hand held device running on montavista linux,
 1) i wrote a c program 
 
  int main ()
{
  int i;

i is uninitialized here. It contains a random value...

  while (i  25000)
  printf (%d\n, i);

...which doesn't change at all while the loop is running.

}
 it works very fine in my machine without any problem. (it takes around 1.2
 minutes)

So I don't understand why this program terminates at all (it should
terminate either *immediately* or *never at all*.

 2)If try to run the same part of code on a button click using gtk,
 the application is crashing around 30 seconds saying just Terminated.

Even 30 seconds seem too long (or too short, depending on the initial
value of i).

BTW, if you compile that with -Wall, the compiler would have told you
that (needs option -O as well):

 | [EMAIL PROTECTED]:~$ cat fo.c
 | #include stdio.h
 | 
 | int main ()
 | {
 |   int i;
 |   while (i  25000)
 |   printf (%d\n, i);
 | }
 | [EMAIL PROTECTED]:~$ gcc -O -Wall -o fo fo.c
 | fo.c: In function 'main':
 | fo.c:7: warning: 'i' is used uninitialized in this function
 | fo.c:8: warning: control reaches end of non-void function

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFhNT4Bcgs9XrR2kYRAnr6AJoCjUAlBxcSFTZ1LTrscfh25YH76QCeIy5U
5nV+H8AO+bgUgSWQ8r69tS0=
=20kT
-END PGP SIGNATURE-

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

Re: reg: callbacks

2006-12-13 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Dec 13, 2006 at 12:43:00PM +0530, Prasad Achar wrote:
 Hi
 
 I have a situation where in have to catch 2 different callbacks on 2
 different events from single fuction.
 
 Then how can i manage the below function..
 
 whether i have to add one more gpointer   func_data1 ?
 
 
 gint gtk_signal_connect( GtkObject *object,
  gchar *name,
  GtkSignalFunc  func,
  gpointer   func_data );
 

Quite probably you are not being called from *both* places *at the same
time* ;-)

So when you are being called from place A you point with func_data to
func_data, else you point to func_data1. Now you just have to
differentiate both cases whithin your callback. May be a struct member
in the struct pointed to by func_data is all is needed.

E.g.:

 | typedef struct func_data { /* generic */
 |   int whence; /* 0 for A, 1 for B; better use enum! */
 |   union {
 | struct {
 |   blah blah
 | } A;
 | struct {
 |   bloh bloh
 | } B;
 |   } stuff;
 | } fundata;

Then on place A:

 | fundata *f1 = g_new(fundata, 1);
 | f1-whence = 0; /* called from A */
 | f1-stuff.A.foo = 2;
 | ...
 | gtk_signal_connect(obj, foobar from A, fun, f1);

Likewise on place B

HTH
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFf8c9Bcgs9XrR2kYRAtGdAJ0aTJtY28xsXn/GBswufUMP0+9ABwCeNf1b
/0hhs6jwYnJ/jJJeMtK1cD8=
=r6JY
-END PGP SIGNATURE-

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

Re: FW: Need to get the widget focused

2006-12-13 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Dec 13, 2006 at 10:01:13AM -0500, John K Luebs wrote:

[...]

 What idiots write this shit, and wy are they allowed to practice law?

...maybe because they otherwise would write programs :-D

(SCNR)

- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFgCyBBcgs9XrR2kYRAoXZAJ9XpZTvmWONpSaqs7j3uvt490xAnQCeKb0R
oPb4zkJiIKczOEehwJBwToM=
=Razu
-END PGP SIGNATURE-

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

  1   2   >