RE: list of g_signal_connect options

2003-03-04 Thread Murray . Cumming
 I was wondering if someone could direct me to a list of 
 all the options viable under g_signal_connect, such as 
 clicked, destroy, realize etc. I couldn't find this 
 online anywhere, and the only ones I know of are because of 
 the gtk-demo. Thanks!

The signals for each widget are listed in the GTK+ documentation. For
instance,
http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html

Murray Cumming
[EMAIL PROTECTED]
www.murrayc.com 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Help with focus/activation problems

2003-03-04 Thread Owen Taylor
On Mon, 2003-03-03 at 19:22, Carl B. Constantine wrote:
 I posted a message a couple days ago, but no answer so I'm going to post
 again with some additional info that may help.
 
 I have a window in which are several widgets, such as GtkEntry and
 GtkTextView, and GtkTreeView (list store). When I run my program, it
 seems that while I can click around and type text in the text entries
 and text views, or select items in the TreeView, the widgets never seem
 to become active, ie: the cursor does not blink in the text entries
 and selecting a row in the TreeView is the inactive color.
 
 If I right-click in the text view, or select an item from my
 GtkOptionMenu (of which no code exists for that callback, it's just
 empty right now) suddenly the widgets seem to become active, ie: the
 text cursor blinks in the text entries and text views, selecting a row
 in the GtkTreeView appears in the active highlight color.

You mean you aren't calling:

 gtk_make_focus_work ()

? [In case that isn't obvious, that's a joke]. 

The only thing I can think of that might make focus not work for a
toplevel window is if you create it as type GTK_WINDOW_POPUP, which
takes the window completely out of the normal X system.

Other than that, you've discovered some bug in your window manager
or in GTK+.

You'll need to create the smallest possible standalone test case
that reproduces the problem, and provide that so we can figure out
what you are doing differently than everybody else.

Regards,
  Owen


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


Re: glib and threads

2003-03-04 Thread Owen Taylor
On Mon, 2003-03-03 at 06:53, Sebastian Ley wrote:
 Hello,
 
 will the configure switch --enable-threads in glib one time enabled,
 the other time disabled produce two binary compatible libraries or
 will they have a different ABI?
 
 Please CC me in your replies, since I am not subscribed.

They should be ABI compatible. 

(Note that --enable-threads is the default, and I don't expect
that --disable-threads will produce a result that is either
significantly smaller or significantly faster.)

Regards,
Owen


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


Quick newbie question

2003-03-04 Thread Ben LeMasurier
Hey everyone,

I am just starting to get into GTK+ programming, So far I am doing   
  pretty well but I am stuck at a certain point. I want to have 
a text entry and then a button to submit the information - lets just say 
when you hit submit, it pops up a new window that shows the information you 
had in the box. My problem is that I can't find out how to access the data 
from the text entry, once the clicked signal is received from the button. 
Can anyone help me out here?

Thanks,

Ben LeMasurier

_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

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


CellRenderText properties question.

2003-03-04 Thread Carl B. Constantine
The Gnome 2.0 porting docs contain the following information on the
GtkCellRender widget (under new widgets in the docs):

* Cell renderer properties can be set per-renderer or per-cell (based on
data in the model). So for example, the text renderer has a foreground
property for the foreground color. You could set the foreground color globally
for an entire column, or you could have the foreground property change per-cell
according to data in the model.

* For a given cell renderer, multiple fields in the model can affect it.
For example, if your mail client model has a boolean field indicating unread
message, and a string field indicating subject, you can set the bold
property of the cell from the unread flag and the text property of the cell
from the subject.


Looking at the API docs for GtkCellRender and GtkCellRenderText, I see
the following description under gtk_cell_renderer_text_new ():

...Also, with GtkTreeViewColumn, you can bind a property to a value in a
GtkTreeModel. For example, you can bind the text property on the cell
renderer to a string value in the model, thus rendering a different string in
each row of the GtkTreeView.

However, I can't really find any code examples of how to do anything
suggested in these docs. For example, I have a GtkTextView that only has
a single column in it. When I click a button in my window, I want to
find out the current selection in that TreeView and set it's text to Red
or Bold or something. I can't seem to find anything that shows how to
get the exact cell and then change its attributes. I can do it globably
for a column (and have for testing) but not on a single cell. 

