GtkTreeView issues (porting from GtkCList)

2005-05-30 Thread Yury Aliaev

Hi everybody!

Now I'm porting some project from Gtk+-1.2 to Gtk+-2.6 and have some 
questions on GtkTreeView (with GtkListStore as a model):
1) Rows in GtkTreeView are higher than in GtkCList because of the much 
free space between them. How can I make GtkTreeView more compact?
2) When pressing the left mouse button and moving the cursor vertically 
the selection in GtkCList follow the cursor. In GtkTreeView -- not. How 
can I obtain in GtkTreeView the same behavior as in GtkCList?


Thanks in advance!

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


GnomeDateEdit

2005-05-30 Thread abhi rocks
hi

Could someone please tell me how to access the
GtkEntry field in the GnomeDateEdit widget.
Or it would be cooler if someone could tell me how to
extract the date and time from time_t data type.

Thanks 
Abhishek Samuel





___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Distinguish between G_IO_ERR and G_IO_HUP

2005-05-30 Thread Colossus

Hi,

I'm trying to catch the returned error message of the unzip
executable with GIOChannel. I use g_spawn_async_with_pipes and
then I create a GIOChannel and then i call g_io_add_watch. I run
unzip with an incomplete zip file so the have the unzip executable
fails with an error message but the G_IO_ERR conditions is never met, 
while the G_IO_HUP is met when both the pipe ends and when the unzip 
returns an error; how can I distinguish the two conditions so to have 
my application emits an appropriate gtk_dialog with an error message 
when unzip fails to open the zip archive ?

--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

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


Re: Distinguish between G_IO_ERR and G_IO_HUP

2005-05-30 Thread Tim Müller
On Monday 30 May 2005 13:31, Colossus wrote:

 I'm trying to catch the returned error message of the unzip
 executable with GIOChannel. I use g_spawn_async_with_pipes and
 then I create a GIOChannel and then i call g_io_add_watch. I run
 unzip with an incomplete zip file so the unzip executable
 fails with an error message but the G_IO_ERR condition is never met,
 while the G_IO_HUP is met when both the pipe ends and when the unzip
 returns an error; how can I distinguish the two conditions so to have
 my application emits an appropriate gtk_dialog with an error message
 when unzip fails to open the zip archive ?

The G_IO_ERR condition only occurs if there is an error on the pipe/iochannel. 
It has nothing to do with the child program being executed. To catch an error 
in your spawned unzip program, you'll need to:

 * pass the G_SPAWN_DO_NOT_REAP_CHILD flag to g_spawn_*
 * watch the child yourself via g_child_watch_add ()

When the child exits, the callback function you passed to g_child_watch_add() 
is called with the exit status of the child, which will tell you if the child 
exited with an error or not. On unix, you'll need the macros described in the 
waitpid manpage to interpret the exit code (e.g. if (WIFEXITED(status)  
WEXITSTATUS(status) == EXIT_SUCCESS) then it's a normal exit, otherwise there 
was an error or the program received a fatal signal). No idea how to 
interpret the exit code on win32.

Alternatively, or in addition, you could just watch stderr for messages, and 
assume that an error has occured if unzip prints a message to stderr.

Cheers
 -Tim

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


Re: GnomeDateEdit

2005-05-30 Thread Peter Bloomfield

On 05/30/2005 05:42:49 AM, abhi rocks wrote:

hi

Could someone please tell me how to access the
GtkEntry field in the GnomeDateEdit widget.


I believe you can't.


Or it would be cooler if someone could tell me how to
extract the date and time from time_t data type.


g_date_set_time will initialize a GDate from GTime (= time_t).   
To get the time of day: gmtime_r or localtime_r?


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


get parent

2005-05-30 Thread Giovanni Manenti

Hi, how can I get the parent of a widget?

I'm using gtk 1.2.


thanks
Giovanni

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


Re: get parent

2005-05-30 Thread Roger Leigh
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Giovanni Manenti [EMAIL PROTECTED] writes:

 Hi, how can I get the parent of a widget?

 I'm using gtk 1.2.

Check gtk/gtkwidget.h (widget-parent).  GTK+ 1.2 is well past it's
use by date, though.  Use gtk_widget_get_parent() in GTK+ 2.x.


Regards,
Roger

- -- 
Roger Leigh
Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
Debian GNU/Linuxhttp://www.debian.org/
GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 http://mailcrypt.sourceforge.net/

iD8DBQFCmyAJVcFcaSW/uEgRAkpiAKCkkvgPeV8K+ya5bmdpPBGPnBA+wQCg3Mz1
/h8sBGiyAcS5A1rk4oSfBGI=
=OlT1
-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


State changing of Toggle Buttons

2005-05-30 Thread Michal Porzuczek
Hi,

