Re: Location entry in GtkFileChooser

2008-04-15 Thread Carlos Pereira
Martin (OPENGeoMap) wrote:

 Hullo,

 In a GTkFilechooser, how can I acess the information
 on the Location entry? I only find functions to get
 the full filename and uri but not the actual short
 filename...

  

 I don´t understand well??

 are you talking about filters???

No,
I am talking about the GtkEntry that is next to the GtkLabel that
says Location:, the place where the file shortname is written.

So if I write foo.xml, I want to get that shortname back, not just the 
fullname,

Carlos
 Something like this??

 GtkFileFilter *filter;
 filter = gtk_file_filter_new ();
 gtk_file_filter_add_pattern (filter, *.doc);
 gtk_file_filter_set_name(filter, microsoft word);
 gtk_file_chooser_add_filter (dialog,filter);





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


Re: Location entry in GtkFileChooser

2008-04-15 Thread Carlos Pereira
Luis Menina wrote:
 Hi Carlos.

 Well, I'm not familiar with GtkFileChooser, but I think you should 
 retrieve the full filename, and then use g_path_get_basename to get 
 the short filename.

Thanks, that is a good suggestion, unfortunately it fails in my case. I 
really need
to have access to the GtkEntry next to Location, to get the information 
in there.

The reason is, in my app, I accept local and remote addresses as well. 
It works
like this:

If the user writes:
http://www.my_site.org/my_path/my_file.xml
my app tries to fetch that file by HTTP (and ignores the GTK fullname).

If the users writes:
ftp://ftp.my_site.org/my_path/my_file.xml
my app tries to fetch that file by anonymous FTP (and ignores the GTK 
fullname).

Otherwise, my app will consider the file as an ordinary file,
and then normal procedure applies: get the GTK fullname, etc...

