Ejemplo n.º 1
0
void
ghack_menu_window_display(GtkWidget *menuWin, gboolean blocking,
                          gpointer data)
{
    //if(blocking) {
        gnome_dialog_close_hides (GNOME_DIALOG (menuWin), TRUE);
	gnome_dialog_set_close (GNOME_DIALOG (menuWin), TRUE);
	gnome_dialog_run_and_close(GNOME_DIALOG (menuWin));
    //}
    //else {
        //gtk_widget_show(menuWin);
    //}
}
Ejemplo n.º 2
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_gnome_dialog_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gboolean auto_close, hide_on_close;

  gb_window_set_standard_properties (widget, data,
				     Title, Type, Position, Modal,
				     DefaultWidth, DefaultHeight,
				     Shrink, Grow, AutoShrink,
				     IconName, FocusOnMap,
				     Resizable, DestroyWithParent, Icon,
				     Role, TypeHint, SkipTaskbar,
				     SkipPager, Decorated, Gravity, Urgency);

  auto_close = gb_widget_input_bool (data, AutoClose);
  if (data->apply)
    gnome_dialog_set_close (GNOME_DIALOG (widget), auto_close);

  hide_on_close = gb_widget_input_bool (data, HideOnClose);
  if (data->apply)
    gnome_dialog_close_hides (GNOME_DIALOG (widget), hide_on_close);
}
Ejemplo n.º 3
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_gnome_message_box_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  GtkWidget *pixmap, *label;
  gchar *message, *type_name;
  gboolean auto_close, hide_on_close;

  get_message_box_widgets (widget, &pixmap, &label);
  g_return_if_fail (pixmap != NULL);
  g_return_if_fail (label != NULL);

  type_name = gb_widget_input_choice (data, MessageBoxType);
  if (data->apply)
    {
      set_message_box_type (widget, pixmap, type_name);
    }

  message = gb_widget_input_text (data, Message);
  if (data->apply)
    {
      gtk_label_set_text (GTK_LABEL (label), message);
    }
  if (data->action == GB_APPLYING)
    g_free (message);

  gb_window_set_standard_properties (widget, data,
				     Title, NULL, Position, Modal,
				     DefaultWidth, DefaultHeight,
				     Shrink, Grow, AutoShrink,
				     WMName, WMClass);

  auto_close = gb_widget_input_bool (data, AutoClose);
  if (data->apply)
    gnome_dialog_set_close (GNOME_DIALOG (widget), auto_close);

  hide_on_close = gb_widget_input_bool (data, HideOnClose);
  if (data->apply)
    gnome_dialog_close_hides (GNOME_DIALOG (widget), hide_on_close);
}
Ejemplo n.º 4
0
int ghack_yes_no_dialog( const char *question, 
		      const char *choices, int def)
{
    int i=0, ret;
    gchar button_name[BUFSZ];
    GtkWidget *box;
    GtkWidget* mainWnd=NULL;

    box = gnome_message_box_new ( question, GNOME_MESSAGE_BOX_QUESTION, NULL);
    /* add buttons for each choice */
    if (!strcmp(GNOME_STOCK_BUTTON_OK, choices)) {
	gnome_dialog_append_button ( GNOME_DIALOG(box), GNOME_STOCK_BUTTON_OK);
	gnome_dialog_set_default( GNOME_DIALOG(box), 0);
	gnome_dialog_set_accelerator( GNOME_DIALOG(box), 0, 'o', 0);
#if 0
	g_print("Setting accelerator '%c' for button %d\n", 'o', 0);
#endif
    }
    else {
	for( ; choices[i]!='\0'; i++) {
	    if (choices[i]=='y') {
		sprintf( button_name, GNOME_STOCK_BUTTON_YES);
	    }
	    else if (choices[i]=='n') {
		sprintf( button_name, GNOME_STOCK_BUTTON_NO);
	    }
	    else if (choices[i] == 'q') {
	        sprintf( button_name, "Quit");
	    } else {
		sprintf( button_name, "%c", choices[i]);
	    }
	    if (def==choices[i])
		gnome_dialog_set_default( GNOME_DIALOG(box), i);
	    gnome_dialog_append_button ( GNOME_DIALOG(box), button_name);
	    gnome_dialog_set_accelerator( GNOME_DIALOG(box), i, choices[i], 0);
#if 0
	    g_print("Setting accelerator '%c' for button %d\n", choices[i], i);
#endif
	}
    }
#if 0
    /* Perhaps add in a quit game button, like this... */
    gnome_dialog_append_button ( GNOME_DIALOG(box), GNOME_STOCK_BUTTON_CLOSE);
    gnome_dialog_set_accelerator( GNOME_DIALOG(box), i, choices[i], 0);
    g_print("Setting accelerator '%c' for button %d\n", 'Q', i);
#endif

    gnome_dialog_set_close(GNOME_DIALOG (box), TRUE);
    mainWnd = ghack_get_main_window ();
    gtk_window_set_modal( GTK_WINDOW(box), TRUE);
    gtk_window_set_title( GTK_WINDOW(box), "GnomeHack");
    if ( mainWnd != NULL ) {
	gnome_dialog_set_parent (GNOME_DIALOG (box), 
		GTK_WINDOW ( mainWnd) );
    }

    ret=gnome_dialog_run_and_close ( GNOME_DIALOG (box));
    
#if 0
    g_print("You selected button %d\n", ret);
#endif
    
    if (ret==-1)
	return( '\033');
    else
	return( choices[ret]);
}