Re: How do you get the data from a GList?

2006-11-17 Thread Matias Torres
Ouch!

change this
next = g_slist_next (node);
to
node = g_slist_next (node);
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkTreeRowReferences and ¿signal 155?

2006-10-18 Thread Matias Torres
Hi all,

I'm building an app with a TreeView with the selection mode set to 
multiple. When i have to delete data from the tree view, i get a list of 
selection with gtk_tree_selection_get_selected them i transform this 
list into another list with GtkTreeRowReferences in it.

The deletion of the data works, but just after delete some element i get 
this error message:

GLib-GObject-WARNING **: gsignal.c:2133: signal id `155' is invalid for 
instance `0x8072eb8'

Does anybody knows what is this? I didn't connect any signal to the 
RowReference. Here's goes part of the code:
  
   /* act is a GList of GtkTreeRowReferences */
while (act != NULL)
{
if (gtk_tree_row_reference_valid ((GtkTreeRowReference*) 
act-data))
{
path = gtk_tree_row_reference_get_path 
((GtkTreeRowReference*) act-data);
gtk_tree_row_reference_free ((GtkTreeRowReference*) 
act-data); /* Without this the error keep appearing */
if (path != NULL)
{
gtk_tree_model_get_iter (model, iter, path);
gtk_tree_model_get (model, iter, BRAND_ID_COLUMN, 
brandid, -1);
   /* Updates DB */
res = db_brand_delete (brandid);
if (res == SQLITE_DONE)
{
/* Updates model */
gtk_list_store_remove (GTK_LIST_STORE (model), 
iter);
}
}
}
act = g_list_next (act);
}

I'm using Gtk+-2.10.6 and Glib 2.12.4.

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


Re: GTK table insert row

2006-10-12 Thread Matias Torres
Guy Rouillier escribió:
 Razvan wrote:
   
 Hi there

 I have the following problem:
 I have a dynamic created table and at a moment I want to insert a whole row
 into the table but I dont know how to do it. I dont want to re-create the
 entire table. Is there any possibilies to do such thing ?

 Any help or suggestions are apreciated.
 


 You don't provide much to go on.  Which Gtk widget are you using - 
 GtkTable or GtkTreeView with a backing list store?

   
If what you're looking for is to insert a widget into a whole row what 
you can do is this:

gtk_table_attach (GTK_TABLE (table), widget, 0, LAST_TABLE_COLUMN, 0 , 
1, GTK_FILL | GTK_EXPAND, 0, 0, 0);

This way the widget will be inserted from 0 to the last column. The 
GTK_FILL and GTK_EXPAND flags are specified so the widget expands to the 
full width of the table. Hope that's what you're looking for.
Matias
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


SpinButton and Decimal separator

2006-10-09 Thread Matias Torres
Hi all,
I'm using a spin button to enter float numbers. The default locale has 
the ',' as decimal separator, but i want to also use the '.' as the 
decimal separator. Is there a way to change this without changing the 
locale?

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


Gettext

2006-10-03 Thread Matias Torres
Hi all!
Yes, I know it's not a GTK question but i couldn't find an answer to my 
problem.

After building my application (if it helps, it uses gtk), i use gettext 
for translating it, and, in linux it works just fine. But, talking about 
windows, well .. it doesn't..

Note: Gtk Widgets DO translate, but the my own text doesn't.

This is what i do:
..
#include gtk/gtk/h
#include libintl.h
..
#define PACKAGE xiliunsystem
#define LOCALEDIR po
..
void nls_init (void)
{
/* SHOULD I CALL gtk_set_locales(), WHERE?  */
setlocale (LC_ALL, );
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
bind_textdomain_codeset (PACKAGE, UTF-8);
}

int main ( ... )
{
nls_init ();
gtk_init (argc, argv);

return 0;
}


The message catalogs are in a subfolder in the main app dir called po 
which looks something like this:

myAppDir/po/es/LC_MESSAGES/

In there there's a myapp.mo file compile with msgfmt.EXE

Does anybody knows what's wrong or run into this problem?

Please, Thanks and I'm sorry I'm sorry I'm sorry I'm sorry I'm sorry i 
konw it's not a gtk question.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Gettext

2006-10-03 Thread Matias Torres
Tristan Van Berkom escribió:
 Matias Torres wrote:

 Hi all!
 Yes, I know it's not a GTK question but i couldn't find an answer to 
 my problem.

 After building my application (if it helps, it uses gtk), i use 
 gettext for translating it, and, in linux it works just fine. But, 
 talking about windows, well .. it doesn't..

 Note: Gtk Widgets DO translate, but the my own text doesn't.

 This is what i do:
..
 #include gtk/gtk/h
 #include libintl.h
..
 #define PACKAGE xiliunsystem
 #define LOCALEDIR po
