Re: bar with label and two buttons

2012-12-29 Thread Lance Dillon




- Original Message -
 From: rastersoft ras...@rastersoft.com
 To: GTK App Devel gtk-app-devel-list@gnome.org
 Cc: 
 Sent: Saturday, December 29, 2012 6:31 PM
 Subject: bar with label and two buttons
 
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi all:
 
 I want to create a bar with two buttons and a label between, but I want
 that both buttons have exactly the same width, no matter if one has a
 large text and the other a shorter one. But also I don't want to fixate
 the width, like using a grid would mandate, but want that the width will
 be the minimum needed by the bigger button (I don't want to have
 problems if a translation results in a very long text). Finally, the
 label must be between both buttons, expanded, using the maximum
 available space.
 
 I created a picture with the idea, which is here:
 http://picpaste.com/buttons.png
 
 How can I do that?
 
 Thanks.
 
 - -- 
 Nos leemos
                  RASTER    (Linux user #228804)
 ras...@rastersoft.com              http://www.rastersoft.com
 

I think this might be what you want: 
http://developer.gnome.org/gtk3/stable/GtkSizeGroup.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: modifiable dialog button labels?

2012-03-08 Thread Lance Dillon






 From: Roger Davis r...@soest.hawaii.edu
To: Lance Dillon riffraff...@yahoo.com 
Cc: gtk-app-devel-list@gnome.org gtk-app-devel-list@gnome.org 
Sent: Thursday, March 8, 2012 2:07 AM
Subject: Re: modifiable dialog button labels?
 


On Wed, 7 Mar 2012, Lance Dillon wrote:

 you can use gtk_get_action_area() to get the GtkBox that that is the action
 area, that itself contains the buttons.  I believe you can then get all the
 child widgets, which would be the GtkButtons.
 
 The  docs for GtkDialog describes it some, but doesn't talk about getting the
 buttons.  I think you would have to go to the page for GtkBox for how to get
 the children.

Hi Lance,

The GtkDialog documentation tells only how to access the action area, not its 
children. Searching around I see a gtk_container_get_children() which 
presumably returns a list of GtkWidget pointers. Is there a way I can look at 
a widget pointer and detrmine the widget's type, i.e., figure out whether or 
not it's a button? I see references to a gtk_widget_get_type() on the web, but 
no good examples of how it's used, and it appears to be not present at all in 
my own GTK release's GtkWidget documentation. There also seem to be some 
related type discovery functions in the gobject library such as g_type(), 
etc., but so far I have not found any useful examples of how I might use them 
to figure out if any particular widget pointer is a button or not.

Thanks,

Roger

You would then use g_type_is_a() (possibly), perhaps with G_TYPE_FROM_INSTANCE 
and g_type_from_name():

GList *g,*g1;
g1=g=gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_action_area(dialogbox)));

while(g1);

if (g_type_is_a(G_TYPE_FROM_INSTANCE(g1-data),g_type_from_name(GtkButton))) {
  /* do something with button */
  g1=g_list_next(g1);
}

g_list_free(g);



You can of course create the dialog without buttons with gtk_dialog_new(), then 
add buttons manually with gtk_dialog_add_button(), and save the return value 
which is the widget, then change the labels on the buttons  when you need to.  
That may be easier than the above:

GtkWidget *d;
d=gtk_dialog_new();
GtkButton *b1,*b2;
b1=gtk_dialog_add_button(GTK_DIALOG(d),Wine,1);
b2=gtk_dialog_add_button(GTK_DIALOG(d),Beer,2);

Then do your gtk_dialog_run() later.  Then when you need to change the values, 
you can just do gtk_button_set_label(b1,Dog); gtk_button_set_label(b2,Cat), 
then reshow your dialog and gtk_dialog_run() again.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: modifiable dialog button labels?

2012-03-07 Thread Lance Dillon






 From: Roger Davis r...@soest.hawaii.edu
To: gtk-app-devel-list@gnome.org 
Sent: Wednesday, March 7, 2012 7:59 PM
Subject: modifiable dialog button labels?
 

Hi all,

I am trying to code some reusable GtkDialogs (i.e., create them only once,
then hide and reuse them later as necessary rather than destroying and 
recreating every time). I need numerous dialogs which ask a simple question
and then have two buttons for the user to choose between, e.g.,

    Favorite drink? Wine/Beer
    Which way? North/South

(Poor examples maybe, but you get the idea.) Seems like a waste to create
a bunch of different dialogs that are all using the same basic structure,
I would prefer to just create one and then modify its elements as needed.

I can see how to change a text label inserted into the dialog's content area
to alter my question text, but so far have discovered no way to alter the
text labels used in the buttons which I supply at creation time to
gtk_dialog_new_with_buttons(). Seems like this ought to be an easy thing
to do, but I can see no way to retrieve any pointer to the dialog's button
objects nor any way to explicitly set their labels after the dialog
has been created. Any ideas?  

Thanks!

Roger Davis
_

you can use gtk_get_action_area() to get the GtkBox that that is the action 
area, that itself contains the buttons.  I believe you can then get all the 
child widgets, which would be the GtkButtons.

The  docs for GtkDialog describes it some, but doesn't talk about getting the 
buttons.  I think you would have to go to the page for GtkBox for how to get 
the children.

-lsd




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


GtkBuilder issue?

2010-09-28 Thread Lance Dillon
I'm trying to add gtkbuilder support to pike (pike.roxen.com).

In loading a glade3 file, it says Invalid Object 'blah', unless I create an 
instance of the object first.  I narrowed it down to (in gtkbuilder.c):

static GType
gtk_builder_real_get_type_from_name (GtkBuilder  *builder, 
 const gchar *type_name)
{
  GType gtype;

  gtype = g_type_from_name (type_name);
  if (gtype != G_TYPE_INVALID)
return gtype;

  return _gtk_builder_resolve_type_lazily (type_name);
}

Which as you can see, calls _gtk_builder_resolve_type_lazily().  That function 
loads the module using GModule, using NULL to load the symbols of itself, find 
the *_get_type() function of the object, and calls it to get the type.  The 
type, of course, is not created until the first time it is used.

For some reason, my code doesn't do that.  The binding is a .so file that is 
dynamically loaded into the pike interpreter, so I'm hazarding a guess that it 
gets the symbols to the current module, which is not libgtk-x11.so (on linux 
anyway), so it can't find the *_get_type() function, so it gets G_TYPE_INVALID. 
 
I've been trying different things and so far nothing is working.

Does anybody have any idea how to get around this, to make it resolve properly?

Thanks


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


Re: GTK/GDK equivalent to UpdateWindow() ?

2010-07-04 Thread Lance Dillon




