Newbie question



Hi Everyone...

Using Glade, im trying to make my first gtk application. It's a simple
frontend to the ping command. I've managed to get most of the data from
the form into my callback function by writing 'do_ping'.

My questions: 

1: How do I get the state of the togglebutton called 'route'?
2. Host is an 'entry-box'; count, wait, timeout, packet are spinbuttons;
output is a 'textbox'. This tell's me that GTK_WIDGET(button) in the
lookup_widget lines should be something else. Isn't that correct?


Help on this one would be appreaciated.


The application... as it is now:
http://www.musik.auc.dk/~schimkat/data/software/pingfe-0.1.tar.gz


Regards Soren Schimkat

-------------------------------------------------------------------------
Callback.c:


#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

extern GtkWidget * main_window;

void
do_ping                                (GtkButton       *button,
                                        gpointer         user_data)
{
   gchar * host, * countval, * waitval, * timeoutval, * packetval;
   gchar output[80], command[80], commandoutput[5000];
   FILE * ping;
   long int timeoutint;
   int outputint;
   int readcount;

   GtkWidget * hostname = lookup_widget (GTK_WIDGET(button), "host" );
   GtkWidget * count = lookup_widget (GTK_WIDGET(button), "count" );
   GtkWidget * wait = lookup_widget (GTK_WIDGET(button), "wait" );
   GtkWidget * timeout = lookup_widget (GTK_WIDGET(button), "timeout" );
   GtkWidget * packet = lookup_widget (GTK_WIDGET(button), "packet" );
   GtkWidget * outputwin = lookup_widget (GTK_WIDGET(button), "output"
);
   /* what about 'route'? */

   host = gtk_entry_get_text((GtkEntry *) hostname);
   countval = gtk_entry_get_text((GtkEntry *) count);
   waitval = gtk_entry_get_text((GtkEntry *) wait);
   timeoutval = gtk_entry_get_text((GtkEntry *) timeout);
   packetval = gtk_entry_get_text((GtkEntry *) packet);
   /* what about 'routestate'? */

   ...and so on....




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]