Re: how to get the parent of a selected row in treeview?

2010-04-26 Thread Arthur 1989
thank you.I will try to implement it.

On Mon, Apr 26, 2010 at 7:12 PM, Tadej Borovšak tadeb...@gmail.com wrote:

 Hi.

 You can obtain parent iter like this:
  1a. converting GtkTreeIter that you got from
 gtk_tree_view_selection_get_selected() into GtkTreePath using
 gtk_tree_model_get_path()
  1b. get selected path directly using
 gtk_tree_view_selection_get_selected_rows()
  2. get parent path using gtk_tree_path_up()
  3. convert path back to iter using gtk_tree_model_get_iter()

 Tadej

 --
 Tadej Borovšak
 tadeboro.blogspot.com
 tadeb...@gmail.com
 tadej.borov...@gmail.com




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

what do i get if a cell is empty?

2010-04-24 Thread Arthur 1989
Hi, I met this question: I use gtk_tree_model_get(model, iter, i, s, -1)
to get a cell's content. but when the cell is empty,i am not sure what i
really get. i print s out with
 g_print (s = %s\n, s) , then i get s = (null),so i want to test what's
in s, i run this, if (s == EXP) print(s == EXP\n), where EXP is replaced
by , NULL, null and (null) ,but the test have no come out message.
can any body tell me  what is in s if i use gtk_tree_model_get() to get the
content of an empty cell. Thanks.

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


Re: what do i get if a cell is empty?

2010-04-24 Thread Arthur 1989
Thank you so much.

On Sun, Apr 25, 2010 at 1:14 AM, Tadej Borovšak tadeb...@gmail.com wrote:

 Hello.

 You get NULL pointer. To test for it, you should do something like:

 if( s == NULL )
 {
/* Handle empty string */
 }

 Tadej

 --
 Tadej Borovšak
 tadeboro.blogspot.com
 tadeb...@gmail.com
 tadej.borov...@gmail.com




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

Re: different data types between clist and mysql.

2010-04-23 Thread Arthur 1989
 G_TYPE_LONG:
l-sortable=TRUE;
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model),
 l-pos, sort_by_long,(gpointer) l-pos, NULL);
break;
case G_TYPE_ULONG:
l-sortable=TRUE;
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model),
 l-pos, sort_by_ulong,(gpointer) l-pos, NULL);
break;
case G_TYPE_DOUBLE:
l-sortable=TRUE;
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model),
 l-pos, sort_by_double,(gpointer) l-pos, NULL);
break;
case G_TYPE_STRING:
l-sortable=TRUE;
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model),
 l-pos, sort_by_string,(gpointer) l-pos, NULL);
break;
}

}


return model;
}



 return NULL;}



 Hope this helps,
 Shawn



  EMAILING FOR THE GREATER GOOD
 Join me

  Subject: Re: different data types between clist and mysql.
  From: eba...@gmail.com
  To: gtk-app-devel-list@gnome.org
  Date: Tue, 20 Apr 2010 15:49:20 +0100
 
  On Tue, 2010-04-20 at 21:15 +0800, Arthur 1989 wrote:
   Hello, I used *clist* to display data iI fetch from mysql server,but
 when
   writing data back into the table of database, I got this question: the
 data
   type of clist is always *gchar **, while there are quite a lot of other
 data
   types in mysql. What can I do to get this question solved? Any tips
 will be
   appreciated.
 
  CList is *beyond* deprecation - you should not be using it.
 
  look at GtkListStore and GtkTreeView; there's also a tutorial here:
 
http://scentric.net/tutorial
 
  ciao,
   Emmanuele.
 
  --
  W: http://www.emmanuelebassi.name
  B: http://blogs.gnome.org/ebassi
 
  ___
  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




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


different data types between clist and mysql.

2010-04-20 Thread Arthur 1989
Hello, I used *clist* to display data iI fetch from mysql server,but when
writing data back into the table of database, I got this question: the data
type of clist is always *gchar **, while there are quite a lot of other data
types in mysql. What can I do to get this question solved? Any tips will be
appreciated.

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


how to remove the contents of vbox?

2010-04-19 Thread Arthur 1989
hello, I got this func: static void (GtkWidget *vbox) {...}, when passed in
an vbox, it should insert a GtkWidget *scrolled_window into the vbox, but I
want to clear the contents of vbox first,otherwise the old contents will be
displayed as well as the newly inserted widget. I am wondering how to
implement this.Any tips will be appreciated.

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