title: How to get the text of a button in GTK?
body: <p>I am developing an application that has a numeric keypad and a text box when clicked on a button, text box shows the number.
  I need to write a function to each button? Or you can pass a text and a widget as parameter?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;gtk/gtk.h&gt;
  
  void callback( GtkWidget *widget,
                 gpointer   data )
  {
     gtk_entry_append_text(entry, text);
  }
  
  void create_button(GtkWidget* table,GtkWidget* entry,
                      int start_r,int end_r,
                      int start_c,int end_c,
                      char* label)
  {
      GtkWidget *button;
  
      button = gtk_button_new_with_label (label);
      g_object_set_data( G_OBJECT( button ),
                             "char", (gpointer)label );
      g_signal_connect (button, "clicked",
                G_CALLBACK (callback), entry);
  
      gtk_table_attach_defaults (GTK_TABLE(table), button, start_c, end_c, start_r, end_r);
  
      gtk_widget_show (button);
  
  }
  
  gint delete_event( GtkWidget *widget,
                     GdkEvent  *event,
                     gpointer   data )
  {
      gtk_main_quit ();
      return(FALSE);
  }
  
  int main(int argc,char* argv[]){
  
      GtkWidget *window;
      //GtkWidget *button;
      GtkWidget *table;
      GtkWidget *entry;
      //GtkWidget *label;
  
      gtk_init (&amp;argc, &amp;argv);
  
      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_title (GTK_WINDOW (window), "Armario");
      g_signal_connect (GTK_OBJECT (window), "delete_event",
                          G_CALLBACK (delete_event), NULL);
      gtk_container_set_border_width (GTK_CONTAINER (window), 20);
  
      table = gtk_table_new (2, 2, TRUE);
      gtk_container_add (GTK_CONTAINER (window), table);
  
      entry = gtk_entry_new();
      gtk_entry_set_max_length(GTK_ENTRY(entry),10);
      gtk_entry_set_placeholder_text(GTK_ENTRY(entry),"Teste");
      gtk_table_attach_defaults (GTK_TABLE(table), entry, 0, 2, 1, 2);
      gtk_widget_show(entry);
  
      create_button(table,entry,0,1,0,1,"Botao");
  
      gtk_widget_show (table);
      gtk_widget_show (window);
  
      gtk_main ();
  
      return 0;
  }
  </code></pre>