question about dialog boxes



I've got a dialog box that pops up when the user clicks Help | About:

  void CreateAboutDialog(void)
  {
     GtkWidget *AboutWindow, *AboutLabel, *OkButton;
  
     AboutWindow = gtk_dialog_new();
     AboutLabel = gtk_label_new("blah");
     OkButton = gtk_button_new_with_label("OK");
  
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(AboutWindow)->vbox),
        AboutLabel, EXPAND, FILL, NO_SPACING);
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(AboutWindow)->action_area),
        OkButton, EXPAND, NO_FILL, NO_SPACING);
  
     gtk_signal_connect(GTK_OBJECT(OkButton), "clicked",
           GTK_SIGNAL_FUNC(dialog_callback_delete), AboutWindow);
  
     gtk_widget_show_all(AboutWindow);
  }
  

  
  gboolean dialog_callback_delete(GtkWidget *widget, GtkWidget *Dialog)
  {
     gtk_widget_destroy(Dialog);
     return TRUE;
  }


This works, even though I only slightly know what i'm doing.  The
problem is that this generates a compiler warning because GtkWidget
*widget is unused in dialog_callback_delete().

The thing is, I can't take "GtkWidget *widget" out of the function
parameter list because then Dialog refers to the button, rather than the
dialog window.  That causes just the button to disappear when you press
"Ok" rather than the whole dialog box.

What's the correct way of doing this so that gcc doesn't complain about
unused variables?

Thanks!
Pete

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D




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