LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-15-2006, 05:35 AM   #1
rino.caldelli
Member
 
Registered: Apr 2005
Location: perugia
Distribution: ubuntu
Posts: 181

Rep: Reputation: 31
gtk simple interface help


I have this interface for a scanning software I'm devising... which doesn't work properly... it should have 2 tabs (which are shown when compiled) and two buttons for scanning and sniffing which are not shown.. any can help???

Code:
#include "stdio.h"
#include "netinet/ip.h"
#include "sys/socket.h"
#include "sys/types.h"
#include "errno.h"
#include "netinet/in.h"
#include "netinet/tcp.h"
#include "stdlib.h"
#include "unistd.h"
#include "signal.h"
#include "netdb.h"
#include "arpa/inet.h"
#define PORT 80
#define IP_SIZE sizeof(struct iphdr)
#define IP_TCP_SIZE sizeof(struct iphdr)+sizeof(struct tcphdr)
#define BIG 1024
#define MORE_BIG 4096
#define MAX_PORTS 65535
#include <gtk/gtk.h>
typedef unsigned short int u_16;

void sniff()
{
  int sockfd;
  
  struct Packet
  {
  struct iphdr iph;
  struct tcphdr tcph;
  } pkt;

  struct sockaddr_in serv;
  struct in_addr addr;

  if((sockfd=socket(AF_INET,SOCK_RAW,0x06))==-1)
    {
      perror("socket");
      exit(1);
    }
  int sz=sizeof(struct sockaddr_in);
  for(;;)
    {
      if(recvfrom(sockfd,&pkt,sizeof(pkt),0,(struct sockaddr*)&serv,&sz)==-1)
	{
	  perror("recvfrom");
	  exit(1);
	}
      printf("-=-=-Packet Captured-=-=-\n");
      addr.s_addr=pkt.iph.saddr;
      printf("Source IP:%s\n",inet_ntoa(addr));
      addr.s_addr=pkt.iph.daddr;
      printf("Destination IP:%s\n",inet_ntoa(addr));
      printf("Source Port:%d\n",ntohs(pkt.tcph.source));
      printf("Destination Port:%d\n",ntohs(pkt.tcph.dest));
      printf("TTL:%d\n",pkt.iph.ttl);
      printf("Packet Length:%d\n",pkt.iph.tot_len);
      printf("sequence:%d\n",ntohl(pkt.tcph.seq));
      printf("fin:%d\n",pkt.tcph.fin);
      printf("syn:%d\n",pkt.tcph.syn);
      printf("------------------------------------\n");

    }

}

char *
resolver(char *host_ip)
{
  struct in_addr ip;
  char* charip;
  if( (ip.s_addr = inet_addr(host_ip) )==-1)
  {
    struct hostent *h;
    if( (h=gethostbyname(host_ip) ) == NULL)
     {
      perror("gethostbyname");
      exit(-1);
     }
    charip=(char *)inet_ntoa(*((struct in_addr*)h->h_addr));   
   return charip;
   exit(1);  
   }
  return host_ip;
}

u_16 cksum(u_16 *addr,int len)
{

  register int sum=0;
  u_short answer=0;
  register u_short *w=addr;
  register int nleft=len;

  while(nleft>1)
    {
      sum+=*w++;
      nleft-=2;
    }
  if(nleft==1)
    {
      *(u_char*)&answer=*(u_char*)w;
      sum+=answer;
    }

  sum=(sum>>16)+(sum & 0xffff);
  sum+=(sum>>16);
  answer=~sum;
  return answer;

}

void 
scan_ports(char *target)
{

  struct sockaddr_in sin;
  struct servent *serv;

  int sockfd,i,status;

  for(i=0;i<MAX_PORTS;i++)
    {

      if((sockfd=socket(AF_INET,SOCK_STREAM,0))==-1)
	{
	  perror("socket");
	  exit(1);
	}
      sin.sin_addr.s_addr=inet_addr(target);
      sin.sin_family=AF_INET;
      bzero(&(sin.sin_zero),8);


      sin.sin_port=htons(i);

 status=(connect(sockfd,(struct sockaddr *)&sin,sizeof(struct sockaddr))==0);
 if(status==1)
   {
     serv=getservbyport(sin.sin_port,"tcp");
     if(serv==NULL)
       {
perror("getservbyport");
 break;
       }
     printf("port open:%d [ %s ]\n",i,serv->s_name);
   }

 close(sockfd);
    }
}

