GObject docs improvements

2007-02-07 Thread Stefan Kost
hi,

yesterday I committed a first batch of cleanups to the GObject docs.
http://developer.gnome.org/doc/API/2.0/gobject/index.html

IMHO this is a crucial documentation for the GNOME platform and it can  
be improved further. Marc-Andre Lureau and Zeeshan Ali already joined  
in the quest to improve this. What I like to ask you is to reply to  
this mail and tell us what you don't understand yet, point out parts  
that can be improved, let us know if there are some nagging concerns  
about the way GObject works. Are there details that should be  
explained by a picture?

If possible then please checkout the latest version and base your  
feedback on that one:
   svn co http://svn.gnome.org/svn/glib/trunk glib
   cd glib
   ./autogen.sh --prefix=$HOME/test
   make
   cd docs/reference/gobject
   evince html/index.html &
you don't need to install it.

Thanks!

Stefan

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


when and where to destroy "popup menu"?

2007-02-07 Thread Zhang Yang
Hello.
I have created a popup menu in my function(list below). But I have a
question "when and where to destroy it?".
 I tried connect its selection-done handler to gtk_widget_destroy.But it
seems nothing happened. I run the program and monitor it through
"system monitor". The program continuing eat memory when I right click
the treeview to popup menu. 

Thanks for any help.

Best regards.


[CODE]
gboolean jmView_OnButtonPressed(GtkWidget *tv,GdkEventButton
*event,gpointer userdata){
if(GDK_BUTTON_PRESS == event->type && event->button == 1){
g_print("left click on treeview\n");
}else if(GDK_BUTTON_PRESS == event->type && 3 == event->button){
GtkTreeSelection *treeSel = NULL;
GtkTreePath *treePath = NULL;
GladeXML *xml = NULL;
GtkWidget *popupMenu = NULL,*jmPopupMenu_open=NULL,*jmPopupMenu_add =
NULL;
treeSel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
if(gtk_tree_selection_count_selected_rows(treeSel) < 1){
return TRUE;
}
if(FALSE ==
gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv),(gint)event->x,(gint)event->y,&treePath,NULL,NULL,NULL)){
return TRUE;
}
//here create the menu
popupMenu = libcore_get_widget(&xml,"menuCategory");
jmPopupMenu_open = libcore_get_widget(&xml,"menuitemCategoryOpen");
jmPopupMenu_add = libcore_get_widget(&xml,"menuitemCategoryAdd");

g_signal_connect(GTK_MENU_ITEM(jmPopupMenu_open),"activate",(GCallback)jmPopupMenu_open_onActivate,treePath);

g_signal_connect(GTK_MENU_ITEM(jmPopupMenu_add),"activate",(GCallback)jmPopupMenu_add_onActivate,treePath);

g_signal_connect(GTK_MENU_SHELL(popupMenu),"selection-done",gtk_widget_destroy,popupMenu);

gtk_menu_popup(GTK_MENU(popupMenu),NULL,NULL,NULL,NULL,event->button,event->time);
g_print("right click on treeview\n");
//  gtk_widget_destroy(popupMenu);
return TRUE;

}
return FALSE;
}

[/CODE]


___
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 08:32:26PM +0100, Mehmet YASAR wrote:
> [EMAIL PROTECTED] a écrit :
[...]
> >> 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.
> 
> I had already done some experimentation and I've found that widgets may 
> get more than one size-allocate signal.

[...]

Yes, I suppose you'd have to "track" the size as it changes. If you have
to do an action  hwenever the size really, truly changed (meaning it has
been displayed and all is quiescent), perhaps an idle handler would be
the right place.

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

iD8DBQFFyrrRBcgs9XrR2kYRAv5IAJ492lpDlVYRLNQMTW5tyQg7tyzCtQCfdpVr
CbfgmDGn4JNUmPkHHam9lZI=
=UcZq
-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: transparent gtkwindow

2007-02-07 Thread Suma H.S
It doesn't work. Can u plz give me a working example if u have?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Brian J.
Tarricone
Sent: Wednesday, February 07, 2007 3:15 PM
To: gtk-app-devel-list@gnome.org
Subject: Re: transparent gtkwindow