- Original Message 
 From: jcup...@gmail.com jcup...@gmail.com
 To: John Emmas john...@tiscali.co.uk
 Cc: gtk-app-devel-list gtk-app-devel-list@gnome.org
 Sent: Sun, July 4, 2010 12:51:52 PM
 Subject: Re: GTK/GDK equivalent to UpdateWindow() ?
 
 On 4 July 2010 16:50, John Emmas 
 href=mailto:john...@tiscali.co.uk;john...@tiscali.co.uk wrote:
 
 operation being processed.  Neither of those is quite what I need.  I'm 
 looking 
 for is a function that will force a window to be repainted at once, before 
 any 
 other pending events get processed.

There's 
 gdk_window_process_updates():

http://library.gnome.org/devel/gdk/stable/gdk-Windows.html#gdk-window-process-updates

But 
 I'm not certain is does much any more. Generally, you just paint
in the 
 expose handler and nowhere else, and calls like this 
 are
unnecessary.

What are you trying to achieve? Perhaps there's some 
 other way to get
the effect you 
 need.

John

-


Maybe this is what you want?


http://library.gnome.org/devel/gdk/stable/GdkDisplay.html#gdk-display-flush
http://library.gnome.org/devel/gdk/stable/gdk-Windows.html#gdk-window-flush

This one is possible, but the others may be more useful or relevant:

http://library.gnome.org/devel/gdk/stable/gdk-General.html#gdk-flush



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


Re: Setting the font for Gtk::Button

2010-05-06 Thread Lance Dillon




- Original Message 
 From: John Emmas john...@tiscali.co.uk
 To: gtk-app-devel-list@gnome.org
 Sent: Thu, May 6, 2010 7:23:16 AM
 Subject: Re: Setting the font for Gtk::Button
 
 
 On 6 May 2010, at 10:07, Murray Cumming 
 wrote:


 You have to set the font of the label in 
 the button, not the font of the
 button. I generally think this is 
 far too difficult.


 I have to admit, I would never 
 have guessed that!  Thanks for the tip,
 Murray.  I'll try it 
 out, later.

Hmmm  bafflement is settling in already.  
 How do I actually get the
label object?  I can see how I get the label's 
 text but not the object
itself.

The only thing that looks promising is 
 Gtk::Widget::list_mnemonic_labels()
but that does seem somewhat difficult if 
 it's the appropriate 
 interface
