Using g_signal_connect in class

2008-07-15 Thread Marco Rocco

Hello, this is my first post on this mailing list, now i do my request:
can i use g_signal_connect  in a method of my class, using as c_handler 
a private function of class? ...and if i can, how i can do ?


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


RE: g_main_loop

2008-07-15 Thread HASWANI HARISH-VCKR47
Hi All,
 
I am a beginner to gtk APIs. 
My query is : 
- In Thread T1 I am calling g_main_loop()
- In Thread T2 I am emitting a signal through
g_signal_emit_by_name(G_OBJECT, signal-name);
 
I saw that signal handler is running in Thread2 context. I want that it
should run in Thread 1 context. How I can achieve this?
 
Regards,
Harish Haswani,
LJ-P2P, GRAPHICS, MME Group, MIEL, Bangalore, INDIA
Ph: 91-80-26014164
 
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Using g_signal_connect in class

2008-07-15 Thread Murray Cumming
On Tue, 2008-07-15 at 12:04 +0200, Marco Rocco wrote:
> Hello, this is my first post on this mailing list, now i do my request:
> can i use g_signal_connect  in a method of my class, using as c_handler 
> a private function of class? ...and if i can, how i can do ?

You are talking about C++, I believe.

The answer is No, not unless your method is a static method.

gtkmm makes this possible, using libsigc++ slots.

-- 
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com

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


g_main_loop

2008-07-15 Thread HASWANI HARISH-VCKR47
Hi All,
 
I am a beginner to gtk APIs. 
My query is : 
- In Thread T1 I am calling g_main_loop()
- In Thread T2 I am emitting a signal through
g_signal_emit_by_name(G_OBJECT, signal-name);
 
I saw that signal handler is running in Thread2 context. I want that it
should run in Thread 1 context. How I can achieve this?
 
Regards,
Harish Haswani,
LJ-P2P, GRAPHICS, MME Group, MIEL, Bangalore, INDIA
Ph: 91-80-26014164
 
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: g_main_loop

2008-07-15 Thread Paul Davis

On Tue, 2008-07-15 at 19:15 +0800, HASWANI HARISH-VCKR47 wrote:
> Hi All,
>  
> I am a beginner to gtk APIs. 
> My query is : 
> - In Thread T1 I am calling g_main_loop()
> - In Thread T2 I am emitting a signal through
> g_signal_emit_by_name(G_OBJECT, signal-name);
>  
> I saw that signal handler is running in Thread2 context. I want that
> it should run in Thread 1 context. How I can achieve this?

best to think of some other model. gobject signals do not (trivially)
cross thread boundaries. the most widely adopted approach is to use
g_idle_add() to (thread-safely) add an idle callback that emits the
signal from the correct (g_main_loop()) thread:

gboolean foobar (gpointer foo) { 
  g_signal_emit_by_name (foo, signal-name); 
  return FALSE;
}

in thread T2:

   ...
   g_idle_add (foobar, G_OBJECT);
   ...

something like that, anyway.


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


Re: build problem: (gtk+-2.12.10 build error)

2008-07-15 Thread d.henman

Thanks for your response Sergei.

Sergei Steshenko <[EMAIL PROTECTED]> wrote:

> On what platform are you building ? I mean, what is the OS ?
>
> --Sergei.
>
Posix compliant cygwin: CYGWIN_NT-5.1 1.5.25
The gtk version is:  gtk+-2.12.10

>
In answer to your other question.  No, this is not a permission problem.
> > GDK_PIXBUF_MODULE_FILE=../gdk-pixbuf/gdk-pixbuf.loaders
> > ./gtk-update-icon-cache --force --ignore-theme-index\
> >--source builtin_icons stock-icons >
> > gtkbuiltincache.h.tmp &&\
> > mv gtkbuiltincache.h.tmp gtkbuiltincache.h
> > gtk-update-icon-cache: The generated cache was invalid.

True the program "gtk-update-icon-cache" seem to have a bug in it.  It does not
honor the option "--force".

Whether or no another bug exists in not honoring --ingore-theme-index  is 
another question.

But, I want to know why the build process get suckered into/ or bugged into 
building an invalid "cache" according to "gtk-update-icon-cache".  Clearly 
something is wrong.
There a bug and I want to track it down.  I should hope that the deveopers 
would as well.

The developers, should not the bugs (if not illuciate why not).  Good code, 
does not flunk like this.  It should at the very, very least. give some hints 
as to why it considers a "cache" to be invalid.  Then one can dig in a bit 
deeper to try to cure the
 illness, which in this case is a "make" crash.

regards,
  d.j.
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


g_main_loop

2008-07-15 Thread HASWANI HARISH-VCKR47
Hi All,
 
I am a beginner to gtk APIs. 
My query is : 
- In Thread T1 I am calling g_main_loop()
- In Thread T2 I am emitting a signal through
g_signal_emit_by_name(G_OBJECT, signal-name);
 
I saw that signal handler is running in Thread2 context. I want that it
should run in Thread 1 context. How I can achieve this?
 
Regards,
Harish Haswani,
LJ-P2P, GRAPHICS, MME Group, MIEL, Bangalore, INDIA
Ph: 91-80-26014164
 
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


About setting the resource file

2008-07-15 Thread Keane Hu
    Hi,
   I meet a broblem that use a resource file to setting the picture of  
button widget, I try for a long time, but also failed. So would you help 
me, tell me something or methods, please.


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


Doing introspection on a GObject

2008-07-15 Thread Andreas Sliwka
Greetings,
  I'd like to query a Gobject for its properties. Browsing through the
header files I found g_object_class_list_properties(), which takes a
GObjectClass as first parameter. Now how do I get this GObjectClass
from GObject? Is this possible at all, if not, is this planned for a
future version of GLib?

be seeing you,

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


GTK Win32 accessibility

2008-07-15 Thread E.J. Zufelt

Good morning,

Can someone please direct me to a resource to learn about GTK accessibility 
for Win32?  Does GTK currently interface well with Win32 to expose objects 
(MSAA or not) to the O/S?


Thank you,
Everett


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


needing a source code pointer

2008-07-15 Thread Chuck Robey
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I have done nearly all of the various research needed to be able to write an
Xorg Xinput driver for a class of graphic tablets which I'm writing.  My goal is
to get it to work with Gimp, which I have been givne to understand uses solely
GTK drivers... Hence, I need to know what source C-files that exist to document
your hardware interface, and specifically, for graphic tablets.  Please DON'T
point me at Wacom stuff, my tablets ARE NOT wacom, and can't profit by using
their software, they are different.  I may be a little extreme in my reaction on
that, but I couldn't get the folks on the irc to stop pointing me at Wacom user
docs.  I have all the info I need to get info into the Xinput driver, what I
need now is to find out what GTK needs to get *from* me.  Assuming all the time
that gimp doesn't use any custom non-gtk things.

If there are any written docs on the matter, that's be really great, but I
wouldn't be disheartened if there wasn't.

I could also use a git url so I could download your archive, but maybe I'll spot
that at your main website somewhere.

Thanks for any pointers.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkh6KwQACgkQz62J6PPcoOkIvACbBL1LjbcnsBORV8313qmipH8V
E1gAoJm8KUqYuIYrtqHumXmQJ24Hnr2H
=KBeL
-END PGP SIGNATURE-
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


needing a source code pointer

2008-07-15 Thread Chuck Robey
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

*Resend after I subscribed to the list*

I have done nearly all of the various research needed to be able to write an
Xorg Xinput driver for a class of graphic tablets which I'm writing.  My goal is
to get it to work with Gimp, which I have been givne to understand uses solely
GTK drivers... Hence, I need to know what source C-files that exist to document
your hardware interface, and specifically, for graphic tablets.  Please DON'T
point me at Wacom stuff, my tablets ARE NOT wacom, and can't profit by using
their software, they are different.  I may be a little extreme in my reaction on
that, but I couldn't get the folks on the irc to stop pointing me at Wacom user
docs.  I have all the info I need to get info into the Xinput driver, what I
need now is to find out what GTK needs to get *from* me.  Assuming all the time
that gimp doesn't use any custom non-gtk things.

If there are any written docs on the matter, that's be really great, but I
wouldn't be disheartened if there wasn't.

I could also use a git url so I could download your archive, but maybe I'll spot
that at your main website somewhere.

Thanks for any pointers.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkh6L6MACgkQz62J6PPcoOm+tQCfe+ueMV+rUlEvC5jPTnhbhjlX
IhYAn1Y5B2xrG5xxTjjjOoE1fj8O0MFq
=ZZay
-END PGP SIGNATURE-
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Catching keyboard meessages/input to a GTK(sharp) textview widget

2008-07-15 Thread True_Friend

Hi
I am trying to create a custom widget based on gtk textview (the gtk#
bindings for C#). The purpose is to enable writing my local language Urdu in
textview instead of English. I am unable to find how can I hack the keyboard
input before it appears on screen (so I change the key values like a to ا
and b to ب etc). I am a beginner so plz suggest me it this regards.
Obviously I want to do it in c# (mono has Gdk.Keyboard, Gdk.Keymap and some
other such classes, but I am unable to figure out a way to get the pressed
key's value and change it before it is passed to textview buffer). At last
here is the example my friend done in system.windows.forms textbox.
__
using System;
using System.Drawing;
using System.Drawing.Design;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;


namespace UrduCtrl
{
enum KeyboardStates
{
kbNormal=0,
kbShift=1,
kbCtrl=2,
kbAltGr=3
}

public class UrduTextPropertyEditor: UITypeEditor
{
//  public override object EditValue( 
//  System.ComponentModel.ITypeDescriptorContext context, 
//  System.IServiceProvider provider, object value) 
//  { 
//  IWindowsFormsEditorService frmsvr =
(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
//  if(frmsvr == null)
//  return null;
//
//  UrduTextPropertyEditorDlg dlg= new 
UrduTextPropertyEditorDlg();
//  dlg.EditedText = (string) value;
//
//  //dlg.ShowDialog();
//  frmsvr.ShowDialog(dlg);
//
//  return (string) dlg.EditedText;
//  }

//  public override object EditValue(ITypeDescriptorContext context,
IServiceProvider provider, object value)
//  {
//  if (context!=null && provider!=null)
//  {
//  IWindowsFormsEditorService edSrv=
(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
//  if (edSrv!=null)
//  {
//  UrduTextPropertyEditorDlg dialog= new 
UrduTextPropertyEditorDlg();
//  if (value is String)
//  dialog.EditedText= 
(string)value;   
//  if 
(edSrv.ShowDialog(dialog)==System.Windows.Forms.DialogResult.OK)
//  value= dialog.EditedText;
//  dialog.Dispose();
//  dialog= null;
//  }
//  }
//  return value;
//  }

public override System.Drawing.Design.UITypeEditorEditStyle 

GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) 
{ 
// We will use a window for property editing. 
return UITypeEditorEditStyle.Modal; 
}

public override bool GetPaintValueSupported( 
System.ComponentModel.ITypeDescriptorContext context) 
{ 
// No special thumbnail will be shown for the grid. 
return false; 
} 
}

/// 
/// Summary description for Class1.
/// 

[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
Name="FullTrust")]
public class UrduTextBox: System.Windows.Forms.TextBox
{
private int WM_CHAR = 0x102;
private int WM_KEYDOWN = 0x100;
private int WM_KEYUP = 0x101;
private bool m_bIsUrdu;
private KeyboardStates kbState;
private Hashtable UrduPhonetic;
private char  charSingleQuote= Convert.ToChar(39);

public UrduTextBox()
{

this.Font = new System.Drawing.Font("Urdu Naskh 
Asiatype", 12F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
//this.TextAlign = 
System.Windows.Forms.HorizontalAlignment.Right;
this.m_bIsUrdu= true;
kbState= KeyboardStates.kbNormal;


UrduPhonetic= new Hashtable();
UrduPhonetic['a']=new Key(0x0627, 0x0622, 0x0623);

Re: Doing introspection on a GObject

2008-07-15 Thread Emmanuele Bassi
On Tue, 2008-07-08 at 13:02 +0200, Andreas Sliwka wrote:
> Greetings,
>   I'd like to query a Gobject for its properties. Browsing through the
> header files I found g_object_class_list_properties(), which takes a
> GObjectClass as first parameter. Now how do I get this GObjectClass
> from GObject? Is this possible at all

yes, of course:

  GParamSpec **pspecs;
  GObjectClass *object_class;
  gint n_pspecs;

  object_class = G_OBJECT_GET_CLASS (object_instance);

  pspecs = g_object_class_list_properties (object_class, &n_pspecs);
  for (i = 0; i < n_pspecs; i++)
{
  GParamSpec *pspec = pspecs[i];

  g_print ("Objects of type %s have the %s property\n",
   G_OBJECT_TYPE_NAME (some_instance),
   pspec->name);
}
  g_free (pspecs);

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

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


Re: g_main_loop

2008-07-15 Thread Ed James
Just a guess, but I'd try putting a function in Thread 1 that emits the
signal, but call
that function from Thread 2.  This way, Thread 2 controls when the signal is
emitted,
but the signal is still handled by Thread 1.  Never actually tried this
myself, though,
so I don't know for sure if one thread can call a function in another
thread.

Ed James

2008/7/15 HASWANI HARISH-VCKR47 <[EMAIL PROTECTED]>:

>  Hi All,
>
> I am a beginner to gtk APIs.
> My query is :
> - In Thread T1 I am calling g_main_loop()
> - In Thread T2 I am emitting a signal through
> g_signal_emit_by_name(G_OBJECT, signal-name);
>
> I saw that signal handler is running in Thread2 context. I want that it
> should run in Thread 1 context. How I can achieve this?
>
>
>
>
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


RE: Using g_signal_connect in class

2008-07-15 Thread Vallone, Anthony
Only if the member function is static.  Calling a non-static member
function requires two addresses: the instance address and the function
address.  Whether its public or private doesn't matter because access to
function pointers is not checked by compilers.  I frequently do
something like this:

class SomeClass
{
  ...
private:
  ...
  static void staticCb(..., gpointer inInstance) {
SomeClass* instance = (SomeClass*)inInstance;
instance->callback(...);
  }
  void callback(...) {
...
  }
  ...
  void someFunc() {
...
g_signal_connect(..., G_CALLBACK(&staticCb), this);
...
  }
  ...
};


-Anthony Vallone


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Marco Rocco
Sent: Tuesday, July 15, 2008 6:04 AM
To: gtk-list@gnome.org
Subject: Using g_signal_connect in class

Hello, this is my first post on this mailing list, now i do my request:
can i use g_signal_connect  in a method of my class, using as c_handler
a private function of class? ...and if i can, how i can do ?

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


Re: g_main_loop

2008-07-15 Thread Milosz Derezynski
A function is just a piece of code, so if you call a function in T1 from T2,
you still call it in the context of T2; the only thing really helping here
is having a maincontext in T1 and T2, and using a g_idle_add() *on* the
maincontext of T1 (but the code that adds it can be called from T2) so the
idle handler can call some code with the context of T1.

Am 15. Juli 2008 16:38 schrieb Ed James <[EMAIL PROTECTED]>:

> Just a guess, but I'd try putting a function in Thread 1 that emits the
> signal, but call
> that function from Thread 2.  This way, Thread 2 controls when the signal
> is emitted,
> but the signal is still handled by Thread 1.  Never actually tried this
> myself, though,
> so I don't know for sure if one thread can call a function in another
> thread.
>
> Ed James
>
> 2008/7/15 HASWANI HARISH-VCKR47 <[EMAIL PROTECTED]>:
>
>>  Hi All,
>>
>> I am a beginner to gtk APIs.
>> My query is :
>> - In Thread T1 I am calling g_main_loop()
>> - In Thread T2 I am emitting a signal through
>> g_signal_emit_by_name(G_OBJECT, signal-name);
>>
>> I saw that signal handler is running in Thread2 context. I want that it
>> should run in Thread 1 context. How I can achieve this?
>>
>>
>>
>>
>
> ___
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>


-- 

Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: why no save mode for gtk_file_chooser_button?

2008-07-15 Thread [EMAIL PROTECTED]

Does really nobody has an idea or opinion about that?
I see no reason for limiting the capabilities of the the FileChooserButton
in that way.
After all the programmer still has to be aware of what he is doing with
his widgets.

I have no clue about gtk+ development and so i am not really able to
estimate the
amount of work which is necessary to remove this restriction. It would be
great if
someone could point this out and maybe apply the needed changes.
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list