Re: quarks

2008-09-01 Thread Martin (OpenGeoMap)

hi:

On Mon, Sep 01, 2008 at 02:20:35AM -0300, Martin (OpenGeoMap) wrote:
  

hi!,


Someone knows like quarks works in glib.



I suppose quarks is a pun on atoms that is so
often used as a lingo for som small item. Like atoms
in X.

  
I can not find the source code, only the header. It?? suppose we don 
need free the string inside a static string of a quarks. But how is 
that???. Where is the string saved?.



A quark is a pointer to your objeckt. So it is stored inside your 
program. If you don't need the quark any more you should free it.


GH
  


How??
With g_free ???
http://library.gnome.org/devel/glib/stable/glib-Quarks.html

I don´t see in the  quarks API anything to free???

I am very confused about this topic.

Regards.


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


Re: quarks

2008-09-01 Thread Brian J. Tarricone
On Mon, 01 Sep 2008 02:20:35 -0300 Martin (OpenGeoMap) wrote:

 Someone knows like quarks works in glib.
 
 I can not find the source code, only the header. Itś suppose we don
 need free the string inside a static string of a quarks. But how is
 that???. Where is the string saved?.

The documentation on quarks should tell you all you need:
http://library.gnome.org/devel/glib/stable/glib-Quarks.html

If not, please ask specific questions about specific sections of the
documentation that you don't understand.

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

Re: quarks

2008-09-01 Thread Martin (OpenGeoMap)

Brian J. Tarricone escribió:

On Mon, 01 Sep 2008 02:20:35 -0300 Martin (OpenGeoMap) wrote:

  

Someone knows like quarks works in glib.

I can not find the source code, only the header. Itś suppose we don
need free the string inside a static string of a quarks. But how is
that???. Where is the string saved?.



The documentation on quarks should tell you all you need:
http://library.gnome.org/devel/glib/stable/glib-Quarks.html

If not, please ask specific questions about specific sections of the
documentation that you don't understand.
  



 g_quark_from_string ()

Here you create a copy of the string. But where is the string saved??. 
How do you free the string resources?


Usually you need use the quark data, but when you need free it??. Do we 
need free the string with g_free?
If was so, then when we need free the string the firt we have to do is 
use thes method (g_quark_to_string ) to get the string and then

free the string.



Usually in glib you can see information about what free, but here i can 
not see it:


For example here we can see what we need free:

http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-strndup


, but not in quarks API documentation.


-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: [semi-OT] dependencies libraries

2008-09-01 Thread Gabriele Greco
On Sun, Aug 31, 2008 at 10:46 AM, Brian J. Tarricone [EMAIL PROTECTED]wrote:

  for example: if i develop with gtk 2.12 (but i can do the same
  reasoning with any other library) how can i do to know if i used (or
  not) new functions/classes introduced on that version? (of course
  without look inside library documentation for every function/class
  that i used)

 That's pretty much the only way to do it, looking through the
 documentation.  If you really want to target a specific minimum version
 (say, 2.8), then you should develop against that version.


The autopackage project (www.autopackage.org) distributes a set of OLD gtk
headers/linklibs (I think 2.4, or 2.6 ones), suited to develop GTK+ apps
that runs on the vast majority of linux distro actually deployed.

Linking to them also remove the dependency from cairo. This is important
because if you link to a recent version of GTK (2.8+) also if you take care
to use only 2.0 apis you'll give your program an implicit dependency from
cairo.

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


libgnomedb3.0: WARNING **: could expand into list of field

2008-09-01 Thread paragasu
i am very new into this gtk and libgnomedb. this is my first attempt
write one, i have one
function.

[snip]
GtkWidget *page_1(GdaConnection *conn)
{
GtkWidget *vbox;
GdaQuery *query;
GdaDict *dict = gda_dict_new();
gda_dict_set_connection(dict, conn);

query = gda_query_new_from_sql(dict, SELECT * FROM account, NULL);
GdaDataModel *acc_list_model = gda_data_model_query_new(query);
g_object_unref(query);

query = gda_query_new_from_sql(dict,
SELECT * from account
WHERE acc_id=##/*name=:'acc_id' type:gint 
descr:'account id'*/,
NULL);

GdaDataModel *payment_model = gda_data_model_query_new(query);
g_object_unref(query);

GdaParameterList *params =
gda_data_model_query_get_parameter_list(GDA_DATA_MODEL_QUERY(payment_model));
GdaParameter *param = gda_parameter_list_find_param(params, acc_id);


GtkWidget *grid = gnome_db_raw_grid_new(acc_list_model);
GtkWidget *form = gnome_db_raw_form_new(payment_model);

gtk_box_pack_start(GTK_BOX(vbox), grid, FALSE, FALSE, 3);
gtk_container_add(GTK_CONTAINER(vbox), form);

return vbox;
}

