Re: how to draw something on GtkDrawingArea when I click a button?

2010-03-19 Thread Amol Kulkarni
gdk_draw_line takes GdkDrawable as first parameter.
try using drawing_area-window instead.


--
Regards,
Amol
On Fri, 2010-03-19 at 13:34 +0800, Tolic Ma wrote:
 Hi,everyone!
 
 I want to draw something on GtkDrawingArea when I click a GtkButton,but I
 don't know how to do this...
 
 this is my code(it doesn't work...):
 
 *void click_button(void){
 
 
 gdk_draw_line(drawing_area,drawing_area-style-white_gc,x,y,width+x,height+y);
 
 }
 
 int main(int argc,char *argv[]){
...
g_signal_connect(button,clicked,G_CALLBACK(click_button),NULL);
...
 }*
 ___
 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


GtkTreeView in VBox

2010-01-07 Thread Amol Kulkarni
Hi All,
Is it possible to add GtkTreeView inside VBox and then add that VBox to
ScrolledWindow using gtk_scrolled_window_add_with_viewport(sw,vbox).
GtkTreeView has inbuilt scrolling support hence it is expected to add it
directely to scrolledwindow using gtk_container_add but in some weird
case i want to pack treeview in vbox which will eventually be placed in
scrolledwindow.
It works fine for most of the cases but if i am having long list of
elements packed inside it then it behaves very randomly when my
scrolledwindow adjustment value is between some range [17000 - 27000] it
again works fine once adjustment moves beyond that. 
Since i am not adding treeview directely to scrolledwindow treeview
adjustments and scrolledwindow adjustments may not be in sync but if i
manually set treeview adjustments then i get double scrolling [scrolled
window + treeview] which i don't want.
Is this expected/supported use case or am i doing something wrong here?
Thanks for your time.

--
Thanks and Regards,
Amol

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


GtkIconView Pixbuf rendering

2009-10-06 Thread Amol Kulkarni
Hi All,
In newer versions of Gtk+[After GIcon addition] user is not able to add
mixed images in IconView that is file path plus named icons.
User will prefer named icons over file path to have consistent look and
feel but all required icons may not be available in icon theme so he may
need to use mix of these in some cases.
Are such scenarios discouraged or is their any workaround available?
thanks for your time.

--
Regrads,
Amol


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


GtkIconView Pixbuf rendering

2009-10-06 Thread Amol Kulkarni
Hi All,
In newer versions of Gtk+[After GIcon addition] user is not able to add
mixed images in IconView that is file path plus named icons.
User will prefer named icons over file path to have consistent look and
feel but all required icons may not be available in icon theme so he may
need to use mix of these in some cases.
Are such scenarios discouraged or is their any workaround available?
thanks for your time.

--
Regrads,
Amol


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


Re: GtkIconView Pixbuf rendering

2009-10-06 Thread Amol Kulkarni
Hi Christian,
I will attach a testcase. 
please find my reply inline for your overview
On Tue, 2009-10-06 at 13:33 +0200, Christian Dywan wrote:
 Am Tue, 06 Oct 2009 16:13:00 +0530
 schrieb Amol Kulkarni amolgkulka...@gmail.com:
 
  Hi All,
  In newer versions of Gtk+[After GIcon addition] user is not able to
  add mixed images in IconView that is file path plus named icons.
  User will prefer named icons over file path to have consistent look
  and feel but all required icons may not be available in icon theme so
  he may need to use mix of these in some cases.
  Are such scenarios discouraged or is their any workaround available?
  thanks for your time.
 
 Hey Amol,
 
 can you be more specific about what you are trying to do? How are you
 loading pixbufs into the model? Are you manipulating cell renderers? If
 you have a small code example that worked in older GTK+ releases but
 not with 2.18 that would be great.

  I have two columns in model one of STRING type and one of PIXBUF type.
  i set icon-name to use data from STRING type column and pixbuf to use
data from PIXBUF column of model through gtk_cell_layout_set_attributes.
e.g 
  gtk_cell_layout_set_attributes
(icon_view,cell,icon-name,0,pixbuf,1,NULL);
where 0 = STRING type column
  1 = PIXBUF type column

if i have icon present in icon theme i set icon-name for corresponding
item if not then i set pixbuf from some filepath.
But in this case it will display only named icons[since attribute list
is reversed it will first set pixbuf property of renderer and then it
will set icon-name which will override previously set pixbuf].

It used to work in 2.12.9 but not in 2.14.3 onwards

Thanks.
Amol


 
 ciao,
 Christian

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


Re: Can I set background image for GtkTextView

2009-06-30 Thread Amol
Try setting background to textwindow of GtkTextView.
you can get text_window through gtk_text_view_get_window
(textview,window_type);
I don't remember exact syntax though.

Regards,
Amol
On Tue, 2009-06-30 at 15:54 +0800, winsty wrote:
 Hi, All
  
 I want to set a background image for GtkTextView in my program, but i 
 don't know how to do it. And i also can't find something useful about 
 this question, that's why I'm sending it here. 
  
 Best Regards
 winsty
  
 
 
 ___
 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: Height of text row in TreeView

2008-05-27 Thread amol

On Tue, 2008-04-22 at 23:14 +, BJörn Lindqvist wrote:

 2008/4/22 amol [EMAIL PROTECTED]:
 
   Hi
   I have a TreeView with two columns one pixbuf and one text.
   when i have large text in text column the height of text column never
  increase beyond height of pixbuf.
 
 This works for me and I can not reproduce it.

i am attaching a test case and screenshots to reproduce above scenario.
 if i set wrap-width before displaying treeview then it works as
expected and text column height is set accordingly.
 But if i set wrap-width in some timer callback then text gets wrapped
but text column height is not changed.
I have attached screenshots for above two cases.
case 1: (image 1)
  wrap-width is set before doing show.Works as expected.text is wrapped
and height is adjusted accordingly.
case 2: (image 2 and image 3)
  initially image 2 is displayed as no wrap-width is set but when
wrap-width is set say after 5 sec then image 3 is displayed.text gets
wrapped but height is not adjusted accordingly and we can't see more
than two lines.

 
   If there is no pixbuf rendered height never increases beyond one line.
 
 What does this mean? GtkTreeView doesn't word wrap your text unless
 you tell it to.
 
   Is this issue with GtkCellRendererText?
 
 It is impossible to say. Please provide minimal example code that
 demonstrates your problems. Also see bugzilla.gnome.org which is the
 standard place for bug reports.
 
 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Height of text row in TreeView

2008-04-22 Thread amol
Hi
I have a TreeView with two columns one pixbuf and one text.
when i have large text in text column the height of text column never
increase beyond height of pixbuf.
If there is no pixbuf rendered height never increases beyond one line.
Is this issue with GtkCellRendererText?
Is there any simple way to achieve this so that we get correct cell
height.

Thanx for your time.

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


GtkListStore with GtkBuilder

2008-04-22 Thread amol
sorry for second mail since first one was from non member mail id
Hi,
I have a Liststore with two columns first is a Pixbuf and second is a
string column.
When i want to populate this Liststore through ui i always need to
specify both fields.
but for some row if i don't want to show Pixbuf i can't do it. I always
need to specify both columns.
If i specify wrong filename or NULL Gtk will show
GTK_STOCK_MISSING_IMAGE.

And if i does not Pixbuf column then GtkListstore tries to set the
string part (second col) as pixbuf in first column.
When i looked in GtkListStore code I think their is mismatch in column
type and passed GValue which is to filled by calling 
gtk_builder_value_from_string_type.

I am attaching a patch (with correct index) for above case.It works fine
in my case but needs to verify it with other scenarios.

Can't we miss any column(any one of many) which is not needed for that
particular row.

Regards,
Amol 

Index: gtkliststore.c
===
--- gtkliststore.c	(revision 16714)
+++ gtkliststore.c	(working copy)
@@ -2197,7 +2197,7 @@
 
   string = g_strndup (text, text_len);
   if (!gtk_builder_value_from_string_type (data-builder,
-	   data-column_types[i],
+	   data-column_types[data-columns[i]],
 	   string,
 	   data-values[i],
 	   tmp_error))
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Height of text row in TreeView

2008-04-22 Thread amol
Hi
I have a TreeView with two columns one pixbuf and one text.
when i have large text in text column the height of text column never
increase beyond height of pixbuf.
If there is no pixbuf rendered height never increases beyond one line.
Is this issue with GtkCellRendererText?
Is there any simple way to achieve this so that we get correct cell
height.

Thanx for your time.

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


Re: recurrent spam from applications developers [was: GtkListStore with GtkBuilder]

2008-04-22 Thread amol

On Tue, 2008-04-22 at 12:43 +0200, Guillaume Cottenceau wrote:
 How about renaming gtk-devel-list into gtk-core-library-devel or
 something like that?
 
 Also, on http://gtk.org/mailing-lists.html:
 
 This list is for developers of GTK+ to discuss code. General GTK+
 questions should not be asked on this list, as that is more
 appropriate for gtk-app-devel-list.
 
 =
 
 This list is for developers of the bcore/b GTK+ library to discuss
 GTK+ implementation. GTK+ applications development, and general GTK+
 questions, should bnot/b be asked on this list, as that is more
 appropriate for gtk-app-devel-list.
I suppose this is not General GTK+ question. this is probably bug in
Gtk+ code and this list seems to be more appropriate one to discuss it.
Please go through it before making it spam.


 
 -- Forwarded message --
 From: amol [EMAIL PROTECTED]
 Date: 2008/4/22
 Subject: GtkListStore with GtkBuilder
 To: gtk-devel-list@gnome.org
 
 
 
  sorry for second mail since first one was from non member mail id
  Hi,
  I have a Liststore with two columns first is a Pixbuf and second is a
 string column.
  When i want to populate this Liststore through ui i always need to
 specify both fields.
  but for some row if i don't want to show Pixbuf i can't do it. I
 always need to specify both columns.
  If i specify wrong filename or NULL Gtk will show GTK_STOCK_MISSING_IMAGE.
 
  And if i does not Pixbuf column then GtkListstore tries to set the
 string part (second col) as pixbuf in first column.
  When i looked in GtkListStore code I think their is mismatch in
 column type and passed GValue which is to filled by calling
  gtk_builder_value_from_string_type.
 
  I am attaching a patch (with correct index) for above case.It works
 fine in my case but needs to verify it with other scenarios.
 
  Can't we miss any column(any one of many) which is not needed for
 that particular row.
 
  Regards,
  Amol
 
 
 
 ___
  gtk-devel-list mailing list
  gtk-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-devel-list
 
 
 
 
 ___
 gtk-devel-list mailing list
 gtk-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-devel-list

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


Height of text row in TreeView

2008-04-17 Thread amol
Hi
I have a TreeView with two columns one pixbuf and one text.
when i have large text in text column the height of text column never
increase beyond height of pixbuf.
If there is no pixbuf rendered height never increases beyond one line.
Is this issue with GtkCellRendererText?
Is there any simple way to achieve this so that we get correct cell
height.

Thanx for your time.

Regards,
Amol.


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


Height of text row in TreeView

2008-04-17 Thread amol
Hi
I have a TreeView with two columns one pixbuf and one text.
when i have large text in text column the height of text column never
increase beyond height of pixbuf.
If there is no pixbuf rendered height never increases beyond one line.
Is this issue with GtkCellRendererText?
Is there any simple way to achieve this so that we get correct cell
height.

Thanx for your time.

Regards,
Amol.


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


Re: How to get the preedit character from TextView?

2008-03-30 Thread amol
Hi 
Try this 

gtk_im_context_get_preedit_string (GTK_TEXT_VIEW
(text_view)-im_context, preedit_string, NULL,
   cursor_pos); 

. 
do what u want with preedit string
.
gtk_im_context_reset (GTK_TEXT_VIEW (text_view)-im_context);

Regards,
Amol
On Fri, 2008-03-28 at 12:33 +0900, KwangYul Seo wrote:

 Hi,
 
 I can get the text string from TextView,
 but I can't get the last character in preedit mode before it commits.
 
 Is it possible to get the character in preedit mode from TextView?
 
 Thanks,
 Kwang Yul Seo
 ___
 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


buildable_set_name

2008-01-29 Thread amol
Hi,
When we do gtk_buildable_set/get_name for any object created through
GtkBuilder, GtkBuildable does g_object_set/get_data to return the
corresponding name of object if its set/get_name are not overridden.
But GtkWidget overrides set/get_name of buildable interface and does
gtk_widget_set/get_name.
I may create GtkWidget through GtkBuilder and after that i may set
widget name accordingly (to use different styles in different cases).
But when i do gtk_buildable_get_name it returns me new name which was
set through widget_set_name and not through buildable_set_name.
No one except GtkAction and GtkActionGroup seems to be using buildable
set/get_name.
My doubt is - What is the intention for GtkWidget to override set/get
functions of GtkBuildable interface.
Can we get rid of it w/o affecting any Gtk applications.
Gtk+ don't have any idea about the custom Id's specified in ui file
while object creation.
What is achieved doing by gtk_widget_set_name with Id specified in ui
file.(gtkrc and ui Creator must be always in sync for themes to be work
correctly )
I am planning to get rid of overriding set/get_name of buildable in
GtkWidget. Does it will have any adverse effect?

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


buildable_set_name

2008-01-29 Thread amol
Hi,
When we do gtk_buildable_set/get_name for any object created through
GtkBuilder, GtkBuildable does g_object_set/get_data to return the
corresponding name of object if its set/get_name are not overridden.
But GtkWidget overrides set/get_name of buildable interface and does
gtk_widget_set/get_name.
I may create GtkWidget through GtkBuilder and after that i may set
widget name accordingly (to use different styles in different cases).
But when i do gtk_buildable_get_name it returns me new name which was
set through widget_set_name and not through buildable_set_name.
No one except GtkAction and GtkActionGroup seems to be using buildable
set/get_name.
My doubt is - What is the intention for GtkWidget to override set/get
functions of GtkBuildable interface.
Can we get rid of it w/o affecting any Gtk applications.
Gtk+ don't have any idea about the custom Id's specified in ui file
while object creation.
What is achieved doing by gtk_widget_set_name with Id specified in ui
file.(gtkrc and ui Creator must be always in sync for themes to be work
correctly )
I am planning to get rid of overriding set/get_name of buildable in
GtkWidget. Does it will have any adverse effect?

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


Reparsing with GtkBuilder

2007-12-17 Thread amol
Hi
If i used gtk_builder_add_from_string to parse some string for builder
which already has some content then application terminates  with
following message
Gtk-ERROR **: file gtkbuilder.c: line 567
(apply_delayed_properties): assertion failed: (object != NULL)
if builder had already set some delayed property.

If builder had not set any delayed property previously then it does not
crashes while reparsing with add_string.

Is this bug in Gtk+?

Delayed properties are applied in parser finished.
If we parse any buffer again with same builder then it tries to set the
delayed properties again which are irrelevant.
setting builder-delayed_properties to NULL in parser_finished solves
above problem but is this a right solution or it has any other side
effects?
If new buffer has any delayed properties associated with objects then
builder-delayed_properties will set again and that properties will be
applied in parser_finished.

Regards
Amol




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


Custom cel renderer

2007-09-07 Thread amol
Hi All,
I am trying to write custom cell renderer which should be able to
display GtkWidgets.
But I am not able to get GdkWindow of widget to be displayed since it
not displayed or added to any container(not realized yet).
I am creating one widget say GtkButton and wanted it to be displayed on
cellrenderer.
What i am trying is to implement  'cell_class-render' and in it try to
draw this widget on parent GdkWindow through gdk_draw_drawable() but i
am not able to get GdkDrawable (GdkWindow) of widget(i.e of button) to
draw it on destination GdkWindow.
Is there any way to draw this widget on parent GdkWindow or is there any
other way to display widgets with cellrenderer?
Are there any guidelines to write custom cellrenderer which will display
any GtkWidget?
Thanks in advance.

Regards,
Amol


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


Re: List view: Howto get the number of displayed rows?

2007-06-20 Thread amol
Hi
I am not sure whether this is right/optimized solution.

1. gtk_list_store_insert_before   (GtkListStore *list_store,
GtkTreeIter *iter,   GtkTreeIter *sibling); with sibling = NULL.

2. gchar*  gtk_tree_model_get_string_from_iter  (GtkTreeModel
*tree_model,  GtkTreeIter *iter);
  if your list has 10 rows then 10 will be returned. 

3. gtk_list_store_remove (GtkListStore *list_store,GtkTreeIter *iter);

Regards,
Amol.


On Wed, 2007-06-20 at 10:47 +0200, Felipe wrote: 

 Hi,
 
 Perhaps a stupid question, but I searched unsuccessfully in the 
 documentation of GtkListStore and GtkTreeModel about the number of rows 
 that are currently displayed in a list view. Now I need to know if 
 exists a function for this or should I use gtk_tree_model_foreach() to 
 count the number of rows manually?
 
 
 Thanks in advance,
 
 
 Felipe
 
 
 ___
 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


How to detect the presence of scrollbar on scrolled window.

2007-01-03 Thread amol
Does anyone know how to find out whether a vertical scrollbar is present
on scolled window or not.
I need to detect its presence at runtime.
below is the code which i tried to find out.but it is not working as
expected.
line 3 is always returning false.irrespective of vscrollbar presence.

1.  scrolled_window = (GtkScrolledWindow *) gtk_scrolled_window_new
(NULL, NULL);
2.  gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);

3.  if (scrolled_window-vscrollbar_visible) {
4.  GtkWidget *widget = gtk_scrolled_window_get_vscrollbar
(scrolled_window);
5.  width = widget-requisition.width;
6.  }

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