Suma H.S wrote:
> thanks...shall look into that.
> But, do u by any chance know how to use multiple masks for the function
> gtk_widget_shape_combine_mask ()?
> If I try to call this function multiple times using different mask
> everytime, only the effect of the last call is seen.
> I want to have the effect of gdk_window_set_child_shapes() fuction
(whatever
> it claims that it does, in the doc). But I have problem using that
function
> since I am using gtkwindow.

There may be a better way of doing this, but you can probably do:

GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_realize(win);
gdk_window_set_child_shapes(win->window, ...);

-brian

___
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: GtkFileChooserDialog: response from Location

2007-02-07 Thread Braden McDaniel
On Wed, 2007-02-07 at 20:56 -0500, Braden McDaniel wrote:
> It seems that--by default, at least--pressing "Enter" in the Location
> entry of a GtkFileChooserDialog does not constitute a "response" (that
> is, it does not close the dialog).
> 
> Can this be changed? Or can it be fudged?

Nevermind. I just needed to do:

gtk_dialog_set_default_response(GTK_DIALOG(file_chooser_dialog),
GTK_RESPONSE_ACCEPT);

-- 
Braden McDaniel   e-mail: <[EMAIL PROTECTED]>
Jabber: <[EMAIL PROTECTED]>


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


Re: GtkFileChooserDialog: response from Location

2007-02-07 Thread Leandro A. F. Pereira
Hello, Braden!