[/snip]

the code compile well. except it give up warning  and segmentation fault.

WARNING **: could  expand 'account.*' into list of fields

i do not have any idea what happen or how to fix this one.
I really appreciate your comment..

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


Re: quarks

2008-09-01 Thread Mike

http://library.gnome.org/devel/glib/stable/glib-Quarks.html
The link works.  Is this some kind of weird joke?

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


Re: quarks

2008-09-01 Thread Martin (OpenGeoMap)

hi:


Quark strings are static and should not be freed.  You don't free them.  glib
does not free them either.  When the process dies they are automatically
freed.  That's all.  Just don't worry about them.
  

But then i can imaging we can not abuse of that kind of types.


thank you.


behdad

Martin (OpenGeoMap) wrote:
  

Brian J. Tarricone escribió:


On Mon, 01 Sep 2008 02:20:35 -0300 Martin (OpenGeoMap) wrote:

 
  

Someone knows like quarks works in glib.

I can not find the source code, only the header. Itś suppose we don
need free the string inside a static string of a quarks. But how is
that???. Where is the string saved?.



The documentation on quarks should tell you all you need:
http://library.gnome.org/devel/glib/stable/glib-Quarks.html

If not, please ask specific questions about specific sections of the
documentation that you don't understand.
  
  

 g_quark_from_string ()

Here you create a copy of the string. But where is the string saved??.
How do you free the string resources?

Usually you need use the quark data, but when you need free it??. Do we
need free the string with g_free?
If was so, then when we need free the string the firt we have to do is
use thes method (g_quark_to_string ) to get the string and then
free the string.



Usually in glib you can see information about what free, but here i can
not see it:

For example here we can see what we need free:

http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-strndup



, but not in quarks API documentation.



-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



  


___
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_emit()

2008-09-01 Thread dhk

dhk wrote:

Kristian Rietveld wrote:

On Sun, Aug 31, 2008 at 2:08 PM, dhk [EMAIL PROTECTED] wrote:

I have two callback functions.  The first for when a cell in a treeview
gets edited and the second for when the tab key is pressed.  The 
first works
fine.  In the second, I want to emit the edited signal so it acts 
as if

the first event happened.  However, the g_signal_emit() in the
key-press-event callback does not seem to work.

I am doing the following and the renderer and sig_id are valid.

sig_id=g_signal_lookup(edited, G_OBJECT_TYPE(renderer));
g_signal_emit(renderer, sig_id, 0);


It looks like you are trying to emit the edited signal here without
specifying the correct arguments.


In short what I'm trying to do is emit the edited event when the
key-press-event occurs.  That way when the use tabs off the cell in 
the

treeview the callback for the edited event is called.  It doesn't make
sense the if there are two way to leave a cell (tabbing off it or 
clicking

outside of it) that you can't call the same event.


Maybe you can try using gtk_cell_editable_editing_done() here?  The
editing-done signal handler of the respective cell editable will take
care of emitting the edited signal.  You can get hold of the correct
cell editable by listening for the editing-started signal on the cell
renderer.


regards,

-kris.

That sounds like it could work.  I'll see if I can get the 
GtkCellEditable from gtk_cell_renderer_start_editing().  That seems to 
take a lot of parameter that I don't have.  I'll let you know what happens.


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

Kris, that was a great idea.  The tricky part was getting the 
GtkCellEditable pointer without doing a lot of work.  Doing a lot of 
work usually means I'm doing something wrong.  After looking at the gtk 
source, I was able to come up with the following four lines.  It will 
emit the edited signal from a key-press-event callback.


gtk_tree_view_get_cursor(GTK_TREE_VIEW(treeview), tp, focus_column);
if(focus_column!=NULL) {
  gtk_cell_editable_editing_done(focus_column-editable_widget);
}

Thanks,

dave
___
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 center vbox inside full screen window

2008-09-01 Thread Dov Grobgeld
Both GtkImage and GtkLabel are subclasses of GtkMisc, which means that you
can set their alignments through the GtkMisc methods. Thus after after
packing them together, set the yalignment of the image to 1.0 and the
yalignment of the label to 0.0 (default for both are 0.5) and you should be
ok.

Search for GtkMisc in the GtkLabel and GtkImage documentations.

Another option is to create another non-filled GtkVBox into which you place
the image and the label, and then place this vbox in your outer filled vbox.