Unfortunatly GTK tries to parse the GtkEntry before sending it to me,
and gtk_file_chooser_get_filename returns NULL when the shortname
starts with http:// or ftp:// which in turn makes it impossible to use
g_path_get_basename :-(

So I really must have access to the Location GtkEntry,
Carlos
 Cheers,

 Luis

 Carlos Pereira a écrit :
 Hullo,

 In a GTkFilechooser, how can I acess the information
 on the Location entry? I only find functions to get
 the full filename and uri but not the actual short
 filename...

 Carlos
 ___
 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: Location entry in GtkFileChooser

2008-04-15 Thread Damien Caliste
Hello,

Le 15/04/2008, Carlos Pereira [EMAIL PROTECTED] a écrit :
 The reason is, in my app, I accept local and remote addresses as
 well. It works
I've never used this function, so I may be wrong, but you may try
gtk_file_chooser_get_uri() instead of gtk_file_chooser_get_filename()
to retrieve the entry value.

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

function parameters not const

2008-04-15 Thread Gabriele Greco
There is a reason for functions like:

gtk_tree_store_iter_depth, gtk_tree_store_iter_is_valid,
gtk_list_store_iter_is_valid

[large part of all the iterator related api, mostly for GtkTreeIter type]

does not use a const GtkTreeIter * but a simple GtkTreeIter *?

In C programs is almost the same but for C++ programmers and compilers in
general specifying const where it's correct to do so will be very useful,
and AFAIK in a few API functions this has been already done (most
GtkTextIter related API have their prototypes using const where possible).

-- 
Bye,
 Gabry
___
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 draw a primitive with one color and fill it with, another? (Sergey Parhomenko)

2008-04-15 Thread Thomas Stover
I would suggest you look at doing your drawing with cairo if possible. 
Once I discovered that, I gave up on calling all those gdk functions. 
Read the documents on their site at, http://www.cairographics.org . It 
looks like most gtk drawing is going this way. I'm also fuzzy on what 
the role of the pixmap is in your example. Are you trying to draw to a 
widget, or to a pixmap?

Here is an untested example off of the top of my head to do what you 
want to a widget (drawing area widget that is)...

void draw(GtkWidget* widget)
{
 int width = widget-allocation.width;
 int height = widget-allocation.height;
 cairo_t *cr gdk_cairo_create(widget-window);

 int x = width / 2;
 int y = height / 2;
 int r = 30;

 /* clearing to white: (rgb values in cairo are floating points instead of 
bytes) */
 cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
 cairo_rectangle(, 0, 0, width, height);
 cairo_fill(cr);

 cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
 cairo_arc(cr, x, y, r, 0.0, 0.0);
 cairo_fill(cr);
 cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
 cairo_stroke(cr);

 cairo_destroy(cr);
}



 Date: Mon, 14 Apr 2008 07:05:20 -0700 (PDT)
 From: Sergey Parhomenko [EMAIL PROTECTED]
 Subject: How to draw a primitive with one color and fill it with
   another?
 To: gtk-app-devel-list@gnome.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=iso-8859-1

 Hello everyone.

 I want to draw a red circle filled within with a green
 color on my pixmap. I've set foreground and background
 colors and passed TRUE as the filled parameter to
 gdk_draw_arc(). But the circle is filled with the same
 color as it is drawn, that is with the foreground
 color - red.

 How can I draw a red circle filled with green? The
 relevant part of my code is below.

 /* ... */

 static GdkPixmap *pixmap = NULL;

 void draw(GtkWidget* widget)
 {
   int width = widget-allocation.width;
   int height = widget-allocation.height;
   GdkGC *gc;
   GdkColor colors[2];

   int x = width / 2;
   int y = height / 2;
   int r = 30;

   if (pixmap)
 g_object_unref (pixmap);
   pixmap = gdk_pixmap_new (widget-window,
width,
height,
-1);
   gc = gdk_gc_new((GdkDrawable *)pixmap);
 /* clearing to white: */
   gdk_draw_rectangle (pixmap,
   widget-style-white_gc,
   TRUE,
   0, 0,
   width,
   height);

   gdk_color_parse(#ff, colors[0]);
   gdk_color_parse(#00ff00, colors[1]);
 /* By the way, can I get red and green GdkColor
 faster, without these gdk_color_parse()? Are some
 constants for this available? */
   gdk_gc_set_rgb_fg_color(gc, colors[0]);
   gdk_gc_set_rgb_bg_color(gc, colors[1]);

   gdk_draw_arc(pixmap, gc, TRUE, x - r / 2, y - r / 2,
 r, r, 0, 64 * 360);
 }

 /* ... */




   

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


Re: printing gtktextview and text layout

2008-04-15 Thread Behdad Esfahbod
On Sat, 2008-04-12 at 11:08 +0200, Philippe Rouquier wrote:
 
 Could someone help me with that please?

Just reorder your code to use pango_cairo_show_layout() for both display
and print, then make sure you set font options on your PangoContext
attached to the layout using pango_cairo_context_set_font_options() to
turn metrics hinting off (cairo_font_options_set_hint_metrics()).

-- 
behdad
http://behdad.org/

Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety.
-- Benjamin Franklin, 1759

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


ComboBox displaying data from a TreeStore

2008-04-15 Thread Tiberius Duluman
Hello

I have one question about a ComboBox displaying data from a TreeStore.
How can I make it to display the entire path? For example, when a
child is selected, I want it to display something like /item n/subitem 
c/subitem xx
In the application that I'm working to, display only child name, the way 
ComboBox
is doing now, would be very confusing. ( for example, displaying only 
subitem xx )

I've tried to make a custom CellRenderer, but there is a problem:
when the popup is displayed, it displays every item with the entire path.
For example, I open item n item and inside of it I want to see an item 
subitem c,
but with the custom CellRenderer, the subitem is rendered as /item 
n/subitem c.

I'm thinking to write a custom widget inherited from ComboBox, and 
overriding
the on_expose_event, but I have no idea how to determine the rectangle 
where I
should render the text; I don't want to overwrite it over the arrow.

Does anybody have any idea how can I solve this problem?

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


signal for detecting gtk app de-focus

2008-04-15 Thread Steve Splonskowski
Hello,

I am attempting to find a way in my gtk app to get control (via signal  
or other means) when my application looses focus - that is when  
another application comes to the front, but my app is still running. I  
need to cleanup somethings at that point in time, but have not been  
able to determine how to get control.

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


text selection color accessor

2008-04-15 Thread Steve Splonskowski
Hello,

I have a need to get the current (as per the selected UI theme) text  
selection color. I will be using this to highlight some other custom  
drawn elements in the UI of my gtk app.

I understand that I can get this from the style information of a text  
widget (GtkEntry, etc), but it seems that the widget must be active in  
the UI before this information is fully filled in (that is, just  
creating a GtkEntry and accessing its style information does not give  
the correct results - this is just from my experiments).

Any idea how I can access the text selection color at startup in my  
gtk app?


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