void
 rawsyn(char *target){
  int sockfd,optval;
  char load[IP_TCP_SIZE];
 
  struct sockaddr_in sin;
  struct iphdr *iph=(struct iphdr*)load;
  struct tcphdr *tcph=(struct tcphdr*)load+IP_SIZE;
 
 
   if((sockfd=socket(AF_INET,SOCK_RAW,0x06))==-1)
    {
      perror("socket");
      exit(1);
    }

  iph->ihl=5;
  iph->version=4;
  iph->tos=0;
  iph->tot_len=IP_TCP_SIZE;
  iph->id=htonl(31337); 
  iph->ttl=255;
  iph->protocol=0x06;
  iph->check=0;
  iph->saddr=inet_addr("11.12.13.14"); /*strange ip ;)  5p00f3d */
  iph->daddr=inet_addr(target);

  tcph->source=htons(rand()%65535);
  tcph->dest=htons(rand()%65535);
  tcph->seq=random();
  tcph->ack_seq=0;
  tcph->doff=0;
  tcph->syn=1;
  tcph->window=htonl(65535);
  tcph->check=0;
  tcph->urg_ptr=0;

  iph->check=cksum((u_16 *)load,IP_TCP_SIZE);
  tcph->check=cksum((u_16 *)load,IP_TCP_SIZE);

  sin.sin_addr.s_addr=iph->daddr;
  sin.sin_family=AF_INET;
  sin.sin_port=tcph->source;
 
  
  if(setsockopt(sockfd,IPPROTO_IP,IP_HDRINCL,&optval,sizeof(int))==-1)
    {
      perror("setsockopt");
      exit(1);
     }
   
   while(1)
{
 if(sendto(sockfd,load,IP_TCP_SIZE,0,(struct sockaddr*)&sin,sizeof(sin))==-1)
{
perror("sendto");
exit(-1);
}
 else
printf("-> ");
}  

}

void getRequests(char *target)
{
  int sockfd;
  struct sockaddr_in sin;
  char *x,y[BIG],z[MORE_BIG];
  int len;
  pid_t pid;

  if((pid=fork())<0)
    {
      perror("fork");
      exit(1);
    }
  else if(pid>0)
    {
    exit(1);
    }
  else if(pid==0)
    {

  if((sockfd=socket(AF_INET,SOCK_STREAM,0))==-1)
    {
      perror("socket");
      exit(1);
    }
  sin.sin_addr.s_addr=inet_addr(target);
  sin.sin_port=htons(PORT);
  sin.sin_family=AF_INET;
  bzero(&(sin.sin_zero),8);

  if(connect(sockfd,(struct sockaddr*)&sin,sizeof(struct sockaddr))==-1)
    {
      fprintf(stdout,"connection out...\n");
      exit(1);
    }
  x="GET / HTTP/1.1\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, deflate\r\nUser-Agent: %s\r\nHost: 127.0.0.1\r\nConnection: Keep-Alive";
  len = strlen(x);

  snprintf(y,len,x);

  if(send(sockfd,y,len,0)==-1)
    {
      perror("send");
      exit(1);
    }
  if(recv(sockfd,z,MORE_BIG,0)==-1)
    {
      perror("recv");
      exit(1);
    }
    }
}

/* Our new improved callback.  The data passed to this function
 * is printed to stdout. */
void callback1( GtkWidget *widget,
               gpointer   data )
{
    g_print ("scanning...\n");
    scan_ports("192.168.0.1");
}

void callback2( GtkWidget *widget,
               gpointer   data )
{
   printf("Capturing network traffic...\n");
   printf("warning: You might need to be root to do this\n");
   sniff();
}

/* another callback */
gint delete_event( GtkWidget *widget,
                   GdkEvent  *event,
                   gpointer   data )
{
    gtk_main_quit ();
    return FALSE;
}

