GtkWidget* create_Xgcom (struct xcomdata *xcomdata) { GtkWidget *main_window; GdkPixbuf *Xgcom_icon_pixbuf; GtkWidget *main_vbox; /*-------------------------main_menubar---------------------*/ GtkWidget *main_menubar; /*-------------------------body_hbox------------------------*/ GtkWidget *body_hbox; GtkWidget *left_vbox; /*------------------------right_vbox-------------------------*/ GtkWidget *right_vbox; /*------------------------foot_hbox--------------------------*/ GtkWidget *foot_hbox; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new (); main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); //gtk_widget_set_size_request (main_window, 600, 700); GTK_WIDGET_SET_FLAGS (main_window, GTK_CAN_FOCUS); GTK_WIDGET_SET_FLAGS (main_window, GTK_CAN_DEFAULT); gtk_window_set_title (GTK_WINDOW (main_window), _("XGCom (Xiyou-Linux-Group)")); //gtk_window_set_default_size (GTK_WINDOW (main_window), 600, 700); gtk_window_set_destroy_with_parent (GTK_WINDOW (main_window), TRUE); gtk_window_set_position (GTK_WINDOW (main_window), GTK_WIN_POS_CENTER); Xgcom_icon_pixbuf = create_pixbuf ("xgcom.png"); if (Xgcom_icon_pixbuf){ gtk_window_set_icon (GTK_WINDOW (main_window), Xgcom_icon_pixbuf); gdk_pixbuf_unref (Xgcom_icon_pixbuf); } main_vbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (main_vbox); gtk_container_add (GTK_CONTAINER (main_window), main_vbox); /*------------------------main_menubar-----------------------*/ main_menubar = create_menu(main_window, main_vbox, accel_group, xcomdata); /*------------------------body_hbox--------------------------*/ body_hbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (body_hbox); gtk_box_pack_start (GTK_BOX (main_vbox), body_hbox, TRUE, TRUE, 0); /*-------------------------create_leftvbox-------------------*/ left_vbox = create_leftvbox(main_window, body_hbox, accel_group, xcomdata); /*-------------------------create_rightvbox------------------*/ right_vbox = create_rightvbox(main_window, body_hbox, accel_group, xcomdata); /*-------------------------create_foot-----------------------*/ foot_hbox = create_foot(main_window, main_vbox, xcomdata); g_signal_connect ((gpointer) main_window, "delete_event", G_CALLBACK (on_Xgcom_delete_event), NULL); gtk_widget_grab_focus (main_window); gtk_widget_grab_default (main_window); gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group); xcomdata->gmain = main_window; debug_p("baud: %d \n", xcomdata->comcfg.baud); return main_window; }
int main(int argc, char *argv[]) { gnome_init(VERSION, VERSION, argc, argv); /* Set up to draw from card class */ GtkWidget *vbox, *vbox1, *vbox2, *vbox3; GtkWidget *tbar; GtkWidget *setbutton, *nosetbutton; GdkColor white, black, blue; /* Done setting up */ window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Set Game"); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE); gtk_container_border_width(GTK_CONTAINER(window), 0); vbox= gtk_vbox_new(FALSE, 0); vbox1 = gtk_vbox_new(FALSE, 0); vbox2 = gtk_vbox_new(FALSE, 0); vbox3 = gtk_vbox_new(FALSE, 0); drawing_area = gtk_drawing_area_new(); gtk_widget_set_events(drawing_area, GDK_EXPOSURE_MASK|GDK_BUTTON_PRESS_MASK); gtk_widget_set_events(window, GDK_KEY_PRESS_MASK); gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event", GTK_SIGNAL_FUNC(expose_event), 0); gtk_signal_connect(GTK_OBJECT(drawing_area), "button_press_event", GTK_SIGNAL_FUNC(button_event), 0); GnomeUIInfo toolbar[ ] = { GNOMEUIINFO_ITEM_STOCK ("New Game", "Start new Game", newgame, GNOME_STOCK_PIXMAP_NEW), GNOMEUIINFO_ITEM_STOCK ("High Scores", "Shows High scores", gtk_main_quit, GNOME_STOCK_PIXMAP_SCORES), GNOMEUIINFO_ITEM_STOCK ("End Game", "Ends Current Game", gtk_main_quit, GNOME_STOCK_PIXMAP_STOP), GNOMEUIINFO_ITEM_STOCK ("Exit", "Exit the application", gtk_main_quit, GNOME_STOCK_PIXMAP_EXIT), GNOMEUIINFO_END }; tbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); gnome_app_fill_toolbar(GTK_TOOLBAR(tbar), toolbar, gtk_accel_group_new()); gtk_box_pack_start(GTK_BOX(vbox1), tbar, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), vbox3, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), drawing_area, TRUE, TRUE, 5); gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area), SPACE_INTER+CARD_WS*4, SPACE_INTER+CARD_HS*3); gtk_box_pack_start(GTK_BOX(vbox3), gtk_label_new("Player"), TRUE, TRUE, 1); playerscore = gtk_label_new("0"); gtk_box_pack_start(GTK_BOX(vbox3), playerscore, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(vbox3), gtk_label_new("Computer"), TRUE, TRUE, 1); computerscore = gtk_label_new("0"); gtk_box_pack_start(GTK_BOX(vbox3), computerscore, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(vbox3), gtk_label_new("Cards Remaining"), TRUE, TRUE, 1); cards_remain = gtk_label_new("81"); gtk_box_pack_start(GTK_BOX(vbox3), cards_remain, TRUE, TRUE, 1); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show_all(window); gtk_idle_add( myidle, NULL); /************************ Start Deck Setup *************************/ unsigned char *pixmap_data[] = { bean_e_bits, bean_s_bits, bean_f_bits, blob_e_bits, blob_s_bits, blob_f_bits, diamond_e_bits, diamond_s_bits, diamond_f_bits }; int i, j; GdkWindow *wn = window->window; GdkColor col[4]; GdkColormap *cmap = gdk_window_get_colormap(wn); GdkGC *gc; GtkStyle *style = gtk_widget_get_style(window); col[0].red = 54000; col[0].green = col[0].blue = 0; col[1].green = 40000; col[1].red = col[1].blue = 0; col[2].red = col[2].blue = 32000; col[2].green = 0; gdk_color_white(cmap, &white); gdk_color_black(cmap, &black); blue.red = blue.green = 0; blue.blue = 48000; gdk_color_alloc(cmap, &blue); for (i=0; i<3; i++) gdk_color_alloc(cmap, &col[i]); for (i=0; i<9; i++) for (j=0; j<3; j++) card_pixmap[i*3+j] = gdk_pixmap_create_from_data(wn, (gchar*) pixmap_data[i], SHAPE_W, SHAPE_H, -1, &col[j], &white); /* free colors? !! */ gc = gdk_gc_new(wn); /*** cards in normal state ***/ card_bkg = gdk_pixmap_new(wn, CARD_WIDTH, CARD_HEIGHT, -1); /* clear the card */ gdk_gc_set_foreground(gc, &style->bg[GTK_STATE_NORMAL]); gdk_draw_rectangle(card_bkg, gc, 1, 0, 0, CARD_WIDTH, CARD_HEIGHT); /* draw corner arcs */ gdk_gc_set_foreground(gc, &white); gdk_draw_arc(card_bkg, gc, 1, 0, 0, 2*ARC_SIZE, 2*ARC_SIZE, 90*64, 90*64); gdk_draw_arc(card_bkg, gc, 1, CARD_WIDTH-2*ARC_SIZE, 0, 2*ARC_SIZE, 2*ARC_SIZE, 0, 90*64); gdk_draw_arc(card_bkg, gc, 1, 0, CARD_HEIGHT-2*ARC_SIZE, 2*ARC_SIZE, 2*ARC_SIZE, 180*64, 90*64); gdk_draw_arc(card_bkg, gc, 1, CARD_WIDTH-2*ARC_SIZE, CARD_HEIGHT-2*ARC_SIZE, 2*ARC_SIZE, 2*ARC_SIZE, 270*64, 90*64); /* draw the rest */ gdk_draw_rectangle(card_bkg, gc, 1, ARC_SIZE, 0, CARD_WIDTH-2*ARC_SIZE, CARD_HEIGHT); gdk_draw_rectangle(card_bkg, gc, 1, 0, ARC_SIZE, CARD_WIDTH, CARD_HEIGHT-2*ARC_SIZE); gdk_gc_destroy(gc); /************************ End Deck Setup *************************/ /* done setting up for once to draw wn = drawing_area->window; gc-gdk_gc_new(wn); card1.draw(); .............draw(); gdk_gc_destroy(); Card(int colr, int shp, int num, int shdng); */ mytable.Draw(); gtk_main(); return 0; }
GtkWidget* create_rs232 (void) { GtkWidget *rs232; GtkWidget *eventbox1; GtkWidget *vbox1; GtkWidget *hbox5; GtkWidget *exit; GtkWidget *swap; GtkWidget *clean_data_area; GtkWidget *label7; GtkWidget *label8; GtkWidget *hseparator5; GtkWidget *hbox3; GtkWidget *vbox2; GtkWidget *hbox18; GtkWidget *label1; GtkWidget *combo1; GList *combo1_items = NULL; GtkWidget *combo_entry_baudrate; GtkWidget *hbox24; GtkWidget *label2; GtkWidget *entry5; GtkWidget *label20; GtkWidget *hbox19; GtkWidget *label3; GtkWidget *hbox25; GtkWidget *combo3; GList *combo3_items = NULL; GtkWidget *combo_entry_port; GtkWidget *hbox26; GtkWidget *label4; GtkWidget *entry2; GtkWidget *label21; GtkWidget *hbox27; GtkWidget *togglebutton1; GtkWidget *save_as_numeral; GtkWidget *entry1; GtkWidget *scrolledwindow1; GtkWidget *text1; GtkWidget *scrolledwindow2; GtkWidget *text2; GtkWidget *hseparator4; GtkWidget *hbox4; GtkWidget *label22; GSList *_4_group = NULL; GtkWidget *radiobutton1; guint radiobutton2_key; GtkWidget *radiobutton2; GtkWidget *hseparator6; GtkWidget *hbox29; GtkWidget *spectrum; GtkWidget *inspect; GtkWidget *hbox30; GtkWidget *big_spectrum; GtkWidget *optionmenu1; GtkWidget *optionmenu1_menu; GtkWidget *glade_menuitem; GtkWidget *print_spectrum; GtkWidget *label19; GtkWidget *printer_name; GtkWidget *hbox17; GtkWidget *label18; GtkWidget *point; GtkWidget *save_as_eps; GtkWidget *entry4; GtkWidget *hseparator1; GtkWidget *hbox9; GtkWidget *label9; GSList *_1_group = NULL; GtkWidget *specification_on; GtkWidget *coefficient_on; GtkWidget *hseparator3; GtkWidget *hbox6; GtkWidget *label11; GSList *_2_group = NULL; GtkWidget *move_average; GtkWidget *window; GtkWidget *butterworth; GtkWidget *chebyshev; GtkWidget *hbox8; GtkWidget *fs_label; GtkWidget *fs; GtkWidget *pass_edge_label; GtkWidget *pass_edge; GtkWidget *stop_edge_label; GtkWidget *stop_edge; GtkWidget *pass_ripple_label; GtkWidget *pass_ripple; GtkWidget *stop_ripple_label; GtkWidget *stop_ripple; GtkWidget *hseparator2; GtkWidget *hbox10; GtkWidget *label12; GSList *_3_group = NULL; GtkWidget *fir_input_coefficient; GtkWidget *iir_input_coefficient; GtkWidget *identify_stability; GtkWidget *hbox14; GtkWidget *label16; GtkWidget *a_value; GtkWidget *label17; GtkWidget *b_value; GtkWidget *appbar1; GtkWidget *hbox28; GtkWidget *statusbar1; GtkWidget *progressbar1; GtkAccelGroup *accel_group; GtkTooltips *tooltips; tooltips = gtk_tooltips_new (); accel_group = gtk_accel_group_new (); rs232 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_object_set_data (GTK_OBJECT (rs232), "rs232", rs232); gtk_window_set_title (GTK_WINDOW (rs232), _("\246\263\255\255\257\337\275\304\305T\300\263 FIR \244\316\265L\255\255\257\337\275\304\305T\300\263 IIR \252\272\300W\303\320\244\300\252R\300\263\245\316")); gtk_window_set_policy (GTK_WINDOW (rs232), FALSE, FALSE, TRUE); eventbox1 = gtk_event_box_new (); gtk_widget_ref (eventbox1); gtk_object_set_data_full (GTK_OBJECT (rs232), "eventbox1", eventbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (eventbox1); gtk_container_add (GTK_CONTAINER (rs232), eventbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (rs232), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (eventbox1), vbox1); hbox5 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox5); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox5", hbox5, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox5); gtk_box_pack_start (GTK_BOX (vbox1), hbox5, TRUE, TRUE, 10); exit = gtk_button_new_with_label (_("\302\367\266}")); gtk_widget_ref (exit); gtk_object_set_data_full (GTK_OBJECT (rs232), "exit", exit, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (exit); gtk_box_pack_start (GTK_BOX (hbox5), exit, FALSE, FALSE, 10); gtk_widget_set_usize (exit, 100, -2); swap = gtk_button_new_with_label (_("\261\265\246\254")); gtk_widget_ref (swap); gtk_object_set_data_full (GTK_OBJECT (rs232), "swap", swap, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (swap); gtk_box_pack_start (GTK_BOX (hbox5), swap, FALSE, FALSE, 10); gtk_widget_set_usize (swap, 100, -2); gtk_tooltips_set_tip (tooltips, swap, _("\245i\261\265\246\254\245\321\246\352\246C\260\360\251\322\260e\250\323\252\272\270\352\256\306"), NULL); clean_data_area = gtk_button_new_with_label (_("\262M\260\243\270\352\256\306\261\265\246\254\260\317")); gtk_widget_ref (clean_data_area); gtk_object_set_data_full (GTK_OBJECT (rs232), "clean_data_area", clean_data_area, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (clean_data_area); gtk_box_pack_start (GTK_BOX (hbox5), clean_data_area, FALSE, FALSE, 10); label7 = gtk_label_new (_("\255\354\251l\270\352\256\306")); gtk_widget_ref (label7); gtk_object_set_data_full (GTK_OBJECT (rs232), "label7", label7, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label7); gtk_box_pack_start (GTK_BOX (hbox5), label7, FALSE, FALSE, 89); label8 = gtk_label_new (_("\274\306\255\310\270\352\256\306")); gtk_widget_ref (label8); gtk_object_set_data_full (GTK_OBJECT (rs232), "label8", label8, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label8); gtk_box_pack_start (GTK_BOX (hbox5), label8, FALSE, FALSE, 52); hseparator5 = gtk_hseparator_new (); gtk_widget_ref (hseparator5); gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator5", hseparator5, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hseparator5); gtk_box_pack_start (GTK_BOX (vbox1), hseparator5, TRUE, TRUE, 5); hbox3 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox3); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox3", hbox3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox3); gtk_box_pack_start (GTK_BOX (vbox1), hbox3, TRUE, TRUE, 5); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_ref (vbox2); gtk_object_set_data_full (GTK_OBJECT (rs232), "vbox2", vbox2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox2); gtk_box_pack_start (GTK_BOX (hbox3), vbox2, TRUE, TRUE, 0); hbox18 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox18); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox18", hbox18, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox18); gtk_box_pack_start (GTK_BOX (vbox2), hbox18, TRUE, TRUE, 5); label1 = gtk_label_new (_("\266\307\277\351\300j\262v")); gtk_widget_ref (label1); gtk_object_set_data_full (GTK_OBJECT (rs232), "label1", label1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (hbox18), label1, FALSE, FALSE, 10); combo1 = gtk_combo_new (); gtk_widget_ref (combo1); gtk_object_set_data_full (GTK_OBJECT (rs232), "combo1", combo1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (combo1); gtk_box_pack_start (GTK_BOX (hbox18), combo1, TRUE, TRUE, 10); gtk_widget_set_usize (combo1, 1, -2); combo1_items = g_list_append (combo1_items, (gpointer) _("2400")); combo1_items = g_list_append (combo1_items, (gpointer) _("4800")); combo1_items = g_list_append (combo1_items, (gpointer) _("9600")); combo1_items = g_list_append (combo1_items, (gpointer) _("19200")); combo1_items = g_list_append (combo1_items, (gpointer) _("38400")); combo1_items = g_list_append (combo1_items, (gpointer) _("57600")); combo1_items = g_list_append (combo1_items, (gpointer) _("115200")); gtk_combo_set_popdown_strings (GTK_COMBO (combo1), combo1_items); g_list_free (combo1_items); combo_entry_baudrate = GTK_COMBO (combo1)->entry; gtk_widget_ref (combo_entry_baudrate); gtk_object_set_data_full (GTK_OBJECT (rs232), "combo_entry_baudrate", combo_entry_baudrate, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (combo_entry_baudrate); gtk_entry_set_editable (GTK_ENTRY (combo_entry_baudrate), FALSE); gtk_entry_set_text (GTK_ENTRY (combo_entry_baudrate), _("4800")); hbox24 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox24); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox24", hbox24, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox24); gtk_box_pack_start (GTK_BOX (hbox18), hbox24, TRUE, TRUE, 0); label2 = gtk_label_new (_("\270\352\256\306\252\370\253\327")); gtk_widget_ref (label2); gtk_object_set_data_full (GTK_OBJECT (rs232), "label2", label2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label2); gtk_box_pack_start (GTK_BOX (hbox24), label2, FALSE, FALSE, 15); entry5 = gtk_entry_new (); gtk_widget_ref (entry5); gtk_object_set_data_full (GTK_OBJECT (rs232), "entry5", entry5, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (entry5); gtk_box_pack_start (GTK_BOX (hbox24), entry5, TRUE, TRUE, 10); gtk_widget_set_usize (entry5, 1, -2); gtk_tooltips_set_tip (tooltips, entry5, _("\263\346\246\354\254O\246\354\244\270\262\325"), NULL); gtk_entry_set_text (GTK_ENTRY (entry5), _("16")); label20 = gtk_label_new (_("\246\354\244\270\262\325\274\306")); gtk_widget_ref (label20); gtk_object_set_data_full (GTK_OBJECT (rs232), "label20", label20, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label20); gtk_box_pack_start (GTK_BOX (hbox24), label20, FALSE, FALSE, 10); hbox19 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox19); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox19", hbox19, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox19); gtk_box_pack_start (GTK_BOX (vbox2), hbox19, TRUE, TRUE, 5); label3 = gtk_label_new (_("\266\307\277\351\247\307\246C")); gtk_widget_ref (label3); gtk_object_set_data_full (GTK_OBJECT (rs232), "label3", label3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label3); gtk_box_pack_start (GTK_BOX (hbox19), label3, FALSE, FALSE, 10); hbox25 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox25); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox25", hbox25, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox25); gtk_box_pack_start (GTK_BOX (hbox19), hbox25, TRUE, TRUE, 0); combo3 = gtk_combo_new (); gtk_widget_ref (combo3); gtk_object_set_data_full (GTK_OBJECT (rs232), "combo3", combo3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (combo3); gtk_box_pack_start (GTK_BOX (hbox25), combo3, TRUE, TRUE, 10); gtk_widget_set_usize (combo3, 1, -2); combo3_items = g_list_append (combo3_items, (gpointer) _("1")); combo3_items = g_list_append (combo3_items, (gpointer) _("2")); gtk_combo_set_popdown_strings (GTK_COMBO (combo3), combo3_items); g_list_free (combo3_items); combo_entry_port = GTK_COMBO (combo3)->entry; gtk_widget_ref (combo_entry_port); gtk_object_set_data_full (GTK_OBJECT (rs232), "combo_entry_port", combo_entry_port, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (combo_entry_port); gtk_entry_set_editable (GTK_ENTRY (combo_entry_port), FALSE); gtk_entry_set_text (GTK_ENTRY (combo_entry_port), _("1")); hbox26 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox26); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox26", hbox26, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox26); gtk_box_pack_start (GTK_BOX (hbox25), hbox26, TRUE, TRUE, 0); label4 = gtk_label_new (_("\270\352\256\306\301`\274\306")); gtk_widget_ref (label4); gtk_object_set_data_full (GTK_OBJECT (rs232), "label4", label4, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label4); gtk_box_pack_start (GTK_BOX (hbox26), label4, FALSE, FALSE, 15); entry2 = gtk_entry_new (); gtk_widget_ref (entry2); gtk_object_set_data_full (GTK_OBJECT (rs232), "entry2", entry2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (entry2); gtk_box_pack_start (GTK_BOX (hbox26), entry2, TRUE, TRUE, 10); gtk_widget_set_usize (entry2, 1, -2); gtk_entry_set_text (GTK_ENTRY (entry2), _("5")); label21 = gtk_label_new (_("\265\247\270\352\256\306\274\306")); gtk_widget_ref (label21); gtk_object_set_data_full (GTK_OBJECT (rs232), "label21", label21, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label21); gtk_box_pack_start (GTK_BOX (hbox26), label21, FALSE, FALSE, 10); hbox27 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox27); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox27", hbox27, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox27); gtk_box_pack_start (GTK_BOX (vbox2), hbox27, FALSE, FALSE, 5); togglebutton1 = gtk_toggle_button_new_with_label (_("\261j\250\356\274g\244J\300\311\256\327")); gtk_widget_ref (togglebutton1); gtk_object_set_data_full (GTK_OBJECT (rs232), "togglebutton1", togglebutton1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (togglebutton1); gtk_box_pack_start (GTK_BOX (hbox27), togglebutton1, FALSE, FALSE, 10); gtk_tooltips_set_tip (tooltips, togglebutton1, _("\244\243\272\336\253\374\251w\252\272\300\311\256\327\270\364\256|\244\247\300\311\246W\246s\246b\273P\247_\241A\244@\253\337\261j\250\356\274g\244J"), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton1), TRUE); save_as_numeral = gtk_button_new_with_label (_("\300\311\256\327\270\364\256|")); gtk_widget_ref (save_as_numeral); gtk_object_set_data_full (GTK_OBJECT (rs232), "save_as_numeral", save_as_numeral, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (save_as_numeral); gtk_box_pack_start (GTK_BOX (hbox27), save_as_numeral, FALSE, FALSE, 0); entry1 = gtk_entry_new (); gtk_widget_ref (entry1); gtk_object_set_data_full (GTK_OBJECT (rs232), "entry1", entry1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (entry1); gtk_box_pack_start (GTK_BOX (hbox27), entry1, TRUE, TRUE, 10); gtk_widget_set_usize (entry1, 1, -2); gtk_entry_set_text (GTK_ENTRY (entry1), _("/home/allways/numeral.txt")); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_ref (scrolledwindow1); gtk_object_set_data_full (GTK_OBJECT (rs232), "scrolledwindow1", scrolledwindow1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scrolledwindow1); gtk_box_pack_start (GTK_BOX (hbox3), scrolledwindow1, TRUE, TRUE, 5); gtk_widget_set_usize (scrolledwindow1, 1, -2); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); text1 = gtk_text_new (NULL, NULL); gtk_widget_ref (text1); gtk_object_set_data_full (GTK_OBJECT (rs232), "text1", text1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (text1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), text1); gtk_tooltips_set_tip (tooltips, text1, _("\261q\246\352\246C\260\360\266\307\250\323\252\272\247\271\276\343\270\352\256\306"), NULL); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_ref (scrolledwindow2); gtk_object_set_data_full (GTK_OBJECT (rs232), "scrolledwindow2", scrolledwindow2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scrolledwindow2); gtk_box_pack_start (GTK_BOX (hbox3), scrolledwindow2, TRUE, TRUE, 5); gtk_widget_set_usize (scrolledwindow2, 1, -2); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); text2 = gtk_text_new (NULL, NULL); gtk_widget_ref (text2); gtk_object_set_data_full (GTK_OBJECT (rs232), "text2", text2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (text2); gtk_container_add (GTK_CONTAINER (scrolledwindow2), text2); gtk_tooltips_set_tip (tooltips, text2, _("\261q\247\271\276\343\270\352\256\306\251\322\261o\250\354\252\272\257\302\274\306\255\310\270\352\256\306"), NULL); hseparator4 = gtk_hseparator_new (); gtk_widget_ref (hseparator4); gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator4", hseparator4, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hseparator4); gtk_box_pack_start (GTK_BOX (vbox1), hseparator4, TRUE, TRUE, 5); hbox4 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox4); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox4", hbox4, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox4); gtk_box_pack_start (GTK_BOX (vbox1), hbox4, TRUE, TRUE, 5); label22 = gtk_label_new (_("\250\317\245\316\245\273\263n\305\351\244\247\302o\252i\276\271")); gtk_widget_ref (label22); gtk_object_set_data_full (GTK_OBJECT (rs232), "label22", label22, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label22); gtk_box_pack_start (GTK_BOX (hbox4), label22, FALSE, FALSE, 10); radiobutton1 = gtk_radio_button_new_with_label (_4_group, _("\254O")); _4_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton1)); gtk_widget_ref (radiobutton1); gtk_object_set_data_full (GTK_OBJECT (rs232), "radiobutton1", radiobutton1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (radiobutton1); gtk_box_pack_start (GTK_BOX (hbox4), radiobutton1, FALSE, FALSE, 0); radiobutton2 = gtk_radio_button_new_with_label (_4_group, ""); radiobutton2_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (radiobutton2)->child), _("\247_")); gtk_widget_add_accelerator (radiobutton2, "clicked", accel_group, radiobutton2_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); _4_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton2)); gtk_widget_ref (radiobutton2); gtk_object_set_data_full (GTK_OBJECT (rs232), "radiobutton2", radiobutton2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (radiobutton2); gtk_box_pack_start (GTK_BOX (hbox4), radiobutton2, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton2), TRUE); hseparator6 = gtk_hseparator_new (); gtk_widget_ref (hseparator6); gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator6", hseparator6, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hseparator6); gtk_box_pack_start (GTK_BOX (vbox1), hseparator6, TRUE, TRUE, 5); hbox29 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox29); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox29", hbox29, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox29); gtk_box_pack_start (GTK_BOX (vbox1), hbox29, TRUE, TRUE, 5); spectrum = gtk_button_new_with_label (_("\266}\251l\303\270\273s\302o\252i\276\271\300W\303\320\271\317")); gtk_widget_ref (spectrum); gtk_object_set_data_full (GTK_OBJECT (rs232), "spectrum", spectrum, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (spectrum); gtk_box_pack_start (GTK_BOX (hbox29), spectrum, FALSE, FALSE, 10); gtk_tooltips_set_tip (tooltips, spectrum, _("\267\355\246U\260\321\274\306\244\316\263]\251w\246n\244F\244\247\253\341\241A\264N\245i\245H\253\366\246\271\266s\250\323\303\270\273s\271\317\247\316\244F"), NULL); inspect = gtk_button_new_with_label (_("\300\313\265\370\271\317\300\311")); gtk_widget_ref (inspect); gtk_object_set_data_full (GTK_OBJECT (rs232), "inspect", inspect, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (inspect); gtk_box_pack_start (GTK_BOX (hbox29), inspect, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, inspect, _("\245i\244\243\254O A \271\317\263\341\241I\254O\300W\303\320\271\317\260\325\241I"), NULL); hbox30 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox30); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox30", hbox30, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox30); gtk_box_pack_start (GTK_BOX (vbox1), hbox30, TRUE, TRUE, 5); big_spectrum = gtk_toggle_button_new_with_label (_("\244j\261i\252\272\300W\303\320\271\317")); gtk_widget_ref (big_spectrum); gtk_object_set_data_full (GTK_OBJECT (rs232), "big_spectrum", big_spectrum, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (big_spectrum); gtk_box_pack_start (GTK_BOX (hbox30), big_spectrum, FALSE, FALSE, 10); optionmenu1 = gtk_option_menu_new (); gtk_widget_ref (optionmenu1); gtk_object_set_data_full (GTK_OBJECT (rs232), "optionmenu1", optionmenu1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (optionmenu1); gtk_box_pack_start (GTK_BOX (hbox30), optionmenu1, FALSE, FALSE, 10); optionmenu1_menu = gtk_menu_new (); glade_menuitem = gtk_menu_item_new_with_label (_(" \300W\303\320\271\317\252\355\245\334\244\350\252k")); gtk_widget_show (glade_menuitem); gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem); glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\274\306\246\354\300W\262v Y\241G\275u\251\312\274W\257q")); gtk_widget_show (glade_menuitem); gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem); glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\274\306\246\354\300W\262v Y\241G\244\300\250\251\274W\257q")); gtk_widget_show (glade_menuitem); gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem); glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\303\376\244\361\300W\262v Y\241G\275u\251\312\274W\257q")); gtk_widget_show (glade_menuitem); gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem); glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\303\376\244\361\300W\262v Y\241G\244\300\250\251\274W\257q")); gtk_widget_show (glade_menuitem); gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu1), optionmenu1_menu); print_spectrum = gtk_toggle_button_new_with_label (_("\300W\303\320\271\317\245\316\246L\252\355\276\367\246L\245X")); gtk_widget_ref (print_spectrum); gtk_object_set_data_full (GTK_OBJECT (rs232), "print_spectrum", print_spectrum, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (print_spectrum); gtk_box_pack_start (GTK_BOX (hbox30), print_spectrum, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, print_spectrum, _("\300W\303\320\271\317\273\335\255n\245\316\246L\252\355\276\367\303\270\273s\245X\250\323\252\272\256\311\255\324\241A\250\317\244\247\244U\250H\241A\260O\261o\246L\252\355\276\367\252\272\246W\272\331\255n\245[\263\341\241I"), NULL); label19 = gtk_label_new (_("\246L\252\355\276\367\252\272\271q\270\243\246W\272\331")); gtk_widget_ref (label19); gtk_object_set_data_full (GTK_OBJECT (rs232), "label19", label19, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label19); gtk_box_pack_start (GTK_BOX (hbox30), label19, FALSE, FALSE, 10); printer_name = gtk_entry_new (); gtk_widget_ref (printer_name); gtk_object_set_data_full (GTK_OBJECT (rs232), "printer_name", printer_name, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (printer_name); gtk_box_pack_start (GTK_BOX (hbox30), printer_name, TRUE, TRUE, 10); gtk_widget_set_usize (printer_name, 1, -2); gtk_tooltips_set_tip (tooltips, printer_name, _("\264N\254O\246b\272\364\270\364\244W\246L\252\355\276\367\252\272\246W\246r\241A\245i\244\243\254O\245L\252\272\241\247\262\243\253~\246W\246r\241\250\263\341"), NULL); gtk_entry_set_text (GTK_ENTRY (printer_name), _("hp")); hbox17 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox17); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox17", hbox17, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox17); gtk_box_pack_start (GTK_BOX (vbox1), hbox17, TRUE, TRUE, 5); label18 = gtk_label_new (_("\300W\303\320\271\317\245\255\267\306\253\327( X \266b )")); gtk_widget_ref (label18); gtk_object_set_data_full (GTK_OBJECT (rs232), "label18", label18, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label18); gtk_box_pack_start (GTK_BOX (hbox17), label18, FALSE, FALSE, 10); point = gtk_entry_new (); gtk_widget_ref (point); gtk_object_set_data_full (GTK_OBJECT (rs232), "point", point, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (point); gtk_box_pack_start (GTK_BOX (hbox17), point, TRUE, TRUE, 0); gtk_widget_set_usize (point, 1, -2); gtk_tooltips_set_tip (tooltips, point, _("\264N\254O\247A\247\306\261\346 X \266b\257\340\260\367\244\300\246\250\264X\255\323\265\245\244\300\251O\241H"), NULL); gtk_entry_set_text (GTK_ENTRY (point), _("200")); save_as_eps = gtk_button_new_with_label (_("eps\241Bps\241Bpdf \300\311\300x\246s\270\364\256|\241A\275\320\245[\244W\260\306\300\311\246W")); gtk_widget_ref (save_as_eps); gtk_object_set_data_full (GTK_OBJECT (rs232), "save_as_eps", save_as_eps, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (save_as_eps); gtk_box_pack_start (GTK_BOX (hbox17), save_as_eps, FALSE, FALSE, 10); entry4 = gtk_entry_new (); gtk_widget_ref (entry4); gtk_object_set_data_full (GTK_OBJECT (rs232), "entry4", entry4, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (entry4); gtk_box_pack_start (GTK_BOX (hbox17), entry4, TRUE, TRUE, 10); gtk_widget_set_usize (entry4, 1, -2); gtk_tooltips_set_tip (tooltips, entry4, _("\275\320\260O\261o\244@\251w\261o\247\342\271\317\300\311\252\272\260\306\300\311\246W\246\333\246\346\245[\244J\241C\246p eps ps pdf"), NULL); gtk_entry_set_text (GTK_ENTRY (entry4), _("/home/allways/spectrum.eps")); hseparator1 = gtk_hseparator_new (); gtk_widget_ref (hseparator1); gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator1", hseparator1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hseparator1); gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, TRUE, 5); hbox9 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox9); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox9", hbox9, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox9); gtk_box_pack_start (GTK_BOX (vbox1), hbox9, TRUE, TRUE, 5); label9 = gtk_label_new (_("\302o\252i\276\271\252\272\300W\303\320\271\317\262\243\245\315\244\350\246\241\241G")); gtk_widget_ref (label9); gtk_object_set_data_full (GTK_OBJECT (rs232), "label9", label9, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label9); gtk_box_pack_start (GTK_BOX (hbox9), label9, FALSE, FALSE, 5); specification_on = gtk_radio_button_new_with_label (_1_group, _("\302o\252i\276\271\251\372\262\323\263W\256\346")); _1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (specification_on)); gtk_widget_ref (specification_on); gtk_object_set_data_full (GTK_OBJECT (rs232), "specification_on", specification_on, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (specification_on); gtk_box_pack_start (GTK_BOX (hbox9), specification_on, FALSE, FALSE, 5); gtk_tooltips_set_tip (tooltips, specification_on, _("\247A\245i\245H\246\333\246\346\245\321\302o\252i\276\271\252\272\246U\255\323\260\321\274\306\244@\244@\277\351\244J\247A\255n\252\272\300W\261a\275d\263\362"), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (specification_on), TRUE); coefficient_on = gtk_radio_button_new_with_label (_1_group, _("\260\262\263]\244\247\253Y\274\306\261a\244J\302\340\262\276\250\347\246\241")); _1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (coefficient_on)); gtk_widget_ref (coefficient_on); gtk_object_set_data_full (GTK_OBJECT (rs232), "coefficient_on", coefficient_on, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (coefficient_on); gtk_box_pack_start (GTK_BOX (hbox9), coefficient_on, FALSE, FALSE, 5); gtk_tooltips_set_tip (tooltips, coefficient_on, _("\247A\245i\245H\245\321\265\352\300\300\244@\255\323\302\340\262\276\250\347\274\306\252\272\253Y\274\306\250\323\261o\250\354\247A\255n\252\272\300W\303\320\271\317\241A\265\245\250\354\271\272\245X\250\323\252\272\256\311\255\324\241A\246A\245h\255\327\245\277\247A\252\272\253Y\274\306\241A\244]\254O\244@\272\330\244\350\252k"), NULL); hseparator3 = gtk_hseparator_new (); gtk_widget_ref (hseparator3); gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator3", hseparator3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hseparator3); gtk_box_pack_start (GTK_BOX (vbox1), hseparator3, TRUE, TRUE, 5); hbox6 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox6); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox6", hbox6, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox6); gtk_box_pack_start (GTK_BOX (vbox1), hbox6, TRUE, TRUE, 5); label11 = gtk_label_new (_("\302o\252i\276\271\251\372\262\323\263W\256\346\241G")); gtk_widget_ref (label11); gtk_object_set_data_full (GTK_OBJECT (rs232), "label11", label11, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label11); gtk_box_pack_start (GTK_BOX (hbox6), label11, FALSE, FALSE, 5); move_average = gtk_radio_button_new_with_label (_2_group, _("FIR\241G\262\276\260\312\245\255\247\241\302o\252i\276\271")); _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (move_average)); gtk_widget_ref (move_average); gtk_object_set_data_full (GTK_OBJECT (rs232), "move_average", move_average, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (move_average); gtk_box_pack_start (GTK_BOX (hbox6), move_average, FALSE, FALSE, 0); window = gtk_radio_button_new_with_label (_2_group, _("FIR\241G\265\370\265\241\302o\252i\276\271")); _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (window)); gtk_widget_ref (window); gtk_object_set_data_full (GTK_OBJECT (rs232), "window", window, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (window); gtk_box_pack_start (GTK_BOX (hbox6), window, FALSE, FALSE, 0); butterworth = gtk_radio_button_new_with_label (_2_group, _("IIR\241G\245\244\252o\255\310\261o\302o\252i\276\271")); _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (butterworth)); gtk_widget_ref (butterworth); gtk_object_set_data_full (GTK_OBJECT (rs232), "butterworth", butterworth, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (butterworth); gtk_box_pack_start (GTK_BOX (hbox6), butterworth, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, butterworth, _("\250\344\271\352\264N\254O\244\332\257S\250U\264\376\260\325\241I"), NULL); chebyshev = gtk_radio_button_new_with_label (_2_group, _("IIR\241G\253\264\244\361\263\267\244\322\302o\252i\276\271")); _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (chebyshev)); gtk_widget_ref (chebyshev); gtk_object_set_data_full (GTK_OBJECT (rs232), "chebyshev", chebyshev, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (chebyshev); gtk_box_pack_start (GTK_BOX (hbox6), chebyshev, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chebyshev), TRUE); hbox8 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox8); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox8", hbox8, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox8); gtk_box_pack_start (GTK_BOX (vbox1), hbox8, TRUE, TRUE, 5); fs_label = gtk_label_new (_("\250\372\274\313\300W\262v")); gtk_widget_ref (fs_label); gtk_object_set_data_full (GTK_OBJECT (rs232), "fs_label", fs_label, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (fs_label); gtk_box_pack_start (GTK_BOX (hbox8), fs_label, FALSE, FALSE, 10); fs = gtk_entry_new (); gtk_widget_ref (fs); gtk_object_set_data_full (GTK_OBJECT (rs232), "fs", fs, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (fs); gtk_box_pack_start (GTK_BOX (hbox8), fs, TRUE, TRUE, 0); gtk_widget_set_usize (fs, 1, -2); gtk_tooltips_set_tip (tooltips, fs, _("\263\346\246\354\254\260\273\256\257\367"), NULL); gtk_entry_set_text (GTK_ENTRY (fs), _("20000")); pass_edge_label = gtk_label_new (_("\263q\261a\272I\244\356\300W\262v")); gtk_widget_ref (pass_edge_label); gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_edge_label", pass_edge_label, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (pass_edge_label); gtk_box_pack_start (GTK_BOX (hbox8), pass_edge_label, FALSE, FALSE, 10); pass_edge = gtk_entry_new (); gtk_widget_ref (pass_edge); gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_edge", pass_edge, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (pass_edge); gtk_box_pack_start (GTK_BOX (hbox8), pass_edge, TRUE, TRUE, 0); gtk_widget_set_usize (pass_edge, 1, -2); gtk_tooltips_set_tip (tooltips, pass_edge, _("\263\346\246\354\254\260\273\256\257\367"), NULL); gtk_entry_set_text (GTK_ENTRY (pass_edge), _("5000")); stop_edge_label = gtk_label_new (_("\244\356\261a\272I\244\356\300W\262v")); gtk_widget_ref (stop_edge_label); gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_edge_label", stop_edge_label, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (stop_edge_label); gtk_box_pack_start (GTK_BOX (hbox8), stop_edge_label, FALSE, FALSE, 10); stop_edge = gtk_entry_new (); gtk_widget_ref (stop_edge); gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_edge", stop_edge, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (stop_edge); gtk_box_pack_start (GTK_BOX (hbox8), stop_edge, TRUE, TRUE, 0); gtk_widget_set_usize (stop_edge, 1, -2); gtk_tooltips_set_tip (tooltips, stop_edge, _("\263\346\246\354\254\260\273\256\257\367"), NULL); gtk_entry_set_text (GTK_ENTRY (stop_edge), _("7500")); pass_ripple_label = gtk_label_new (_("\263q\261a\272\247\252i")); gtk_widget_ref (pass_ripple_label); gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_ripple_label", pass_ripple_label, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (pass_ripple_label); gtk_box_pack_start (GTK_BOX (hbox8), pass_ripple_label, FALSE, FALSE, 10); pass_ripple = gtk_entry_new (); gtk_widget_ref (pass_ripple); gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_ripple", pass_ripple, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (pass_ripple); gtk_box_pack_start (GTK_BOX (hbox8), pass_ripple, TRUE, TRUE, 0); gtk_widget_set_usize (pass_ripple, 1, -2); gtk_tooltips_set_tip (tooltips, pass_ripple, _("\263\346\246\354\254\260\244\300\250\251\274W\257q"), NULL); gtk_entry_set_text (GTK_ENTRY (pass_ripple), _("1")); stop_ripple_label = gtk_label_new (_("\244\356\261a\272\247\252i")); gtk_widget_ref (stop_ripple_label); gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_ripple_label", stop_ripple_label, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (stop_ripple_label); gtk_box_pack_start (GTK_BOX (hbox8), stop_ripple_label, FALSE, FALSE, 10); stop_ripple = gtk_entry_new (); gtk_widget_ref (stop_ripple); gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_ripple", stop_ripple, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (stop_ripple); gtk_box_pack_start (GTK_BOX (hbox8), stop_ripple, TRUE, TRUE, 10); gtk_widget_set_usize (stop_ripple, 1, -2); gtk_tooltips_set_tip (tooltips, stop_ripple, _("\263\346\246\354\254\260\244\300\250\251\274W\257q"), NULL); gtk_entry_set_text (GTK_ENTRY (stop_ripple), _("32")); hseparator2 = gtk_hseparator_new (); gtk_widget_ref (hseparator2); gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator2", hseparator2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hseparator2); gtk_box_pack_start (GTK_BOX (vbox1), hseparator2, TRUE, TRUE, 5); hbox10 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox10); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox10", hbox10, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox10); gtk_box_pack_start (GTK_BOX (vbox1), hbox10, TRUE, TRUE, 5); label12 = gtk_label_new (_("\260\262\263]\244\247\253Y\274\306\261a\244J\302\340\262\276\250\347\246\241\241G")); gtk_widget_ref (label12); gtk_object_set_data_full (GTK_OBJECT (rs232), "label12", label12, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label12); gtk_box_pack_start (GTK_BOX (hbox10), label12, FALSE, FALSE, 5); fir_input_coefficient = gtk_radio_button_new_with_label (_3_group, _("\246\263\255\255\257\337\275\304 FIR \302o\252i\276\271")); _3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (fir_input_coefficient)); gtk_widget_ref (fir_input_coefficient); gtk_object_set_data_full (GTK_OBJECT (rs232), "fir_input_coefficient", fir_input_coefficient, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (fir_input_coefficient); gtk_box_pack_start (GTK_BOX (hbox10), fir_input_coefficient, FALSE, FALSE, 10); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fir_input_coefficient), TRUE); iir_input_coefficient = gtk_radio_button_new_with_label (_3_group, _("\265L\255\255\257\337\275\304 IIR \302o\252i\276\271")); _3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (iir_input_coefficient)); gtk_widget_ref (iir_input_coefficient); gtk_object_set_data_full (GTK_OBJECT (rs232), "iir_input_coefficient", iir_input_coefficient, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (iir_input_coefficient); gtk_box_pack_start (GTK_BOX (hbox10), iir_input_coefficient, FALSE, FALSE, 10); identify_stability = gtk_button_new_with_label (_("IIR \302o\252i\276\271\303\255\251w\253\327\305\262\251w(\245\274\247\271\246\250)")); gtk_widget_ref (identify_stability); gtk_object_set_data_full (GTK_OBJECT (rs232), "identify_stability", identify_stability, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (identify_stability); gtk_box_pack_start (GTK_BOX (hbox10), identify_stability, FALSE, FALSE, 10); gtk_tooltips_set_tip (tooltips, identify_stability, _("\246]\254\260\247A\252\272\302\340\262\276\250\347\274\306\254O\260\262\263]\252\272\255\310\241A\251\322\245H\303\255\244\243\303\255\251w\247A\244]\244\243\275T\251w\241A\246\271\266s\245i\245H\247P\302_\244@\244U\241A\246]\254\260 FIR \244@\251w\254O\303\255\251w\252\272\241A\251\322\245H\244\243\245\316\264\372\244F\241C"), NULL); hbox14 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox14); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox14", hbox14, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox14); gtk_box_pack_start (GTK_BOX (vbox1), hbox14, TRUE, TRUE, 5); label16 = gtk_label_new (_("\302\340\262\276\250\347\274\306\244\300\245\300 Y( n ) ")); gtk_widget_ref (label16); gtk_object_set_data_full (GTK_OBJECT (rs232), "label16", label16, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label16); gtk_box_pack_start (GTK_BOX (hbox14), label16, FALSE, FALSE, 10); a_value = gtk_entry_new (); gtk_widget_ref (a_value); gtk_object_set_data_full (GTK_OBJECT (rs232), "a_value", a_value, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (a_value); gtk_box_pack_start (GTK_BOX (hbox14), a_value, TRUE, TRUE, 10); gtk_widget_set_usize (a_value, 1, -2); gtk_tooltips_set_tip (tooltips, a_value, _("\264N\254O\302\340\262\276\250\347\274\306\244\244\252\272\244\300\245\300\263\241\245\367\241A\267\355\265M\263o\245u\246\263 IIR \244~\267|\246\263\252\272"), NULL); gtk_entry_set_text (GTK_ENTRY (a_value), _("1 -0.7757")); label17 = gtk_label_new (_("\302\340\262\276\250\347\274\306\244\300\244l X( n )")); gtk_widget_ref (label17); gtk_object_set_data_full (GTK_OBJECT (rs232), "label17", label17, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label17); gtk_box_pack_start (GTK_BOX (hbox14), label17, FALSE, FALSE, 10); b_value = gtk_entry_new (); gtk_widget_ref (b_value); gtk_object_set_data_full (GTK_OBJECT (rs232), "b_value", b_value, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (b_value); gtk_box_pack_start (GTK_BOX (hbox14), b_value, TRUE, TRUE, 10); gtk_widget_set_usize (b_value, 1, -2); gtk_entry_set_text (GTK_ENTRY (b_value), _("4.7 2.2 3.6 2.2 4.7")); appbar1 = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER); gtk_widget_ref (appbar1); gtk_object_set_data_full (GTK_OBJECT (rs232), "appbar1", appbar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (appbar1); gtk_box_pack_start (GTK_BOX (vbox1), appbar1, TRUE, TRUE, 0); hbox28 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox28); gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox28", hbox28, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox28); gtk_box_pack_start (GTK_BOX (vbox1), hbox28, TRUE, TRUE, 0); statusbar1 = gtk_statusbar_new (); gtk_widget_ref (statusbar1); gtk_object_set_data_full (GTK_OBJECT (rs232), "statusbar1", statusbar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (statusbar1); gtk_box_pack_start (GTK_BOX (hbox28), statusbar1, FALSE, FALSE, 0); gtk_widget_set_usize (statusbar1, 629, -2); progressbar1 = gtk_progress_bar_new (); gtk_widget_ref (progressbar1); gtk_object_set_data_full (GTK_OBJECT (rs232), "progressbar1", progressbar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (progressbar1); gtk_box_pack_start (GTK_BOX (hbox28), progressbar1, FALSE, FALSE, 0); gtk_progress_set_show_text (GTK_PROGRESS (progressbar1), TRUE); gtk_progress_set_format_string (GTK_PROGRESS (progressbar1), _("%P %% \247\271\246\250")); gtk_signal_connect (GTK_OBJECT (rs232), "delete_event", GTK_SIGNAL_FUNC (on_rs232_delete_event), NULL); gtk_signal_connect (GTK_OBJECT (rs232), "show", GTK_SIGNAL_FUNC (on_rs232_show), NULL); gtk_signal_connect (GTK_OBJECT (exit), "clicked", GTK_SIGNAL_FUNC (on_exit_clicked), NULL); gtk_signal_connect (GTK_OBJECT (swap), "clicked", GTK_SIGNAL_FUNC (on_swap_clicked), NULL); gtk_signal_connect (GTK_OBJECT (clean_data_area), "clicked", GTK_SIGNAL_FUNC (on_clean_data_area_clicked), NULL); gtk_signal_connect (GTK_OBJECT (combo_entry_baudrate), "changed", GTK_SIGNAL_FUNC (on_combo_entry_baudrate_changed), NULL); gtk_signal_connect (GTK_OBJECT (combo_entry_port), "changed", GTK_SIGNAL_FUNC (on_combo_entry_port_changed), NULL); gtk_signal_connect (GTK_OBJECT (save_as_numeral), "clicked", GTK_SIGNAL_FUNC (on_save_as_numeral_clicked), NULL); gtk_signal_connect (GTK_OBJECT (spectrum), "clicked", GTK_SIGNAL_FUNC (on_spectrum_clicked), NULL); gtk_signal_connect (GTK_OBJECT (inspect), "clicked", GTK_SIGNAL_FUNC (on_inspect_clicked), NULL); gtk_signal_connect (GTK_OBJECT (print_spectrum), "toggled", GTK_SIGNAL_FUNC (on_print_spectrum_toggled), NULL); gtk_signal_connect (GTK_OBJECT (save_as_eps), "clicked", GTK_SIGNAL_FUNC (on_save_as_eps_clicked), NULL); gtk_signal_connect (GTK_OBJECT (specification_on), "clicked", GTK_SIGNAL_FUNC (on_specification_on_clicked), NULL); gtk_signal_connect (GTK_OBJECT (coefficient_on), "clicked", GTK_SIGNAL_FUNC (on_coefficient_on_clicked), NULL); gtk_signal_connect (GTK_OBJECT (move_average), "clicked", GTK_SIGNAL_FUNC (on_move_average_clicked), NULL); gtk_signal_connect (GTK_OBJECT (window), "clicked", GTK_SIGNAL_FUNC (on_window_clicked), NULL); gtk_signal_connect (GTK_OBJECT (butterworth), "clicked", GTK_SIGNAL_FUNC (on_butterworth_clicked), NULL); gtk_signal_connect (GTK_OBJECT (chebyshev), "clicked", GTK_SIGNAL_FUNC (on_chebyshev_clicked), NULL); gtk_signal_connect (GTK_OBJECT (fir_input_coefficient), "clicked", GTK_SIGNAL_FUNC (on_fir_input_coefficient_clicked), NULL); gtk_signal_connect (GTK_OBJECT (iir_input_coefficient), "clicked", GTK_SIGNAL_FUNC (on_iir_input_coefficient_clicked), NULL); gtk_object_set_data (GTK_OBJECT (rs232), "tooltips", tooltips); gtk_window_add_accel_group (GTK_WINDOW (rs232), accel_group); return rs232; }
GtkWidget * create_window1 (void) { GtkWidget *vbox1; /* menu */ GtkWidget *menubar1; GtkWidget *menuitem1; GtkWidget *menuitem1_menu; GtkWidget *open; GtkWidget *apply; GtkWidget *save; GtkWidget *separatormenuitem1; GtkWidget *save_picture; GtkWidget *save_picture_image; GtkWidget *xsane; GtkWidget *separatormenuitem2; GtkWidget *quit; GtkWidget *menuitem2; GtkWidget *menuitem2_menu; GtkWidget *font; GtkWidget *separator2; GtkWidget *spell_check; GtkWidget *separator3; GtkWidget *menuitem3; GtkWidget *menuitem3_menu; GtkWidget *zoom_in; GtkWidget *zoom_out; GtkWidget *normal_size; GtkWidget *menuitem4; GtkWidget *menuitem4_menu; GtkWidget *about; GtkAccelGroup *accel_group; /* toolbar */ GtkWidget *toolbar; GtkIconSize tmp_toolbar_icon_size; GtkWidget *toolbutton_open; GtkWidget *toolbutton_apply; GtkWidget *toolbutton_save; GtkWidget *toolitem1; GtkWidget *vseparator1; GtkWidget *toolbutton_spell; GtkWidget *toolitem2; GtkWidget *vseparator2; GtkWidget *toolbutton_zoom_in; GtkWidget *toolbutton_zoom_out; GtkWidget *toolbutton_zoom_fit; /* image */ GtkWidget *vpaned1; GtkWidget *scrolledwindow_image; /* text */ GtkTooltips *tooltips; PangoFontDescription *font_desc; tooltips = gtk_tooltips_new (); accel_group = gtk_accel_group_new (); window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (window1, 600, 300); gtk_window_maximize (GTK_WINDOW (window1)); gtk_window_set_title (GTK_WINDOW (window1), _("hocr-gtk")); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (window1), vbox1); /* menu */ menubar1 = gtk_menu_bar_new (); gtk_widget_show (menubar1); gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0); menuitem1 = gtk_menu_item_new_with_mnemonic (_("_File")); gtk_widget_show (menuitem1); gtk_container_add (GTK_CONTAINER (menubar1), menuitem1); menuitem1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu); open = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group); gtk_widget_show (open); gtk_container_add (GTK_CONTAINER (menuitem1_menu), open); apply = gtk_image_menu_item_new_from_stock ("gtk-apply", accel_group); gtk_widget_show (apply); gtk_container_add (GTK_CONTAINER (menuitem1_menu), apply); save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); gtk_widget_show (save); gtk_container_add (GTK_CONTAINER (menuitem1_menu), save); separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (separatormenuitem1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1); gtk_widget_set_sensitive (separatormenuitem1, FALSE); save_picture = gtk_image_menu_item_new_with_label (_("Save Picture")); save_picture_image = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); gtk_widget_show (save_picture_image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (save_picture), save_picture_image); gtk_widget_show (save_picture); gtk_container_add (GTK_CONTAINER (menuitem1_menu), save_picture); xsane = gtk_menu_item_new_with_label (_("Xsane")); gtk_widget_show (xsane); gtk_container_add (GTK_CONTAINER (menuitem1_menu), xsane); separatormenuitem2 = gtk_separator_menu_item_new (); gtk_widget_show (separatormenuitem2); gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem2); gtk_widget_set_sensitive (separatormenuitem2, FALSE); quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group); gtk_widget_show (quit); gtk_container_add (GTK_CONTAINER (menuitem1_menu), quit); menuitem2 = gtk_menu_item_new_with_mnemonic (_("_Edit")); gtk_widget_show (menuitem2); gtk_container_add (GTK_CONTAINER (menubar1), menuitem2); menuitem2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem2), menuitem2_menu); font = gtk_image_menu_item_new_from_stock ("gtk-select-font", accel_group); gtk_widget_show (font); gtk_container_add (GTK_CONTAINER (menuitem2_menu), font); separator2 = gtk_separator_menu_item_new (); gtk_widget_show (separator2); gtk_container_add (GTK_CONTAINER (menuitem2_menu), separator2); gtk_widget_set_sensitive (separator2, FALSE); #ifdef WITH_GTKSPELL spell_check = gtk_image_menu_item_new_from_stock ("gtk-spell-check", accel_group); gtk_widget_show (spell_check); gtk_container_add (GTK_CONTAINER (menuitem2_menu), spell_check); separator3 = gtk_separator_menu_item_new (); gtk_widget_show (separator3); gtk_container_add (GTK_CONTAINER (menuitem2_menu), separator3); gtk_widget_set_sensitive (separator3, FALSE); #endif color_text_box = gtk_check_menu_item_new_with_mnemonic (_("Color boxes")); gtk_widget_show (color_text_box); gtk_container_add (GTK_CONTAINER (menuitem2_menu), color_text_box); gtk_tooltips_set_tip (tooltips, color_text_box, _("Color text boxes"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (color_text_box), TRUE); color_misread = gtk_check_menu_item_new_with_mnemonic (_("Color misread")); gtk_widget_show (color_misread); gtk_container_add (GTK_CONTAINER (menuitem2_menu), color_misread); gtk_tooltips_set_tip (tooltips, color_misread, _("Color misread fonts"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (color_misread), TRUE); clear_text = gtk_check_menu_item_new_with_mnemonic (_("Clear")); gtk_widget_show (clear_text); gtk_container_add (GTK_CONTAINER (menuitem2_menu), clear_text); gtk_tooltips_set_tip (tooltips, clear_text, _("Clear text each time you ocr new scan"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (clear_text), TRUE); ocr = gtk_check_menu_item_new_with_mnemonic (_("Ocr")); gtk_widget_show (ocr); gtk_container_add (GTK_CONTAINER (menuitem2_menu), ocr); gtk_tooltips_set_tip (tooltips, ocr, _("Try to recognize fonts in scaned text"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ocr), TRUE); use_dict = gtk_check_menu_item_new_with_mnemonic (_("Use dictionary")); gtk_widget_show (use_dict); gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_dict); gtk_tooltips_set_tip (tooltips, use_dict, _ ("Try to guess unrecognized fonts in scaned text using internal dictionary"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_dict), FALSE); use_nikud = gtk_check_menu_item_new_with_mnemonic (_("Use nikud")); gtk_widget_show (use_nikud); gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_nikud); gtk_tooltips_set_tip (tooltips, use_nikud, _("Try to guess nikud"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_nikud), TRUE); use_spaces = gtk_check_menu_item_new_with_mnemonic (_("Use spaces")); gtk_widget_show (use_spaces); gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_spaces); gtk_tooltips_set_tip (tooltips, use_spaces, _("Use spaces for tabs"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_spaces), FALSE); use_indent = gtk_check_menu_item_new_with_mnemonic (_("Use indentation")); gtk_widget_show (use_indent); gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_indent); gtk_tooltips_set_tip (tooltips, use_indent, _("Try to guess line indentation"), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_indent), FALSE); menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menuitem3); gtk_container_add (GTK_CONTAINER (menubar1), menuitem3); menuitem3_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem3), menuitem3_menu); zoom_in = gtk_image_menu_item_new_from_stock ("gtk-zoom-in", accel_group); gtk_widget_show (zoom_in); gtk_container_add (GTK_CONTAINER (menuitem3_menu), zoom_in); zoom_out = gtk_image_menu_item_new_from_stock ("gtk-zoom-out", accel_group); gtk_widget_show (zoom_out); gtk_container_add (GTK_CONTAINER (menuitem3_menu), zoom_out); normal_size = gtk_image_menu_item_new_from_stock ("gtk-zoom-100", accel_group); gtk_widget_show (normal_size); gtk_container_add (GTK_CONTAINER (menuitem3_menu), normal_size); menuitem4 = gtk_menu_item_new_with_mnemonic (_("_Help")); gtk_widget_show (menuitem4); gtk_container_add (GTK_CONTAINER (menubar1), menuitem4); menuitem4_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu); about = gtk_menu_item_new_with_mnemonic (_("_About")); gtk_widget_show (about); gtk_container_add (GTK_CONTAINER (menuitem4_menu), about); /* toolbar */ toolbar = gtk_toolbar_new (); gtk_widget_show (toolbar); gtk_box_pack_start (GTK_BOX (vbox1), toolbar, FALSE, FALSE, 0); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH); tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar)); toolbutton_open = (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-open"); gtk_widget_show (toolbutton_open); gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_open); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_open), tooltips, _("Open a new picture for the OCR"), NULL); toolbutton_apply = (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-apply"); gtk_widget_show (toolbutton_apply); gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_apply); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_apply), tooltips, _("Convert picture to text"), NULL); toolbutton_save = (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-save"); gtk_widget_show (toolbutton_save); gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_save); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_save), tooltips, _("Save the text created by the OCR"), NULL); toolitem1 = (GtkWidget *) gtk_tool_item_new (); gtk_widget_show (toolitem1); gtk_container_add (GTK_CONTAINER (toolbar), toolitem1); vseparator1 = gtk_vseparator_new (); gtk_widget_show (vseparator1); gtk_container_add (GTK_CONTAINER (toolitem1), vseparator1); #ifdef WITH_GTKSPELL toolbutton_spell = (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-spell-check"); gtk_widget_show (toolbutton_spell); gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_spell); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_spell), tooltips, _("Spell check the text"), NULL); toolitem2 = (GtkWidget *) gtk_tool_item_new (); gtk_widget_show (toolitem2); gtk_container_add (GTK_CONTAINER (toolbar), toolitem2); vseparator2 = gtk_vseparator_new (); gtk_widget_show (vseparator2); gtk_container_add (GTK_CONTAINER (toolitem2), vseparator2); #endif toolbutton_zoom_in = (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-zoom-in"); gtk_widget_show (toolbutton_zoom_in); gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_zoom_in); toolbutton_zoom_out = (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-zoom-out"); gtk_widget_show (toolbutton_zoom_out); gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_zoom_out); toolbutton_zoom_fit = (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-zoom-fit"); gtk_widget_show (toolbutton_zoom_fit); gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_zoom_fit); /* image */ vpaned1 = gtk_vpaned_new (); gtk_widget_show (vpaned1); gtk_container_add (GTK_CONTAINER (vbox1), vpaned1); scrolledwindow_image = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ((GtkScrolledWindow *) scrolledwindow_image, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show (scrolledwindow_image); gtk_container_add (GTK_CONTAINER (vpaned1), scrolledwindow_image); viewport1 = gtk_viewport_new (NULL, NULL); gtk_widget_show (viewport1); gtk_container_add (GTK_CONTAINER (scrolledwindow_image), viewport1); image = gtk_image_new (); gtk_widget_show (image); gtk_container_add (GTK_CONTAINER (viewport1), image); /* text */ scrolledwindow_text = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ((GtkScrolledWindow *) scrolledwindow_text, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show (scrolledwindow_text); gtk_container_add (GTK_CONTAINER (vpaned1), scrolledwindow_text); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow_text), GTK_SHADOW_IN); textview = gtk_text_view_new (); gtk_widget_show (textview); gtk_container_add (GTK_CONTAINER (scrolledwindow_text), textview); font_desc = pango_font_description_from_string (font_name); gtk_widget_modify_font (textview, font_desc); font_name = g_strdup (TEXT_FONT_NAME); /* progress bar */ hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0); pbar = gtk_progress_bar_new (); gtk_widget_show (pbar); gtk_box_pack_start (GTK_BOX (hbox2), pbar, FALSE, FALSE, 0); gtk_widget_set_size_request (pbar, 100, -1); statusbar1 = gtk_statusbar_new (); gtk_widget_show (statusbar1); gtk_box_pack_start (GTK_BOX (hbox2), statusbar1, TRUE, TRUE, 0); /* main window */ g_signal_connect ((gpointer) window1, "delete_event", G_CALLBACK (on_window1_delete_event), NULL); /* toolbar */ g_signal_connect ((gpointer) toolbutton_open, "clicked", G_CALLBACK (on_toolbutton_open_clicked), NULL); g_signal_connect ((gpointer) toolbutton_apply, "clicked", G_CALLBACK (on_toolbutton_apply_clicked), NULL); g_signal_connect ((gpointer) toolbutton_save, "clicked", G_CALLBACK (on_toolbutton_save_clicked), NULL); g_signal_connect ((gpointer) toolbutton_zoom_in, "clicked", G_CALLBACK (on_toolbutton_zoom_in_clicked), NULL); g_signal_connect ((gpointer) toolbutton_zoom_out, "clicked", G_CALLBACK (on_toolbutton_zoom_out_clicked), NULL); g_signal_connect ((gpointer) toolbutton_zoom_fit, "clicked", G_CALLBACK (on_toolbutton_zoom_fit_clicked), NULL); #ifdef WITH_GTKSPELL g_signal_connect ((gpointer) toolbutton_spell, "clicked", G_CALLBACK (on_toolbutton_spell_clicked), NULL); #endif /* menu */ g_signal_connect ((gpointer) open, "activate", G_CALLBACK (on_open_activate), NULL); g_signal_connect ((gpointer) apply, "activate", G_CALLBACK (on_apply_activate), NULL); g_signal_connect ((gpointer) save, "activate", G_CALLBACK (on_save_activate), NULL); g_signal_connect ((gpointer) save_picture, "activate", G_CALLBACK (on_save_picture_activate), NULL); g_signal_connect ((gpointer) xsane, "activate", G_CALLBACK (on_xsane_activate), NULL); g_signal_connect ((gpointer) quit, "activate", G_CALLBACK (on_quit_activate), NULL); g_signal_connect ((gpointer) font, "activate", G_CALLBACK (on_font_activate), NULL); #ifdef WITH_GTKSPELL g_signal_connect ((gpointer) spell_check, "activate", G_CALLBACK (on_spell_check_activate), NULL); #endif g_signal_connect ((gpointer) zoom_in, "activate", G_CALLBACK (on_zoom_in_activate), NULL); g_signal_connect ((gpointer) zoom_out, "activate", G_CALLBACK (on_zoom_out_activate), NULL); g_signal_connect ((gpointer) normal_size, "activate", G_CALLBACK (on_normal_size_activate), NULL); g_signal_connect ((gpointer) about, "activate", G_CALLBACK (on_about_activate), NULL); gtk_window_add_accel_group (GTK_WINDOW (window1), accel_group); return window1; }
GtkWidget * gw_text_box_create ( GtkWindow *window, gchar *title, gchar *subject, gchar *text, GtkSignalFunc ok) { /* This is a single window, this properties may be changed */ static GtkWidget *w = NULL; GtkWidget *frame = NULL; GtkWidget *vbox = NULL; GtkWidget *hbox = NULL; GtkWidget *scroll_zone = NULL; GtkWidget *txt_area = NULL; GtkWidget *button = NULL; guint button_key; GtkAccelGroup *accel = NULL; gchar *text_utf8 = NULL; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif /* Inits an accel group for keystroke shortcuts */ accel = gtk_accel_group_new ( ); if ( !w ) { w = gtk_window_new ( GTK_WINDOW_TOPLEVEL); gtk_window_set_policy ( GTK_WINDOW ( w), FALSE, FALSE, TRUE); g_strdup_to_gtk_text ( title, text_utf8); gtk_window_set_title ( GTK_WINDOW ( w), text_utf8); g_free ( text_utf8); gtk_window_set_modal ( GTK_WINDOW ( w),TRUE); gtk_window_set_transient_for ( GTK_WINDOW ( w), window); gtk_window_set_position ( GTK_WINDOW ( w), GTK_WIN_POS_CENTER); gtk_container_border_width ( GTK_CONTAINER ( w), 5); gtk_signal_connect ( GTK_OBJECT ( w), "destroy", GTK_SIGNAL_FUNC ( gtk_widget_destroyed), &w); /* Store parent window reference */ gtk_widget_ref ( GTK_WIDGET ( window)); gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_TEXT_BOX_PARENT_WINDOW, window, (GtkDestroyNotify) gtk_widget_unref); frame = gtk_frame_new ( subject); gtk_container_add ( GTK_CONTAINER ( w), frame); vbox = gtk_vbox_new ( FALSE, 0); gtk_container_add ( GTK_CONTAINER ( frame), vbox); gtk_container_set_border_width ( GTK_CONTAINER ( vbox), 10); /* Creates the text srollbar */ scroll_zone = gtk_scrolled_window_new ( NULL, NULL); gtk_box_pack_start ( GTK_BOX ( vbox), scroll_zone, TRUE, TRUE, 0); gtk_container_set_border_width ( GTK_CONTAINER ( scroll_zone), 5); gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scroll_zone), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); /* Creates text area */ txt_area = gtk_text_area_new ( ); gtk_text_area_set_editable ( GTK_TEXT_AREA ( txt_area), TRUE); /* Sets default text value */ if ( text != NULL ) { gtk_text_area_insert ( GTK_TEXT_AREA ( txt_area), text); } gtk_widget_set_usize ( txt_area, 400, 300); gtk_widget_ref ( txt_area); /* Store data text reference */ gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_TEXT_DATA_TEXT, txt_area, (GtkDestroyNotify) gtk_widget_unref); gtk_container_add ( GTK_CONTAINER ( scroll_zone), txt_area); gtk_widget_grab_focus ( txt_area); hbox = gtk_hbox_new ( TRUE, 10); gtk_container_add ( GTK_CONTAINER ( vbox), hbox); gtk_container_set_border_width ( GTK_CONTAINER ( hbox), 5); button = gtk_button_new_with_label ( ""); g_strdup_to_gtk_text ( _( "_OK"), text_utf8); button_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( button)->child), text_utf8); g_free ( text_utf8); gtk_widget_add_accelerator ( button, "clicked", accel, button_key, GDK_MOD1_MASK, 0); gtk_object_set_user_data ( GTK_OBJECT ( button), w); gtk_box_pack_start ( GTK_BOX ( hbox), button, TRUE, TRUE, 0); if ( ok != NULL ) { gtk_signal_connect ( GTK_OBJECT ( button), "clicked", GTK_SIGNAL_FUNC ( ok), w); } else { gtk_signal_connect_object ( GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w)); } button = gtk_button_new_with_label ( ""); g_strdup_to_gtk_text ( _( "_Cancel"), text_utf8); button_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( button)->child), text_utf8); g_free ( text_utf8); gtk_widget_add_accelerator ( button, "clicked", accel, button_key, GDK_MOD1_MASK, 0); gtk_object_set_user_data ( GTK_OBJECT ( button), w); gtk_box_pack_start ( GTK_BOX ( hbox), button, TRUE, TRUE, 0); gtk_signal_connect_object ( GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w)); gtk_window_add_accel_group ( GTK_WINDOW ( w), accel); } if ( !GTK_WIDGET_VISIBLE ( w) ) { #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : show the window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif gtk_widget_show_all ( w); } else { #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : destroy the window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif gtk_widget_destroy ( w); } return w; }
/** * create_bios_misc_files_window(): Create the BIOS/Misc Files Window. * @return BIOS/Misc Files Window. */ GtkWidget* create_bios_misc_files_window(void) { GdkPixbuf *bios_misc_files_window_icon_pixbuf; GtkWidget *vbox_bmf; GtkWidget *frame_file = NULL, *label_frame_file = NULL, *table_frame_file = NULL; GtkWidget *label_file = NULL, *entry_file = NULL, *button_file = NULL; GtkWidget *hbutton_box_bmf_buttonRow; GtkWidget *button_bmf_Cancel, *button_bmf_Apply, *button_bmf_Save; char tmp[64]; int file = 0, table_row = 0; if (bios_misc_files_window) { // BIOS/Misc Files window is already created. Set focus. gtk_widget_grab_focus(bios_misc_files_window); return NULL; } accel_group = gtk_accel_group_new(); // Create the BIOS/Misc Files window. CREATE_GTK_WINDOW(bios_misc_files_window, "bios_misc_files_window", "Configure BIOS/Misc Files", bios_misc_files_window_icon_pixbuf, "Gens2.ico"); // Callbacks for if the window is closed. g_signal_connect((gpointer)bios_misc_files_window, "delete_event", G_CALLBACK(on_bios_misc_files_window_close), NULL); g_signal_connect((gpointer)bios_misc_files_window, "destroy_event", G_CALLBACK(on_bios_misc_files_window_close), NULL); // Create the main VBox. vbox_bmf = gtk_vbox_new(FALSE, 10); gtk_widget_set_name(vbox_bmf, "vbox_bmf"); gtk_widget_show(vbox_bmf); gtk_container_add(GTK_CONTAINER(bios_misc_files_window), vbox_bmf); GLADE_HOOKUP_OBJECT(bios_misc_files_window, vbox_bmf, "vbox_bmf"); // Create all frames. This will be fun! while (BIOSMiscFiles[file].title) { if (!BIOSMiscFiles[file].entry) { // No entry buffer. This is a new frame. sprintf(tmp, "frame_%s", BIOSMiscFiles[file].tag); frame_file = gtk_frame_new(NULL); gtk_widget_set_name(frame_file, tmp); gtk_container_set_border_width(GTK_CONTAINER(frame_file), 4); gtk_frame_set_shadow_type(GTK_FRAME(frame_file), GTK_SHADOW_ETCHED_IN); gtk_widget_show(frame_file); gtk_box_pack_start(GTK_BOX(vbox_bmf), frame_file, TRUE, TRUE, 0); GLADE_HOOKUP_OBJECT(bios_misc_files_window, frame_file, tmp); // Add the frame label. sprintf(tmp, "label_frame_%s", BIOSMiscFiles[file].tag); label_frame_file = gtk_label_new(BIOSMiscFiles[file].title); gtk_widget_set_name(label_frame_file, tmp); gtk_label_set_use_markup(GTK_LABEL(label_frame_file), TRUE); gtk_widget_show(label_frame_file); gtk_frame_set_label_widget(GTK_FRAME(frame_file), label_frame_file); GLADE_HOOKUP_OBJECT(bios_misc_files_window, label_frame_file, tmp); // Add the frame table. sprintf(tmp, "table_frame_%s", BIOSMiscFiles[file].tag); table_frame_file = gtk_table_new(1, 3, FALSE); gtk_widget_set_name(table_frame_file, tmp); gtk_container_set_border_width(GTK_CONTAINER(table_frame_file), 8); gtk_table_set_row_spacings(GTK_TABLE(table_frame_file), 4); gtk_table_set_col_spacings(GTK_TABLE(table_frame_file), 4); gtk_widget_show(table_frame_file); gtk_container_add(GTK_CONTAINER(frame_file), table_frame_file); GLADE_HOOKUP_OBJECT(bios_misc_files_window, table_frame_file, tmp); table_row = 0; } else { // File entry. // Check if the table needs to be resized. if (table_row > 0) gtk_table_resize(GTK_TABLE(table_frame_file), table_row + 1, 3); // Create the label for this file. sprintf(tmp, "label_%s", BIOSMiscFiles[file].tag); label_file = gtk_label_new(BIOSMiscFiles[file].title); gtk_widget_set_name(label_file, tmp); gtk_widget_set_size_request(label_file, 85, -1); gtk_misc_set_alignment(GTK_MISC(label_file), 0, 0.5); gtk_widget_show(label_file); gtk_table_attach(GTK_TABLE(table_frame_file), label_file, 0, 1, table_row, table_row + 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); GLADE_HOOKUP_OBJECT(bios_misc_files_window, label_file, tmp); // Create the entry for this file. sprintf(tmp, "entry_%s", BIOSMiscFiles[file].tag); entry_file = gtk_entry_new(); gtk_widget_set_name(entry_file, tmp); gtk_entry_set_max_length(GTK_ENTRY(entry_file), GENS_PATH_MAX - 1); gtk_entry_set_text(GTK_ENTRY(entry_file), BIOSMiscFiles[file].entry); gtk_widget_set_size_request(entry_file, 250, -1); gtk_widget_show(entry_file); gtk_table_attach(GTK_TABLE(table_frame_file), entry_file, 1, 2, table_row, table_row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); GLADE_HOOKUP_OBJECT(bios_misc_files_window, entry_file, tmp); // Create the button for this file. // TODO: Use an icon? sprintf(tmp, "button_%s", BIOSMiscFiles[file].tag); button_file = gtk_button_new_with_label("Change..."); gtk_widget_set_name(button_file, tmp); gtk_widget_show(button_file); gtk_table_attach(GTK_TABLE(table_frame_file), button_file, 2, 3, table_row, table_row + 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); g_signal_connect((gpointer)button_file, "clicked", G_CALLBACK(on_button_bmf_Change_clicked), GINT_TO_POINTER(file)); GLADE_HOOKUP_OBJECT(bios_misc_files_window, button_file, tmp); table_row++; } file++; } // HButton Box for the row of buttons on the bottom of the window hbutton_box_bmf_buttonRow = gtk_hbutton_box_new(); gtk_widget_set_name(hbutton_box_bmf_buttonRow, "hbutton_box_bmf_buttonRow"); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbutton_box_bmf_buttonRow), GTK_BUTTONBOX_END); gtk_widget_show(hbutton_box_bmf_buttonRow); gtk_box_pack_start(GTK_BOX(vbox_bmf), hbutton_box_bmf_buttonRow, FALSE, FALSE, 0); GLADE_HOOKUP_OBJECT(bios_misc_files_window, hbutton_box_bmf_buttonRow, "hbutton_box_bmf_buttonRow"); // Cancel button_bmf_Cancel = gtk_button_new_from_stock("gtk-cancel"); gtk_widget_set_name(button_bmf_Cancel, "button_bmf_cancel"); gtk_widget_show(button_bmf_Cancel); gtk_box_pack_start(GTK_BOX(hbutton_box_bmf_buttonRow), button_bmf_Cancel, FALSE, FALSE, 0); gtk_widget_add_accelerator(button_bmf_Cancel, "activate", accel_group, GDK_Escape, (GdkModifierType)(0), (GtkAccelFlags)(0)); AddButtonCallback_Clicked(button_bmf_Cancel, on_button_bmf_Cancel_clicked); GLADE_HOOKUP_OBJECT(bios_misc_files_window, button_bmf_Cancel, "button_bmf_Cancel"); // Apply button_bmf_Apply = gtk_button_new_from_stock("gtk-apply"); gtk_widget_set_name(button_bmf_Apply, "button_bmf_Apply"); gtk_widget_show(button_bmf_Apply); gtk_box_pack_start(GTK_BOX(hbutton_box_bmf_buttonRow), button_bmf_Apply, FALSE, FALSE, 0); AddButtonCallback_Clicked(button_bmf_Apply, on_button_bmf_Apply_clicked); GLADE_HOOKUP_OBJECT(bios_misc_files_window, button_bmf_Apply, "button_bmf_Apply"); // Save button_bmf_Save = gtk_button_new_from_stock("gtk-save"); gtk_widget_set_name(button_bmf_Save, "button_bmf_Save"); gtk_widget_show(button_bmf_Save); gtk_box_pack_start(GTK_BOX(hbutton_box_bmf_buttonRow), button_bmf_Save, FALSE, FALSE, 0); AddButtonCallback_Clicked(button_bmf_Save, on_button_bmf_Save_clicked); gtk_widget_add_accelerator(button_bmf_Save, "activate", accel_group, GDK_Return, (GdkModifierType)(0), (GtkAccelFlags)(0)); gtk_widget_add_accelerator(button_bmf_Save, "activate", accel_group, GDK_KP_Enter, (GdkModifierType)(0), (GtkAccelFlags)(0)); GLADE_HOOKUP_OBJECT(bios_misc_files_window, button_bmf_Save, "button_bmf_Save"); // Add the accel group. gtk_window_add_accel_group(GTK_WINDOW(bios_misc_files_window), accel_group); return bios_misc_files_window; }
void create_main_window (ProcData *procdata) { gint i; gint width, height, xpos, ypos; GtkWidget *app; GtkAction *action; GtkWidget *menubar; GtkWidget *main_box; GtkWidget *notebook; GtkWidget *tab_label1, *tab_label2, *tab_label3; GtkWidget *vbox1; GtkWidget *sys_box, *devices_box; GtkWidget *sysinfo_box, *sysinfo_label; app = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(app), _("System Monitor")); GdkScreen* screen = gtk_widget_get_screen(app); /* use visual, if available */ GdkVisual* visual = gdk_screen_get_rgba_visual(screen); if (visual) gtk_widget_set_visual(app, visual); main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(app), main_box); width = procdata->config.width; height = procdata->config.height; xpos = procdata->config.xpos; ypos = procdata->config.ypos; gtk_window_set_default_size (GTK_WINDOW (app), width, height); gtk_window_move(GTK_WINDOW (app), xpos, ypos); gtk_window_set_resizable (GTK_WINDOW (app), TRUE); if (procdata->config.maximized) { gtk_window_maximize(GTK_WINDOW(app)); } /* create the menubar */ procdata->uimanager = gtk_ui_manager_new (); /* show tooltips in the statusbar */ g_signal_connect (procdata->uimanager, "connect_proxy", G_CALLBACK (connect_proxy_cb), procdata); g_signal_connect (procdata->uimanager, "disconnect_proxy", G_CALLBACK (disconnect_proxy_cb), procdata); gtk_window_add_accel_group (GTK_WINDOW (app), gtk_ui_manager_get_accel_group (procdata->uimanager)); if (!gtk_ui_manager_add_ui_from_string (procdata->uimanager, ui_info, -1, NULL)) { g_error("building menus failed"); } procdata->action_group = gtk_action_group_new ("ProcmanActions"); gtk_action_group_set_translation_domain (procdata->action_group, NULL); gtk_action_group_add_actions (procdata->action_group, menu_entries, G_N_ELEMENTS (menu_entries), procdata); gtk_action_group_add_toggle_actions (procdata->action_group, toggle_menu_entries, G_N_ELEMENTS (toggle_menu_entries), procdata); gtk_action_group_add_radio_actions (procdata->action_group, radio_menu_entries, G_N_ELEMENTS (radio_menu_entries), procdata->config.whose_process, G_CALLBACK(cb_radio_processes), procdata); gtk_action_group_add_radio_actions (procdata->action_group, priority_menu_entries, G_N_ELEMENTS (priority_menu_entries), NORMAL_PRIORITY, G_CALLBACK(cb_renice), procdata); gtk_ui_manager_insert_action_group (procdata->uimanager, procdata->action_group, 0); menubar = gtk_ui_manager_get_widget (procdata->uimanager, "/MenuBar"); gtk_box_pack_start (GTK_BOX (main_box), menubar, FALSE, FALSE, 0); /* create the main notebook */ procdata->notebook = notebook = gtk_notebook_new (); gtk_box_pack_start (GTK_BOX (main_box), notebook, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (notebook), 12); sysinfo_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); // procman_create_sysinfo_view(); sysinfo_label = gtk_label_new(_("System")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sysinfo_box, sysinfo_label); vbox1 = create_proc_view (procdata); tab_label1 = gtk_label_new (_("Processes")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox1, tab_label1); sys_box = create_sys_view (procdata); tab_label2 = gtk_label_new (_("Resources")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sys_box, tab_label2); devices_box = create_disk_view (procdata); tab_label3 = gtk_label_new (_("File Systems")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), devices_box, tab_label3); g_signal_connect (G_OBJECT (notebook), "switch-page", G_CALLBACK (cb_switch_page), procdata); g_signal_connect (G_OBJECT (notebook), "change-current-page", G_CALLBACK (cb_change_current_page), procdata); gtk_widget_show_all(notebook); // need to make page switch work gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), procdata->config.current_tab); cb_change_current_page (GTK_NOTEBOOK (notebook), procdata->config.current_tab, procdata); g_signal_connect (G_OBJECT (app), "delete_event", G_CALLBACK (cb_app_delete), procdata); GtkAccelGroup *accel_group; GClosure *goto_tab_closure[4]; accel_group = gtk_accel_group_new (); gtk_window_add_accel_group (GTK_WINDOW(app), accel_group); for (i = 0; i < 4; ++i) { goto_tab_closure[i] = g_cclosure_new_swap (G_CALLBACK (cb_proc_goto_tab), GINT_TO_POINTER (i), NULL); gtk_accel_group_connect (accel_group, '0'+(i+1), GDK_MOD1_MASK, GTK_ACCEL_VISIBLE, goto_tab_closure[i]); } /* create the statusbar */ procdata->statusbar = gtk_statusbar_new(); gtk_box_pack_start(GTK_BOX(main_box), procdata->statusbar, FALSE, FALSE, 0); procdata->tip_message_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (procdata->statusbar), "tip_message"); action = gtk_action_group_get_action (procdata->action_group, "ShowDependencies"); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), procdata->config.show_tree); gtk_widget_show_all(app); procdata->app = app; }
GtkWidget* create_BookkeepingMainwindow (void) { GtkWidget *BookkeepingMainwindow; GtkWidget *vbox1; GtkWidget *menubar1; GtkWidget *file1; GtkWidget *file1_menu; GtkWidget *choosePrinter1; GtkWidget *separator2; GtkWidget *quit1; GtkWidget *bookkeeping; GtkWidget *bookkeeping_menu; GtkWidget *new1; GtkWidget *edit1; GtkWidget *trennlinie1; GtkWidget *save1; GtkWidget *separator3; GtkWidget *print1; GtkWidget *separator1; GtkWidget *delete1; GtkWidget *journal1; GtkWidget *journal1_menu; GtkWidget *journal_monthly1; GtkWidget *journal_all1; GtkWidget *toolbar1; GtkIconSize tmp_toolbar_icon_size; GtkWidget *hbox1; GtkWidget *lFindNumber; GtkWidget *eFindName; GtkWidget *lFindDesignation; GtkWidget *eFindCity; GtkWidget *bSearch; GtkWidget *scrolledwindow1; GtkWidget *viewport1; GtkWidget *tree1; GtkWidget *notebook1; GtkWidget *vbox2; GtkWidget *hbox2; GtkWidget *label1; GtkWidget *eDate; GtkWidget *label2; GtkWidget *eShortKey; GtkWidget *cbAutomatic; GtkWidget *hbox3; GtkWidget *label3; GtkWidget *eDesignation; GtkWidget *hbox25; GtkWidget *hbox26; GtkWidget *label13; GtkWidget *eDocumentNumber1; GtkWidget *hbox27; GtkWidget *label14; GtkWidget *eDocumentNumber2; GtkWidget *hbox4; GtkWidget *label11; GtkWidget *hbox10; GtkWidget *label9; GtkWidget *label10; GtkWidget *hbox17; GtkWidget *hbox28; GtkWidget *eBookAccount1; GtkWidget *eInfo1; GtkWidget *hbox18; GtkWidget *eDebit1; GtkWidget *eCredit1; GtkWidget *hbox32; GtkWidget *hbox33; GtkWidget *eBookAccount2; GtkWidget *eInfo2; GtkWidget *hbox34; GtkWidget *eDebit2; GtkWidget *eCredit2; GtkWidget *hbox35; GtkWidget *hbox36; GtkWidget *eBookAccount3; GtkWidget *eInfo3; GtkWidget *hbox37; GtkWidget *eDebit3; GtkWidget *eCredit3; GtkWidget *hseparator1; GtkWidget *hbox9; GtkWidget *label12; GtkWidget *hbox15; GtkWidget *hbox16; GtkWidget *hbox19; GtkWidget *hbox29; GtkWidget *eBookAccount5; GtkWidget *eInfo5; GtkWidget *hbox21; GtkWidget *eDebit5; GtkWidget *eCredit5; GtkWidget *hbox20; GtkWidget *hbox30; GtkWidget *eBookAccount6; GtkWidget *eInfo6; GtkWidget *hbox22; GtkWidget *eDebit6; GtkWidget *eCredit6; GtkWidget *hbox23; GtkWidget *hbox31; GtkWidget *eBookAccount7; GtkWidget *eInfo7; GtkWidget *hbox24; GtkWidget *eDebit7; GtkWidget *eCredit7; GtkWidget *bCash; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new (); BookkeepingMainwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (BookkeepingMainwindow), _("Bookkeeping")); vbox1 = gtk_vbox_new (FALSE, 17); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (BookkeepingMainwindow), vbox1); menubar1 = gtk_menu_bar_new (); gtk_widget_show (menubar1); gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0); file1 = gtk_menu_item_new_with_mnemonic (_("_File")); gtk_widget_show (file1); gtk_container_add (GTK_CONTAINER (menubar1), file1); file1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (file1), file1_menu); choosePrinter1 = gtk_menu_item_new_with_mnemonic (_("Print S_etup...")); gtk_widget_show (choosePrinter1); gtk_container_add (GTK_CONTAINER (file1_menu), choosePrinter1); separator2 = gtk_separator_menu_item_new (); gtk_widget_show (separator2); gtk_container_add (GTK_CONTAINER (file1_menu), separator2); gtk_widget_set_sensitive (separator2, FALSE); quit1 = gtk_image_menu_item_new_from_stock ("gtk-close", accel_group); gtk_widget_show (quit1); gtk_container_add (GTK_CONTAINER (file1_menu), quit1); bookkeeping = gtk_menu_item_new_with_mnemonic (_("Bookkeeping")); gtk_widget_show (bookkeeping); gtk_container_add (GTK_CONTAINER (menubar1), bookkeeping); bookkeeping_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (bookkeeping), bookkeeping_menu); new1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); gtk_widget_show (new1); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), new1); edit1 = gtk_image_menu_item_new_from_stock ("gtk-edit", accel_group); gtk_widget_show (edit1); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), edit1); trennlinie1 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie1); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), trennlinie1); gtk_widget_set_sensitive (trennlinie1, FALSE); save1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); gtk_widget_show (save1); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), save1); separator3 = gtk_separator_menu_item_new (); gtk_widget_show (separator3); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), separator3); gtk_widget_set_sensitive (separator3, FALSE); print1 = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group); gtk_widget_show (print1); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), print1); separator1 = gtk_separator_menu_item_new (); gtk_widget_show (separator1); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), separator1); gtk_widget_set_sensitive (separator1, FALSE); delete1 = gtk_image_menu_item_new_from_stock ("gtk-clear", accel_group); gtk_widget_show (delete1); gtk_container_add (GTK_CONTAINER (bookkeeping_menu), delete1); journal1 = gtk_menu_item_new_with_mnemonic (_("Journal")); gtk_widget_show (journal1); gtk_container_add (GTK_CONTAINER (menubar1), journal1); journal1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (journal1), journal1_menu); journal_monthly1 = gtk_menu_item_new_with_mnemonic (_("Monthly")); gtk_widget_show (journal_monthly1); gtk_container_add (GTK_CONTAINER (journal1_menu), journal_monthly1); journal_all1 = gtk_menu_item_new_with_mnemonic (_("All")); gtk_widget_show (journal_all1); gtk_container_add (GTK_CONTAINER (journal1_menu), journal_all1); toolbar1 = gtk_toolbar_new (); gtk_widget_show (toolbar1); gtk_box_pack_start (GTK_BOX (vbox1), toolbar1, FALSE, FALSE, 0); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH); tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1)); hbox1 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); lFindNumber = gtk_label_new (_("Date")); gtk_widget_show (lFindNumber); gtk_box_pack_start (GTK_BOX (hbox1), lFindNumber, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (lFindNumber), GTK_JUSTIFY_CENTER); eFindName = gtk_entry_new (); gtk_widget_show (eFindName); gtk_box_pack_start (GTK_BOX (hbox1), eFindName, FALSE, FALSE, 0); lFindDesignation = gtk_label_new (_("Designation")); gtk_widget_show (lFindDesignation); gtk_box_pack_start (GTK_BOX (hbox1), lFindDesignation, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (lFindDesignation), GTK_JUSTIFY_CENTER); eFindCity = gtk_entry_new (); gtk_widget_show (eFindCity); gtk_box_pack_start (GTK_BOX (hbox1), eFindCity, FALSE, FALSE, 0); bSearch = gtk_button_new_with_mnemonic (_("Search")); gtk_widget_show (bSearch); gtk_box_pack_start (GTK_BOX (hbox1), bSearch, FALSE, FALSE, 0); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow1); gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0); GTK_WIDGET_UNSET_FLAGS (scrolledwindow1, GTK_CAN_FOCUS); viewport1 = gtk_viewport_new (NULL, NULL); gtk_widget_show (viewport1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1); tree1 = gtk_tree_view_new (); gtk_widget_show (tree1); gtk_container_add (GTK_CONTAINER (viewport1), tree1); GTK_WIDGET_UNSET_FLAGS (tree1, GTK_CAN_FOCUS); notebook1 = gtk_notebook_new (); gtk_widget_show (notebook1); gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_container_add (GTK_CONTAINER (notebook1), vbox2); hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0); label1 = gtk_label_new (_("date")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (hbox2), label1, FALSE, FALSE, 0); eDate = gtk_entry_new (); gtk_widget_show (eDate); gtk_box_pack_start (GTK_BOX (hbox2), eDate, TRUE, TRUE, 0); gtk_entry_set_width_chars (GTK_ENTRY (eDate), 10); label2 = gtk_label_new (_("short key")); gtk_widget_show (label2); gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0); eShortKey = gtk_entry_new (); gtk_widget_show (eShortKey); gtk_box_pack_start (GTK_BOX (hbox2), eShortKey, TRUE, TRUE, 0); gtk_entry_set_has_frame (GTK_ENTRY (eShortKey), FALSE); gtk_entry_set_width_chars (GTK_ENTRY (eShortKey), 6); cbAutomatic = gtk_check_button_new_with_mnemonic (_("Automatic")); gtk_widget_show (cbAutomatic); gtk_box_pack_start (GTK_BOX (hbox2), cbAutomatic, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cbAutomatic), TRUE); hbox3 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox3); gtk_box_pack_start (GTK_BOX (vbox2), hbox3, TRUE, TRUE, 0); label3 = gtk_label_new (_("Designation")); gtk_widget_show (label3); gtk_box_pack_start (GTK_BOX (hbox3), label3, FALSE, FALSE, 0); eDesignation = gtk_entry_new (); gtk_widget_show (eDesignation); gtk_box_pack_start (GTK_BOX (hbox3), eDesignation, TRUE, TRUE, 0); hbox25 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox25); gtk_box_pack_start (GTK_BOX (vbox2), hbox25, TRUE, TRUE, 0); hbox26 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox26); gtk_box_pack_start (GTK_BOX (hbox25), hbox26, TRUE, TRUE, 0); label13 = gtk_label_new (_("Doc.-Nr. 1")); gtk_widget_show (label13); gtk_box_pack_start (GTK_BOX (hbox26), label13, FALSE, FALSE, 0); eDocumentNumber1 = gtk_entry_new (); gtk_widget_show (eDocumentNumber1); gtk_box_pack_start (GTK_BOX (hbox26), eDocumentNumber1, TRUE, TRUE, 0); hbox27 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox27); gtk_box_pack_start (GTK_BOX (hbox25), hbox27, TRUE, TRUE, 0); label14 = gtk_label_new (_("Doc-Nr. 2")); gtk_widget_show (label14); gtk_box_pack_start (GTK_BOX (hbox27), label14, FALSE, FALSE, 0); eDocumentNumber2 = gtk_entry_new (); gtk_widget_show (eDocumentNumber2); gtk_box_pack_start (GTK_BOX (hbox27), eDocumentNumber2, TRUE, TRUE, 0); hbox4 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox4); gtk_box_pack_start (GTK_BOX (vbox2), hbox4, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox4), 3); label11 = gtk_label_new (_("account")); gtk_widget_show (label11); gtk_box_pack_start (GTK_BOX (hbox4), label11, FALSE, FALSE, 0); hbox10 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox10); gtk_box_pack_start (GTK_BOX (hbox4), hbox10, TRUE, TRUE, 0); label9 = gtk_label_new (_("debit (receipt)")); gtk_widget_show (label9); gtk_box_pack_start (GTK_BOX (hbox10), label9, FALSE, FALSE, 0); label10 = gtk_label_new (_("credit (cost)")); gtk_widget_show (label10); gtk_box_pack_start (GTK_BOX (hbox10), label10, FALSE, FALSE, 0); hbox17 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox17); gtk_box_pack_start (GTK_BOX (vbox2), hbox17, TRUE, TRUE, 0); hbox28 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox28); gtk_box_pack_start (GTK_BOX (hbox17), hbox28, TRUE, TRUE, 0); eBookAccount1 = gtk_entry_new (); gtk_widget_show (eBookAccount1); gtk_box_pack_start (GTK_BOX (hbox28), eBookAccount1, TRUE, TRUE, 0); gtk_widget_add_accelerator (eBookAccount1, "activate", accel_group, GDK_F1, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount1), 10); eInfo1 = gtk_entry_new (); gtk_widget_show (eInfo1); gtk_box_pack_start (GTK_BOX (hbox28), eInfo1, FALSE, FALSE, 0); gtk_editable_set_editable (GTK_EDITABLE (eInfo1), FALSE); gtk_entry_set_width_chars (GTK_ENTRY (eInfo1), 30); hbox18 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox18); gtk_box_pack_start (GTK_BOX (hbox17), hbox18, TRUE, TRUE, 0); eDebit1 = gtk_entry_new (); gtk_widget_show (eDebit1); gtk_box_pack_start (GTK_BOX (hbox18), eDebit1, TRUE, TRUE, 0); eCredit1 = gtk_entry_new (); gtk_widget_show (eCredit1); gtk_box_pack_start (GTK_BOX (hbox18), eCredit1, TRUE, TRUE, 0); hbox32 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox32); gtk_box_pack_start (GTK_BOX (vbox2), hbox32, FALSE, FALSE, 0); hbox33 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox33); gtk_box_pack_start (GTK_BOX (hbox32), hbox33, TRUE, TRUE, 0); eBookAccount2 = gtk_entry_new (); gtk_widget_show (eBookAccount2); gtk_box_pack_start (GTK_BOX (hbox33), eBookAccount2, TRUE, TRUE, 0); gtk_widget_add_accelerator (eBookAccount2, "activate", accel_group, GDK_F1, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount2), 10); eInfo2 = gtk_entry_new (); gtk_widget_show (eInfo2); gtk_box_pack_start (GTK_BOX (hbox33), eInfo2, FALSE, FALSE, 0); gtk_editable_set_editable (GTK_EDITABLE (eInfo2), FALSE); gtk_entry_set_width_chars (GTK_ENTRY (eInfo2), 30); hbox34 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox34); gtk_box_pack_start (GTK_BOX (hbox32), hbox34, TRUE, TRUE, 0); eDebit2 = gtk_entry_new (); gtk_widget_show (eDebit2); gtk_box_pack_start (GTK_BOX (hbox34), eDebit2, TRUE, TRUE, 0); eCredit2 = gtk_entry_new (); gtk_widget_show (eCredit2); gtk_box_pack_start (GTK_BOX (hbox34), eCredit2, TRUE, TRUE, 0); hbox35 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox35); gtk_box_pack_start (GTK_BOX (vbox2), hbox35, TRUE, TRUE, 0); hbox36 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox36); gtk_box_pack_start (GTK_BOX (hbox35), hbox36, TRUE, TRUE, 0); eBookAccount3 = gtk_entry_new (); gtk_widget_show (eBookAccount3); gtk_box_pack_start (GTK_BOX (hbox36), eBookAccount3, TRUE, TRUE, 0); gtk_widget_add_accelerator (eBookAccount3, "activate", accel_group, GDK_F1, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount3), 10); eInfo3 = gtk_entry_new (); gtk_widget_show (eInfo3); gtk_box_pack_start (GTK_BOX (hbox36), eInfo3, FALSE, FALSE, 0); gtk_editable_set_editable (GTK_EDITABLE (eInfo3), FALSE); gtk_entry_set_width_chars (GTK_ENTRY (eInfo3), 30); hbox37 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox37); gtk_box_pack_start (GTK_BOX (hbox35), hbox37, TRUE, TRUE, 0); eDebit3 = gtk_entry_new (); gtk_widget_show (eDebit3); gtk_box_pack_start (GTK_BOX (hbox37), eDebit3, TRUE, TRUE, 0); eCredit3 = gtk_entry_new (); gtk_widget_show (eCredit3); gtk_box_pack_start (GTK_BOX (hbox37), eCredit3, TRUE, TRUE, 0); hseparator1 = gtk_hseparator_new (); gtk_widget_show (hseparator1); gtk_box_pack_start (GTK_BOX (vbox2), hseparator1, TRUE, TRUE, 0); gtk_widget_set_size_request (hseparator1, -1, 13); hbox9 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox9); gtk_box_pack_start (GTK_BOX (vbox2), hbox9, TRUE, TRUE, 0); label12 = gtk_label_new (_("counter account")); gtk_widget_show (label12); gtk_box_pack_start (GTK_BOX (hbox9), label12, FALSE, FALSE, 0); hbox15 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox15); gtk_box_pack_start (GTK_BOX (hbox9), hbox15, TRUE, TRUE, 0); hbox16 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox16); gtk_box_pack_start (GTK_BOX (hbox15), hbox16, TRUE, TRUE, 0); hbox19 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox19); gtk_box_pack_start (GTK_BOX (vbox2), hbox19, TRUE, TRUE, 0); hbox29 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox29); gtk_box_pack_start (GTK_BOX (hbox19), hbox29, TRUE, TRUE, 0); eBookAccount5 = gtk_entry_new (); gtk_widget_show (eBookAccount5); gtk_box_pack_start (GTK_BOX (hbox29), eBookAccount5, TRUE, TRUE, 0); gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount5), 10); eInfo5 = gtk_entry_new (); gtk_widget_show (eInfo5); gtk_box_pack_start (GTK_BOX (hbox29), eInfo5, FALSE, FALSE, 0); gtk_editable_set_editable (GTK_EDITABLE (eInfo5), FALSE); gtk_entry_set_width_chars (GTK_ENTRY (eInfo5), 30); hbox21 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox21); gtk_box_pack_start (GTK_BOX (hbox19), hbox21, TRUE, TRUE, 0); eDebit5 = gtk_entry_new (); gtk_widget_show (eDebit5); gtk_box_pack_start (GTK_BOX (hbox21), eDebit5, TRUE, TRUE, 0); eCredit5 = gtk_entry_new (); gtk_widget_show (eCredit5); gtk_box_pack_start (GTK_BOX (hbox21), eCredit5, TRUE, TRUE, 0); hbox20 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox20); gtk_box_pack_start (GTK_BOX (vbox2), hbox20, TRUE, TRUE, 0); hbox30 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox30); gtk_box_pack_start (GTK_BOX (hbox20), hbox30, TRUE, TRUE, 0); eBookAccount6 = gtk_entry_new (); gtk_widget_show (eBookAccount6); gtk_box_pack_start (GTK_BOX (hbox30), eBookAccount6, TRUE, TRUE, 0); gtk_widget_add_accelerator (eBookAccount6, "activate", accel_group, GDK_F1, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount6), 10); eInfo6 = gtk_entry_new (); gtk_widget_show (eInfo6); gtk_box_pack_start (GTK_BOX (hbox30), eInfo6, FALSE, FALSE, 0); gtk_editable_set_editable (GTK_EDITABLE (eInfo6), FALSE); gtk_entry_set_width_chars (GTK_ENTRY (eInfo6), 30); hbox22 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox22); gtk_box_pack_start (GTK_BOX (hbox20), hbox22, TRUE, TRUE, 0); eDebit6 = gtk_entry_new (); gtk_widget_show (eDebit6); gtk_box_pack_start (GTK_BOX (hbox22), eDebit6, TRUE, TRUE, 0); eCredit6 = gtk_entry_new (); gtk_widget_show (eCredit6); gtk_box_pack_start (GTK_BOX (hbox22), eCredit6, TRUE, TRUE, 0); hbox23 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox23); gtk_box_pack_start (GTK_BOX (vbox2), hbox23, TRUE, TRUE, 0); hbox31 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox31); gtk_box_pack_start (GTK_BOX (hbox23), hbox31, TRUE, TRUE, 0); eBookAccount7 = gtk_entry_new (); gtk_widget_show (eBookAccount7); gtk_box_pack_start (GTK_BOX (hbox31), eBookAccount7, TRUE, TRUE, 0); gtk_widget_add_accelerator (eBookAccount7, "activate", accel_group, GDK_F1, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount7), 10); eInfo7 = gtk_entry_new (); gtk_widget_show (eInfo7); gtk_box_pack_start (GTK_BOX (hbox31), eInfo7, FALSE, FALSE, 0); gtk_editable_set_editable (GTK_EDITABLE (eInfo7), FALSE); gtk_entry_set_width_chars (GTK_ENTRY (eInfo7), 30); hbox24 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox24); gtk_box_pack_start (GTK_BOX (hbox23), hbox24, TRUE, TRUE, 0); eDebit7 = gtk_entry_new (); gtk_widget_show (eDebit7); gtk_box_pack_start (GTK_BOX (hbox24), eDebit7, TRUE, TRUE, 0); eCredit7 = gtk_entry_new (); gtk_widget_show (eCredit7); gtk_box_pack_start (GTK_BOX (hbox24), eCredit7, TRUE, TRUE, 0); bCash = gtk_button_new_with_mnemonic (_("Bookkeeping")); gtk_widget_show (bCash); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), bCash); g_signal_connect ((gpointer) choosePrinter1, "activate", G_CALLBACK (on_choosePrinter1_activate), NULL); g_signal_connect ((gpointer) quit1, "activate", G_CALLBACK (on_quit1_activate), NULL); g_signal_connect ((gpointer) new1, "activate", G_CALLBACK (on_new1_activate), NULL); g_signal_connect ((gpointer) edit1, "activate", G_CALLBACK (on_edit1_activate), NULL); g_signal_connect ((gpointer) save1, "activate", G_CALLBACK (on_save1_activate), NULL); g_signal_connect ((gpointer) print1, "activate", G_CALLBACK (on_print1_activate), NULL); g_signal_connect ((gpointer) delete1, "activate", G_CALLBACK (on_delete1_activate), NULL); g_signal_connect ((gpointer) journal_monthly1, "activate", G_CALLBACK (on_journal_monthly1_activate), NULL); g_signal_connect ((gpointer) journal_all1, "activate", G_CALLBACK (on_journal_all1_activate), NULL); g_signal_connect ((gpointer) bSearch, "clicked", G_CALLBACK (on_bSearch_clicked), NULL); g_signal_connect ((gpointer) eDate, "key_press_event", G_CALLBACK (on_eDate_key_press_event), NULL); g_signal_connect ((gpointer) eShortKey, "changed", G_CALLBACK (on_eShortKey_changed), NULL); g_signal_connect ((gpointer) eShortKey, "focus_out_event", G_CALLBACK (on_eShortKey_focus_out_event), NULL); g_signal_connect ((gpointer) eBookAccount1, "activate", G_CALLBACK (on_eCAB1_activate), NULL); g_signal_connect ((gpointer) eBookAccount1, "changed", G_CALLBACK (on_eCAB1_changed), NULL); g_signal_connect ((gpointer) eDebit1, "editing_done", G_CALLBACK (on_eDebi1_editing_done), NULL); g_signal_connect ((gpointer) eCredit1, "editing_done", G_CALLBACK (on_eCredit1_editing_done), NULL); g_signal_connect ((gpointer) eBookAccount2, "activate", G_CALLBACK (on_eCAB1_activate), NULL); g_signal_connect ((gpointer) eBookAccount2, "changed", G_CALLBACK (on_eCAB1_changed), NULL); g_signal_connect ((gpointer) eDebit2, "editing_done", G_CALLBACK (on_eDebi1_editing_done), NULL); g_signal_connect ((gpointer) eCredit2, "editing_done", G_CALLBACK (on_eCredit1_editing_done), NULL); g_signal_connect ((gpointer) eBookAccount3, "activate", G_CALLBACK (on_eCAB1_activate), NULL); g_signal_connect ((gpointer) eBookAccount3, "changed", G_CALLBACK (on_eCAB1_changed), NULL); g_signal_connect ((gpointer) eDebit3, "editing_done", G_CALLBACK (on_eDebi1_editing_done), NULL); g_signal_connect ((gpointer) eCredit3, "editing_done", G_CALLBACK (on_eCredit1_editing_done), NULL); g_signal_connect ((gpointer) eBookAccount5, "activate", G_CALLBACK (on_eCAB2_activate), NULL); g_signal_connect ((gpointer) eBookAccount5, "changed", G_CALLBACK (on_eCAB2_changed), NULL); g_signal_connect ((gpointer) eBookAccount6, "activate", G_CALLBACK (on_eCAB3_activate), NULL); g_signal_connect ((gpointer) eBookAccount6, "changed", G_CALLBACK (on_eCAB3_changed), NULL); g_signal_connect ((gpointer) eBookAccount7, "activate", G_CALLBACK (on_eCAB4_activate), NULL); g_signal_connect ((gpointer) eBookAccount7, "changed", G_CALLBACK (on_eCAB4_changed), NULL); g_signal_connect ((gpointer) bCash, "clicked", G_CALLBACK (on_bArticle_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (BookkeepingMainwindow, BookkeepingMainwindow, "BookkeepingMainwindow"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, menubar1, "menubar1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, file1, "file1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, file1_menu, "file1_menu"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, choosePrinter1, "choosePrinter1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, separator2, "separator2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, quit1, "quit1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bookkeeping, "bookkeeping"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bookkeeping_menu, "bookkeeping_menu"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, new1, "new1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, edit1, "edit1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, trennlinie1, "trennlinie1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, save1, "save1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, separator3, "separator3"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, print1, "print1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, separator1, "separator1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, delete1, "delete1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal1, "journal1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal1_menu, "journal1_menu"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal_monthly1, "journal_monthly1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal_all1, "journal_all1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, toolbar1, "toolbar1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, lFindNumber, "lFindNumber"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eFindName, "eFindName"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, lFindDesignation, "lFindDesignation"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eFindCity, "eFindCity"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bSearch, "bSearch"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, scrolledwindow1, "scrolledwindow1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, viewport1, "viewport1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, tree1, "tree1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, notebook1, "notebook1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, vbox2, "vbox2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox2, "hbox2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label1, "label1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDate, "eDate"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label2, "label2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eShortKey, "eShortKey"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, cbAutomatic, "cbAutomatic"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox3, "hbox3"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label3, "label3"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDesignation, "eDesignation"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox25, "hbox25"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox26, "hbox26"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label13, "label13"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDocumentNumber1, "eDocumentNumber1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox27, "hbox27"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label14, "label14"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDocumentNumber2, "eDocumentNumber2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox4, "hbox4"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label11, "label11"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox10, "hbox10"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label9, "label9"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label10, "label10"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox17, "hbox17"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox28, "hbox28"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount1, "eBookAccount1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo1, "eInfo1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox18, "hbox18"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit1, "eDebit1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit1, "eCredit1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox32, "hbox32"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox33, "hbox33"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount2, "eBookAccount2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo2, "eInfo2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox34, "hbox34"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit2, "eDebit2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit2, "eCredit2"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox35, "hbox35"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox36, "hbox36"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount3, "eBookAccount3"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo3, "eInfo3"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox37, "hbox37"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit3, "eDebit3"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit3, "eCredit3"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hseparator1, "hseparator1"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox9, "hbox9"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label12, "label12"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox15, "hbox15"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox16, "hbox16"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox19, "hbox19"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox29, "hbox29"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount5, "eBookAccount5"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo5, "eInfo5"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox21, "hbox21"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit5, "eDebit5"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit5, "eCredit5"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox20, "hbox20"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox30, "hbox30"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount6, "eBookAccount6"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo6, "eInfo6"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox22, "hbox22"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit6, "eDebit6"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit6, "eCredit6"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox23, "hbox23"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox31, "hbox31"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount7, "eBookAccount7"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo7, "eInfo7"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox24, "hbox24"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit7, "eDebit7"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit7, "eCredit7"); GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bCash, "bCash"); gtk_window_add_accel_group (GTK_WINDOW (BookkeepingMainwindow), accel_group); return BookkeepingMainwindow; }
static GtkWidget *vte_create_popup_menu(void) { GtkWidget *menu, *item; GtkAccelGroup *accel_group; menu = gtk_menu_new(); accel_group = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(main_widgets.window), accel_group); item = gtk_image_menu_item_new_from_stock(GTK_STOCK_COPY, NULL); gtk_widget_add_accelerator(item, "activate", accel_group, GDK_c, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_COPY)); item = gtk_image_menu_item_new_from_stock(GTK_STOCK_PASTE, NULL); gtk_widget_add_accelerator(item, "activate", accel_group, GDK_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_PASTE)); item = gtk_separator_menu_item_new(); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); item = gtk_image_menu_item_new_from_stock(GTK_STOCK_SELECT_ALL, NULL); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_SELECTALL)); item = gtk_separator_menu_item_new(); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); item = gtk_image_menu_item_new_with_mnemonic(_("_Set Path From Document")); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_CHANGEPATH)); item = gtk_image_menu_item_new_with_mnemonic(_("_Restart Terminal")); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_RESTARTTERMINAL)); item = gtk_separator_menu_item_new(); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); item = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_PREFERENCES)); msgwin_menu_add_common_items(GTK_MENU(menu)); item = gtk_separator_menu_item_new(); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); /* the IM submenu should always be the last item to be consistent with other GTK popup menus */ vc->im_submenu = gtk_menu_new(); item = gtk_image_menu_item_new_with_mnemonic(_("_Input Methods")); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), vc->im_submenu); /* submenu populated after vte realized */ return menu; }
/* * display the initial menu to setup global options * at startup. */ static void gtkui_setup(void) { GtkTextIter iter; GtkWidget *item, *vbox, *scroll, *vpaned, *logo; GtkItemFactory *item_factory; GClosure *closure = NULL; GdkModifierType mods; gint keyval, width, height, left, top; char *path = NULL; GtkItemFactoryEntry file_menu[] = { { "/_File", "<shift>F", NULL, 0, "<Branch>" }, { "/File/_Open", "<control>O", gtkui_file_open, 0, "<StockItem>", GTK_STOCK_OPEN }, { "/File/_Save", "<control>S", gtkui_file_write, 0, "<StockItem>", GTK_STOCK_SAVE }, { "/File/sep1", NULL, NULL, 0, "<Separator>" }, { "/File/E_xit", "<control>x", gtkui_exit, 0, "<StockItem>", GTK_STOCK_QUIT }, { "/_Sniff", "<shift>S", NULL, 0, "<Branch>" }, { "/Sniff/Unified sniffing...", "<shift>U", gtkui_unified_sniff, 0, "<StockItem>", GTK_STOCK_DND }, { "/Sniff/Bridged sniffing...", "<shift>B", gtkui_bridged_sniff, 0, "<StockItem>", GTK_STOCK_DND_MULTIPLE }, { "/Sniff/sep2", NULL, NULL, 0, "<Separator>" }, { "/Sniff/Set pcap filter...", "p", gtkui_pcap_filter, 0, "<StockItem>", GTK_STOCK_PREFERENCES }, { "/_Options", "<shift>O", NULL, 0, "<Branch>" }, { "/Options/Unoffensive", NULL, toggle_unoffensive, 0, "<ToggleItem>" }, { "/Options/Promisc mode", NULL, toggle_nopromisc, 0, "<ToggleItem>" }, { "/Options/Set netmask", "n", gtkui_set_netmask, 0, "<Item>"} #ifndef OS_WINDOWS ,{"/_?", NULL, NULL, 0, "<Branch>" }, {"/?/Contents", " ", gtkui_help, 0, "<StockItem>", GTK_STOCK_HELP } #endif }; gint nmenu_items = sizeof (file_menu) / sizeof (file_menu[0]); DEBUG_MSG("gtkui_setup"); width = gtkui_conf_get("window_width"); height = gtkui_conf_get("window_height"); left = gtkui_conf_get("window_left"); top = gtkui_conf_get("window_top"); /* create menu window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW (window), EC_PROGRAM" "EC_VERSION); gtk_window_set_default_size(GTK_WINDOW (window), width, height); if(left > 0 || top > 0) gtk_window_move(GTK_WINDOW(window), left, top); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtkui_exit), NULL); accel_group = gtk_accel_group_new (); item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group); gtk_item_factory_create_items (item_factory, nmenu_items, file_menu, NULL); /* hidden shortcut to start Unified Sniffing with default interface */ closure = g_cclosure_new(G_CALLBACK(gtkui_unified_sniff_default), NULL, NULL); gtk_accelerator_parse ("u", &keyval, &mods); gtk_accel_group_connect(accel_group, keyval, mods, 0, closure); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER (window), vbox); gtk_widget_show(vbox); main_menu = gtk_item_factory_get_widget (item_factory, "<main>"); gtk_box_pack_start(GTK_BOX(vbox), main_menu, FALSE, FALSE, 0); gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); gtk_widget_show(main_menu); if(GBL_PCAP->promisc) { /* setting the menu item active will toggle this setting */ /* it will be TRUE after the menu is updated */ GBL_PCAP->promisc = 0; item = gtk_item_factory_get_item(item_factory, "/Options/Promisc mode"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM (item), TRUE); } if(GBL_OPTIONS->unoffensive) { GBL_OPTIONS->unoffensive = 0; item = gtk_item_factory_get_item(item_factory, "/Options/Unoffensive"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM (item), TRUE); } vpaned = gtk_vpaned_new(); /* notebook for MDI pages */ notebook_frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME (notebook_frame), GTK_SHADOW_IN); gtk_paned_pack1(GTK_PANED(vpaned), notebook_frame, TRUE, TRUE); gtk_widget_show(notebook_frame); path = INSTALL_DATADIR "/" EC_PROGRAM "/" LOGO_FILE; if(g_file_test(path, G_FILE_TEST_EXISTS)) logo = gtk_image_new_from_file(path); else /* if neither path is valid gtk will use a broken image icon */ logo = gtk_image_new_from_file("./share/" LOGO_FILE); gtk_misc_set_alignment (GTK_MISC (logo), 0.5, 0.5); gtk_container_add(GTK_CONTAINER (notebook_frame), logo); gtk_widget_show(logo); /* messages */ scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN); gtk_paned_pack2(GTK_PANED (vpaned), scroll, FALSE, TRUE); gtk_widget_show(scroll); textview = gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW (textview), GTK_WRAP_WORD_CHAR); gtk_text_view_set_editable(GTK_TEXT_VIEW (textview), FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (textview), FALSE); gtk_widget_set_size_request(textview, -1, 140); gtk_container_add(GTK_CONTAINER (scroll), textview); gtk_widget_show(textview); msgbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (textview)); gtk_text_buffer_get_end_iter(msgbuffer, &iter); endmark = gtk_text_buffer_create_mark(msgbuffer, "end", &iter, FALSE); gtk_box_pack_end(GTK_BOX(vbox), vpaned, TRUE, TRUE, 0); gtk_widget_show(vpaned); gtk_widget_show(window); DEBUG_MSG("gtk_setup: end"); }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox3b; GtkWidget *toolbar1; GtkIconSize tmp_toolbar_icon_size; GtkWidget *toolbuttonOpen; GtkWidget *toolbuttonSave; GtkWidget *tmp_image; GtkWidget *toolbuttonScript; GtkWidget *toolbuttonDVD; GtkWidget *toolbuttonHalfD1; GtkWidget *toolbuttonSVCD; GtkWidget *toolbuttonVCD; GtkWidget *hbox11; GtkWidget *frame1; GtkWidget *alignment1; GtkWidget *vbox2; GtkWidget *notebook1; GtkWidget *scrolledwindow1; GtkWidget *treeview1; GtkWidget *hbox5; GtkWidget *image1; GtkWidget *label11; GtkWidget *scrolledwindow2; GtkWidget *treeview2; GtkWidget *hbox6; GtkWidget *image2; GtkWidget *label17; GtkWidget *scrolledwindow3; GtkWidget *treeview3; GtkWidget *hbox7; GtkWidget *image3; GtkWidget *label18; GtkWidget *scrolledwindow4; GtkWidget *treeview4; GtkWidget *hbox8; GtkWidget *image4; GtkWidget *label19; GtkWidget *scrolledwindow5; GtkWidget *treeview5; GtkWidget *hbox9; GtkWidget *image5; GtkWidget *label20; GtkWidget *scrolledwindow6; GtkWidget *treeview6; GtkWidget *hbox10; GtkWidget *image6; GtkWidget *label21; GtkWidget *scrolledwindow7; GtkWidget *treeview7; GtkWidget *hbox4; GtkWidget *image7; GtkWidget *label22; GtkWidget *treeview8; GtkWidget *label28; GtkWidget *hbox13; GtkWidget *buttonAdd; GtkWidget *image11; GtkWidget *label23; GtkWidget *frame2; GtkWidget *alignment2; GtkWidget *hbox1; GtkWidget *vbox3; GtkWidget *scrolledwindow9; GtkWidget *treeview0; GtkWidget *hbox14; GtkWidget *buttonRemove; GtkWidget *image15; GtkWidget *buttonDown; GtkWidget *image14; GtkWidget *buttonUp; GtkWidget *image13; GtkWidget *buttonPartial; GtkWidget *buttonProperties; GtkWidget *alignment4; GtkWidget *hbox16; GtkWidget *label25; GtkWidget *label2; GtkWidget *dialog_action_area1; GtkWidget *buttonPreview; GtkWidget *alignment5; GtkWidget *hbox17; GtkWidget *image17; GtkWidget *label26; GtkWidget *buttonClose; GtkAccelGroup *accel_group; GtkTooltips *tooltips; tooltips = gtk_tooltips_new (); accel_group = gtk_accel_group_new (); dialog1 = gtk_dialog_new (); gtk_container_set_border_width (GTK_CONTAINER (dialog1), 6); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Video Filter Manager")); gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_dialog_set_has_separator (GTK_DIALOG (dialog1), FALSE); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_box_set_spacing (GTK_BOX(dialog_vbox1), 12); gtk_widget_show (dialog_vbox1); vbox3b = gtk_vbox_new (FALSE, 12); gtk_widget_show (vbox3b); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox3b, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox3b), 6); toolbar1 = gtk_toolbar_new (); gtk_widget_show (toolbar1); gtk_box_pack_start (GTK_BOX (vbox3b), toolbar1, FALSE, FALSE, 0); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH); tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1)); toolbuttonOpen = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-open"); gtk_widget_show (toolbuttonOpen); gtk_container_add (GTK_CONTAINER (toolbar1), toolbuttonOpen); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbuttonOpen), tooltips, QT_TR_NOOP("Open filter list [Ctrl-O]"), NULL); gtk_widget_add_accelerator (toolbuttonOpen, "clicked", accel_group, GDK_O, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (toolbuttonOpen), TRUE); toolbuttonSave = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-save"); gtk_widget_show (toolbuttonSave); gtk_container_add (GTK_CONTAINER (toolbar1), toolbuttonSave); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbuttonSave), tooltips, QT_TR_NOOP("Save filter list [Ctrl-S]"), NULL); gtk_widget_add_accelerator (toolbuttonSave, "clicked", accel_group, GDK_S, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (toolbuttonSave), TRUE); tmp_image = gtk_image_new_from_stock ("gtk-save-as", tmp_toolbar_icon_size); gtk_widget_show (tmp_image); toolbuttonScript = (GtkWidget*) gtk_tool_button_new (tmp_image, QT_TR_NOOP("Save Script")); gtk_widget_show (toolbuttonScript); gtk_container_add (GTK_CONTAINER (toolbar1), toolbuttonScript); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbuttonScript), tooltips, QT_TR_NOOP("Save as script [Ctrl-J]"), NULL); gtk_widget_add_accelerator (toolbuttonScript, "clicked", accel_group, GDK_J, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (toolbuttonScript), TRUE); tmp_image = gtk_image_new_from_stock ("gtk-cdrom", tmp_toolbar_icon_size); gtk_widget_show (tmp_image); toolbuttonDVD = (GtkWidget*) gtk_tool_button_new (tmp_image, QT_TR_NOOP("DVD Res")); gtk_widget_show (toolbuttonDVD); gtk_container_add (GTK_CONTAINER (toolbar1), toolbuttonDVD); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbuttonDVD), tooltips, QT_TR_NOOP("DVD resolution [Ctrl-1]"), NULL); gtk_widget_add_accelerator (toolbuttonDVD, "clicked", accel_group, GDK_1, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (toolbuttonDVD), TRUE); tmp_image = gtk_image_new_from_stock ("gtk-cdrom", tmp_toolbar_icon_size); gtk_widget_show (tmp_image); toolbuttonHalfD1 = (GtkWidget*) gtk_tool_button_new (tmp_image, QT_TR_NOOP("Half D1 Res")); gtk_widget_show (toolbuttonHalfD1); gtk_container_add (GTK_CONTAINER (toolbar1), toolbuttonHalfD1); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbuttonHalfD1), tooltips, QT_TR_NOOP("Half D1 resolution [Ctrl-2]"), NULL); gtk_widget_add_accelerator (toolbuttonHalfD1, "clicked", accel_group, GDK_2, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (toolbuttonHalfD1), TRUE); tmp_image = gtk_image_new_from_stock ("gtk-cdrom", tmp_toolbar_icon_size); gtk_widget_show (tmp_image); toolbuttonSVCD = (GtkWidget*) gtk_tool_button_new (tmp_image, QT_TR_NOOP("SVCD Res")); gtk_widget_show (toolbuttonSVCD); gtk_container_add (GTK_CONTAINER (toolbar1), toolbuttonSVCD); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbuttonSVCD), tooltips, QT_TR_NOOP("SVCD resolution [Ctrl-3]"), NULL); gtk_widget_add_accelerator (toolbuttonSVCD, "clicked", accel_group, GDK_3, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (toolbuttonSVCD), TRUE); tmp_image = gtk_image_new_from_stock ("gtk-cdrom", tmp_toolbar_icon_size); gtk_widget_show (tmp_image); toolbuttonVCD = (GtkWidget*) gtk_tool_button_new (tmp_image, QT_TR_NOOP("VCD Res")); gtk_widget_show (toolbuttonVCD); gtk_container_add (GTK_CONTAINER (toolbar1), toolbuttonVCD); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbuttonVCD), tooltips, QT_TR_NOOP("VCD resolution [Ctrl-4]"), NULL); gtk_widget_add_accelerator (toolbuttonVCD, "clicked", accel_group, GDK_4, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (toolbuttonVCD), TRUE); hbox11 = gtk_hbox_new (FALSE, 12); gtk_widget_show (hbox11); gtk_box_pack_start (GTK_BOX (vbox3b), hbox11, TRUE, TRUE, 0); frame1 = gtk_frame_new (NULL); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (hbox11), frame1, TRUE, TRUE, 0); gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE); alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment1); gtk_container_add (GTK_CONTAINER (frame1), alignment1); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 6, 0, 18, 0); vbox2 = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox2); gtk_container_add (GTK_CONTAINER (alignment1), vbox2); notebook1 = gtk_notebook_new (); gtk_widget_show (notebook1); gtk_box_pack_start (GTK_BOX (vbox2), notebook1, TRUE, TRUE, 0); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook1), FALSE); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook1), GTK_POS_LEFT); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow1); gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow1); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); treeview1 = gtk_tree_view_new (); gtk_widget_show (treeview1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview1); gtk_widget_set_size_request (treeview1, 288, 336); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview1), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview1), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview1), FALSE); hbox5 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox5); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), hbox5); image1 = create_pixmap (dialog1, "1.png"); gtk_widget_show (image1); gtk_box_pack_start (GTK_BOX (hbox5), image1, FALSE, FALSE, 0); label11 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Transform")); gtk_widget_show (label11); gtk_box_pack_start (GTK_BOX (hbox5), label11, FALSE, FALSE, 4); gtk_label_set_use_markup (GTK_LABEL (label11), TRUE); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow2); gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow2); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); treeview2 = gtk_tree_view_new (); gtk_widget_show (treeview2); gtk_container_add (GTK_CONTAINER (scrolledwindow2), treeview2); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview2), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview2), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview2), FALSE); hbox6 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox6); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), hbox6); image2 = create_pixmap (dialog1, "2.png"); gtk_widget_show (image2); gtk_box_pack_start (GTK_BOX (hbox6), image2, FALSE, FALSE, 0); label17 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Interlacing")); gtk_widget_show (label17); gtk_box_pack_start (GTK_BOX (hbox6), label17, FALSE, FALSE, 4); scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow3); gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow3); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); treeview3 = gtk_tree_view_new (); gtk_widget_show (treeview3); gtk_container_add (GTK_CONTAINER (scrolledwindow3), treeview3); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview3), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview3), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview3), FALSE); hbox7 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox7); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), hbox7); image3 = create_pixmap (dialog1, "4.png"); gtk_widget_show (image3); gtk_box_pack_start (GTK_BOX (hbox7), image3, FALSE, FALSE, 0); label18 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Colors")); gtk_widget_show (label18); gtk_box_pack_start (GTK_BOX (hbox7), label18, FALSE, FALSE, 4); scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow4); gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow4); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); treeview4 = gtk_tree_view_new (); gtk_widget_show (treeview4); gtk_container_add (GTK_CONTAINER (scrolledwindow4), treeview4); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview4), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview4), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview4), FALSE); hbox8 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox8); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), hbox8); image4 = create_pixmap (dialog1, "5.png"); gtk_widget_show (image4); gtk_box_pack_start (GTK_BOX (hbox8), image4, FALSE, FALSE, 0); label19 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Noise")); gtk_widget_show (label19); gtk_box_pack_start (GTK_BOX (hbox8), label19, FALSE, FALSE, 4); scrolledwindow5 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow5); gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow5); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow5), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); treeview5 = gtk_tree_view_new (); gtk_widget_show (treeview5); gtk_container_add (GTK_CONTAINER (scrolledwindow5), treeview5); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview5), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview5), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview5), FALSE); hbox9 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox9); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 4), hbox9); image5 = create_pixmap (dialog1, "3.png"); gtk_widget_show (image5); gtk_box_pack_start (GTK_BOX (hbox9), image5, FALSE, FALSE, 0); label20 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Sharpness")); gtk_widget_show (label20); gtk_box_pack_start (GTK_BOX (hbox9), label20, FALSE, FALSE, 4); scrolledwindow6 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow6); gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow6); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow6), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); treeview6 = gtk_tree_view_new (); gtk_widget_show (treeview6); gtk_container_add (GTK_CONTAINER (scrolledwindow6), treeview6); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview6), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview6), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview6), FALSE); hbox10 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox10); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 5), hbox10); image6 = create_pixmap (dialog1, "7.png"); gtk_widget_show (image6); gtk_box_pack_start (GTK_BOX (hbox10), image6, FALSE, FALSE, 0); label21 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Subtitles")); gtk_widget_show (label21); gtk_box_pack_start (GTK_BOX (hbox10), label21, FALSE, FALSE, 4); scrolledwindow7 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow7); gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow7); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow7), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); treeview7 = gtk_tree_view_new (); gtk_widget_show (treeview7); gtk_container_add (GTK_CONTAINER (scrolledwindow7), treeview7); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview7), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview7), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview7), FALSE); hbox4 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox4); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 6), hbox4); image7 = create_pixmap (dialog1, "6.png"); gtk_widget_show (image7); gtk_box_pack_start (GTK_BOX (hbox4), image7, FALSE, FALSE, 0); label22 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Misc")); gtk_widget_show (label22); gtk_box_pack_start (GTK_BOX (hbox4), label22, FALSE, FALSE, 4); treeview8 = gtk_tree_view_new (); gtk_widget_show (treeview8); gtk_container_add (GTK_CONTAINER (notebook1), treeview8); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview8), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview8), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview8), FALSE); label28 = gtk_label_new (QT_TR_NOOP("External")); gtk_widget_show (label28); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 7), label28); hbox13 = gtk_hbox_new (FALSE, 6); gtk_widget_show (hbox13); gtk_box_pack_start (GTK_BOX (vbox2), hbox13, FALSE, FALSE, 0); buttonAdd = gtk_button_new (); gtk_widget_show (buttonAdd); gtk_box_pack_end (GTK_BOX (hbox13), buttonAdd, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, buttonAdd, QT_TR_NOOP("Add selected filter to the Active Filters list"), NULL); image11 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_BUTTON); gtk_widget_show (image11); gtk_container_add (GTK_CONTAINER (buttonAdd), image11); label23 = gtk_label_new (QT_TR_NOOP("<b>Available Filters</b>")); gtk_widget_show (label23); gtk_frame_set_label_widget (GTK_FRAME (frame1), label23); gtk_label_set_use_markup (GTK_LABEL (label23), TRUE); gtk_misc_set_alignment (GTK_MISC (label23), 1, 1); frame2 = gtk_frame_new (NULL); gtk_widget_show (frame2); gtk_box_pack_start (GTK_BOX (hbox11), frame2, TRUE, TRUE, 0); gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE); alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment2); gtk_container_add (GTK_CONTAINER (frame2), alignment2); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 6, 0, 18, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_container_add (GTK_CONTAINER (alignment2), hbox1); vbox3 = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox3); gtk_box_pack_start (GTK_BOX (hbox1), vbox3, TRUE, TRUE, 0); scrolledwindow9 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow9); gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow9, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow9), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow9), GTK_SHADOW_OUT); treeview0 = gtk_tree_view_new (); gtk_widget_show (treeview0); gtk_container_add (GTK_CONTAINER (scrolledwindow9), treeview0); gtk_widget_set_size_request (treeview0, 288, 336); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview0), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview0), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview0), FALSE); hbox14 = gtk_hbox_new (FALSE, 6); gtk_widget_show (hbox14); gtk_box_pack_start (GTK_BOX (vbox3), hbox14, FALSE, FALSE, 0); buttonRemove = gtk_button_new (); gtk_widget_show (buttonRemove); gtk_box_pack_end (GTK_BOX (hbox14), buttonRemove, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, buttonRemove, QT_TR_NOOP("Remove filter"), NULL); image15 = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_BUTTON); gtk_widget_show (image15); gtk_container_add (GTK_CONTAINER (buttonRemove), image15); buttonDown = gtk_button_new (); gtk_widget_show (buttonDown); gtk_box_pack_end (GTK_BOX (hbox14), buttonDown, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, buttonDown, QT_TR_NOOP("Move filter down"), NULL); image14 = gtk_image_new_from_icon_name ("gtk-go-down", GTK_ICON_SIZE_BUTTON); gtk_widget_show (image14); gtk_container_add (GTK_CONTAINER (buttonDown), image14); buttonUp = gtk_button_new (); gtk_widget_show (buttonUp); gtk_box_pack_end (GTK_BOX (hbox14), buttonUp, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, buttonUp, QT_TR_NOOP("Move filter up"), NULL); image13 = gtk_image_new_from_icon_name ("gtk-go-up", GTK_ICON_SIZE_BUTTON); gtk_widget_show (image13); gtk_container_add (GTK_CONTAINER (buttonUp), image13); buttonPartial = gtk_button_new_with_mnemonic (QT_TR_NOOP("P_artial")); gtk_widget_show (buttonPartial); gtk_box_pack_end (GTK_BOX (hbox14), buttonPartial, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, buttonPartial, QT_TR_NOOP("Apply the current filter only to a part of the file"), NULL); buttonProperties = gtk_button_new (); gtk_widget_show (buttonProperties); gtk_box_pack_end (GTK_BOX (hbox14), buttonProperties, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, buttonProperties, QT_TR_NOOP("Configure filter"), NULL); alignment4 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment4); gtk_container_add (GTK_CONTAINER (buttonProperties), alignment4); hbox16 = gtk_hbox_new (FALSE, 2); gtk_widget_show (hbox16); gtk_container_add (GTK_CONTAINER (alignment4), hbox16); label25 = gtk_label_new_with_mnemonic (QT_TR_NOOP("C_onfigure")); gtk_widget_show (label25); gtk_box_pack_start (GTK_BOX (hbox16), label25, FALSE, FALSE, 0); label2 = gtk_label_new (QT_TR_NOOP("<b >Active Filters</b>")); gtk_widget_show (label2); gtk_frame_set_label_widget (GTK_FRAME (frame2), label2); gtk_label_set_use_markup (GTK_LABEL (label2), TRUE); gtk_misc_set_alignment (GTK_MISC (label2), 1, 1); dialog_action_area1 = GTK_DIALOG (dialog1)->action_area; gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); buttonPreview = gtk_button_new (); gtk_widget_show (buttonPreview); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), buttonPreview, GTK_RESPONSE_APPLY); GTK_WIDGET_SET_FLAGS (buttonPreview, GTK_CAN_DEFAULT); alignment5 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment5); gtk_container_add (GTK_CONTAINER (buttonPreview), alignment5); hbox17 = gtk_hbox_new (FALSE, 2); gtk_widget_show (hbox17); gtk_container_add (GTK_CONTAINER (alignment5), hbox17); image17 = create_pixmap (dialog1, "preview-button.png"); gtk_widget_show (image17); gtk_box_pack_start (GTK_BOX (hbox17), image17, FALSE, FALSE, 0); label26 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Preview")); gtk_widget_show (label26); gtk_box_pack_start (GTK_BOX (hbox17), label26, FALSE, FALSE, 0); buttonClose = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (buttonClose); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), buttonClose, GTK_RESPONSE_CLOSE); GTK_WIDGET_SET_FLAGS (buttonClose, GTK_CAN_DEFAULT); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (dialog1, vbox3b, "vbox3b"); GLADE_HOOKUP_OBJECT (dialog1, toolbar1, "toolbar1"); GLADE_HOOKUP_OBJECT (dialog1, toolbuttonOpen, "toolbuttonOpen"); GLADE_HOOKUP_OBJECT (dialog1, toolbuttonSave, "toolbuttonSave"); GLADE_HOOKUP_OBJECT (dialog1, toolbuttonScript, "toolbuttonScript"); GLADE_HOOKUP_OBJECT (dialog1, toolbuttonDVD, "toolbuttonDVD"); GLADE_HOOKUP_OBJECT (dialog1, toolbuttonHalfD1, "toolbuttonHalfD1"); GLADE_HOOKUP_OBJECT (dialog1, toolbuttonSVCD, "toolbuttonSVCD"); GLADE_HOOKUP_OBJECT (dialog1, toolbuttonVCD, "toolbuttonVCD"); GLADE_HOOKUP_OBJECT (dialog1, hbox11, "hbox11"); GLADE_HOOKUP_OBJECT (dialog1, frame1, "frame1"); GLADE_HOOKUP_OBJECT (dialog1, alignment1, "alignment1"); GLADE_HOOKUP_OBJECT (dialog1, vbox2, "vbox2"); GLADE_HOOKUP_OBJECT (dialog1, notebook1, "notebook1"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow1, "scrolledwindow1"); GLADE_HOOKUP_OBJECT (dialog1, treeview1, "treeview1"); GLADE_HOOKUP_OBJECT (dialog1, hbox5, "hbox5"); GLADE_HOOKUP_OBJECT (dialog1, image1, "image1"); GLADE_HOOKUP_OBJECT (dialog1, label11, "label11"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow2, "scrolledwindow2"); GLADE_HOOKUP_OBJECT (dialog1, treeview2, "treeview2"); GLADE_HOOKUP_OBJECT (dialog1, hbox6, "hbox6"); GLADE_HOOKUP_OBJECT (dialog1, image2, "image2"); GLADE_HOOKUP_OBJECT (dialog1, label17, "label17"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow3, "scrolledwindow3"); GLADE_HOOKUP_OBJECT (dialog1, treeview3, "treeview3"); GLADE_HOOKUP_OBJECT (dialog1, hbox7, "hbox7"); GLADE_HOOKUP_OBJECT (dialog1, image3, "image3"); GLADE_HOOKUP_OBJECT (dialog1, label18, "label18"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow4, "scrolledwindow4"); GLADE_HOOKUP_OBJECT (dialog1, treeview4, "treeview4"); GLADE_HOOKUP_OBJECT (dialog1, hbox8, "hbox8"); GLADE_HOOKUP_OBJECT (dialog1, image4, "image4"); GLADE_HOOKUP_OBJECT (dialog1, label19, "label19"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow5, "scrolledwindow5"); GLADE_HOOKUP_OBJECT (dialog1, treeview5, "treeview5"); GLADE_HOOKUP_OBJECT (dialog1, hbox9, "hbox9"); GLADE_HOOKUP_OBJECT (dialog1, image5, "image5"); GLADE_HOOKUP_OBJECT (dialog1, label20, "label20"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow6, "scrolledwindow6"); GLADE_HOOKUP_OBJECT (dialog1, treeview6, "treeview6"); GLADE_HOOKUP_OBJECT (dialog1, hbox10, "hbox10"); GLADE_HOOKUP_OBJECT (dialog1, image6, "image6"); GLADE_HOOKUP_OBJECT (dialog1, label21, "label21"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow7, "scrolledwindow7"); GLADE_HOOKUP_OBJECT (dialog1, treeview7, "treeview7"); GLADE_HOOKUP_OBJECT (dialog1, hbox4, "hbox4"); GLADE_HOOKUP_OBJECT (dialog1, image7, "image7"); GLADE_HOOKUP_OBJECT (dialog1, label22, "label22"); GLADE_HOOKUP_OBJECT (dialog1, treeview8, "treeview8"); GLADE_HOOKUP_OBJECT (dialog1, label28, "label28"); GLADE_HOOKUP_OBJECT (dialog1, hbox13, "hbox13"); GLADE_HOOKUP_OBJECT (dialog1, buttonAdd, "buttonAdd"); GLADE_HOOKUP_OBJECT (dialog1, image11, "image11"); GLADE_HOOKUP_OBJECT (dialog1, label23, "label23"); GLADE_HOOKUP_OBJECT (dialog1, frame2, "frame2"); GLADE_HOOKUP_OBJECT (dialog1, alignment2, "alignment2"); GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (dialog1, vbox3, "vbox3"); GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow9, "scrolledwindow9"); GLADE_HOOKUP_OBJECT (dialog1, treeview0, "treeview0"); GLADE_HOOKUP_OBJECT (dialog1, hbox14, "hbox14"); GLADE_HOOKUP_OBJECT (dialog1, buttonRemove, "buttonRemove"); GLADE_HOOKUP_OBJECT (dialog1, image15, "image15"); GLADE_HOOKUP_OBJECT (dialog1, buttonDown, "buttonDown"); GLADE_HOOKUP_OBJECT (dialog1, image14, "image14"); GLADE_HOOKUP_OBJECT (dialog1, buttonUp, "buttonUp"); GLADE_HOOKUP_OBJECT (dialog1, image13, "image13"); GLADE_HOOKUP_OBJECT (dialog1, buttonPartial, "buttonPartial"); GLADE_HOOKUP_OBJECT (dialog1, buttonProperties, "buttonProperties"); GLADE_HOOKUP_OBJECT (dialog1, alignment4, "alignment4"); GLADE_HOOKUP_OBJECT (dialog1, hbox16, "hbox16"); GLADE_HOOKUP_OBJECT (dialog1, label25, "label25"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, buttonPreview, "buttonPreview"); GLADE_HOOKUP_OBJECT (dialog1, alignment5, "alignment5"); GLADE_HOOKUP_OBJECT (dialog1, hbox17, "hbox17"); GLADE_HOOKUP_OBJECT (dialog1, image17, "image17"); GLADE_HOOKUP_OBJECT (dialog1, label26, "label26"); GLADE_HOOKUP_OBJECT (dialog1, buttonClose, "buttonClose"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, tooltips, "tooltips"); gtk_window_add_accel_group (GTK_WINDOW (dialog1), accel_group); return dialog1; }
int dt_gui_gtk_init(dt_gui_gtk_t *gui, int argc, char *argv[]) { // unset gtk rc from kde: char gtkrc[PATH_MAX], path[PATH_MAX], datadir[PATH_MAX], configdir[PATH_MAX]; dt_loc_get_datadir(datadir, PATH_MAX); dt_loc_get_user_config_dir(configdir, PATH_MAX); g_snprintf(gtkrc, PATH_MAX, "%s/darktable.gtkrc", configdir); if (!g_file_test(gtkrc, G_FILE_TEST_EXISTS)) g_snprintf(gtkrc, PATH_MAX, "%s/darktable.gtkrc", datadir); if (g_file_test(gtkrc, G_FILE_TEST_EXISTS)) (void)setenv("GTK2_RC_FILES", gtkrc, 1); else fprintf(stderr, "[gtk_init] could not found darktable.gtkrc"); /* lets zero mem */ memset(gui,0,sizeof(dt_gui_gtk_t)); #if GLIB_MAJOR_VERSION <= 2 #if GLIB_MINOR_VERSION < 31 if (!g_thread_supported ()) g_thread_init(NULL); #endif #endif gdk_threads_init(); gdk_threads_enter(); gtk_init (&argc, &argv); GtkWidget *widget; gui->ui = dt_ui_initialize(argc,argv); gui->pixmap = NULL; gui->center_tooltip = 0; gui->presets_popup_menu = NULL; if(g_file_test(gtkrc, G_FILE_TEST_EXISTS)) gtk_rc_parse (gtkrc); // Initializing the shortcut groups darktable.control->accelerators = gtk_accel_group_new(); darktable.control->accelerator_list = NULL; // Connecting the callback to update keyboard accels for key_pressed g_signal_connect(G_OBJECT(gtk_accel_map_get()), "changed", G_CALLBACK(key_accel_changed), NULL); // Initializing widgets init_widgets(); // Adding the global shortcut group to the main window gtk_window_add_accel_group(GTK_WINDOW(dt_ui_main_window(darktable.gui->ui)), darktable.control->accelerators); // get the screen resolution gui->dpi = gdk_screen_get_resolution(gtk_widget_get_screen(GTK_WIDGET(dt_ui_main_window(darktable.gui->ui)))); // set constant width from conf key int panel_width = dt_conf_get_int("panel_width"); if(panel_width < 20 || panel_width > 500) { // fix for unset/insane values. panel_width = 300; dt_conf_set_int("panel_width", panel_width); } // dt_gui_background_jobs_init(); /* Have the delete event (window close) end the program */ dt_loc_get_datadir(datadir, PATH_MAX); snprintf(path, PATH_MAX, "%s/icons", datadir); gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), path); widget = dt_ui_center(darktable.gui->ui); g_signal_connect (G_OBJECT (widget), "key-press-event", G_CALLBACK (key_pressed), NULL); g_signal_connect (G_OBJECT (widget), "configure-event", G_CALLBACK (configure), NULL); g_signal_connect (G_OBJECT (widget), "expose-event", G_CALLBACK (expose), NULL); g_signal_connect (G_OBJECT (widget), "motion-notify-event", G_CALLBACK (mouse_moved), NULL); g_signal_connect (G_OBJECT (widget), "leave-notify-event", G_CALLBACK (center_leave), NULL); g_signal_connect (G_OBJECT (widget), "enter-notify-event", G_CALLBACK (center_enter), NULL); g_signal_connect (G_OBJECT (widget), "button-press-event", G_CALLBACK (button_pressed), NULL); g_signal_connect (G_OBJECT (widget), "button-release-event", G_CALLBACK (button_released), NULL); g_signal_connect (G_OBJECT (widget), "scroll-event", G_CALLBACK (scrolled), NULL); // TODO: left, right, top, bottom: //leave-notify-event widget = darktable.gui->widgets.left_border; g_signal_connect (G_OBJECT (widget), "expose-event", G_CALLBACK (expose_borders), (gpointer)0); g_signal_connect (G_OBJECT (widget), "button-press-event", G_CALLBACK (borders_button_pressed), darktable.gui->ui); g_signal_connect (G_OBJECT (widget), "scroll-event", G_CALLBACK (borders_scrolled), (gpointer)0); g_object_set_data(G_OBJECT (widget), "border", (gpointer)0); widget = darktable.gui->widgets.right_border; g_signal_connect (G_OBJECT (widget), "expose-event", G_CALLBACK (expose_borders), (gpointer)1); g_signal_connect (G_OBJECT (widget), "button-press-event", G_CALLBACK (borders_button_pressed), darktable.gui->ui); g_signal_connect (G_OBJECT (widget), "scroll-event", G_CALLBACK (borders_scrolled), (gpointer)1); g_object_set_data(G_OBJECT (widget), "border", (gpointer)1); widget = darktable.gui->widgets.top_border; g_signal_connect (G_OBJECT (widget), "expose-event", G_CALLBACK (expose_borders), (gpointer)2); g_signal_connect (G_OBJECT (widget), "button-press-event", G_CALLBACK (borders_button_pressed), darktable.gui->ui); g_signal_connect (G_OBJECT (widget), "scroll-event", G_CALLBACK (borders_scrolled), (gpointer)2); g_object_set_data(G_OBJECT (widget), "border", (gpointer)2); widget = darktable.gui->widgets.bottom_border; g_signal_connect (G_OBJECT (widget), "expose-event", G_CALLBACK (expose_borders), (gpointer)3); g_signal_connect (G_OBJECT (widget), "button-press-event", G_CALLBACK (borders_button_pressed), darktable.gui->ui); g_signal_connect (G_OBJECT (widget), "scroll-event", G_CALLBACK (borders_scrolled), (gpointer)3); g_object_set_data(G_OBJECT (widget), "border", (gpointer)3); dt_gui_presets_init(); widget = dt_ui_center(darktable.gui->ui); GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED); // GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED); GTK_WIDGET_SET_FLAGS (widget, GTK_APP_PAINTABLE); // TODO: make this work as: libgnomeui testgnome.c /* GtkContainer *box = GTK_CONTAINER(darktable.gui->widgets.plugins_vbox); GtkScrolledWindow *swin = GTK_SCROLLED_WINDOW(darktable.gui-> widgets.right_scrolled_window); gtk_container_set_focus_vadjustment (box, gtk_scrolled_window_get_vadjustment (swin)); */ dt_ctl_get_display_profile(widget, &darktable.control->xprofile_data, &darktable.control->xprofile_size); // register keys for view switching dt_accel_register_global(NC_("accel", "capture view"), GDK_t, 0); dt_accel_register_global(NC_("accel", "lighttable view"), GDK_l, 0); dt_accel_register_global(NC_("accel", "darkroom view"), GDK_d, 0); dt_accel_connect_global( "capture view", g_cclosure_new(G_CALLBACK(_gui_switch_view_key_accel_callback), (gpointer)DT_GUI_VIEW_SWITCH_TO_TETHERING, NULL)); dt_accel_connect_global( "lighttable view", g_cclosure_new(G_CALLBACK(_gui_switch_view_key_accel_callback), (gpointer)DT_GUI_VIEW_SWITCH_TO_LIBRARY, NULL)); dt_accel_connect_global( "darkroom view", g_cclosure_new(G_CALLBACK(_gui_switch_view_key_accel_callback), (gpointer)DT_GUI_VIEW_SWITCH_TO_DARKROOM, NULL)); // register_keys for applying styles init_styles_key_accels(); connect_styles_key_accels(); // register ctrl-q to quit: dt_accel_register_global(NC_("accel", "quit"), GDK_q, GDK_CONTROL_MASK); dt_accel_connect_global( "quit", g_cclosure_new(G_CALLBACK(quit_callback), NULL, NULL)); // Contrast and brightness accelerators dt_accel_register_global(NC_("accel", "increase brightness"), GDK_F10, 0); dt_accel_register_global(NC_("accel", "decrease brightness"), GDK_F9, 0); dt_accel_register_global(NC_("accel", "increase contrast"), GDK_F8, 0); dt_accel_register_global(NC_("accel", "decrease contrast"), GDK_F7, 0); dt_accel_connect_global( "increase brightness", g_cclosure_new(G_CALLBACK(brightness_key_accel_callback), (gpointer)1, NULL)); dt_accel_connect_global( "decrease brightness", g_cclosure_new(G_CALLBACK(brightness_key_accel_callback), (gpointer)0, NULL)); dt_accel_connect_global( "increase contrast", g_cclosure_new(G_CALLBACK(contrast_key_accel_callback), (gpointer)1, NULL)); dt_accel_connect_global( "decrease contrast", g_cclosure_new(G_CALLBACK(contrast_key_accel_callback), (gpointer)0, NULL)); // Full-screen accelerators dt_accel_register_global(NC_("accel", "toggle fullscreen"), GDK_F11, 0); dt_accel_register_global(NC_("accel", "leave fullscreen"), GDK_Escape, 0); dt_accel_connect_global( "toggle fullscreen", g_cclosure_new(G_CALLBACK(fullscreen_key_accel_callback), (gpointer)1, NULL)); dt_accel_connect_global( "leave fullscreen", g_cclosure_new(G_CALLBACK(fullscreen_key_accel_callback), (gpointer)0, NULL)); // Side-border hide/show dt_accel_register_global(NC_("accel", "toggle side borders"), GDK_Tab, 0); // toggle view of header dt_accel_register_global(NC_("accel", "toggle header"), GDK_h, GDK_CONTROL_MASK); // View-switch dt_accel_register_global(NC_("accel", "switch view"), GDK_period, 0); dt_accel_connect_global( "switch view", g_cclosure_new(G_CALLBACK(view_switch_key_accel_callback), NULL, NULL)); darktable.gui->reset = 0; for(int i=0; i<3; i++) darktable.gui->bgcolor[i] = 0.1333; /* apply contrast to theme */ dt_gui_contrast_init (); return 0; }
GtkWindow * gw_msg_box_create ( GtkWindow *window, gchar *title, gchar *subject) { /*static */GtkWidget *w = NULL; GtkWidget *vbox,*label,*button,*hbox; GtkAccelGroup *accel; guint button_key; gchar *text_utf8 = NULL; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : title=%s subject=%s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, title, subject); #endif if ( !w ) { #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() new dialog window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif accel = gtk_accel_group_new ( ); w = gtk_window_new ( GTK_WINDOW_DIALOG); gtk_window_set_policy ( GTK_WINDOW ( w), FALSE, FALSE, TRUE); g_strdup_to_gtk_text ( title, text_utf8); gtk_window_set_title ( GTK_WINDOW ( w), text_utf8); g_free ( text_utf8); gtk_container_border_width ( GTK_CONTAINER ( w), 10); gtk_window_set_modal ( GTK_WINDOW ( w),TRUE); gtk_window_set_transient_for ( GTK_WINDOW ( w), window); gtk_window_set_position ( GTK_WINDOW ( w), GTK_WIN_POS_CENTER); #ifdef HAVE_GTK12 gtk_signal_connect ( GTK_OBJECT ( w), "destroy", GTK_SIGNAL_FUNC ( gtk_widget_destroyed), &w); #endif vbox = gtk_vbox_new ( TRUE, 10); gtk_container_add ( GTK_CONTAINER ( w), vbox); gtk_container_set_border_width ( GTK_CONTAINER ( vbox), 10); g_strdup_to_gtk_text ( subject, text_utf8); label = gtk_label_new ( text_utf8); gtk_label_set_text ( GTK_LABEL ( label), text_utf8); g_free ( text_utf8); gtk_box_pack_start ( GTK_BOX ( vbox), label, FALSE, FALSE, 0); /* The Ok button area */ hbox = gtk_hbutton_box_new ( ); gtk_button_box_set_layout ( GTK_BUTTON_BOX ( hbox), GTK_BUTTONBOX_EDGE); gtk_button_box_set_spacing ( GTK_BUTTON_BOX ( hbox), 5); gtk_box_pack_end ( GTK_BOX ( vbox), hbox, FALSE, FALSE, 0); button = gtk_button_new_with_label ( ""); g_strdup_to_gtk_text ( _( "_OK"), text_utf8); button_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( button)->child), text_utf8); g_free ( text_utf8); gtk_widget_add_accelerator ( button, "clicked", accel, button_key, GDK_MOD1_MASK, 0); gtk_object_set_user_data ( GTK_OBJECT ( button), w); gtk_box_pack_start ( GTK_BOX ( hbox), button, TRUE, FALSE, 0); gtk_signal_connect_object ( GTK_OBJECT ( button), "clicked", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w)); GTK_WIDGET_SET_FLAGS ( button, GTK_CAN_FOCUS); gtk_widget_grab_focus ( button); gtk_window_add_accel_group ( GTK_WINDOW ( w), accel); } if ( !GTK_WIDGET_VISIBLE ( w)) { gtk_widget_show_all ( w); } else { gtk_widget_destroy ( w); } return GTK_WINDOW ( w); }
static GtkWidget *create_window(void) { GtkWidget *startwin; GtkWidget *hlayout; GtkWidget *banner; GtkWidget *vlayout; GtkWidget *tabs; GtkWidget *configvlayout; GtkWidget *configlayout; GtkWidget *vmode3dlabel; GtkWidget *vmode3dcombo; GtkWidget *fullscreencheck; GtkWidget *alwaysshowcheck; GtkWidget *configtab; GtkWidget *messagesscroll; GtkWidget *messagestext; GtkWidget *messagestab; GtkWidget *buttons; GtkWidget *cancelbutton; GtkWidget *cancelbuttonalign; GtkWidget *cancelbuttonlayout; GtkWidget *cancelbuttonicon; GtkWidget *cancelbuttonlabel; GtkWidget *startbutton; GtkWidget *startbuttonalign; GtkWidget *startbuttonlayout; GtkWidget *startbuttonicon; GtkWidget *startbuttonlabel; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new(); // Basic window startwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(startwin), apptitle); // NOTE: use global app title gtk_window_set_position(GTK_WINDOW(startwin), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW(startwin), FALSE); gtk_window_set_type_hint(GTK_WINDOW(startwin), GDK_WINDOW_TYPE_HINT_DIALOG); // Horizontal layout of banner and controls hlayout = gtk_hbox_new(FALSE, 0); gtk_widget_show(hlayout); gtk_container_add(GTK_CONTAINER(startwin), hlayout); // Banner { GdkPixbuf *pixbuf = load_banner(); banner = gtk_image_new_from_pixbuf(pixbuf); g_object_unref((gpointer)pixbuf); } gtk_widget_show(banner); gtk_box_pack_start(GTK_BOX(hlayout), banner, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(banner), 0.5, 0); // Vertical layout of tab control and start+cancel buttons vlayout = gtk_vbox_new(FALSE, 0); gtk_widget_show(vlayout); gtk_box_pack_start(GTK_BOX(hlayout), vlayout, TRUE, TRUE, 0); // Tab control tabs = gtk_notebook_new(); gtk_widget_show(tabs); gtk_box_pack_start(GTK_BOX(vlayout), tabs, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(tabs), 4); // Vertical layout of config page main body configvlayout = gtk_vbox_new(FALSE, 0); gtk_widget_show(configvlayout); gtk_container_add(GTK_CONTAINER(tabs), configvlayout); // Fixed-position layout of config page controls configlayout = gtk_fixed_new(); gtk_widget_show(configlayout); gtk_box_pack_start(GTK_BOX(configvlayout), configlayout, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(configlayout), 6); // 3D video mode label vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:"); gtk_widget_show(vmode3dlabel); gtk_fixed_put(GTK_FIXED(configlayout), vmode3dlabel, 0, 0); gtk_widget_set_size_request(vmode3dlabel, 88, 29); gtk_misc_set_alignment(GTK_MISC(vmode3dlabel), 0, 0.5); // 3D video mode combo { GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); GtkCellRenderer *cell; vmode3dcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list)); g_object_unref(G_OBJECT(list)); cell = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(vmode3dcombo), cell, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode3dcombo), cell, "text", 0, NULL); } gtk_widget_show(vmode3dcombo); gtk_fixed_put(GTK_FIXED(configlayout), vmode3dcombo, 88, 0); gtk_widget_set_size_request(vmode3dcombo, 150, 29); gtk_widget_add_accelerator(vmode3dcombo, "grab_focus", accel_group, GDK_V, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); // Fullscreen checkbox fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen"); gtk_widget_show(fullscreencheck); gtk_fixed_put(GTK_FIXED(configlayout), fullscreencheck, 248, 0); gtk_widget_set_size_request(fullscreencheck, 85, 29); gtk_widget_add_accelerator(fullscreencheck, "grab_focus", accel_group, GDK_F, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); // Always show config checkbox alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start"); gtk_widget_show(alwaysshowcheck); gtk_box_pack_start(GTK_BOX(configvlayout), alwaysshowcheck, FALSE, FALSE, 0); gtk_widget_add_accelerator(alwaysshowcheck, "grab_focus", accel_group, GDK_A, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); // Configuration tab configtab = gtk_label_new("Configuration"); gtk_widget_show(configtab); gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 0), configtab); // Messages scrollable area messagesscroll = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(messagesscroll); gtk_container_add(GTK_CONTAINER(tabs), messagesscroll); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); // Messages text area messagestext = gtk_text_view_new(); gtk_widget_show(messagestext); gtk_container_add(GTK_CONTAINER(messagesscroll), messagestext); gtk_text_view_set_editable(GTK_TEXT_VIEW(messagestext), FALSE); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(messagestext), GTK_WRAP_WORD); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(messagestext), FALSE); gtk_text_view_set_left_margin(GTK_TEXT_VIEW(messagestext), 2); gtk_text_view_set_right_margin(GTK_TEXT_VIEW(messagestext), 2); // Messages tab messagestab = gtk_label_new("Messages"); gtk_widget_show(messagestab); gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 1), messagestab); // Dialogue box buttons layout buttons = gtk_hbutton_box_new(); gtk_widget_show(buttons); gtk_box_pack_start(GTK_BOX(vlayout), buttons, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(buttons), 3); gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons), GTK_BUTTONBOX_END); // Cancel button cancelbutton = gtk_button_new(); gtk_widget_show(cancelbutton); gtk_container_add(GTK_CONTAINER(buttons), cancelbutton); GTK_WIDGET_SET_FLAGS(cancelbutton, GTK_CAN_DEFAULT); gtk_widget_add_accelerator(cancelbutton, "grab_focus", accel_group, GDK_C, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(cancelbutton, "clicked", accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE); cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_widget_show(cancelbuttonalign); gtk_container_add(GTK_CONTAINER(cancelbutton), cancelbuttonalign); cancelbuttonlayout = gtk_hbox_new(FALSE, 2); gtk_widget_show(cancelbuttonlayout); gtk_container_add(GTK_CONTAINER(cancelbuttonalign), cancelbuttonlayout); cancelbuttonicon = gtk_image_new_from_stock("gtk-cancel", GTK_ICON_SIZE_BUTTON); gtk_widget_show(cancelbuttonicon); gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonicon, FALSE, FALSE, 0); cancelbuttonlabel = gtk_label_new_with_mnemonic("_Cancel"); gtk_widget_show(cancelbuttonlabel); gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonlabel, FALSE, FALSE, 0); // Start button startbutton = gtk_button_new(); gtk_widget_show(startbutton); gtk_container_add(GTK_CONTAINER(buttons), startbutton); GTK_WIDGET_SET_FLAGS(startbutton, GTK_CAN_DEFAULT); gtk_widget_add_accelerator(startbutton, "grab_focus", accel_group, GDK_S, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(startbutton, "clicked", accel_group, GDK_Return, 0, GTK_ACCEL_VISIBLE); startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_widget_show(startbuttonalign); gtk_container_add(GTK_CONTAINER(startbutton), startbuttonalign); startbuttonlayout = gtk_hbox_new(FALSE, 2); gtk_widget_show(startbuttonlayout); gtk_container_add(GTK_CONTAINER(startbuttonalign), startbuttonlayout); startbuttonicon = gtk_image_new_from_stock("gtk-execute", GTK_ICON_SIZE_BUTTON); gtk_widget_show(startbuttonicon); gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonicon, FALSE, FALSE, 0); startbuttonlabel = gtk_label_new_with_mnemonic("_Start"); gtk_widget_show(startbuttonlabel); gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonlabel, FALSE, FALSE, 0); // Wire up the signals g_signal_connect((gpointer) startwin, "delete_event", G_CALLBACK(on_startwin_delete_event), NULL); g_signal_connect((gpointer) vmode3dcombo, "changed", G_CALLBACK(on_vmode3dcombo_changed), NULL); g_signal_connect((gpointer) fullscreencheck, "toggled", G_CALLBACK(on_fullscreencheck_toggled), NULL); g_signal_connect((gpointer) alwaysshowcheck, "toggled", G_CALLBACK(on_alwaysshowcheck_toggled), NULL); g_signal_connect((gpointer) cancelbutton, "clicked", G_CALLBACK(on_cancelbutton_clicked), NULL); g_signal_connect((gpointer) startbutton, "clicked", G_CALLBACK(on_startbutton_clicked), NULL); // Associate labels with their controls gtk_label_set_mnemonic_widget(GTK_LABEL(vmode3dlabel), vmode3dcombo); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF(startwin, startwin, "startwin"); GLADE_HOOKUP_OBJECT(startwin, hlayout, "hlayout"); GLADE_HOOKUP_OBJECT(startwin, banner, "banner"); GLADE_HOOKUP_OBJECT(startwin, vlayout, "vlayout"); GLADE_HOOKUP_OBJECT(startwin, tabs, "tabs"); GLADE_HOOKUP_OBJECT(startwin, configvlayout, "configvlayout"); GLADE_HOOKUP_OBJECT(startwin, configlayout, "configlayout"); GLADE_HOOKUP_OBJECT(startwin, vmode3dlabel, "vmode3dlabel"); GLADE_HOOKUP_OBJECT(startwin, vmode3dcombo, "vmode3dcombo"); GLADE_HOOKUP_OBJECT(startwin, fullscreencheck, "fullscreencheck"); GLADE_HOOKUP_OBJECT(startwin, alwaysshowcheck, "alwaysshowcheck"); GLADE_HOOKUP_OBJECT(startwin, configtab, "configtab"); GLADE_HOOKUP_OBJECT(startwin, messagesscroll, "messagesscroll"); GLADE_HOOKUP_OBJECT(startwin, messagestext, "messagestext"); GLADE_HOOKUP_OBJECT(startwin, messagestab, "messagestab"); GLADE_HOOKUP_OBJECT(startwin, buttons, "buttons"); GLADE_HOOKUP_OBJECT(startwin, cancelbutton, "cancelbutton"); GLADE_HOOKUP_OBJECT(startwin, cancelbuttonalign, "cancelbuttonalign"); GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlayout, "cancelbuttonlayout"); GLADE_HOOKUP_OBJECT(startwin, cancelbuttonicon, "cancelbuttonicon"); GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlabel, "cancelbuttonlabel"); GLADE_HOOKUP_OBJECT(startwin, startbutton, "startbutton"); GLADE_HOOKUP_OBJECT(startwin, startbuttonalign, "startbuttonalign"); GLADE_HOOKUP_OBJECT(startwin, startbuttonlayout, "startbuttonlayout"); GLADE_HOOKUP_OBJECT(startwin, startbuttonicon, "startbuttonicon"); GLADE_HOOKUP_OBJECT(startwin, startbuttonlabel, "startbuttonlabel"); gtk_window_add_accel_group(GTK_WINDOW(startwin), accel_group); return startwin; }
void DoCommandListDlg() { command_list_dialog_t dialog; GtkWindow* window = create_modal_dialog_window(MainFrame_getWindow(), "Mapped Commands", dialog, -1, 400); GtkAccelGroup* accel = gtk_accel_group_new(); gtk_window_add_accel_group(window, accel); GtkHBox* hbox = create_dialog_hbox(4, 4); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(hbox)); { GtkScrolledWindow* scr = create_scrolled_window(GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(scr), TRUE, TRUE, 0); { GtkListStore* store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); { GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Command", renderer, "text", 0, 0); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); } { GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Key", renderer, "text", 1, 0); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); } gtk_widget_show(view); gtk_container_add(GTK_CONTAINER (scr), view); { // Initialize dialog StringOutputStream path(256); path << SettingsPath_get() << "commandlist.txt"; globalOutputStream() << "Writing the command list to " << path.c_str() << "\n"; class BuildCommandList : public CommandVisitor { TextFileOutputStream m_commandList; GtkListStore* m_store; public: BuildCommandList(const char* filename, GtkListStore* store) : m_commandList(filename), m_store(store) { } void visit(const char* name, Accelerator& accelerator) { StringOutputStream modifiers; modifiers << accelerator; { GtkTreeIter iter; gtk_list_store_append(m_store, &iter); gtk_list_store_set(m_store, &iter, 0, name, 1, modifiers.c_str(), -1); } if(!m_commandList.failed()) { m_commandList << makeLeftJustified(name, 25) << " " << modifiers.c_str() << '\n'; } } } visitor(path.c_str(), store); GlobalShortcuts_foreach(visitor); } g_object_unref(G_OBJECT(store)); } } GtkVBox* vbox = create_dialog_vbox(4); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(vbox), FALSE, FALSE, 0); { GtkButton* button = create_modal_dialog_button("Close", dialog.m_close_button); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(button), FALSE, FALSE, 0); widget_make_default(GTK_WIDGET(button)); gtk_widget_grab_focus(GTK_WIDGET(button)); gtk_widget_add_accelerator(GTK_WIDGET(button), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0); gtk_widget_add_accelerator(GTK_WIDGET(button), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0); } modal_dialog_show(window, dialog); gtk_widget_destroy(GTK_WIDGET(window)); }
void ay_edit_local_accounts(void) { char *text[] = { _("C"), _("Screen Name"), _("Password"), _("Service") }; GtkWidget *box; GtkWidget *window_box; GtkWidget *hbox; GtkWidget *button_box; GtkWidget *label; guint label_key; GtkWidget *toolbar; GtkToolItem *toolitem; GtkToolItem *tool_sep; GtkWidget *separator; LList *list; LList *l; GtkAccelGroup *accel_group; GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkTreeSelection *selection; if (is_open) return; is_open = 1; accel_group = gtk_accel_group_new(); account_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(account_window), GTK_WIN_POS_MOUSE); gtk_widget_realize(account_window); account_list_store = gtk_list_store_new(COL_COUNT, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); account_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL (account_list_store)); renderer = gtk_cell_renderer_toggle_new(); column = gtk_tree_view_column_new_with_attributes(text[CONNECT], renderer, "active", CONNECT, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(account_list), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(text[USER_NAME], renderer, "text", USER_NAME, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(GTK_TREE_VIEW(account_list), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(text[SERVICE_TYPE], renderer, "text", SERVICE_TYPE, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(account_list), column); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(account_list)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); gtk_container_set_border_width(GTK_CONTAINER(account_window), 5); g_signal_connect(selection, "changed", G_CALLBACK(selection_made_callback), NULL); box = gtk_vbox_new(FALSE, 0); window_box = gtk_vbox_new(FALSE, 5); hbox = gtk_hbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); /*Screen Name Section */ label = gtk_label_new_with_mnemonic(_("Screen _Name:")); label_key = gtk_label_get_mnemonic_keyval(GTK_LABEL(label)); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 5); gtk_widget_show(label); username = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(box), username, FALSE, FALSE, 2); gtk_widget_show(username); gtk_widget_add_accelerator(username, "grab_focus", accel_group, label_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); /*Password Section */ label = gtk_label_new_with_mnemonic(_("_Password:"******"grab_focus", accel_group, label_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); /*Service Type Section */ label = gtk_label_new_with_mnemonic(_("Service _Type:")); label_key = gtk_label_get_mnemonic_keyval(GTK_LABEL(label)); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 5); gtk_widget_show(label); service_type = gtk_combo_box_new_text(); list = get_service_list(); for (l = list; l; l = l_list_next(l)) { char *label = l->data; gtk_combo_box_append_text(GTK_COMBO_BOX(service_type), label); } l_list_free(list); gtk_widget_show(service_type); gtk_box_pack_start(GTK_BOX(box), service_type, FALSE, FALSE, 2); gtk_widget_add_accelerator(service_type, "grab_focus", accel_group, label_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); /*Connect at startup Section */ connect_at_startup = gtk_check_button_new_with_mnemonic(_("_Connect at startup")); label_key = gtk_label_get_mnemonic_keyval(GTK_LABEL(GTK_BIN (connect_at_startup)->child)); gtk_widget_show(connect_at_startup); gtk_widget_add_accelerator(connect_at_startup, "clicked", accel_group, label_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); gtk_box_pack_start(GTK_BOX(box), connect_at_startup, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 2); gtk_widget_show(box); box = gtk_vbox_new(FALSE, 0); read_contacts(); gtk_box_pack_start(GTK_BOX(box), account_list, TRUE, TRUE, 0); gtk_widget_show(account_list); gtk_box_pack_start(GTK_BOX(hbox), box, TRUE, TRUE, 2); gtk_widget_show(box); gtk_box_pack_start(GTK_BOX(window_box), hbox, TRUE, TRUE, 0); gtk_widget_show(hbox); separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(window_box), separator, TRUE, TRUE, 0); gtk_widget_show(separator); /*Initialize Toolbar */ toolbar = gtk_toolbar_new(); gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH); gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), FALSE); gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_HORIZONTAL); gtk_container_set_border_width(GTK_CONTAINER(toolbar), 0); /*Add Button */ #define TOOLBAR_APPEND(titem,stock,tip,callback,cb_data) { \ titem = gtk_tool_button_new_from_stock(stock); \ gtk_tool_item_set_tooltip_text(titem, tip); \ g_signal_connect(titem, "clicked", G_CALLBACK(callback), cb_data); \ gtk_widget_show(GTK_WIDGET(titem)); \ gtk_toolbar_insert(GTK_TOOLBAR(toolbar), titem, -1); \ } /* line will tell whether to draw the separator line or not */ #define TOOLBAR_APPEND_SEPARATOR(line) { \ tool_sep = gtk_separator_tool_item_new(); \ gtk_separator_tool_item_set_draw(GTK_SEPARATOR_TOOL_ITEM(tool_sep), line); \ gtk_widget_show(GTK_WIDGET(tool_sep)); \ gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tool_sep, -1); \ } TOOLBAR_APPEND(toolitem, GTK_STOCK_HELP, _("Help"), help_callback, NULL); TOOLBAR_APPEND_SEPARATOR(TRUE); TOOLBAR_APPEND(toolitem, GTK_STOCK_ADD, _("Add Account"), add_callback, NULL); TOOLBAR_APPEND_SEPARATOR(FALSE); /*Delete Button */ TOOLBAR_APPEND(del_button, GTK_STOCK_DELETE, _("Delete Account"), remove_callback, NULL); gtk_widget_set_sensitive(GTK_WIDGET(del_button), FALSE); TOOLBAR_APPEND_SEPARATOR(FALSE); /* Modify Button */ TOOLBAR_APPEND(mod_button, GTK_STOCK_EDIT, _("Modify Account"), modify_callback, NULL); gtk_widget_set_sensitive(GTK_WIDGET(mod_button), FALSE); TOOLBAR_APPEND_SEPARATOR(TRUE); /*Okay Button */ TOOLBAR_APPEND(toolitem, GTK_STOCK_OK, _("Ok"), ok_callback, NULL); TOOLBAR_APPEND_SEPARATOR(FALSE); /*Cancel Button */ TOOLBAR_APPEND(toolitem, GTK_STOCK_CANCEL, _("Cancel"), cancel_callback, NULL); #undef TOOLBAR_APPEND_SEPARATOR #undef TOOLBAR_APPEND /*Buttons End */ button_box = gtk_hbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(button_box), toolbar, FALSE, FALSE, 0); gtk_widget_show(toolbar); gtk_box_pack_start(GTK_BOX(window_box), button_box, FALSE, FALSE, 0); gtk_widget_show(button_box); gtk_widget_show(window_box); gtk_container_add(GTK_CONTAINER(account_window), window_box); gtk_window_set_title(GTK_WINDOW(account_window), _("Ayttm Account Editor")); g_signal_connect(account_window, "destroy", G_CALLBACK(destroy), NULL); gtk_window_add_accel_group(GTK_WINDOW(account_window), accel_group); gtk_widget_show(account_window); gtk_widget_grab_focus(username); }
void pressed_shifter() { GtkWidget *vbox, *hbox, *table, *button, *label; GtkAccelGroup* ag = gtk_accel_group_new(); int i, j, max; char txt[32]; shifter_window = add_a_window(GTK_WINDOW_TOPLEVEL, _("Palette Shifter"), GTK_WIN_POS_CENTER, TRUE); vbox = add_vbox(shifter_window); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); table = add_a_table(9, 4, 5, vbox); label = add_to_table( _("Start"), table, 0, 1, 1 ); gtk_misc_set_alignment( GTK_MISC(label), 0.5, 0.5 ); label = add_to_table( _("Finish"), table, 0, 2, 1 ); gtk_misc_set_alignment( GTK_MISC(label), 0.5, 0.5 ); label = add_to_table( _("Delay"), table, 0, 3, 1 ); gtk_misc_set_alignment( GTK_MISC(label), 0.5, 0.5 ); for ( i=0; i<8; i++ ) { sprintf(txt, "%i", i); add_to_table( txt, table, i+1, 0, 5 ); for ( j=0; j<3; j++ ) { if ( j==2 ) max=255; else max=mem_cols-1; shifter_spin[i][j] = spin_to_table( table, i+1, j+1, 2, shifter_in[i][j], 0, max ); spin_connect(shifter_spin[i][j], GTK_SIGNAL_FUNC(shifter_moved), NULL); } } hbox = pack(vbox, gtk_hbox_new(FALSE, 0)); gtk_widget_show (hbox); button = pack(hbox, sig_toggle_button(_("Play"), FALSE, NULL, GTK_SIGNAL_FUNC(shift_but_playstop))); shift_play_state = FALSE; // Stopped shifter_label = xpack(hbox, gtk_label_new("")); gtk_widget_show( shifter_label ); gtk_misc_set_alignment( GTK_MISC(shifter_label), 0.5, 0.5 ); shifter_slider = xpack5(vbox, mt_spinslide_new(-1, -1)); mt_spinslide_set_range(shifter_slider, 0, 0); mt_spinslide_set_value(shifter_slider, 0); mt_spinslide_connect(shifter_slider, GTK_SIGNAL_FUNC(shifter_slider_moved), NULL); add_hseparator( vbox, -2, 10 ); hbox = pack(vbox, gtk_hbox_new(FALSE, 0)); gtk_widget_show (hbox); button = xpack5(hbox, gtk_button_new_with_label(_("Clear"))); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(click_shift_clear), NULL); button = xpack5(hbox, gtk_button_new_with_label(_("Fix Palette"))); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(click_shift_fix), NULL); button = xpack5(hbox, gtk_button_new_with_label(_("Create Frames"))); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(click_shift_create), NULL); button = xpack5(hbox, gtk_button_new_with_label(_("Close"))); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(click_shift_close), NULL ); gtk_widget_add_accelerator (button, "clicked", ag, GDK_Escape, 0, (GtkAccelFlags) 0); delete_to_click(shifter_window, button); gtk_window_add_accel_group(GTK_WINDOW (shifter_window), ag); // !!! Transient windows cannot be minimized; don't know if that's desirable here // gtk_window_set_transient_for(GTK_WINDOW(shifter_window), GTK_WINDOW(main_window)); gtk_widget_show(shifter_window); #if GTK_MAJOR_VERSION == 1 gtk_widget_queue_resize(shifter_window); /* Re-render sliders */ #endif mem_pal_copy( sh_old_pal, mem_pal ); // Backup the current palette shifter_pos = 0; shifter_max = 0; shifter_moved(); // Initialize the input array }
////////////// Main and Init ///////////////// static void FskGtkWindowLoop(void *refcon) { FskWindow fskWindow = (FskWindow)refcon; FskGtkWindow gtkWin = (FskGtkWindow)fskWindow->gtkWin; GtkWidget *win; GdkPixbuf *iconBuf; // Start GTK special initialization XInitThreads(); //fix a xcb issue happened when using multithread gtk, see http://stackoverflow.com/a/18690540/472927 gtk_init(NULL, NULL); gtkWin->owner = fskWindow; gtkWin->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(win, 750, 505); // Set App Icon char *iconPath = FskStrDoCat(FskGetApplicationPath(), "fsk.png"); iconBuf = gdk_pixbuf_new_from_file(iconPath, NULL); if(iconBuf != NULL) { gtk_window_set_icon(GTK_WINDOW(win), iconBuf); g_object_unref(G_OBJECT(iconBuf)); } FskMemPtrDispose(iconPath); gtkWin->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(win), gtkWin->vbox); gtk_widget_show(gtkWin->vbox); gtkWin->menubar = gtk_menu_bar_new(); gtk_widget_show(gtkWin->menubar); gtkWin->da = gtk_drawing_area_new(); gtk_widget_show(gtkWin->da); gtkWin->accelGroup = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(win), gtkWin->accelGroup); FskMutexNew(>kWin->bufMutex, "drawAreaBuffer"); gtkWin->queue = g_async_queue_new(); gtk_widget_add_events(GTK_WIDGET(win), GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK); gtk_widget_add_events(GTK_WIDGET(gtkWin->da), GDK_ALL_EVENTS_MASK); g_signal_connect(win, "destroy", G_CALLBACK(app_quit), gtkWin); g_signal_connect(win, "key-press-event", G_CALLBACK(on_key_press), gtkWin); g_signal_connect(win, "key-release-event", G_CALLBACK(on_key_release), gtkWin); g_signal_connect(win, "configure-event", G_CALLBACK(configure_event_win), gtkWin); // If want to resize draw-area, it will be the event receiver. g_signal_connect(gtkWin->da, "configure-event", G_CALLBACK(configure_event_cb), gtkWin); g_signal_connect(gtkWin->da, "draw", G_CALLBACK(draw_callback), gtkWin); g_signal_connect(gtkWin->da, "button-press-event", G_CALLBACK(on_button_press), gtkWin); g_signal_connect(gtkWin->da, "button-release-event",G_CALLBACK(on_button_release), gtkWin); g_signal_connect(gtkWin->da, "motion-notify-event", G_CALLBACK(motion_notify), gtkWin); gtk_box_pack_start(GTK_BOX(gtkWin->vbox), gtkWin->menubar, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(gtkWin->vbox), gtkWin->da, TRUE, TRUE, 0); // Set all to true! gdk_threads_add_idle(idle_func, gtkWin); //gtk_widget_show_all(win); FskThreadInitializationComplete(FskThreadGetCurrent()); gtk_main(); }
Compose * compose_new(Config * config) { Compose * compose; GtkAccelGroup * group; GtkWidget * vbox; GtkWidget * toolbar; GtkToolItem * toolitem; GtkSizeGroup * sizegroup; GtkWidget * vpaned; GtkWidget * vbox2; GtkWidget * widget; GtkCellRenderer * renderer; GtkTreeViewColumn * column; GtkTreeIter iter; char const * headers[] = { "To:", "Cc:", "Bcc:", "Reply-To:", "Newsgroup:", "Followup-To:" }; size_t i; gint size; if((compose = malloc(sizeof(*compose))) == NULL) { compose_error(NULL, strerror(errno), 0); return NULL; } compose->mime = mime_new(NULL); /* check errors */ if(compose->mime == NULL) { free(compose); return NULL; } compose->config = config; compose->standalone = FALSE; /* window */ group = gtk_accel_group_new(); compose->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_add_accel_group(GTK_WINDOW(compose->window), group); g_object_unref(group); #ifndef EMBEDDED gtk_window_set_default_size(GTK_WINDOW(compose->window), 512, 384); #else gtk_window_set_default_size(GTK_WINDOW(compose->window), 200, 300); #endif gtk_window_set_title(GTK_WINDOW(compose->window), _("Compose")); #if GTK_CHECK_VERSION(2, 6, 0) gtk_window_set_icon_name(GTK_WINDOW(compose->window), "mailer"); #endif g_signal_connect_swapped(G_OBJECT(compose->window), "delete-event", G_CALLBACK(_compose_on_closex), compose); #if GTK_CHECK_VERSION(3, 0, 0) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); #else vbox = gtk_vbox_new(FALSE, 0); #endif /* menubar */ #ifndef EMBEDDED widget = desktop_menubar_create(_compose_menubar, compose, group); gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0); #endif /* toolbar */ toolbar = desktop_toolbar_create(_compose_toolbar, compose, group); gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, TRUE, 0); /* from */ sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); toolbar = gtk_toolbar_new(); widget = gtk_label_new(_("From: ")); #if GTK_CHECK_VERSION(3, 14, 0) g_object_set(widget, "halign", GTK_ALIGN_START, NULL); #else gtk_misc_set_alignment(GTK_MISC(widget), 0.1, 0.5); #endif gtk_widget_set_size_request(widget, 80, -1); gtk_size_group_add_widget(sizegroup, widget); toolitem = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(toolitem), widget); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); #if GTK_CHECK_VERSION(2, 24, 0) compose->from = gtk_combo_box_text_new_with_entry(); #else compose->from = gtk_combo_box_entry_new_text(); #endif toolitem = gtk_tool_item_new(); gtk_tool_item_set_expand(toolitem, TRUE); gtk_container_add(GTK_CONTAINER(toolitem), compose->from); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); /* paned */ #if GTK_CHECK_VERSION(3, 0, 0) vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); #else vpaned = gtk_vpaned_new(); #endif if(gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &size, &size) != TRUE) size = 24; gtk_paned_set_position(GTK_PANED(vpaned), size * 2); /* headers */ widget = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); compose->h_store = gtk_list_store_new(CHC_COUNT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); compose->h_store_filter = gtk_tree_model_filter_new(GTK_TREE_MODEL( compose->h_store), NULL); gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER( compose->h_store_filter), _compose_on_headers_filter, compose, NULL); compose->h_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL( compose->h_store_filter)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(compose->h_view), FALSE); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(compose->h_view), TRUE); compose->h_headers = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); for(i = 0; i < sizeof(headers) / sizeof(*headers); i++) { gtk_list_store_append(compose->h_headers, &iter); gtk_list_store_set(compose->h_headers, &iter, 0, headers[i], 1, headers[i], -1); } renderer = gtk_cell_renderer_combo_new(); g_object_set(renderer, "editable", TRUE, "model", compose->h_headers, "text-column", 1, NULL); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK( _on_header_field_edited), compose); column = gtk_tree_view_column_new_with_attributes("", renderer, "text", CHC_HEADER, NULL); gtk_tree_view_column_set_min_width(column, 80); gtk_tree_view_append_column(GTK_TREE_VIEW(compose->h_view), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK( _on_header_edited), compose); column = gtk_tree_view_column_new_with_attributes("", renderer, "text", CHC_VALUE, NULL); #if GTK_CHECK_VERSION(2, 4, 0) gtk_tree_view_column_set_expand(column, TRUE); #endif gtk_tree_view_append_column(GTK_TREE_VIEW(compose->h_view), column); /* default to 8-bits transfers with UTF-8 encoding */ compose_set_header(compose, "Content-Transfer-Encoding:", "8bit", FALSE); compose_set_header(compose, "Content-Type:", "text/plain; charset=UTF-8", FALSE); compose_add_field(compose, "To:", NULL); gtk_container_add(GTK_CONTAINER(widget), compose->h_view); gtk_paned_add1(GTK_PANED(vpaned), widget); /* paned */ #if GTK_CHECK_VERSION(3, 0, 0) vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); #else vbox2 = gtk_vbox_new(FALSE, 0); #endif /* subject */ toolbar = gtk_toolbar_new(); widget = gtk_label_new(_("Subject: ")); #if GTK_CHECK_VERSION(3, 14, 0) g_object_set(widget, "halign", GTK_ALIGN_START, NULL); #else gtk_misc_set_alignment(GTK_MISC(widget), 0.1, 0.5); #endif gtk_size_group_add_widget(sizegroup, widget); toolitem = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(toolitem), widget); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); compose->subject = gtk_entry_new(); toolitem = gtk_tool_item_new(); gtk_tool_item_set_expand(toolitem, TRUE); gtk_container_add(GTK_CONTAINER(toolitem), compose->subject); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, TRUE, 0); /* view */ widget = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); compose->view = _new_text_view(compose); compose_set_font(compose, _compose_get_font(compose)); gtk_container_add(GTK_CONTAINER(widget), compose->view); gtk_box_pack_start(GTK_BOX(vbox2), widget, TRUE, TRUE, 0); gtk_paned_add2(GTK_PANED(vpaned), vbox2); gtk_box_pack_start(GTK_BOX(vbox), vpaned, TRUE, TRUE, 0); /* attachments */ compose->a_window = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(compose->a_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); compose->a_store = gtk_list_store_new(CAC_COUNT, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER); compose->a_view = gtk_icon_view_new_with_model(GTK_TREE_MODEL( compose->a_store)); gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(compose->a_view), CAC_ICON); gtk_icon_view_set_selection_mode(GTK_ICON_VIEW(compose->a_view), GTK_SELECTION_MULTIPLE); gtk_icon_view_set_text_column(GTK_ICON_VIEW(compose->a_view), CAC_BASENAME); gtk_container_add(GTK_CONTAINER(compose->a_window), compose->a_view); gtk_widget_show_all(compose->a_view); gtk_widget_set_no_show_all(compose->a_window, TRUE); gtk_box_pack_start(GTK_BOX(vbox), compose->a_window, FALSE, TRUE, 0); /* statusbar */ compose->statusbar = gtk_statusbar_new(); compose->statusbar_id = 0; gtk_box_pack_start(GTK_BOX(vbox), compose->statusbar, FALSE, TRUE, 0); gtk_container_add(GTK_CONTAINER(compose->window), vbox); /* about dialog */ compose->ab_window = NULL; /* signature */ compose_append_signature(compose); compose_set_modified(compose, FALSE); compose_scroll_to_offset(compose, 0); /* display */ gtk_widget_grab_focus(compose->view); gtk_widget_show_all(vbox); gtk_widget_show(compose->window); return compose; }
static void saa_main_window_init (SaaMainWindow * w) { GtkWidget * vbox_win; // Barre de menu ---------------------------------------------------------- GtkWidget *menubar; GtkWidget *image; GtkWidget *mit_fichier; GtkWidget *mit_fichier_menu; GtkWidget *it_charger_xml; GtkWidget *it_enregistrer_xml; GtkWidget *mit_exporter; GtkWidget *mit_exporter_menu; GtkWidget *it_exporter; GtkWidget *it_exporter_rb; GtkWidget *it_sep_fichier; GtkWidget *it_quitter; GtkWidget *mit_aide; GtkWidget *mit_aide_menu; GtkWidget *it_a_propos; GtkWidget *hbox_win; GtkWidget *vbox_prop; // Onglets ---------------------------------------------------------------- GtkWidget *notebook; GtkWidget *label_page1; GtkWidget *page1; GtkWidget *f_uniform; GtkWidget *lbl_uniform; GtkWidget *f_traitement; GtkWidget *lbl_traitement; GtkWidget *label_page2; GtkWidget *page2; GtkWidget *sw; GtkWidget *label_page3; GtkWidget *page3; // Barre d'état ----------------------------------------------------------- GtkWidget *hbox_status; GtkWidget *statusbar; GtkWidget *progressbar; GtkAccelGroup *accel_group; int i; const gchar* const * dirs = g_get_system_data_dirs(); gchar * path; // TODO init_files(); saa_init_files(); g_set_application_name (PACKAGE_NAME); w->icon = NULL; for(i=0; dirs[i] && !w->icon; i++) { path = g_build_filename(dirs[i], "images", "gsolaar-logo.png", NULL); if(g_file_test(path, G_FILE_TEST_EXISTS)) { w->icon = gdk_pixbuf_new_from_file(path, NULL); gtk_window_set_default_icon (w->icon); } g_free(path); } w->visuel = saa_visuel_creer(); accel_group = gtk_accel_group_new (); gtk_window_set_title (GTK_WINDOW (w), "GSolaar"); vbox_win = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox_win); gtk_container_add (GTK_CONTAINER (w), vbox_win); menubar = gtk_menu_bar_new (); gtk_widget_show (menubar); gtk_box_pack_start (GTK_BOX (vbox_win), menubar, FALSE, FALSE, 0); mit_fichier = gtk_menu_item_new_with_mnemonic(_("_File")); gtk_widget_show (mit_fichier); gtk_container_add (GTK_CONTAINER (menubar), mit_fichier); mit_fichier_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (mit_fichier), mit_fichier_menu); // Chargement ------------------------------------------------------------- it_charger_xml = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, accel_group); gtk_widget_show (it_charger_xml); gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_charger_xml); // Sauvegarde ------------------------------------------------------------- it_enregistrer_xml = gtk_image_menu_item_new_from_stock (GTK_STOCK_SAVE, accel_group); gtk_widget_show (it_enregistrer_xml); gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_enregistrer_xml); // Patron ----------------------------------------------------------------- mit_exporter = gtk_image_menu_item_new_with_mnemonic(_("_Export")); gtk_widget_show(mit_exporter); gtk_container_add (GTK_CONTAINER (mit_fichier_menu), mit_exporter); image = gtk_image_new_from_stock (GTK_STOCK_CONVERT, GTK_ICON_SIZE_MENU); gtk_widget_show (image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mit_exporter), image); mit_exporter_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (mit_exporter), mit_exporter_menu); it_exporter = gtk_image_menu_item_new_with_label (_("Pattern ...")); gtk_widget_show (it_exporter); gtk_container_add (GTK_CONTAINER (mit_exporter_menu), it_exporter); it_exporter_rb = gtk_image_menu_item_new_with_label (_("Ruby script for SketchUp ...")); gtk_widget_show (it_exporter_rb); gtk_container_add (GTK_CONTAINER (mit_exporter_menu), it_exporter_rb); //------------------------------------------------------------------------- it_sep_fichier = gtk_menu_item_new (); gtk_widget_show (it_sep_fichier); gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_sep_fichier); gtk_widget_set_sensitive (it_sep_fichier, FALSE); it_quitter = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, accel_group); gtk_widget_show (it_quitter); gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_quitter); mit_aide = gtk_menu_item_new_with_mnemonic ("_?"); gtk_widget_show (mit_aide); gtk_container_add (GTK_CONTAINER (menubar), mit_aide); mit_aide_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (mit_aide), mit_aide_menu); it_a_propos = gtk_image_menu_item_new_from_stock ( GTK_STOCK_ABOUT, accel_group); gtk_widget_show (it_a_propos); gtk_container_add (GTK_CONTAINER (mit_aide_menu), it_a_propos); //------------------------------------------------------------------------- hbox_win = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox_win); gtk_box_pack_start (GTK_BOX (vbox_win), hbox_win, TRUE, TRUE, 0); vbox_prop = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox_prop); gtk_box_pack_start (GTK_BOX (hbox_win), vbox_prop, TRUE, TRUE, 0); gtk_widget_set_size_request (vbox_prop, 500, 400); // Drawing Area w->area = saa_drawing_area_new_with_visuel (w->visuel); gtk_widget_show (w->area); gtk_box_pack_start (GTK_BOX (vbox_prop), w->area, TRUE, TRUE, 0); gtk_widget_set_size_request (w->area, 600, 400); notebook = gtk_notebook_new(); gtk_widget_show(notebook); gtk_container_set_border_width (GTK_CONTAINER (notebook), 5); gtk_box_pack_start (GTK_BOX (hbox_win), notebook, FALSE, FALSE, 0); label_page1 = gtk_label_new (_("Polyhedron")); gtk_widget_show (label_page1); page1 = gtk_vbox_new (FALSE, 5); gtk_widget_show (page1); gtk_container_set_border_width (GTK_CONTAINER (page1), 5); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page1, label_page1); f_uniform = gtk_frame_new (NULL); gtk_widget_show (f_uniform); gtk_box_pack_start (GTK_BOX (page1), f_uniform, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (f_uniform), 5); gtk_frame_set_label_align (GTK_FRAME (f_uniform), 0.5, 0.5); lbl_uniform = gtk_label_new (_("Uniform polyhedra")); gtk_widget_show (lbl_uniform); gtk_frame_set_label_widget (GTK_FRAME (f_uniform), lbl_uniform); gtk_label_set_justify (GTK_LABEL (lbl_uniform), GTK_JUSTIFY_LEFT); // Solid manager w->manager = saa_solid_manager_new_with_visuel(w->visuel); gtk_widget_show(w->manager); gtk_container_add (GTK_CONTAINER (f_uniform), w->manager); f_traitement = gtk_frame_new (NULL); gtk_widget_show (f_traitement); gtk_box_pack_start (GTK_BOX (page1), f_traitement, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (f_traitement), 5); gtk_frame_set_label_align (GTK_FRAME (f_traitement), 0.5, 0.5); lbl_traitement = gtk_label_new (_("Treatment")); gtk_widget_show (lbl_traitement); gtk_frame_set_label_widget (GTK_FRAME (f_traitement), lbl_traitement); gtk_label_set_justify (GTK_LABEL (lbl_traitement), GTK_JUSTIFY_LEFT); // Solid Handler w->handler = saa_solid_handler_new_with_visuel(w->visuel); gtk_widget_show(w->handler); gtk_container_add (GTK_CONTAINER (f_traitement), w->handler); label_page2 = gtk_label_new (_("Navigation")); gtk_widget_show (label_page2); page2 = gtk_vbox_new (FALSE, 5); gtk_widget_show (page2); gtk_container_set_border_width (GTK_CONTAINER (page2), 5); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page2, label_page2); sw = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show(sw); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (page2), sw, TRUE, TRUE, 0); // Treeview navigator w->explorer = saa_tree_view_new_with_visuel(w->visuel); gtk_widget_show(w->explorer); gtk_container_add (GTK_CONTAINER (sw), w->explorer); // TODO a deplacer dans window realize saa_tree_view_update(SAA_TREE_VIEW(w->explorer)); label_page3 = gtk_label_new (_("Display")); gtk_widget_show (label_page3); page3 = gtk_vbox_new (FALSE, 5); gtk_widget_show (page3); gtk_container_set_border_width (GTK_CONTAINER (page3), 5); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page3, label_page3); // Solid display w->display = saa_solid_display_new_with_visuel(w->visuel); gtk_widget_show (w->display); gtk_box_pack_start(GTK_BOX(page3), w->display, TRUE, TRUE, 0); hbox_status = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox_status); gtk_box_pack_start (GTK_BOX (vbox_win), hbox_status, FALSE, FALSE, 0); statusbar = gtk_statusbar_new (); gtk_widget_show (statusbar); gtk_box_pack_start (GTK_BOX (hbox_status), statusbar, TRUE, TRUE, 0); progressbar = gtk_progress_bar_new (); gtk_widget_show (progressbar); gtk_box_pack_start (GTK_BOX (hbox_status), progressbar, FALSE, FALSE, 0); g_signal_connect_swapped ((gpointer)w->manager, "solid-changed", G_CALLBACK (saa_tree_view_update), w->explorer); g_signal_connect_swapped ((gpointer)w->manager, "solid-changed", G_CALLBACK (gtk_widget_queue_draw), w->area); g_signal_connect_swapped ((gpointer)w->display, "solid-changed", G_CALLBACK (gtk_widget_queue_draw), w->area); g_signal_connect_swapped ((gpointer)w->handler, "solid-changed", G_CALLBACK (saa_tree_view_update), w->explorer); g_signal_connect_swapped ((gpointer)w->handler, "solid-changed", G_CALLBACK (gtk_widget_queue_draw), w->area); g_signal_connect_swapped ((gpointer)w->area, "vertex-selected", G_CALLBACK (saa_tree_view_select_vertex), w->explorer); g_signal_connect_swapped ((gpointer)w->area, "edge-selected", G_CALLBACK (saa_tree_view_select_edge), w->explorer); g_signal_connect_swapped ((gpointer)w->area, "wing-selected", G_CALLBACK (saa_tree_view_select_wing), w->explorer); g_signal_connect_swapped ((gpointer)w->explorer, "vertex-selected", G_CALLBACK (saa_drawing_area_select_vertex), w->area); g_signal_connect_swapped ((gpointer)w->explorer, "edge-selected", G_CALLBACK (saa_drawing_area_select_edge), w->area); g_signal_connect_swapped ((gpointer)w->explorer, "wing-selected", G_CALLBACK (saa_drawing_area_select_wing), w->area); g_signal_connect_swapped((gpointer)it_charger_xml, "activate", G_CALLBACK (saa_main_window_charger_xml_clicked), w); g_signal_connect_swapped((gpointer)it_enregistrer_xml, "activate", G_CALLBACK (saa_main_window_sauver_xml_activate), w); g_signal_connect_swapped((gpointer)it_exporter, "activate", G_CALLBACK (saa_main_window_exporter_activate), w); g_signal_connect_swapped((gpointer)it_exporter_rb, "activate", G_CALLBACK (saa_main_window_exporter_rb_activate), w); g_signal_connect_swapped ((gpointer)it_quitter, "activate", G_CALLBACK (saa_main_window_quitter_activate), w); g_signal_connect (G_OBJECT(w), "destroy", G_CALLBACK (saa_main_window_quitter_activate), NULL); g_signal_connect_swapped ((gpointer)it_a_propos, "activate", G_CALLBACK (saa_main_window_a_propos_activate), w); gtk_window_add_accel_group (GTK_WINDOW (w), accel_group); }
GtkWidget* create_window1 (void) { GtkWidget *window1; GtkWidget *vbox1; GtkWidget *menubar1; GtkWidget *menuitem1; GtkWidget *menuitem1_menu; GtkWidget *separatormenuitem1; GtkWidget *quit1; GtkWidget *menuitem4; GtkWidget *menuitem4_menu; GtkWidget *about1; GtkWidget *vbox2; GtkWidget *fixed1; GtkWidget *entry1; GtkWidget *button3; GtkWidget *button1; GtkWidget *button2; GtkWidget *image2; GtkWidget *label2; GtkWidget *label1; GtkWidget *hseparator1; GtkWidget *image1; GtkWidget *optionmenu1; GtkWidget *menu1; GtkWidget *center1; GtkWidget *top1; GtkWidget *bottom1; GtkWidget *left1; GtkWidget *right1; GtkWidget *topleft1; GtkWidget *topright1; GtkWidget *bottomleft1; GtkWidget *bottomright1; GtkWidget *statusbar1; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new (); window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (window1, 380, 380); gtk_window_set_title (GTK_WINDOW (window1), _("Qvwm Background Changer")); gtk_window_set_position (GTK_WINDOW (window1), GTK_WIN_POS_CENTER); gtk_window_set_resizable (GTK_WINDOW (window1), FALSE); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (window1), vbox1); menubar1 = gtk_menu_bar_new (); gtk_widget_show (menubar1); gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0); menuitem1 = gtk_menu_item_new_with_mnemonic (_("_File")); gtk_widget_show (menuitem1); gtk_container_add (GTK_CONTAINER (menubar1), menuitem1); menuitem1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu); separatormenuitem1 = gtk_menu_item_new (); gtk_widget_show (separatormenuitem1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1); gtk_widget_set_sensitive (separatormenuitem1, FALSE); quit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group); gtk_widget_show (quit1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), quit1); menuitem4 = gtk_menu_item_new_with_mnemonic (_("_Help")); gtk_widget_show (menuitem4); gtk_container_add (GTK_CONTAINER (menubar1), menuitem4); menuitem4_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu); about1 = gtk_menu_item_new_with_mnemonic (_("_About")); gtk_widget_show (about1); gtk_container_add (GTK_CONTAINER (menuitem4_menu), about1); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0); fixed1 = gtk_fixed_new (); gtk_widget_show (fixed1); gtk_box_pack_start (GTK_BOX (vbox2), fixed1, TRUE, TRUE, 0); entry1 = gtk_entry_new (); gtk_widget_show (entry1); gtk_fixed_put (GTK_FIXED (fixed1), entry1, 120, 264); gtk_widget_set_size_request (entry1, 224, 24); button3 = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (button3); gtk_fixed_put (GTK_FIXED (fixed1), button3, 248, 296); gtk_widget_set_size_request (button3, 88, 32); button1 = gtk_button_new_from_stock ("gtk-save"); gtk_widget_show (button1); gtk_fixed_put (GTK_FIXED (fixed1), button1, 48, 296); gtk_widget_set_size_request (button1, 96, 32); button2 = gtk_button_new (); gtk_widget_show (button2); gtk_fixed_put (GTK_FIXED (fixed1), button2, 344, 264); gtk_widget_set_size_request (button2, 24, 24); image2 = gtk_image_new_from_stock ("gtk-floppy", GTK_ICON_SIZE_BUTTON); gtk_widget_show (image2); gtk_container_add (GTK_CONTAINER (button2), image2); label2 = gtk_label_new (_("Position :")); gtk_widget_show (label2); gtk_fixed_put (GTK_FIXED (fixed1), label2, 8, 240); gtk_widget_set_size_request (label2, 96, 16); gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE); label1 = gtk_label_new (_("Picture :")); gtk_widget_show (label1); gtk_fixed_put (GTK_FIXED (fixed1), label1, 8, 272); gtk_widget_set_size_request (label1, 96, 16); gtk_label_set_line_wrap (GTK_LABEL (label1), TRUE); hseparator1 = gtk_hseparator_new (); gtk_widget_show (hseparator1); gtk_fixed_put (GTK_FIXED (fixed1), hseparator1, 8, 208); gtk_widget_set_size_request (hseparator1, 368, 16); image1 = gtk_image_new_from_stock ("gtk-missing-image", GTK_ICON_SIZE_DIALOG); gtk_widget_show (image1); gtk_fixed_put (GTK_FIXED (fixed1), image1, 8, 8); gtk_widget_set_size_request (image1, 370, 200); optionmenu1 = gtk_option_menu_new (); gtk_widget_show (optionmenu1); gtk_fixed_put (GTK_FIXED (fixed1), optionmenu1, 176, 232); gtk_widget_set_size_request (optionmenu1, 192, 26); gtk_container_set_border_width (GTK_CONTAINER (optionmenu1), 1); menu1 = gtk_menu_new (); center1 = gtk_menu_item_new_with_mnemonic (_("Center")); gtk_widget_show (center1); gtk_container_add (GTK_CONTAINER (menu1), center1); top1 = gtk_menu_item_new_with_mnemonic (_("Top")); gtk_widget_show (top1); gtk_container_add (GTK_CONTAINER (menu1), top1); bottom1 = gtk_menu_item_new_with_mnemonic (_("Bottom")); gtk_widget_show (bottom1); gtk_container_add (GTK_CONTAINER (menu1), bottom1); left1 = gtk_menu_item_new_with_mnemonic (_("Left")); gtk_widget_show (left1); gtk_container_add (GTK_CONTAINER (menu1), left1); right1 = gtk_menu_item_new_with_mnemonic (_("Right")); gtk_widget_show (right1); gtk_container_add (GTK_CONTAINER (menu1), right1); topleft1 = gtk_menu_item_new_with_mnemonic (_("TopLeft")); gtk_widget_show (topleft1); gtk_container_add (GTK_CONTAINER (menu1), topleft1); topright1 = gtk_menu_item_new_with_mnemonic (_("TopRight")); gtk_widget_show (topright1); gtk_container_add (GTK_CONTAINER (menu1), topright1); bottomleft1 = gtk_menu_item_new_with_mnemonic (_("BottomLeft")); gtk_widget_show (bottomleft1); gtk_container_add (GTK_CONTAINER (menu1), bottomleft1); bottomright1 = gtk_menu_item_new_with_mnemonic (_("BottomRight")); gtk_widget_show (bottomright1); gtk_container_add (GTK_CONTAINER (menu1), bottomright1); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu1), menu1); statusbar1 = gtk_statusbar_new (); gtk_widget_show (statusbar1); gtk_box_pack_start (GTK_BOX (vbox1), statusbar1, FALSE, FALSE, 0); g_signal_connect ((gpointer) window1, "delete_event", G_CALLBACK (on_window1_delete_event), NULL); g_signal_connect ((gpointer) window1, "destroy_event", G_CALLBACK (on_window1_destroy_event), NULL); g_signal_connect ((gpointer) window1, "show", G_CALLBACK (on_window1_show), NULL); g_signal_connect ((gpointer) quit1, "activate", G_CALLBACK (on_quit1_activate), NULL); g_signal_connect ((gpointer) about1, "activate", G_CALLBACK (on_about1_activate), NULL); g_signal_connect ((gpointer) entry1, "changed", G_CALLBACK (on_entry1_changed), NULL); g_signal_connect ((gpointer) button3, "clicked", G_CALLBACK (on_button3_clicked), NULL); g_signal_connect ((gpointer) button1, "clicked", G_CALLBACK (on_button1_clicked), NULL); g_signal_connect ((gpointer) button2, "clicked", G_CALLBACK (on_button2_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, menubar1, "menubar1"); GLADE_HOOKUP_OBJECT (window1, menuitem1, "menuitem1"); GLADE_HOOKUP_OBJECT (window1, menuitem1_menu, "menuitem1_menu"); GLADE_HOOKUP_OBJECT (window1, separatormenuitem1, "separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, quit1, "quit1"); GLADE_HOOKUP_OBJECT (window1, menuitem4, "menuitem4"); GLADE_HOOKUP_OBJECT (window1, menuitem4_menu, "menuitem4_menu"); GLADE_HOOKUP_OBJECT (window1, about1, "about1"); GLADE_HOOKUP_OBJECT (window1, vbox2, "vbox2"); GLADE_HOOKUP_OBJECT (window1, fixed1, "fixed1"); GLADE_HOOKUP_OBJECT (window1, entry1, "entry1"); GLADE_HOOKUP_OBJECT (window1, button3, "button3"); GLADE_HOOKUP_OBJECT (window1, button1, "button1"); GLADE_HOOKUP_OBJECT (window1, button2, "button2"); GLADE_HOOKUP_OBJECT (window1, image2, "image2"); GLADE_HOOKUP_OBJECT (window1, label2, "label2"); GLADE_HOOKUP_OBJECT (window1, label1, "label1"); GLADE_HOOKUP_OBJECT (window1, hseparator1, "hseparator1"); GLADE_HOOKUP_OBJECT (window1, image1, "image1"); GLADE_HOOKUP_OBJECT (window1, optionmenu1, "optionmenu1"); GLADE_HOOKUP_OBJECT (window1, menu1, "menu1"); GLADE_HOOKUP_OBJECT (window1, center1, "center1"); GLADE_HOOKUP_OBJECT (window1, top1, "top1"); GLADE_HOOKUP_OBJECT (window1, bottom1, "bottom1"); GLADE_HOOKUP_OBJECT (window1, left1, "left1"); GLADE_HOOKUP_OBJECT (window1, right1, "right1"); GLADE_HOOKUP_OBJECT (window1, topleft1, "topleft1"); GLADE_HOOKUP_OBJECT (window1, topright1, "topright1"); GLADE_HOOKUP_OBJECT (window1, bottomleft1, "bottomleft1"); GLADE_HOOKUP_OBJECT (window1, bottomright1, "bottomright1"); GLADE_HOOKUP_OBJECT (window1, statusbar1, "statusbar1"); gtk_window_add_accel_group (GTK_WINDOW (window1), accel_group); return window1; }
BOOL create_connectionpool (HWND hwnd, TCONNECTIONPOOLING *choose_t) { GtkWidget *connectionpool, *dialog_vbox1, *fixed1, *l_question; GtkWidget *t_cptimeout, *dialog_action_area1, *hbuttonbox1; GtkWidget *t_probe, *l_time, *l_probe; GtkWidget *b_finish, *b_cancel; guint b_finish_key, b_cancel_key; GtkAccelGroup *accel_group; char msg[1024]; if (hwnd == NULL || !GTK_IS_WIDGET (hwnd) || !choose_t) return FALSE; accel_group = gtk_accel_group_new (); connectionpool = gtk_dialog_new (); gtk_object_set_data (GTK_OBJECT (connectionpool), "connectionpool", connectionpool); gtk_window_set_title (GTK_WINDOW (connectionpool), "Connection pooling attributes"); gtk_window_set_position (GTK_WINDOW (connectionpool), GTK_WIN_POS_CENTER); gtk_window_set_modal (GTK_WINDOW (connectionpool), TRUE); gtk_window_set_policy (GTK_WINDOW (connectionpool), FALSE, FALSE, FALSE); #if GTK_CHECK_VERSION(2,0,0) gtk_widget_show (connectionpool); #endif dialog_vbox1 = GTK_DIALOG (connectionpool)->vbox; gtk_object_set_data (GTK_OBJECT (connectionpool), "dialog_vbox1", dialog_vbox1); gtk_widget_show (dialog_vbox1); fixed1 = gtk_fixed_new (); gtk_widget_ref (fixed1); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "fixed1", fixed1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (fixed1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), fixed1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (fixed1), 6); l_question = gtk_label_new ("You have now to specify the connection pooling timeout\nin seconds of the specified driver and probe query"); gtk_widget_ref (l_question); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "l_question", l_question, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (l_question); gtk_fixed_put (GTK_FIXED (fixed1), l_question, 8, 8); gtk_widget_set_uposition (l_question, 8, 8); #if GTK_CHECK_VERSION(2,0,0) gtk_widget_set_usize (l_question, 376, 36); #else gtk_widget_set_usize (l_question, 376, 24); #endif gtk_label_set_justify (GTK_LABEL (l_question), GTK_JUSTIFY_LEFT); l_time = gtk_label_new ("Timeout:"); gtk_widget_ref (l_time); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "l_time", l_time, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (l_time); #if GTK_CHECK_VERSION(2,0,0) gtk_fixed_put (GTK_FIXED (fixed1), l_time, 8, 48); gtk_widget_set_uposition (l_time, 8, 48); #else gtk_fixed_put (GTK_FIXED (fixed1), l_time, 8, 40); gtk_widget_set_uposition (l_time, 8, 40); #endif gtk_widget_set_usize (l_time, 60, 24); gtk_label_set_justify (GTK_LABEL (l_time), GTK_JUSTIFY_RIGHT); t_cptimeout = gtk_entry_new (); gtk_widget_ref (t_cptimeout); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "t_cptimeout", t_cptimeout, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (t_cptimeout); #if GTK_CHECK_VERSION(2,0,0) gtk_fixed_put (GTK_FIXED (fixed1), t_cptimeout, 80, 48); gtk_widget_set_uposition (t_cptimeout, 80, 48); #else gtk_fixed_put (GTK_FIXED (fixed1), t_cptimeout, 80, 40); gtk_widget_set_uposition (t_cptimeout, 80, 40); #endif gtk_widget_set_usize (t_cptimeout, 300, 22); if (choose_t) gtk_entry_set_text (GTK_ENTRY (t_cptimeout), choose_t->timeout); l_probe = gtk_label_new ("Query:"); gtk_widget_ref (l_probe); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "l_probe", l_probe, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (l_probe); #if GTK_CHECK_VERSION(2,0,0) gtk_fixed_put (GTK_FIXED (fixed1), l_probe, 8, 78); gtk_widget_set_uposition (l_probe, 8, 78); #else gtk_fixed_put (GTK_FIXED (fixed1), l_probe, 8, 70); gtk_widget_set_uposition (l_probe, 8, 70); #endif gtk_widget_set_usize (l_probe, 60, 24); gtk_label_set_justify (GTK_LABEL (l_probe), GTK_JUSTIFY_RIGHT); t_probe = gtk_entry_new (); gtk_widget_ref (t_probe); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "t_probe", t_probe, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (t_probe); #if GTK_CHECK_VERSION(2,0,0) gtk_fixed_put (GTK_FIXED (fixed1), t_probe, 80, 78); gtk_widget_set_uposition (t_probe, 80, 78); #else gtk_fixed_put (GTK_FIXED (fixed1), t_probe, 80, 70); gtk_widget_set_uposition (t_probe, 80, 70); #endif gtk_widget_set_usize (t_probe, 300, 22); if (choose_t) gtk_entry_set_text (GTK_ENTRY (t_probe), choose_t->probe); dialog_action_area1 = GTK_DIALOG (connectionpool)->action_area; gtk_object_set_data (GTK_OBJECT (connectionpool), "dialog_action_area1", dialog_action_area1); gtk_widget_show (dialog_action_area1); gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 5); hbuttonbox1 = gtk_hbutton_box_new (); gtk_widget_ref (hbuttonbox1); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "hbuttonbox1", hbuttonbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbuttonbox1); gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox1, TRUE, TRUE, 0); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END); gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 10); b_finish = gtk_button_new_with_label (""); b_finish_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (b_finish)->child), "_Finish"); gtk_widget_add_accelerator (b_finish, "clicked", accel_group, b_finish_key, GDK_MOD1_MASK, 0); gtk_widget_ref (b_finish); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "b_finish", b_finish, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (b_finish); gtk_container_add (GTK_CONTAINER (hbuttonbox1), b_finish); GTK_WIDGET_SET_FLAGS (b_finish, GTK_CAN_DEFAULT); gtk_widget_add_accelerator (b_finish, "clicked", accel_group, 'F', GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); b_cancel = gtk_button_new_with_label (""); b_cancel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (b_cancel)->child), "_Cancel"); gtk_widget_add_accelerator (b_cancel, "clicked", accel_group, b_cancel_key, GDK_MOD1_MASK, 0); gtk_widget_ref (b_cancel); gtk_object_set_data_full (GTK_OBJECT (connectionpool), "b_cancel", b_cancel, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (b_cancel); gtk_container_add (GTK_CONTAINER (hbuttonbox1), b_cancel); GTK_WIDGET_SET_FLAGS (b_cancel, GTK_CAN_DEFAULT); gtk_widget_add_accelerator (b_cancel, "clicked", accel_group, 'C', GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); /* Finish button events */ gtk_signal_connect (GTK_OBJECT (b_finish), "clicked", GTK_SIGNAL_FUNC (connectionpool_finish_clicked), choose_t); /* Cancel button events */ gtk_signal_connect (GTK_OBJECT (b_cancel), "clicked", GTK_SIGNAL_FUNC (connectionpool_cancel_clicked), choose_t); /* Close window button events */ gtk_signal_connect (GTK_OBJECT (connectionpool), "delete_event", GTK_SIGNAL_FUNC (delete_event), choose_t); gtk_signal_connect (GTK_OBJECT (connectionpool), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_window_add_accel_group (GTK_WINDOW (connectionpool), accel_group); choose_t->timeout_entry = t_cptimeout; choose_t->probe_entry = t_probe; choose_t->mainwnd = connectionpool; gtk_widget_show_all (connectionpool); gtk_main (); return choose_t->changed; }
gboolean check_emacs_key_theme(GtkWindow *window, GtkItemFactory *ifactory) { GtkAccelGroup *accel_group; GSList *groups; gchar *key_theme = NULL; gboolean emacs_flag = FALSE; GtkSettings *settings = gtk_settings_get_default(); g_object_get(settings, "gtk-key-theme-name", &key_theme, NULL); if (key_theme) { if (!g_ascii_strcasecmp(key_theme, "Emacs")) emacs_flag = TRUE; g_free(key_theme); } if (!emacs_flag) return FALSE; groups = gtk_accel_groups_from_object(G_OBJECT(window)); accel_group = groups->data; if (accel_group) { gtk_window_remove_accel_group(GTK_WINDOW(window), accel_group); g_object_unref(accel_group); } accel_group = gtk_accel_group_new(); gtk_rc_parse_string ( "binding \"gtk-emacs-text-entry\"" "{\n" "bind \"<ctrl>w\" { \"cut-clipboard\" () }" "}\n" ); /* gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/File/New"), accel_group, GDK_N, GDK_CONTROL_MASK); gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/File/Open..."), accel_group, GDK_O, GDK_CONTROL_MASK); gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/File/Save"), accel_group, GDK_S, GDK_CONTROL_MASK); gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/File/Save As..."), accel_group, GDK_S, GDK_SHIFT_MASK | GDK_CONTROL_MASK); #ifdef ENABLE_PRINT gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/File/Print..."), accel_group, GDK_P, GDK_CONTROL_MASK); #endif gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/Edit/Undo"), accel_group, GDK_Z, GDK_CONTROL_MASK); */ gtk_widget_add_accelerator( gtk_item_factory_get_widget(ifactory, "/Edit/Undo"), "activate", accel_group, GDK_underscore, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); /* gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/Edit/Select All"), accel_group, GDK_A, GDK_CONTROL_MASK); gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Find..."), accel_group, GDK_F, GDK_CONTROL_MASK); */ gtk_widget_add_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Find..."), "activate", accel_group, GDK_S, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); /* gtk_widget_add_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Find Next"), "activate", accel_group, GDK_S, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); */ gtk_widget_add_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Find Previous"), "activate", accel_group, GDK_R, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); /* gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Replace..."), accel_group, GDK_H, GDK_CONTROL_MASK); */ gtk_widget_add_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Replace..."), "activate", accel_group, GDK_percent, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); /* gtk_widget_remove_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Jump To..."), accel_group, GDK_J, GDK_CONTROL_MASK); */ gtk_widget_add_accelerator( gtk_item_factory_get_widget(ifactory, "/Search/Jump To..."), "activate", accel_group, GDK_G, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); gtk_accel_group_connect( accel_group, GDK_X, GDK_CONTROL_MASK, 0, g_cclosure_new_swap(G_CALLBACK(emacs_key_prefix), NULL, NULL)); gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); return TRUE; }
static GtkWidget * create_window (int confirm_mode) { GtkWidget *w; GtkWidget *win, *box; GtkWidget *wvbox, *chbox, *bbox; GtkAccelGroup *acc; gchar *msg; tooltips = gtk_tooltips_new (); /* FIXME: check the grabbing code against the one we used with the old gpg-agent */ win = gtk_window_new (GTK_WINDOW_TOPLEVEL); acc = gtk_accel_group_new (); g_signal_connect (G_OBJECT (win), "delete_event", G_CALLBACK (delete_event), NULL); #if 0 g_signal_connect (G_OBJECT (win), "destroy", G_CALLBACK (gtk_main_quit), NULL); #endif g_signal_connect (G_OBJECT (win), "size-request", G_CALLBACK (constrain_size), NULL); if (!confirm_mode) { if (pinentry->grab) g_signal_connect (G_OBJECT (win), "realize", G_CALLBACK (make_transient), NULL); /* We need to grab the keyboard when its visible! not when its mapped (there is a difference) */ g_object_set (G_OBJECT(win), "events", GDK_VISIBILITY_NOTIFY_MASK | GDK_STRUCTURE_MASK, NULL); g_signal_connect (G_OBJECT (win), pinentry->grab ? "visibility-notify-event" : "focus-in-event", G_CALLBACK (grab_keyboard), NULL); g_signal_connect (G_OBJECT (win), pinentry->grab ? "unmap-event" : "focus-out-event", G_CALLBACK (ungrab_keyboard), NULL); } gtk_window_add_accel_group (GTK_WINDOW (win), acc); wvbox = gtk_vbox_new (FALSE, HIG_LARGE * 2); gtk_container_add (GTK_CONTAINER (win), wvbox); gtk_container_set_border_width (GTK_CONTAINER (wvbox), HIG_LARGE); chbox = gtk_hbox_new (FALSE, HIG_LARGE); gtk_box_pack_start (GTK_BOX (wvbox), chbox, FALSE, FALSE, 0); w = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.0); gtk_box_pack_start (GTK_BOX (chbox), w, FALSE, FALSE, 0); box = gtk_vbox_new (FALSE, HIG_SMALL); gtk_box_pack_start (GTK_BOX (chbox), box, TRUE, TRUE, 0); if (pinentry->title) { msg = pinentry_utf8_validate (pinentry->title); gtk_window_set_title (GTK_WINDOW(win), msg); } if (pinentry->description) { msg = pinentry_utf8_validate (pinentry->description); w = gtk_label_new (msg); g_free (msg); gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); gtk_label_set_line_wrap (GTK_LABEL (w), TRUE); gtk_box_pack_start (GTK_BOX (box), w, TRUE, FALSE, 0); } if (pinentry->error && !confirm_mode) { GdkColor color = { 0, 0xffff, 0, 0 }; msg = pinentry_utf8_validate (pinentry->error); w = gtk_label_new (msg); g_free (msg); gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); gtk_label_set_line_wrap (GTK_LABEL (w), TRUE); gtk_box_pack_start (GTK_BOX (box), w, TRUE, FALSE, 0); gtk_widget_modify_fg (w, GTK_STATE_NORMAL, &color); } qualitybar = NULL; if (!confirm_mode) { GtkWidget* table = gtk_table_new (pinentry->quality_bar ? 2 : 1, 2, FALSE); gtk_box_pack_start (GTK_BOX (box), table, FALSE, FALSE, 0); if (pinentry->prompt) { msg = pinentry_utf8_validate (pinentry->prompt); w = gtk_label_new_with_mnemonic (msg); g_free (msg); gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); gtk_table_attach (GTK_TABLE (table), w, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 4, 0); } entry = gtk_secure_entry_new (); gtk_widget_set_size_request (entry, 200, -1); g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (enter_callback), entry); g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (changed_text_handler), entry); gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0); gtk_widget_grab_focus (entry); gtk_widget_show (entry); if (pinentry->quality_bar) { msg = pinentry_utf8_validate (pinentry->quality_bar); w = gtk_label_new (msg); g_free (msg); gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); gtk_table_attach (GTK_TABLE (table), w, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 4, 0); qualitybar = gtk_progress_bar_new(); gtk_widget_add_events (qualitybar, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); gtk_progress_bar_set_text (GTK_PROGRESS_BAR (qualitybar), QUALITYBAR_EMPTY_TEXT); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (qualitybar), 0.0); if (pinentry->quality_bar_tt) gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), qualitybar, pinentry->quality_bar_tt, ""); gtk_table_attach (GTK_TABLE (table), qualitybar, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0); } #ifdef ENABLE_ENHANCED if (pinentry->enhanced) { GtkWidget *sbox = gtk_hbox_new (FALSE, HIG_SMALL); gtk_box_pack_start (GTK_BOX (box), sbox, FALSE, FALSE, 0); w = gtk_label_new ("Forget secret after"); gtk_box_pack_start (GTK_BOX (sbox), w, FALSE, FALSE, 0); gtk_widget_show (w); time_out = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, HUGE_VAL, 1, 60, 60)), 2, 0); gtk_box_pack_start (GTK_BOX (sbox), time_out, FALSE, FALSE, 0); gtk_widget_show (time_out); w = gtk_label_new ("seconds"); gtk_box_pack_start (GTK_BOX (sbox), w, FALSE, FALSE, 0); gtk_widget_show (w); gtk_widget_show (sbox); insure = gtk_check_button_new_with_label ("ask before giving out " "secret"); gtk_box_pack_start (GTK_BOX (box), insure, FALSE, FALSE, 0); gtk_widget_show (insure); } #endif } bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END); gtk_box_set_spacing (GTK_BOX (bbox), 6); gtk_box_pack_start (GTK_BOX (wvbox), bbox, TRUE, FALSE, 0); if (!pinentry->one_button) { if (pinentry->cancel) { msg = pinentry_utf8_validate (pinentry->cancel); w = gtk_button_new_with_mnemonic (msg); g_free (msg); } else if (pinentry->default_cancel) { GtkWidget *image; msg = pinentry_utf8_validate (pinentry->default_cancel); w = gtk_button_new_with_mnemonic (msg); g_free (msg); image = gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON); if (image) gtk_button_set_image (GTK_BUTTON (w), image); } else w = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_container_add (GTK_CONTAINER (bbox), w); g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK (confirm_mode ? confirm_button_clicked : button_clicked), (gpointer) CONFIRM_CANCEL); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); } if (confirm_mode && !pinentry->one_button && pinentry->notok) { msg = pinentry_utf8_validate (pinentry->notok); w = gtk_button_new_with_mnemonic (msg); g_free (msg); gtk_container_add (GTK_CONTAINER (bbox), w); g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK (confirm_button_clicked), (gpointer) CONFIRM_NOTOK); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); } if (pinentry->ok) { msg = pinentry_utf8_validate (pinentry->ok); w = gtk_button_new_with_mnemonic (msg); g_free (msg); } else if (pinentry->default_ok) { GtkWidget *image; msg = pinentry_utf8_validate (pinentry->default_ok); w = gtk_button_new_with_mnemonic (msg); g_free (msg); image = gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON); if (image) gtk_button_set_image (GTK_BUTTON (w), image); } else w = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_container_add (GTK_CONTAINER(bbox), w); if (!confirm_mode) { g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK (button_clicked), "ok"); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); g_signal_connect_object (G_OBJECT (entry), "focus_in_event", G_CALLBACK (gtk_widget_grab_default), G_OBJECT (w), 0); } else { g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK(confirm_button_clicked), (gpointer) CONFIRM_OK); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); } gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER); gtk_window_set_keep_above (GTK_WINDOW (win), TRUE); gtk_widget_show_all (win); gtk_window_present (GTK_WINDOW (win)); /* Make sure it has the focus. */ return win; }
int main(int argc, char *argv[]) { GtkWidget *window, *vbox, *notebook; wg_aux auxptr; nb_aux *nbfirst; #if 0 GtkWidget *menubar, *menu, *mn_wispy, *menuitem; #endif GtkWidget *menubar; GtkItemFactory *item_factory; GtkAccelGroup *accel_group; wispy_device_registry wdr; int x; char errstr[WISPY_ERROR_MAX]; setlocale(LC_ALL, ""); bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); gtk_init(&argc, &argv); wdr_init(&wdr); /* Turn on broadcast autodetection */ if (wdr_enable_bcast(&wdr, errstr) < 0) { Wispy_Alert_Dialog(errstr); } window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "WiSPY"); gtk_window_set_default_size(GTK_WINDOW(window), 750, 650); g_signal_connect(G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL); accel_group = gtk_accel_group_new(); item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); gtk_item_factory_create_items(item_factory, nmain_menu_items, main_menu_items, &auxptr); gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); menubar = gtk_item_factory_get_widget(item_factory, "<main>"); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show(vbox); gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0); gtk_widget_show(menubar); /* Make a notebook */ notebook = gtk_notebook_new(); gtk_box_pack_end(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); gtk_widget_show(notebook); auxptr.wdr = &wdr; auxptr.main_vbox = vbox; auxptr.main_window = window; auxptr.notebook = notebook; auxptr.num_tabs = 0; nbfirst = build_nb_page(notebook, &auxptr); gtk_widget_show(window); gtk_main(); return 0; }
GtkWidget* create_PreferencesFinancesMainwindow (void) { GtkWidget *PreferencesFinancesMainwindow; GtkWidget *vbox1; GtkWidget *menubar1; GtkWidget *file1; GtkWidget *file1_menu; GtkWidget *choosePrinter1; GtkWidget *separator2; GtkWidget *quit1; GtkWidget *mi_vat1; GtkWidget *mi_vat1_menu; GtkWidget *new1; GtkWidget *edit1; GtkWidget *save1; GtkWidget *separator3; GtkWidget *print1; GtkWidget *separator1; GtkWidget *clear1; GtkWidget *separator9; GtkWidget *chooseTaxVat; GtkWidget *mi_top1; GtkWidget *mi_top1_menu; GtkWidget *TopNew1; GtkWidget *TopEdit1; GtkWidget *TopSave1; GtkWidget *separator4; GtkWidget *TopPrint1; GtkWidget *separator5; GtkWidget *TopClear1; GtkWidget *separator11; GtkWidget *chooseTOP; GtkWidget *account_info1; GtkWidget *account_info1_menu; GtkWidget *AcctInfoNew1; GtkWidget *AcctInfoEdit1; GtkWidget *AcctInfoSave1; GtkWidget *separator6; GtkWidget *AcctInfoPrint1; GtkWidget *AcctInfoClear1; GtkWidget *separator10; GtkWidget *choose_acct1; GtkWidget *account_plan1; GtkWidget *account_plan1_menu; GtkWidget *AcctPlanNew1; GtkWidget *AcctPlanEdit1; GtkWidget *AcctPlanSave1; GtkWidget *separator8; GtkWidget *AcctPlanPrint1; GtkWidget *AcctPlanClear1; GtkWidget *toolbar1; GtkIconSize tmp_toolbar_icon_size; GtkWidget *hbox1; GtkWidget *lFindName; GtkWidget *eFindName; GtkWidget *lFindDescription; GtkWidget *eFindDescription; GtkWidget *button1; GtkWidget *scrolledwindow1; GtkWidget *viewport1; GtkWidget *tree1; GtkWidget *notebook1; GtkWidget *fixed3; GtkWidget *eVatName; GtkWidget *eVatDescription; GtkWidget *label1; GtkWidget *eVatValue; GtkWidget *label2; GtkWidget *label63; GtkWidget *eVatType; GtkWidget *eVatCountry; GtkWidget *eVatDef; GtkWidget *eVatCoeficient; GtkWidget *eVatAcct1; GtkWidget *eVatAcct2; GtkWidget *label31; GtkWidget *label60; GtkWidget *label61; GtkWidget *label62; GtkWidget *label64; GtkWidget *label65; GtkWidget *lProfile; GtkWidget *vbox2; GtkWidget *hbox3; GtkWidget *table5; GtkWidget *label42; GtkWidget *label43; GtkWidget *label44; GtkWidget *eTPName; GtkWidget *eTPDesignation; GtkWidget *scrolledwindow2; GtkWidget *tvTPText; GtkWidget *table6; GtkWidget *label45; GtkWidget *label46; GtkWidget *label47; GtkWidget *label48; GtkWidget *label49; GtkWidget *eTPDays; GtkWidget *eTPDelay; GtkWidget *entry17; GtkWidget *entry18; GtkWidget *entry19; GtkWidget *table7; GtkWidget *label50; GtkWidget *label51; GtkWidget *label52; GtkWidget *label53; GtkWidget *label54; GtkWidget *label55; GtkWidget *label56; GtkWidget *label57; GtkWidget *label58; GtkWidget *label59; GtkWidget *eTPValue1; GtkWidget *eTPValue3; GtkWidget *eTPValue4; GtkWidget *eTPValue5; GtkWidget *eTPValue6; GtkWidget *eTPValue7; GtkWidget *eTPValue8; GtkWidget *eTPValue9; GtkWidget *eTPValue10; GtkWidget *eTPValue2; GtkWidget *label30; GtkWidget *table1; GtkWidget *label66; GtkWidget *label67; GtkWidget *label68; GtkWidget *label69; GtkWidget *eAcctAccount; GtkWidget *eAcctType; GtkWidget *eAcctDesignation; GtkWidget *eAcctEG; GtkWidget *label70; GtkWidget *bImportAcct; GtkWidget *hbox4; GtkWidget *eAcctAcctPlan; GtkWidget *eAcctPlanText; GtkWidget *label71; GtkWidget *table8; GtkWidget *label73; GtkWidget *eAcctPlanNumber; GtkWidget *label74; GtkWidget *eAcctPlanDesignation; GtkWidget *label72; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new (); PreferencesFinancesMainwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (PreferencesFinancesMainwindow), _("Finances Preferences")); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (PreferencesFinancesMainwindow), vbox1); menubar1 = gtk_menu_bar_new (); gtk_widget_show (menubar1); gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0); file1 = gtk_menu_item_new_with_mnemonic (_("_File")); gtk_widget_show (file1); gtk_container_add (GTK_CONTAINER (menubar1), file1); file1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (file1), file1_menu); choosePrinter1 = gtk_menu_item_new_with_mnemonic (_("Print S_etup...")); gtk_widget_show (choosePrinter1); gtk_container_add (GTK_CONTAINER (file1_menu), choosePrinter1); separator2 = gtk_separator_menu_item_new (); gtk_widget_show (separator2); gtk_container_add (GTK_CONTAINER (file1_menu), separator2); gtk_widget_set_sensitive (separator2, FALSE); quit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group); gtk_widget_show (quit1); gtk_container_add (GTK_CONTAINER (file1_menu), quit1); mi_vat1 = gtk_menu_item_new_with_mnemonic (_("Vat")); gtk_widget_show (mi_vat1); gtk_container_add (GTK_CONTAINER (menubar1), mi_vat1); mi_vat1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi_vat1), mi_vat1_menu); new1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); gtk_widget_show (new1); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), new1); edit1 = gtk_image_menu_item_new_from_stock ("gtk-edit", accel_group); gtk_widget_show (edit1); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), edit1); save1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); gtk_widget_show (save1); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), save1); separator3 = gtk_separator_menu_item_new (); gtk_widget_show (separator3); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), separator3); gtk_widget_set_sensitive (separator3, FALSE); print1 = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group); gtk_widget_show (print1); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), print1); separator1 = gtk_separator_menu_item_new (); gtk_widget_show (separator1); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), separator1); gtk_widget_set_sensitive (separator1, FALSE); clear1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); gtk_widget_show (clear1); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), clear1); separator9 = gtk_separator_menu_item_new (); gtk_widget_show (separator9); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), separator9); gtk_widget_set_sensitive (separator9, FALSE); chooseTaxVat = gtk_menu_item_new_with_mnemonic (_("choose")); gtk_widget_show (chooseTaxVat); gtk_container_add (GTK_CONTAINER (mi_vat1_menu), chooseTaxVat); mi_top1 = gtk_menu_item_new_with_mnemonic (_("Terms Of Payment")); gtk_widget_show (mi_top1); gtk_container_add (GTK_CONTAINER (menubar1), mi_top1); mi_top1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi_top1), mi_top1_menu); TopNew1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); gtk_widget_show (TopNew1); gtk_container_add (GTK_CONTAINER (mi_top1_menu), TopNew1); TopEdit1 = gtk_image_menu_item_new_from_stock ("gtk-edit", accel_group); gtk_widget_show (TopEdit1); gtk_container_add (GTK_CONTAINER (mi_top1_menu), TopEdit1); TopSave1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); gtk_widget_show (TopSave1); gtk_container_add (GTK_CONTAINER (mi_top1_menu), TopSave1); separator4 = gtk_separator_menu_item_new (); gtk_widget_show (separator4); gtk_container_add (GTK_CONTAINER (mi_top1_menu), separator4); gtk_widget_set_sensitive (separator4, FALSE); TopPrint1 = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group); gtk_widget_show (TopPrint1); gtk_container_add (GTK_CONTAINER (mi_top1_menu), TopPrint1); separator5 = gtk_separator_menu_item_new (); gtk_widget_show (separator5); gtk_container_add (GTK_CONTAINER (mi_top1_menu), separator5); gtk_widget_set_sensitive (separator5, FALSE); TopClear1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); gtk_widget_show (TopClear1); gtk_container_add (GTK_CONTAINER (mi_top1_menu), TopClear1); separator11 = gtk_separator_menu_item_new (); gtk_widget_show (separator11); gtk_container_add (GTK_CONTAINER (mi_top1_menu), separator11); gtk_widget_set_sensitive (separator11, FALSE); chooseTOP = gtk_menu_item_new_with_mnemonic (_("choose TOP")); gtk_widget_show (chooseTOP); gtk_container_add (GTK_CONTAINER (mi_top1_menu), chooseTOP); account_info1 = gtk_menu_item_new_with_mnemonic (_("Account-Info")); gtk_widget_show (account_info1); gtk_container_add (GTK_CONTAINER (menubar1), account_info1); account_info1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (account_info1), account_info1_menu); AcctInfoNew1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); gtk_widget_show (AcctInfoNew1); gtk_container_add (GTK_CONTAINER (account_info1_menu), AcctInfoNew1); AcctInfoEdit1 = gtk_image_menu_item_new_from_stock ("gtk-edit", accel_group); gtk_widget_show (AcctInfoEdit1); gtk_container_add (GTK_CONTAINER (account_info1_menu), AcctInfoEdit1); AcctInfoSave1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); gtk_widget_show (AcctInfoSave1); gtk_container_add (GTK_CONTAINER (account_info1_menu), AcctInfoSave1); separator6 = gtk_separator_menu_item_new (); gtk_widget_show (separator6); gtk_container_add (GTK_CONTAINER (account_info1_menu), separator6); gtk_widget_set_sensitive (separator6, FALSE); AcctInfoPrint1 = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group); gtk_widget_show (AcctInfoPrint1); gtk_container_add (GTK_CONTAINER (account_info1_menu), AcctInfoPrint1); AcctInfoClear1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); gtk_widget_show (AcctInfoClear1); gtk_container_add (GTK_CONTAINER (account_info1_menu), AcctInfoClear1); separator10 = gtk_separator_menu_item_new (); gtk_widget_show (separator10); gtk_container_add (GTK_CONTAINER (account_info1_menu), separator10); gtk_widget_set_sensitive (separator10, FALSE); choose_acct1 = gtk_menu_item_new_with_mnemonic (_("choose Acct")); gtk_widget_show (choose_acct1); gtk_container_add (GTK_CONTAINER (account_info1_menu), choose_acct1); account_plan1 = gtk_menu_item_new_with_mnemonic (_("Account-Plan")); gtk_widget_show (account_plan1); gtk_container_add (GTK_CONTAINER (menubar1), account_plan1); account_plan1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (account_plan1), account_plan1_menu); AcctPlanNew1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); gtk_widget_show (AcctPlanNew1); gtk_container_add (GTK_CONTAINER (account_plan1_menu), AcctPlanNew1); AcctPlanEdit1 = gtk_image_menu_item_new_from_stock ("gtk-edit", accel_group); gtk_widget_show (AcctPlanEdit1); gtk_container_add (GTK_CONTAINER (account_plan1_menu), AcctPlanEdit1); AcctPlanSave1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); gtk_widget_show (AcctPlanSave1); gtk_container_add (GTK_CONTAINER (account_plan1_menu), AcctPlanSave1); separator8 = gtk_separator_menu_item_new (); gtk_widget_show (separator8); gtk_container_add (GTK_CONTAINER (account_plan1_menu), separator8); gtk_widget_set_sensitive (separator8, FALSE); AcctPlanPrint1 = gtk_separator_menu_item_new (); gtk_widget_show (AcctPlanPrint1); gtk_container_add (GTK_CONTAINER (account_plan1_menu), AcctPlanPrint1); gtk_widget_set_sensitive (AcctPlanPrint1, FALSE); AcctPlanClear1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); gtk_widget_show (AcctPlanClear1); gtk_container_add (GTK_CONTAINER (account_plan1_menu), AcctPlanClear1); toolbar1 = gtk_toolbar_new (); gtk_widget_show (toolbar1); gtk_box_pack_start (GTK_BOX (vbox1), toolbar1, FALSE, FALSE, 0); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH); tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1)); hbox1 = gtk_hbox_new (TRUE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); lFindName = gtk_label_new (_("Name")); gtk_widget_show (lFindName); gtk_box_pack_start (GTK_BOX (hbox1), lFindName, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (lFindName), GTK_JUSTIFY_CENTER); eFindName = gtk_entry_new (); gtk_widget_show (eFindName); gtk_box_pack_start (GTK_BOX (hbox1), eFindName, FALSE, FALSE, 0); lFindDescription = gtk_label_new (_("Descript.")); gtk_widget_show (lFindDescription); gtk_box_pack_start (GTK_BOX (hbox1), lFindDescription, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (lFindDescription), GTK_JUSTIFY_CENTER); eFindDescription = gtk_entry_new (); gtk_widget_show (eFindDescription); gtk_box_pack_start (GTK_BOX (hbox1), eFindDescription, FALSE, FALSE, 0); button1 = gtk_button_new_with_mnemonic (_("Search")); gtk_widget_show (button1); gtk_box_pack_start (GTK_BOX (hbox1), button1, FALSE, FALSE, 0); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow1); gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0); gtk_widget_set_size_request (scrolledwindow1, -1, 111); GTK_WIDGET_UNSET_FLAGS (scrolledwindow1, GTK_CAN_FOCUS); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); viewport1 = gtk_viewport_new (NULL, NULL); gtk_widget_show (viewport1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1); tree1 = gtk_tree_view_new (); gtk_widget_show (tree1); gtk_container_add (GTK_CONTAINER (viewport1), tree1); gtk_widget_set_size_request (tree1, -1, 114); GTK_WIDGET_UNSET_FLAGS (tree1, GTK_CAN_FOCUS); notebook1 = gtk_notebook_new (); gtk_widget_show (notebook1); gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0); fixed3 = gtk_fixed_new (); gtk_widget_show (fixed3); gtk_container_add (GTK_CONTAINER (notebook1), fixed3); eVatName = gtk_entry_new (); gtk_widget_show (eVatName); gtk_fixed_put (GTK_FIXED (fixed3), eVatName, 128, 8); gtk_widget_set_size_request (eVatName, 0, 0); eVatDescription = gtk_entry_new (); gtk_widget_show (eVatDescription); gtk_fixed_put (GTK_FIXED (fixed3), eVatDescription, 128, 56); gtk_widget_set_size_request (eVatDescription, 0, 0); label1 = gtk_label_new (_("Name")); gtk_widget_show (label1); gtk_fixed_put (GTK_FIXED (fixed3), label1, 8, 8); gtk_widget_set_size_request (label1, 0, 0); eVatValue = gtk_entry_new (); gtk_widget_show (eVatValue); gtk_fixed_put (GTK_FIXED (fixed3), eVatValue, 128, 104); gtk_widget_set_size_request (eVatValue, 158, 31); label2 = gtk_label_new (_("Description")); gtk_widget_show (label2); gtk_fixed_put (GTK_FIXED (fixed3), label2, 8, 56); gtk_widget_set_size_request (label2, 0, 0); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER); label63 = gtk_label_new (_("Coefficient")); gtk_widget_show (label63); gtk_fixed_put (GTK_FIXED (fixed3), label63, 392, 24); gtk_widget_set_size_request (label63, 0, 0); eVatType = gtk_entry_new (); gtk_widget_show (eVatType); gtk_fixed_put (GTK_FIXED (fixed3), eVatType, 128, 168); gtk_widget_set_size_request (eVatType, 160, 33); eVatCountry = gtk_entry_new (); gtk_widget_show (eVatCountry); gtk_fixed_put (GTK_FIXED (fixed3), eVatCountry, 128, 216); gtk_widget_set_size_request (eVatCountry, 160, 33); eVatDef = gtk_entry_new (); gtk_widget_show (eVatDef); gtk_fixed_put (GTK_FIXED (fixed3), eVatDef, 128, 264); gtk_widget_set_size_request (eVatDef, 160, 33); eVatCoeficient = gtk_entry_new (); gtk_widget_show (eVatCoeficient); gtk_fixed_put (GTK_FIXED (fixed3), eVatCoeficient, 520, 16); gtk_widget_set_size_request (eVatCoeficient, 160, 33); eVatAcct1 = gtk_entry_new (); gtk_widget_show (eVatAcct1); gtk_fixed_put (GTK_FIXED (fixed3), eVatAcct1, 520, 64); gtk_widget_set_size_request (eVatAcct1, 160, 33); eVatAcct2 = gtk_entry_new (); gtk_widget_show (eVatAcct2); gtk_fixed_put (GTK_FIXED (fixed3), eVatAcct2, 520, 112); gtk_widget_set_size_request (eVatAcct2, 160, 33); label31 = gtk_label_new (_("Vat Value")); gtk_widget_show (label31); gtk_fixed_put (GTK_FIXED (fixed3), label31, 8, 104); gtk_widget_set_size_request (label31, 0, 0); label60 = gtk_label_new (_("Type")); gtk_widget_show (label60); gtk_fixed_put (GTK_FIXED (fixed3), label60, 8, 168); gtk_widget_set_size_request (label60, 0, 0); label61 = gtk_label_new (_("Country")); gtk_widget_show (label61); gtk_fixed_put (GTK_FIXED (fixed3), label61, 8, 216); gtk_widget_set_size_request (label61, 0, 0); label62 = gtk_label_new (_("Def.")); gtk_widget_show (label62); gtk_fixed_put (GTK_FIXED (fixed3), label62, 8, 264); gtk_widget_set_size_request (label62, 0, 0); label64 = gtk_label_new (_("acct. 1")); gtk_widget_show (label64); gtk_fixed_put (GTK_FIXED (fixed3), label64, 392, 72); gtk_widget_set_size_request (label64, 0, 0); label65 = gtk_label_new (_("acct. 2")); gtk_widget_show (label65); gtk_fixed_put (GTK_FIXED (fixed3), label65, 392, 120); gtk_widget_set_size_request (label65, 70, 23); lProfile = gtk_label_new (_("VAT")); gtk_widget_show (lProfile); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), lProfile); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_container_add (GTK_CONTAINER (notebook1), vbox2); hbox3 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox3); gtk_box_pack_start (GTK_BOX (vbox2), hbox3, TRUE, TRUE, 0); table5 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table5); gtk_box_pack_start (GTK_BOX (hbox3), table5, TRUE, TRUE, 0); label42 = gtk_label_new (_("Name")); gtk_widget_show (label42); gtk_table_attach (GTK_TABLE (table5), label42, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label42), 0, 0.5); label43 = gtk_label_new (_("Designation")); gtk_widget_show (label43); gtk_table_attach (GTK_TABLE (table5), label43, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label43), 0, 0.5); label44 = gtk_label_new (_("Text")); gtk_widget_show (label44); gtk_table_attach (GTK_TABLE (table5), label44, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label44), 0, 0.5); eTPName = gtk_entry_new (); gtk_widget_show (eTPName); gtk_table_attach (GTK_TABLE (table5), eTPName, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPDesignation = gtk_entry_new (); gtk_widget_show (eTPDesignation); gtk_table_attach (GTK_TABLE (table5), eTPDesignation, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow2); gtk_table_attach (GTK_TABLE (table5), scrolledwindow2, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN); tvTPText = gtk_text_view_new (); gtk_widget_show (tvTPText); gtk_container_add (GTK_CONTAINER (scrolledwindow2), tvTPText); table6 = gtk_table_new (5, 2, TRUE); gtk_widget_show (table6); gtk_box_pack_start (GTK_BOX (hbox3), table6, TRUE, TRUE, 1); gtk_container_set_border_width (GTK_CONTAINER (table6), 1); gtk_table_set_row_spacings (GTK_TABLE (table6), 1); gtk_table_set_col_spacings (GTK_TABLE (table6), 2); label45 = gtk_label_new (_("Days")); gtk_widget_show (label45); gtk_table_attach (GTK_TABLE (table6), label45, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label45), 0, 0.5); label46 = gtk_label_new (_("Delay")); gtk_widget_show (label46); gtk_table_attach (GTK_TABLE (table6), label46, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label46), 0, 0.5); label47 = gtk_label_new (""); gtk_widget_show (label47); gtk_table_attach (GTK_TABLE (table6), label47, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label47), 0, 0.5); label48 = gtk_label_new (""); gtk_widget_show (label48); gtk_table_attach (GTK_TABLE (table6), label48, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label48), 0, 0.5); label49 = gtk_label_new (""); gtk_widget_show (label49); gtk_table_attach (GTK_TABLE (table6), label49, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label49), 0, 0.5); eTPDays = gtk_entry_new (); gtk_widget_show (eTPDays); gtk_table_attach (GTK_TABLE (table6), eTPDays, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPDelay = gtk_entry_new (); gtk_widget_show (eTPDelay); gtk_table_attach (GTK_TABLE (table6), eTPDelay, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry17 = gtk_entry_new (); gtk_widget_show (entry17); gtk_table_attach (GTK_TABLE (table6), entry17, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry18 = gtk_entry_new (); gtk_widget_show (entry18); gtk_table_attach (GTK_TABLE (table6), entry18, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry19 = gtk_entry_new (); gtk_widget_show (entry19); gtk_table_attach (GTK_TABLE (table6), entry19, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); table7 = gtk_table_new (5, 4, FALSE); gtk_widget_show (table7); gtk_box_pack_start (GTK_BOX (vbox2), table7, TRUE, TRUE, 0); label50 = gtk_label_new (_("##Value1")); gtk_widget_show (label50); gtk_table_attach (GTK_TABLE (table7), label50, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label50), 0, 0.5); label51 = gtk_label_new (_("##Value2")); gtk_widget_show (label51); gtk_table_attach (GTK_TABLE (table7), label51, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label51), 0, 0.5); label52 = gtk_label_new (_("##Value3")); gtk_widget_show (label52); gtk_table_attach (GTK_TABLE (table7), label52, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label52), 0, 0.5); label53 = gtk_label_new (_("##Value4")); gtk_widget_show (label53); gtk_table_attach (GTK_TABLE (table7), label53, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label53), 0, 0.5); label54 = gtk_label_new (_("##Value5")); gtk_widget_show (label54); gtk_table_attach (GTK_TABLE (table7), label54, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label54), 0, 0.5); label55 = gtk_label_new (_("##Value6")); gtk_widget_show (label55); gtk_table_attach (GTK_TABLE (table7), label55, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label55), 0, 0.5); label56 = gtk_label_new (_("##Value7")); gtk_widget_show (label56); gtk_table_attach (GTK_TABLE (table7), label56, 2, 3, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label56), 0, 0.5); label57 = gtk_label_new (_("##Value8")); gtk_widget_show (label57); gtk_table_attach (GTK_TABLE (table7), label57, 2, 3, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label57), 0, 0.5); label58 = gtk_label_new (_("##Value9")); gtk_widget_show (label58); gtk_table_attach (GTK_TABLE (table7), label58, 2, 3, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label58), 0, 0.5); label59 = gtk_label_new (_("##Value10")); gtk_widget_show (label59); gtk_table_attach (GTK_TABLE (table7), label59, 2, 3, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label59), 0, 0.5); eTPValue1 = gtk_entry_new (); gtk_widget_show (eTPValue1); gtk_table_attach (GTK_TABLE (table7), eTPValue1, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue3 = gtk_entry_new (); gtk_widget_show (eTPValue3); gtk_table_attach (GTK_TABLE (table7), eTPValue3, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue4 = gtk_entry_new (); gtk_widget_show (eTPValue4); gtk_table_attach (GTK_TABLE (table7), eTPValue4, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue5 = gtk_entry_new (); gtk_widget_show (eTPValue5); gtk_table_attach (GTK_TABLE (table7), eTPValue5, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue6 = gtk_entry_new (); gtk_widget_show (eTPValue6); gtk_table_attach (GTK_TABLE (table7), eTPValue6, 3, 4, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue7 = gtk_entry_new (); gtk_widget_show (eTPValue7); gtk_table_attach (GTK_TABLE (table7), eTPValue7, 3, 4, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue8 = gtk_entry_new (); gtk_widget_show (eTPValue8); gtk_table_attach (GTK_TABLE (table7), eTPValue8, 3, 4, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue9 = gtk_entry_new (); gtk_widget_show (eTPValue9); gtk_table_attach (GTK_TABLE (table7), eTPValue9, 3, 4, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue10 = gtk_entry_new (); gtk_widget_show (eTPValue10); gtk_table_attach (GTK_TABLE (table7), eTPValue10, 3, 4, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eTPValue2 = gtk_entry_new (); gtk_widget_show (eTPValue2); gtk_table_attach (GTK_TABLE (table7), eTPValue2, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label30 = gtk_label_new (_("Terms of Payment")); gtk_widget_show (label30); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label30); table1 = gtk_table_new (6, 4, FALSE); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (notebook1), table1); label66 = gtk_label_new (_("Acct.")); gtk_widget_show (label66); gtk_table_attach (GTK_TABLE (table1), label66, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label66), 0, 0.5); label67 = gtk_label_new (_("Type")); gtk_widget_show (label67); gtk_table_attach (GTK_TABLE (table1), label67, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label67), 0, 0.5); label68 = gtk_label_new (_("Descr.")); gtk_widget_show (label68); gtk_table_attach (GTK_TABLE (table1), label68, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label68), 0, 0.5); label69 = gtk_label_new (_("EG")); gtk_widget_show (label69); gtk_table_attach (GTK_TABLE (table1), label69, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label69), 0, 0.5); eAcctAccount = gtk_entry_new (); gtk_widget_show (eAcctAccount); gtk_table_attach (GTK_TABLE (table1), eAcctAccount, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_editable_set_editable (GTK_EDITABLE (eAcctAccount), FALSE); eAcctType = gtk_entry_new (); gtk_widget_show (eAcctType); gtk_table_attach (GTK_TABLE (table1), eAcctType, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eAcctDesignation = gtk_entry_new (); gtk_widget_show (eAcctDesignation); gtk_table_attach (GTK_TABLE (table1), eAcctDesignation, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); eAcctEG = gtk_entry_new (); gtk_widget_show (eAcctEG); gtk_table_attach (GTK_TABLE (table1), eAcctEG, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label70 = gtk_label_new (_("Acct.-Plan")); gtk_widget_show (label70); gtk_table_attach (GTK_TABLE (table1), label70, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label70), 0, 0.5); bImportAcct = gtk_button_new_with_mnemonic (_("import Acct.")); gtk_widget_show (bImportAcct); gtk_table_attach (GTK_TABLE (table1), bImportAcct, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); hbox4 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox4); gtk_table_attach (GTK_TABLE (table1), hbox4, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); eAcctAcctPlan = gtk_entry_new (); gtk_widget_show (eAcctAcctPlan); gtk_box_pack_start (GTK_BOX (hbox4), eAcctAcctPlan, TRUE, TRUE, 0); gtk_widget_add_accelerator (eAcctAcctPlan, "activate", accel_group, GDK_F1, (GdkModifierType) GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_entry_set_width_chars (GTK_ENTRY (eAcctAcctPlan), 6); eAcctPlanText = gtk_entry_new (); gtk_widget_show (eAcctPlanText); gtk_box_pack_start (GTK_BOX (hbox4), eAcctPlanText, TRUE, TRUE, 0); gtk_editable_set_editable (GTK_EDITABLE (eAcctPlanText), FALSE); label71 = gtk_label_new (_("Acct")); gtk_widget_show (label71); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label71); table8 = gtk_table_new (4, 4, FALSE); gtk_widget_show (table8); gtk_container_add (GTK_CONTAINER (notebook1), table8); label73 = gtk_label_new (_("Number")); gtk_widget_show (label73); gtk_table_attach (GTK_TABLE (table8), label73, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label73), 0, 0.5); eAcctPlanNumber = gtk_entry_new (); gtk_widget_show (eAcctPlanNumber); gtk_table_attach (GTK_TABLE (table8), eAcctPlanNumber, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label74 = gtk_label_new (_("Designation")); gtk_widget_show (label74); gtk_table_attach (GTK_TABLE (table8), label74, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label74), 0, 0.5); eAcctPlanDesignation = gtk_entry_new (); gtk_widget_show (eAcctPlanDesignation); gtk_table_attach (GTK_TABLE (table8), eAcctPlanDesignation, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label72 = gtk_label_new (_("Acct.-Plan")); gtk_widget_show (label72); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label72); g_signal_connect ((gpointer) choosePrinter1, "activate", G_CALLBACK (on_choosePrinter1_activate), NULL); g_signal_connect ((gpointer) quit1, "activate", G_CALLBACK (on_quit1_activate), NULL); g_signal_connect ((gpointer) new1, "activate", G_CALLBACK (on_VatNew1_activate), NULL); g_signal_connect ((gpointer) edit1, "activate", G_CALLBACK (on_VatEdit1_activate), NULL); g_signal_connect ((gpointer) save1, "activate", G_CALLBACK (on_VatSave1_activate), NULL); g_signal_connect ((gpointer) print1, "activate", G_CALLBACK (on_VatPrint1_activate), NULL); g_signal_connect ((gpointer) clear1, "activate", G_CALLBACK (on_VatClear1_activate), NULL); g_signal_connect ((gpointer) chooseTaxVat, "activate", G_CALLBACK (on_chooseTaxVat_activate), NULL); g_signal_connect ((gpointer) TopNew1, "activate", G_CALLBACK (on_TopNew1_activate), NULL); g_signal_connect ((gpointer) TopEdit1, "activate", G_CALLBACK (on_TopEdit1_activate), NULL); g_signal_connect ((gpointer) TopSave1, "activate", G_CALLBACK (on_TopSave1_activate), NULL); g_signal_connect ((gpointer) TopPrint1, "activate", G_CALLBACK (on_TopPrint1_activate), NULL); g_signal_connect ((gpointer) TopClear1, "activate", G_CALLBACK (on_TopClear1_activate), NULL); g_signal_connect ((gpointer) chooseTOP, "activate", G_CALLBACK (on_chooseTop_activate), NULL); g_signal_connect ((gpointer) AcctInfoNew1, "activate", G_CALLBACK (on_AcctInfoNew1_activate), NULL); g_signal_connect ((gpointer) AcctInfoEdit1, "activate", G_CALLBACK (on_AcctInfoEdit1_activate), NULL); g_signal_connect ((gpointer) AcctInfoSave1, "activate", G_CALLBACK (on_AcctInfoSave1_activate), NULL); g_signal_connect ((gpointer) AcctInfoPrint1, "activate", G_CALLBACK (on_AcctInfoPrint1_activate), NULL); g_signal_connect ((gpointer) AcctInfoClear1, "activate", G_CALLBACK (on_AcctInfoClear1_activate), NULL); g_signal_connect ((gpointer) choose_acct1, "activate", G_CALLBACK (on_choose_acct1_activate), NULL); g_signal_connect ((gpointer) AcctPlanNew1, "activate", G_CALLBACK (on_AcctPlanNew1_activate), NULL); g_signal_connect ((gpointer) AcctPlanEdit1, "activate", G_CALLBACK (on_AcctPlanEdit1_activate), NULL); g_signal_connect ((gpointer) AcctPlanSave1, "activate", G_CALLBACK (on_AcctPlanSave1_activate), NULL); g_signal_connect ((gpointer) AcctPlanPrint1, "activate", G_CALLBACK (on_AcctPlanPrint1_activate), NULL); g_signal_connect ((gpointer) AcctPlanClear1, "activate", G_CALLBACK (on_AcctPlanClear1_activate), NULL); g_signal_connect ((gpointer) button1, "clicked", G_CALLBACK (on_bSearch_clicked), NULL); g_signal_connect ((gpointer) tree1, "row_activated", G_CALLBACK (on_tree1_row_activated), NULL); g_signal_connect ((gpointer) notebook1, "switch_page", G_CALLBACK (on_notebook1_switch_page), NULL); g_signal_connect ((gpointer) bImportAcct, "clicked", G_CALLBACK (on_bImportAcct_clicked), NULL); g_signal_connect ((gpointer) eAcctAcctPlan, "changed", G_CALLBACK (on_eAcctAcctPlan_changed), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (PreferencesFinancesMainwindow, PreferencesFinancesMainwindow, "PreferencesFinancesMainwindow"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, menubar1, "menubar1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, file1, "file1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, file1_menu, "file1_menu"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, choosePrinter1, "choosePrinter1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator2, "separator2"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, quit1, "quit1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, mi_vat1, "mi_vat1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, mi_vat1_menu, "mi_vat1_menu"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, new1, "new1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, edit1, "edit1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, save1, "save1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator3, "separator3"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, print1, "print1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator1, "separator1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, clear1, "clear1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator9, "separator9"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, chooseTaxVat, "chooseTaxVat"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, mi_top1, "mi_top1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, mi_top1_menu, "mi_top1_menu"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, TopNew1, "TopNew1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, TopEdit1, "TopEdit1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, TopSave1, "TopSave1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator4, "separator4"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, TopPrint1, "TopPrint1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator5, "separator5"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, TopClear1, "TopClear1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator11, "separator11"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, chooseTOP, "chooseTOP"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, account_info1, "account_info1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, account_info1_menu, "account_info1_menu"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctInfoNew1, "AcctInfoNew1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctInfoEdit1, "AcctInfoEdit1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctInfoSave1, "AcctInfoSave1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator6, "separator6"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctInfoPrint1, "AcctInfoPrint1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctInfoClear1, "AcctInfoClear1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator10, "separator10"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, choose_acct1, "choose_acct1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, account_plan1, "account_plan1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, account_plan1_menu, "account_plan1_menu"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctPlanNew1, "AcctPlanNew1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctPlanEdit1, "AcctPlanEdit1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctPlanSave1, "AcctPlanSave1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, separator8, "separator8"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctPlanPrint1, "AcctPlanPrint1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, AcctPlanClear1, "AcctPlanClear1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, toolbar1, "toolbar1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, lFindName, "lFindName"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eFindName, "eFindName"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, lFindDescription, "lFindDescription"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eFindDescription, "eFindDescription"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, button1, "button1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, scrolledwindow1, "scrolledwindow1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, viewport1, "viewport1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, tree1, "tree1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, notebook1, "notebook1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, fixed3, "fixed3"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatName, "eVatName"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatDescription, "eVatDescription"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label1, "label1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatValue, "eVatValue"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label2, "label2"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label63, "label63"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatType, "eVatType"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatCountry, "eVatCountry"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatDef, "eVatDef"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatCoeficient, "eVatCoeficient"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatAcct1, "eVatAcct1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eVatAcct2, "eVatAcct2"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label31, "label31"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label60, "label60"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label61, "label61"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label62, "label62"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label64, "label64"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label65, "label65"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, lProfile, "lProfile"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, vbox2, "vbox2"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, hbox3, "hbox3"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, table5, "table5"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label42, "label42"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label43, "label43"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label44, "label44"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPName, "eTPName"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPDesignation, "eTPDesignation"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, scrolledwindow2, "scrolledwindow2"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, tvTPText, "tvTPText"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, table6, "table6"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label45, "label45"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label46, "label46"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label47, "label47"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label48, "label48"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label49, "label49"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPDays, "eTPDays"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPDelay, "eTPDelay"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, entry17, "entry17"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, entry18, "entry18"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, entry19, "entry19"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, table7, "table7"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label50, "label50"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label51, "label51"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label52, "label52"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label53, "label53"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label54, "label54"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label55, "label55"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label56, "label56"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label57, "label57"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label58, "label58"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label59, "label59"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue1, "eTPValue1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue3, "eTPValue3"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue4, "eTPValue4"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue5, "eTPValue5"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue6, "eTPValue6"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue7, "eTPValue7"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue8, "eTPValue8"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue9, "eTPValue9"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue10, "eTPValue10"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eTPValue2, "eTPValue2"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label30, "label30"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, table1, "table1"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label66, "label66"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label67, "label67"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label68, "label68"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label69, "label69"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctAccount, "eAcctAccount"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctType, "eAcctType"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctDesignation, "eAcctDesignation"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctEG, "eAcctEG"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label70, "label70"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, bImportAcct, "bImportAcct"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, hbox4, "hbox4"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctAcctPlan, "eAcctAcctPlan"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctPlanText, "eAcctPlanText"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label71, "label71"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, table8, "table8"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label73, "label73"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctPlanNumber, "eAcctPlanNumber"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label74, "label74"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, eAcctPlanDesignation, "eAcctPlanDesignation"); GLADE_HOOKUP_OBJECT (PreferencesFinancesMainwindow, label72, "label72"); gtk_window_add_accel_group (GTK_WINDOW (PreferencesFinancesMainwindow), accel_group); return PreferencesFinancesMainwindow; }
void gui_init () { GtkWidget *hbox = NULL, *vbox = NULL, *vbox1 = NULL, *frame = NULL; GtkWidget *separator; GtkAccelGroup *ag; GtkItemFactoryEntry game_items [num_games+1]; GtkItemFactoryEntry items[] = { #if GTK_MAJOR_VERSION == 1 /* { "/_File", NULL, NULL, 0, "<Branch>" }, { "/File/_Load game", "<control>L", menu_load_file_dialog, 0, "" }, { "/File/_Save game", NULL, NULL, 0, "" }, { "/File/_Quit", "<control>Q", (GtkSignalFunc) ui_cleanup, 0, "" }, */ { "/_Game", NULL, NULL, 0, "<Branch>" }, { "/Game/Select _Game", NULL, NULL, 0, "<LastBranch>" }, { "/Game/_Levels", NULL, NULL, 0, "<Branch>"}, { "/Game/Sep1", NULL, NULL, 0, "<Separator>" }, { "/Game/_New", "<control>N", menu_start_stop_game, MENU_RESET_GAME, "" }, { "/Game/_Start", "<control>G", menu_start_stop_game, MENU_START_GAME, "" }, { "/Game/_Pause", "<control>P", menu_start_stop_game, MENU_STOP_GAME, "" }, { "/Game/Sep2", NULL, NULL, 0, "<Separator>" }, { "/Game/_Highscores", NULL, prefs_show_scores, 0, ""}, { "/Game/_Zap Highscores", NULL, prefs_zap_highscores, 0, ""}, { "/Game/Sep3", NULL, NULL, 0, "<Separator>" }, { "/Game/_Quit", "<control>Q", (GtkSignalFunc) ui_cleanup, 0, "" }, { "/_Move", NULL, NULL, 0, "<Branch>" }, { "/Move/_Back", "<control>B", menu_back_forw, MENU_BACK, "" }, { "/Move/_Forward", "<control>F", menu_back_forw, MENU_FORW, "" }, { "/Move/Sep1", NULL, NULL, 0, "<Separator>" }, { "/Move/_Move Now", "<control>M", (GtkItemFactoryCallback) ui_move_now_cb, 0, "" }, #else /* { "/_File", NULL, NULL, 0, "<Branch>" }, { "/File/_Load game", "<control>L", menu_load_file_dialog, 0, "<StockItem>", GTK_STOCK_OPEN }, { "/File/_Save game", NULL, menu_save_file_dialog, 0, "<StockItem>", GTK_STOCK_SAVE }, { "/File/_Quit", "<control>Q", (GtkSignalFunc) ui_cleanup, 0, "<StockItem>", GTK_STOCK_QUIT }, */ { "/_Game", NULL, NULL, 0, "<Branch>" }, { "/Game/Select _Game", NULL, NULL, 0, "<LastBranch>" }, { "/Game/Levels", NULL, NULL, 0, "<Branch>"}, { "/Game/Sep1", NULL, NULL, 0, "<Separator>" }, { "/Game/_New", "<control>N", menu_start_stop_game, MENU_RESET_GAME, "<StockItem>", GTK_STOCK_NEW }, { "/Game/_Start", "<control>G", menu_start_stop_game, MENU_START_GAME, "<StockItem>", GTK_STOCK_YES }, { "/Game/_Pause", "<control>P", menu_start_stop_game, MENU_STOP_GAME, "<StockItem>", GTK_STOCK_STOP }, { "/Game/Sep2", NULL, NULL, 0, "<Separator>" }, //FIXME: there's a scores stock item but I can't seem to find it { "/Game/_Highscores", NULL, prefs_show_scores, 0, ""}, { "/Game/_Zap Highscores", NULL, prefs_zap_highscores, 0, ""}, { "/Game/Sep3", NULL, NULL, 0, "<Separator>" }, { "/Game/_Quit", "<control>Q", (GtkSignalFunc) ui_cleanup, 0, "<StockItem>", GTK_STOCK_QUIT }, { "/_Move", NULL, NULL, 0, "<Branch>" }, { "/Move/_Back", "<control>B", menu_back_forw, 1, "<StockItem>", GTK_STOCK_GO_BACK }, { "/Move/_Forward", "<control>F", menu_back_forw, 2, "<StockItem>", GTK_STOCK_GO_FORWARD }, { "/Move/Sep1", NULL, NULL, 0, "<Separator>" }, { "/Move/_Move Now", "<control>M", (GtkItemFactoryCallback) ui_move_now_cb, 0, "" }, #endif { "/_Settings", NULL, NULL, 0, "<Branch>" }, { "/Settings/_Player", NULL, NULL, 0, "<Branch>" }, { "/Settings/Player/File", NULL, NULL, 0, "<RadioItem>" }, { "/Settings/Player/Human-Human", NULL, menu_set_player, 1, "/Settings/Player/File" }, { "/Settings/Player/Human-Machine", NULL, menu_set_player, 2, "/Settings/Player/File" }, { "/Settings/Player/Machine-Human", NULL, menu_set_player, 3, "/Settings/Player/File" }, { "/Settings/Player/Machine-Machine", NULL, menu_set_player, 4, "/Settings/Player/File" }, // { "/Settings/_Eval function", NULL, NULL, 0, "<Branch>" }, // { "/Settings/_Eval function/_White", NULL, NULL, 0, "<Branch>" }, // { "/Settings/_Eval function/_Black", NULL, NULL, 0, "<Branch>" }, { "/Settings/_Flip Board", "<control>T", menu_board_flip_cb, 0, "" }, { "/Settings/_Enable Sound", NULL, menu_enable_sound_cb, 1, ""}, { "/Settings/_Disable Sound", NULL, menu_enable_sound_cb, 0, ""}, { "/Settings/_Time per move", NULL, NULL, 0, "<Branch>" }, { "/Settings/_Time per move/Default", NULL, menu_set_delay_cb, DEF_TIME_PER_MOVE, "<RadioItem>" }, { "/Settings/_Time per move/100 milliseconds", NULL, menu_set_delay_cb, 100, "/Settings/Time per move/Default" }, { "/Settings/Time per move/200 milliseconds", NULL, menu_set_delay_cb, 200, "/Settings/Time per move/Default" }, { "/Settings/Time per move/500 milliseconds", NULL, menu_set_delay_cb, 500, "/Settings/Time per move/Default" }, { "/Settings/Time per move/1 second", NULL, menu_set_delay_cb, 1000, "/Settings/Time per move/Default" }, { "/Settings/Time per move/2 seconds", NULL, menu_set_delay_cb, 2000, "/Settings/Time per move/Default" }, { "/Settings/Time per move/5 seconds", NULL, menu_set_delay_cb, 5000, "/Settings/Time per move/Default" }, { "/Settings/Time per move/10 seconds", NULL, menu_set_delay_cb, 10000, "/Settings/Time per move/Default" }, { "/Settings/Time per move/30 seconds", NULL, menu_set_delay_cb, 30000, "/Settings/Time per move/Default" }, { "/Settings/Time per move/1 minute", NULL, menu_set_delay_cb, 600000, "/Settings/Time per move/Default" }, { "/_Help", NULL, NULL, 0, "<Branch>" }, { "/Help/_About", NULL, menu_show_about_dialog, 0, ""}, #ifdef HAVE_GNOME { "/Help/_Home Page", NULL, menu_help_home_page, 0, "<StockItem>", GTK_STOCK_HOME}, #endif // TODO: implement context help // { "/Help/_Context help", NULL, ui_set_context_help, 0, ""}, }; int i; gdk_rgb_init (); main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_policy (GTK_WINDOW (main_window), FALSE, FALSE, TRUE); gtk_signal_connect (GTK_OBJECT (main_window), "delete_event", GTK_SIGNAL_FUNC(ui_cleanup), NULL); gtk_window_set_title (GTK_WINDOW (main_window), "Gtkboard"); ag = gtk_accel_group_new(); menu_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", ag); gtk_window_add_accel_group (GTK_WINDOW (main_window), ag); gtk_item_factory_create_items (menu_factory, sizeof (items) / sizeof (items[0]), items, NULL); for (i=0; i<=num_games; i++) { if (i==0) game_items[i].path = "/Game/Select Game/none"; else { if (games[i-1]->group) { GtkItemFactoryEntry group_item = {NULL, NULL, NULL, 0, "<Branch>"}; group_item.path = g_strdup_printf ("/Game/Select Game/%s", games[i-1]->group); // FIXME: this is O(N^2) where N is the number of games if (gtk_item_factory_get_widget (menu_factory, group_item.path) == NULL) gtk_item_factory_create_item (menu_factory, &group_item, NULL, 1); game_items[i].path = g_strdup_printf ("/Game/Select Game/%s/%s", games[i-1]->group ? games[i-1]->group : "", games[i-1]->name); } else game_items[i].path = g_strdup_printf ("/Game/Select Game/%s", games[i-1]->name); } game_items[i].accelerator = NULL; game_items[i].callback = menu_set_game; game_items[i].callback_action = i-1; game_items[i].item_type = (i == 0 ? "<RadioItem>": "/Game/Select Game/none"); } gtk_item_factory_create_items (menu_factory, num_games+1, game_items, NULL); // ugly hack to create a group of radio button with no button selected by default gtk_item_factory_delete_item (menu_factory, "/Game/Select Game/none"); menu_main = gtk_item_factory_get_widget (menu_factory, "<main>"); gtk_widget_set_state (gtk_item_factory_get_widget (menu_factory, "/Settings/Player/File"), GTK_STATE_INSENSITIVE); for (i=1; i<=NUM_RECENT_GAMES; i++) { gchar *tmp; gchar *gamename; gamename = prefs_get_config_val (tmp = g_strdup_printf ("recent_game_%d", i)); g_free (tmp); if (gamename && gamename[0] != '\0') menu_insert_game_item (gamename, i); } menu_set_eval_function (); vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), menu_main, FALSE, FALSE, 0); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); { GtkWidget *innerframe; board_colbox = gtk_vbox_new (FALSE, 0); board_area = gtk_drawing_area_new (); hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), board_colbox, FALSE, FALSE, 0); vbox1 = gtk_vbox_new (FALSE, 0); board_rowbox = gtk_hbox_new (FALSE, 0); innerframe = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (innerframe), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (vbox1), innerframe); gtk_container_add (GTK_CONTAINER (innerframe), board_area); gtk_container_add (GTK_CONTAINER (vbox1), board_rowbox); gtk_box_pack_start (GTK_BOX (hbox), vbox1, TRUE, FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_signal_connect (GTK_OBJECT (board_area), "expose_event", GTK_SIGNAL_FUNC (board_redraw), NULL); gtk_widget_set_events(board_area, gtk_widget_get_events (board_area) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK ); gtk_signal_connect (GTK_OBJECT (board_area), "leave_notify_event", GTK_SIGNAL_FUNC (board_signal_handler), NULL); gtk_signal_connect (GTK_OBJECT (board_area), "motion_notify_event", GTK_SIGNAL_FUNC (board_signal_handler), NULL); gtk_signal_connect (GTK_OBJECT (board_area), "button_release_event", GTK_SIGNAL_FUNC (board_signal_handler), NULL); gtk_signal_connect (GTK_OBJECT (board_area), "button_press_event", GTK_SIGNAL_FUNC (board_signal_handler), NULL); gtk_signal_connect (GTK_OBJECT (main_window), "key_press_event", GTK_SIGNAL_FUNC (board_signal_handler), NULL); gtk_signal_connect (GTK_OBJECT (main_window), "key_release_event", GTK_SIGNAL_FUNC (board_signal_handler), NULL); menu_info_bar = hbox = gtk_hbox_new (FALSE, 0); sb_game_label = gtk_label_new (opt_game ? opt_game->name : NULL); gtk_box_pack_start (GTK_BOX (hbox), sb_game_label, FALSE, FALSE, 3); sb_game_separator = gtk_vseparator_new (); gtk_box_pack_start (GTK_BOX (hbox), sb_game_separator, FALSE, FALSE, 0); sb_player_label = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (hbox), sb_player_label, FALSE, FALSE, 3); sb_player_separator = gtk_vseparator_new (); gtk_box_pack_start (GTK_BOX (hbox), sb_player_separator, FALSE, FALSE, 0); sb_who_label = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (hbox), sb_who_label, FALSE, FALSE, 3); sb_who_separator = gtk_vseparator_new (); gtk_box_pack_start (GTK_BOX (hbox), sb_who_separator, FALSE, FALSE, 0); sb_score_label = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (hbox), sb_score_label, FALSE, FALSE, 3); sb_score_separator = gtk_vseparator_new (); gtk_box_pack_start (GTK_BOX (hbox), sb_score_separator, FALSE, FALSE, 0); #if GTK_MAJOR_VERSION == 2 sb_turn_image = gtk_image_new_from_stock (GTK_STOCK_YES, GTK_ICON_SIZE_MENU); gtk_box_pack_end (GTK_BOX (hbox), sb_turn_image, FALSE, FALSE, 0); sb_turn_separator = gtk_vseparator_new (); gtk_box_pack_end (GTK_BOX (hbox), sb_turn_separator, FALSE, FALSE, 0); #endif sb_time_label = gtk_label_new (NULL); gtk_box_pack_end (GTK_BOX (hbox), sb_time_label, FALSE, FALSE, 0); sb_time_separator = gtk_vseparator_new (); gtk_box_pack_end (GTK_BOX (hbox), sb_time_separator, FALSE, FALSE, 0); } menu_info_separator = separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0); menu_warning_bar = gtk_label_new ("Warning: this game has not yet been completely implemented."); gtk_box_pack_start (GTK_BOX (vbox), menu_warning_bar, FALSE, FALSE, 0); sb_warning_separator = separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0); sb_message_label = gtk_label_new (NULL); gtk_misc_set_alignment (GTK_MISC (sb_message_label), 0, 0.5); hbox = gtk_hbox_new (TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), sb_message_label, TRUE, TRUE, 3); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (main_window), vbox); // FIXME: board_init() needs show() to be called to get a gc, but // leads to the whole window not popping up at once gtk_widget_show_all (main_window); if (!opt_game) board_init (); gtk_timeout_add (100, sb_update_periodic, NULL); // this should be called before setting state_gui_active = TRUE if (opt_game) menu_put_game (); state_gui_active = TRUE; if (opt_game) menu_start_game (); menu_put_player (TRUE); // if (!opt_game) sb_message ("Select a game from the Game menu", FALSE); sb_update (); }
max_undos_supported_count=NO_OF_UNDOS_SUPPORTED; free_last_element_in_undo_stack(&undo_store_positions); } } GtkWidget* create_main_window (void) { GtkWidget *main_window, *menubar1,*menuitem1,*menuitem1_menu,*new; GtkWidget *separatormenuitem1,*quit1,*menuitem4; GtkWidget *menuitem4_menu,*about1,*toolbar1; GtkWidget *new_button,*quit_button,*help_button; /* GtkWidget *undo_button;*/ gint tmp_toolbar_icon_size, x, y, c=0; GtkAccelGroup *accel_group = gtk_accel_group_new (); GdkColor color = {0, 0xcc00, 0xec00, 0xff00}; vacant_pos = 15; move_no=0; main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (main_window), "MPuzzle-1.7"); vbox1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (main_window), vbox1); menubar1 = gtk_menu_bar_new (); menuitem1 = gtk_menu_item_new_with_mnemonic ("_File"); menuitem1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu); new = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); separatormenuitem1 = gtk_separator_menu_item_new ();
gint main (gint argc, gchar **argv) { PopplerDocument *document; GtkWidget *win; GtkWidget *hbox; GtkWidget *notebook; GtkWidget *treeview; GtkTreeSelection *selection; GFile *file; GTimer *timer; GError *error = NULL; GtkAccelGroup *gtk_accel; GClosure *closure; if (argc != 2) { g_print ("Usage: poppler-glib-demo FILE\n"); return 1; } gtk_init (&argc, &argv); file = g_file_new_for_commandline_arg (argv[1]); timer = g_timer_new (); document = poppler_document_new_from_gfile (file, NULL, NULL, &error); g_timer_stop (timer); if (error) { while (g_error_matches (error, POPPLER_ERROR, POPPLER_ERROR_ENCRYPTED)) { GtkDialog *dialog; const gchar *password; dialog = pgd_demo_get_auth_dialog (file); if (gtk_dialog_run (dialog) != GTK_RESPONSE_OK) { g_print ("Error: no password provided\n"); g_object_unref (file); return 1; } g_clear_error (&error); password = g_object_get_data (G_OBJECT (dialog), "pgd-password"); g_timer_start (timer); document = poppler_document_new_from_gfile (file, password, NULL, &error); g_timer_stop (timer); gtk_widget_destroy (GTK_WIDGET (dialog)); } if (error) { g_print ("Error: %s\n", error->message); g_error_free (error); g_object_unref (file); return 1; } } g_object_unref (file); g_print ("Document successfully loaded in %.4f seconds\n", g_timer_elapsed (timer, NULL)); g_timer_destroy (timer); /* Main window */ win = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (win), 600, 600); gtk_window_set_title (GTK_WINDOW (win), "Poppler GLib Demo"); g_signal_connect (G_OBJECT (win), "delete-event", G_CALLBACK (gtk_main_quit), NULL); gtk_accel = gtk_accel_group_new (); closure = g_cclosure_new (G_CALLBACK (gtk_main_quit), NULL, NULL); gtk_accel_group_connect (gtk_accel, gdk_keyval_from_name ("q"), GDK_CONTROL_MASK, 0, closure); g_closure_unref (closure); gtk_window_add_accel_group (GTK_WINDOW(win), gtk_accel); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); treeview = pgd_demo_list_create (); gtk_box_pack_start (GTK_BOX (hbox), treeview, FALSE, TRUE, 0); gtk_widget_show (treeview); notebook = pdg_demo_notebook_create (document); gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0); gtk_widget_show (notebook); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (pgd_demo_changed), (gpointer) notebook); gtk_container_add (GTK_CONTAINER (win), hbox); gtk_widget_show (hbox); gtk_widget_show (win); gtk_main (); g_object_unref (document); return 0; }
GtkWidget* create_wspec (void) { GtkWidget *wspec; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *label1; GtkWidget *specfreqpointer; GtkWidget *label2; GtkWidget *specfreqmark; GtkWidget *label3; GtkWidget *specfreqspace; GtkWidget *frame1; GtkWidget *hbox2; GSList *hbox2_group = NULL; GtkWidget *shift170; GtkWidget *shift200; GtkWidget *shift425; GtkWidget *shift800; GtkWidget *shiftother; GtkWidget *frame4; GtkWidget *table9; GtkWidget *spec; GtkWidget *hruler1; GtkWidget *squelch_vruler; GtkAccelGroup *spec_accels; wspec = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (wspec, "wspec"); gtk_object_set_data (GTK_OBJECT (wspec), "wspec", wspec); gtk_window_set_title (GTK_WINDOW (wspec), _("Frequency Spectrum")); gtk_window_set_policy (GTK_WINDOW (wspec), FALSE, FALSE, FALSE); gtk_window_set_wmclass (GTK_WINDOW (wspec), "hfterm", "hfterm"); spec_accels = gtk_accel_group_new (); gtk_accel_group_attach(spec_accels, GTK_OBJECT(wspec)); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (vbox1, "vbox1"); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (wspec), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (wspec), vbox1); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox1, "hbox1"); gtk_widget_ref (hbox1); gtk_object_set_data_full (GTK_OBJECT (wspec), "hbox1", hbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 3); gtk_container_set_border_width (GTK_CONTAINER (hbox1), 1); label1 = gtk_label_new (_("Pointer")); gtk_widget_set_name (label1, "label1"); gtk_widget_ref (label1); gtk_object_set_data_full (GTK_OBJECT (wspec), "label1", label1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0); specfreqpointer = gtk_entry_new (); gtk_widget_set_name (specfreqpointer, "specfreqpointer"); gtk_widget_ref (specfreqpointer); gtk_object_set_data_full (GTK_OBJECT (wspec), "specfreqpointer", specfreqpointer, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (specfreqpointer); gtk_box_pack_start (GTK_BOX (hbox1), specfreqpointer, FALSE, TRUE, 4); gtk_widget_set_usize (specfreqpointer, 60, -2); GTK_WIDGET_UNSET_FLAGS (specfreqpointer, GTK_CAN_FOCUS); gtk_entry_set_editable (GTK_ENTRY (specfreqpointer), FALSE); label2 = gtk_label_new (_("Mark")); gtk_widget_set_name (label2, "label2"); gtk_widget_ref (label2); gtk_object_set_data_full (GTK_OBJECT (wspec), "label2", label2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label2); gtk_box_pack_start (GTK_BOX (hbox1), label2, FALSE, FALSE, 0); specfreqmark = gtk_entry_new (); gtk_widget_set_name (specfreqmark, "specfreqmark"); gtk_widget_ref (specfreqmark); gtk_object_set_data_full (GTK_OBJECT (wspec), "specfreqmark", specfreqmark, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (specfreqmark); gtk_box_pack_start (GTK_BOX (hbox1), specfreqmark, FALSE, TRUE, 4); gtk_widget_set_usize (specfreqmark, 60, -2); GTK_WIDGET_UNSET_FLAGS (specfreqmark, GTK_CAN_FOCUS); gtk_entry_set_editable (GTK_ENTRY (specfreqmark), FALSE); label3 = gtk_label_new (_("Space")); gtk_widget_set_name (label3, "label3"); gtk_widget_ref (label3); gtk_object_set_data_full (GTK_OBJECT (wspec), "label3", label3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label3); gtk_box_pack_start (GTK_BOX (hbox1), label3, FALSE, FALSE, 0); specfreqspace = gtk_entry_new (); gtk_widget_set_name (specfreqspace, "specfreqspace"); gtk_widget_ref (specfreqspace); gtk_object_set_data_full (GTK_OBJECT (wspec), "specfreqspace", specfreqspace, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (specfreqspace); gtk_box_pack_start (GTK_BOX (hbox1), specfreqspace, FALSE, TRUE, 4); gtk_widget_set_usize (specfreqspace, 60, -2); GTK_WIDGET_UNSET_FLAGS (specfreqspace, GTK_CAN_FOCUS); gtk_entry_set_editable (GTK_ENTRY (specfreqspace), FALSE); frame1 = gtk_frame_new (_("Shift")); gtk_widget_set_name (frame1, "frame1"); gtk_widget_ref (frame1); gtk_object_set_data_full (GTK_OBJECT (wspec), "frame1", frame1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (frame1); gtk_box_pack_end (GTK_BOX (hbox1), frame1, FALSE, TRUE, 0); hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox2, "hbox2"); gtk_widget_ref (hbox2); gtk_object_set_data_full (GTK_OBJECT (wspec), "hbox2", hbox2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox2); gtk_container_add (GTK_CONTAINER (frame1), hbox2); shift170 = gtk_radio_button_new_with_label (hbox2_group, _("170")); hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (shift170)); gtk_widget_set_name (shift170, "shift170"); gtk_widget_ref (shift170); gtk_object_set_data_full (GTK_OBJECT (wspec), "shift170", shift170, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (shift170); gtk_box_pack_start (GTK_BOX (hbox2), shift170, FALSE, FALSE, 0); shift200 = gtk_radio_button_new_with_label (hbox2_group, _("200")); hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (shift200)); gtk_widget_set_name (shift200, "shift200"); gtk_widget_ref (shift200); gtk_object_set_data_full (GTK_OBJECT (wspec), "shift200", shift200, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (shift200); gtk_box_pack_start (GTK_BOX (hbox2), shift200, FALSE, FALSE, 0); shift425 = gtk_radio_button_new_with_label (hbox2_group, _("425")); hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (shift425)); gtk_widget_set_name (shift425, "shift425"); gtk_widget_ref (shift425); gtk_object_set_data_full (GTK_OBJECT (wspec), "shift425", shift425, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (shift425); gtk_box_pack_start (GTK_BOX (hbox2), shift425, FALSE, FALSE, 0); shift800 = gtk_radio_button_new_with_label (hbox2_group, _("800")); hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (shift800)); gtk_widget_set_name (shift800, "shift800"); gtk_widget_ref (shift800); gtk_object_set_data_full (GTK_OBJECT (wspec), "shift800", shift800, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (shift800); gtk_box_pack_start (GTK_BOX (hbox2), shift800, FALSE, FALSE, 0); shiftother = gtk_radio_button_new_with_label (hbox2_group, _("other")); hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (shiftother)); gtk_widget_set_name (shiftother, "shiftother"); gtk_widget_ref (shiftother); gtk_object_set_data_full (GTK_OBJECT (wspec), "shiftother", shiftother, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (shiftother); gtk_box_pack_start (GTK_BOX (hbox2), shiftother, FALSE, FALSE, 0); frame4 = gtk_frame_new (_("Spectrum")); gtk_widget_set_name (frame4, "frame4"); gtk_widget_ref (frame4); gtk_object_set_data_full (GTK_OBJECT (wspec), "frame4", frame4, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (frame4); gtk_box_pack_start (GTK_BOX (vbox1), frame4, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame4), 1); table9 = gtk_table_new (2, 2, FALSE); gtk_widget_set_name (table9, "table9"); gtk_widget_ref (table9); gtk_object_set_data_full (GTK_OBJECT (wspec), "table9", table9, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (table9); gtk_container_add (GTK_CONTAINER (frame4), table9); spec = spectrum_new ("spec", NULL, NULL, 0, 0); gtk_widget_set_name (spec, "spec"); gtk_widget_ref (spec); gtk_object_set_data_full (GTK_OBJECT (wspec), "spec", spec, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (spec); gtk_table_attach (GTK_TABLE (table9), spec, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_widget_set_usize (spec, 512, 384); GTK_WIDGET_SET_FLAGS (spec, GTK_CAN_FOCUS); GTK_WIDGET_UNSET_FLAGS (spec, GTK_CAN_DEFAULT); gtk_widget_set_events (spec, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK); hruler1 = gtk_hruler_new (); gtk_widget_set_name (hruler1, "hruler1"); gtk_widget_ref (hruler1); gtk_object_set_data_full (GTK_OBJECT (wspec), "hruler1", hruler1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hruler1); gtk_table_attach (GTK_TABLE (table9), hruler1, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_ruler_set_range (GTK_RULER (hruler1), 0, 4000, 5.91797, 10); squelch_vruler = gtk_vruler_new (); gtk_widget_set_name (squelch_vruler, "squelch_vruler"); gtk_widget_ref (squelch_vruler); gtk_object_set_data_full (GTK_OBJECT (wspec), "squelch_vruler", squelch_vruler, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (squelch_vruler); gtk_table_attach (GTK_TABLE (table9), squelch_vruler, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_ruler_set_range (GTK_RULER (squelch_vruler), 0, 10, 4.24479, 10); gtk_signal_connect (GTK_OBJECT (wspec), "delete_event", GTK_SIGNAL_FUNC (on_wspec_delete_event), NULL); gtk_widget_add_accelerator(wspec, "hide", spec_accels, GDK_f, GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(wspec, "hide", spec_accels, GDK_Escape, 0, GTK_ACCEL_VISIBLE); gtk_signal_connect (GTK_OBJECT (spec), "button_press_event", GTK_SIGNAL_FUNC (on_spec_button_press_event), NULL); gtk_signal_connect (GTK_OBJECT (spec), "motion_notify_event", GTK_SIGNAL_FUNC (on_spec_motion_event), NULL); return wspec; }