Hope this helps,
Dov

2008/8/30 Christian Smith [EMAIL PROTECTED]

 Hi All,

 I have a very simple GTK program (in C) that creates a full screen window.
  Inside the full screen window I am placing a vbox with two elements inside:
 and image and a label.

 For the life of me I cannot figure out how to get the contents of the vbox
 to be packed together.  I.e. I want the image + label touching each other
 and centered on the screen.  Currently the height of the vbox seems to fill
 the height of the screen with the image and label distributed inside (and
 not touching).

 Any help is appreciated!

 Thanks,
 Christian
 ___
 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: libgnomedb3.0: WARNING **: could expand into list of field

2008-09-01 Thread paragasu
i am sorry, maybe this email should go to gnome-db list. but, i can
help but to continue use this thread for this time.

But i come accross another problem. It compile, but now give critical error.
I try to check what is wrong and tried to search using google but
return no result. so,
again i have to ask this list to guide me the direction. Anything i
miss here, i look at the
code many times but i cannot spot the problem.

thank you again..

CRITICAL **: gda_parameter_list_find_param: assertion
`GDA_IS_PARAMETER_LIST (paramlist)` failed
CRITICAL **: gda_parameter_restrict_values: assertion
`GDA_IS_PARAMETER (param)` failed

here is the code