:-(

John


I would try gtk_bin_get_child(), since it is a subclass of GtkBin.

http://library.gnome.org/devel/gtk/stable/GtkBin.html#gtk-bin-get-child

/lsd


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


Re: outstream question [i think]

2009-08-27 Thread Lance Dillon
The best I can think of is to capture the output into a TextBuffer, and display 
using a TextView.

But as far as I know there really isn't anything like a fictional 
gtk_display_text() function.


- Original Message 
From: dev...@iamaquatics.org dev...@iamaquatics.org
To: gtk-app-devel-list@gnome.org
Sent: Thursday, August 27, 2009 6:31:58 PM
Subject: Re: outstream question [i think]

Siddu,

 what do u mean equivalent  cout statement for GTK .
 do u mean on the click of the button the results should be logged somewhere
 or need to printed on the stdout . be more clearer on this

The intent is to have the results go to the gui (as opposed to the console).


mysql show columns from customers;
++--+--+-+-++
| Field  | Type | Null | Key | Default | Extra  |
++--+--+-+-++
| vend_id| int(11)  | NO   | PRI | NULL| auto_increment |
| cust_lname | char(50) | YES  | | NULL||
| cust_fname | char(50) | YES  | | NULL||
| cust_phone | char(50) | YES  | | NULL||
++--+--+-+-++

--
Christopher Devlin
dev...@iamaquatics.org
O|ASS
  American Red Cross - LGI, WSI
  PADI - Divemaster
  Illinois Department of Public Health - Certified Pool Operator
  NSPF - CPO
___
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: status bars with multiples part

2008-12-17 Thread Lance Dillon
I believe you can set the size of a widget (gtk_widget_set_size_request).  That 
is the minimum size for the widget.  It can still be bigger if the containing 
widget is bigger.



- Original Message 
From: Luiz Rafael Culik Guimaraes l...@xharbour.com.br
To: Lance Dillon riffraff...@yahoo.com; gtk-app-devel-list@gnome.org
Sent: Wednesday, December 17, 2008 9:59:00 AM
Subject: Re: status bars with multiples part

Hi Lance


I would just pack 4 different statusbars in an hbox, and have each 
statusbar have it's own information.
thanks for the info, but is possible to specify the size of each part of 
statusbar ?

Regards
Luiz 


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


Re: inserting model in a GtkTreeStore

2008-04-27 Thread Lance Dillon


- Original Message 
From: Carlos Pereira [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Sunday, April 27, 2008 12:10:27 PM
Subject: inserting model in a GtkTreeStore

Hi all!

To insert the various nodes in a GtkTreeStore, the code below works for me.
The problem is, this should not work, because I am handling a
GtkTreeIter as if it was some sort of integer, while it is in fact a 
structure!

The current child node is the next parent node, so I would expect the 
proper
way to do this would be to copy the current node iter to the parent 
iter, and
because these are structures, I would have to copy their contents...

What is the standard way of doing this? I am confused!

Thanks!
Carlos

GtkTreeIter insert_row (GtkTreeStore *store, GtkTreeIter *parent, char 
*label)
{
GtkTreeIter iter;

gtk_tree_store_append (store, iter, parent);
gtk_tree_store_set (store, iter, 0, label, -1);

return iter;
}

void insert_model (GtkWidget *treeview)
{
GtkTreeStore *store;
GtkTreeIter iter1, iter2, iter3;

store = gtk_tree_store_new (1, G_TYPE_STRING);
iter1 = insert_row (store, NULL, Node 0);
iter2 = insert_row (store, iter1, Node 0:0);
insert_row (store, iter2, Node 0:0:0);
insert_row (store, iter2, Node 0:0:1);
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
g_object_unref (store);
}


---

I believe this is copying the struct (which is allowed as of c99 or something, 
I believe).  Now, if you leave the function and try to use one of the copied 
structs, it probably won't work, becuase these iters were allocated on the 
stack, and will have been freed.  You can do that only if you only will use the 
iter in the current function, otherwise you'll want to use it as a pointer 
instead.






  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTextView: inserting text with different styles

2008-03-17 Thread Lance Dillon


- Original Message 
From: Carlos Pereira [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Monday, March 17, 2008 8:46:02 AM
Subject: GtkTextView: inserting text with different styles

Hi,
Let's say I have a GtkTextView, with two color tags, red and blue:

text_view = gtk_text_view_new ();
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_create_tag (buffer, my_red, foreground, #ff, 
NULL);
gtk_text_buffer_create_tag (buffer, my_blue, foreground, #00ff00, 
NULL);

Now I want too insert Hello World:
gtk_text_buffer_insert_at_cursor (buffer, Hello , -1);
gtk_text_buffer_insert_at_cursor (buffer, World, -1);

but I want Hello to be red and World to be blue.

What is the usual procedure to achieve this?
(perhaps get the iterators for the last insertion? it should be quite
easy but apparently I could not find information about this...)

Thanks,
Carlos
---
I would do this:

GtkTextIter iter;
GtkTextTag *myred,*myblue;
GtkTextTagTable *tb;

/* blah blah blah */
/* start at top */
gtk_text_buffer_get_iter_at_offset(buffer,iter,0);
tb=gtk_text_buffer_get_tag_table(buffer);
myred=gtk_text_tag_new(my_red);
g_object_set(G_OBJECT(myred),foreground,#ff,NULL);
myblue=gtk_text_tag_new(my_blue);
g_object_set(G_OBJECT(myblue),foreground,#00ff00,NULL);
gtk_text_tag_table_add(GTK_TEXT_TAG_TABLE(tb),myred);
gtk_text_tag_table_add(GTK_TEXT_TAG_TABLE(tb),myblue);

gtk_text_buffer_insert(buffer,iter,random text...,-1);
gtk_text_buffer_insert_with_tags(buffer,iter,Hello ,-1,myred,NULL);
gtk_text_buffer_insert_with_tags(buffer,iter,World,-1,myblue,NULL);




There may be a little more efficient way to do this (add multiple tags to a tag 
table at the same time, perhaps?), but this is just off the top off my head...





  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Signal prototypes

2008-02-21 Thread Lance Dillon


- Original Message 
From: Gabriele Greco [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Thursday, February 21, 2008 8:40:05 AM
Subject: Signal prototypes


Given 
that 
different 
signals 
may 
have 
different 
prototypes:

clicked: 
void 
(*)(GtkWidget 
*, 
void 
*)
keypress: 
gboolean 
(*)(GtkWidget 
*, 
GdkEvent 
*, 
void 
*)
delete_event: 
gboolean 
(*)(GtkWidget 
*, 
void 
*)
[...]

There 
is 
a 
way, 
from 
the 
signal 
name, 
to 
find 
in 
ADVANCE 
what 
kind 
of 
prototype 
the 
signal 
will 
expect?

---
Bye,
 
Gabry


-


Try g_signal_query()

Use g_signal_lookup() to get the id from the signal name (and the type of 
object it acts on), then use g_signal_query() to get the in-depth information.

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



guint   g_signal_lookup (const gchar *name,
 GType itype);


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

___
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 insert a menu_item into the middle of a menu list ?

2008-01-27 Thread Lance Dillon


- Original Message 
From: John Coppens [EMAIL PROTECTED]
To: Gregory Hosler [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Sunday, January 27, 2008 12:09:39 PM
Subject: Re: how to insert a menu_item into the middle of a menu list ?


On Sun, 27 Jan 2008 22:42:47 +0800
Gregory Hosler [EMAIL PROTECTED] wrote:

 any thoughts or suggestions ?
 

Sorry about the previous message, Greg... I was writing from memory,
 and
seems memory didn't work as it should've...

The GList you obtain from _get_children is newly allocated so you can't
change anything there. 

But the MenuBar and Menu are both derived from MenuShell, which _does_
provide with several methods to manipulate items in the list, including
a  gtk_menu_shell_insert  to insert new items at a certain position.

John






GtkUiManager is a lot easier to manage menus with, and will do what you want a 
lot easier and better, and it is also easier to undo.







  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

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


Re: IP address entry widget

2008-01-07 Thread Lance Dillon
You could probably use libview, also.  It is a bunch of widgets that vmware 
made for their user interface.  I believe it has an ip address entry widget.

Go to freshmeat.net and look up libview.


- Original Message 
From: Micah Carrick [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Sunday, January 6, 2008 10:22:18 PM
Subject: Re: IP address entry widget


Andrew Krause's book Foundations of GTK+ Development uses an IP
 widget 
derived from an Entry as an example of writing custom widgets. Check it
 
out at www.gtkbook.com

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Bin Chen wrote:
 Hi,

 Is there any type of IP address entry widget existed? I want to let
 user input the IP address in dot form, and strict their input to
 0-255.

 Thanks.
 Bin
 ___
 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





  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

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


Re: App blueprint, advice please!

2007-12-16 Thread Lance Dillon


- Original Message 
From: Niels Heirbaut [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Sunday, December 16, 2007 2:32:04 AM
Subject: Re: App blueprint, advice please!


On Dec 16, 2007 3:27 AM, Patrick [EMAIL PROTECTED] wrote:

[snip]

 I want to build an App to control dozens or even hundreds of
 instruments
 using different ports/buses (GPIB, Serial, Parallel etc) and I want
 to
 do some fairly complex data processing after. Then I want to be able
 to
 save the data in a database and/or in numerous formats.

[snip]

There is an open source project called Comedi that might at least
provide the drivers for the data acquisition equipment. Have a look at
http://www.comedi.org/.


---

I used the comedi drivers to write code for the Diamond dmm32at card.  But, 
there were a couple of other cards that I wrote the drivers by hand, and the 
interface code was written in bash.  These were all PC/104 cards.  One was 
called Pearl, and was just a set of 16 switches, either open or closed.  You 
couldn't even tell whether a switch was open or closed, so I had to keep state 
information.  You got the state from the /proc interface.

Anyway, comedi is easy, but depending on the board, it may be overkill.

I also write one for the Sensoray model 518.  It was a lot of sensors, current 
loops, thermocouples, things like that.  I wrote it by hand, also.  I'm not 
sure if comedi would have been too much or not.






  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

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


Re: changing menu item labels

2007-12-09 Thread Lance Dillon


- Original Message 
From: Dr. Michael J. Chudobiak [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Sunday, December 9, 2007 9:18:15 AM
Subject: changing menu item labels


Hi all,

Is there an easy way to dynamically change the label associated with a 
menu item?

It want to implement a menu containing a fixed number of used-defined 
scripts with user-defined names. I would like the user-defined names to
 
appear in the menu.

- Mike


-

Check out GtkUiManager:

http://library.gnome.org/devel/gtk/unstable/GtkUIManager.html






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
___
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 destroy window if ptr to mainWindow not known

2007-12-06 Thread Lance Dillon


- Original Message 
From: Jim George [EMAIL PROTECTED]
To: Lukasz Gromotowicz [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Thursday, December 6, 2007 8:45:24 AM
Subject: Re: how to destroy window if ptr to mainWindow not known


On Dec 6, 2007 4:46 AM, Lukasz Gromotowicz [EMAIL PROTECTED] wrote:
 Hi all,

 the problem is when loading windows from the xml file:

   glade_xml = glade_xml_new(ami.glade,NULL,NULL);

 I need to know the reference to main window (GtkWindow) to be able to
 destroy it, yes?
 I can get it like this:
window = glade_xml_get_widget(glade_xml,window1);
 and destroy:
   gtk_widget_destroy(window);

 But what if there is no window1 in the glade file? Let's say
 updated xml
 changed the name to mainWindow?

 Window exists on the screen, but how to delete it?

I don't think the glade file should be edited while the program is
running... or is that what you are doing?

---

As far as I'm concerned, you should look at the glade file as one of the source 
files.  If it is changed, other things may need to be changed to reflect it.  
It isn't an unrelated file, as config files can be.





  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Lance Dillon
GtkPageSetupUnixDialog and GtkPrintUnixDialog don't exist on my system, even 
though it seems that they should.

Fedora 7
gtk2-2.10.14-3.fc7
gtk2-devel-2.10.14-3.fc7

Documentation 
(http://library.gnome.org/devel/gtk/unstable/GtkPageSetupUnixDialog.html) shows 
it was added in gtk+ 2.10.

However, the header files dont exist.  They do exist in the source, though:

/home/riffraff/src/gtk+-2.10.14/gtk
[EMAIL PROTECTED] gtk]$ ls gtkprintunixdialog.*
gtkprintunixdialog.c  gtkprintunixdialog.h  gtkprintunixdialog.lo
[EMAIL PROTECTED] gtk]$ ls gtkpagesetupunixdialog.*
gtkpagesetupunixdialog.c  gtkpagesetupunixdialog.h  gtkpagesetupunixdialog.lo
[EMAIL PROTECTED] gtk]$ 

But:
[EMAIL PROTECTED] gtk]$ ls -al /usr/include/gtk-2.0/gtk/gtkpagesetup*
-rw-r--r-- 1 root root 3765 2007-07-24 22:38 
/usr/include/gtk-2.0/gtk/gtkpagesetup.h
[EMAIL PROTECTED] gtk]$ ls -al /usr/include/gtk-2.0/gtk/gtkprintun*
ls: cannot access /usr/include/gtk-2.0/gtk/gtkprintun*: No such file or 
directory
[EMAIL PROTECTED] gtk]$ 

So, is something wrong with my system?  With the packages provided by Fedora?  
Or is the documentation incorrect?

Thanks,
Lance





  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

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


Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Lance Dillon


- Original Message 
From: David Nečas (Yeti) [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Tuesday, October 9, 2007 1:36:55 PM
Subject: Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

On Tue, Oct 09, 2007 at 10:26:30AM -0700, Lance Dillon wrote:
 GtkPageSetupUnixDialog and GtkPrintUnixDialog don't exist on my system, even 
 though it seems that they should.

They do.

 Fedora 7
 gtk2-2.10.14-3.fc7
 gtk2-devel-2.10.14-3.fc7

  rpm -q gtk2-devel | grep unix

should clarify things a lot...

 ...

 So, is something wrong with my system?  With the packages provided by Fedora? 
  Or is the documentation incorrect?

The Gtk+ Unix printing stuff is in gtk+-unix-print-2.0
pkg-config package.  If you really need to use the
non-portable Unix part of the API, you have to add flags
from this package.

Yeti


-

Okay, thanks for the help.  It doesn't appear that Fedora 7 doesn't provide 
these packages, at least not in the default repositories.






   

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos  more. 
http://mobile.yahoo.com/go?refer=1GNXIC
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Lance Dillon




WTF?

If the Fedora 7 packages

  gtk2-2.10.14-3.fc7
  gtk2-devel-2.10.14-3.fc7

*you* asked about are not provided by your Fedora 7, then at
least one of us is confused.

No, I meant the ones you referenced before:

 rpm -q gtk2-devel | grep unix


[EMAIL PROTECTED] ~]# yum list|grep gtk2-devel|grep unix
[EMAIL PROTECTED] ~]# 






  

Tonight's top picks. What will you watch tonight? Preview the hottest shows on 
Yahoo! TV.
http://tv.yahoo.com/ 

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


Re: Animation with GTK+

2007-09-12 Thread Lance Dillon
If you have an animated gif, you can use GtkImage.  If you need to actually 
sync it with something external, you can use GdkPixbufAnimation and 
GdkPixbufAnimationIter:

http://library.gnome.org/devel/gtk/unstable/GtkImage.html
http://library.gnome.org/devel/gdk-pixbuf/unstable/gdk-pixbuf-animation.html


- Original Message 
From: Prokopenko, Konstantyn [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Wednesday, September 12, 2007 9:38:18 AM
Subject: Animation with GTK+

Hello,

I'm totally new to the GUI application development in Linux X11. I was
mostly involved in embedded non-graphical development.
Now I need to create GUI interface application using GTK+. 
Could you advise me the best way to create animation of a rotating
object in GTK window? This object is going to be a picture of a device
rotating in sync with a real hardware device. Which library/extension I
can use?

Thank you.

Regards,
Konstantyn


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





  

Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Alternative GTK widgets

2007-05-14 Thread Lance Dillon
Their is also libview, which is the widgets that vmware created.  You can 
search on freshmeat for it.






   
Take
 the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos  more. 
http://mobile.yahoo.com/go?refer=1GNXIC
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkImage problem

2007-05-06 Thread Lance Dillon
I'm thinking you'll want to add:

gtk_widget_show_all(window);

With that you can remove:

gtk_widget_show(image);


- Original Message 
From: beginner.c [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Sunday, May 6, 2007 6:36:32 PM
Subject: Re: GtkImage problem


You are right. Thanks for that. Everything executes without error...except,
no image is displayed. 


void create_window (GtkWidget *window, GtkWidget *image)
{

GladeXML *gxml;

gxml = glade_xml_new (GLADE_FILE, NULL, NULL);

/* This is important */
glade_xml_signal_autoconnect (gxml);
window = glade_xml_get_widget (gxml, window);
image = glade_xml_get_widget (gxml, image1);
}

void funcImage (GtkWidget *image)
{
image = gtk_image_new();
gtk_image_clear(GTK_IMAGE(image));
gtk_image_set_from_file (GTK_IMAGE(image),
/home/s/Pictures/space-05.jpg);
gtk_widget_show(image);
}

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

#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, UTF-8);
textdomain (GETTEXT_PACKAGE);
#endif


gtk_set_locale ();
gtk_init (argc, argv);

create_window (window,image);

funcImage(image);
//gtk_widget_show_all (window);
gtk_main ();

return 0;
}











David Nečas (Yeti)-2 wrote:
 
 On Sun, May 06, 2007 at 04:06:11AM -0700, beginner.c wrote:
 
 I am in fact
 calling gtk_init() prior to any of these functions.
 
 No, you don't, the call to gtk_image_new() to initialize
 image
 
   GtkWidget *image = gtk_image_new();
 
 is performed before any code in main().
 
 Yeti
 
 --
 http://gwyddion.net/
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 

-- 
View this message in context: 
http://www.nabble.com/GtkImage-problem-tf3694858.html#a10350080
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.

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



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GModule

2007-01-29 Thread Lance Dillon


- Original Message 
From: Jordan Walsh [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Sunday, January 28, 2007 11:30:02 PM
Subject: GModule

Hi all. I need to be able to see from what library (using GModule) a certain
symbol comes from. In my main program when a plugin unloads I need to be
able to de-reference any pointers to its functions. I cannot however seem to
figure out how to see what module that function resides in. Thanks.




From what I can see from the api 
(http://developer.gnome.org/doc/API/2.0/glib/glib-Dynamic-Loading-of-Modules.html),
 you have to get symbol pointers yourself with g_module_symbol().  Therefore 
you should know already which module a symbol comes from.  You can probably 
keep track of the which symbols belong with which module using a GHashTable or 
something similar.







 

Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: g_signal_connect_swapped

2006-11-26 Thread Lance Dillon


- Original Message 
From: Matt Hoosier [EMAIL PROTECTED]
To: Richard [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Sunday, November 26, 2006 6:44:13 PM
Subject: Re: g_signal_connect_swapped

On 11/25/06, Richard [EMAIL PROTECTED] wrote:

 Could someone explain the reason for this function

 g_signal_connect_swapped

 I have read the manual here:

 http://www.gtk.org/tutorial/x159.html

 where it says:

 ,
 | g_signal_connect_swapped() is the same as g_signal_connect() except that
 | the instance on which the signal is emitted and data will be swapped
 | when calling the handler. So when using this function to connect
 | signals, the callback should be of the form
 |
 |
 | void callback_func( gpointer   callback_data,
 | ... /* other signal arguments */
 | GtkWidget *widget);
 |
 | where the object is usually a widget.
 `

 Could anyone express this a little clearer? I (as a gtk beginner) can
 see no reason for it.

This just means that the widget and callback_data pointers will be
pushed onto the call stack in the opposite order from their ordering
if hooked up with g_signal_connect(). If you're designing your own
callback function, this probably isn't useful; just use
g_signal_connnect() with a callback that has GObject* and gpointer
parameters [in that order].


-

I've used it for a couple of different things.  One, if you aren't concerned 
with the widget that it is concerning, then you can used _swapped() and have 
your user_data first, and not worry about where the widget is, somewhere at the 
end of the argument list.  Or another thing is with language bindings.  I'm 
writing the language binding for pike, and in the signal marshaller I'm taking 
the arguments and actually rearranging them kind of different, so that the pike 
funciton gets the widget, the user_data, then an array of the rest of the 
arguments.  This way the user can get the user_data at arg2, regardless of the 
number of other args there are.








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


Re: gtk_file_selection - select only folder?

2006-10-27 Thread Lance Dillon


- Original Message 
From: Alvis Koon [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Friday, October 27, 2006 5:31:17 AM
Subject: gtk_file_selection - select only folder?

Hi,

Quick question:
Is there a way to limit users to only select folders on gtk_file_selection?


--

I'd guess you can filter (with GtkFileFilter) on mime type, filtering on 
text/directory.







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


Re: GtkTextView: Applying tags at the cursor

2006-10-24 Thread Lance Dillon
- Original Message 
From: Samuel Lidén Borell [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Tuesday, October 24, 2006 1:49:54 PM
Subject: GtkTextView: Applying tags at the cursor

Hi,

I'm working on a web site creation software that uses Gtk, Glade and
Python for the UI. I'm using the GtkTextView widget to let the user edit
text with basic formatting but I have a question:

How do I apply a tag at the cursor so that inserted text gets it's
formatting? Right now I surround the cursor with two zero-width spaces
(an invisible Unicode character) and then I apply the tag to the spaces.
This gives new text the right formatting, but it's an ugly solution that
has some bugs...

-
I'm not sure there you can just add a tag at the current cursor position.  I'm 
creating the GTK2 bindings for the language Pike, and in my tests I created an 
array of tags that I need to apply at a certain position, then I added the text 
for that position, then applied that tags for that text range.  Something like 
this:

void insert_text(char *text) {
  GtkTextIter *start,*end,*iter;
  GtkTextMark *mark;

  mark=gtk_text_buffer_get_insert(GTK_TEXT_BUFFER(buffer));
  gtk_text_buffer_get_iter_at_mark(GTK_TEXT_BUFFER(buffer),start,mark);
  *start=*iter;
  gtk_text_buffer_insert(GTK_TEXT_BUFFER(buffer),text,-1);
  mark=gtk_text_buffer_get_insert(GTK_TEXT_BUFFER(buffer));
  gtk_text_buffer_get_iter_at_mark(GTK_TEXT_BUFFER(buffer),end,mark);
  /* foreach tag */
gtk_text_buffer_apply_tag(GTK_TEXT_BUFFER(buffer),tag,start,end);
  /* end */
}

I fudged on the foreach array iteration.  I have it simpler in pike, but 
basically the same thing.






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


Re: number of entries in GtkCombobox

2006-09-19 Thread Lance Dillon
I'm not sure I like this answer, it seems to be way to much for this question, 
but it looks like the best way to do it is to get a GtkTreeIter with 
gtk_tree_model_get_iter_first(), then walk the list with 
gtk_tree_model_iter_next(), counting up the number of rows:

GtkTreeIter iter;
int num,v;
GtkTreeModel *m;
m=gtk_combo_box_get_model(combo_box);
v=gtk_tree_model_get_iter_first(m,iter);
if (v) {
  num=1;
  while (v=gtk_tree_model_iter_next(m,iter))
num++;
} else
  num=0;



- Original Message 
From: [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Monday, September 18, 2006 11:54:21 AM
Subject: number of entries in GtkCombobox

Hi.
How do I get the number of entries in GtkComboBox (created with
gtk_combo_box_new_text() )?

Tomek
___
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: number of entries in GtkCombobox

2006-09-19 Thread Lance Dillon
Okay, that's better.  I didn't see the special case.


- Original Message 
From: [EMAIL PROTECTED]
To: Lance Dillon [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Tuesday, September 19, 2006 11:45:06 AM
Subject: Re: number of entries in GtkCombobox

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tue, Sep 19, 2006 at 08:34:56AM -0700, Lance Dillon wrote:
 I'm not sure I like this answer, it seems to be way to much for this question,
 but it looks like the best way to do it is to get a GtkTreeIter with
 gtk_tree_model_get_iter_first(), then walk the list with 
 gtk_tree_model_iter_next(),
 counting up the number of rows:

There is gtk_tree_model_iter_n_children ():

 | gint gtk_tree_model_iter_n_children(GtkTreeModel *tree_model,
 | GtkTreeIter *iter);
 | 
 | Returns the number of children that iter has. As a special case, if iter
 | is NULL, then the number of toplevel nodes is returned.

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

iD8DBQFFEBCCBcgs9XrR2kYRAnKoAJ9udyMXFULPZfDhdVt50d5H62MrFACeKB4s
pHwsM5/sWoBj4AkdwhbS5A0=
=ME1l
-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 Curves

2006-09-12 Thread Lance Dillon
Check out gtkdatabox:

http://www.eudoxos.net/gtk/gtkdatabox/


- Original Message 
From: Matias Torres [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Tuesday, September 12, 2006 3:25:58 PM
Subject: GTK Curves

hello,

i'm trying to make a curve based on some values passing a float array to 
a GtkCurve:
gtk_curve_set_vector ( GTK_CURVE (income_curve), length, array)

This results in well.. not a curve, but a number of straight lines like 
this:

4 
3
2   
1

(hope you understand, i just don't know how to explain it let's say i'm 
looking for a continuous curve)

Changing the curve type does not help at all (segmentation fault).

Do you know how to make it work? or.. Do you know some other library 
that let's me draw a curve based on a limited number of floats?

Thanks in advance. Matias

___
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: combo box

2006-09-11 Thread Lance Dillon
I would try the changed signal of GtkComboBox:
http://developer.gnome.org/doc/API/2.0/gtk/GtkComboBox.html#GtkComboBox-changed



- Original Message 
From: shibu Alampatta [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Monday, September 11, 2006 7:27:56 AM
Subject: combo box

i'm using a combo box and on selection of a particular item from the drop
down list i need to do some processing depending on the selection. which
signal i need to use for this purpose, i tried with selection_get signal .
it's not working. pls help me.

Thks in advance
Shibu
___
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: text with links

2006-09-11 Thread Lance Dillon
This example code does it.  You may want to make some changes, but it works.
#include stdio.h
#include gtk/gtk.h

GtkTextTag *tag1;

static void print_coords(GtkWidget *w, int x, int y) {
  gint bx,by;
  GtkTextIter iter;
  gint trail;
  gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(w),GTK_TEXT_WINDOW_WIDGET,
x,y,bx,by);
  gtk_text_view_get_iter_at_position(GTK_TEXT_VIEW(w),iter,trail,bx,by);
  if (gtk_text_iter_has_tag(iter,tag1))
g_debug(CLICKED ON LINK!);
}

static void click_link(GtkWidget *w, GdkEventButton *ev, gpointer g) {
  g_debug(x==%f,ev-x);
  g_debug(y==%f,ev-y);
  g_debug(button==%d,ev-button);
  switch (ev-type) {
case GDK_BUTTON_PRESS:
  g_debug(type==single click);
  print_coords(w,(int)ev-x,(int)ev-y);
  break;
/*
case GDK_2BUTTON_PRESS:
  g_debug(type==double click);
  break;
case GDK_3BUTTON_PRESS:
  g_debug(type==triple click);
  break;
case GDK_BUTTON_RELEASE:
  g_debug(type==button release);
  break;
*/
default:
  break;
  }
}

int main(int argc, char **argv) {
  GtkTextBuffer *buffer;
  GtkTextView *tv;
  GtkWidget *w;
  GtkTextIter iter;
  GtkTextTagTable *tb;

  gtk_init(argc, argv);

  w=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  g_signal_connect(G_OBJECT(w),delete_event,G_CALLBACK(gtk_false),NULL);
  g_signal_connect(G_OBJECT(w),destroy,G_CALLBACK(gtk_main_quit),NULL);
  tv=GTK_TEXT_VIEW(gtk_text_view_new());
  gtk_container_add(GTK_CONTAINER(w),GTK_WIDGET(tv));
  buffer=gtk_text_view_get_buffer(tv);
  gtk_widget_set_size_request(GTK_WIDGET(w),300,300);
  gtk_text_view_set_editable(tv,FALSE);

  tb=gtk_text_buffer_get_tag_table(buffer);
  tag1=gtk_text_tag_new(link);
  g_object_set(G_OBJECT(tag1),underline,PANGO_UNDERLINE_SINGLE,NULL);
  g_object_set(G_OBJECT(tag1),foreground,blue,NULL);
  gtk_text_tag_table_add(GTK_TEXT_TAG_TABLE(tb),tag1);

  gtk_text_buffer_get_iter_at_offset(buffer,iter,0);
  gtk_text_buffer_insert(buffer,iter,This is some sample text.\n\nA link is 
,-1);
  gtk_text_buffer_insert_with_tags(buffer,iter,here,-1,tag1,NULL);
  gtk_text_buffer_insert(buffer,iter,.\n\nMore text...\n,-1);
  
g_signal_connect(G_OBJECT(tv),button-press-event,G_CALLBACK(click_link),NULL);
  gtk_widget_show_all(w);
  gtk_main();

  return 0;
}


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


question about gclosures

2006-09-11 Thread Lance Dillon
The following code works:

// GtkTextView *tv;
g_signal_connect(G_OBJECT(tv),button-press-event,G_CALLBACK(click_link),NULL
);


However, I'm writing gtk2 bindings for pike, and use the following:

// signal_connect function for pike language binding
// blah blah
GClosure *gc=g_cclosure_new_swap(G_CALLBACK(my_signal_func_wrapper),
user_data,(GClosureNotify)my_free_func);
g_closure_set_marshal(gc,my_marshaller);
int id=g_signal_connect_closure(G_OBJECT(obj),signal_name,gc,1);
// more stuff...end of function

Now, using this code to connect my signals (in pike) seems to be working with 
all signals so far, except for the button-press-event above.

I connect destroy to the window, and it calls my marshaller (I put debug 
statements in).  But, the button-press-event doesn't call my marshaller at all, 
so it doesn't even get to the rest of the signal handler.

I know it works with clicked, destroy, delete, notify, and others.

Is there a possibility that I am missing something?  I'm continuing my 
debugging, but I'm not sure where to go to next...

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


Re: Conversion from GdkPixbuf to png

2006-09-08 Thread Lance Dillon
gdk_pixbuf_save() will save a pixbuf to png,jpg,ico,bmp

http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-file-saving.html#gdk-pixbuf-save



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


Re: text with links

2006-09-06 Thread Lance Dillon


- Original Message 
From: Paul Drynoff [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Wednesday, September 6, 2006 11:40:20 AM
Subject: text with links

Hello.

I need component like GtkTextView,
but with abbilities handle click on some words (links),
with interface like this:

component_name_mark_text_as_link(position)

on_click(gchar *link_value, gpointer arg)

is it possible implement with GtkTextView(exists any examples?),
or there is around any component with such features?

I found gtkhtml, but it has too many dependicies, and too many
functionality, which I not need.

The easiest and quickest way I can think of is create a TextView, add some 
TextAnchors, define some LinkButtons, and anchor the LinkButtons to the 
TextAnchors.





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


Re: text with links

2006-09-06 Thread Lance Dillon


- Original Message 
From: Paul Drynoff [EMAIL PROTECTED]
To: Lance Dillon [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Wednesday, September 6, 2006 12:31:20 PM
Subject: Re: text with links

On 9/6/06, Lance Dillon [EMAIL PROTECTED] wrote:
 The easiest and quickest way I can think of is create a TextView, add some
 TextAnchors, define some LinkButtons, and anchor the LinkButtons to the
 TextAnchors.

Thanks, without your help I never catch this feature of GtkTextView,
but there is some minor thing, what about LinkButton, I don't find
such component,
I have to write it?

No, actually, GtkLinkButton is a new widget in 2.10 I think.  If you are using 
gtk2.10, then just a plain GtkButton, perhaps marked up with an underline so 
it looks like a standard hypertext link.


I used GtkButton, but it is appered above the other text, and I can
not find method to make text in it it blue and underlined, here is
code:

--
What I would probably do is create a blank button, create a label with markup, 
then add the label to the button, since a button is just a container:

GtkLabel *lab=gtk_label_new();
gtk_label_set_markup(GTK_LABEL(lab),span underline=\single\ 
foreground=\blue\Link/span);
GtkButton *gb=gtk_button_new();
gtk_container_add(GTK_CONTAINER(gb),lab);

--


#include cstdlib
#include gtk/gtk.h

static void on_link(GtkButton *button, gpointer user_data)
{
g_debug(on_link\n);
}

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

  GtkWidget *topLevelWindow=gtk_window_new(GTK_WINDOW_TOPLEVEL);

  g_signal_connect(G_OBJECT(topLevelWindow), delete_event,
   G_CALLBACK(gtk_false), NULL);
  g_signal_connect(G_OBJECT(topLevelWindow), destroy,
   G_CALLBACK(gtk_main_quit), NULL);
  GtkTextView *tv = GTK_TEXT_VIEW(gtk_text_view_new());
  gtk_container_add(GTK_CONTAINER(topLevelWindow), GTK_WIDGET(tv));
  GtkButton *bt = GTK_BUTTON(gtk_button_new_with_label(link));
  gtk_button_set_relief(bt, GTK_RELIEF_NONE);
  g_signal_connect(G_OBJECT(bt), clicked, G_CALLBACK(on_link), NULL);

  GtkTextBuffer *buffer = gtk_text_view_get_buffer(tv);
  GtkTextIter iter;
  gtk_text_buffer_get_iter_at_offset(
buffer, iter, 0
  );
  gtk_text_buffer_insert(buffer, iter, aaa , -1);
  GtkTextChildAnchor *anchor =
  gtk_text_buffer_create_child_anchor(buffer, iter);
  gtk_text_buffer_insert(buffer, iter, \nbbb, -1);
  gtk_text_view_set_editable(tv, FALSE);
  gtk_text_view_add_child_at_anchor(tv, GTK_WIDGET(bt), anchor);

  gtk_widget_show_all(topLevelWindow);
  gtk_main();

  return EXIT_SUCCESS;
}




--

I would have to test this.  I think the gtk example does some anchors inline.


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


Re: text with links

2006-09-06 Thread Lance Dillon


- Original Message 
From: Paul Drynoff [EMAIL PROTECTED]
To: Lance Dillon [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Wednesday, September 6, 2006 2:52:00 PM
Subject: Re: text with links



I would have to test this.  I think the gtk example does some anchors inline.

The last problem is, if you trys example, you see that
in line aaa Link,
the Link and aaa is not on the same line,
can GtkTextView care about anchors automaticaly, or I should do it by my self?
I don't find API to get height of line in GtkTextView to resize button to it,
and interesting what happend if there are no text, only anchors on line,
is it climb on the next line?


What I'm thinking is that the padding and margin and stuff of the button is 
adding to the height.  

Didn't work.

What might be better is draw regular lines with markup as needed 
(blue,underline), and connect to button-press-event.  Then, when the button is 
clicked on one of your links, check whether it was a single click, grab the x 
and y coordinate of the click, then use gtk_text_view_window_to_buffer_coords() 
(perhaps?) to find where in the buffer the mouse was clicked.  You can create a 
GtkTextTag that has the appropriate markup (blue, underline) called link or 
something, then test whether your tag is on for the location, using 
gtk_text_iter_get_toggled_tags.




That's just a quick suggestion.  It may be round about, but it may work.

Other people may have something better and/or easier.


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


Re: GObject exposure

2006-08-22 Thread Lance Dillon
Maybe it is just me, but I don't see a problem with letting users access the 
object with gobject methods.  If you look at the api, there aren't that many, 
and there don't seem to be any that would harm too much.  Also, restricting 
access too much prevents people from using it in (perhaps beneficial) ways that 
you may not have originally imagined.

If you want to, you can override some of the original class methods, such as 
{set,get}_property.  But perhaps using the methods to your advantage would be 
better.

Such as the {set,get}_property methods.  You can let the user of the object 
change parameters in this way, rather than creating a dozen api calls to change 
this parameter, or that one.

Implementing signals could be nice also, let the user attach user-defined 
methods/signals/hooks to events that happen with your objects.

Perhaps look at ways to use the gobject methods, rather than seeing them as a 
way for users to get around your code...

-l


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


Re: Key-value file parser, howto get all groups and create loop from them

2006-08-14 Thread Lance Dillon
(I hate yahoo's quoting)

- Original Message 
From: Peter Firefly Lund [EMAIL PROTECTED]
To: Lance Dillon [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Monday, August 14, 2006 8:07:43 AM
Subject: Re: Key-value file parser, howto get all groups and create loop from 
them

On Mon, 14 Aug 2006, Lance Dillon wrote:

 The problem is your code doesn't seem to initialize iter in any way. 
 Before you call make_list, you should probably do something like this:

No, no.  make_list() by itself is fine.  It sets its local iter in every 
iteration through the call to gtk_list_store_append().
---

Okay, I see that..



But actually, the real question is: why keep a global iterator around in 
the first place?



I agree.  Iterators (both tree and text) get invalidated often, and they only 
seem to be valid if you use before making any other changes.




___
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 copy data between widgets?

2006-08-08 Thread Lance Dillon

 From: Román Gorojovsky [EMAIL PROTECTED]
 To: gtk-app-devel-list@gnome.org
 Sent: Tuesday, August 8, 2006 10:07:06 AM
 Subject: How to copy data between widgets?

 Hi all, sorry if this is a FAQ, but I've been reading the docs and I
 couldn't find the answer.  Not being too fluent in english, I couldn't
 find it in the archives, since I don't know what to look for.

 The problem is the following.  I have a text entry, a button and a
 label.  I want the label to display the text in the entry when you
 press the button.

 So far I've used g_signal_connect_swapped() connecting the clicked
 signal on the button with a callback that takes a pointer to the label
 as data.  But I couldn't pass more than that, so I could't pass a
 string nor the text entry.

But you can pass any kind of pointer, so make a struct, something like this:

struct my_data {
  GtkLabel *l;
  GtkEntry *e;
};

Then pass a pointer to an instance of your struct.  Now you have both widgets 
available in your callback.




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

Re: Fwd: Animation problem

2006-08-06 Thread Lance Dillon
What you can do is use g_object_get_property on the image to get the reference 
(or, if it doesn't reference it, you may need to use g_object_ref), then use 
g_object_set_property to set the image.  This works on GtkImage, for example.

- Original Message 
From: [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Sunday, August 6, 2006 8:33:41 AM
Subject: Fwd: Animation problem

Hi, unfortunately nobody seems to have an idea so far.
Perhaps I can try it more simple:
How can I replace an Image by another one at runtime (without producing a 
memory leak)?
In fact this could help to solve the same problem. At least it's worth a try...

Thanks, dasaspock



 Original-Nachricht 
Datum: Sun, 06 Aug 2006 03:40:53 +0200
Von: [EMAIL PROTECTED]
An: gtk-app-devel-list@gnome.org
Betreff: Animation problem

Hi, I have a problem with keeping an animated gif running while the gtk main 
loop is blocked.
The gif (called waitImage) is placed on a GtkDialog (waitDialog). The 
GdkPixbufAnimation behind waitImage is called waitImageAnimated.
I tried to do it like this:

while(...) {
  gtk_widget_queue_draw(GTK_WIDGET (GTK_DIALOG (waitDlg)-vbox));
  gdk_window_process_updates (gtk_widget_get_parent_window (GTK_DIALOG
  (waitDlg)-vbox), true);
  waitImagePixbuf = gdk_pixbuf_animation_iter_get_pixbuf(
  gdk_pixbuf_animation_get_iter(waitImageAnimated, NULL));
  gtk_image_set_from_pixbuf(GTK_IMAGE (waitImage),waitImagePixbuf);
}

But this doesn't work. The gif doesn't run.
Does anybody know, how to do it correctly?
A solution without memory leaks would be especially nice ;-)

Thank you, dasaspock
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
Feel free mit GMX DSL: http://www.gmx.net/de/go/dsl
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 


Feel free – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
___
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: Storing GObject in GtkListStore

2006-08-02 Thread Lance Dillon
As far as I can tell you can, as per this example:


http://developer.gnome.org/doc/API/2.0/gtk/GtkListStore.html#gtk-list-store-new

Notice how they set a column as a GDK_TYPE_PIXBUF, which is derived from 
G_OBJECT.  This implies that you can store anything derived from G_OBJECT in a 
column designated as such.  Of course, you may not be able to display that 
column unless you have a CellRenderer capable of grabbing some useful 
information from your object.

- Original Message 
From: Tomasz Jankowski [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Wednesday, August 2, 2006 9:51:08 AM
Subject: Storing GObject in GtkListStore

Hi!

Generally it isn't a problem, I'm only nosy :P I'd like to know if there is
some other (more recommended) way to store, for example GObject in
GtkListStore/GtkTreeStore. So far I do it, by creating column with type
G_TYPE_INT and storing there pointer to object.

-- 
Pozdrawiam!
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: GObject - problem, as usual

2006-08-01 Thread Lance Dillon
If I understand the problem correctly, you need to call the ancestor method's 
manually (regardless of whether it is a finalize methoed or anything else).  
There is s section on it in the gobject documentation:

http://developer.gnome.org/doc/API/2.0/gobject/howto-gobject-chainup.html

- Original Message 
From: Tomasz Jankowski [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Tuesday, August 1, 2006 6:10:15 AM
Subject: GObject - problem, as usual

Hi!

I'm writing some application based on GObject and I have problem when I'm
trying to destroy object. I have two object A and B, A derives from GObject
and B derives from A. I declared my own finalize methods for both objects,
but when I'm destroying B object only B finalize function is executed. When
I remowe B finlize function declaration from B_class_init () A finalize
function is executed normaly. Why B finalize method overrides A finalize
method and what should I do to remoe this overriding? Maybe some parts od my
code will be helpful:

GType A_get_type   (void)   {
   /*PRINT_DBG_IN_FUN_NAME*/

   static GType type = 0;
   if (type == 0) {
  static const GTypeInfo info = {
 sizeof (AClass),
 NULL,   /* base_init */
 NULL,   /* base_finalize */
 A_class_init,   /* class_init */
 NULL,   /* class_finalize */
 NULL,   /* class_data */
 sizeof (A),
 0,  /* n_preallocs */
 NULL/* instance_init */
  };
  type = g_type_register_static (G_TYPE_OBJECT,
 AType,
 info, 0);
   }
return type;
}

GType B_get_type   (void)   {
   /*PRINT_DBG_IN_FUN_NAME*/

   static GType type = 0;
   if (type == 0) {
  static const GTypeInfo info = {
 sizeof (BClass),
 NULL,   /* base_init */
 NULL,   /* base_finalize */
 B_class_init,   /* class_init */
 NULL,   /* class_finalize */
 NULL,   /* class_data */
 sizeof (B),
 0,  /* n_preallocs */
 NULL/* instance_init */
  };
  type = g_type_register_static (A_TYPE,
 BType,
 info, 0);
   }
return type;
}

static void B_class_init(gpointer g_class,
  gpointer class_data)
{
   PRINT_DBG_IN_FUN_NAME
   GObjectClass   *class = G_OBJECT_CLASS (g_class);
   GParamSpec *spec;

   g_type_class_add_private (class, sizeof (BPrivate));

   class-constructor = B_constructor;
   class-dispose = B_dispose;
   class-finalize = B_finalize;
   class-set_property = B_set_property;
   class-get_property = B_get_property;
   /* other code */
}

static void A_class_init   (gpointer g_class,
 gpointer class_data)
{
   PRINT_DBG_IN_FUN_NAME
   GObjectClass   *class= G_OBJECT_CLASS (g_class);
   GParamSpec *spec;

   class-finalize = A_finalize;
   class-set_property = A_set_property;
   class-get_property = A_get_property;
   /* other code */
}

I changed objects names, to make it more legible. PRINT_DBG_IN_FUN_NAME is a
macro, which display function name in console. Here is otput of running
'g_object_unref (g_object_new (A_TYPE, NULL))'. This is program output:

Function: A_class_init
Function: B_class_init
Function: B_constructor
Function: B_dispose
Function: B_finalize

I noticed, that in both *_class_init fnctions I use GObjectClass to declare
finalize, constructor etc. functions on it, is this main reason of my
problem?

-- 
Pozdrawiam!
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