On 2/7/07, Braden McDaniel <[EMAIL PROTECTED]> wrote:
>
> (I came across  in the
> course of googling about this. But it just left me more confused;
> particularly Federico's last comment about there being "no location
> dialog anymore in GTK+ 2.10". I'm using 2.10.8, and I do have the
> location entry. Perhaps he's talking about something else.)
>

Yes, he is. GTK+ 2.10 has a Location entry inside the File Chooser,
while older versions had a Location Dialog (which you had to press
Ctrl+L to open).

Cheers!

-- 
  Leandro A. F. Pereira <[EMAIL PROTECTED]>
  Developer, Tiamat Software Wizardry.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkFileChooserDialog: response from Location

2007-02-07 Thread Braden McDaniel
It seems that--by default, at least--pressing "Enter" in the Location
entry of a GtkFileChooserDialog does not constitute a "response" (that
is, it does not close the dialog).

Can this be changed? Or can it be fudged?

(I came across  in the
course of googling about this. But it just left me more confused;
particularly Federico's last comment about there being "no location
dialog anymore in GTK+ 2.10". I'm using 2.10.8, and I do have the
location entry. Perhaps he's talking about something else.)

-- 
Braden McDaniel   e-mail: <[EMAIL PROTECTED]>
Jabber: <[EMAIL PROTECTED]>


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


Re: transparent gtkwindow

2007-02-07 Thread Brian J. Tarricone
Suma H.S wrote:
> thanks...shall look into that.
> But, do u by any chance know how to use multiple masks for the function
> gtk_widget_shape_combine_mask ()?
> If I try to call this function multiple times using different mask
> everytime, only the effect of the last call is seen.
> I want to have the effect of gdk_window_set_child_shapes() fuction (whatever
> it claims that it does, in the doc). But I have problem using that function
> since I am using gtkwindow.

There may be a better way of doing this, but you can probably do:

GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_realize(win);
gdk_window_set_child_shapes(win->window, ...);

-brian

___
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 Mehmet YASAR
[EMAIL PROTECTED] a écrit :
>> 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.

I had already done some experimentation and I've found that widgets may 
get more than one size-allocate signal.

Suppose the GtkVBox is empty, after adding some widgets the vertical 
scrollbar is shown, the widgets get another "size-allocate" signal (the 
GtkScrollBar is reducing the available space).

___
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: Newby question on Glade2

2007-02-07 Thread Tristan Van Berkom
On Wed, 2007-02-07 at 10:32 -0500, Gerald I. Evenden wrote:
> Host hardware: amd64. OS-flavor: kubuntu
> 
> I managed to successfully complete one of the tutorials on Glade2 by getting 
> an example up and running and making a few personal tweaks to the project.
> I feel that I am ready to progress to using Glade2 to provide a gui to 
> frontend some software that is currently only executed by command-line.  To 
> be sure, I will keep it simple and progress to more complex application as I 
> learn.
> 
> However, at the moment I am at a loss as to how to incorporate software 
> (either as local C files that I would rather not imbed into callbacks.c or 
> external libraries) into the make system generated by the Glade2 'build' 
> operation.  Admittedly, despite more that 20 years of C program, I am 
> ignorant of anything but basic Make operations and totally overwelmed by the 
> processes of 'autogen' and such.  I am a simple mathematician/cartographer 
> and not and not capable of Stallmanesque gurumanship.

Hi !

Please dont generate code with glade :D please enjoy libglade, note also
that in the future gtk+ will parse glade files natively, there is really
no need for generating any code - the libglade api is also very very
simple.

If you want to try out glade3, you can grab a tarball at 
http://ftp.gnome.org/pub/GNOME/sources/glade3/3.0/

Regardless, the glade files generated by glade 2 & 3 will both work
with libglade.

Once you've got libglade you should be able to compile your app with
this line:

gcc -o prog prog.c `pkg-config --cflags --libs gtk+-2.0 gmodule-2.0
libglade-2.0`

If you need to make a proper package, all I can suggest is that you
do what we all did, take an example package that exists, copy the
configure.ac, autogen.sh, base Makefile.am and work from there...
anjuta is doing some work on automating this, but I dont know how
far they are on that front...

Cheers,
  -Tristan



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


Newby question on Glade2

2007-02-07 Thread Gerald I. Evenden
Host hardware: amd64. OS-flavor: kubuntu

I managed to successfully complete one of the tutorials on Glade2 by getting 
an example up and running and making a few personal tweaks to the project.
I feel that I am ready to progress to using Glade2 to provide a gui to 
frontend some software that is currently only executed by command-line.  To 
be sure, I will keep it simple and progress to more complex application as I 
learn.

However, at the moment I am at a loss as to how to incorporate software 
(either as local C files that I would rather not imbed into callbacks.c or 
external libraries) into the make system generated by the Glade2 'build' 
operation.  Admittedly, despite more that 20 years of C program, I am 
ignorant of anything but basic Make operations and totally overwelmed by the 
processes of 'autogen' and such.  I am a simple mathematician/cartographer 
and not and not capable of Stallmanesque gurumanship.

Is there some expanded documentation/tutorial that may cover the problem of a 
project involving non-gtk *.c/h files and non-gtk libraries not already 
referenced by the Glade2 system?

Many thanks.

PS: I am aware that there is a Glade3 but a binary does not seem to be 
available for my machine.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


pixel position of a point

2007-02-07 Thread ferri_marllo

Hello!!
I have plot points in an X-Y plot using this code:


void grafica(GtkWidget *plot)
{
 GdkColor color;
 GtkPlotAxis *axis;
 int i,j,k,l;
 
 int np_x,np_y;
 np_x=0;
 np_y=0;
 
 
 t1a=g_array_new(FALSE,FALSE,sizeof(gdouble));
 t2a=g_array_new(FALSE,FALSE,sizeof(gdouble));
 v1a=g_array_new(FALSE,FALSE,sizeof(gdouble));
 v2a=g_array_new(FALSE,FALSE,sizeof(gdouble));
 

 
 matriz = &mat[0][0];   
 tiempo[FILAS] = mat[FILAS][0];
 var1[FILAS] = mat[FILAS][1];
 var2[FILAS] = mat[FILAS][2];
 
 
 fp=fopen(fichero_partida,"r");
 fp_sal=fopen("c:\\dev-cpp\\datos\\greca_matriz.txt","w");
 
 matriz=(double*)malloc(FILAS*COL*sizeof(double*));
 if(matriz==NULL)
 {
  g_print("No hay memoria");
 }
 
  
 for(i=0;i=0.0 && var2[k]>=-50.0)
{g_array_append_val(t2a,tiempo[k]);
  np_y=np_y+1;}

if(var2[k]>=-50.0)
{g_array_append_val(v2a,var2[k]);}
if(tiempo[k]>=0.0 && var1[k]>=-50.0)
{
 np_x=np_x+1;
 g_array_append_val(t1a,tiempo[k]);}
if(var1[k]>=-50.0)
{g_array_append_val(v1a,var1[k]);}
   }
   fprintf(fp_sal,"%d %d\n",np_x,np_y);
 
   
  
   
   t1=(gdouble*)t1a->data;
   t2=(gdouble*)t2a->data;
   v1=(gdouble*)v1a->data;  
   v2=(gdouble*)v2a->data;  
   
   g_array_free(t1a,FALSE);
   g_array_free(t2a,FALSE);
   g_array_free(v1a,FALSE); 

   g_array_free(v2a,FALSE);   
 
 

dataset[0] = GTK_PLOT_DATA(gtk_plot_data_new());
gtk_plot_add_data(GTK_PLOT(plot), dataset[0]);
gtk_widget_show(GTK_WIDGET(dataset[0]));


gtk_plot_data_set_points(dataset[0], t1, v1,NULL,NULL,np_x);

gdk_color_parse("red", &color);
gdk_color_alloc(gdk_colormap_get_system(), &color); 

gtk_plot_data_set_symbol(dataset[0],GTK_PLOT_SYMBOL_DIAMOND,
  GTK_PLOT_SYMBOL_EMPTY,10, 2, &color, &color);
gtk_plot_data_set_line_attributes(dataset[0],GTK_PLOT_LINE_SOLID,0, 0, 1,
&color);

   

  
  fclose(fp);
  fclose(fp_sal);
 
}


but i'd like to know the pixel position of each plotted point in reference to
all the screen.
How can i Do it??

thanks a lot!



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


RE: transparent gtkwindow

2007-02-07 Thread Suma H.S
thanks...shall look into that.
But, do u by any chance know how to use multiple masks for the function
gtk_widget_shape_combine_mask ()?
If I try to call this function multiple times using different mask
everytime, only the effect of the last call is seen.
I want to have the effect of gdk_window_set_child_shapes() fuction (whatever
it claims that it does, in the doc). But I have problem using that function
since I am using gtkwindow.

Regards,
Suma


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Tor Lillqvist
Sent: Wednesday, February 07, 2007 2:58 AM
To: gtk-app-devel-list@gnome.org
Subject: Re: transparent gtkwindow


 > > How to create a transparent gtkwindow with alpha values on Windows and
 > > Linux?

Presumably you mean with the X11 backend (which is in no way Linux
specific) when you say "on Linux"?

 > gtk_widget_shape_combine_mask () could be what you want.

No, it wouldn't. That sets the shape of a window. That's nothing new,
it has been in GTK+ since ages. It does work on both X11 (as long as
the X server has the SHAPE extension, which I guess they practically
all do) and Windows.

Instead, take a look at testgtk.c in recent GTK+ distributions. Look
for the create_alpha_window() function.

But I'm afraid that this doesn't work on Windows. Sorry. The Windows
API one has to use to fully support per-pixel alpha is horribly broken
by design, and making gdk/win32 use it seems rather impossible. (I
spent one weekend looking into it, so trust me, this isn't just a gut
feeling. I would love to be proved wrong, of course.)

Using just one fixed alpha value for a whole window is much easier in
the Windows API, but then there is no API to request that in GTK+. I
probably should add a feature request for that to Bugzilla and maybe
even implement it.

--tml
___
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: transparent gtkwindow

2007-02-07 Thread Tor Lillqvist
 > > How to create a transparent gtkwindow with alpha values on Windows and
 > > Linux?

Presumably you mean with the X11 backend (which is in no way Linux
specific) when you say "on Linux"?

 > gtk_widget_shape_combine_mask () could be what you want.

No, it wouldn't. That sets the shape of a window. That's nothing new,
it has been in GTK+ since ages. It does work on both X11 (as long as
the X server has the SHAPE extension, which I guess they practically
all do) and Windows.

Instead, take a look at testgtk.c in recent GTK+ distributions. Look
for the create_alpha_window() function.

But I'm afraid that this doesn't work on Windows. Sorry. The Windows
API one has to use to fully support per-pixel alpha is horribly broken
by design, and making gdk/win32 use it seems rather impossible. (I
spent one weekend looking into it, so trust me, this isn't just a gut
feeling. I would love to be proved wrong, of course.)

Using just one fixed alpha value for a whole window is much easier in
the Windows API, but then there is no API to request that in GTK+. I
probably should add a feature request for that to Bugzilla and maybe
even implement it.

--tml
___
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 myasar
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 ...
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list