GtkWidget* create_ChromaShift (void) { GtkWidget *ChromaShift; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *table1; GtkWidget *label1; GtkWidget *label2; GtkObject *spinbutton_U_adj; GtkWidget *spinbutton_U; GtkObject *spinbutton_V_adj; GtkWidget *spinbutton_V; GtkWidget *hscale; GtkWidget *frame1; GtkWidget *alignment1; GtkWidget *drawingarea1; GtkWidget *label3; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *applybutton1; GtkWidget *okbutton1; ChromaShift = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (ChromaShift), QT_TR_NOOP("ChromaShift")); gtk_window_set_type_hint (GTK_WINDOW (ChromaShift), GDK_WINDOW_TYPE_HINT_DIALOG); dialog_vbox1 = GTK_DIALOG (ChromaShift)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); table1 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0); label1 = gtk_label_new (QT_TR_NOOP("U Shift :")); gtk_widget_show (label1); gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); label2 = gtk_label_new (QT_TR_NOOP("V Shift :")); gtk_widget_show (label2); gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5); spinbutton_U_adj = gtk_adjustment_new (0, -32, 32, 1, 10, 10); spinbutton_U = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_U_adj), 1, 0); gtk_widget_show (spinbutton_U); gtk_table_attach (GTK_TABLE (table1), spinbutton_U, 1, 2, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton_U), TRUE); spinbutton_V_adj = gtk_adjustment_new (0, -32, 32, 1, 10, 10); spinbutton_V = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_V_adj), 1, 0); gtk_widget_show (spinbutton_V); gtk_table_attach (GTK_TABLE (table1), spinbutton_V, 1, 2, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton_V), TRUE); hscale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 1, 1))); gtk_widget_show (hscale); gtk_box_pack_start (GTK_BOX (vbox1), hscale, FALSE, FALSE, 0); gtk_scale_set_digits (GTK_SCALE (hscale), 0); frame1 = gtk_frame_new (NULL); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (vbox1), 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), 0, 0, 12, 0); drawingarea1 = gtk_drawing_area_new (); gtk_widget_show (drawingarea1); gtk_container_add (GTK_CONTAINER (alignment1), drawingarea1); label3 = gtk_label_new (QT_TR_NOOP("<b>Preview</b>")); gtk_widget_show (label3); gtk_frame_set_label_widget (GTK_FRAME (frame1), label3); gtk_label_set_use_markup (GTK_LABEL (label3), TRUE); dialog_action_area1 = GTK_DIALOG (ChromaShift)->action_area; gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (ChromaShift), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); applybutton1 = gtk_button_new_from_stock ("gtk-apply"); gtk_widget_show (applybutton1); gtk_dialog_add_action_widget (GTK_DIALOG (ChromaShift), applybutton1, GTK_RESPONSE_APPLY); GTK_WIDGET_SET_FLAGS (applybutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (ChromaShift), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (ChromaShift, ChromaShift, "ChromaShift"); GLADE_HOOKUP_OBJECT_NO_REF (ChromaShift, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (ChromaShift, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (ChromaShift, table1, "table1"); GLADE_HOOKUP_OBJECT (ChromaShift, label1, "label1"); GLADE_HOOKUP_OBJECT (ChromaShift, label2, "label2"); GLADE_HOOKUP_OBJECT (ChromaShift, spinbutton_U, "spinbutton_U"); GLADE_HOOKUP_OBJECT (ChromaShift, spinbutton_V, "spinbutton_V"); GLADE_HOOKUP_OBJECT (ChromaShift, hscale, "hscale"); GLADE_HOOKUP_OBJECT (ChromaShift, frame1, "frame1"); GLADE_HOOKUP_OBJECT (ChromaShift, alignment1, "alignment1"); GLADE_HOOKUP_OBJECT (ChromaShift, drawingarea1, "drawingarea1"); GLADE_HOOKUP_OBJECT (ChromaShift, label3, "label3"); GLADE_HOOKUP_OBJECT_NO_REF (ChromaShift, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (ChromaShift, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (ChromaShift, applybutton1, "applybutton1"); GLADE_HOOKUP_OBJECT (ChromaShift, okbutton1, "okbutton1"); return ChromaShift; }
static void xfburn_preferences_dialog_init (XfburnPreferencesDialog * obj) { GtkBox *box = GTK_BOX (GTK_DIALOG (obj)->vbox); XfburnPreferencesDialogPrivate *priv = XFBURN_PREFERENCES_DIALOG_GET_PRIVATE (obj); GtkWidget *vbox, *vbox2, *vbox3, *hbox; GtkWidget *label; GtkWidget *frame; GtkWidget *scrolled_window; GtkListStore *icon_store, *store; gint x,y; GdkPixbuf *icon = NULL; GtkTreeIter iter; GtkTreeViewColumn *column_name; GtkCellRenderer *cell_icon, *cell_name; GtkWidget *button_close; gint idx; gtk_window_set_title (GTK_WINDOW (obj), _("Preferences")); xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (obj), _("Tune how Xfburn behaves")); gtk_window_set_default_size (GTK_WINDOW (obj), 775, 400); gtk_window_set_destroy_with_parent (GTK_WINDOW (obj), TRUE); gtk_window_set_icon_name (GTK_WINDOW (obj), GTK_STOCK_PREFERENCES); gtk_dialog_set_has_separator (GTK_DIALOG (obj), FALSE); hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (box, hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); scrolled_window = gtk_scrolled_window_new (NULL, NULL); g_object_set (G_OBJECT (scrolled_window), "hscrollbar-policy", GTK_POLICY_NEVER, "shadow-type", GTK_SHADOW_IN, "vscrollbar-policy", GTK_POLICY_NEVER, NULL); gtk_box_pack_start (GTK_BOX (hbox), scrolled_window, FALSE, FALSE, 0); gtk_widget_show (scrolled_window); /* icon bar */ icon_store = gtk_list_store_new (SETTINGS_LIST_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); priv->icon_bar = exo_icon_bar_new_with_model (GTK_TREE_MODEL (icon_store)); exo_icon_bar_set_pixbuf_column (EXO_ICON_BAR (priv->icon_bar), SETTINGS_LIST_PIXBUF_COLUMN); exo_icon_bar_set_text_column (EXO_ICON_BAR (priv->icon_bar), SETTINGS_LIST_TEXT_COLUMN); gtk_container_add (GTK_CONTAINER (scrolled_window), priv->icon_bar); gtk_widget_show (priv->icon_bar); /* notebook */ priv->notebook = gtk_notebook_new (); gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), BORDER); g_object_set (G_OBJECT (priv->notebook), "show-border", FALSE, "show-tabs", FALSE, NULL); gtk_box_pack_start (GTK_BOX (hbox), priv->notebook, TRUE, TRUE, BORDER); gtk_widget_show (priv->notebook); /* general tab */ vbox = gtk_vbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER); idx = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), vbox, NULL); gtk_widget_show (vbox); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); frame = xfce_gtk_frame_box_new_with_content (_("Temporary directory"), vbox2); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, BORDER); gtk_widget_show (frame); priv->chooser_button = gtk_file_chooser_button_new (_("Temporary directory"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); gtk_box_pack_start (GTK_BOX (vbox2), priv->chooser_button, FALSE, FALSE, BORDER); gtk_widget_show (priv->chooser_button); priv->check_clean_tmpdir = gtk_check_button_new_with_mnemonic (_("_Clean temporary directory on exit")); gtk_box_pack_start (GTK_BOX (vbox2), priv->check_clean_tmpdir, FALSE, FALSE, BORDER); gtk_widget_show (priv->check_clean_tmpdir); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); frame = xfce_gtk_frame_box_new_with_content (_("File browser"), vbox2); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, BORDER); gtk_widget_show (frame); priv->check_show_hidden = gtk_check_button_new_with_mnemonic (_("Show _hidden files")); gtk_box_pack_start (GTK_BOX (vbox2), priv->check_show_hidden, FALSE, FALSE, BORDER); gtk_widget_show (priv->check_show_hidden); g_signal_connect (G_OBJECT (priv->check_show_hidden), "clicked", G_CALLBACK (cb_show_hidden_clicked), NULL); priv->check_show_human_readable = gtk_check_button_new_with_mnemonic (_("Show human_readable filesizes")); gtk_box_pack_start (GTK_BOX (vbox2), priv->check_show_human_readable, FALSE, FALSE, BORDER); gtk_widget_show (priv->check_show_human_readable); icon = gtk_widget_render_icon (GTK_WIDGET (priv->icon_bar), GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_DIALOG, NULL); gtk_list_store_append (icon_store, &iter); gtk_list_store_set (icon_store, &iter, SETTINGS_LIST_PIXBUF_COLUMN, icon, SETTINGS_LIST_TEXT_COLUMN, _("General"), SETTINGS_LIST_INDEX_COLUMN, idx, -1); g_object_unref (G_OBJECT (icon)); /* devices tab */ vbox = gtk_vbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER); idx = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), vbox, NULL); gtk_widget_show (vbox); label = gtk_label_new (_("Devices")); gtk_widget_show (label); gtk_notebook_set_tab_label (GTK_NOTEBOOK (priv->notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), 1), label); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); frame = xfce_gtk_frame_box_new_with_content (_("Detected devices"), vbox2); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, BORDER); gtk_widget_show (frame); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); gtk_widget_show (scrolled_window); gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, BORDER); store = gtk_list_store_new (DEVICE_LIST_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); priv->treeview_devices = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), DEVICE_LIST_COLUMN_NAME, GTK_SORT_ASCENDING); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->treeview_devices), TRUE); gtk_widget_show (priv->treeview_devices); gtk_container_add (GTK_CONTAINER (scrolled_window), priv->treeview_devices); g_object_unref (store); /* add columns */ column_name = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column_name, _("Name")); gtk_tree_view_column_set_expand (column_name, TRUE); cell_icon = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column_name, cell_icon, FALSE); gtk_tree_view_column_set_attributes (column_name, cell_icon, "pixbuf", DEVICE_LIST_COLUMN_ICON, NULL); g_object_set (cell_icon, "xalign", 0.0, "ypad", 0, NULL); cell_name = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column_name, cell_name, TRUE); gtk_tree_view_column_set_attributes (column_name, cell_name, "text", DEVICE_LIST_COLUMN_NAME, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (priv->treeview_devices), column_name); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->treeview_devices), -1, _("Node"), gtk_cell_renderer_text_new (), "text", DEVICE_LIST_COLUMN_NODE, NULL); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->treeview_devices), -1, _("Write CD-R"), gtk_cell_renderer_toggle_new (), "active", DEVICE_LIST_COLUMN_CDR, NULL); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->treeview_devices), -1, _("Write CD-RW"), gtk_cell_renderer_toggle_new (), "active", DEVICE_LIST_COLUMN_CDRW, NULL); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->treeview_devices), -1, _("Write DVD-R"), gtk_cell_renderer_toggle_new (), "active", DEVICE_LIST_COLUMN_DVDR, NULL); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->treeview_devices), -1, _("Write DVD-RAM"), gtk_cell_renderer_toggle_new (), "active", DEVICE_LIST_COLUMN_DVDRAM, NULL); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->treeview_devices), -1, _("Write Blu-ray"), gtk_cell_renderer_toggle_new (), "active", DEVICE_LIST_COLUMN_BD, NULL); hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, BORDER); gtk_widget_show (hbox); priv->button_scan = xfce_gtk_button_new_mixed (GTK_STOCK_CDROM, _("Sc_an for devices")); gtk_box_pack_end (GTK_BOX (hbox), priv->button_scan, FALSE, FALSE, BORDER); g_signal_connect (G_OBJECT (priv->button_scan), "clicked", G_CALLBACK (scan_button_clicked_cb), obj); gtk_widget_show (priv->button_scan); gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &x, &y); icon = gtk_icon_theme_load_icon ( gtk_icon_theme_get_default(), "media-optical", x, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL); if (!icon) icon = gtk_icon_theme_load_icon ( gtk_icon_theme_get_default(), "media-cdrom", x, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL); if (!icon) icon = gtk_icon_theme_load_icon ( gtk_icon_theme_get_default(), GTK_STOCK_CDROM, x, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL); gtk_list_store_append (icon_store, &iter); gtk_list_store_set (icon_store, &iter, SETTINGS_LIST_PIXBUF_COLUMN, icon, SETTINGS_LIST_TEXT_COLUMN, _("Devices"), SETTINGS_LIST_INDEX_COLUMN, idx, -1); if (icon) g_object_unref (G_OBJECT (icon)); exo_mutual_binding_new (G_OBJECT (priv->notebook), "page", G_OBJECT (priv->icon_bar), "active"); /* below the device list */ #if 0 priv->check_empty_speed_list = gtk_check_button_new_with_mnemonic (_("Show warning on _empty speed list")); gtk_box_pack_start (GTK_BOX (vbox2), priv->check_empty_speed_list, FALSE, FALSE, BORDER); gtk_widget_show (priv->check_empty_speed_list); #endif /* fifo */ vbox3 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox3); frame = xfce_gtk_frame_box_new_with_content (_("FIFO buffer size (in kb)"), vbox3); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, BORDER); gtk_widget_show (frame); priv->scale_fifo = gtk_hscale_new_with_range (0.0, FIFO_MAX_SIZE, 32.0); gtk_scale_set_value_pos (GTK_SCALE (priv->scale_fifo), GTK_POS_LEFT); gtk_range_set_value (GTK_RANGE (priv->scale_fifo), 0); gtk_box_pack_start (GTK_BOX (vbox3), priv->scale_fifo, FALSE, FALSE, BORDER/2); gtk_widget_show (priv->scale_fifo); /* action buttons */ button_close = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (button_close); gtk_dialog_add_action_widget (GTK_DIALOG (obj), button_close, GTK_RESPONSE_CLOSE); GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT); gtk_widget_grab_focus (button_close); gtk_widget_grab_default (button_close); g_signal_connect (G_OBJECT (obj), "response", G_CALLBACK (xfburn_preferences_dialog_response_cb), priv); refresh_devices_list (obj); g_object_unref (icon_store); }
void create_win_save_phrase(WSP_S *wsp, int wspN) { #if WIN32 if (test_mode) return; #endif if (!wspN) return; SAVE_SESS *sess = tzmalloc(SAVE_SESS, 1); GtkWidget *main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_has_resize_grip(GTK_WINDOW(main_window), FALSE); sess->win = main_window; gtk_window_set_default_size(GTK_WINDOW (main_window), 20, 10); gtk_window_set_title(GTK_WINDOW(main_window), _(_L("加片語到詞庫"))); #if 0 g_signal_connect (G_OBJECT (main_window), "delete_event", G_CALLBACK (delete_event), sess); #endif GtkWidget *vbox = gtk_vbox_new (FALSE, 0); gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (main_window), vbox); char tt[512]; tt[0] = 0; wsp_str(wsp, wspN, tt); gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new(tt), FALSE, FALSE, 0); int i; for(i=0; i<wspN; i++) { if (ph_key_sz==2) strcat(tt, phokey_to_str(wsp[i].key)); strcat(tt, " "); } if (tt[0]) gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new(tt), FALSE, FALSE, 0); sess->mywsp = tmemdup(wsp, WSP_S, wspN); sess->mywspN = wspN; GtkWidget *hbox_cancel_ok = gtk_hbox_new (FALSE, 10); gtk_box_pack_start (GTK_BOX (vbox), hbox_cancel_ok , FALSE, FALSE, 5); GtkWidget *button_ok = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 5); GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0); sess->label_countdown = gtk_label_new(NULL); gtk_box_pack_start (GTK_BOX (vbox), sess->label_countdown, FALSE, FALSE, 5); #if 1 #if WIN32 set_no_focus(main_window); #endif gtk_widget_realize(main_window); #if UNIX set_no_focus(main_window); #else win32_init_win(main_window); #endif #endif // dbg("mmmmmmmmmmmmm\n"); GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT); gtk_widget_grab_default (button_ok); #if 1 // dbg("main_window %x\n", main_window); g_signal_connect (G_OBJECT (button_cancel), "clicked", G_CALLBACK (close_win_save_phrase), sess); g_signal_connect (G_OBJECT (button_ok), "clicked", G_CALLBACK (cb_ok), sess); #endif gtk_window_present(GTK_WINDOW(main_window)); gtk_window_set_keep_above(GTK_WINDOW(main_window), TRUE); // gtk_window_set_modal(GTK_WINDOW(main_window), TRUE); sess->countdown = 3; disp_countdown(sess); sess->countdown_handle = g_timeout_add(1000, timeout_countdown, sess); gtk_widget_show_all(main_window); }
GtkWidget* create_vmmstatus (void) { GtkWidget *vmmstatus; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *label1; GtkWidget *label5; GtkWidget *label2; GtkWidget *label3; GtkWidget *dialog_action_area1; GtkWidget *closebutton1; vmmstatus = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (vmmstatus), _("VMM Status")); gtk_window_set_default_size (GTK_WINDOW (vmmstatus), 384, 384); gtk_window_set_destroy_with_parent (GTK_WINDOW (vmmstatus), TRUE); gtk_window_set_type_hint (GTK_WINDOW (vmmstatus), GDK_WINDOW_TYPE_HINT_DIALOG); dialog_vbox1 = GTK_DIALOG (vmmstatus)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); label1 = gtk_label_new (_("Status:")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0); gtk_misc_set_padding (GTK_MISC (label1), 12, 12); label5 = gtk_label_new (""); gtk_widget_show (label5); gtk_box_pack_start (GTK_BOX (hbox1), label5, TRUE, FALSE, 0); label2 = gtk_label_new (""); gtk_widget_show (label2); gtk_box_pack_start (GTK_BOX (hbox1), label2, FALSE, FALSE, 0); gtk_misc_set_padding (GTK_MISC (label2), 12, 12); label3 = gtk_label_new (""); gtk_widget_show (label3); gtk_box_pack_start (GTK_BOX (vbox1), label3, TRUE, TRUE, 0); gtk_misc_set_alignment (GTK_MISC (label3), 0, 0); gtk_misc_set_padding (GTK_MISC (label3), 12, 12); dialog_action_area1 = GTK_DIALOG (vmmstatus)->action_area; gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); closebutton1 = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (closebutton1); gtk_dialog_add_action_widget (GTK_DIALOG (vmmstatus), closebutton1, GTK_RESPONSE_CLOSE); GTK_WIDGET_SET_FLAGS (closebutton1, GTK_CAN_DEFAULT); g_signal_connect ((gpointer) vmmstatus, "destroy", G_CALLBACK (on_dialog1_destroy), NULL); g_signal_connect ((gpointer) closebutton1, "clicked", G_CALLBACK (on_closebutton1_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (vmmstatus, vmmstatus, "vmmstatus"); GLADE_HOOKUP_OBJECT_NO_REF (vmmstatus, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (vmmstatus, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (vmmstatus, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (vmmstatus, label1, "label1"); GLADE_HOOKUP_OBJECT (vmmstatus, label5, "label5"); GLADE_HOOKUP_OBJECT (vmmstatus, label2, "label2"); GLADE_HOOKUP_OBJECT (vmmstatus, label3, "label3"); GLADE_HOOKUP_OBJECT_NO_REF (vmmstatus, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (vmmstatus, closebutton1, "closebutton1"); return vmmstatus; }
GtkWidget *create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *notebook1; GtkWidget *table1; GtkWidget *radioCQ; GSList *radioCQ_group = NULL; GtkWidget *radioCBR; GtkWidget *radio2Pass; GtkWidget *entryCQ; GtkWidget *entryCBR; GtkWidget *entry2Pass; GtkWidget *label1; GtkWidget *table2; GtkWidget *label5; GtkWidget *label6; GtkWidget *label7; GtkObject *spinbuttonMaxIFrame_adj; GtkWidget *spinbuttonMaxIFrame; GtkWidget *label8; GtkObject *spinbuttonMinIFrame_adj; GtkWidget *spinbuttonMinIFrame; GtkWidget *optionME; GtkWidget *menu4; GtkWidget *_0___none1; GtkWidget *_1__very_low1; GtkWidget *_2__low1; GtkWidget *_3__medium1; GtkWidget *_4__high1; GtkWidget *_5__very_high1; GtkWidget *_6__ultra_high1; GtkWidget *optionQzer; GtkWidget *menu5; GtkWidget *h263_quantizer1; GtkWidget *mpeg_quantizer1; GtkWidget *label2; GtkWidget *table3; GtkWidget *label9; GtkWidget *label10; GtkWidget *label11; GtkWidget *label12; GtkObject *spinImin_adj; GtkWidget *spinImin; GtkObject *spinImax_adj; GtkWidget *spinImax; GtkObject *spinPmin_adj; GtkWidget *spinPmin; GtkObject *spinPmax_adj; GtkWidget *spinPmax; GtkWidget *label3; GtkWidget *label13; GtkWidget *label4; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Xvid Encoder")); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); notebook1 = gtk_notebook_new (); gtk_widget_show (notebook1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook1, TRUE, TRUE, 0); table1 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (notebook1), table1); radioCQ = gtk_radio_button_new_with_mnemonic (NULL, QT_TR_NOOP("Constant Quantizer")); gtk_widget_show (radioCQ); gtk_table_attach (GTK_TABLE (table1), radioCQ, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioCQ), radioCQ_group); radioCQ_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioCQ)); radioCBR = gtk_radio_button_new_with_mnemonic (NULL, QT_TR_NOOP("Constant Bitrate (kbps)")); gtk_widget_show (radioCBR); gtk_table_attach (GTK_TABLE (table1), radioCBR, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioCBR), radioCQ_group); radioCQ_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioCBR)); radio2Pass = gtk_radio_button_new_with_mnemonic (NULL, QT_TR_NOOP("Dual pass (MBytes)")); gtk_widget_show (radio2Pass); gtk_table_attach (GTK_TABLE (table1), radio2Pass, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio2Pass), radioCQ_group); radioCQ_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio2Pass)); entryCQ = gtk_entry_new (); gtk_widget_show (entryCQ); gtk_table_attach (GTK_TABLE (table1), entryCQ, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entryCBR = gtk_entry_new (); gtk_widget_show (entryCBR); gtk_table_attach (GTK_TABLE (table1), entryCBR, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry2Pass = gtk_entry_new (); gtk_widget_show (entry2Pass); gtk_table_attach (GTK_TABLE (table1), entry2Pass, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label1 = gtk_label_new (QT_TR_NOOP("Basic")); gtk_widget_show (label1); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1); gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); table2 = gtk_table_new (4, 2, FALSE); gtk_widget_show (table2); gtk_container_add (GTK_CONTAINER (notebook1), table2); label5 = gtk_label_new (QT_TR_NOOP("Motion Search")); gtk_widget_show (label5); gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); label6 = gtk_label_new (QT_TR_NOOP("Quantization")); gtk_widget_show (label6); gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); label7 = gtk_label_new (QT_TR_NOOP("Max I frame interval ")); gtk_widget_show (label7); gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); spinbuttonMaxIFrame_adj = gtk_adjustment_new (300, 0, 600, 1, 10, 0); spinbuttonMaxIFrame = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonMaxIFrame_adj), 1, 0); gtk_widget_show (spinbuttonMaxIFrame); gtk_table_attach (GTK_TABLE (table2), spinbuttonMaxIFrame, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonMaxIFrame), TRUE); label8 = gtk_label_new (QT_TR_NOOP("Min I frame interval")); gtk_widget_show (label8); gtk_table_attach (GTK_TABLE (table2), label8, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label8), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5); spinbuttonMinIFrame_adj = gtk_adjustment_new (1, 0, 600, 1, 10, 0); spinbuttonMinIFrame = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonMinIFrame_adj), 1, 0); gtk_widget_show (spinbuttonMinIFrame); gtk_table_attach (GTK_TABLE (table2), spinbuttonMinIFrame, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonMinIFrame), TRUE); optionME = gtk_option_menu_new (); gtk_widget_show (optionME); gtk_table_attach (GTK_TABLE (table2), optionME, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); menu4 = gtk_menu_new (); _0___none1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("0 - None")); gtk_widget_show (_0___none1); gtk_container_add (GTK_CONTAINER (menu4), _0___none1); _1__very_low1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("1- Very low")); gtk_widget_show (_1__very_low1); gtk_container_add (GTK_CONTAINER (menu4), _1__very_low1); _2__low1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("2- Low")); gtk_widget_show (_2__low1); gtk_container_add (GTK_CONTAINER (menu4), _2__low1); _3__medium1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("3- Medium")); gtk_widget_show (_3__medium1); gtk_container_add (GTK_CONTAINER (menu4), _3__medium1); _4__high1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("4- High")); gtk_widget_show (_4__high1); gtk_container_add (GTK_CONTAINER (menu4), _4__high1); _5__very_high1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("5- Very High")); gtk_widget_show (_5__very_high1); gtk_container_add (GTK_CONTAINER (menu4), _5__very_high1); _6__ultra_high1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("6- Ultra High")); gtk_widget_show (_6__ultra_high1); gtk_container_add (GTK_CONTAINER (menu4), _6__ultra_high1); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionME), menu4); optionQzer = gtk_option_menu_new (); gtk_widget_show (optionQzer); gtk_table_attach (GTK_TABLE (table2), optionQzer, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); menu5 = gtk_menu_new (); h263_quantizer1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("H263 Quantizer")); gtk_widget_show (h263_quantizer1); gtk_container_add (GTK_CONTAINER (menu5), h263_quantizer1); mpeg_quantizer1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("MPEG Quantizer")); gtk_widget_show (mpeg_quantizer1); gtk_container_add (GTK_CONTAINER (menu5), mpeg_quantizer1); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionQzer), menu5); label2 = gtk_label_new (QT_TR_NOOP("Advanced")); gtk_widget_show (label2); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); table3 = gtk_table_new (4, 2, FALSE); gtk_widget_show (table3); gtk_container_add (GTK_CONTAINER (notebook1), table3); label9 = gtk_label_new (QT_TR_NOOP("Min I Frame Qzer")); gtk_widget_show (label9); gtk_table_attach (GTK_TABLE (table3), label9, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5); label10 = gtk_label_new (QT_TR_NOOP("Max I Frame Qzer")); gtk_widget_show (label10); gtk_table_attach (GTK_TABLE (table3), label10, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5); label11 = gtk_label_new (QT_TR_NOOP("Min P Frame Qzer")); gtk_widget_show (label11); gtk_table_attach (GTK_TABLE (table3), label11, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label11), 0, 0.5); label12 = gtk_label_new (QT_TR_NOOP("Max P Frame Qzer")); gtk_widget_show (label12); gtk_table_attach (GTK_TABLE (table3), label12, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5); spinImin_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 0); spinImin = gtk_spin_button_new (GTK_ADJUSTMENT (spinImin_adj), 1, 0); gtk_widget_show (spinImin); gtk_table_attach (GTK_TABLE (table3), spinImin, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinImin), TRUE); spinImax_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 0); spinImax = gtk_spin_button_new (GTK_ADJUSTMENT (spinImax_adj), 1, 0); gtk_widget_show (spinImax); gtk_table_attach (GTK_TABLE (table3), spinImax, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinImax), TRUE); spinPmin_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 0); spinPmin = gtk_spin_button_new (GTK_ADJUSTMENT (spinPmin_adj), 1, 0); gtk_widget_show (spinPmin); gtk_table_attach (GTK_TABLE (table3), spinPmin, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPmin), TRUE); spinPmax_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 0); spinPmax = gtk_spin_button_new (GTK_ADJUSTMENT (spinPmax_adj), 1, 0); gtk_widget_show (spinPmax); gtk_table_attach (GTK_TABLE (table3), spinPmax, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPmax), TRUE); label3 = gtk_label_new (QT_TR_NOOP("Quantizer")); gtk_widget_show (label3); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label3); gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT); label13 = gtk_label_new (QT_TR_NOOP("Not Yet!")); gtk_widget_show (label13); gtk_container_add (GTK_CONTAINER (notebook1), label13); gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_LEFT); label4 = gtk_label_new (QT_TR_NOOP("B Frames")); gtk_widget_show (label4); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label4); gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT); 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); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, 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, notebook1, "notebook1"); GLADE_HOOKUP_OBJECT (dialog1, table1, "table1"); GLADE_HOOKUP_OBJECT (dialog1, radioCQ, "radioCQ"); GLADE_HOOKUP_OBJECT (dialog1, radioCBR, "radioCBR"); GLADE_HOOKUP_OBJECT (dialog1, radio2Pass, "radio2Pass"); GLADE_HOOKUP_OBJECT (dialog1, entryCQ, "entryCQ"); GLADE_HOOKUP_OBJECT (dialog1, entryCBR, "entryCBR"); GLADE_HOOKUP_OBJECT (dialog1, entry2Pass, "entry2Pass"); GLADE_HOOKUP_OBJECT (dialog1, label1, "label1"); GLADE_HOOKUP_OBJECT (dialog1, table2, "table2"); GLADE_HOOKUP_OBJECT (dialog1, label5, "label5"); GLADE_HOOKUP_OBJECT (dialog1, label6, "label6"); GLADE_HOOKUP_OBJECT (dialog1, label7, "label7"); GLADE_HOOKUP_OBJECT (dialog1, spinbuttonMaxIFrame, "spinbuttonMaxIFrame"); GLADE_HOOKUP_OBJECT (dialog1, label8, "label8"); GLADE_HOOKUP_OBJECT (dialog1, spinbuttonMinIFrame, "spinbuttonMinIFrame"); GLADE_HOOKUP_OBJECT (dialog1, optionME, "optionME"); GLADE_HOOKUP_OBJECT (dialog1, menu4, "menu4"); GLADE_HOOKUP_OBJECT (dialog1, _0___none1, "_0___none1"); GLADE_HOOKUP_OBJECT (dialog1, _1__very_low1, "_1__very_low1"); GLADE_HOOKUP_OBJECT (dialog1, _2__low1, "_2__low1"); GLADE_HOOKUP_OBJECT (dialog1, _3__medium1, "_3__medium1"); GLADE_HOOKUP_OBJECT (dialog1, _4__high1, "_4__high1"); GLADE_HOOKUP_OBJECT (dialog1, _5__very_high1, "_5__very_high1"); GLADE_HOOKUP_OBJECT (dialog1, _6__ultra_high1, "_6__ultra_high1"); GLADE_HOOKUP_OBJECT (dialog1, optionQzer, "optionQzer"); GLADE_HOOKUP_OBJECT (dialog1, menu5, "menu5"); GLADE_HOOKUP_OBJECT (dialog1, h263_quantizer1, "h263_quantizer1"); GLADE_HOOKUP_OBJECT (dialog1, mpeg_quantizer1, "mpeg_quantizer1"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT (dialog1, table3, "table3"); GLADE_HOOKUP_OBJECT (dialog1, label9, "label9"); GLADE_HOOKUP_OBJECT (dialog1, label10, "label10"); GLADE_HOOKUP_OBJECT (dialog1, label11, "label11"); GLADE_HOOKUP_OBJECT (dialog1, label12, "label12"); GLADE_HOOKUP_OBJECT (dialog1, spinImin, "spinImin"); GLADE_HOOKUP_OBJECT (dialog1, spinImax, "spinImax"); GLADE_HOOKUP_OBJECT (dialog1, spinPmin, "spinPmin"); GLADE_HOOKUP_OBJECT (dialog1, spinPmax, "spinPmax"); GLADE_HOOKUP_OBJECT (dialog1, label3, "label3"); GLADE_HOOKUP_OBJECT (dialog1, label13, "label13"); GLADE_HOOKUP_OBJECT (dialog1, label4, "label4"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *frame1; GtkWidget *table2; GtkWidget *label4; GtkWidget *label5; GtkWidget *hscaleBrightness; GtkWidget *hscaleSaturation; GtkWidget *hscaleContrast; GtkWidget *label3; GtkWidget *label1; GtkWidget *frame2; GtkWidget *table3; GtkWidget *label6; GtkWidget *hscaleGamma; GtkWidget *hscaleGammaR; GtkWidget *label8; GtkWidget *hscaleGammaG; GtkWidget *label9; GtkWidget *label10; GtkWidget *label7; GtkWidget *hscaleGammaB; GtkWidget *hscaleGammaWeight; GtkWidget *label2; GtkWidget *hscale1; GtkWidget *drawingarea1; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_container_set_border_width (GTK_CONTAINER (dialog1), 6); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("MPlayer eq2")); gtk_window_set_resizable (GTK_WINDOW (dialog1), FALSE); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); frame1 = gtk_frame_new (NULL); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (hbox1), frame1, TRUE, TRUE, 0); gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE); table2 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table2); gtk_container_add (GTK_CONTAINER (frame1), table2); gtk_container_set_border_width (GTK_CONTAINER (table2), 12); gtk_table_set_row_spacings (GTK_TABLE (table2), 6); gtk_table_set_col_spacings (GTK_TABLE (table2), 12); label4 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Brigh_tness:")); gtk_widget_show (label4); gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); label5 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Saturation:")); gtk_widget_show (label5); gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); hscaleBrightness = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -1, 1, 0.05, 1, 0))); gtk_widget_show (hscaleBrightness); gtk_table_attach (GTK_TABLE (table2), hscaleBrightness, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleBrightness, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleBrightness), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleBrightness), 2); hscaleSaturation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 3, 0.05, 1, 0))); gtk_widget_show (hscaleSaturation); gtk_table_attach (GTK_TABLE (table2), hscaleSaturation, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleSaturation, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleSaturation), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleSaturation), 2); hscaleContrast = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, -2, 2, 0.05, 1, 0))); gtk_widget_show (hscaleContrast); gtk_table_attach (GTK_TABLE (table2), hscaleContrast, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleContrast, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleContrast), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleContrast), 2); label3 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Contrast:")); gtk_widget_show (label3); gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5); label1 = gtk_label_new (""); gtk_widget_show (label1); gtk_frame_set_label_widget (GTK_FRAME (frame1), label1); gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); frame2 = gtk_frame_new (NULL); gtk_widget_show (frame2); gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0); gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE); table3 = gtk_table_new (5, 2, FALSE); gtk_widget_show (table3); gtk_container_add (GTK_CONTAINER (frame2), table3); gtk_container_set_border_width (GTK_CONTAINER (table3), 12); gtk_table_set_row_spacings (GTK_TABLE (table3), 6); gtk_table_set_col_spacings (GTK_TABLE (table3), 12); label6 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Initial:")); gtk_widget_show (label6); gtk_table_attach (GTK_TABLE (table3), label6, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); hscaleGamma = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0))); gtk_widget_show (hscaleGamma); gtk_table_attach (GTK_TABLE (table3), hscaleGamma, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleGamma, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleGamma), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleGamma), 2); hscaleGammaR = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0))); gtk_widget_show (hscaleGammaR); gtk_table_attach (GTK_TABLE (table3), hscaleGammaR, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleGammaR, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaR), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleGammaR), 2); label8 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Red:")); gtk_widget_show (label8); gtk_table_attach (GTK_TABLE (table3), label8, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label8), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5); hscaleGammaG = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0))); gtk_widget_show (hscaleGammaG); gtk_table_attach (GTK_TABLE (table3), hscaleGammaG, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleGammaG, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaG), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleGammaG), 2); label9 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Green:")); gtk_widget_show (label9); gtk_table_attach (GTK_TABLE (table3), label9, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5); label10 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Blue:")); gtk_widget_show (label10); gtk_table_attach (GTK_TABLE (table3), label10, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5); label7 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Weight:")); gtk_widget_show (label7); gtk_table_attach (GTK_TABLE (table3), label7, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); hscaleGammaB = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0))); gtk_widget_show (hscaleGammaB); gtk_table_attach (GTK_TABLE (table3), hscaleGammaB, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleGammaB, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaB), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleGammaB), 2); hscaleGammaWeight = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 1, 0.05, 1, 0))); gtk_widget_show (hscaleGammaWeight); gtk_table_attach (GTK_TABLE (table3), hscaleGammaWeight, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_widget_set_size_request (hscaleGammaWeight, 144, 0); gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaWeight), GTK_POS_RIGHT); gtk_scale_set_digits (GTK_SCALE (hscaleGammaWeight), 2); label2 = gtk_label_new (QT_TR_NOOP("<b>Gamma</b>")); gtk_widget_show (label2); gtk_frame_set_label_widget (GTK_FRAME (frame2), label2); gtk_label_set_use_markup (GTK_LABEL (label2), TRUE); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 1, 0))); gtk_widget_show (hscale1); gtk_box_pack_start (GTK_BOX (vbox1), hscale1, FALSE, FALSE, 0); drawingarea1 = gtk_drawing_area_new (); gtk_widget_show (drawingarea1); gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0); 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); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); gtk_label_set_mnemonic_widget (GTK_LABEL (label4), hscaleBrightness); gtk_label_set_mnemonic_widget (GTK_LABEL (label5), hscaleSaturation); gtk_label_set_mnemonic_widget (GTK_LABEL (label3), hscaleContrast); gtk_label_set_mnemonic_widget (GTK_LABEL (label6), hscaleGamma); gtk_label_set_mnemonic_widget (GTK_LABEL (label8), hscaleGammaR); gtk_label_set_mnemonic_widget (GTK_LABEL (label9), hscaleGammaG); gtk_label_set_mnemonic_widget (GTK_LABEL (label10), hscaleGammaB); gtk_label_set_mnemonic_widget (GTK_LABEL (label7), hscaleGammaWeight); /* 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, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (dialog1, frame1, "frame1"); GLADE_HOOKUP_OBJECT (dialog1, table2, "table2"); GLADE_HOOKUP_OBJECT (dialog1, label4, "label4"); GLADE_HOOKUP_OBJECT (dialog1, label5, "label5"); GLADE_HOOKUP_OBJECT (dialog1, hscaleBrightness, "hscaleBrightness"); GLADE_HOOKUP_OBJECT (dialog1, hscaleSaturation, "hscaleSaturation"); GLADE_HOOKUP_OBJECT (dialog1, hscaleContrast, "hscaleContrast"); GLADE_HOOKUP_OBJECT (dialog1, label3, "label3"); GLADE_HOOKUP_OBJECT (dialog1, label1, "label1"); GLADE_HOOKUP_OBJECT (dialog1, frame2, "frame2"); GLADE_HOOKUP_OBJECT (dialog1, table3, "table3"); GLADE_HOOKUP_OBJECT (dialog1, label6, "label6"); GLADE_HOOKUP_OBJECT (dialog1, hscaleGamma, "hscaleGamma"); GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaR, "hscaleGammaR"); GLADE_HOOKUP_OBJECT (dialog1, label8, "label8"); GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaG, "hscaleGammaG"); GLADE_HOOKUP_OBJECT (dialog1, label9, "label9"); GLADE_HOOKUP_OBJECT (dialog1, label10, "label10"); GLADE_HOOKUP_OBJECT (dialog1, label7, "label7"); GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaB, "hscaleGammaB"); GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaWeight, "hscaleGammaWeight"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1"); GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }
void create_TextProfileDialog (CTextProfile *tp) { GtkWidget *TextEncoderDialog; GtkWidget *dialog_vbox11; GtkWidget *table8; GtkWidget *TextEncodingOptionMenu; GtkWidget *label211; GtkWidget *label212; GtkObject *TextRepeatTimeSpinner_adj; GtkWidget *TextRepeatTimeSpinner; GtkWidget *label213; GtkWidget *TextProfileEntry; GtkWidget *dialog_action_area10; GtkWidget *cancelbutton8; GtkWidget *okbutton10; TextEncoderDialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(TextEncoderDialog), _("Text Encoder")); gtk_window_set_modal(GTK_WINDOW(TextEncoderDialog), TRUE); gtk_window_set_resizable(GTK_WINDOW(TextEncoderDialog), FALSE); dialog_vbox11 = GTK_DIALOG(TextEncoderDialog)->vbox; gtk_widget_show(dialog_vbox11); table8 = gtk_table_new(3, 2, TRUE); gtk_widget_show(table8); gtk_box_pack_start(GTK_BOX(dialog_vbox11), table8, TRUE, TRUE, 0); gtk_table_set_row_spacings(GTK_TABLE(table8), 11); gtk_table_set_col_spacings(GTK_TABLE(table8), 7); TextEncodingOptionMenu = gtk_option_menu_new(); gtk_widget_show(TextEncodingOptionMenu); gtk_table_attach(GTK_TABLE(table8), TextEncodingOptionMenu, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); label211 = gtk_label_new(_("Text Encoder:")); gtk_widget_show(label211); gtk_table_attach(GTK_TABLE(table8), label211, 0, 1, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); gtk_misc_set_alignment(GTK_MISC(label211), 0, 0.5); label212 = gtk_label_new(_("Repeat Time:")); gtk_widget_show(label212); gtk_table_attach(GTK_TABLE(table8), label212, 0, 1, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); gtk_misc_set_alignment(GTK_MISC(label212), 0, 0.5); TextRepeatTimeSpinner_adj = gtk_adjustment_new(tp != NULL ? tp->GetFloatValue(CFG_TEXT_REPEAT_TIME_SECS) : 1, 0, 100, 1, 10, 10); TextRepeatTimeSpinner = gtk_spin_button_new(GTK_ADJUSTMENT(TextRepeatTimeSpinner_adj), 1, 1); gtk_widget_show(TextRepeatTimeSpinner); gtk_table_attach(GTK_TABLE(table8), TextRepeatTimeSpinner, 1, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(TextRepeatTimeSpinner), TRUE); label213 = gtk_label_new(_("Text Profile:")); gtk_widget_show(label213); gtk_table_attach(GTK_TABLE(table8), label213, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); gtk_misc_set_alignment(GTK_MISC(label213), 0, 0.5); TextProfileEntry = gtk_entry_new(); gtk_widget_show (TextProfileEntry); gtk_table_attach (GTK_TABLE(table8), TextProfileEntry, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); dialog_action_area10 = GTK_DIALOG(TextEncoderDialog)->action_area; gtk_widget_show(dialog_action_area10); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area10), GTK_BUTTONBOX_END); cancelbutton8 = gtk_button_new_from_stock("gtk-cancel"); gtk_widget_show(cancelbutton8); gtk_dialog_add_action_widget(GTK_DIALOG(TextEncoderDialog), cancelbutton8, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS(cancelbutton8, GTK_CAN_DEFAULT); okbutton10 = gtk_button_new_from_stock("gtk-ok"); gtk_widget_show(okbutton10); gtk_dialog_add_action_widget(GTK_DIALOG(TextEncoderDialog), okbutton10, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS(okbutton10, GTK_CAN_DEFAULT); g_signal_connect((gpointer) TextEncoderDialog, "response", G_CALLBACK(on_TextEncoderDialog_response), tp); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF(TextEncoderDialog, TextEncoderDialog, "TextEncoderDialog"); GLADE_HOOKUP_OBJECT_NO_REF(TextEncoderDialog, dialog_vbox11, "dialog_vbox11"); GLADE_HOOKUP_OBJECT(TextEncoderDialog, table8, "table8"); GLADE_HOOKUP_OBJECT(TextEncoderDialog, TextEncodingOptionMenu, "TextEncodingOptionMenu"); GLADE_HOOKUP_OBJECT(TextEncoderDialog, label211, "label211"); GLADE_HOOKUP_OBJECT(TextEncoderDialog, label212, "label212"); GLADE_HOOKUP_OBJECT(TextEncoderDialog, TextRepeatTimeSpinner, "TextRepeatTimeSpinner"); GLADE_HOOKUP_OBJECT (TextEncoderDialog, label213, "label213"); GLADE_HOOKUP_OBJECT (TextEncoderDialog, TextProfileEntry, "TextProfileEntry"); GLADE_HOOKUP_OBJECT_NO_REF(TextEncoderDialog, dialog_action_area10, "dialog_action_area10"); GLADE_HOOKUP_OBJECT(TextEncoderDialog, cancelbutton8, "cancelbutton8"); GLADE_HOOKUP_OBJECT(TextEncoderDialog, okbutton10, "okbutton10"); uint encoderIndex = 0; uint ix = 0; encoderNames = (const char **)malloc(text_encoder_table_size * sizeof(const char *)); for (ix = 0; ix < text_encoder_table_size; ix++) { if (tp != NULL && strcasecmp(tp->GetStringValue(CFG_TEXT_ENCODING), text_encoder_table[ix].text_encoding) == 0) { encoderIndex = ix; } encoderNames[ix] = text_encoder_table[ix].dialog_selection_name; } CreateOptionMenu(TextEncodingOptionMenu, encoderNames, text_encoder_table_size, encoderIndex); if (tp != NULL) { gtk_entry_set_text(GTK_ENTRY(TextProfileEntry), tp->GetStringValue(CFG_TEXT_PROFILE_NAME)); gtk_widget_set_sensitive(TextProfileEntry, false); } gtk_widget_show(TextEncoderDialog); }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *frame1; GtkWidget *table1; GtkWidget *buttonSelect; GtkWidget *labelVobsub; GtkWidget *label4; GtkWidget *optionmenu1; GtkWidget *label2; GtkWidget *frame2; GtkWidget *table2; GtkWidget *label6; GtkObject *spinbutton1_adj; GtkWidget *spinbutton1; GtkWidget *label7; GtkWidget *entryShift; GtkWidget *label5; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("VobSub Settings")); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); frame1 = gtk_frame_new (NULL); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (vbox1), frame1, TRUE, TRUE, 0); table1 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (frame1), table1); buttonSelect = gtk_button_new_with_mnemonic (QT_TR_NOOP("Select .idx")); gtk_widget_show (buttonSelect); gtk_table_attach (GTK_TABLE (table1), buttonSelect, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); labelVobsub = gtk_label_new (QT_TR_NOOP("None")); gtk_widget_show (labelVobsub); gtk_table_attach (GTK_TABLE (table1), labelVobsub, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (labelVobsub), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (labelVobsub), 0, 0.5); label4 = gtk_label_new (QT_TR_NOOP("Select Language :")); gtk_widget_show (label4); gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); optionmenu1 = gtk_option_menu_new (); gtk_widget_show (optionmenu1); gtk_table_attach (GTK_TABLE (table1), optionmenu1, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); label2 = gtk_label_new (QT_TR_NOOP("Select Sub")); gtk_widget_show (label2); gtk_frame_set_label_widget (GTK_FRAME (frame1), label2); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); frame2 = gtk_frame_new (NULL); gtk_widget_show (frame2); gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0); table2 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table2); gtk_container_add (GTK_CONTAINER (frame2), table2); label6 = gtk_label_new (QT_TR_NOOP("Extra Shrink Factor :")); gtk_widget_show (label6); gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); spinbutton1_adj = gtk_adjustment_new (1, 1, 2, 0.1, 0.2, 0.2); spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0); gtk_widget_show (spinbutton1); gtk_table_attach (GTK_TABLE (table2), spinbutton1, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label7 = gtk_label_new (QT_TR_NOOP("Shift (ms) :")); gtk_widget_show (label7); gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); entryShift = gtk_entry_new (); gtk_widget_show (entryShift); gtk_table_attach (GTK_TABLE (table2), entryShift, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label5 = gtk_label_new (QT_TR_NOOP("Extra Settings")); gtk_widget_show (label5); gtk_frame_set_label_widget (GTK_FRAME (frame2), label5); gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT); 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); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, 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, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (dialog1, frame1, "frame1"); GLADE_HOOKUP_OBJECT (dialog1, table1, "table1"); GLADE_HOOKUP_OBJECT (dialog1, buttonSelect, "buttonSelect"); GLADE_HOOKUP_OBJECT (dialog1, labelVobsub, "labelVobsub"); GLADE_HOOKUP_OBJECT (dialog1, label4, "label4"); GLADE_HOOKUP_OBJECT (dialog1, optionmenu1, "optionmenu1"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT (dialog1, frame2, "frame2"); GLADE_HOOKUP_OBJECT (dialog1, table2, "table2"); GLADE_HOOKUP_OBJECT (dialog1, label6, "label6"); GLADE_HOOKUP_OBJECT (dialog1, spinbutton1, "spinbutton1"); GLADE_HOOKUP_OBJECT (dialog1, label7, "label7"); GLADE_HOOKUP_OBJECT (dialog1, entryShift, "entryShift"); GLADE_HOOKUP_OBJECT (dialog1, label5, "label5"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }
int DoMessageBox (const char* lpText, const char* lpCaption, guint32 uType) { GtkWidget *window, *w, *vbox, *hbox; int mode = (uType & MB_TYPEMASK), ret, loop = 1; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (dialog_delete_callback), NULL); gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL); gtk_window_set_title (GTK_WINDOW (window), lpCaption); gtk_container_border_width (GTK_CONTAINER (window), 10); g_object_set_data (G_OBJECT (window), "loop", &loop); g_object_set_data (G_OBJECT (window), "ret", &ret); gtk_widget_realize (window); vbox = gtk_vbox_new (FALSE, 10); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); w = gtk_label_new (lpText); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 2); gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT); gtk_widget_show (w); w = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 2); gtk_widget_show (w); hbox = gtk_hbox_new (FALSE, 10); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2); gtk_widget_show (hbox); if (mode == MB_OK) { w = gtk_button_new_with_label ("Ok"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); gtk_widget_show (w); ret = IDOK; } else if (mode == MB_OKCANCEL) { w = gtk_button_new_with_label ("Ok"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); gtk_widget_show (w); w = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDCANCEL)); gtk_widget_show (w); ret = IDCANCEL; } else if (mode == MB_YESNOCANCEL) { w = gtk_button_new_with_label ("Yes"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDYES)); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); gtk_widget_show (w); w = gtk_button_new_with_label ("No"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDNO)); gtk_widget_show (w); w = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDCANCEL)); gtk_widget_show (w); ret = IDCANCEL; } else /* if (mode == MB_YESNO) */ { w = gtk_button_new_with_label ("Yes"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDYES)); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); gtk_widget_show (w); w = gtk_button_new_with_label ("No"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDNO)); gtk_widget_show (w); ret = IDNO; } gtk_widget_show (window); gtk_grab_add (window); while (loop) gtk_main_iteration (); gtk_grab_remove (window); gtk_widget_destroy (window); return ret; }
static GtkWidget *create_window(void) { stwidgets.accel_group = gtk_accel_group_new(); // Basic window stwidgets.startwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(stwidgets.startwin), apptitle); // NOTE: use global app title gtk_window_set_position(GTK_WINDOW(stwidgets.startwin), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW(stwidgets.startwin), FALSE); gtk_window_set_type_hint(GTK_WINDOW(stwidgets.startwin), GDK_WINDOW_TYPE_HINT_DIALOG); // Horizontal layout of banner and controls stwidgets.hlayout = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(stwidgets.startwin), stwidgets.hlayout); // banner { GdkPixbuf *pixbuf = load_banner(); stwidgets.banner = gtk_image_new_from_pixbuf(pixbuf); g_object_unref((gpointer)pixbuf); } gtk_box_pack_start(GTK_BOX(stwidgets.hlayout), stwidgets.banner, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(stwidgets.banner), 0.5, 0); // Vertical layout of tab control and start+cancel buttons stwidgets.vlayout = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(stwidgets.hlayout), stwidgets.vlayout, TRUE, TRUE, 0); // Tab control stwidgets.tabs = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.tabs, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(stwidgets.tabs), 4); // layout table of config page stwidgets.configtlayout = gtk_table_new(4, 3, FALSE); gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.configtlayout); // 2D video mode label stwidgets.vmode2dlabel = gtk_label_new_with_mnemonic("_2D Video mode:"); gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode2dlabel), 0.3, 0); gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 6); // 2D video mode combo { GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); GtkCellRenderer *cell; stwidgets.vmode2dcombo = 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(stwidgets.vmode2dcombo), cell, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, "text", 0, NULL); } gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 6); gtk_widget_add_accelerator(stwidgets.vmode2dcombo, "grab_focus", stwidgets.accel_group, GDK_2, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); // Fullscreen checkbox stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen"); gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.fullscreencheck, 2,3, 0,1, GTK_FILL, 0, 4, 6); gtk_widget_add_accelerator(stwidgets.fullscreencheck, "grab_focus", stwidgets.accel_group, GDK_F, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); // 3D video mode label stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_3D Video mode:"); gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0); gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 1,2, GTK_FILL, 0, 4, 6); // 3D video mode combo { GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); GtkCellRenderer *cell; stwidgets.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(stwidgets.vmode3dcombo), cell, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL); } gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0); gtk_widget_add_accelerator(stwidgets.vmode3dcombo, "grab_focus", stwidgets.accel_group, GDK_3, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); // Empty horizontal layout stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0); gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, 0, GTK_EXPAND | GTK_FILL, 0, 0); // Always show config checkbox stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start"); gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,2, 3,4, GTK_FILL, 0, 4, 6); gtk_widget_add_accelerator(stwidgets.alwaysshowcheck, "grab_focus", stwidgets.accel_group, GDK_A, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); // Configuration tab stwidgets.configtab = gtk_label_new("Configuration"); gtk_notebook_set_tab_label(GTK_NOTEBOOK(stwidgets.tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(stwidgets.tabs), 0), stwidgets.configtab); // Messages scrollable area stwidgets.messagesscroll = gtk_scrolled_window_new(NULL, NULL); gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.messagesscroll); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(stwidgets.messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); // Messages text area stwidgets.messagestext = gtk_text_view_new(); gtk_container_add(GTK_CONTAINER(stwidgets.messagesscroll), stwidgets.messagestext); gtk_text_view_set_editable(GTK_TEXT_VIEW(stwidgets.messagestext), FALSE); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(stwidgets.messagestext), GTK_WRAP_WORD); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(stwidgets.messagestext), FALSE); gtk_text_view_set_left_margin(GTK_TEXT_VIEW(stwidgets.messagestext), 2); gtk_text_view_set_right_margin(GTK_TEXT_VIEW(stwidgets.messagestext), 2); // Messages tab stwidgets.messagestab = gtk_label_new("Messages"); gtk_notebook_set_tab_label(GTK_NOTEBOOK(stwidgets.tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(stwidgets.tabs), 1), stwidgets.messagestab); // Dialogue box buttons layout stwidgets.buttons = gtk_hbutton_box_new(); gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.buttons, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(stwidgets.buttons), 3); gtk_button_box_set_layout(GTK_BUTTON_BOX(stwidgets.buttons), GTK_BUTTONBOX_END); // Cancel button stwidgets.cancelbutton = gtk_button_new(); gtk_container_add(GTK_CONTAINER(stwidgets.buttons), stwidgets.cancelbutton); GTK_WIDGET_SET_FLAGS(stwidgets.cancelbutton, GTK_CAN_DEFAULT); gtk_widget_add_accelerator(stwidgets.cancelbutton, "grab_focus", stwidgets.accel_group, GDK_C, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(stwidgets.cancelbutton, "clicked", stwidgets.accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE); stwidgets.cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_container_add(GTK_CONTAINER(stwidgets.cancelbutton), stwidgets.cancelbuttonalign); stwidgets.cancelbuttonlayout = gtk_hbox_new(FALSE, 2); gtk_container_add(GTK_CONTAINER(stwidgets.cancelbuttonalign), stwidgets.cancelbuttonlayout); stwidgets.cancelbuttonicon = gtk_image_new_from_stock("gtk-cancel", GTK_ICON_SIZE_BUTTON); gtk_box_pack_start(GTK_BOX(stwidgets.cancelbuttonlayout), stwidgets.cancelbuttonicon, FALSE, FALSE, 0); stwidgets.cancelbuttonlabel = gtk_label_new_with_mnemonic("_Cancel"); gtk_box_pack_start(GTK_BOX(stwidgets.cancelbuttonlayout), stwidgets.cancelbuttonlabel, FALSE, FALSE, 0); // Start button stwidgets.startbutton = gtk_button_new(); gtk_container_add(GTK_CONTAINER(stwidgets.buttons), stwidgets.startbutton); GTK_WIDGET_SET_FLAGS(stwidgets.startbutton, GTK_CAN_DEFAULT); gtk_widget_add_accelerator(stwidgets.startbutton, "grab_focus", stwidgets.accel_group, GDK_S, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(stwidgets.startbutton, "clicked", stwidgets.accel_group, GDK_Return, 0, GTK_ACCEL_VISIBLE); stwidgets.startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_container_add(GTK_CONTAINER(stwidgets.startbutton), stwidgets.startbuttonalign); stwidgets.startbuttonlayout = gtk_hbox_new(FALSE, 2); gtk_container_add(GTK_CONTAINER(stwidgets.startbuttonalign), stwidgets.startbuttonlayout); stwidgets.startbuttonicon = gtk_image_new_from_stock("gtk-execute", GTK_ICON_SIZE_BUTTON); gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonicon, FALSE, FALSE, 0); stwidgets.startbuttonlabel = gtk_label_new_with_mnemonic("_Start"); gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonlabel, FALSE, FALSE, 0); // Wire up the signals g_signal_connect((gpointer) stwidgets.startwin, "delete_event", G_CALLBACK(on_startwin_delete_event), NULL); g_signal_connect((gpointer) stwidgets.vmode2dcombo, "changed", G_CALLBACK(on_vmode2dcombo_changed), NULL); g_signal_connect((gpointer) stwidgets.vmode3dcombo, "changed", G_CALLBACK(on_vmode3dcombo_changed), NULL); g_signal_connect((gpointer) stwidgets.fullscreencheck, "toggled", G_CALLBACK(on_fullscreencheck_toggled), NULL); g_signal_connect((gpointer) stwidgets.alwaysshowcheck, "toggled", G_CALLBACK(on_alwaysshowcheck_toggled), NULL); g_signal_connect((gpointer) stwidgets.cancelbutton, "clicked", G_CALLBACK(on_cancelbutton_clicked), NULL); g_signal_connect((gpointer) stwidgets.startbutton, "clicked", G_CALLBACK(on_startbutton_clicked), NULL); // Associate labels with their controls gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.vmode2dlabel), stwidgets.vmode2dcombo); gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.vmode3dlabel), stwidgets.vmode3dcombo); gtk_window_add_accel_group(GTK_WINDOW(stwidgets.startwin), stwidgets.accel_group); return stwidgets.startwin; }
/** * gimp_dialog_create_action_areav: * @dialog: The #GtkDialog you want to create the action_area for. * @args: A @va_list as obtained with va_start() describing the action_area * buttons. * */ void gimp_dialog_create_action_areav (GtkDialog *dialog, va_list args) { GtkWidget *hbbox = NULL; GtkWidget *button; /* action area variables */ const gchar *label; GtkSignalFunc callback; gpointer data; GtkObject *slot_object; GtkWidget **widget_ptr; gboolean default_action; gboolean connect_delete; gboolean delete_connected = FALSE; g_return_if_fail (dialog != NULL); g_return_if_fail (GTK_IS_DIALOG (dialog)); /* prepare the action_area */ label = va_arg (args, const gchar *); if (label) { gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 2); gtk_box_set_homogeneous (GTK_BOX (dialog->action_area), FALSE); hbbox = gtk_hbutton_box_new (); gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4); gtk_box_pack_end (GTK_BOX (dialog->action_area), hbbox, FALSE, FALSE, 0); gtk_widget_show (hbbox); } /* the action_area buttons */ while (label) { callback = va_arg (args, GtkSignalFunc); data = va_arg (args, gpointer); slot_object = va_arg (args, GtkObject *); widget_ptr = va_arg (args, GtkWidget **); default_action = va_arg (args, gboolean); connect_delete = va_arg (args, gboolean); button = gtk_button_new_with_label (label); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); if (slot_object == (GtkObject *) 1) slot_object = GTK_OBJECT (dialog); if (data == NULL) data = dialog; if (callback) { if (slot_object) gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), slot_object); else gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), data); } if (widget_ptr) *widget_ptr = button; if (connect_delete && callback && !delete_connected) { gtk_object_set_data (GTK_OBJECT (dialog), "gimp_dialog_cancel_callback", callback); gtk_object_set_data (GTK_OBJECT (dialog), "gimp_dialog_cancel_widget", slot_object ? slot_object : GTK_OBJECT (button)); /* catch the WM delete event */ gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", GTK_SIGNAL_FUNC (gimp_dialog_delete_callback), data); delete_connected = TRUE; } if (default_action) gtk_widget_grab_default (button); gtk_widget_show (button); label = va_arg (args, gchar *); } }
GtkWidget* create_bsv_viewer_pref_dlg (void) { GtkWidget *bsv_viewer_pref_dlg; GtkWidget *dialog_vbox1; GtkWidget *notebook1; GtkWidget *vbox2; GtkWidget *hbox19; GtkWidget *label3; GtkObject *chanperscreen_spinb_adj; GtkWidget *chanperscreen_spinb; GtkWidget *hbox20; GtkWidget *label4; GtkObject *hrange_spinb_adj; GtkWidget *hrange_spinb; GtkWidget *label5; GtkWidget *label1; GtkWidget *vbox3; GtkWidget *hbox21; GtkWidget *label6; GtkWidget *logfile_entry; GtkWidget *button15; GtkWidget *image17; GtkWidget *hbox22; GtkWidget *label7; GtkWidget *patid_entry; GtkWidget *hbox23; GtkWidget *label8; GtkWidget *recid_entry; GtkWidget *label2; GtkWidget *dialog_action_area1; GtkWidget *okbutton1; bsv_viewer_pref_dlg = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (bsv_viewer_pref_dlg), _("Viewer Preferences")); dialog_vbox1 = GTK_DIALOG (bsv_viewer_pref_dlg)->vbox; gtk_widget_show (dialog_vbox1); notebook1 = gtk_notebook_new (); gtk_widget_show (notebook1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook1, TRUE, TRUE, 0); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_container_add (GTK_CONTAINER (notebook1), vbox2); hbox19 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox19); gtk_box_pack_start (GTK_BOX (vbox2), hbox19, FALSE, TRUE, 0); label3 = gtk_label_new (_("Channels per Screen: ")); gtk_widget_show (label3); gtk_box_pack_start (GTK_BOX (hbox19), label3, FALSE, FALSE, 0); chanperscreen_spinb_adj = gtk_adjustment_new (1, 1, 100, 1, 10, 10); chanperscreen_spinb = gtk_spin_button_new (GTK_ADJUSTMENT (chanperscreen_spinb_adj), 1, 0); gtk_widget_show (chanperscreen_spinb); gtk_box_pack_start (GTK_BOX (hbox19), chanperscreen_spinb, FALSE, TRUE, 0); hbox20 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox20); gtk_box_pack_start (GTK_BOX (vbox2), hbox20, FALSE, TRUE, 0); label4 = gtk_label_new (_("Horizontal Time Range: ")); gtk_widget_show (label4); gtk_box_pack_start (GTK_BOX (hbox20), label4, FALSE, FALSE, 0); hrange_spinb_adj = gtk_adjustment_new (1, 1, 100, 1, 10, 10); hrange_spinb = gtk_spin_button_new (GTK_ADJUSTMENT (hrange_spinb_adj), 1, 0); gtk_widget_show (hrange_spinb); gtk_box_pack_start (GTK_BOX (hbox20), hrange_spinb, FALSE, TRUE, 0); label5 = gtk_label_new (_(" sec")); gtk_widget_show (label5); gtk_box_pack_start (GTK_BOX (hbox20), label5, FALSE, FALSE, 0); label1 = gtk_label_new (_("Viewer")); gtk_widget_show (label1); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1); vbox3 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox3); gtk_container_add (GTK_CONTAINER (notebook1), vbox3); hbox21 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox21); gtk_box_pack_start (GTK_BOX (vbox3), hbox21, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox21), 2); label6 = gtk_label_new (_("GDF Logfile: ")); gtk_widget_show (label6); gtk_box_pack_start (GTK_BOX (hbox21), label6, FALSE, FALSE, 0); logfile_entry = gtk_entry_new (); gtk_widget_show (logfile_entry); gtk_box_pack_start (GTK_BOX (hbox21), logfile_entry, TRUE, TRUE, 0); button15 = gtk_button_new (); gtk_widget_show (button15); gtk_box_pack_start (GTK_BOX (hbox21), button15, FALSE, FALSE, 0); image17 = gtk_image_new_from_stock ("gtk-floppy", GTK_ICON_SIZE_BUTTON); gtk_widget_show (image17); gtk_container_add (GTK_CONTAINER (button15), image17); hbox22 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox22); gtk_box_pack_start (GTK_BOX (vbox3), hbox22, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox22), 2); label7 = gtk_label_new (_("Patient ID: ")); gtk_widget_show (label7); gtk_box_pack_start (GTK_BOX (hbox22), label7, FALSE, FALSE, 0); patid_entry = gtk_entry_new (); gtk_widget_show (patid_entry); gtk_box_pack_start (GTK_BOX (hbox22), patid_entry, TRUE, TRUE, 0); hbox23 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox23); gtk_box_pack_start (GTK_BOX (vbox3), hbox23, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox23), 2); label8 = gtk_label_new (_("Record ID: ")); gtk_widget_show (label8); gtk_box_pack_start (GTK_BOX (hbox23), label8, FALSE, FALSE, 0); recid_entry = gtk_entry_new (); gtk_widget_show (recid_entry); gtk_box_pack_start (GTK_BOX (hbox23), recid_entry, TRUE, TRUE, 0); label2 = gtk_label_new (_("Logfile")); gtk_widget_show (label2); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2); dialog_action_area1 = GTK_DIALOG (bsv_viewer_pref_dlg)->action_area; gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (bsv_viewer_pref_dlg), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); g_signal_connect ((gpointer) bsv_viewer_pref_dlg, "delete_event", G_CALLBACK (update_viewer_settings), NULL); g_signal_connect ((gpointer) button15, "clicked", G_CALLBACK (show_fs_dlg), NULL); g_signal_connect ((gpointer) okbutton1, "clicked", G_CALLBACK (update_viewer_settings_but), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (bsv_viewer_pref_dlg, bsv_viewer_pref_dlg, "bsv_viewer_pref_dlg"); GLADE_HOOKUP_OBJECT_NO_REF (bsv_viewer_pref_dlg, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, notebook1, "notebook1"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, vbox2, "vbox2"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, hbox19, "hbox19"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label3, "label3"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, chanperscreen_spinb, "chanperscreen_spinb"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, hbox20, "hbox20"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label4, "label4"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, hrange_spinb, "hrange_spinb"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label5, "label5"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label1, "label1"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, vbox3, "vbox3"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, hbox21, "hbox21"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label6, "label6"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, logfile_entry, "logfile_entry"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, button15, "button15"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, image17, "image17"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, hbox22, "hbox22"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label7, "label7"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, patid_entry, "patid_entry"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, hbox23, "hbox23"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label8, "label8"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, recid_entry, "recid_entry"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, label2, "label2"); GLADE_HOOKUP_OBJECT_NO_REF (bsv_viewer_pref_dlg, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (bsv_viewer_pref_dlg, okbutton1, "okbutton1"); return bsv_viewer_pref_dlg; }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *label1; GtkWidget *entryName; GtkWidget *label2; GtkWidget *entryParam; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Pipe to")); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); label1 = gtk_label_new (QT_TR_NOOP("Application path/name (/usr/bin/sox...)")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); entryName = gtk_entry_new (); gtk_widget_show (entryName); gtk_box_pack_start (GTK_BOX (vbox1), entryName, FALSE, FALSE, 0); label2 = gtk_label_new (QT_TR_NOOP("Full parameter line")); gtk_widget_show (label2); gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); entryParam = gtk_entry_new (); gtk_widget_show (entryParam); gtk_box_pack_start (GTK_BOX (vbox1), entryParam, FALSE, FALSE, 0); 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); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, 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, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (dialog1, label1, "label1"); GLADE_HOOKUP_OBJECT (dialog1, entryName, "entryName"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT (dialog1, entryParam, "entryParam"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }
void create_kbm_window() { if (hime_kbm_window) { gtk_window_present(GTK_WINDOW(hime_kbm_window)); return; } load_setttings(); hime_kbm_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(hime_kbm_window), GTK_WIN_POS_MOUSE); gtk_window_set_has_resize_grip(GTK_WINDOW(hime_kbm_window), FALSE); g_signal_connect (G_OBJECT (hime_kbm_window), "delete_event", G_CALLBACK (close_kbm_window), NULL); gtk_window_set_title (GTK_WINDOW (hime_kbm_window), _("HIME 注音/詞音設定")); gtk_container_set_border_width (GTK_CONTAINER (hime_kbm_window), 1); GtkWidget *vbox_top = gtk_vbox_new (FALSE, 3); gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (hime_kbm_window), vbox_top); GtkWidget *hbox_lr = gtk_hbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (vbox_top), hbox_lr, TRUE, TRUE, 0); GtkWidget *vbox_l = gtk_vbox_new (FALSE, 3); gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_l), GTK_ORIENTATION_VERTICAL); gtk_box_pack_start (GTK_BOX (hbox_lr), vbox_l, TRUE, TRUE, 10); GtkWidget *vbox_r = gtk_vbox_new (FALSE, 3); gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_r), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_homogeneous(GTK_GRID(vbox_r), TRUE); gtk_box_pack_start (GTK_BOX (hbox_lr), vbox_r, TRUE, TRUE, 10); GtkWidget *frame_kbm = gtk_frame_new(_("鍵盤排列方式/選擇鍵/選單每列字數")); gtk_box_pack_start (GTK_BOX (vbox_l), frame_kbm, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame_kbm), 1); gtk_container_add (GTK_CONTAINER (frame_kbm), create_kbm_opts()); gtk_box_pack_start (GTK_BOX (vbox_l), create_en_pho_key_sel(_("(詞音) 切換[中/英]輸入")), TRUE, TRUE, 0); GtkWidget *frame_tsin_space_opt = gtk_frame_new(_("(詞音) 鍵入空白鍵")); gtk_box_pack_start (GTK_BOX (vbox_l), frame_tsin_space_opt, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_space_opt), 1); GtkWidget *box_tsin_space_opt = gtk_vbox_new (FALSE, 0); gtk_orientable_set_orientation(GTK_ORIENTABLE(box_tsin_space_opt), GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (frame_tsin_space_opt), box_tsin_space_opt); gtk_container_set_border_width (GTK_CONTAINER (box_tsin_space_opt), 1); GSList *group_tsin_space_opt = NULL; int current_idx = get_currnet_tsin_space_option_idx(); new_select_idx_tsin_space_opt = current_idx; gsize i; for(i=0; i< tsin_space_optionsN; i++) { GtkWidget *button = gtk_radio_button_new_with_label (group_tsin_space_opt, _(tsin_space_options[i].name)); gtk_box_pack_start (GTK_BOX (box_tsin_space_opt), button, TRUE, TRUE, 0); group_tsin_space_opt = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback_button_clicked_tsin_space_opt), (gpointer) i); if (i==current_idx) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); } GtkWidget *hbox_tsin_phrase_pre_select = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_l), hbox_tsin_phrase_pre_select , TRUE, TRUE, 1); check_button_tsin_phrase_pre_select = gtk_check_button_new_with_label(_("詞音輸入預選詞視窗")); gtk_box_pack_start (GTK_BOX (hbox_tsin_phrase_pre_select), check_button_tsin_phrase_pre_select, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_tsin_phrase_pre_select), tsin_phrase_pre_select); GtkWidget *hbox_phonetic_char_dynamic_sequence = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_l), hbox_phonetic_char_dynamic_sequence , TRUE, TRUE, 1); check_button_phonetic_char_dynamic_sequence = gtk_check_button_new_with_label(_("依使用頻率調整字的順序")); gtk_box_pack_start (GTK_BOX (hbox_phonetic_char_dynamic_sequence), check_button_phonetic_char_dynamic_sequence, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_phonetic_char_dynamic_sequence), phonetic_char_dynamic_sequence); GtkWidget *hbox_pho_hide_row2 = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_l), hbox_pho_hide_row2 , TRUE, TRUE, 1); check_button_pho_hide_row2 = gtk_check_button_new_with_label(_("注音隱藏第二列 (注音符號)")); gtk_box_pack_start (GTK_BOX (hbox_pho_hide_row2), check_button_pho_hide_row2, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_pho_hide_row2), pho_hide_row2); GtkWidget *hbox_pho_in_row1 = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_l), hbox_pho_in_row1 , TRUE, TRUE, 1); check_button_pho_in_row1 = gtk_check_button_new_with_label(_("注音符號移至第一列")); gtk_box_pack_start (GTK_BOX (hbox_pho_in_row1), check_button_pho_in_row1, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_pho_in_row1), pho_in_row1); GtkWidget *hbox_phonetic_huge_tab = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_r), hbox_phonetic_huge_tab , TRUE, TRUE, 1); check_button_phonetic_huge_tab = gtk_check_button_new_with_label(_("使用巨大 UTF-8 字集")); gtk_box_pack_start (GTK_BOX (hbox_phonetic_huge_tab), check_button_phonetic_huge_tab, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_phonetic_huge_tab), phonetic_huge_tab); GtkWidget *hbox_tsin_tone_char_input = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tone_char_input , TRUE, TRUE, 1); check_button_tsin_tone_char_input = gtk_check_button_new_with_label(_("(詞音) 輸入注音聲調符號")); gtk_box_pack_start (GTK_BOX (hbox_tsin_tone_char_input), check_button_tsin_tone_char_input, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_tsin_tone_char_input), tsin_tone_char_input); GtkWidget *hbox_tsin_tab_phrase_end = gtk_hbox_new(FALSE, 1); gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tab_phrase_end , TRUE, TRUE, 1); check_button_tsin_tab_phrase_end = gtk_check_button_new_with_label(_("(詞音) 使用 Escape/Tab 斷詞")); gtk_box_pack_start (GTK_BOX (hbox_tsin_tab_phrase_end), check_button_tsin_tab_phrase_end, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_tsin_tab_phrase_end), tsin_tab_phrase_end); GtkWidget *hbox_tsin_tail_select_key = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tail_select_key , TRUE, TRUE, 1); check_button_tsin_tail_select_key = gtk_check_button_new_with_label(_("選擇鍵顯示於候選字(詞)後方")); gtk_box_pack_start (GTK_BOX (hbox_tsin_tail_select_key), check_button_tsin_tail_select_key, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_tsin_tail_select_key), tsin_tail_select_key); GtkWidget *hbox_tsin_buffer_editing_mode = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_buffer_editing_mode , TRUE, TRUE, 1); check_button_tsin_buffer_editing_mode = gtk_check_button_new_with_label(_("\\ 鍵可切換 jkx 鍵編輯模式")); gtk_box_pack_start (GTK_BOX (hbox_tsin_buffer_editing_mode), check_button_tsin_buffer_editing_mode, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_tsin_buffer_editing_mode), tsin_buffer_editing_mode); GtkWidget *hbox_tsin_use_pho_near = gtk_hbox_new(FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_use_pho_near , TRUE, TRUE, 1); check_button_tsin_use_pho_near = gtk_check_button_new_with_label(_("按下 ↑ 鍵查詢近似音")); gtk_box_pack_start (GTK_BOX (hbox_tsin_use_pho_near), check_button_tsin_use_pho_near, FALSE, FALSE, 0); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(check_button_tsin_use_pho_near), tsin_use_pho_near); GtkWidget *frame_tsin_buffer_size = gtk_frame_new(_("(詞音) 的編輯緩衝區大小")); gtk_box_pack_start (GTK_BOX (vbox_r), frame_tsin_buffer_size, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_buffer_size), 1); GtkAdjustment *adj_gtab_in = (GtkAdjustment *) gtk_adjustment_new (tsin_buffer_size, 10.0, MAX_PH_BF, 1.0, 1.0, 0.0); spinner_tsin_buffer_size = gtk_spin_button_new (adj_gtab_in, 0, 0); gtk_container_add (GTK_CONTAINER (frame_tsin_buffer_size), spinner_tsin_buffer_size); GtkWidget *frame_tsin_cursor_color = gtk_frame_new(_("詞音游標的顏色")); gtk_box_pack_start (GTK_BOX (vbox_r), frame_tsin_cursor_color, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_cursor_color), 1); GtkWidget *button_tsin_cursor_color = gtk_button_new(); g_signal_connect (G_OBJECT (button_tsin_cursor_color), "clicked", G_CALLBACK (cb_tsin_cursor_color), G_OBJECT (hime_kbm_window)); da_cursor = gtk_drawing_area_new(); gtk_container_add (GTK_CONTAINER (button_tsin_cursor_color), da_cursor); gdk_color_parse(tsin_cursor_color, &tsin_cursor_gcolor); #if !GTK_CHECK_VERSION(2,91,6) gtk_widget_modify_bg(da_cursor, GTK_STATE_NORMAL, &tsin_cursor_gcolor); #else GdkRGBA rgbbg; gdk_rgba_parse(&rgbbg, gdk_color_to_string(&tsin_cursor_gcolor)); gtk_widget_override_background_color(da_cursor, GTK_STATE_FLAG_NORMAL, &rgbbg); #endif gtk_widget_set_size_request(da_cursor, 16, 2); gtk_container_add (GTK_CONTAINER (frame_tsin_cursor_color), button_tsin_cursor_color); GtkWidget *hbox_cancel_ok = gtk_hbox_new (FALSE, 10); gtk_grid_set_column_homogeneous(GTK_GRID(hbox_cancel_ok), TRUE); gtk_box_pack_start (GTK_BOX (vbox_top), hbox_cancel_ok , FALSE, FALSE, 5); GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL); if (button_order) gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0); else gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0); GtkWidget *button_ok = gtk_button_new_from_stock (GTK_STOCK_OK); #if !GTK_CHECK_VERSION(2,91,2) if (button_order) gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 5); else gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 5); #else if (button_order) gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_LEFT, 1, 1); else gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_RIGHT, 1, 1); #endif g_signal_connect (G_OBJECT (button_cancel), "clicked", G_CALLBACK (close_kbm_window), G_OBJECT (hime_kbm_window)); g_signal_connect_swapped (G_OBJECT (button_ok), "clicked", G_CALLBACK (cb_ok), G_OBJECT (hime_kbm_window)); GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT); gtk_widget_grab_default (button_cancel); gtk_widget_show_all (hime_kbm_window); return; }
struct connect_context * create_connect_window (struct ghtlc_conn *ghtlc) { struct ghx_window *gwin; GtkWidget *connect_window; GtkWidget *vbox1; GtkWidget *hbox; GtkWidget *cipher_label; GtkWidget *cipher_entry; GtkWidget *compress_label; GtkWidget *compress_entry; GtkWidget *secure_toggle; GtkWidget *help_label; GtkWidget *frame1; GtkWidget *table1; GtkWidget *server_label; GtkWidget *login_label; GtkWidget *pass_label; GtkWidget *address_entry; GtkWidget *login_entry; GtkWidget *password_entry; GtkWidget *button_connect; GtkWidget *button_cancel; GtkWidget *bookmarkmenu; GtkWidget *bookmarkmenu_menu; GtkWidget *hbuttonbox1; GtkWidget *save_button; struct connect_context *cc; gwin = window_create(ghtlc, WG_CONNECT); connect_window = gwin->widget; gtk_window_set_title(GTK_WINDOW(connect_window), "Connect"); gtk_window_set_position(GTK_WINDOW(connect_window), GTK_WIN_POS_CENTER); vbox1 = gtk_vbox_new(0, 10); gtk_container_add(GTK_CONTAINER(connect_window), vbox1); gtk_container_set_border_width(GTK_CONTAINER(vbox1), 10); help_label = gtk_label_new("Enter the server address, and if you have an account, your login and password. If not, leave the login and password blank."); gtk_box_pack_start(GTK_BOX(vbox1), help_label, 0, 1, 0); gtk_label_set_justify(GTK_LABEL(help_label), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap(GTK_LABEL(help_label), 1); gtk_misc_set_alignment(GTK_MISC(help_label), 0, 0.5); frame1 = gtk_frame_new(0); gtk_box_pack_start(GTK_BOX(vbox1), frame1, 1, 1, 0); gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_IN); table1 = gtk_table_new(4, 3, 0); gtk_container_add(GTK_CONTAINER(frame1), table1); gtk_container_set_border_width(GTK_CONTAINER(table1), 10); gtk_table_set_row_spacings(GTK_TABLE(table1), 5); gtk_table_set_col_spacings(GTK_TABLE(table1), 5); server_label = gtk_label_new("Server:"); gtk_table_attach(GTK_TABLE(table1), server_label, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)0, 0, 0); gtk_label_set_justify(GTK_LABEL(server_label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(server_label), 0, 0.5); login_label = gtk_label_new("Login:"******"Password:"******"Secure"); #ifdef CONFIG_HOPE gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(secure_toggle), 1); #else gtk_widget_set_sensitive(secure_toggle, 0); #endif cipher_label = gtk_label_new("Cipher:"); cipher_entry = gtk_entry_new(); #ifdef CONFIG_CIPHER gtk_entry_set_text(GTK_ENTRY(cipher_entry), ghtlc->htlc->cipheralg); #else gtk_widget_set_sensitive(cipher_entry, 0); #endif compress_label = gtk_label_new("Compress:"); compress_entry = gtk_entry_new(); #ifdef CONFIG_COMPRESS gtk_entry_set_text(GTK_ENTRY(compress_entry), ghtlc->htlc->compressalg); #else gtk_widget_set_sensitive(compress_entry, 0); #endif gtk_table_attach(GTK_TABLE(table1), secure_toggle, 0, 1, 3, 4, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 0, 0); hbox = gtk_hbox_new(0, 0); gtk_box_pack_start(GTK_BOX(hbox), cipher_label, 0, 0, 2); gtk_box_pack_start(GTK_BOX(hbox), cipher_entry, 0, 0, 2); gtk_table_attach(GTK_TABLE(table1), hbox, 1, 2, 3, 4, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 0, 0); hbox = gtk_hbox_new(0, 0); gtk_box_pack_start(GTK_BOX(hbox), compress_label, 0, 0, 2); gtk_box_pack_start(GTK_BOX(hbox), compress_entry, 0, 0, 2); gtk_table_attach(GTK_TABLE(table1), hbox, 1, 2, 4, 5, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 0, 0); cc = xmalloc(sizeof(struct connect_context)); cc->ghtlc = ghtlc; cc->connect_window = connect_window; cc->address_entry = address_entry; cc->login_entry = login_entry; cc->password_entry = password_entry; cc->cipher_entry = cipher_entry; cc->compress_entry = compress_entry; cc->secure_toggle = secure_toggle; bookmarkmenu = gtk_option_menu_new(); gtk_table_attach(GTK_TABLE(table1), bookmarkmenu, 2, 3, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 0, 0); bookmarkmenu_menu = gtk_menu_new(); list_bookmarks(bookmarkmenu_menu, cc); gtk_option_menu_set_menu(GTK_OPTION_MENU(bookmarkmenu), bookmarkmenu_menu); hbuttonbox1 = gtk_hbutton_box_new(); gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox1, 1, 1, 0); save_button = gtk_button_new_with_label("Save..."); gtk_container_add(GTK_CONTAINER(hbuttonbox1), save_button); GTK_WIDGET_SET_FLAGS(save_button, GTK_CAN_DEFAULT); gtk_signal_connect_object(GTK_OBJECT(save_button), "clicked", GTK_SIGNAL_FUNC(save_dialog), (gpointer)cc); button_cancel = gtk_button_new_with_label("Cancel"); gtk_signal_connect_object(GTK_OBJECT(button_cancel), "clicked", GTK_SIGNAL_FUNC(close_connect_window), (gpointer)cc); gtk_container_add(GTK_CONTAINER(hbuttonbox1), button_cancel); GTK_WIDGET_SET_FLAGS(button_cancel, GTK_CAN_DEFAULT); button_connect = gtk_button_new_with_label("Connect"); gtk_signal_connect_object(GTK_OBJECT(button_connect), "clicked", GTK_SIGNAL_FUNC(server_connect), (gpointer)cc); gtk_container_add(GTK_CONTAINER (hbuttonbox1), button_connect); GTK_WIDGET_SET_FLAGS(button_connect, GTK_CAN_DEFAULT); gtk_signal_connect_object(GTK_OBJECT(address_entry), "activate", GTK_SIGNAL_FUNC(server_connect), (gpointer)cc); gtk_signal_connect_object(GTK_OBJECT(login_entry), "activate", GTK_SIGNAL_FUNC(server_connect), (gpointer)cc); gtk_signal_connect_object(GTK_OBJECT(password_entry), "activate", GTK_SIGNAL_FUNC(server_connect), (gpointer)cc); gtk_widget_show_all(connect_window); return cc; }
static void widget_set_flags (GtkWidget *widget, int flags) { GTK_WIDGET_SET_FLAGS (widget, flags); }
void about_dialog (gpointer data) { GtkWidget * tempwid, * notebook, * box, * label, * view, * vscroll, * dialog; char *tempstr, *temp1str, *no_license_agreement, *str, buf[255], *share_dir; size_t len; FILE * fd; #if GTK_MAJOR_VERSION > 1 GtkTextBuffer * textbuf; GtkTextIter iter; gint textlen; #endif share_dir = gftp_get_share_dir (); no_license_agreement = g_strdup_printf (_("Cannot find the license agreement file COPYING. Please make sure it is in either %s or in %s"), BASE_CONF_DIR, share_dir); #if GTK_MAJOR_VERSION == 1 dialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog), _("About gFTP")); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5); gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE); #else dialog = gtk_dialog_new_with_buttons (_("About gFTP"), NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); #endif gtk_window_set_wmclass (GTK_WINDOW(dialog), "about", "gFTP"); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5); gtk_widget_realize (dialog); if (gftp_icon != NULL) { gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap, gftp_icon->bitmap); gdk_window_set_icon_name (dialog->window, gftp_version); } notebook = gtk_notebook_new (); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0); gtk_widget_show (notebook); box = gtk_vbox_new (TRUE, 5); gtk_container_border_width (GTK_CONTAINER (box), 10); gtk_widget_show (box); tempwid = toolbar_pixmap (dialog, "gftp-logo.xpm"); gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); tempstr = g_strdup_printf (_("%s\nCopyright (C) 1998-2007 Brian Masney <*****@*****.**>\nOfficial Homepage: http://www.gftp.org/\n"), gftp_version); str = _("Translated by"); if (strcmp (str, "Translated by") != 0) { tempstr = g_realloc (tempstr, (gulong) (strlen (tempstr) + strlen (str) + 1)); strcat (tempstr, str); } tempwid = gtk_label_new (tempstr); g_free (tempstr); gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); label = gtk_label_new (_("About")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, label); box = gtk_vbox_new (FALSE, 5); gtk_container_border_width (GTK_CONTAINER (box), 10); gtk_widget_show (box); tempwid = gtk_table_new (1, 2, FALSE); gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0); gtk_widget_show (tempwid); #if GTK_MAJOR_VERSION == 1 view = gtk_text_new (NULL, NULL); gtk_text_set_editable (GTK_TEXT (view), FALSE); gtk_text_set_word_wrap (GTK_TEXT (view), TRUE); gtk_table_attach (GTK_TABLE (tempwid), view, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); gtk_widget_show (view); vscroll = gtk_vscrollbar_new (GTK_TEXT (view)->vadj); gtk_table_attach (GTK_TABLE (tempwid), vscroll, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0); gtk_widget_show (vscroll); #else view = gtk_text_view_new (); gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); vscroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vscroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (vscroll), view); gtk_widget_show (view); gtk_table_attach (GTK_TABLE (tempwid), vscroll, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); gtk_widget_show (vscroll); textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); #endif label = gtk_label_new (_("License Agreement")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, label); #if GTK_MAJOR_VERSION == 1 tempwid = gtk_button_new_with_label (_(" Close ")); GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, FALSE, FALSE, 0); gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (dialog)); gtk_widget_grab_default (tempwid); gtk_widget_show (tempwid); #else g_signal_connect_swapped (GTK_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (dialog)); #endif tempstr = g_strconcat ("/usr/share/common-licenses/GPL", NULL); if (access (tempstr, F_OK) != 0) { g_free (tempstr); temp1str = g_strconcat (share_dir, "/COPYING", NULL); tempstr = gftp_expand_path (NULL, temp1str); g_free (temp1str); if (access (tempstr, F_OK) != 0) { g_free (tempstr); tempstr = gftp_expand_path (NULL, BASE_CONF_DIR "/COPYING"); if (access (tempstr, F_OK) != 0) { #if GTK_MAJOR_VERSION == 1 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, no_license_agreement, -1); #else textlen = gtk_text_buffer_get_char_count (textbuf); gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen); gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1); #endif gtk_widget_show (dialog); return; } } } if ((fd = fopen (tempstr, "r")) == NULL) { #if GTK_MAJOR_VERSION == 1 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, no_license_agreement, -1); #else textlen = gtk_text_buffer_get_char_count (textbuf); gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen); gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1); #endif gtk_widget_show (dialog); g_free (tempstr); return; } g_free (tempstr); memset (buf, 0, sizeof (buf)); while ((len = fread (buf, 1, sizeof (buf) - 1, fd))) { buf[len] = '\0'; #if GTK_MAJOR_VERSION == 1 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, buf, -1); #else textlen = gtk_text_buffer_get_char_count (textbuf); gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen); gtk_text_buffer_insert (textbuf, &iter, buf, -1); #endif } fclose (fd); gtk_widget_show (dialog); g_free (no_license_agreement); gftp_free_pixmap ("gftp-logo.xpm"); }
void create_error (HWND hwnd, LPCSTR dsn, LPCSTR text, LPCSTR errmsg) { GtkWidget *error, *dialog_vbox1, *hbox1, *pixmap1, *vbox1; GtkWidget *l_text, *l_error, *dialog_action_area1, *hbuttonbox1, *b_ok; GtkAccelGroup *accel_group; GdkPixmap *pixmap; GdkBitmap *mask; GtkStyle *style; guint b_ok_key; char msg[1024]; if (hwnd == NULL || !GTK_IS_WIDGET (hwnd)) return; accel_group = gtk_accel_group_new (); error = gtk_dialog_new (); if (dsn) sprintf (msg, "Error : %s", dsn); else sprintf (msg, "Error ..."); gtk_object_set_data (GTK_OBJECT (error), "error", error); gtk_window_set_title (GTK_WINDOW (error), msg); gtk_widget_set_size_request (error, 400, 150); gtk_window_set_position (GTK_WINDOW (error), GTK_WIN_POS_CENTER); gtk_window_set_modal (GTK_WINDOW (error), TRUE); gtk_window_set_default_size (GTK_WINDOW (error), 400, 150); gtk_window_set_type_hint (GTK_WINDOW (error), GDK_WINDOW_TYPE_HINT_DIALOG); #if GTK_CHECK_VERSION(2,0,0) gtk_widget_show (error); #endif dialog_vbox1 = GTK_DIALOG (error)->vbox; gtk_object_set_data (GTK_OBJECT (error), "dialog_vbox1", dialog_vbox1); gtk_widget_show (dialog_vbox1); hbox1 = gtk_hbox_new (FALSE, 6); gtk_widget_ref (hbox1); gtk_object_set_data_full (GTK_OBJECT (error), "hbox1", hbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox1), 6); #if GTK_CHECK_VERSION(2,0,0) style = gtk_widget_get_style (error); pixmap = gdk_pixmap_create_from_xpm_d (error->window, &mask, &style->bg[GTK_STATE_NORMAL], (gchar **) error_xpm); #else style = gtk_widget_get_style (GTK_WIDGET (hwnd)); pixmap = gdk_pixmap_create_from_xpm_d (GTK_WIDGET (hwnd)->window, &mask, &style->bg[GTK_STATE_NORMAL], (gchar **) error_xpm); #endif pixmap1 = gtk_pixmap_new (pixmap, mask); gtk_widget_ref (pixmap1); gtk_object_set_data_full (GTK_OBJECT (error), "pixmap1", pixmap1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (pixmap1); gtk_box_pack_start (GTK_BOX (hbox1), pixmap1, FALSE, FALSE, 0); vbox1 = gtk_vbox_new (TRUE, 0); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (error), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 0); l_text = gtk_label_new (""); gtk_label_parse_uline (GTK_LABEL (l_text), (text) ? text : ""); gtk_widget_ref (l_text); gtk_object_set_data_full (GTK_OBJECT (error), "l_text", l_text, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (l_text); gtk_box_pack_start (GTK_BOX (vbox1), l_text, FALSE, TRUE, 0); gtk_label_set_justify (GTK_LABEL (l_text), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap (GTK_LABEL (l_text), TRUE); l_error = gtk_label_new (""); gtk_label_parse_uline (GTK_LABEL (l_error), (errmsg) ? errmsg : ""); gtk_widget_ref (l_error); gtk_object_set_data_full (GTK_OBJECT (error), "l_error", l_error, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (l_error); gtk_box_pack_start (GTK_BOX (vbox1), l_error, FALSE, TRUE, 0); gtk_label_set_justify (GTK_LABEL (l_error), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap (GTK_LABEL (l_error), TRUE); dialog_action_area1 = GTK_DIALOG (error)->action_area; gtk_object_set_data (GTK_OBJECT (error), "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 (error), "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_ok = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_ref (b_ok); gtk_object_set_data_full (GTK_OBJECT (error), "b_ok", b_ok, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (b_ok); gtk_container_add (GTK_CONTAINER (hbuttonbox1), b_ok); gtk_dialog_add_action_widget (GTK_DIALOG (error), b_ok, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (b_ok, GTK_CAN_DEFAULT); /* Ok button events */ gtk_signal_connect (GTK_OBJECT (b_ok), "clicked", GTK_SIGNAL_FUNC (error_ok_clicked), error); /* Close window button events */ gtk_signal_connect (GTK_OBJECT (error), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); gtk_signal_connect (GTK_OBJECT (error), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_window_add_accel_group (GTK_WINDOW (error), accel_group); gtk_widget_show_all (error); gtk_main (); }
void greeter_session_init (void) { GtkWidget *w = NULL; GtkWidget *hbox = NULL; GtkWidget *main_vbox = NULL; GtkWidget *vbox = NULL; GtkWidget *cat_vbox = NULL; GtkWidget *radio; GtkWidget *dialog; GtkWidget *button; GList *tmp; static GtkTooltips *tooltips = NULL; GtkRequisition req; char *s; int num = 1; char *label; greeter_set_session (NULL); session_dialog = dialog = gtk_dialog_new (); if (tooltips == NULL) tooltips = gtk_tooltips_new (); gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); button = gtk_button_new_with_mnemonic (_("Change _Session")); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_widget_show (button); gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); main_vbox = gtk_vbox_new (FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 5); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_vbox, FALSE, FALSE, 0); cat_vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (main_vbox), cat_vbox, FALSE, FALSE, 0); s = g_strdup_printf ("<b>%s</b>", _("Sessions")); w = gtk_label_new (s); gtk_label_set_use_markup (GTK_LABEL (w), TRUE); g_free (s); gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (cat_vbox), w, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (cat_vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (" "), FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 6); /* we will pack this later depending on size */ if (mdm_config_get_bool (MDM_KEY_SHOW_LAST_SESSION)) { greeter_set_session (LAST_SESSION); radio = gtk_radio_button_new_with_mnemonic (session_group, _("_Last session")); g_object_set_data (G_OBJECT (radio), SESSION_NAME, LAST_SESSION); session_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)); gtk_tooltips_set_tip (tooltips, radio, _("Log in using the session that you have used " "last time you logged in"), NULL); gtk_box_pack_start (GTK_BOX (vbox), radio, FALSE, FALSE, 0); gtk_widget_show (radio); } mdm_session_list_init (); for (tmp = sessions; tmp != NULL; tmp = tmp->next) { MdmSession *session; char *file; file = (char *) tmp->data; session = g_hash_table_lookup (sessnames, file); if (num < 10 && (strcmp (file, MDM_SESSION_FAILSAFE_GNOME) != 0) && (strcmp (file, MDM_SESSION_FAILSAFE_XTERM) != 0)) label = g_strdup_printf ("_%d. %s", num, session->name); else label = g_strdup (session->name); num++; radio = gtk_radio_button_new_with_mnemonic (session_group, label); g_free (label); g_object_set_data_full (G_OBJECT (radio), SESSION_NAME, file, (GDestroyNotify) g_free); session_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)); gtk_box_pack_start (GTK_BOX (vbox), radio, FALSE, FALSE, 0); gtk_widget_show (radio); if (! ve_string_empty (session->comment)) gtk_tooltips_set_tip (tooltips, GTK_WIDGET (radio), session->comment, NULL); } gtk_widget_show_all (vbox); gtk_widget_size_request (vbox, &req); /* if too large */ if (req.height > 0.7 * mdm_wm_screen.height) { GtkWidget *sw = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (sw, req.width, 0.7 * mdm_wm_screen.height); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_NONE); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox); gtk_widget_show (sw); gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0); } else { gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); } }
bool wxScrolledWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { Init(); if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxWindow creation failed") ); return FALSE; } m_insertCallback = wxInsertChildInScrolledWindow; m_targetWindow = this; m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) ); scroll_class->scrollbar_spacing = 0; gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); m_hAdjust = gtk_range_get_adjustment( GTK_RANGE(scrolledWindow->hscrollbar) ); m_vAdjust = gtk_range_get_adjustment( GTK_RANGE(scrolledWindow->vscrollbar) ); m_wxwindow = gtk_pizza_new(); gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); GtkPizza *pizza = GTK_PIZZA(m_wxwindow); if (HasFlag(wxRAISED_BORDER)) { gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_OUT ); } else if (HasFlag(wxSUNKEN_BORDER)) { gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_IN ); } else if (HasFlag(wxSIMPLE_BORDER)) { gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_THIN ); } else { gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_NONE ); } GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); m_acceptsFocus = TRUE; // I _really_ don't want scrollbars in the beginning m_vAdjust->lower = 0.0; m_vAdjust->upper = 1.0; m_vAdjust->value = 0.0; m_vAdjust->step_increment = 1.0; m_vAdjust->page_increment = 2.0; gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); m_hAdjust->lower = 0.0; m_hAdjust->upper = 1.0; m_hAdjust->value = 0.0; m_hAdjust->step_increment = 1.0; m_hAdjust->page_increment = 2.0; gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); // Handlers for new scrollbar values GtkVConnectEvent(); GtkHConnectEvent(); // these handlers block mouse events to any window during scrolling such as // motion events and prevent GTK and wxWidgets from fighting over where the // slider should be gtk_signal_connect( GTK_OBJECT(scrolledWindow->vscrollbar), "button_press_event", (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); gtk_signal_connect( GTK_OBJECT(scrolledWindow->hscrollbar), "button_press_event", (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); gtk_signal_connect( GTK_OBJECT(scrolledWindow->vscrollbar), "button_release_event", (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); gtk_signal_connect( GTK_OBJECT(scrolledWindow->hscrollbar), "button_release_event", (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); gtk_widget_show( m_wxwindow ); if (m_parent) m_parent->DoAddChild( this ); m_focusWidget = m_wxwindow; PostCreation(); Show( TRUE ); return TRUE; }
void create_TextSourceDialog (void) { GtkWidget *TextSourceDialog; GtkWidget *dialog_vbox10; GtkWidget *table7; GtkWidget *label193; GtkWidget *TextSourceMenu; GtkWidget *menu17; GtkWidget *text_entry_dialog1; GtkWidget *timed_from_file1; GtkWidget *file_with_queued_dialog1; GtkWidget *label194; GtkWidget *hbox103; GtkWidget *TextFileEntry; GtkWidget *FileBrowseButton; GtkWidget *alignment27; GtkWidget *hbox104; GtkWidget *image33; GtkWidget *label195; GtkWidget *dialog_action_area9; GtkWidget *cancelbutton7; GtkWidget *okbutton9; TextSourceDialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(TextSourceDialog), _("Text Source")); gtk_window_set_modal(GTK_WINDOW(TextSourceDialog), TRUE); dialog_vbox10 = GTK_DIALOG(TextSourceDialog)->vbox; gtk_widget_show(dialog_vbox10); table7 = gtk_table_new(2, 2, FALSE); gtk_widget_show(table7); gtk_box_pack_start(GTK_BOX(dialog_vbox10), table7, TRUE, TRUE, 2); gtk_table_set_row_spacings(GTK_TABLE(table7), 9); gtk_table_set_col_spacings(GTK_TABLE(table7), 17); label193 = gtk_label_new(_("Text Source:")); gtk_widget_show(label193); gtk_table_attach(GTK_TABLE(table7), label193, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); gtk_misc_set_alignment(GTK_MISC(label193), 0, 0.5); TextSourceMenu = gtk_option_menu_new(); gtk_widget_show(TextSourceMenu); gtk_table_attach(GTK_TABLE(table7), TextSourceMenu, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); menu17 = gtk_menu_new(); text_entry_dialog1 = gtk_menu_item_new_with_mnemonic(_("Dialog with Text Entry")); gtk_widget_show(text_entry_dialog1); gtk_container_add(GTK_CONTAINER(menu17), text_entry_dialog1); timed_from_file1 = gtk_menu_item_new_with_mnemonic(_("File with Timing Info")); gtk_widget_show(timed_from_file1); gtk_container_add(GTK_CONTAINER(menu17), timed_from_file1); file_with_queued_dialog1 = gtk_menu_item_new_with_mnemonic(_("Dialog Using File")); gtk_widget_show(file_with_queued_dialog1); gtk_container_add(GTK_CONTAINER(menu17), file_with_queued_dialog1); gtk_option_menu_set_menu(GTK_OPTION_MENU(TextSourceMenu), menu17); label194 = gtk_label_new(_("File:")); gtk_widget_show(label194); gtk_table_attach(GTK_TABLE(table7), label194, 0, 1, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); gtk_misc_set_alignment(GTK_MISC(label194), 0, 0.5); hbox103 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox103); gtk_table_attach(GTK_TABLE(table7), hbox103, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_FILL), 0, 0); TextFileEntry = gtk_entry_new(); gtk_widget_show(TextFileEntry); gtk_box_pack_start(GTK_BOX(hbox103), TextFileEntry, TRUE, TRUE, 0); FileBrowseButton = gtk_button_new(); gtk_widget_show(FileBrowseButton); gtk_box_pack_start(GTK_BOX(hbox103), FileBrowseButton, FALSE, FALSE, 0); alignment27 = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_widget_show(alignment27); gtk_container_add(GTK_CONTAINER(FileBrowseButton), alignment27); hbox104 = gtk_hbox_new(FALSE, 2); gtk_widget_show(hbox104); gtk_container_add(GTK_CONTAINER(alignment27), hbox104); image33 = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON); gtk_widget_show(image33); gtk_box_pack_start(GTK_BOX(hbox104), image33, FALSE, FALSE, 0); label195 = gtk_label_new_with_mnemonic(_("Browse")); gtk_widget_show(label195); gtk_box_pack_start(GTK_BOX(hbox104), label195, FALSE, FALSE, 0); dialog_action_area9 = GTK_DIALOG(TextSourceDialog)->action_area; gtk_widget_show(dialog_action_area9); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area9), GTK_BUTTONBOX_END); cancelbutton7 = gtk_button_new_from_stock("gtk-cancel"); gtk_widget_show(cancelbutton7); gtk_dialog_add_action_widget(GTK_DIALOG(TextSourceDialog), cancelbutton7, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS(cancelbutton7, GTK_CAN_DEFAULT); okbutton9 = gtk_button_new_from_stock("gtk-ok"); gtk_widget_show(okbutton9); gtk_dialog_add_action_widget(GTK_DIALOG(TextSourceDialog), okbutton9, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS(okbutton9, GTK_CAN_DEFAULT); g_signal_connect((gpointer) TextSourceDialog, "response", G_CALLBACK(on_TextSourceDialog_response), NULL); g_signal_connect((gpointer) TextSourceMenu, "changed", G_CALLBACK(on_TextSourceMenu_changed), TextSourceDialog); g_signal_connect((gpointer) FileBrowseButton, "clicked", G_CALLBACK(on_FileBrowseButton_clicked), TextSourceDialog); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF(TextSourceDialog, TextSourceDialog, "TextSourceDialog"); GLADE_HOOKUP_OBJECT_NO_REF(TextSourceDialog, dialog_vbox10, "dialog_vbox10"); GLADE_HOOKUP_OBJECT(TextSourceDialog, table7, "table7"); GLADE_HOOKUP_OBJECT(TextSourceDialog, label193, "label193"); GLADE_HOOKUP_OBJECT(TextSourceDialog, TextSourceMenu, "TextSourceMenu"); GLADE_HOOKUP_OBJECT(TextSourceDialog, menu17, "menu17"); GLADE_HOOKUP_OBJECT(TextSourceDialog, text_entry_dialog1, "text_entry_dialog1"); GLADE_HOOKUP_OBJECT(TextSourceDialog, timed_from_file1, "timed_from_file1"); GLADE_HOOKUP_OBJECT(TextSourceDialog, file_with_queued_dialog1, "file_with_queued_dialog1"); GLADE_HOOKUP_OBJECT(TextSourceDialog, label194, "label194"); GLADE_HOOKUP_OBJECT(TextSourceDialog, hbox103, "hbox103"); GLADE_HOOKUP_OBJECT(TextSourceDialog, TextFileEntry, "TextFileEntry"); GLADE_HOOKUP_OBJECT(TextSourceDialog, FileBrowseButton, "FileBrowseButton"); GLADE_HOOKUP_OBJECT(TextSourceDialog, alignment27, "alignment27"); GLADE_HOOKUP_OBJECT(TextSourceDialog, hbox104, "hbox104"); GLADE_HOOKUP_OBJECT(TextSourceDialog, image33, "image33"); GLADE_HOOKUP_OBJECT(TextSourceDialog, label195, "label195"); GLADE_HOOKUP_OBJECT_NO_REF(TextSourceDialog, dialog_action_area9, "dialog_action_area9"); GLADE_HOOKUP_OBJECT(TextSourceDialog, cancelbutton7, "cancelbutton7"); GLADE_HOOKUP_OBJECT(TextSourceDialog, okbutton9, "okbutton9"); const char *type = MyConfig->GetStringValue(CONFIG_TEXT_SOURCE_TYPE); uint index = 0; if (strcmp(type, TEXT_SOURCE_TIMED_FILE) == 0) { index = 1; } else if (strcmp(type, TEXT_SOURCE_DIALOG) == 0) { index = 0; } else if (strcmp(type, TEXT_SOURCE_FILE_WITH_DIALOG) == 0) { index = 2; } gtk_option_menu_set_history(GTK_OPTION_MENU(TextSourceMenu), index); const char *file = MyConfig->GetStringValue(CONFIG_TEXT_SOURCE_FILE_NAME); if (file != NULL) { gtk_entry_set_text(GTK_ENTRY(TextFileEntry), file); } EnableFromTextMenu(TextSourceDialog, index); gtk_widget_show(TextSourceDialog); }
GtkWidget * create_SkinBrowser( void ) { GtkWidget * vbox5; GtkWidget * scrolledwindow1; GtkWidget * hbuttonbox4; GtkWidget * Cancel; GtkWidget * Ok; GtkAccelGroup * accel_group; accel_group = gtk_accel_group_new (); SkinBrowser=gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_widget_set_name( SkinBrowser,MSGTR_SkinBrowser ); gtk_object_set_data( GTK_OBJECT( SkinBrowser ),MSGTR_SkinBrowser,SkinBrowser ); gtk_widget_set_usize( SkinBrowser,256,320 ); gtk_container_set_border_width( GTK_CONTAINER( SkinBrowser ),1 ); GTK_WIDGET_SET_FLAGS( SkinBrowser,GTK_CAN_DEFAULT ); gtk_widget_set_events( SkinBrowser,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); gtk_window_set_title( GTK_WINDOW( SkinBrowser ),MSGTR_SkinBrowser ); gtk_window_set_position( GTK_WINDOW( SkinBrowser ),GTK_WIN_POS_CENTER ); gtk_window_set_policy( GTK_WINDOW( SkinBrowser ),FALSE,FALSE,TRUE ); gtk_window_set_wmclass( GTK_WINDOW( SkinBrowser ),"SkinBrowser","MPlayer" ); gtk_widget_realize( SkinBrowser ); gtkAddIcon( SkinBrowser ); vbox5=AddVBox( AddDialogFrame( SkinBrowser ),0 ); AddLabel( MSGTR_SKIN_LABEL,vbox5 ); AddHSeparator( vbox5 ); scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" ); gtk_widget_ref( scrolledwindow1 ); gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"scrolledwindow1",scrolledwindow1,(GtkDestroyNotify)gtk_widget_unref ); gtk_widget_show( scrolledwindow1 ); gtk_box_pack_start( GTK_BOX( vbox5 ),scrolledwindow1,TRUE,TRUE,0 ); gtk_container_set_border_width( GTK_CONTAINER( scrolledwindow1 ),2 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); SkinList=gtk_clist_new( 1 ); gtk_widget_set_name( SkinList,"SkinList" ); gtk_widget_ref( SkinList ); gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"SkinList",SkinList,(GtkDestroyNotify)gtk_widget_unref ); gtk_widget_show( SkinList ); gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),SkinList ); gtk_clist_set_column_width( GTK_CLIST( SkinList ),0,80 ); gtk_clist_set_selection_mode( GTK_CLIST( SkinList ),GTK_SELECTION_SINGLE ); gtk_clist_column_titles_hide( GTK_CLIST( SkinList ) ); gtk_clist_set_shadow_type( GTK_CLIST( SkinList ),GTK_SHADOW_ETCHED_OUT ); AddHSeparator( vbox5 ); hbuttonbox4=AddHButtonBox( vbox5 ); gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox4 ),GTK_BUTTONBOX_SPREAD ); gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox4 ),10 ); Ok=AddButton( MSGTR_Ok,hbuttonbox4 ); Cancel=AddButton( MSGTR_Cancel,hbuttonbox4 ); gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&SkinBrowser ); gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row",GTK_SIGNAL_FUNC( on_SkinList_select_row ),NULL ); gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 ); gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 ); if ( ( sbMPlayerDirInHome=calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL ) { strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); } if ( ( sbMPlayerPrefixDir=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL ) { strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); } gtk_window_add_accel_group( GTK_WINDOW( SkinBrowser ),accel_group ); gtk_widget_grab_focus( SkinList ); return SkinBrowser; }
gint delete_event (GtkWidget *widget, GdkEvent *event, GtkWidget *parent) { static GtkWidget *dialog_window = NULL; GtkWidget *label; GtkWidget *button; gint x, y; if (dialog_window == NULL) { gint flag = TRUE; dialog_window = gtk_dialog_new (); gtk_signal_connect (GTK_OBJECT (dialog_window), "delete_event", GTK_SIGNAL_FUNC (gtk_false), NULL); gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_window_set_title (GTK_WINDOW (dialog_window), "Exit Hello World"); gtk_container_set_border_width ( GTK_CONTAINER (dialog_window), 0); gtk_widget_set_usize (dialog_window, 250, 110); label = gtk_label_new ("真的要退出程序?"); gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog_window)->vbox), label, TRUE, TRUE, 0); gtk_widget_show (label); button = gtk_button_new_with_label ("确认"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_yes), &flag); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (dialog_window)); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area), button, TRUE, TRUE, 0); gtk_widget_grab_default (button); gtk_widget_show (button); button = gtk_button_new_with_label ("取消"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_no), &flag); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (dialog_window)); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area), button, TRUE, TRUE, 0); gtk_widget_show (button); //设置窗口锁定状态 gtk_window_set_modal (GTK_WINDOW(dialog_window), TRUE); //设置为临时窗口状态 gtk_window_set_transient_for(GTK_WINDOW (dialog_window), GTK_WINDOW (parent)); //取得根窗口的位置 gdk_window_get_root_origin (parent->window, &x, &y); //设置对话框窗口的位置 gtk_widget_set_uposition (dialog_window, x+40, y+40); gtk_widget_show (dialog_window); gtk_main (); dialog_window = NULL; return flag; } return TRUE; }
static void gth_empty_list_realize (GtkWidget *widget) { GthEmptyList *self; GdkWindowAttr attributes; int attributes_mask; g_return_if_fail (GTH_IS_EMPTY_LIST (widget)); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); /**/ attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; attributes_mask = (GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP); widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (widget->window, widget); /**/ self = (GthEmptyList*) widget; attributes.x = 0; attributes.y = 0; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | gtk_widget_get_events (widget)); self->priv->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask); gdk_window_set_user_data (self->priv->bin_window, widget); /* Style */ widget->style = gtk_style_attach (widget->style, widget->window); gdk_window_set_background (widget->window, &widget->style->base[widget->state]); gdk_window_set_background (self->priv->bin_window, &widget->style->base[widget->state]); /* 'No Image' message Layout */ if (self->priv->layout != NULL) g_object_unref (self->priv->layout); self->priv->layout = gtk_widget_create_pango_layout (widget, NULL); pango_layout_set_wrap (self->priv->layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_font_description (self->priv->layout, widget->style->font_desc); pango_layout_set_alignment (self->priv->layout, PANGO_ALIGN_CENTER); }
GtkWidget *create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *label1; GtkWidget *hscaleQual; GtkWidget *checkbuttonUV; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), _("Mjpeg Codec settings")); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); label1 = gtk_label_new (_("Quality")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); hscaleAdj=gtk_adjustment_new (0, 0, 100, 0, 0, 0); hscaleQual = gtk_hscale_new (GTK_ADJUSTMENT (hscaleAdj)); gtk_widget_show (hscaleQual); gtk_box_pack_start (GTK_BOX (vbox1), hscaleQual, FALSE, FALSE, 0); gtk_scale_set_digits (GTK_SCALE (hscaleQual), 0); checkbuttonUV = gtk_check_button_new_with_mnemonic (_("Swap U & V")); gtk_widget_show (checkbuttonUV); gtk_box_pack_start (GTK_BOX (vbox1), checkbuttonUV, FALSE, FALSE, 0); 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); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, 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, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (dialog1, label1, "label1"); GLADE_HOOKUP_OBJECT (dialog1, hscaleQual, "hscaleQual"); GLADE_HOOKUP_OBJECT (dialog1, checkbuttonUV, "checkbuttonUV"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }
static void curvewidgetgtk_realize( GtkWidget *widget) { GdkWindowAttr attr; gint attr_mask; CurveWidgetGtk *curve; g_return_if_fail (widget != NULL); g_return_if_fail (IS_CURVEWIDGETGTK( widget)); curve = CURVEWIDGETGTK( widget); GTK_WIDGET_SET_FLAGS( widget, GTK_REALIZED); attr.x = widget->allocation.x; attr.y = widget->allocation.y; attr.width = widget->allocation.width; attr.height = widget->allocation.height; attr.wclass = GDK_INPUT_OUTPUT; attr.window_type = GDK_WINDOW_CHILD; attr.event_mask = gtk_widget_get_events( widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK; attr.visual = gtk_widget_get_visual( widget); attr.colormap = gtk_widget_get_colormap( widget); attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new( widget->parent->window, &attr, attr_mask); widget->style = gtk_style_attach( widget->style, widget->window); gdk_window_set_user_data( widget->window, widget); gtk_style_set_background( widget->style, widget->window, GTK_STATE_ACTIVE); GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_FOCUS); if ( curve->is_navigator) { if ( !curve->curve_ctx) { CurveWidgetGtk *main_curve = (CurveWidgetGtk *) curve->main_curve_widget; if ( !main_curve->is_realized) { main_curve->realize_navigator = 1; main_curve->navigator_widget = widget; } else { curve->curve_ctx = main_curve->curve_ctx; curve->draw_ctx = main_curve->draw_ctx; ((GlowDrawGtk *)curve->draw_ctx)->init_nav( widget); } } } else { if ( !curve->curve_ctx) { curve->draw_ctx = new GlowDrawGtk( widget, &curve->curve_ctx, curve_init_proc, curve->client_data, glow_eCtxType_Curve); } if ( curve->realize_navigator) { CurveWidgetGtk *nav_curve = (CurveWidgetGtk *) curve->navigator_widget; nav_curve->curve_ctx = curve->curve_ctx; nav_curve->draw_ctx = curve->draw_ctx; ((GlowDrawGtk *)nav_curve->draw_ctx)->init_nav( (GtkWidget *)nav_curve); } } curve->is_realized = 1; }
void statistics_dialog (void) { GtkWidget *window; GtkWidget *main_vbox; GtkWidget *page; GtkWidget *hbox; GtkWidget *label; GtkWidget *button; int page_num = 0; server_stats_create (); collect_statistics (); window = dialog_create_modal_transient_window (_("Statistics"), TRUE, TRUE, G_CALLBACK(statistics_save_geometry)); statistics_restore_geometry(window); main_vbox = gtk_vbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 8); gtk_container_add (GTK_CONTAINER (window), main_vbox); label = gtk_label_new (_("Statistics")); gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 8); gtk_widget_show (label); stat_notebook = gtk_notebook_new (); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (stat_notebook), GTK_POS_TOP); gtk_notebook_set_tab_hborder (GTK_NOTEBOOK (stat_notebook), 4); gtk_box_pack_start (GTK_BOX (main_vbox), stat_notebook, TRUE, TRUE, 0); page = server_stats_page (); label = gtk_label_new (_(srv_label)); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (stat_notebook), page, label); page = archs_stats_page (); label = gtk_label_new (_(arch_label)); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (stat_notebook), page, label); #ifdef USE_GEOIP page = country_stats_page (); label = gtk_label_new (_(country_label)); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (stat_notebook), page, label); #endif page_num = config_get_int ("/" CONFIG_FILE "/Statistics/page"); gtk_notebook_set_page (GTK_NOTEBOOK (stat_notebook), page_num); gtk_widget_show (stat_notebook); /* Close Button */ hbox = gtk_hbox_new (FALSE, 8); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); button = gtk_button_new_with_label (_("Close")); gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_set_usize (button, 80, -1); g_signal_connect (button, "clicked", G_CALLBACK (grab_defaults), NULL); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_widget_grab_default (button); gtk_widget_show (button); gtk_widget_show (hbox); gtk_widget_show (main_vbox); gtk_widget_show (window); gtk_main (); unregister_window (window); server_stats_destroy (); }
void FLAC_XMMS__configure(void) { GtkWidget *title_frame, *title_tag_vbox, *title_tag_label; GtkWidget *replaygain_frame, *resolution_frame, *output_vbox, *resolution_normal_frame, *resolution_replaygain_frame; GtkWidget *replaygain_vbox, *resolution_hbox, *resolution_normal_vbox, *resolution_replaygain_vbox; GtkWidget *resolution_replaygain_noise_shaping_vbox; GtkWidget *resolution_replaygain_bps_out_vbox; GtkWidget *label, *hbox; GtkWidget *bbox, *ok, *cancel; GList *list; GtkWidget *streaming_vbox; GtkWidget *streaming_buf_frame, *streaming_buf_hbox; GtkWidget *streaming_size_box, *streaming_size_label, *streaming_size_spin; GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin; GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox; GtkWidget *streaming_proxy_port_label, *streaming_proxy_host_label; GtkWidget *streaming_save_frame, *streaming_save_vbox; GtkWidget *streaming_save_label, *streaming_save_browse; #ifdef FLAC_ICECAST GtkWidget *streaming_cast_frame, *streaming_cast_vbox; #endif char *temp; if (flac_configurewin != NULL) { gdk_window_raise(flac_configurewin->window); return; } flac_configurewin = gtk_window_new(GTK_WINDOW_DIALOG); gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &flac_configurewin); gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(configure_destroy), &flac_configurewin); gtk_window_set_title(GTK_WINDOW(flac_configurewin), _("Flac Configuration")); gtk_window_set_policy(GTK_WINDOW(flac_configurewin), FALSE, FALSE, FALSE); gtk_container_border_width(GTK_CONTAINER(flac_configurewin), 10); vbox = gtk_vbox_new(FALSE, 10); gtk_container_add(GTK_CONTAINER(flac_configurewin), vbox); notebook = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); /* Title config.. */ title_frame = gtk_frame_new(_("Tag Handling")); gtk_container_border_width(GTK_CONTAINER(title_frame), 5); title_tag_vbox = gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5); gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox); /* Convert Char Set */ convert_char_set = gtk_check_button_new_with_label(_("Convert Character Set")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(convert_char_set), flac_cfg.title.convert_char_set); gtk_signal_connect(GTK_OBJECT(convert_char_set), "clicked", convert_char_set_cb, NULL); gtk_box_pack_start(GTK_BOX(title_tag_vbox), convert_char_set, FALSE, FALSE, 0); /* Combo boxes... */ hbox = gtk_hbox_new(FALSE,4); gtk_container_add(GTK_CONTAINER(title_tag_vbox),hbox); label = gtk_label_new(_("Convert character set from :")); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0); fileCharacterSetEntry = gtk_combo_new(); gtk_box_pack_start(GTK_BOX(hbox),fileCharacterSetEntry,TRUE,TRUE,0); label = gtk_label_new (_("to :")); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0); userCharacterSetEntry = gtk_combo_new(); gtk_box_pack_start(GTK_BOX(hbox),userCharacterSetEntry,TRUE,TRUE,0); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),FALSE); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),FALSE); gtk_combo_set_value_in_list(GTK_COMBO(fileCharacterSetEntry),TRUE,FALSE); gtk_combo_set_value_in_list(GTK_COMBO(userCharacterSetEntry),TRUE,FALSE); list = Charset_Create_List(); gtk_combo_set_popdown_strings(GTK_COMBO(fileCharacterSetEntry),Charset_Create_List_UTF8_Only()); gtk_combo_set_popdown_strings(GTK_COMBO(userCharacterSetEntry),list); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.user_char_set)); gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE); gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set); /* Override Tagging Format */ title_tag_override = gtk_check_button_new_with_label(_("Override generic titles")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override), flac_cfg.title.tag_override); gtk_signal_connect(GTK_OBJECT(title_tag_override), "clicked", title_tag_override_cb, NULL); gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE, FALSE, 0); title_tag_box = gtk_hbox_new(FALSE, 5); gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override); gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE, FALSE, 0); title_tag_label = gtk_label_new(_("Title format:")); gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE, FALSE, 0); title_tag_entry = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(title_tag_entry), flac_cfg.title.tag_format); gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE, 0); title_desc = xmms_titlestring_descriptions("pafFetnygc", 2); gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override); gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, gtk_label_new(_("Title"))); /* Output config.. */ output_vbox = gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(output_vbox), 5); /* replaygain */ replaygain_frame = gtk_frame_new(_("ReplayGain")); gtk_container_border_width(GTK_CONTAINER(replaygain_frame), 5); gtk_box_pack_start(GTK_BOX(output_vbox), replaygain_frame, TRUE, TRUE, 0); replaygain_vbox = gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(replaygain_vbox), 5); gtk_container_add(GTK_CONTAINER(replaygain_frame), replaygain_vbox); replaygain_enable = gtk_check_button_new_with_label(_("Enable ReplayGain processing")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_enable), flac_cfg.output.replaygain.enable); gtk_signal_connect(GTK_OBJECT(replaygain_enable), "clicked", replaygain_enable_cb, NULL); gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_enable, FALSE, FALSE, 0); replaygain_album_mode = gtk_check_button_new_with_label(_("Album mode")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_album_mode), flac_cfg.output.replaygain.album_mode); gtk_signal_connect(GTK_OBJECT(replaygain_album_mode), "clicked", replaygain_album_mode_cb, NULL); gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_album_mode, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE,3); gtk_container_add(GTK_CONTAINER(replaygain_vbox),hbox); label = gtk_label_new(_("Preamp:")); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0); replaygain_preamp = gtk_adjustment_new(flac_cfg.output.replaygain.preamp, -24.0, +24.0, 1.0, 6.0, 0.0); gtk_signal_connect(GTK_OBJECT(replaygain_preamp), "value-changed", replaygain_preamp_cb, NULL); replaygain_preamp_hscale = gtk_hscale_new(GTK_ADJUSTMENT(replaygain_preamp)); gtk_scale_set_draw_value(GTK_SCALE(replaygain_preamp_hscale), FALSE); gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_hscale,TRUE,TRUE,0); replaygain_preamp_label = gtk_label_new(_("0 dB")); gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_label,FALSE,FALSE,0); gtk_adjustment_value_changed(GTK_ADJUSTMENT(replaygain_preamp)); replaygain_hard_limit = gtk_check_button_new_with_label(_("6dB hard limiting")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit), flac_cfg.output.replaygain.hard_limit); gtk_signal_connect(GTK_OBJECT(replaygain_hard_limit), "clicked", replaygain_hard_limit_cb, NULL); gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_hard_limit, FALSE, FALSE, 0); replaygain_enable_cb(replaygain_enable, NULL); /* resolution */ resolution_frame = gtk_frame_new(_("Resolution")); gtk_container_border_width(GTK_CONTAINER(resolution_frame), 5); gtk_box_pack_start(GTK_BOX(output_vbox), resolution_frame, TRUE, TRUE, 0); resolution_hbox = gtk_hbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(resolution_hbox), 5); gtk_container_add(GTK_CONTAINER(resolution_frame), resolution_hbox); resolution_normal_frame = gtk_frame_new(_("Without ReplayGain")); gtk_container_border_width(GTK_CONTAINER(resolution_normal_frame), 5); gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_normal_frame, TRUE, TRUE, 0); resolution_normal_vbox = gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(resolution_normal_vbox), 5); gtk_container_add(GTK_CONTAINER(resolution_normal_frame), resolution_normal_vbox); resolution_normal_dither_24_to_16 = gtk_check_button_new_with_label(_("Dither 24bps to 16bps")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16), flac_cfg.output.resolution.normal.dither_24_to_16); gtk_signal_connect(GTK_OBJECT(resolution_normal_dither_24_to_16), "clicked", resolution_normal_dither_24_to_16_cb, NULL); gtk_box_pack_start(GTK_BOX(resolution_normal_vbox), resolution_normal_dither_24_to_16, FALSE, FALSE, 0); resolution_replaygain_frame = gtk_frame_new(_("With ReplayGain")); gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_frame), 5); gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_replaygain_frame, TRUE, TRUE, 0); resolution_replaygain_vbox = gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_vbox), 5); gtk_container_add(GTK_CONTAINER(resolution_replaygain_frame), resolution_replaygain_vbox); resolution_replaygain_dither = gtk_check_button_new_with_label(_("Enable dithering")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither), flac_cfg.output.resolution.replaygain.dither); gtk_signal_connect(GTK_OBJECT(resolution_replaygain_dither), "clicked", resolution_replaygain_dither_cb, NULL); gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), resolution_replaygain_dither, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(hbox), 5); gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), hbox, TRUE, TRUE, 0); resolution_replaygain_noise_shaping_frame = gtk_frame_new(_("Noise shaping")); gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), 5); gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_noise_shaping_frame, TRUE, TRUE, 0); resolution_replaygain_noise_shaping_vbox = gtk_vbutton_box_new(); gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), 5); gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), resolution_replaygain_noise_shaping_vbox); resolution_replaygain_noise_shaping_radio_none = gtk_radio_button_new_with_label(NULL, _("none")); if(flac_cfg.output.resolution.replaygain.noise_shaping == 0) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none), TRUE); gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_none), "clicked", resolution_replaygain_noise_shaping_cb, NULL); gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_none); resolution_replaygain_noise_shaping_radio_low = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("low")); if(flac_cfg.output.resolution.replaygain.noise_shaping == 1) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low), TRUE); gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_low), "clicked", resolution_replaygain_noise_shaping_cb, NULL); gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_low); resolution_replaygain_noise_shaping_radio_medium = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("medium")); if(flac_cfg.output.resolution.replaygain.noise_shaping == 2) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium), TRUE); gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_medium), "clicked", resolution_replaygain_noise_shaping_cb, NULL); gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_medium); resolution_replaygain_noise_shaping_radio_high = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("high")); if(flac_cfg.output.resolution.replaygain.noise_shaping == 3) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high), TRUE); gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_high), "clicked", resolution_replaygain_noise_shaping_cb, NULL); gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_high); resolution_replaygain_bps_out_frame = gtk_frame_new(_("Dither to")); gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_frame), 5); gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_bps_out_frame, FALSE, FALSE, 0); resolution_replaygain_bps_out_vbox = gtk_vbutton_box_new(); gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), 0); gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_frame), resolution_replaygain_bps_out_vbox); resolution_replaygain_bps_out_radio_16bps = gtk_radio_button_new_with_label(NULL, _("16 bps")); if(flac_cfg.output.resolution.replaygain.bps_out == 16) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps), TRUE); gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_16bps), "clicked", resolution_replaygain_bps_out_cb, NULL); gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_16bps); resolution_replaygain_bps_out_radio_24bps = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_bps_out_radio_16bps), _("24 bps")); if(flac_cfg.output.resolution.replaygain.bps_out == 24) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps), TRUE); gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_24bps), "clicked", resolution_replaygain_bps_out_cb, NULL); gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_24bps); resolution_replaygain_dither_cb(resolution_replaygain_dither, NULL); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_vbox, gtk_label_new(_("Output"))); /* Streaming */ streaming_vbox = gtk_vbox_new(FALSE, 0); streaming_buf_frame = gtk_frame_new(_("Buffering:")); gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5); gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE, FALSE, 0); streaming_buf_hbox = gtk_hbox_new(TRUE, 5); gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5); gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox); streaming_size_box = gtk_hbox_new(FALSE, 5); /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */ gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box, TRUE, TRUE, 0); streaming_size_label = gtk_label_new(_("Buffer size (kb):")); gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, FALSE, FALSE, 0); streaming_size_adj = gtk_adjustment_new(flac_cfg.stream.http_buffer_size, 4, 4096, 4, 4, 4); streaming_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0); gtk_widget_set_usize(streaming_size_spin, 60, -1); gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin, FALSE, FALSE, 0); streaming_pre_box = gtk_hbox_new(FALSE, 5); /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */ gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box, TRUE, TRUE, 0); streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):")); gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, FALSE, FALSE, 0); streaming_pre_adj = gtk_adjustment_new(flac_cfg.stream.http_prebuffer, 0, 90, 1, 1, 1); streaming_pre_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0); gtk_widget_set_usize(streaming_pre_spin, 60, -1); gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin, FALSE, FALSE, 0); /* * Proxy config. */ streaming_proxy_frame = gtk_frame_new(_("Proxy:")); gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_frame), 5); gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_proxy_frame, FALSE, FALSE, 0); streaming_proxy_vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_vbox), 5); gtk_container_add(GTK_CONTAINER(streaming_proxy_frame), streaming_proxy_vbox); streaming_proxy_use = gtk_check_button_new_with_label(_("Use proxy")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_use), flac_cfg.stream.use_proxy); gtk_signal_connect(GTK_OBJECT(streaming_proxy_use), "clicked", GTK_SIGNAL_FUNC(proxy_use_cb), NULL); gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_use, FALSE, FALSE, 0); streaming_proxy_hbox = gtk_hbox_new(FALSE, 5); gtk_widget_set_sensitive(streaming_proxy_hbox, flac_cfg.stream.use_proxy); gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_hbox, FALSE, FALSE, 0); streaming_proxy_host_label = gtk_label_new(_("Host:")); gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_label, FALSE, FALSE, 0); streaming_proxy_host_entry = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry), flac_cfg.stream.proxy_host); gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_entry, TRUE, TRUE, 0); streaming_proxy_port_label = gtk_label_new(_("Port:")); gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_label, FALSE, FALSE, 0); streaming_proxy_port_entry = gtk_entry_new(); gtk_widget_set_usize(streaming_proxy_port_entry, 50, -1); temp = g_strdup_printf("%d", flac_cfg.stream.proxy_port); gtk_entry_set_text(GTK_ENTRY(streaming_proxy_port_entry), temp); g_free(temp); gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_entry, FALSE, FALSE, 0); streaming_proxy_auth_use = gtk_check_button_new_with_label(_("Use authentication")); gtk_widget_set_sensitive(streaming_proxy_auth_use, flac_cfg.stream.use_proxy); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use), flac_cfg.stream.proxy_use_auth); gtk_signal_connect(GTK_OBJECT(streaming_proxy_auth_use), "clicked", GTK_SIGNAL_FUNC(proxy_auth_use_cb), NULL); gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_use, FALSE, FALSE, 0); streaming_proxy_auth_hbox = gtk_hbox_new(FALSE, 5); gtk_widget_set_sensitive(streaming_proxy_auth_hbox, flac_cfg.stream.use_proxy && flac_cfg.stream.proxy_use_auth); gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_hbox, FALSE, FALSE, 0); streaming_proxy_auth_user_label = gtk_label_new(_("Username:"******"Password:"******"Save stream to disk:")); gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5); gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame, FALSE, FALSE, 0); streaming_save_vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5); gtk_container_add(GTK_CONTAINER(streaming_save_frame), streaming_save_vbox); streaming_save_use = gtk_check_button_new_with_label(_("Save stream to disk")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), flac_cfg.stream.save_http_stream); gtk_signal_connect(GTK_OBJECT(streaming_save_use), "clicked", GTK_SIGNAL_FUNC(streaming_save_use_cb), NULL); gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, FALSE, FALSE, 0); streaming_save_hbox = gtk_hbox_new(FALSE, 5); gtk_widget_set_sensitive(streaming_save_hbox, flac_cfg.stream.save_http_stream); gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, FALSE, FALSE, 0); streaming_save_label = gtk_label_new(_("Path:")); gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, FALSE, FALSE, 0); streaming_save_entry = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), flac_cfg.stream.save_http_path); gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, TRUE, TRUE, 0); streaming_save_browse = gtk_button_new_with_label(_("Browse")); gtk_signal_connect(GTK_OBJECT(streaming_save_browse), "clicked", GTK_SIGNAL_FUNC(streaming_save_browse_cb), NULL); gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse, FALSE, FALSE, 0); #ifdef FLAC_ICECAST streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:")); gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5); gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame, FALSE, FALSE, 0); streaming_cast_vbox = gtk_vbox_new(5, FALSE); gtk_container_add(GTK_CONTAINER(streaming_cast_frame), streaming_cast_vbox); streaming_cast_title = gtk_check_button_new_with_label(_("Enable SHOUT/Icecast title streaming")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_cast_title), flac_cfg.stream.cast_title_streaming); gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_cast_title, FALSE, FALSE, 0); streaming_udp_title = gtk_check_button_new_with_label(_("Enable Icecast Metadata UDP Channel")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), flac_cfg.stream.use_udp_channel); gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, FALSE, FALSE, 0); #endif gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox, gtk_label_new(_("Streaming"))); /* Buttons */ bbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); ok = gtk_button_new_with_label(_("Ok")); gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(flac_configurewin_ok), NULL); GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0); gtk_widget_grab_default(ok); cancel = gtk_button_new_with_label(_("Cancel")); gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(flac_configurewin)); GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); gtk_widget_show_all(flac_configurewin); }
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. */ if (pinentry->timeout > 0) g_timeout_add (pinentry->timeout*1000, timeout_cb, NULL); return win; }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *table1; GtkObject *spinbuttonQuality_adj; GtkWidget *spinbuttonQuality; GtkWidget *comboboxMode; GtkWidget *comboboxBitrate; GtkWidget *comboboxPreset; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *label4; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), _("Lame Encoder Settings")); gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); table1 = gtk_table_new (4, 2, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0); spinbuttonQuality_adj = gtk_adjustment_new (1, 0, 9, 1, 10, 10); spinbuttonQuality = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonQuality_adj), 1, 0); gtk_widget_show (spinbuttonQuality); gtk_table_attach (GTK_TABLE (table1), spinbuttonQuality, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); comboboxMode = gtk_combo_box_new_text (); gtk_widget_show (comboboxMode); gtk_table_attach (GTK_TABLE (table1), comboboxMode, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxMode), _("Mono")); gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxMode), _("Stereo")); gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxMode), _("Joint-Stereo")); comboboxBitrate = gtk_combo_box_new_text (); gtk_widget_show (comboboxBitrate); gtk_table_attach (GTK_TABLE (table1), comboboxBitrate, 1, 2, 1, 2, (GtkAttachOptions) (GTK_SHRINK | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); comboboxPreset = gtk_combo_box_new_text (); gtk_widget_show (comboboxPreset); gtk_table_attach (GTK_TABLE (table1), comboboxPreset, 1, 2, 2, 3, (GtkAttachOptions) (GTK_SHRINK | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); label1 = gtk_label_new (_("<b>Channel Mode:</b>")); gtk_widget_show (label1); gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); label2 = gtk_label_new (_("<b>Bitrate:</b>")); gtk_widget_show (label2); gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_use_markup (GTK_LABEL (label2), TRUE); gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5); label3 = gtk_label_new (_("<b>Mode:</b>")); gtk_widget_show (label3); gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_use_markup (GTK_LABEL (label3), TRUE); gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5); label4 = gtk_label_new (_("<b>Quality:</b>")); gtk_widget_show (label4); gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_use_markup (GTK_LABEL (label4), TRUE); gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); 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); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, 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, table1, "table1"); GLADE_HOOKUP_OBJECT (dialog1, spinbuttonQuality, "spinbuttonQuality"); GLADE_HOOKUP_OBJECT (dialog1, comboboxMode, "comboboxMode"); GLADE_HOOKUP_OBJECT (dialog1, comboboxBitrate, "comboboxBitrate"); GLADE_HOOKUP_OBJECT (dialog1, comboboxPreset, "comboboxPreset"); GLADE_HOOKUP_OBJECT (dialog1, label1, "label1"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT (dialog1, label3, "label3"); GLADE_HOOKUP_OBJECT (dialog1, label4, "label4"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }