GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Aug 22, 2014 9:49 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How do I call a shell script from my Glade/GTK GUI?
PostPosted: Tue Jun 20, 2006 3:41 pm 
Offline

Joined: Tue Jun 20, 2006 3:39 pm
Posts: 1
I have some shell scrips that do HBA rescans and a bunch of other things. I built a GUI using Glade so that others would feel more comfortable running my scripts, but now I don't know how to call these scripts from my callbacks.c.

Any ideas?

I went through all the GTK commands and couldn't find anything.

_________________
http://www.ubertechnik.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 02, 2006 10:24 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
It's not GTK that's going to help you, but standard C functions (assuming your'e working in C). In the callback for a button click or whatever you want to launch your command, you can use popen:

Code:
        FILE *fp;
        gint exit_status;
        gchar *command = "/this/is/the/script";

        /* execute command */
        fp = popen(command, "r");
   if (fp == NULL)
   {
                g_print("Error running %s", command);
   }
        exit_status = pclose (fp);
        g_print("Script exited with status %d", exit_status);


That's just off the top of my head so you may have to dink around. Do a google search for popen for more information.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group