..
 void nls_init (void)
 {
/* SHOULD I CALL gtk_set_locales(), WHERE?  */
setlocale (LC_ALL, );
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
bind_textdomain_codeset (PACKAGE, UTF-8);
 }

 int main ( ... )
 {
nls_init ();
gtk_init (argc, argv);

return 0;
 }


 The message catalogs are in a subfolder in the main app dir called po 
 which looks something like this:

 myAppDir/po/es/LC_MESSAGES/

 In there there's a myapp.mo file compile with msgfmt.EXE

 Does anybody knows what's wrong or run into this problem?

 Please, Thanks and I'm sorry I'm sorry I'm sorry I'm sorry I'm sorry 
 i konw it's not a gtk question.
  

 A wild guess - maybe #include glib-i18n.h ?

 also, is all that stuff in nls_init() really needed ?

 Cheers,
   -Tristan


Thanks for answering, really.
About the myapp.mo to xiliunsystem.mo, well it is called 
xiliunsystem.mo but i was trying towrite a more anonymous mail :P

And yes, the application Working Dir is ok.

Thanks anyway, i'll try that and get back to you soon.

Well.. about glib-i18n.h, i couldn't find it in my system. So i googled 
it and only two results appeared which makes me think that's not the 
problem. Another thing about my app is that the intl.h.


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


Re: Gettext

2006-10-03 Thread Matias Torres
Tristan Van Berkom escribió:
 Matias Torres wrote:

 Hi all!
 Yes, I know it's not a GTK question but i couldn't find an answer to 
 my problem.

 After building my application (if it helps, it uses gtk), i use 
 gettext for translating it, and, in linux it works just fine. But, 
 talking about windows, well .. it doesn't..

 Note: Gtk Widgets DO translate, but the my own text doesn't.

 This is what i do:
..
 #include gtk/gtk/h
 #include libintl.h
..
 #define PACKAGE xiliunsystem
 #define LOCALEDIR po
..
 void nls_init (void)
 {
/* SHOULD I CALL gtk_set_locales(), WHERE?  */
setlocale (LC_ALL, );
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
bind_textdomain_codeset (PACKAGE, UTF-8);
 }

 int main ( ... )
 {
nls_init ();
gtk_init (argc, argv);

return 0;
 }


 The message catalogs are in a subfolder in the main app dir called po 
 which looks something like this:

 myAppDir/po/es/LC_MESSAGES/

 In there there's a myapp.mo file compile with msgfmt.EXE

 Does anybody knows what's wrong or run into this problem?

 Please, Thanks and I'm sorry I'm sorry I'm sorry I'm sorry I'm sorry 
 i konw it's not a gtk question.
  

 A wild guess - maybe #include glib-i18n.h ?

 also, is all that stuff in nls_init() really needed ?

 Cheers,
   -Tristan





Well i found out what was happening. For initializing the gettext macros 
i used the archive that glades generates under the name of support.h 
with ONLY the gettext macros thought i did not use glade. 
I don not compile the traditional way (./configure make) when trying to 
port to windows because of many many problems but i compile the 
traditional traditional and more traditional way:

mingw-gcc CFLAGS ...SOURCES MANYLIBS(godbless pkg-config)

Because of this the ENABLE_NLS enviroment variable wasn't set when i try 
to build the sources.

Hope it helps someone. To that someone: LEARN TO USE AUTOCONF because i 
didn't and it can make you wish the computer explotes. Thanks to all 
again, good bye!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Problem with the stamp in gtktreeiter

2006-09-17 Thread Matias Torres
Hi
I'm trying to make a widget that works just like the address bar in 
epiphany (a combo box with completion)

The widget i'm workin on is a composite widget that uses 
GtkComboBoxEntry and GtkEntryCompletion.

This widget has a unique gtktreemodel that both, GtkComboBoxEntry and 
GtkEntryCompletion use, but when i try to set the active iter to the 
combo box based on the match-selected signal from the GtkEntryCompletion 
it tells me that the stamp of the iter is invalid.
How can i fix this?
If anyone knows where can i get a similar widget, please let me know

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 Curves

2006-09-12 Thread Matias Torres
I FORGOT ABOUT SOMETHING, I NEED THE LIBRARY TO BE PORTABLE TO WINDOWS. 
THANKS!
**
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


I FORGOT ABOUT SOMETHING, I NEED THE LIBRARY TO BE PORTABLE TO WINDOWS.

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


Re: Reference Counting

2006-09-07 Thread Matias Torres
Thanks for answering. So basically...
(About the g_object_weak_ref)

GDate *date = g_date_new_dmy (1,1,2006);
GtkEntry *entry = gtk_entry_new ();

g_object_weak_ref (G_OBJECT (entry),
(GWeakNotify) g_date_free,
date);

After doing this, before entry is freed gtk would call g_date_free and 
free date. Am i wrong? I tried this with a GWeakNotify function that 
just prints something, but it didn't seem to work.

There's something else, i want to add more reference to other dates, to 
new ones, if i want them to be week referenced i'd have to call

