static void game_preferences_callback (GtkWidget *widget, void *data) { GtkWidget *menu, *omenu, *l, *hb, *cb, *f, *fv; GtkWidget *button; if (pref_dialog) return; pref_dialog = gnome_dialog_new (_("Preferences"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); gnome_dialog_set_parent (GNOME_DIALOG (pref_dialog), GTK_WINDOW (app)); gtk_signal_connect (GTK_OBJECT(pref_dialog), "delete_event", GTK_SIGNAL_FUNC (cancel), NULL); omenu = gtk_option_menu_new (); menu = gtk_menu_new (); fill_menu (menu); gtk_widget_show (omenu); gtk_option_menu_set_menu (GTK_OPTION_MENU(omenu), menu); f = gtk_frame_new (_ ("Scenario")); gtk_container_border_width (GTK_CONTAINER (f), 5); hb = gtk_hbox_new (FALSE, FALSE); gtk_widget_show (hb); l = gtk_label_new (_("Select scenario:")); gtk_widget_show (l); gtk_box_pack_start_defaults (GTK_BOX(hb), l); gtk_box_pack_start_defaults (GTK_BOX(hb), omenu); cb = gtk_check_button_new_with_label ( _("Make it the default scenario") ); gtk_signal_connect (GTK_OBJECT(cb), "clicked", (GtkSignalFunc)set_selection_def, NULL); gtk_widget_show (cb); fv = gtk_vbox_new (0, 5); gtk_container_border_width (GTK_CONTAINER (fv), 5); gtk_widget_show (fv); gtk_box_pack_start_defaults (GTK_BOX(fv), hb); gtk_box_pack_start_defaults (GTK_BOX(fv), cb); gtk_box_pack_start_defaults (GTK_BOX(GNOME_DIALOG(pref_dialog)->vbox), f); gtk_container_add (GTK_CONTAINER (f), fv); gtk_widget_show (f); gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 0, GTK_SIGNAL_FUNC (load_scenario_callback), NULL); gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 1, GTK_SIGNAL_FUNC (cancel), (gpointer)1); gtk_widget_show (pref_dialog); }
static gboolean gui_ask_password (Account *account) { GtkWidget *table; GtkWidget *label; GtkWidget *vbox; char *buf; password_go = FALSE; password_gbool = TRUE; password_window = gnome_dialog_new (_("Incorrect Password"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); vbox = GNOME_DIALOG (password_window)->vbox; buf = g_strdup_printf (_("The password of the account %s is wrong"), account->acc_name); label = gtk_label_new (buf); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); c2_free (buf); table = gtk_table_new (2, 2, FALSE); gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); gtk_widget_show (table); label = gtk_label_new (_("Username:"******"Password:"******"Y"); gnome_dialog_button_connect (GNOME_DIALOG (password_window), 1, GTK_SIGNAL_FUNC (password_cb), (gpointer) "N"); gdk_threads_leave (); while (!password_go) usleep (500); if (!password_gbool) return FALSE; buf = gtk_entry_get_text (GTK_ENTRY (password_entry)); gdk_threads_enter (); if (!buf) return FALSE; c2_free (account->protocol.pop.pass); account->protocol.pop.pass = g_strdup (buf); gtk_widget_destroy (password_window); return TRUE; }
GtkWidget * c2_transfer_list_new (C2Application *application) { C2TransferList *tl; GtkWidget *button, *vbox; const gchar *buttons[] = { N_("Stop all"), GNOME_STOCK_BUTTON_CLOSE, NULL }; tl = gtk_type_new (c2_transfer_list_get_type ()); GTK_BOX (GNOME_DIALOG (tl)->vbox)->spacing = 0; vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (tl)->vbox), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); tl->vbox = vbox; button = gtk_check_button_new_with_label (_("Close when finished.")); gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, TRUE, 0); gtk_widget_show (button); tl->close = button; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), c2_preferences_get_widget_transfer_list_autoclose ()); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (on_close_button_toggled), NULL); c2_dialog_construct (C2_DIALOG (tl), application, _("Send & Receive"), C2_WIDGET_TRANSFER_LIST_TYPE, PKGDATADIR "/pixmaps/send-receive.png", buttons); gnome_dialog_button_connect (GNOME_DIALOG (tl), 0, on_button0_clicked, tl); gnome_dialog_button_connect (GNOME_DIALOG (tl), 1, on_button1_clicked, tl); gtk_signal_connect (GTK_OBJECT (tl), "destroy", GTK_SIGNAL_FUNC (destroy), NULL); return GTK_WIDGET (tl); }
GtkWidget * plugin_fortune_configure (C2DynamicModule *module) { GtkWidget *hbox; GtkWidget *label; window = gnome_dialog_new ("Configuration", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); hbox = gtk_hbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (window)->vbox), hbox, FALSE, TRUE, 0); gtk_widget_show (hbox); label = gtk_label_new ("Command:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); gtk_widget_show (entry); gtk_entry_set_text (GTK_ENTRY (entry), cmnd); label = gtk_label_new ("You can use the commands just like in the terminal.\n" "\n" "i.e. signature; cat $HOME/.signature"); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (window)->vbox), label, TRUE, TRUE, 0); gtk_widget_show (label); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gnome_dialog_button_connect (GNOME_DIALOG (window), 0, GTK_SIGNAL_FUNC (on_plugin_fortune_configure_ok_btn_clicked), NULL); gnome_dialog_button_connect (GNOME_DIALOG (window), 1, GTK_SIGNAL_FUNC (on_plugin_fortune_configure_cancel_btn_clicked), NULL); gtk_widget_show (window); return window; }
static gboolean gui_message_big_new (const char *from, const char *subject, const char *date, const char *account, const char *kbytes) { GtkWidget *vbox, *hbox; GtkWidget *table; GtkWidget *label; GtkWidget *hsep; GtkStyle *style1; GtkStyle *style2; char *buf; GtkWidget *xpm; go = FALSE; gbool = TRUE; window = gnome_dialog_new (_("Confirm message downloading"), GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL); gtk_window_set_modal (GTK_WINDOW (window), TRUE); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (WMain->window)); gnome_dialog_set_default (GNOME_DIALOG (window), 0); vbox = GNOME_DIALOG (window)->vbox; label = gtk_label_new (_("There's a message bigger than what you allowed to automatically download.")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); table = gtk_table_new (5, 2, FALSE); gtk_widget_show (table); gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_table_set_col_spacings (GTK_TABLE (table), 2); if (from && subject && date) { label = gtk_label_new (_("From:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1"); gtk_widget_set_style (label, style2); label = gtk_label_new (from); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1"); gtk_widget_set_style (label, style2); label = gtk_label_new (_("Date:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1"); gtk_widget_set_style (label, style2); label = gtk_label_new (date); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1"); gtk_widget_set_style (label, style2); } else { label = gtk_label_new (_("Since the server doesn't support advanced POP commands very little information about this message could be extracted.")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); } label = gtk_label_new (_("Account:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1"); gtk_widget_set_style (label, style2); if (from && subject && date) { label = gtk_label_new (_("Subject:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1"); gtk_widget_set_style (label, style2); label = gtk_label_new (subject); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1"); gtk_widget_set_style (label, style2); } label = gtk_label_new (_("Size:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1"); gtk_widget_set_style (label, style2); buf = g_strdup_printf ("%s (%d Kb)", kbytes, atoi (kbytes)/1024); label = gtk_label_new (buf); c2_free (buf); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1"); gtk_widget_set_style (label, style2); label= gtk_label_new (account); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5); style1 = gtk_widget_get_style (label); style2 = gtk_style_copy (style1); style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1"); gtk_widget_set_style (label, style2); hsep = gtk_hseparator_new (); gtk_widget_show (hsep); gtk_box_pack_start (GTK_BOX (vbox), hsep, FALSE, TRUE, 0); hbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); buf = gnome_unconditional_pixmap_file("gnome-question.png"); if (buf) { xpm = gnome_pixmap_new_from_file(buf); c2_free(buf); gtk_widget_show (xpm); gtk_box_pack_start (GTK_BOX (hbox), xpm, FALSE, FALSE, 0); } label = gtk_label_new (_("Do you want to download it?")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gnome_dialog_button_connect (GNOME_DIALOG (window), 0, GTK_SIGNAL_FUNC (cb), (gpointer) "Y"); gnome_dialog_set_accelerator (GNOME_DIALOG (window), 0, GDK_Y, 0); gnome_dialog_button_connect (GNOME_DIALOG (window), 1, GTK_SIGNAL_FUNC (cb), (gpointer) "N"); gnome_dialog_set_accelerator (GNOME_DIALOG (window), 1, GDK_N, 0); gtk_widget_show (window); gdk_threads_leave (); while (!go) usleep (500); gdk_threads_enter (); return gbool; }
/* window that shows armies to move in a regroup */ void reagrupe_window( int src, int dst, int cant ) { GtkWidget *label; GtkWidget *table; GtkWidget *frame; GtkWidget *vbox_dia,*vbox; GtkWidget *hbox; GtkAdjustment *adj; char buf[200]; reagrupe_src = src; reagrupe_dst = dst; if( reagrupe_dialog != NULL ) { gdk_window_show( reagrupe_dialog->window); gdk_window_raise( reagrupe_dialog->window); return ; } reagrupe_cant = 0; // reagrupe_dialog = gnome_dialog_new(_("Regrouping armies"),GNOME_STOCK_BUTTON_OK,NULL); reagrupe_dialog = teg_dialog_new(_("Regrouping armies"),_("Regroup your armies")); // Make the dialog modal (=main window is deactivated while the dialog is open) to fix // bug [689687]: Error, unexpected error in reagrupe_click(). gtk_window_set_modal( GTK_WINDOW( reagrupe_dialog ), TRUE ); gnome_dialog_append_button(GNOME_DIALOG(reagrupe_dialog), GNOME_STOCK_BUTTON_OK); gnome_dialog_set_parent (GNOME_DIALOG (reagrupe_dialog), GTK_WINDOW (main_window)); gtk_signal_connect (GTK_OBJECT (reagrupe_dialog), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &reagrupe_dialog); // When ok gets pressed, call reagrupe_ok_cb(). gnome_dialog_button_connect(GNOME_DIALOG(reagrupe_dialog), 0, GTK_SIGNAL_FUNC(reagrupe_ok_cb), NULL); vbox_dia = GNOME_DIALOG(reagrupe_dialog)->vbox; table = gtk_table_new (2, 2, FALSE); gtk_container_border_width (GTK_CONTAINER (table), GNOME_PAD); gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD); gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD); gtk_box_pack_start( GTK_BOX( vbox_dia), table, TRUE, TRUE, 0); frame = gtk_frame_new (_("Regrouping")); gtk_container_border_width (GTK_CONTAINER (frame), 0); vbox = gtk_vbox_new (TRUE, 0); gtk_container_border_width (GTK_CONTAINER (vbox), GNOME_PAD); snprintf(buf, sizeof(buf) -1, _("Moving armies from '%s' to '%s'\n"), countries_get_name(src), countries_get_name(dst) ); buf[ sizeof(buf) -1 ] = 0; label = gtk_label_new(buf); gtk_box_pack_start( GTK_BOX( vbox), label, TRUE, TRUE, 0); hbox = gtk_hbox_new( FALSE, 0); gtk_container_add( GTK_CONTAINER( vbox ), hbox ); label = gtk_label_new(_("Armies to move")); gtk_box_pack_start( GTK_BOX( hbox), label, TRUE, TRUE, 0); adj = (GtkAdjustment *) gtk_adjustment_new( (gfloat) cant, 0.0, (gfloat) (cant + 1), 1.0, 1.0, 1.0 ); reagrupe_hscale_cant = gtk_hscale_new( adj); gtk_box_pack_start( GTK_BOX( hbox), reagrupe_hscale_cant, TRUE, TRUE, 0); gtk_scale_set_digits(GTK_SCALE(reagrupe_hscale_cant), 0); gtk_scale_set_draw_value(GTK_SCALE(reagrupe_hscale_cant),1); /* gtk_range_draw_trough(GTK_RANGE(reagrupe_hscale_cant)); */ snprintf(buf, sizeof(buf) -1,_("[Note: You can regroup as many times as you want,\nas long as you don't regroup an army that was\nregrouped before in this turn.]")); buf[ sizeof(buf) -1 ] = 0; label = gtk_label_new(buf); gtk_box_pack_start( GTK_BOX( vbox), label, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_table_attach (GTK_TABLE (table), frame, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); if (!GTK_WIDGET_VISIBLE (reagrupe_dialog)) gtk_widget_show_all (reagrupe_dialog); else gtk_widget_destroy (reagrupe_dialog); }
/* shows how many armies you can move after an attack */ void tropas_window( int src, int dst, int cant ) { GtkWidget *label; GtkWidget *table; GtkWidget *frame; GtkWidget *vbox_dia,*vbox; GtkWidget *hbox; GtkAdjustment *adj; char buf[200]; tropas_src = src; tropas_dst = dst; if( tropas_dialog != NULL ) { gdk_window_show( tropas_dialog->window); gdk_window_raise( tropas_dialog->window); return ; } tropas_cant = 0; // tropas_dialog = gnome_dialog_new(_("A country was conquered"),GNOME_STOCK_BUTTON_OK,NULL); tropas_dialog = teg_dialog_new(_("A country was conquered"),_("A country was conquered")); gnome_dialog_append_button( GNOME_DIALOG(tropas_dialog),GNOME_STOCK_BUTTON_OK); gnome_dialog_set_parent (GNOME_DIALOG (tropas_dialog), GTK_WINDOW (main_window)); gtk_signal_connect (GTK_OBJECT (tropas_dialog), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &tropas_dialog); if( cant > 0 ) gnome_dialog_button_connect(GNOME_DIALOG(tropas_dialog), 0, GTK_SIGNAL_FUNC(tropas_ok_cb), NULL); else gnome_dialog_button_connect(GNOME_DIALOG(tropas_dialog), 0, GTK_SIGNAL_FUNC(tropas_close_cb), NULL); vbox_dia = GNOME_DIALOG(tropas_dialog)->vbox; table = gtk_table_new (2, 2, FALSE); gtk_container_border_width (GTK_CONTAINER (table), GNOME_PAD); gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD); gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD); gtk_box_pack_start( GTK_BOX( vbox_dia), table, TRUE, TRUE, 0); frame = gtk_frame_new (_("A new country")); gtk_container_border_width (GTK_CONTAINER (frame), 0); vbox = gtk_vbox_new (TRUE, 0); gtk_container_border_width (GTK_CONTAINER (vbox), GNOME_PAD); snprintf(buf,sizeof(buf)-1,_("You conquered '%s' in your attack from '%s'!!\n"), countries_get_name(dst), countries_get_name(src) ); buf[ sizeof(buf) -1 ] = 0; label = gtk_label_new(buf); gtk_box_pack_start( GTK_BOX( vbox), label, TRUE, TRUE, 0); if( cant > 0) { hbox = gtk_hbox_new( FALSE, 0); gtk_container_add( GTK_CONTAINER( vbox ), hbox ); label = gtk_label_new(_("Armies to move")); gtk_box_pack_start( GTK_BOX( hbox), label, TRUE, TRUE, 0); adj = (GtkAdjustment *) gtk_adjustment_new( (gfloat) cant, 0.0, (gfloat) (cant + 1), 1.0, 1.0, 1.0 ); // tropas_spinner_cant = gtk_spin_button_new( adj, 0.0, 0); tropas_hscale_cant = gtk_hscale_new( adj); gtk_box_pack_start( GTK_BOX( hbox), tropas_hscale_cant, TRUE, TRUE, 0); gtk_scale_set_digits(GTK_SCALE(tropas_hscale_cant), 0); gtk_scale_set_draw_value(GTK_SCALE(tropas_hscale_cant),1); /* gtk_range_draw_trough(GTK_RANGE(tropas_hscale_cant)); */ snprintf(buf, sizeof(buf) -1, _("[Note: The server moved 1 army to '%s' for you.\nChoose how many more armies you want to move]"), countries_get_name(dst) ); buf[ sizeof(buf) -1 ] = 0; label = gtk_label_new(buf); gtk_box_pack_start( GTK_BOX( vbox), label, TRUE, TRUE, 0); } gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_table_attach (GTK_TABLE (table), frame, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); if (!GTK_WIDGET_VISIBLE (tropas_dialog)) gtk_widget_show_all (tropas_dialog); else gtk_widget_destroy (tropas_dialog); }