Link to home
Start Free TrialLog in
Avatar of rajneesh75
rajneesh75

asked on

gtk program using glade

Hello
    I am new to gtk programming  in c using glade.

 I have written a basic program which is as follows
/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

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

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)

 void on_cmdHello_clicked( GtkWidget *widget, gpointer data)
{
    g_print ("Hello World\n");
}

GtkWidget*
create_window1 (void)
{
  GtkWidget *window1;
  GtkWidget *vbox1;
  GtkWidget *hbox2;
  GtkWidget *txtHelloWorld;
  GtkWidget *hbox1;
  GtkWidget *cmdHello;

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window1), _("window1"));

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window1), vbox1);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, TRUE, TRUE, 0);

  txtHelloWorld = gtk_entry_new ();
  gtk_widget_show (txtHelloWorld);
  gtk_box_pack_start (GTK_BOX (hbox2), txtHelloWorld, TRUE, TRUE, 0);
  gtk_widget_set_size_request (txtHelloWorld, 158, 24);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);

  cmdHello = gtk_button_new_with_mnemonic (_("Hello World"));
  gtk_widget_show (cmdHello);
  gtk_box_pack_start (GTK_BOX (hbox1), cmdHello, FALSE, FALSE, 0);
  gtk_widget_set_size_request (cmdHello, 76, 26);

  g_signal_connect ((gpointer) cmdHello, "clicked",
                    G_CALLBACK (on_cmdHello_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window1, window1, "window1");
  GLADE_HOOKUP_OBJECT (window1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (window1, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (window1, txtHelloWorld, "txtHelloWorld");
  GLADE_HOOKUP_OBJECT (window1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (window1, cmdHello, "cmdHello");

  return window1;
}

on compiling it gives error  
interface.c:30: conflicting types for `on_cmdHello_clicked' at line 30

i cant under stand it. can anybody help
thanks in advance

ASKER CERTIFIED SOLUTION
Avatar of akshayxx
akshayxx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rajneesh75
rajneesh75

ASKER

thanks . I solved the problem by putting the code of  signal handler in callbacks.c file instead of interface.c

looking for support in future
thanks