g_object_add_weak_pointer ( 
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#GObjectG_OBJECT
 (entry), another_date);

or

g_object_weak_ref again?


Thanks anyway! Matias

Nikhil Dinesh escribió:
 *- Is there a way to pass a function to free certain struct in a 
 GtkTreeModel so GTK frees the allocated space when the model's reference 
 count reach to 0? (without registering it as a G_TYPE).*
   
 

 One way is to register the struct as a weak reference to the model, 
 using g_object_weak_ref. See:

 http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html
   
 *- When reference count starts? I read somewhere that it starts when you 
 add the widget into a container, is it always this way??? Eg:*
   
 
 Reference counting starts when an object is created. In your example:

GtkWidget *entry = gtk_entry_new ();

 After this statement, there is one reference to the entry. When 
 gtk_container_add is invoked, it takes over ownership of this 
 reference.  That is when the container is destroyed, g_object_unref is 
 invoked on the entry. So one needs to invoke destroy only on the root 
 widget (typically).

   
 //*No reference counting on GtkEntry*//
 GtkWidget *entry = gtk_entry_new ();
 //*Reference counting starts here *//
 gtk_container_add (GTK_CONTAINER (window), entry);/
 /* Another doubt: in this case, reference couting starts with 1 or 2? */
 /
 -* If i get a string from a GtkTreeModel, it gives me a copy or the 
 actual pointer to the data?
   
 
 If you're using the get_value method on the iterator, the object is 
 copied into the GValue supplied. Typically this gives you just a 
 reference, and invoking g_value_unset results in just decrementing the  
 reference count. But what exactly happens during copying depends on your 
 object. See:

 http://developer.gnome.org/doc/API/2.0/gobject/gobject-Generic-values.html

   
 *That's it, 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

   

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


Reference Counting

2006-09-06 Thread Matias Torres
Hi all,

I'm working on some simple app which only use gtk and sqlite libraries 
and i KNOW it's leaking memory.
Would you please help me? (damn beatles!, i shouldn't be listening music 
when writing a mail!)

*- Is there a way to pass a function to free certain struct in a 
GtkTreeModel so GTK frees the allocated space when the model's reference 
count reach to 0? (without registering it as a G_TYPE).*

*- When reference count starts? I read somewhere that it starts when you 
add the widget into a container, is it always this way??? Eg:*

//*No reference counting on GtkEntry*//
GtkWidget *entry = gtk_entry_new ();
//*Reference counting starts here *//
gtk_container_add (GTK_CONTAINER (window), entry);/
/* Another doubt: in this case, reference couting starts with 1 or 2? */
/
-* If i get a string from a GtkTreeModel, it gives me a copy or the 
actual pointer to the data?

*That's it, 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


Re: Search for a widget that can completion and option_box

2006-08-30 Thread Matias Torres
I had the same problem a few weeks ago. I modified a function i found in 
a webpage (put koders in google), this is the fuction:

/*
*  This function returns a GtkComboBox with a GtkEntryCompletion inside 
instead a GtkEntry
*  it needs a GtkTreeModel containing the data and the column used to 
search
*/

GtkWidget *create_combo_box_entry (GtkTreeModel *model, int text_column) {
GtkWidget *categories; /*GtkComboBox*/
GObject *completion; /*GtkEntryCompletion*/

categories = gtk_combo_box_entry_new_with_model (model, text_column);
completion = G_OBJECT( gtk_entry_completion_new () );
/* There's a gtkentry inside the combobox, all we need to do is set 
the completion for it*/
gtk_entry_set_completion ( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( 
categories ) ) ),  GTK_ENTRY_COMPLETION(completion) );
gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION(completion),  
gtk_combo_box_get_model(GTK_COMBO_BOX(categories)));
gtk_entry_completion_set_text_column( 
GTK_ENTRY_COMPLETION(completion), text_column );
gtk_entry_completion_set_minimum_key_length (GTK_ENTRY_COMPLETION 
(completion), 2);
gtk_entry_completion_set_inline_completion (GTK_ENTRY_COMPLETION 
(completion), FALSE);
/* To keep the the widgets syncronized */
g_signal_connect( GTK_ENTRY_COMPLETION(completion), 
match-selected, (GCallback) update_cb, categories );
   
return categories;
}

That's it, it worked for me. Oh, excuse my bad english too. :P
Matias

Edward Catmur escribió:
 On Wed, 2006-08-30 at 16:36 +0200, Bernd Demian wrote:
   
 Hi,
 excuse my bad english! We are saerching for a widget that combined the
 gtk_entry_completion with gtk_combo_box_entry, but we have no success. 
 An example is the url widget in firefox. It has more than one
 cell_renderer, has
 completion and the possibility explicit popup the tree_view.
 In all gtk extra widget sets (libsexy, libview, ..) I can't find this
 entry typ. In mozilla I can't find the sources.
 

 Have you looked at the URL widget in epiphany?

 Ed

 ___
 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