Re: Typing Right-To-Left language characters in GtkEntry

2005-06-14 Thread Viraj Chatterjee

It should work with gnome-terminal.

-vc

- Original Message - 
From: "Gaurav Jain" <[EMAIL PROTECTED]>

To: "Mohammed Sameer" <[EMAIL PROTECTED]>
Cc: 
Sent: Wednesday, June 15, 2005 10:53 AM
Subject: Re: Typing Right-To-Left language characters in GtkEntry


I'm using Xterm.

On 6/11/05, Mohammed Sameer <[EMAIL PROTECTED]> wrote:

On Thu, Jun 09, 2005 at 12:29:02PM +0530, Gaurav Jain wrote:
> Yes, this time it worked!  In fact even without setting the font to
> the Code2000 font for the GtkEntry, I'm able to type Arabic text into
> the entry.  Thanks so much for your help!
>
> One think I still wish to know is why I'm unable to type on the
> terminal window.  Is it possible to enable keyboard layout for only my
> GTK application?
>

What's the terminal you are using ?

> Thanks again,
> Gaurav
>
> On 6/9/05, Alem Dain <[EMAIL PROTECTED]> wrote:
> > Ah, it's a mistake I make all the time.  When I said "en" it should
> > have been "us".  The setxkbmap command is actually:
> >
> > setxkbmap -rules xfree86 -model pc104 -layout us,ar
> >
> > possibly with -option grp:menu_toggle if that's what you want.  This
> > is why you were getting "Error loading keyboard description": there is
> > no "en" layout.  Anyway, try this out.  If it still doesn't work, let
> > me know.  Note that most likely, you do not want to be typing these
> > things in a terminal... something like a GtkEntry, however, will
> > certainly produce proper text.
> >
> > The other thing to do, of course, is tell GTK that you want to use a
> > font that supports Arabic.  You do something like this:
> >
> > {
> >   PangoFontDescription *font;
> >   GtkEntry *entry;
> >   font = pango_font_description_from_string("Code2000");
> >   entry = gtk_entry_new();
> >   gtk_widget_modify_font(entry, font);
> > }
> >
> > Just a note, I've noticed that other Unicode X fonts (such as, for
> > example, whatever GTK uses by default) seem to support Arabic as well;
> > you may want to try them also.  This might just be me, since I've
> > install a hajillion extra fonts on my system
> >
> > Anyway, the above bits *should* do it for you.  To summarize, use
> > setxkbmap (I can't speak for any KDE-controlpanel-setting-thingy) to
> > make sure your keyboard does what you want, and use
> > PangoFontDescription to make sure you have are using a font that can
> > handle.
> >
> > Salaam,
> >   Adam.
> >
> > On 6/8/05, Gaurav Jain <[EMAIL PROTECTED]> wrote:
> > > Hello Alem,
> > >
> > > Thanks for the detailed response.  I installed the CODE2000 unicode
> > > font that you mentioned according to the rules given at
> > > http://eyegene.ophthy.med.umich.edu/unicode/index.html#kdefontinst.
> > >  ( using the mkfontscale and mkfontdir commands, and then adding the
> > > path to /etc/X11/XF86Config).
> > >
> > > I then tried to exeute the setxkbmap command that you mentioned, but
> > > it failed with the error: "Error loading new keyboard description".
> > >
> > > I'm using KDE session, so I also tried setting the Keyboard Layout
> > > from the "Control Center > Regional & Accessibility > Keyboard 
> > > Layout"
> > > to Arabic.  However, if I do that, whatever I type on the terminal 
> > > is
> > > not shown on the screen (it looks like an empty space), and it 
> > > doesn't

> > > even show the square blocks that you mentioned.
> > >
> > > Have I missed some step here?
> > > Thanks again,
> > > Gaurav
> > >
> > > On 6/9/05, Alem Dain <[EMAIL PROTECTED]> wrote:
> > > > Hmmm, with almost no work at all, I managed to type right-to-left 
> > > > in

> > > > Arabic (not that I know a word of it...)
> > > >
> > > > For the purpose of input, no locale information is necessary.  All 
> > > > you
> > > > need is the appropriate keyboard mapping loaded in X, as well an 
> > > > an
> > > > Arabic-capable unicode font; Pango knows how to render 
> > > > right-to-left

> > > > text.
> > > >
> > > > More interesting than the version of Linux you are running are the
> > > > versions of GTK and Pango.  As for the keyboard map, I'm not 
> > > > familiar

> > > > with the inner workings of xmodmap; I recommend XKB.  You use this
> > > > program to dynamically change the keyboard mapping as though you 
> > > > had

> > > > edited XF86Config.
> > > >
> > > > So what I did was functionally equivalent to:
> > > >
> > > > setxkbmap -rules xfree86 -model pc104 -layout en,ar -option 
> > > > grp:menu_toggle

> > > >
> > > > Just a quick explanation may be required here.  Most likely you 
> > > > will

> > > > leave the "rules" and "model" option alone; if you have something
> > > > other than a standard keyboard (with the extra Windows keys) you 
> > > > will

> > > > want to change that.  Unfortunately, I'm not sure where you find a
> > > > list of other models.  Anyway, the important ones is "layout".  It
> > > > specifies that the first one should be english (basic), and the
> > > > second, arabic (basic).  You can have up to for.  I like to use 
> > > > the

> > > > Menu key to tog

Re: Typing Right-To-Left language characters in GtkEntry

2005-06-14 Thread Gaurav Jain
I'm using Xterm.

On 6/11/05, Mohammed Sameer <[EMAIL PROTECTED]> wrote:
> On Thu, Jun 09, 2005 at 12:29:02PM +0530, Gaurav Jain wrote:
> > Yes, this time it worked!  In fact even without setting the font to
> > the Code2000 font for the GtkEntry, I'm able to type Arabic text into
> > the entry.  Thanks so much for your help!
> >
> > One think I still wish to know is why I'm unable to type on the
> > terminal window.  Is it possible to enable keyboard layout for only my
> > GTK application?
> >
> 
> What's the terminal you are using ?
> 
> > Thanks again,
> > Gaurav
> >
> > On 6/9/05, Alem Dain <[EMAIL PROTECTED]> wrote:
> > > Ah, it's a mistake I make all the time.  When I said "en" it should
> > > have been "us".  The setxkbmap command is actually:
> > >
> > > setxkbmap -rules xfree86 -model pc104 -layout us,ar
> > >
> > > possibly with -option grp:menu_toggle if that's what you want.  This
> > > is why you were getting "Error loading keyboard description": there is
> > > no "en" layout.  Anyway, try this out.  If it still doesn't work, let
> > > me know.  Note that most likely, you do not want to be typing these
> > > things in a terminal... something like a GtkEntry, however, will
> > > certainly produce proper text.
> > >
> > > The other thing to do, of course, is tell GTK that you want to use a
> > > font that supports Arabic.  You do something like this:
> > >
> > > {
> > >   PangoFontDescription *font;
> > >   GtkEntry *entry;
> > >   font = pango_font_description_from_string("Code2000");
> > >   entry = gtk_entry_new();
> > >   gtk_widget_modify_font(entry, font);
> > > }
> > >
> > > Just a note, I've noticed that other Unicode X fonts (such as, for
> > > example, whatever GTK uses by default) seem to support Arabic as well;
> > > you may want to try them also.  This might just be me, since I've
> > > install a hajillion extra fonts on my system
> > >
> > > Anyway, the above bits *should* do it for you.  To summarize, use
> > > setxkbmap (I can't speak for any KDE-controlpanel-setting-thingy) to
> > > make sure your keyboard does what you want, and use
> > > PangoFontDescription to make sure you have are using a font that can
> > > handle.
> > >
> > > Salaam,
> > >   Adam.
> > >
> > > On 6/8/05, Gaurav Jain <[EMAIL PROTECTED]> wrote:
> > > > Hello Alem,
> > > >
> > > > Thanks for the detailed response.  I installed the CODE2000 unicode
> > > > font that you mentioned according to the rules given at
> > > > http://eyegene.ophthy.med.umich.edu/unicode/index.html#kdefontinst.
> > > >  ( using the mkfontscale and mkfontdir commands, and then adding the
> > > > path to /etc/X11/XF86Config).
> > > >
> > > > I then tried to exeute the setxkbmap command that you mentioned, but
> > > > it failed with the error: "Error loading new keyboard description".
> > > >
> > > > I'm using KDE session, so I also tried setting the Keyboard Layout
> > > > from the "Control Center > Regional & Accessibility > Keyboard Layout"
> > > > to Arabic.  However, if I do that, whatever I type on the terminal is
> > > > not shown on the screen (it looks like an empty space), and it doesn't
> > > > even show the square blocks that you mentioned.
> > > >
> > > > Have I missed some step here?
> > > > Thanks again,
> > > > Gaurav
> > > >
> > > > On 6/9/05, Alem Dain <[EMAIL PROTECTED]> wrote:
> > > > > Hmmm, with almost no work at all, I managed to type right-to-left in
> > > > > Arabic (not that I know a word of it...)
> > > > >
> > > > > For the purpose of input, no locale information is necessary.  All you
> > > > > need is the appropriate keyboard mapping loaded in X, as well an an
> > > > > Arabic-capable unicode font; Pango knows how to render right-to-left
> > > > > text.
> > > > >
> > > > > More interesting than the version of Linux you are running are the
> > > > > versions of GTK and Pango.  As for the keyboard map, I'm not familiar
> > > > > with the inner workings of xmodmap; I recommend XKB.  You use this
> > > > > program to dynamically change the keyboard mapping as though you had
> > > > > edited XF86Config.
> > > > >
> > > > > So what I did was functionally equivalent to:
> > > > >
> > > > > setxkbmap -rules xfree86 -model pc104 -layout en,ar -option 
> > > > > grp:menu_toggle
> > > > >
> > > > > Just a quick explanation may be required here.  Most likely you will
> > > > > leave the "rules" and "model" option alone; if you have something
> > > > > other than a standard keyboard (with the extra Windows keys) you will
> > > > > want to change that.  Unfortunately, I'm not sure where you find a
> > > > > list of other models.  Anyway, the important ones is "layout".  It
> > > > > specifies that the first one should be english (basic), and the
> > > > > second, arabic (basic).  You can have up to for.  I like to use the
> > > > > Menu key to toggle, hence the "-option grp:menu_toggle" bit.
> > > > >
> > > > > What I in fact did was ran a little GTK program I've written that does
> > > > > all these things for me, as 

Fwd: C & P event from x

2005-06-14 Thread Arx Henrique
thanks a lot
i'll read more about clipboard :)

On 6/14/05, Muthiah Annamalai <[EMAIL PROTECTED]> wrote:
> Hello!
>
> --- Arx Henrique <[EMAIL PROTECTED]> wrote:
> > i'm newbie in gtk, and i'm making a simple program
>
> Welcome to GTK!
> Explore documents at
>
> 1. Www.gtk.org/ | tutorials | articles | code
> 2. $ gtk-demo & | A simple & powerful demo of GTK+
> 3. http://developer.gnome.org | GTK+ & GNOME
> programming
> 4. http://gnomefiles.org | free & non-free GTK+
> programs.
>
> > how can i get copy and paste event from x in my gtk
> > app ?
>
> Well I think youre using the 'entry' widget or
> 'TextView' for copy/pasting from/to your app.
>
> Now you need to share data like this with other apps
> using a clipboard.
>
> So look at gtkclipboard.h in your
> /usr/include/gtk-2.0/gtk/ folder.
>
> Process is like this:
>
> 1: When you app starts, get access to a clipboard from
> the X server using:
>
>  GtkClipboard *gtk_clipboard_get_for_display
>   (GdkDisplay   *display, GdkAtom
> selection);
>
>  display can be got like
> GdkDisplay *gdk_display_get_default (void);
>
> For atom choose one from gdkselection.h, its basically
> the type of clipboard you want to save to.
>
>
> 2: If user selects some text in your app, and chooses
> paste,  use this function to set clipboard contents.
>
> void gtk_clipboard_set_text
>(GtkClipboard *clipboard,
>  const gchar   *text, gint   len);
>
> 3: If you want text from the user [paste], then
> request
> text from the clipboard using,
>
> void gtk_clipboard_request_text
> (GtkClipboard  *clipboard,
> GtkClipboardTextReceivedFunc callback,
>  gpointer  user_data);
>
> passing it a callback. Store the data, in some cache,
> and only if user presses paste, copy the text to the
> text buffer.
>
> This is preliminary help, might not work all the time,
> but if youre getting direction, then it helps.
>
> For more help see  /gtk+/gtk/gtktextbuffer.c
>
> Thanks
> Muthu.
>
>
>
> __
> Discover Yahoo!
> Have fun online with music videos, cool games, IM and more. Check it out!
> http://discover.yahoo.com/online.html
>


--
"A fé remove montanas, mas eu prefiro a dinamite"


-- 
"A fé remove montanas, mas eu prefiro a dinamite"
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C & P event from x

2005-06-14 Thread Muthiah Annamalai
Hello!

--- Arx Henrique <[EMAIL PROTECTED]> wrote:
> i'm newbie in gtk, and i'm making a simple program

Welcome to GTK!
Explore documents at 

1. Www.gtk.org/ | tutorials | articles | code
2. $ gtk-demo & | A simple & powerful demo of GTK+
3. http://developer.gnome.org | GTK+ & GNOME
programming
4. http://gnomefiles.org | free & non-free GTK+
programs.

> how can i get copy and paste event from x in my gtk
> app ?

Well I think youre using the 'entry' widget or
'TextView' for copy/pasting from/to your app.

Now you need to share data like this with other apps
using a clipboard.

So look at gtkclipboard.h in your
/usr/include/gtk-2.0/gtk/ folder.

Process is like this:

1: When you app starts, get access to a clipboard from
the X server using:

 GtkClipboard *gtk_clipboard_get_for_display 
  (GdkDisplay   *display, GdkAtom  
selection);

 display can be got like 
GdkDisplay *gdk_display_get_default (void);

For atom choose one from gdkselection.h, its basically
the type of clipboard you want to save to.


2: If user selects some text in your app, and chooses
paste,  use this function to set clipboard contents.

void gtk_clipboard_set_text
   (GtkClipboard *clipboard,
 const gchar   *text, gint   len);

3: If you want text from the user [paste], then
request 
text from the clipboard using,

void gtk_clipboard_request_text
(GtkClipboard  *clipboard,  
GtkClipboardTextReceivedFunc callback,
 gpointer  user_data);

passing it a callback. Store the data, in some cache,
and only if user presses paste, copy the text to the
text buffer.

This is preliminary help, might not work all the time,
but if youre getting direction, then it helps.

For more help see  /gtk+/gtk/gtktextbuffer.c

Thanks
Muthu.



__ 
Discover Yahoo! 
Have fun online with music videos, cool games, IM and more. Check it out! 
http://discover.yahoo.com/online.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: Delete a gtktextbuffer to fill it again

2005-06-14 Thread Freddie Unpenstein

> I use gtk_text_buffer_delete this way:
> if (textbuf != NULL) {
>   gtk_text_buffer_get_start_iter (textbuf,&start);
>   gtk_text_buffer_get_end_iter (textbuf,&end);
>   gtk_text_buffer_delete (textbuf,&start,&end);
> }

As an aside, there is a function that will get both iters at the same time.  
(get_bounds or something), and you could just set the buffer text to "" (not 
sure if NULL will work instead of an empty string).


Fredderic

___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


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


Problem: Multithread Application and gtk_widget_show with gtk-2.0

2005-06-14 Thread Rita Shrivastava
Hi all,

 I have a application that was build using the gtk-1.2 readhat 9.0. The 
application has two threads. The main thread is the display thread, while the 
second one updates the display on sometimes.
When the secons thread updated the display , The following error occurs:
-
Thread2: 
update_alarm_report_window() <- function called 
Xlib: unexpected async reply (sequence 0x5c07)!


I got over the problem by compiling with following options 

gcc -o out test.c `pkg-config --cflags --libs libgnome-2.0 libgnomeui-2.0 
gthread`

Thank to Frank W. Miller for listing out the compilation and link steps 
of the g_threads_init so clearly.  This is exactly what works.

After successful compilation, I could never bring up the application: In fact 
the main thread dumped with the following error at the very begning while 
showing the very first screen


Thread1: 


DH: create_login_window called
DH: DEBUG1
GLib-GObject-CRITICAL **: gtype.c:1875: initialization assertion failed, use 
g_type_init() prior to this function
 
GLib-GObject-CRITICAL **: file gobject.c: line 615 (g_object_new): assertion 
`G_TYPE_IS_OBJECT (object_type)' failed
--

So I added the following call 

  g_type_init();   



Then I got the following Error:

--
DH: create_login_window called
DEBUG1
Gdk-CRITICAL **: file gdkvisual-x11.c: line 533 (gdk_screen_list_visuals): 
assertion `GDK_IS_SCREEN (screen)' failed



I explicitly checked the return value of the gdk_screen_list_visuals() 
function. It is NULL.

Please HELP.

Regards 

Rita


The code is as follows:


main (int argc, char* argv[])
{
initialize_display(argc,argv)
}


int
initialize_display(int argc, char* argv[])
{
  g_print("\nDH: initialize_display called");

  g_type_init();   
  g_thread_init(NULL);
  gdk_init(&argc, &argv);
  gdk_threads_init();
  gdk_threads_enter ();  
  gtk_init (&argc, &argv);
  
  gnome_init ("nw_map", "0.1", argc, argv);
  gtk_rc_parse( "resource.rc" );
  
  // Create the login window
   create_login_window(NULL);   <<<-GUI Function Defined 
below

  gtk_main();
  gdk_threads_leave ();
}



void create_login_window (GtkWidget *prev_win)
{
  GtkWidget *login_window;
  GtkWidget *fixed1;
  GtkWidget *login_label;
  GtkWidget *login_entry;
  GtkWidget *password_label;
  GtkWidget *password_entry;
  GtkWidget *login_button;
  GtkWidget *login_cancel_button;
  GList *gl;

  g_print("\n create_login_window called");
  if (prev_win != NULL)
gtk_widget_destroy (prev_win);

  gl=NULL;

  login_window = gtk_window_new (GTK_WINDOW_DIALOG);
  gtk_object_set_data (GTK_OBJECT (login_window), "login_window", login_window);
  gtk_window_set_title (GTK_WINDOW (login_window), _("LOGIN"));

  gtk_window_set_position (GTK_WINDOW (login_window), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (login_window), TRUE);
  gtk_window_set_default_size(GTK_WINDOW(login_window),360,250);

  fixed1 = gtk_fixed_new ();
  gtk_widget_ref (fixed1);
  gtk_object_set_data_full (GTK_OBJECT (login_window), "fixed1", fixed1,
(GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show (fixed1);
  gtk_container_add (GTK_CONTAINER (login_window), fixed1);

  login_label = gtk_label_new (_("Login"));
  gtk_widget_ref (login_label);
  gtk_object_set_data_full (GTK_OBJECT (login_window), "login_label", 
login_label,
(GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (login_label);
  gtk_fixed_put (GTK_FIXED (fixed1), login_label, 56, 56);
  gtk_widget_set_uposition (login_label, 56, 56);
  gtk_widget_set_usize (login_label, 35, 16);

  login_entry = gtk_entry_new_with_max_length (30);
  gtk_widget_ref (login_entry);
  gtk_object_set_data_full (GTK_OBJECT (login_window), "login_entry", 
login_entry,
(GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (login_entry);
  gtk_fixed_put (GTK_FIXED (fixed1), login_entry, 136, 56);
  gtk_widget_set_uposition (login_entry, 136, 56);
  gtk_widget_set_usize (login_entry, 158, 22);

  password_label = gtk_label_new (_("Password"));
  gtk_widget_ref (password_label);
  gtk_object_set_data_full (GTK_OBJECT (login_window), "password_label", 
password_label,
(GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (password_label);
  gtk_fixed_put (GTK_FIXED (fixed1), password_label, 56, 120);
  gtk_widget_set_uposition (password_label, 56, 120);
  gtk_widget_set_usize (password_label, 55, 16);

  password_entry = gtk_entry_new_with_max_length (15);
  gtk_widget_ref (password_entry);
  gtk_object_set_data_full (GTK_OBJECT (login_window), "password_entry", 
password_entry,
 

Re: using autoconf

2005-06-14 Thread Johannes Tanzler
Am Dienstag, den 14.06.2005, 21:31 +0530 schrieb Mohit Gogia:
> i am new to autotools. i have made gnome applet which uses gtk,gtkhtml
> and libpanelapplet2 libraries.i want to use autoconf and automake to
> make a ditsribution package of this applet..can somebody give me
> sample configure.in and Makefile.am files which will help me in this

Take an existing app (e.g. gnome-hello from cvs.gnome.org) and modify
its autotools related-files.

You could also abuse Glade2 to generate code, and use its configure.in
as a starting point ...

BTW: Is there a tool that automagically creates all the stuff needed for
a recent Gtk+ or Gnome app, including source tree, configure.ac,
scrollkeeper-templates etc. etc.? It's a tedious task to do this
manually.


Johannes

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


Re: casting macros question

2005-06-14 Thread Paul Pogonyshev
Aleksandr Koltsoff wrote:
> This might sound like a stupid question to some one, but a simple yes/no
> answer will do :-)
>
> Should the following code be caught at compile-time (rather than run-time):
>
> gtk_layout_set_adjustment(layout, GTK_ADJUSTMENT(widget));
>
> layout is GtkLayout and widget is GtkWidget.

No.

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


Re: casting macros question

2005-06-14 Thread David Necas (Yeti)
On Tue, Jun 14, 2005 at 10:24:27PM +0300, Aleksandr Koltsoff wrote:
> This might sound like a stupid question to some one, but a simple yes/no 
> answer will do :-)
> 
> Should the following code be caught at compile-time (rather than run-time):
> 
> gtk_layout_set_adjustment(layout, GTK_ADJUSTMENT(widget));
> 
> layout is GtkLayout and widget is GtkWidget.

Run-time.

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


casting macros question

2005-06-14 Thread Aleksandr Koltsoff
This might sound like a stupid question to some one, but a simple yes/no 
answer will do :-)

Should the following code be caught at compile-time (rather than run-time):

gtk_layout_set_adjustment(layout, GTK_ADJUSTMENT(widget));

layout is GtkLayout and widget is GtkWidget.

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


Re: GtkListStore and Threads problems

2005-06-14 Thread Peter Bloomfield

On 06/14/2005 02:20:16 PM Tue, Lorena Salinas wrote:

Hi,

This is what I do inside the worker_thread function
(create_and_start_worker_thread ()) every time I want to update
the
model:


gdk_threads_enter();/* get GTK thread lock */

gtk_list_store_set (GTK_LIST_STORE (host_model), &iter,
MYMODEL_COL_STATUS, STATUS_NORMAL,
-1);

gdk_threads_leave();/* release GTK thread lock
*/


This may not be the cause of your current problem, but in this  
code you can't be sure that the GtkTreeIter is valid, because the  
lock has been dropped and reacquired.  Validating and using an  
iter while holding the lock is safer.

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


C & P event from x

2005-06-14 Thread Arx Henrique
Hi,

i'm newbie in gtk, and i'm making a simple program here, and i want know
how can i get copy and paste event from x in my gtk app ?


-- 
"A fé remove montanas, mas eu prefiro a dinamite"
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkListStore and Threads problems

2005-06-14 Thread Owen Taylor
On Tue, 2005-06-14 at 15:20 -0300, Lorena Salinas wrote:
> Hi,
> 
> This is what I do inside the worker_thread function
> (create_and_start_worker_thread ()) every time I want to update the
> model:
> 
> 
> gdk_threads_enter();  /* get GTK thread lock */
> 
> gtk_list_store_set (GTK_LIST_STORE (host_model), &iter,
>   MYMODEL_COL_STATUS, STATUS_NORMAL,
>   -1);
> 
> gdk_threads_leave();  /* release GTK thread lock */
> 
> I don't know if the problem is because the model is sorted by that
> column. I set this using : gtk_tree_view_column_set_sort_column_id

Which is fine. Presumably the problem is in the main thread. You
are forgetting to get the lock in a timeout or something like that.

Regards,
Owen

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

Re: [gsf] stdin/stdout + "tee"

2005-06-14 Thread Jody Goldberg
On Tue, Jun 14, 2005 at 08:08:13PM +0200, Uzytkownik wrote:
> 
> 2. Can I create one GsfOutput, which automatically send to two(or more)
> another?

We haven't written such an output, but you could easily whip up
something.  I'd be happy to include that in future versions.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkListStore and Threads problems

2005-06-14 Thread Lorena Salinas
Hi,

This is what I do inside the worker_thread function
(create_and_start_worker_thread ()) every time I want to update the
model:


gdk_threads_enter();/* get GTK thread lock */

gtk_list_store_set (GTK_LIST_STORE (host_model), &iter,
MYMODEL_COL_STATUS, STATUS_NORMAL,
-1);

gdk_threads_leave();/* release GTK thread lock */

I don't know if the problem is because the model is sorted by that
column. I set this using : gtk_tree_view_column_set_sort_column_id
(column, MYMODEL_COL_STATUS) when I create the tree_view for that model
.

Regards,
Lorena


On Tue, 2005-06-14 at 14:58, Owen Taylor wrote:
> On Tue, 2005-06-14 at 14:40 -0300, Lorena Salinas wrote:
> > Hi,
> > 
> > This is my app's main function:
> > 
> > int main (int argc, char **argv)
> > 
> > {
> > 
> > /* init threads */
> > g_thread_init(NULL);
> > 
> > gdk_threads_init();
> > 
> > /* init gtk */
> > gtk_init (&argc, &argv);
> > 
> > /* create the model and fill with data */
> > create_and_fill_model();
> > 
> > /* create the window with a tree_view and an icon_view */
> > create_window_and_views_for_model();
> > 
> > /* start the worker thread */
> > create_and_start_worker_thread ();
> > 
> > /* enter the GTK main loop */
> > gdk_threads_enter(); 
> > 
> > gtk_main();
> > 
> > gdk_threads_leave();
> > 
> > return 0;
> > 
> > }
> > 
> > I don't surround function calls in the main loop (eg: callbacks like row
> > changed)
> > because this will actually block the main thread.
> 
> I'd suggest reviewing 
>  
> http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html
> 
> in detail. Somewhere, you modifying the tree view without the GTK+/GDK
> lock.
> 
> Regards,
>   Owen
> 

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


Re: [gsf] stdin/stdout + "tee"

2005-06-14 Thread Hubert Sokołowski
On Tue, 14 Jun 2005 20:08:13 +0200
Uzytkownik <[EMAIL PROTECTED]> wrote:

> 1. How I should access to std{in,out,err} is recommended?
> By FILE * or IOChannel *?
better use GIOChannel. I experienced strange problems on windows
platform when using FILE in a gtk application.

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


Re: GtkTreeView issues (porting from GtkCList)

2005-06-14 Thread André Pedralho
I was trying to port a GTK1 app toward a GTK2 app. In my GTK1 app I
was using a CTree and I had to implement a TreeView in my GTK2 app to
show my old tree.

I have two questions:

1) There is a way to set the root of the tree?
e.g:
root
> child 1
> child 2

What I want is: in this example, I could not move the child 1 or the
child 2 to the root position! The root will always be the ROOT of the
tree.


2) There is a way to select when a node will be a leaf or a node?


Thanks,


On 6/14/05, Jan-Marek Glogowski <[EMAIL PROTECTED]> wrote:
> Hi Yury
> 
> > Yury Aliaev wrote:
> >
> > > 2) When pressing the left mouse button and moving the cursor vertically
> > > the selection in GtkCList follow the cursor. In GtkTreeView -- not. How
> > > can I obtain in GtkTreeView the same behavior as in GtkCList?
> 
> Not the same problem, but you may be able to adapt my solution:
> 
> gtk_widget_add_events( ect->treeview, GDK_POINTER_MOTION_MASK );
> 
> g_signal_connect( ect->treeview, "motion-notify-event",
> G_CALLBACK( editor_clist_hover_event ), ect );
> 
> 
> static gboolean editor_clist_hover_event
> ( GtkWidget *widget, GdkEventMotion *event, gpointer user_data )
> {
> EditorClistTimestamps *ect;
> GtkTreeView *tree_view;
> GtkTreePath *path;
> GtkTreeViewColumn *focus_column;
> 
> g_return_val_if_fail( user_data != NULL, FALSE );
> g_return_val_if_fail( IS_EDITOR_CLIST_TIMESTAMPS( user_data ),
> FALSE );
> 
> ect = EDITOR_CLIST_TIMESTAMPS( user_data );
> tree_view = GTK_TREE_VIEW( ect->treeview );
> 
> if( gtk_tree_view_get_path_at_pos( tree_view,
> (gint) event->x, (gint) event->y, &path, &focus_column,
> NULL, NULL ) )
> {
> gtk_tree_view_set_cursor
> ( tree_view, path, focus_column, FALSE );
> gtk_tree_path_free( path );
> }
> return FALSE;
> }
> 
> You also need to write a button press event handler, to toggle the "hover"
> handling.
> 
> HTH
> 
> Jan-Marek
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


-- 
André Pedralho
Bachelor in Computer Science
Instituto Nokia de Tecnologia
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


[gsf] stdin/stdout + "tee"

2005-06-14 Thread Uzytkownik
1. How I should access to std{in,out,err} is recommended?
By FILE * or IOChannel *?

2. Can I create one GsfOutput, which automatically send to two(or more)
another?

Best regards
-- 
Linux user: #376500 (see http://counter.li.org/)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GtkListStore and Threads problems

2005-06-14 Thread Owen Taylor
On Tue, 2005-06-14 at 14:40 -0300, Lorena Salinas wrote:
> Hi,
> 
> This is my app's main function:
> 
> int main (int argc, char **argv)
> 
> {
> 
>   /* init threads */
>   g_thread_init(NULL);
>   
>   gdk_threads_init();
>   
>   /* init gtk */
>   gtk_init (&argc, &argv);
>   
>   /* create the model and fill with data */
>   create_and_fill_model();
> 
>   /* create the window with a tree_view and an icon_view */
>   create_window_and_views_for_model();
> 
>   /* start the worker thread */
>   create_and_start_worker_thread ();
> 
>   /* enter the GTK main loop */
>   gdk_threads_enter(); 
>   
>   gtk_main();
>   
>   gdk_threads_leave();
>   
>   return 0;
> 
> }
> 
> I don't surround function calls in the main loop (eg: callbacks like row
> changed)
> because this will actually block the main thread.

I'd suggest reviewing 
 
 http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html

in detail. Somewhere, you modifying the tree view without the GTK+/GDK
lock.

Regards,
Owen

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

Re: GtkListStore and Threads problems

2005-06-14 Thread Lorena Salinas
Hi,

This is my app's main function:

int main (int argc, char **argv)

{

/* init threads */
g_thread_init(NULL);

gdk_threads_init();

/* init gtk */
gtk_init (&argc, &argv);

/* create the model and fill with data */
create_and_fill_model();

/* create the window with a tree_view and an icon_view */
create_window_and_views_for_model();

/* start the worker thread */
create_and_start_worker_thread ();

/* enter the GTK main loop */
gdk_threads_enter(); 

gtk_main();

gdk_threads_leave();

return 0;

}

I don't surround function calls in the main loop (eg: callbacks like row
changed)
because this will actually block the main thread.

Regards,
Lorena

On Tue, 2005-06-14 at 11:25, Owen Taylor wrote:
> On Tue, 2005-06-14 at 09:59 -0300, Lorena Salinas wrote:
> > Hello,
> > 
> > I'm having problems with threads and a gtkliststore model.
> > 
> > My working thread updates a column value of a gtkliststore model using 
> > gtk_list_store_set() (every call surrounded by gdk_threads_enter() and 
> > gdk_threads_leave ()). That seems to be working right.
> 
> And you are also surrounding all calls to GTK+ in the main thread by
> these calls? And you've called gdk_threads_init()?
> 
> Regards,
>   Owen
> 

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


using autoconf

2005-06-14 Thread Mohit Gogia
i am new to autotools. i have made gnome applet which uses gtk,gtkhtml
and libpanelapplet2 libraries.i want to use autoconf and automake to
make a ditsribution package of this applet..can somebody give me
sample configure.in and Makefile.am files which will help me in this
reagrd..
thanx.
--
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTreeView issues (porting from GtkCList)

2005-06-14 Thread Jan-Marek Glogowski
Hi Yury

> Yury Aliaev wrote:
>
> > 2) When pressing the left mouse button and moving the cursor vertically
> > the selection in GtkCList follow the cursor. In GtkTreeView -- not. How
> > can I obtain in GtkTreeView the same behavior as in GtkCList?

Not the same problem, but you may be able to adapt my solution:

gtk_widget_add_events( ect->treeview, GDK_POINTER_MOTION_MASK );

g_signal_connect( ect->treeview, "motion-notify-event",
G_CALLBACK( editor_clist_hover_event ), ect );


static gboolean editor_clist_hover_event
( GtkWidget *widget, GdkEventMotion *event, gpointer user_data )
{
EditorClistTimestamps *ect;
GtkTreeView *tree_view;
GtkTreePath *path;
GtkTreeViewColumn *focus_column;

g_return_val_if_fail( user_data != NULL, FALSE );
g_return_val_if_fail( IS_EDITOR_CLIST_TIMESTAMPS( user_data ),
FALSE );

ect = EDITOR_CLIST_TIMESTAMPS( user_data );
tree_view = GTK_TREE_VIEW( ect->treeview );

if( gtk_tree_view_get_path_at_pos( tree_view,
(gint) event->x, (gint) event->y, &path, &focus_column,
NULL, NULL ) )
{
gtk_tree_view_set_cursor
( tree_view, path, focus_column, FALSE );
gtk_tree_path_free( path );
}
return FALSE;
}

You also need to write a button press event handler, to toggle the "hover"
handling.

HTH

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


Re: GtkListStore and Threads problems

2005-06-14 Thread Owen Taylor
On Tue, 2005-06-14 at 09:59 -0300, Lorena Salinas wrote:
> Hello,
> 
> I'm having problems with threads and a gtkliststore model.
> 
> My working thread updates a column value of a gtkliststore model using 
> gtk_list_store_set() (every call surrounded by gdk_threads_enter() and 
> gdk_threads_leave ()). That seems to be working right.

And you are also surrounding all calls to GTK+ in the main thread by
these calls? And you've called gdk_threads_init()?

Regards,
Owen

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

Re: g_main_context_prepare(): main loop already active in another thread

2005-06-14 Thread Owen Taylor
On Tue, 2005-06-14 at 13:03 +0200, Colossus wrote:
> Hi,
> 
> I red the gtk_threads html page. I put the pair gdk_threads_enter() / 
> gdk_threads_leave() inside a function outside the gtk_main loop as 
> showed below:
> 
> void signalhandler (int signum)
> {
>   int status;
>   waitpid ( -1, &status, WNOHANG );
>   gdk_threads_enter();

The *only* thing you are allowed to do in a signal handler is call a
very limited set of C library functions. You certainly can't make
GTK+ calls from a signal handler.

You might want to use the "child watch" functionality of GLib.

Regards,
Owen

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

Re: GTK and the stressed vowels ( à è ì ò ù )

2005-06-14 Thread Peter Bloomfield

On 06/14/2005 09:52:19 AM Tue, Colossus wrote:

Hi,

I have to insert in a liststore some filenames
containing stressed vowels. I get a Pango layout
warning message in the console and the GUI hangs.
How to avoid this ?


See  and  
g_filename_display_name.

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


GTK and the stressed vowels ( à è ì ò ù )

2005-06-14 Thread Colossus

Hi,

I have to insert in a liststore some filenames
containing stressed vowels. I get a Pango layout
warning message in the console and the GUI hangs.
How to avoid this ?

Thanks,
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

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


GtkListStore and Threads problems

2005-06-14 Thread Lorena Salinas
Hello,

I'm having problems with threads and a gtkliststore model.

My working thread updates a column value of a gtkliststore model using 
gtk_list_store_set() (every call surrounded by gdk_threads_enter() and 
gdk_threads_leave ()). That seems to be working right.

The problem is, when the main thread (that is gtk_main()) paints the 
gtk_tree_view (of that model), after some minutes, I get one of the 2 
following the errors:
 
1-
Gtk-ERROR **: file gtksequence.c: line 760 
(_gtk_sequence_node_find_by_pos): assertion failed: (node->parent != NULL)
aborting...
Aborted
 
2-
Gtk-ERROR **: file gtksequence.c: line 596 (_gtk_sequence_node_rotate): 
assertion failed: (node->parent != node)
aborting...
Aborted
 
I think the problem appears when the main thread is being "blocked" (by 
the worker thread) in the middle of a gtk_tree_store_get() while the 
worker thread updates that same row.
 
Then, the main thread no longer founds the "original" iter in the 
"sequence tree",  which (I assume) has been rendered invalid by in the 
call to gtk_list_store_set().
 
Any help with this will be wellcome.
 
Thanks in advance,
Lorena.

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


Re: Delete a gtktextbuffer to fill it again

2005-06-14 Thread Eduardo M KALINOWSKI
Colossus wrote:

> Hi,
>
> I use gtk_text_buffer_delete this way:
>
> if (textbuf != NULL)
> {
> gtk_text_buffer_get_start_iter (textbuf,&start);
> gtk_text_buffer_get_end_iter (textbuf,&end);
> gtk_text_buffer_delete (textbuf,&start,&end);
> }

Have you tried using gtk_text_buffer_set_text() ?

-- 
Conscience is what hurts when everything else feels so good.

Eduardo M KALINOWSKI
[EMAIL PROTECTED]
http://move.to/hpkb

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


g_main_context_prepare(): main loop already active in another thread

2005-06-14 Thread Colossus

Hi,

I red the gtk_threads html page. I put the pair gdk_threads_enter() / 
gdk_threads_leave() inside a function outside the gtk_main loop as 
showed below:


void signalhandler (int signum)
{
int status;
waitpid ( -1, &status, WNOHANG );
gdk_threads_enter();
if ( WIFEXITED(status) )
{
if ( WEXITSTATUS (status) )
{
			gtk_window_set_title ( GTK_WINDOW (MainWindow) , "Xarchiver " 
VERSION );

response = ShowGtkMessageDialog (GTK_WINDOW
		 
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_QUESTION,GTK_BUTTONS_YES_NO,g_strdup_printf 
("An error occurred while reading the archive.\nWould you like to view 
the shell output ?") );

if (response == GTK_RESPONSE_YES) ShowShellOutput();
return;
}
}
gtk_window_set_title ( GTK_WINDOW (MainWindow) , path );
SetButtonState (1,1,1,1,1,1,1,0,0);
gdk_threads_leave();
g_free (path);
}

The function sighandler is "registered" into the main.c:
int main (int argc, char *argv[])
{
  signal (SIGCHLD, signalhandler);
  gtk_set_locale ();
  gtk_init (&argc, &argv);
.
}

When it happens that a child exits with an error status I got the 
message as in the subject. Where am I wrong ?

--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

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


Re: Delete a gtktextbuffer to fill it again

2005-06-14 Thread Muthiah Annamalai
Hello Giant{colossus}!

--- Colossus <[EMAIL PROTECTED]> wrote:
> I use gtk_text_buffer_delete this way:
> 
> if (textbuf != NULL)
> {
>   gtk_text_buffer_get_start_iter (textbuf,&start);
>   gtk_text_buffer_get_end_iter (textbuf,&end);
>   gtk_text_buffer_delete (textbuf,&start,&end);
> }
> will invalidate all outstanding iterators
[SNIP]
> I fill the text gtk_text_buffer this way:
> if (line != NULL) gtk_text_buffer_insert(textbuf,
> &enditer, line, 
> strlen( line ) );

I think your enditer is pointing to some absent
location, which is presently invalid.

You must get enditer via 

gtk_text_buffer_get_end_iter(textbuf,&enditer);

and then call,

gtk_text_buffer_insert(textbuf,&enditer, line, 
strlen( line ) );

Cheers
Muthu.



__ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Determining the number of visible lines in a GtkTextView

2005-06-14 Thread Stephen Kennedy

> > > Well, besides determining the width of the
> > > GtkTextView in
> > > characters, I also need to determine its height in
> > > lines, or the number
> > > of visible lines. I've tried a solution with font
> > > metrics, but the value

Here's an outline. It's pygtk, but I'm sure you can figure it out.
rect = textview.get_visible_rect()
low_iter = textview.get_line_at_y(rect.y)[0]
high_iter = textview.get_line_at_y(rect.y + rect.height)[0]
lines_visible = high_iter.get_line() - low_iter.get_line()

Stephen.
-- 
Stephen Kennedy <[EMAIL PROTECTED]>
http://meld.sf.net visual diff and merge

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


Re: Delete a gtktextbuffer to fill it again

2005-06-14 Thread Colossus

Colossus wrote:

I fill the text gtk_text_buffer this way:
if (line != NULL) gtk_text_buffer_insert(textbuf, &enditer, line, 
strlen( line ) );


As it always happens after sending this email to the list I got the
solution: I forgot to call
gtk_text_buffer_get_start_iter(textbuf, &enditer); after deleting the
gtk_text_buffer because the iterators are changed after the call to
gt_text_buffer_delete().

Sorry,
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

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


Delete a gtktextbuffer to fill it again

2005-06-14 Thread Colossus

Hi,

I use gtk_text_buffer_delete this way:

if (textbuf != NULL)
{
gtk_text_buffer_get_start_iter (textbuf,&start);
gtk_text_buffer_get_end_iter (textbuf,&end);
gtk_text_buffer_delete (textbuf,&start,&end);
}

However the very second time I try to fill the gtktextbuffer with some
text, it's cleaned but not filled and I get a bunch of these messages 
in the console window:


(xarchiver:4473): Gtk-CRITICAL **: gtk_text_buffer_insert: assertion 
`gtk_text_iter_get_buffer (iter) == buffer' failed


(xarchiver:4473): Gtk-WARNING **: Invalid text buffer iterator: either 
the iterator is uninitialized, or the characters/pixbufs/widgets in 
the buffer have been modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a 
position across buffer modifications.

You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents 
that can be referred to by character offset)

will invalidate all outstanding iterators

I fill the text gtk_text_buffer this way:
if (line != NULL) gtk_text_buffer_insert(textbuf, &enditer, line, 
strlen( line ) );


Where am I wrong ??
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

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