int main( int   argc,
          char *argv[] )
{
    /* GtkWidget is the storage type for widgets */
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;
    GtkWidget *table;
    GtkWidget *notebook;
    GtkWidget *frame;
    GtkWidget *label;
    char bufferf[32];
    char bufferl[32];

    /* This is called in all GTK applications. Arguments are parsed
     * from the command line and are returned to the application. */
    gtk_init (&argc, &argv);

    /* Create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    /* This is a new call, which just sets the title of our
     * new window */
    gtk_window_set_title (GTK_WINDOW (window), "Net Attack Tool http://rinonapo.atspace.com");
    
    gtk_window_set_default_size (GTK_WINDOW (window), 440, 420);

    /* Here we just set a handler for delete_event that immediately
     * exits GTK. */
    g_signal_connect (G_OBJECT (window), "delete_event",
		      G_CALLBACK (delete_event), NULL);

    /* Sets the border width of the window. */
    gtk_container_set_border_width (GTK_CONTAINER (window), 140);
    
    table = gtk_table_new (3, 6, FALSE);
    gtk_container_add (GTK_CONTAINER (window), table);

    /* We create a box to pack widgets into.  This is described in detail
     * in the "packing" section. The box is not really visible, it
     * is just used as a tool to arrange widgets. */
    box1 = gtk_hbox_new (FALSE, 0);

    /* Put the box into the main window. */
    gtk_container_add (GTK_CONTAINER (window), box1);
    
//TABS
        /* Create a new notebook, place the position of the tabs */
    notebook = gtk_notebook_new ();
    gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
    gtk_table_attach_defaults (GTK_TABLE (table), notebook, 0, 6, 0, 1);
    gtk_widget_show (notebook);
    
    /* Let's append a bunch of pages to the notebook */
	sprintf(bufferf, "Append Frame %d", 1);
	sprintf(bufferl, "Tool %d", 1);
	
	frame = gtk_frame_new (bufferf);
	gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
	gtk_widget_set_size_request (frame, 500, 100);
	gtk_widget_show (frame);
	
	label = gtk_label_new (bufferf);
	gtk_container_add (GTK_CONTAINER (frame), label);
	gtk_widget_show (label);
	
	label = gtk_label_new (bufferl);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
      
   
    /* Now finally let's prepend pages to the notebook */
    {
	sprintf (bufferf, "rinonapo nettools");
	sprintf (bufferl, "Start %d", 1);
	
	frame = gtk_frame_new (bufferf);
	gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
	gtk_widget_set_size_request (frame, 500, 100);
	gtk_widget_show (frame);
	
	label = gtk_label_new (bufferf);
	gtk_container_add (GTK_CONTAINER (frame), label);
	gtk_widget_show (label);
	
	label = gtk_label_new (bufferl);
	gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), frame, label);
    }

    /* Create a bunch of buttons */
    button = gtk_button_new_with_label ("close");
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
			      G_CALLBACK (delete_event), NULL);
    gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2);
    gtk_widget_show (button);
    
    button = gtk_button_new_with_label ("prev tool");
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
			      G_CALLBACK (gtk_notebook_prev_page),
			      G_OBJECT (notebook));
    gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 1, 2);
    gtk_widget_show (button);
    
    button = gtk_button_new_with_label ("next tool");
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
			      G_CALLBACK (gtk_notebook_next_page),
			      G_OBJECT (notebook));
    gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 1, 2);
    
//BUTTON 1
    /* Creates a new button with the label */
    button = gtk_button_new_with_label ("scan host");
    
    /* Now when the button is clicked, we call the "callback" function
     * with a pointer to "button 1" as its argument */
    g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (callback1), (gpointer) "function 1");

    /* Instead of gtk_container_add, we pack this button into the invisible
     * box, which has been packed into the window. */
    gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0);
    

    /* Always remember this step, this tells GTK that our preparation for
     * this button is complete, and it can now be displayed. */
    gtk_widget_show (button);
//BUTTON 2
    /* Do these same steps again to create a second button */
    button = gtk_button_new_with_label ("Sniffer");

    /* Call the same callback function with a different argument,
     * passing a pointer to "button 2" instead. */
    g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (callback2), (gpointer) "function 2");

    gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);

    /* The order in which we show the buttons is not really important, but I
     * recommend showing the window last, so it all pops up at once. */
    
    gtk_widget_show (button);

    gtk_widget_show (box1);
    
    gtk_widget_show (table);
    
    gtk_widget_show (window);
    
    /* Rest in gtk_main and wait for the fun to begin! */
    gtk_main ();

    return 0;
}
Makefile

Code:
CC = gcc

CFLAGS = -Wall			 	\
	-DG_DISABLE_DEPRECATED 	 	\
	-DGDK_DISABLE_DEPRECATED 	\
	-DGDK_PIXBUF_DISABLE_DEPRECATED \
	-DGTK_DISABLE_DEPRECATED