These docs seem to imply that I need some further data in my cell model
to apply an attribute to. So, it seems like I have to have an extra
invisible column in my model that holds text attributes, update the
column text with a new string (say to red from black in order for
the text in the visible column to have the attribute change. This seems
very confusing to me. The docs say based on data in the model but it's
not clear what that means, if it's actual attributes stored in the
model, or just change based on a programmatic condition (col 1 is true
so set text to bold).

How can I change attributes on a single cell without having extra data
in my model or do I really need the extra data in my model? I'm sure I'm
missing something obvious but the docs are confusing. Also, storing
extra attribute data in my ListStore adds memory overhead.

Additionally, I see this description for
gtk_tree_view_column_cell_set_cell_data:

Sets the cell renderer based on the tree_model and iter. That is, for every
attribute mapping in tree_column, it will get a value from the set column on
the iter, and use that value to set the attribute on the cell renderer.

I'm sorry but that's not very clear, and in fact it's extremely
confusing. Maybe RedHat could hire me as a technical writer (I have
several years experience at this and worked for Metrowerks as a
professional technical writer).

Any help is greatly appreciated.

-- 
 .''`.  Carl B. Constantine
: :' : [EMAIL PROTECTED]
`. `'GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom


pgp0.pgp
Description: PGP signature


Re: Quick newbie question

2003-03-04 Thread Paul Davis
a text entry and then a button to submit the information - lets just say 
when you hit submit, it pops up a new window that shows the information you 
had in the box. My problem is that I can't find out how to access the data 
from the text entry, once the clicked signal is received from the button. 
Can anyone help me out here?

gtk_entry_get_text(), IIRC.
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: CellRenderText properties question.

2003-03-04 Thread Diego Zuccato
Carl B. Constantine wrote:

 ...Also, with GtkTreeViewColumn, you can bind a property to a value in a
 GtkTreeModel. For example, you can bind the text property on the cell
 renderer to a string value in the model, thus rendering a different string in
 each row of the GtkTreeView.
When you add a column to your view, you put ..., text, COL, ... to
show the text from model column COL in the currently being added column.
The same is with background and foreground attributes, and the
pointed columns must contain a colour name (as string: red, blue,
etc).
 
 However, I can't really find any code examples of how to do anything
 suggested in these docs. For example, I have a GtkTextView that only has
 a single column in it. When I click a button in my window, I want to
 find out the current selection in that TreeView and set it's text to Red
 or Bold or something. I can't seem to find anything that shows how to
 get the exact cell and then change its attributes. I can do it globably
 for a column (and have for testing) but not on a single cell.
I posted an example a couple of days ago. Just a code snippet from one
of my projects, but should give you the idea.
You have to add a column for every attribute.

... If only it could be possible to map values to attributes (1=red,
2=blue and so on...)

BYtE,
 Diego.
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: CellRenderText properties question.

2003-03-04 Thread Sven Neumann
Hi,

Carl B. Constantine [EMAIL PROTECTED] writes:

 However, I can't really find any code examples of how to do anything
 suggested in these docs. For example, I have a GtkTextView that only
 has a single column in it. When I click a button in my window, I
 want to find out the current selection in that TreeView and set it's
 text to Red or Bold or something. I can't seem to find anything that
 shows how to get the exact cell and then change its attributes. I
 can do it globably for a column (and have for testing) but not on a
 single cell.

the API reference is not exactly the place where you'd look for code
examples. The gtk-demo as found in the demos directory of the GTK+
source tree seems like a good place to look for such examples.

 These docs seem to imply that I need some further data in my cell
 model to apply an attribute to. So, it seems like I have to have an
 extra invisible column in my model that holds text attributes,
 update the column text with a new string (say to red from black
 in order for the text in the visible column to have the attribute
 change. This seems very confusing to me. The docs say based on data
 in the model but it's not clear what that means, if it's actual
 attributes stored in the model, or just change based on a
 programmatic condition (col 1 is true so set text to bold).
 
 How can I change attributes on a single cell without having extra
 data in my model or do I really need the extra data in my model? I'm
 sure I'm missing something obvious but the docs are confusing. Also,
 storing extra attribute data in my ListStore adds memory overhead.

of course you need the extra data. You want to display additional
information, where should it come from if not from the model? Of
course you can write your own custom cell renderer which calculcates
the information for each cell but unless you want to do that, you need
an extra column in your model. Please note that the model columns
don't necessarily correspond to the view columns. It thus doesn't make
any sense to speak of an invisible column in a model.


Salut, Sven
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: CellRenderText properties question.

2003-03-04 Thread Carl B. Constantine
* Diego Zuccato ([EMAIL PROTECTED]) wrote:
 Carl B. Constantine wrote:
 
  ...Also, with GtkTreeViewColumn, you can bind a property to a value in a
  GtkTreeModel. For example, you can bind the text property on the cell
  renderer to a string value in the model, thus rendering a different string in
  each row of the GtkTreeView.
 When you add a column to your view, you put ..., text, COL, ... to
 show the text from model column COL in the currently being added column.
 The same is with background and foreground attributes, and the
 pointed columns must contain a colour name (as string: red, blue,
 etc).

Thanks for the reply. That confirms what I suspected, but IMHO very bad
design as it creates extra overhead for memory and storage in the
TreeModel (ListStore in this case) instead of being able to determine
the property programatically. What if I have a preference setting where
the user change pick a color so it's not just red or blue it's
between blue and purple?

  However, I can't really find any code examples of how to do anything
  suggested in these docs. For example, I have a GtkTextView that only has
  a single column in it. When I click a button in my window, I want to
  find out the current selection in that TreeView and set it's text to Red
  or Bold or something. I can't seem to find anything that shows how to
  get the exact cell and then change its attributes. I can do it globably
  for a column (and have for testing) but not on a single cell.
 I posted an example a couple of days ago. Just a code snippet from one
 of my projects, but should give you the idea.
 You have to add a column for every attribute.

or add multiple attributes to the column with
gtk_tree_view_column_add_attribute(). But this means I have to add a
column to the model and then hide it after it's appended to the view
right?

 ... If only it could be possible to map values to attributes (1=red,
 2=blue and so on...)

or have a hex value that can then be used for the color. Then a user can
use the color selector to pick a color for certain cells. However, I
find that interface rather awkward to use in that instance, again
because it can't be determined programatically or you have to change the
column the cell looks at on the fly which is awkward.


-- 
 .''`.  Carl B. Constantine
: :' : [EMAIL PROTECTED]
`. `'GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom


pgp0.pgp
Description: PGP signature


Re: CellRenderText properties question.

2003-03-04 Thread Sven Neumann
Hi,

Carl B. Constantine [EMAIL PROTECTED] writes:

 Thanks for the reply. That confirms what I suspected, but IMHO very bad
 design as it creates extra overhead for memory and storage in the
 TreeModel (ListStore in this case) instead of being able to determine
 the property programatically. What if I have a preference setting where
 the user change pick a color so it's not just red or blue it's
 between blue and purple?

noone said you have to store the color as string. You could for
example have model column that holds a GdkColor which would give you
16 bit per color channel and I suspect that's more fine-grained than
you'll ever need it to be.

 or add multiple attributes to the column with
 gtk_tree_view_column_add_attribute(). But this means I have to add a
 column to the model and then hide it after it's appended to the view
 right?

 However, I find that interface rather awkward to use in that
 instance, again because it can't be determined programatically or
 you have to change the column the cell looks at on the fly which
 is awkward.

you shouldn't judge on an API that you obviously did not understood.


Salut, Sven

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


Re: CellRenderText properties question.

2003-03-04 Thread Carl B. Constantine
* Sven Neumann ([EMAIL PROTECTED]) wrote:
 the API reference is not exactly the place where you'd look for code
 examples. The gtk-demo as found in the demos directory of the GTK+
 source tree seems like a good place to look for such examples.

I didn't look there, I looked at the various examples that come with
GTK.

 of course you need the extra data. You want to display additional
 information, where should it come from if not from the model? Of
 course you can write your own custom cell renderer which calculcates
 the information for each cell but unless you want to do that, you need
 an extra column in your model. Please note that the model columns
 don't necessarily correspond to the view columns. It thus doesn't make
 any sense to speak of an invisible column in a model.

Yes, I suppose that's correct. I'm a bit confused as you create the
column with gtk_tree_view_column_new (or
gtk_tree_view_column_new_with_attributes) and then call
gtk_tree_view_append_column to append it to the tree view, at least for
the view. However, I gather I would call gtk_list_store_new with the
extra column (or columns) so I have a place in the store to save my
data, but the view doesn't show it.

This makes sense now that you point that out. I was doing a 1:1 mapping
between the TreeModel (ListStore in my case) and the TreeView but it
doesn't have to be such.

Thanks for the help!

-- 
 .''`.  Carl B. Constantine
: :' : [EMAIL PROTECTED]
`. `'GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom


pgp0.pgp
Description: PGP signature


Re: gtk_entry_get_text() - having problems with return type

2003-03-04 Thread Raymond Wan

Hi,

On Wed, 5 Mar 2003, Ben LeMasurier wrote:
 warning: assignment makes pointer from integer without a cast
 
 gethostbyname() requests a char *
 and gtk_entry_get_text() returns G_CONST_RETURN gchar*

According to the glib docs, a G_CONST_RETURN gchar* is typedef'ed
to a char* (See glib, basic types in the docs).  But, as it stresses in
the gtk_entry_get_text (), you shouldn'tfree, modify, or store it.  I
think I malloc'ed a temporary variable of type char * and did a strcpy and
that worked fine.  Just don't try storing it with an assignment...

Ray


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


Re: GtkTextView Questions -- please help! =]

2003-03-04 Thread Raymond Wan

Hi,

On Mon, 3 Mar 2003, Arash Nikkar wrote:
 1)  I have created a window, with 2 textviews within it. Now I initialized
 the textviews the same way, but the top one is about 1/3 of the window,
 while the bottom is 2/3. I was wondering how i could set them to be the same
 length.

This has to do with the container widget (hbox, vbox, table,
whatever) you put them in and the options that you set.  You should take a
look at the container docs or tutorial.

 2) I have a scrolled window within both of the textviews, and i insert text
 line by line. For some reason, the scrollbars don't scroll down as text is
 inserted into the textviews. They have to be manually scrolled down. I was
 wondering if there is some way to fix that.

The scrolled window has vertical adjustments associated with it.
If you want it to follow the text, you might have to manually get the
adjustments, change it accordingly, and go to it.  I'm not entirely sure
as I tend to put all my text in a char buffer and then put the buffer at
one time -- much faster.  Anyway, take a look at the documentation to
scrolled windows and it should lead you to a GTKAdjustment data structure
which you can read.

 3) Is there anyway to set the attribute of a textview so that it will word
 wrap text that IS TYPED into the textview. I know how to word wrap text that
 you insert into a textview, but I cant figure out how to word wrap text that
 a user enters into the textview.

...I don't know what you mean but manually, perhaps?  That is,
when a user hits the Enter key, you add the \n character to the buffer.

Ray




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


checking for a blank box?

2003-03-04 Thread Brandon
hello,

What value do I compare the output of gtk_editable_get_text() with in
order to know if the entry box I'm getting text from is empty or not?
I'm using an if statement and have tried to do If
(gtk_editable_get_text(entry,0,-1) == NULL) and it won't make the match
even when I don't input anything into the entry box. I've also tried
comparing to '\0' and 32 (ascii value for a space) and nothing ever
matches.  how do i check if a user has inputted anything? 

 The reason i need to do this is that when I convert the empty char
value to an int a 0 is always returned and since a 0 is a valid value in
my program I dont want someone to be able to do nothing and still get
valid results because of the 0 being returned without user input. I'm
doing my comparison w/o doing the conversion to int and I thought a
simple If statement comparing the function I'm using to NULL would work
but it's not.

thanks for any help
brandon
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: gtk_entry_get_text() - having problems with return type

2003-03-04 Thread Ben LeMasurier
Well, I tried to do an strcpy() on the string but I am still getting a 
segfault when I try to access it, I also get the same compile time error as 
before - I don't understand why it is telling me assignment makes pointer 
from an integer either.

better get the coffee out, this might be a long night for me.

thanks,

Ben



Hi,

On Wed, 5 Mar 2003, Ben LeMasurier wrote:
warning: assignment makes pointer from integer without a cast

gethostbyname() requests a char *
and gtk_entry_get_text() returns G_CONST_RETURN gchar*
According to the glib docs, a G_CONST_RETURN gchar* is typedef'ed
to a char* (See glib, basic types in the docs).  But, as it stresses in
the gtk_entry_get_text (), you shouldn'tfree, modify, or store it.  I
think I malloc'ed a temporary variable of type char * and did a strcpy and
that worked fine.  Just don't try storing it with an assignment...
Ray





_
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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


Re: CellRenderText properties question.

2003-03-04 Thread Owen Taylor
On Tue, 2003-03-04 at 17:51, Sven Neumann wrote:

  How can I change attributes on a single cell without having extra
  data in my model or do I really need the extra data in my model? I'm
  sure I'm missing something obvious but the docs are confusing. Also,
  storing extra attribute data in my ListStore adds memory overhead.
 
 of course you need the extra data. You want to display additional
 information, where should it come from if not from the model? Of
 course you can write your own custom cell renderer which calculcates
 the information for each cell but unless you want to do that, you need
 an extra column in your model. Please note that the model columns
 don't necessarily correspond to the view columns. It thus doesn't make
 any sense to speak of an invisible column in a model.

It should be pointed out here that if you _do_ want to calculate
things per-cell, then there's a much easier way to do it than
to write your own renderer - use:

http://developer.gnome.org/doc/API/2.2/gtk/GtkTreeViewColumn.html#gtk-tree-view-column-set-cell-data-func

This is gives you a callback to calculate the properties, usually 
from an application-specific data structure you store in a
treeviewcolumn (you can use G_TYPE_POINTER or register your own
type with g_boxed_type_register_static())

Regards,
 Owen



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


can you do multiple g_signal_connects?

2003-03-04 Thread Arash Nikkar
Hi Everyone,

I want multiple methods to be called when a widget is destroyed. So I was
wondering if this would work:

 g_signal_connect (window, destroy, G_CALLBACK (free_buffers), temp);
 g_signal_connect (window, destroy, G_CALLBACK (gtk_widget_destroyed), window);

so when the window is destroyed, gtk takes care of its stuff, and i take care of
mine. Thanks!

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