I was wondering if it is possible to set a Toggle Button's state to
something else when you are inside another Toogle Button's callback. I
know there is the gtk_toggle_button_set_active method but that
requires you to have the GtkToggleButton. Is there another method that
only uses the Widget to change its state? Or is there an easy way of
accessing the GtkToggleButton from the Widget?

Thanks in advance

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


Arguments in GObject-based object constructor

2005-05-30 Thread Jacob Kroon
Lets say I've written an abstract class Foo (a class that is not 
supposed to be instantiated), and a
class that inherits from Foo called Bar, which is instantiable. Foo 
takes 2 constructor arguments/properties
x and y. Bar:s constructor takes the samt arguments. In order to 
initialize some of Bar:s attributes,
it needs to know both x and y. In the bar_init() function I can't 
get the x and y properties,
because they arent set yet, so where do I initialize the attributes? 
Should I hook into the get/set property of
both x and y, and once both are set (check with some boolean 
variables), I can initialize them in bar_set_property() ?

That way sounds a little too complicated so I think I'm missing something.

The GObject documentation states:

static void
maman_bar_init (GTypeInstance   *instance,
   gpointer g_class)
{
 MamanBar *self = (MamanBar *)instance;
 self-private = g_new0 (MamanBarPrivate, 1);

 /* initialize all public and private members to reasonable default values. */
 /* If you need specific consruction properties to complete initialization,
  * delay initialization completion until the property is set. 
  */

}

What does it mean by delay initialization completion until the property 
is set ?


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


Re: State changing of Toggle Buttons

2005-05-30 Thread Peter Bloomfield

On 05/30/2005 04:44:00 PM, Michal Porzuczek wrote:

Hi,

I was wondering if it is possible to set a Toggle Button's  
state to something else when you are inside another Toogle  
Button's callback. I know there is the  
gtk_toggle_button_set_active method but that requires you to  
have the GtkToggleButton. Is there another method that only  
uses the Widget to change its state? Or is there an easy way of  
accessing the GtkToggleButton from the Widget?


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


Re: Arguments in GObject-based object constructor

2005-05-30 Thread Tristan Van Berkom

Jacob Kroon wrote:
[...]
What does it mean by delay initialization completion until the property 
is set ?


You can override the constructor in your class_init function

see: le-hacker.org/papers/gobject/

and read about the constructor, it is important that you chain up
to the real gobject constructor in your constructor, after the
real constructor returns, your my_instance_init() function will
have been called and all construct properties will have been
applied.

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


Re: Arguments in GObject-based object constructor

2005-05-30 Thread Roger Leigh
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jacob Kroon [EMAIL PROTECTED] writes:

 Lets say I've written an abstract class Foo (a class that is not
 supposed to be instantiated), and a class that inherits from Foo
 called Bar, which is instantiable. Foo takes 2 constructor
 arguments/properties x and y. Bar:s constructor takes the samt
 arguments. In order to initialize some of Bar:s attributes, it needs
 to know both x and y. In the bar_init() function I can't get the
 x and y properties, because they arent set yet, so where do I
 initialize the attributes?

Object properties are set after construction has finished.  That is,
after the contructors and init functions have been called.  You need
to override the get_property and set_property vfuncs of GObjectClass,
and install properties of type G_PARAM_CONSTRUCT.

As an example, have a look at

http://arch.debian.org/cgi-bin/archzoom.cgi/[EMAIL 
PROTECTED]/uterm--mainline--0.1--patch-41/cse/cse-selection.h?template=plain
http://arch.debian.org/cgi-bin/archzoom.cgi/[EMAIL 
PROTECTED]/uterm--mainline--0.1--patch-41/cse/cse-selection.c?template=plain

This is a type derived from GObject.  Here's an example for a type
derived from GtkWidget (hrm, just spotted a bug!):

http://arch.debian.org/cgi-bin/archzoom.cgi/[EMAIL 
PROTECTED]/uterm--mainline--0.1--patch-41/cse/cse-canvas.h?template=plain
http://arch.debian.org/cgi-bin/archzoom.cgi/[EMAIL 
PROTECTED]/uterm--mainline--0.1--patch-41/cse/cse-canvas.c?template=plain

 Should I hook into the get/set property of both x and y, and
 once both are set (check with some boolean variables), I can
 initialize them in bar_set_property() ?  That way sounds a little
 too complicated so I think I'm missing something.

If x and y are properties of the parent Bar class, simply call
g_object_new() with the properties to set.  You don't need to do
anything more, since it will handle setting the properties for you.


Regards,
Roger

- -- 
Roger Leigh
Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
Debian GNU/Linuxhttp://www.debian.org/
GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 http://mailcrypt.sourceforge.net/

iD8DBQFCm5EwVcFcaSW/uEgRArahAKCl+DyuixROOQQJmae/5mP5Wc8fzwCbBYm5
Ow8w5Mjsn8qcsHqnp6MZWWw=
=jCfR
-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


simple example of using gdk_pixbuf_new_from_file