helloworld2: nettool.c 
	$(CC) nettool.c -o nettool $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`

clean: 
	rm -f *.o nettool
	rm -f *.c~
	rm -f Makefile~
 
Old 01-15-2006, 08:36 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you really shouldn't quote headers, du <stdio.h> or <stdio> notation instead, much safer.

as for what's wrong.. no idea as i'm not prepared to sift through all that code, but change the gtk_widget_show()'s to a single gtk_widget_showall(GtkWindow *) instead, and it may well appear
 
Old 01-15-2006, 08:37 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
please also note that gtk is an obselete library, you should not be learning it now, use gtk2 instead.
 
Old 01-15-2006, 09:47 AM   #4
rino.caldelli
Member
 
Registered: Apr 2005
Location: perugia
Distribution: ubuntu
Posts: 181

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by acid_kewpie
please also note that gtk is an obselete library, you should not be learning it now, use gtk2 instead.
Actually I'm using Gtk2.. and the quotes are used as standard in all gtk2 code... just copied it from the examples so it should be fine...

For what regards the code you don't need to sift through all the code, I left it all just to make it compile properly... you should skip all the functions and check only the main() which really contains the graphical interface
 
Old 01-15-2006, 09:48 AM   #5
rino.caldelli
Member
 
Registered: Apr 2005
Location: perugia
Distribution: ubuntu
Posts: 181

Original Poster
Rep: Reputation: 31
the code which matters really is
Code:
/* Our new improved callback.  The data passed to this function
 * is printed to stdout. */
void callback1( GtkWidget *widget,
               gpointer   data )
{
    g_print ("scanning...\n");
    scan_ports("192.168.0.1");
}

void callback2( GtkWidget *widget,
               gpointer   data )
{
   printf("Capturing network traffic...\n");
   printf("warning: You might need to be root to do this\n");
   sniff();
}

/* another callback */
gint delete_event( GtkWidget *widget,
                   GdkEvent  *event,
                   gpointer   data )
{
    gtk_main_quit ();
    return FALSE;
}

int main( int   argc,
          char *argv[] )
{
    /* GtkWidget is the storage type for widgets */
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;
    GtkWidget *table;
    GtkWidget *notebook;
    GtkWidget *frame;
    GtkWidget *label;
    char bufferf[32];
    char bufferl[32];

    /* This is called in all GTK applications. Arguments are parsed
     * from the command line and are returned to the application. */
    gtk_init (&argc, &argv);

    /* Create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    /* This is a new call, which just sets the title of our
     * new window */
    gtk_window_set_title (GTK_WINDOW (window), "Net Attack Tool http://rinonapo.atspace.com");
    
    gtk_window_set_default_size (GTK_WINDOW (window), 440, 420);

    /* Here we just set a handler for delete_event that immediately
     * exits GTK. */
    g_signal_connect (G_OBJECT (window), "delete_event",
		      G_CALLBACK (delete_event), NULL);

    /* Sets the border width of the window. */
    gtk_container_set_border_width (GTK_CONTAINER (window), 140);
    
    table = gtk_table_new (3, 6, FALSE);
    gtk_container_add (GTK_CONTAINER (window), table);

    /* We create a box to pack widgets into.  This is described in detail
     * in the "packing" section. The box is not really visible, it
     * is just used as a tool to arrange widgets. */
    box1 = gtk_hbox_new (FALSE, 0);

    /* Put the box into the main window. */
    gtk_container_add (GTK_CONTAINER (window), box1);
    
//TABS
        /* Create a new notebook, place the position of the tabs */
    notebook = gtk_notebook_new ();
    gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
    gtk_table_attach_defaults (GTK_TABLE (table), notebook, 0, 6, 0, 1);
    gtk_widget_show (notebook);
    
    /* Let's append a bunch of pages to the notebook */
	sprintf(bufferf, "Append Frame %d", 1);
	sprintf(bufferl, "Tool %d", 1);
	
	frame = gtk_frame_new (bufferf);
	gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
	gtk_widget_set_size_request (frame, 500, 100);
	gtk_widget_show (frame);
	
	label = gtk_label_new (bufferf);
	gtk_container_add (GTK_CONTAINER (frame), label);
	gtk_widget_show (label);
	
	label = gtk_label_new (bufferl);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
      
   
    /* Now finally let's prepend pages to the notebook */
    {
	sprintf (bufferf, "rinonapo nettools");
	sprintf (bufferl, "Start %d", 1);
	
	frame = gtk_frame_new (bufferf);
	gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
	gtk_widget_set_size_request (frame, 500, 100);
	gtk_widget_show (frame);
	
	label = gtk_label_new (bufferf);
	gtk_container_add (GTK_CONTAINER (frame), label);
	gtk_widget_show (label);
	
	label = gtk_label_new (bufferl);
	gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), frame, label);
    }

    /* Create a bunch of buttons */
    button = gtk_button_new_with_label ("close");
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
			      G_CALLBACK (delete_event), NULL);
    gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2);
    gtk_widget_show (button);
    
    button = gtk_button_new_with_label ("prev tool");
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
			      G_CALLBACK (gtk_notebook_prev_page),
			      G_OBJECT (notebook));
    gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 1, 2);
    gtk_widget_show (button);
    
    button = gtk_button_new_with_label ("next tool");
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
			      G_CALLBACK (gtk_notebook_next_page),
			      G_OBJECT (notebook));
    gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 1, 2);
    
//BUTTON 1
    /* Creates a new button with the label */
    button = gtk_button_new_with_label ("scan host");
    
    /* Now when the button is clicked, we call the "callback" function
     * with a pointer to "button 1" as its argument */
    g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (callback1), (gpointer) "function 1");

    /* Instead of gtk_container_add, we pack this button into the invisible
     * box, which has been packed into the window. */
    gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0);
    

    /* Always remember this step, this tells GTK that our preparation for
     * this button is complete, and it can now be displayed. */
    gtk_widget_show (button);
//BUTTON 2
    /* Do these same steps again to create a second button */
    button = gtk_button_new_with_label ("Sniffer");

    /* Call the same callback function with a different argument,
     * passing a pointer to "button 2" instead. */
    g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (callback2), (gpointer) "function 2");

    gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);

    /* The order in which we show the buttons is not really important, but I
     * recommend showing the window last, so it all pops up at once. */
    
    gtk_widget_show (button);

    gtk_widget_show (box1);
    
    gtk_widget_show (table);
    
    gtk_widget_show (window);
    
    /* Rest in gtk_main and wait for the fun to begin! */
    gtk_main ();

    return 0;
}
plus the include headers obviously
 
Old 01-15-2006, 11:01 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
that is gtk2? sorry, it's been that long since i coded any gtk2 in c!

like i said originally though, do try a gtk_widget_showall(window), as IF the code compiles, it must surely be there, just invisible.
 
Old 01-16-2006, 05:04 AM   #7
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
Quote:
and the quotes are used as standard in all gtk2 code... just copied it from the examples so it should be fine...
#include <stdio.h> includes a system header from /usr/include
#include "foo.h" includes a local header from the current working directory
gcc seems to find the system headers even if you use quotes, but that is non-standard and may not work with other compilers.

Quote:
but change the gtk_widget_show()'s to a single gtk_widget_showall(GtkWindow *) instead, and it may well appear
It is gtk_widget_show_all(), with an underscore between "show" and "all". Using it is a good idea, because it makes the code shorter and avoids stupid "forgot gtk_widget_show()" errors when you add new widgets to the GUI.


Code:
    table = gtk_table_new (3, 6, FALSE);
    gtk_container_add (GTK_CONTAINER (window), table);

    /* We create a box to pack widgets into.  This is described in detail
     * in the "packing" section. The box is not really visible, it
     * is just used as a tool to arrange widgets. */
    box1 = gtk_hbox_new (FALSE, 0);

    /* Put the box into the main window. */
    gtk_container_add (GTK_CONTAINER (window), box1);
The problem is here. You are adding two widgets into a GtkWindow, which can only contain one. You need to pack them into another box and add that to the window.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GTK+(GLADE interface designer) santhosh.linux Programming 3 01-02-2006 12:42 PM
Looking for simple GTK+ animation examples! paulsm4 Programming 2 08-11-2005 03:26 PM
GTK+ 2.0 and Mobile user interface hk_michael Programming 0 01-04-2005 02:17 AM
glade/gtk tutorials for firewall interface Fatz Linux - Security 1 08-08-2004 01:17 AM
is there a simple interface to install abd_bela Debian 5 09-08-2003 12:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration