Re: [gtk-list] How to invoke Xclient?
- From: "Shawn T . Amundson" <amundson gimp org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] How to invoke Xclient?
- Date: Fri, 18 Dec 1998 00:46:54 -0800
The function required by the "activate" signal is different
than that of system().
So, you do not want to invoke system() directly. You want to do
something like this: (I'm tired so this may not be 100% typed
correctly.)
void
sys_callback (GtkMenuItem *menuitem, gpointer data)
{
gchar *command;
command = (gchar*) data;
system(command);
}
gtk_signal_connect (GTK_OBJECT(menuitem), "activate",
GTK_SIGNAL_FUNC (sys_callback), (gpointer)"kterm &");
You can determine the correct prototype for a signal function by looking
at the widget's class. For menu item that is GtkMenuItemClass, which has:
void (* activate) (GtkMenuItem *menu_item);
(This is from gtkmenuitem.h.)
Append gpointer to that and you have the prototype.
-Shawn
On Fri, Dec 18, 1998 at 05:31:24PM +0900, Chowdhury Takdir Hossain wrote:
>
> Hello
>
> I am trying to launch a Xclient program from the menu item of my program but
> failing. The statement has the following shape.
>
> gtk_signal_connect(GTK_OBJECT(menuitem),"activate",(GtkSignalFunc)system,(gpointer)"kterm &");
>
> It can be compiled. But when I select the item and release it I get a message
> on my terminal saying that "sh::command not found"
>
> Is there any way in gtk+ to launch a Xclient program? Am I missing something
> in my code?
>
> Could anyone please help me in this regard.
>
> Regards,
>
> --Takdir
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
--
Shawn T. Amundson
amundson@gimp.org http://www.gimp.org/~amundson
"The assumption that the universe looks the same in every
direction is clearly not true in reality." - Stephen Hawking
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]