2005-05-30 Thread Raghavendra
-- Forwarded message --
From: Raghavendra [EMAIL PROTECTED]
Date: May 25, 2005 9:59 AM
Subject: Re: simple example of using gdk_pixbuf_new_from_file
To: Muthiah Annamalai [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org


i sucessfully loaded a image using pixbufs.
thanks to Mr.Muthiah.
but now i face the difiiculty of loading multiple images in a window
and those images are transparent one.
so each must be visible.
Any suggestions?
Please anyone help me out!

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


RE: simple example of using gdk_pixbuf_new_from_file

2005-05-30 Thread Freddie Unpenstein

 I sucessfully loaded a image using pixbufs, but now i face the
 difiiculty of loading multiple images in a window and those images
 are transparent one. so each must be visible.

You mean all overlapping each other?  You can only display a single flat 
image (animations not counted).  So if they're one ontop of another, you need 
to composit them together into a single image.

The preferred monster, is;

void gdk_draw_pixbuf (GdkDrawable *drawable, GdkGC *gc, GdkPixbuf *pixbuf, gint 
src_x, gint src_y, gint dest_x, gint dest_y, gint width, gint height, 
GdkRgbDither dither, gint x_dither, gint y_dither);

... or, if you don't mind using depreciated functions ...

void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable 
*drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, 
GdkPixbufAlphaMode alpha_mode, int alpha_threshold, GdkRgbDither dither, int 
x_dither, int y_dither);

(I didn't actually know the latter had been depreciated...  Seems they've 
ditched the alpha_mode and alpha_threshold, and added a gc instead.)

That's basically your main tool.  Composit them all together, probably into a 
new image of the appropriate size (unless you don't mind trashing the one at 
the bottom of the heap) and stick the result into a GtkImage or equivelant.


Fredderic

___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


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


gtk clist append

2005-05-30 Thread srinivas
hi;


 i have a pbm, using fileslection widget i am selecting the file and i
would like to append the same to the clist_widget. 

create_window_new2  is the window name, clist_sst_file_sel is the name
of the clist.   

sst_file_sel = create_window_new2 ();
clist_file_sel = lookup_widget (sst_file_sel, clist_file_sel);


data[0] = Hello;
data[1] = World;
gtk_clist_append (GTK_CLIST (clist_file_sel), data);
 
data[0] = Second;
data[1] = Row;
gtk_clist_append (GTK_CLIST (clist_file_sel), data);

message = (gchararray *) gtk_file_selection_get_filename
(GTK_FILE_SELECTION (fs));  

op = (GtkFileSelection *)gtk_file_selection_get_filename
(GTK_FILE_SELECTION (fs)); 

g_print (%s\n, op);

- //gtk_widget_show (sst_file_sel);

 now using this i am trying to append the text to the clist widget.
the appended text is visible only when if i gave the gtk_widget_show
(sst_file_sel); but using this another window is popping up. i need in
the same window it has to be appended. how can i get this;

thanks;

vasu. 

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


Re: Glade C code a bad thing? (was: root windows)

2005-05-30 Thread Gus Koppel
Maciej Katafiasz wrote:

  Unless by build of glade you mean autogenerated C code, which
  is bad, bad, bad thing to use. Use libglade, really.

  why it is bad? I use it and it works just fine and I don't have
  glade dependiencies.
 
 Because it makes it impossible to later rework UI without rewriting
 the code. In general, mixing autogenerated and hand-written code is
 always a bad idea, and that's exactly what is being done here.
 Besides, it hardcodes interface in code, which is also very bad thing.
 Fortunately, glade-3 won't support generating C, making it painfully
 obvious that libglade is the right thing.

Do all conceptual decisions by all developers make painfully obvious
that they are / were doing the right thing? If Glade 4 were to add
support for QT or MS-Windows resources or other nonsense, would it still
be painfully obviously the right thing?

Possibly contrary to you I've been using both ways, libglade and
hardcoded C source. After quite some time of performance drawbacks and
other quirks I returned to Glade C code and am very happy with it. I'm
co-working on a rather large Glade-based project, btw, with the .glade
file being  1 MB in size. For performance reasons, such files are
inherently unsuitable for being accessed via libglade.

In contrast, we have never experienced any impossibilities of reworking
UIs. There is no more Glade-related code to rewrite (just custom handler
code) when using Glade C code than when using libglade. I also don't see
why mixing auto-generated code with hand-written code is always a bad
idea or hardcoded interface is also very bad thing? Imagine that a
hardcoded interface is actually exactly what some people (developers and
users) WANT to have, for several reasons! (Speed, size, GUI can't be
altered by unauthorized people, installations, easier to program, etc.)

See URL below for an extended discussion of why Glade generated C code
is actually preferrable, why its ceasing support is regrettable and will
certainly cause quite some professional developers to stick to Glade 2.

http://mail.gnome.org/archives/gtk-app-devel-list/2005-January/msg00227.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list