[code]
/*notebook page 1*/
GtkWidget *page_1(GdaConnection *conn)
{
GtkWidget *vbox;
GdaQuery *query;
GdaDict *dict = gda_dict_new();
gda_dict_set_connection(dict, conn);

query = gda_query_new_from_sql(dict, SELECT acc_id, name, ic, tel
FROM account, NULL);
GdaDataModel *acc_list_model = gda_data_model_query_new(query);
g_object_unref(query);

query = gda_query_new_from_sql(dict,SELECT acc_id, name, ic from
account WHERE acc_id=##/*name=:'accountNo' type:gint*/,NULL);
GdaDataModel *payment_model = gda_data_model_query_new(query);
g_object_unref(query);

GdaParameterList *params =
gda_data_model_query_get_parameter_list(GDA_DATA_MODEL_QUERY(payment_model));
GdaParameter *param = gda_parameter_list_find_param(params, 
accountNo);
g_assert(gda_parameter_restrict_values(param, acc_list_model, 0, NULL));


GtkWidget *grid = gnome_db_raw_grid_new(acc_list_model);
GtkWidget *form = gnome_db_raw_form_new(payment_model);

gtk_box_pack_start(GTK_BOX(vbox), grid, FALSE, FALSE, 3);
gtk_container_add(GTK_CONTAINER(vbox), form);

return vbox;
}
[/code]

p/s: i did try to download V4-branch, but have some problem compiling
it. some of dependencies is missing on my debian lenny. i will try
again..

On 9/1/08, Vivien Malerba [EMAIL PROTECTED] wrote:
 2008/9/1 paragasu [EMAIL PROTECTED]:
 i am very new into this gtk and libgnomedb. this is my first attempt

 Please post to the Gnome-Db list if your post is about Gnome-DB.

 write one, i have one
 function.

 [snip]
 GtkWidget *page_1(GdaConnection *conn)
 {
GtkWidget *vbox;
GdaQuery *query;
GdaDict *dict = gda_dict_new();
gda_dict_set_connection(dict, conn);

query = gda_query_new_from_sql(dict, SELECT * FROM account,
 NULL);
GdaDataModel *acc_list_model = gda_data_model_query_new(query);
g_object_unref(query);

query = gda_query_new_from_sql(dict,
SELECT * from account
WHERE acc_id=##/*name=:'acc_id' type:gint
 descr:'account id'*/,
NULL);

GdaDataModel *payment_model = gda_data_model_query_new(query);
g_object_unref(query);

GdaParameterList *params =
 gda_data_model_query_get_parameter_list(GDA_DATA_MODEL_QUERY(payment_model));
GdaParameter *param = gda_parameter_list_find_param(params,
 acc_id);


GtkWidget *grid = gnome_db_raw_grid_new(acc_list_model);
GtkWidget *form = gnome_db_raw_form_new(payment_model);

gtk_box_pack_start(GTK_BOX(vbox), grid, FALSE, FALSE, 3);
gtk_container_add(GTK_CONTAINER(vbox), form);

return vbox;
 }

 [/snip]

 the code compile well. except it give up warning  and segmentation fault.

 WARNING **: could  expand 'account.*' into list of fields

 The (hidden and not obvious) reason is that the dictionary you use is
 not up to date with the database structure, and specifically it knows
 nothing about the account table. To solve this you can either make
 sure the dictionary is up to date (use
 gda_dict_update_dbms_meta_data()), or you can simlply re-write your
 code and replace the '*' from SELECT *...  with the actual fields to
 select.

 BTW, if you are starting with the library on new code, I strongly
 encourage you to use the last 3.99.x version as its API is far easier
 to use and less buggy (the only disadvantage is that the API is not
 yet stable but mostly).

 Regards,

 Vivien

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


Re: increase cell height in a GtkTreeView

2008-09-01 Thread Nicolas SOUBEIRAN

Kristian Rietveld a écrit :

(Apologies for such a late reply, I hope it is still of use).

On Fri, Aug 1, 2008 at 11:37 AM, Nicolas Soubeiran
[EMAIL PROTECTED] wrote:
  

Hi all,
I need to create a treeview with a column which displays a pixbuf that
becomes bigger when the user hovers the row. So I create a cellrenderer
which display either the big pixbuf either the small pixbuf depending of the
value of the GtkCellRendererState flag (if PRELIT then display big pixbuf,
else small). It works except that the height of the cell is always the same
so when the big pixbuf should be displayed, it is troncated.



Once a row got its size calculated and allocated, it will not change
unless the data in the model changes (signaled via row-changed).  When
GtkTreeView receives row-changed for a row, it will recalculate the
requested height for that row by re-querying the cell renderers.
Apart from this, cell renderers cannot influence the height of the
row.

  

I want to know how to ask the cell to request more space. Currently I've
copy/paste the render and get_size fonction of gtk_cell_renderer_pixbuf in
my component.



The easiest solution is to emit the row-changed signal (using
gtk_tree_model_row_changed()) once the row has to update its height.


regards,

-kris.

  

OK, emitting the row-changed signal solves my problem.
Thanks
Nicolas

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


Re: quarks

2008-09-01 Thread Martin (OpenGeoMap)

G Hasse wrote:

On Mon, Sep 01, 2008 at 09:16:14AM +0200, Martin (OpenGeoMap) wrote:
  

hi:


On Mon, Sep 01, 2008 at 02:20:35AM -0300, Martin (OpenGeoMap) wrote:
 
  

hi!,


Someone knows like quarks works in glib.
   


I suppose quarks is a pun on atoms that is so
often used as a lingo for som small item. Like atoms
in X.

 
  
I can not find the source code, only the header. It?? suppose we 
don need free the string inside a static string of a quarks. But 
how is that???. Where is the string saved?.
   

A quark is a pointer to your objeckt. So it is stored inside your 
program. If you don't need the quark any more you should free it.


GH
 
  


Since GQuark is just an integer that gives a string
in a GData list you should not manipulate the list yourself.
(Probalby..)

in FreeBSD look at
/usr/ports/devel/glib20/work/glib-2.14.2/glib/gdataset.c

...

GQuark
g_quark_from_string (const gchar *string)
{
  GQuark quark;
  
  if (!string)

return 0;
  
  G_LOCK (g_quark_global);

  quark = g_quark_from_string_internal (string, TRUE);
  G_UNLOCK (g_quark_global);
  
  return quark;

}


/* HOLDS: g_quark_global_lock */
static inline GQuark
g_quark_from_string_internal (const gchar *string, 
  gboolean duplicate)

{
  GQuark quark = 0;
  
  if (g_quark_ht)

quark = GPOINTER_TO_UINT (g_hash_table_lookup (g_quark_ht, string));
  
  if (!quark)
quark = g_quark_new (duplicate ? g_strdup (string) : (gchar 
*)string);
  
  return quark;

}


/* HOLDS: g_quark_global_lock */
static inline GQuark
g_quark_new (gchar *string)
{
  GQuark quark;
  
  if (g_quark_seq_id % G_QUARK_BLOCK_SIZE == 0)
g_quarks = g_renew (gchar*, g_quarks, g_quark_seq_id + 
G_QUARK_BLOCK_SIZE);

  if (!g_quark_ht)
{
  g_assert (g_quark_seq_id == 0);
  g_quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
  g_quarks[g_quark_seq_id++] = NULL;
}

  quark = g_quark_seq_id++;
  g_quarks[quark] = string;
  g_hash_table_insert (g_quark_ht, string, GUINT_TO_POINTER (quark));
  
  return quark;

}

So there is no god interface to removing entrys from the table.

There is a function to clear the entire list - but then you lose
all quarks...

g_datalist_clear_i  (GData  **datalist);

 



Thanks for all responses.

Regards.

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