static void activate(GtkApplication* app, gpointer user_data){ GtkWidget* window; GtkWidget* button_box; GtkWidget* button; GtkWidget* aggresive_label; window = gtk_application_window_new(app); gtk_window_set_title(GTK_WINDOW(window), "Hello!"); gtk_window_set_default_size(GTK_WINDOW(window), 400, 400); button_box = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); gtk_button_box_set_layout((GtkButtonBox*) button_box, GTK_BUTTONBOX_CENTER); gtk_container_add(GTK_CONTAINER(window), button_box); button = gtk_button_new_with_label("Don't push me, friend!"); aggresive_label = gtk_label_new("You pushed a wrong button!!!11one"); g_signal_connect(button, "clicked", G_CALLBACK(on_agro_button_press), &agro_button_state); gtk_container_add(GTK_CONTAINER(button_box), button); gtk_container_add(GTK_CONTAINER(button_box), aggresive_label); gtk_widget_show_all(window); gtk_widget_hide(aggresive_label); agro_button_state.button = button; agro_button_state.label = aggresive_label; agro_button_state.is_aggresive = 0; GdkWindow* win = gtk_widget_get_parent_window(button); GdkCursor* watchCursor = gdk_cursor_new(GDK_WATCH); gdk_window_set_cursor(win, watchCursor); }
ComparePreferencesDialog::ComparePreferencesDialog(int dummy) { comparepreferencesdialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (comparepreferencesdialog), _("Enter")); gtk_window_set_position (GTK_WINDOW (comparepreferencesdialog), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_modal (GTK_WINDOW (comparepreferencesdialog), TRUE); dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (comparepreferencesdialog)); gtk_widget_show (dialog_vbox1); checkbutton_disregard_notes = gtk_check_button_new_with_mnemonic (_("Disregard changes in notes")); gtk_widget_show (checkbutton_disregard_notes); gtk_box_pack_start (GTK_BOX (dialog_vbox1), checkbutton_disregard_notes, FALSE, FALSE, 0); dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(comparepreferencesdialog)); gtk_widget_show(dialog_action_area1); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); new InDialogHelp(comparepreferencesdialog, NULL, NULL, NULL); cancelbutton = gtk_button_new_from_stock("gtk-cancel"); gtk_widget_show(cancelbutton); gtk_dialog_add_action_widget(GTK_DIALOG(comparepreferencesdialog), cancelbutton, GTK_RESPONSE_CANCEL); gtk_widget_set_can_default (GTK_WIDGET (cancelbutton), true); okbutton = gtk_button_new_from_stock("gtk-ok"); gtk_widget_show(okbutton); gtk_dialog_add_action_widget(GTK_DIALOG(comparepreferencesdialog), okbutton, GTK_RESPONSE_OK); gtk_widget_set_can_default (GTK_WIDGET (okbutton), true); g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this)); gtk_widget_grab_focus(okbutton); gtk_widget_grab_default(okbutton); extern Settings * settings; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton_disregard_notes), settings->genconfig.compare_disregard_notes_get()); }
static GtkWidget * create_main_window (void) { GtkWidget *window; GtkWidget *box; GtkWidget *manager; GtkWidget *button_box; GtkWidget *button; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "delete-event", G_CALLBACK (gtk_main_quit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 6); gtk_window_set_title (GTK_WINDOW (window), "Peas Demo"); gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_add (GTK_CONTAINER (window), box); manager = peas_gtk_plugin_manager_new (peas_engine_get_default ()); gtk_box_pack_start (GTK_BOX (box), manager, TRUE, TRUE, 0); button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_set_spacing (GTK_BOX (button_box), 6); gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_END); gtk_box_pack_start (GTK_BOX (box), button_box, FALSE, FALSE, 0); button = gtk_button_new_with_label ("New window"); g_signal_connect (button, "clicked", G_CALLBACK (create_new_window), NULL); gtk_container_add (GTK_CONTAINER (button_box), button); button = gtk_button_new_from_stock (GTK_STOCK_QUIT); g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL); gtk_container_add (GTK_CONTAINER (button_box), button); return window; }
/* 用指定的参数创建一个按钮盒 */ GtkWidget *create_bbox( gint horizontal, char *title, gint spacing, gint child_w, gint child_h, gint layout ) { GtkWidget *frame; GtkWidget *bbox; GtkWidget *button; frame = gtk_frame_new (title); if (horizontal) bbox = gtk_hbutton_box_new (); else bbox = gtk_vbutton_box_new (); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_container_add (GTK_CONTAINER (frame), bbox); /* 设置按钮盒的外观 */ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout); gtk_box_set_spacing (GTK_BOX (bbox), spacing); /*gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);*/ button = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_container_add (GTK_CONTAINER (bbox), button); button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_container_add (GTK_CONTAINER (bbox), button); button = gtk_button_new_from_stock (GTK_STOCK_HELP); gtk_container_add (GTK_CONTAINER (bbox), button); return frame; }
/** \brief Create RESET button. * \param cfg Config data or NULL in global mode. * \param vbox The container. * * This function creates and sets up the view selector combos. */ static void create_reset_button (GtkBox *vbox) { GtkWidget *button; GtkWidget *butbox; GtkTooltips *tips; button = gtk_button_new_with_label (_("Reset")); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (reset_cb), NULL); tips = gtk_tooltips_new (); gtk_tooltips_set_tip (tips, button, _("Reset settings to the default values."), NULL); butbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (butbox), GTK_BUTTONBOX_END); gtk_box_pack_end (GTK_BOX (butbox), button, FALSE, TRUE, 10); gtk_box_pack_end (vbox, butbox, FALSE, TRUE, 0); }
/** * Initialize the buttons for the help window */ void initialize_buttons (GtkWidget *main_vbox, GtkWidget *content_hpane) { GtkWidget *buttons_hbuttonbox; GtkWidget *back_button; GtkWidget *forward_button; GtkWidget *home_button; GtkWidget *contents_button; // define and attach signals to buttons back_button = gtk_button_new_with_label(_("Back")); g_signal_connect(back_button, "clicked", G_CALLBACK(back_button_clicked), G_OBJECT(main_view)); forward_button = gtk_button_new_with_label(_("Forward")); g_signal_connect(forward_button, "clicked", G_CALLBACK(forward_button_clicked), G_OBJECT(main_view)); home_button = gtk_button_new_with_label(_("Home")); g_signal_connect(home_button, "clicked", G_CALLBACK(home_button_clicked), G_OBJECT(main_view)); contents_button = gtk_button_new_with_label(_("Contents")); g_signal_connect(contents_button, "clicked", G_CALLBACK(contents_button_clicked), G_OBJECT(content_hpane)); // button layout buttons_hbuttonbox = gtk_hbutton_box_new(); gtk_container_add(GTK_CONTAINER(buttons_hbuttonbox), back_button); gtk_container_add(GTK_CONTAINER(buttons_hbuttonbox), forward_button); gtk_container_add(GTK_CONTAINER(buttons_hbuttonbox), home_button); gtk_container_add(GTK_CONTAINER(buttons_hbuttonbox), contents_button); gtk_box_pack_start(GTK_BOX(main_vbox), buttons_hbuttonbox, FALSE, TRUE, 0); gtk_box_set_spacing(GTK_BOX(buttons_hbuttonbox), 6); gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons_hbuttonbox), GTK_BUTTONBOX_START); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT (main_view, back_button, BACKBUTTON); GLADE_HOOKUP_OBJECT (main_view, forward_button, FORWARDBUTTON); GLADE_HOOKUP_OBJECT (main_view, home_button, HOMEBUTTON); GLADE_HOOKUP_OBJECT (main_view, contents_button, CONTENTBUTTON); }
void plugingui_open (void) { GtkWidget *view; GtkWidget *vbox, *hbox; if (plugin_window) { mg_bring_tofront (plugin_window); return; } plugin_window = mg_create_generic_tab ("Addons", _(DISPLAY_NAME": Plugins and Scripts"), FALSE, TRUE, plugingui_close, NULL, 500, 250, &vbox, 0); gtkutil_destroy_on_esc (plugin_window); view = plugingui_treeview_new (vbox); g_object_set_data (G_OBJECT (plugin_window), "view", view); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtkutil_button (hbox, GTK_STOCK_REVERT_TO_SAVED, NULL, plugingui_loadbutton_cb, NULL, _("_Load...")); gtkutil_button (hbox, GTK_STOCK_DELETE, NULL, plugingui_unload, NULL, _("_UnLoad")); fe_pluginlist_update (); gtk_widget_show_all (plugin_window); }
static GtkWidget *create_window(GtkWidget *notebook) { GtkWidget *window; GtkWidget *vbox; GtkWidget *buttonbox; GtkWidget *button; GtkWidget *image; GSettings *settings; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), _("Bluetooth Preferences")); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(window), 600, 420); g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(delete_callback), NULL); g_signal_connect(G_OBJECT(window), "key-press-event", G_CALLBACK(keypress_callback), NULL); vbox = gtk_vbox_new(FALSE, 6); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); button = gtk_check_button_new_with_mnemonic (_("_Show Bluetooth icon")); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); settings = g_settings_new (SCHEMA_NAME); g_settings_bind (settings, PREF_SHOW_ICON, G_OBJECT (button), "active", G_SETTINGS_BIND_DEFAULT); buttonbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_END); gtk_box_pack_start(GTK_BOX(vbox), buttonbox, FALSE, FALSE, 0); button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); gtk_container_add(GTK_CONTAINER(buttonbox), button); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(close_callback), window); button = gtk_button_new_from_stock(GTK_STOCK_HELP); gtk_container_add(GTK_CONTAINER(buttonbox), button); gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox), button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(help_callback), window); image = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON); button = gtk_button_new_with_label (_("Receive Files")); gtk_button_set_image (GTK_BUTTON (button), image); gtk_container_add(GTK_CONTAINER(buttonbox), button); gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox), button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(receive_callback), window); gtk_widget_show_all(window); return window; }
BonoboControl * eab_vcard_control_new (void) { BonoboControl *control; BonoboPersistStream *stream; GtkWidget *display; GtkWidget *button1, *button2; GtkWidget *bbox; GtkWidget *vbox; EABVCardControl *vcard_control = g_new (EABVCardControl, 1); vcard_control->card_list = NULL; vcard_control->display = NULL; vcard_control->label = NULL; vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; /* Create the control. */ display = eab_contact_display_new (); vcard_control->display = EAB_CONTACT_DISPLAY (display); bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); gtk_box_set_spacing (GTK_BOX (bbox), 12); button1 = gtk_button_new_with_label(_("Show Full vCard")); g_signal_connect (button1, "clicked", G_CALLBACK (toggle_full_vcard), vcard_control); gtk_box_pack_start (GTK_BOX (bbox), button1, FALSE, FALSE, 0); button2 = gtk_button_new_with_label(_("Save in addressbook")); g_signal_connect (button2, "clicked", G_CALLBACK (save_in_addressbook), vcard_control); gtk_box_pack_start (GTK_BOX (bbox), button2, FALSE, FALSE, 0); /* This is intentionally not shown. */ vcard_control->label = gtk_label_new (""); vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), display, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), vcard_control->label, TRUE, TRUE, 0); gtk_widget_show_all (bbox); gtk_widget_show (display); gtk_widget_show (vbox); control = bonobo_control_new (vbox); g_object_weak_ref (G_OBJECT (control), free_struct, vcard_control); stream = bonobo_persist_stream_new (pstream_load, pstream_save, pstream_get_content_types, VCARD_CONTROL_ID, vcard_control); if (stream == NULL) { bonobo_object_unref (BONOBO_OBJECT (control)); return NULL; } bonobo_object_add_interface (BONOBO_OBJECT (control), BONOBO_OBJECT (stream)); return control; }
GtkWidget* create_shellexec_conf_dialog (void) { GtkWidget *shellexec_conf_dialog; GtkWidget *dialog_vbox; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *add_button; GtkWidget *remove_button; GtkWidget *edit_button; GtkWidget *scrolledwindow; GtkWidget *command_treeview; GtkWidget *dialog_action_area; GtkWidget *save_button; shellexec_conf_dialog = gtk_dialog_new (); gtk_container_set_border_width (GTK_CONTAINER (shellexec_conf_dialog), 12); gtk_window_set_title (GTK_WINDOW (shellexec_conf_dialog), _("Custom Shell Commands")); gtk_window_set_destroy_with_parent (GTK_WINDOW (shellexec_conf_dialog), TRUE); gtk_window_set_type_hint (GTK_WINDOW (shellexec_conf_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_dialog_set_has_separator (GTK_DIALOG (shellexec_conf_dialog), FALSE); dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (shellexec_conf_dialog)); gtk_widget_show (dialog_vbox); vbox1 = gtk_vbox_new (FALSE, 8); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox), vbox1, TRUE, TRUE, 0); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); add_button = gtk_button_new_with_mnemonic (_("Add")); gtk_widget_show (add_button); gtk_box_pack_start (GTK_BOX (hbox1), add_button, TRUE, TRUE, 0); remove_button = gtk_button_new_with_mnemonic (_("Remove")); gtk_widget_show (remove_button); gtk_box_pack_start (GTK_BOX (hbox1), remove_button, TRUE, TRUE, 0); edit_button = gtk_button_new_with_mnemonic (_("Edit")); gtk_widget_show (edit_button); gtk_box_pack_start (GTK_BOX (hbox1), edit_button, TRUE, TRUE, 0); scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow); gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN); command_treeview = gtk_tree_view_new (); gtk_widget_show (command_treeview); gtk_container_add (GTK_CONTAINER (scrolledwindow), command_treeview); dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (shellexec_conf_dialog)); gtk_widget_show (dialog_action_area); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area), GTK_BUTTONBOX_END); save_button = gtk_button_new_with_mnemonic (_("Close")); gtk_widget_show (save_button); gtk_dialog_add_action_widget (GTK_DIALOG (shellexec_conf_dialog), save_button, 0); gtk_widget_set_can_default(save_button, TRUE); g_signal_connect ((gpointer) shellexec_conf_dialog, "destroy", G_CALLBACK (on_shellexec_conf_dialog_destroy), NULL); g_signal_connect ((gpointer) add_button, "clicked", G_CALLBACK (on_add_button_clicked), NULL); g_signal_connect ((gpointer) remove_button, "clicked", G_CALLBACK (on_remove_button_clicked), NULL); g_signal_connect ((gpointer) edit_button, "clicked", G_CALLBACK (on_edit_button_clicked), NULL); g_signal_connect ((gpointer) save_button, "clicked", G_CALLBACK (on_save_button_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_dialog, shellexec_conf_dialog, "shellexec_conf_dialog"); GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_dialog, dialog_vbox, "dialog_vbox"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, add_button, "add_button"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, remove_button, "remove_button"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, edit_button, "edit_button"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, scrolledwindow, "scrolledwindow"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, command_treeview, "command_treeview"); GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_dialog, dialog_action_area, "dialog_action_area"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, save_button, "save_button"); return shellexec_conf_dialog; }
GtkWidget* create_shellexec_conf_edit_dialog (void) { GtkWidget *shellexec_conf_edit_dialog; GtkWidget *dialog_vbox1; GtkWidget *table1; GtkWidget *title_label; GtkWidget *cmd_label; GtkWidget *cmd_entry; GtkWidget *name_label; GtkWidget *title_entry; GtkWidget *name_entry; GtkWidget *single_check; GtkWidget *multiple_check; GtkWidget *local_check; GtkWidget *remote_check; GtkWidget *common_check; GtkWidget *label1; GtkWidget *dialog_action_area1; GtkWidget *edit_cancel_button; GtkWidget *edit_ok_button; shellexec_conf_edit_dialog = gtk_dialog_new (); gtk_container_set_border_width (GTK_CONTAINER (shellexec_conf_edit_dialog), 12); gtk_window_set_title (GTK_WINDOW (shellexec_conf_edit_dialog), _("Edit Command")); gtk_window_set_modal (GTK_WINDOW (shellexec_conf_edit_dialog), TRUE); gtk_window_set_type_hint (GTK_WINDOW (shellexec_conf_edit_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_dialog_set_has_separator (GTK_DIALOG (shellexec_conf_edit_dialog), FALSE); dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (shellexec_conf_edit_dialog)); gtk_widget_show (dialog_vbox1); table1 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table1), 8); gtk_table_set_col_spacings (GTK_TABLE (table1), 8); title_label = gtk_label_new (_("Title:")); gtk_widget_show (title_label); gtk_table_attach (GTK_TABLE (table1), title_label, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (title_label), 0, 0.5); cmd_label = gtk_label_new (_("Command:")); gtk_widget_show (cmd_label); gtk_table_attach (GTK_TABLE (table1), cmd_label, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (cmd_label), 0, 0.5); cmd_entry = gtk_entry_new (); gtk_widget_show (cmd_entry); gtk_table_attach (GTK_TABLE (table1), cmd_entry, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_tooltip_text (cmd_entry, _("Arbitrary shell command. Will be executed in the shell context which the main application was started from. Title formatting can be used. Example: xdg-open %D")); gtk_entry_set_invisible_char (GTK_ENTRY (cmd_entry), 8226); name_label = gtk_label_new (_("ID:")); gtk_widget_show (name_label); gtk_table_attach (GTK_TABLE (table1), name_label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (name_label), 0, 0.5); title_entry = gtk_entry_new (); gtk_widget_show (title_entry); gtk_table_attach (GTK_TABLE (table1), title_entry, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_tooltip_text (title_entry, _("Free-form name, for example \"My Shell Command\"")); gtk_entry_set_invisible_char (GTK_ENTRY (title_entry), 8226); name_entry = gtk_entry_new (); gtk_widget_show (name_entry); gtk_table_attach (GTK_TABLE (table1), name_entry, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_tooltip_text (name_entry, _("Command ID, normally it should be something short, for example \"youtube_open\". It must be unique.")); gtk_entry_set_invisible_char (GTK_ENTRY (name_entry), 8226); single_check = gtk_check_button_new_with_mnemonic (_("Single Tracks")); gtk_widget_show (single_check); gtk_box_pack_start (GTK_BOX (dialog_vbox1), single_check, FALSE, FALSE, 0); gtk_widget_set_tooltip_text (single_check, _("Works on single track.")); multiple_check = gtk_check_button_new_with_mnemonic (_("Multiple Tracks")); gtk_widget_show (multiple_check); gtk_box_pack_start (GTK_BOX (dialog_vbox1), multiple_check, FALSE, FALSE, 0); gtk_widget_set_tooltip_text (multiple_check, _("Works on multiple tracks.")); local_check = gtk_check_button_new_with_mnemonic (_("Local")); gtk_widget_show (local_check); gtk_box_pack_start (GTK_BOX (dialog_vbox1), local_check, FALSE, FALSE, 0); gtk_widget_set_tooltip_text (local_check, _("Works on local files.")); remote_check = gtk_check_button_new_with_mnemonic (_("Remote")); gtk_widget_show (remote_check); gtk_box_pack_start (GTK_BOX (dialog_vbox1), remote_check, FALSE, FALSE, 0); gtk_widget_set_tooltip_text (remote_check, _("Works on remote files (e.g. http:// streams)")); common_check = gtk_check_button_new_with_mnemonic (_("Generic (Main Menu)")); gtk_widget_show (common_check); gtk_box_pack_start (GTK_BOX (dialog_vbox1), common_check, FALSE, FALSE, 0); gtk_widget_set_tooltip_text (common_check, _("Item should appear in the main menu")); label1 = gtk_label_new (_("<small>If you want to add the command to main menu, make sure that title contains the menu path like this: \"File/My Command\", where File is the menu name in the English version.</small>")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), label1, FALSE, FALSE, 0); gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label1), TRUE); gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (shellexec_conf_edit_dialog)); gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); edit_cancel_button = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (edit_cancel_button); gtk_dialog_add_action_widget (GTK_DIALOG (shellexec_conf_edit_dialog), edit_cancel_button, GTK_RESPONSE_CANCEL); gtk_widget_set_can_default(edit_cancel_button, TRUE); edit_ok_button = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (edit_ok_button); gtk_dialog_add_action_widget (GTK_DIALOG (shellexec_conf_edit_dialog), edit_ok_button, GTK_RESPONSE_OK); gtk_widget_set_can_default(edit_ok_button, TRUE); g_signal_connect ((gpointer) edit_cancel_button, "clicked", G_CALLBACK (on_edit_cancel_button_clicked), NULL); g_signal_connect ((gpointer) edit_ok_button, "clicked", G_CALLBACK (on_edit_ok_button_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_edit_dialog, shellexec_conf_edit_dialog, "shellexec_conf_edit_dialog"); GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_edit_dialog, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, table1, "table1"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, title_label, "title_label"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, cmd_label, "cmd_label"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, cmd_entry, "cmd_entry"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, name_label, "name_label"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, title_entry, "title_entry"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, name_entry, "name_entry"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, single_check, "single_check"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, multiple_check, "multiple_check"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, local_check, "local_check"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, remote_check, "remote_check"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, common_check, "common_check"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, label1, "label1"); GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_edit_dialog, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, edit_cancel_button, "edit_cancel_button"); GLADE_HOOKUP_OBJECT (shellexec_conf_edit_dialog, edit_ok_button, "edit_ok_button"); return shellexec_conf_edit_dialog; }
static void create_window(struct catalog *catalog) { GtkWidget *window; GtkWidget *rootvbox; struct preferences_catalog *prefs_catalog; GtkWidget *catalog_widget; GtkWidget *notebook; GtkWidget *buttonbox; GtkWidget *close; GtkWidget *general_widget; GtkWidget *label; GtkWidget *stop; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Ocha Preferences"); rootvbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(rootvbox); gtk_container_add(GTK_CONTAINER(window), rootvbox); notebook = gtk_notebook_new(); gtk_widget_show (notebook); gtk_box_pack_start (GTK_BOX (rootvbox), notebook, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (notebook), 12); buttonbox = gtk_hbutton_box_new (); gtk_widget_show (buttonbox); gtk_box_pack_start (GTK_BOX (rootvbox), buttonbox, FALSE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (buttonbox), 12); gtk_button_box_set_layout (GTK_BUTTON_BOX (buttonbox), GTK_BUTTONBOX_END); close = gtk_button_new_from_stock(GTK_STOCK_CLOSE); gtk_widget_show (close); gtk_container_add (GTK_CONTAINER (buttonbox), close); GTK_WIDGET_SET_FLAGS (close, GTK_CAN_DEFAULT); /* notebook page : general */ general_widget = preferences_general_widget_new(); gtk_widget_show(general_widget); gtk_container_add(GTK_CONTAINER(notebook), general_widget); label = gtk_label_new ("General"); gtk_widget_show (label); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), label); /* notebook page : catalog */ prefs_catalog = preferences_catalog_new(catalog); catalog_widget = preferences_catalog_get_widget(prefs_catalog); gtk_widget_show(catalog_widget); gtk_container_add(GTK_CONTAINER(notebook), catalog_widget); label = gtk_label_new ("Catalog"); gtk_widget_show (label); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label); /* notebook page: stop */ stop = preferences_stop_create(); gtk_container_add(GTK_CONTAINER(notebook), stop); label = gtk_label_new ("Stop"); gtk_widget_show (label); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2), label); gtk_window_set_default_size(GTK_WINDOW(window), 250, 300); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL); g_signal_connect (G_OBJECT (close), "clicked", G_CALLBACK (destroy_cb), NULL); gtk_widget_show(window); }
/** * show_properties_dialog * * Description: * displays the properties dialog **/ void show_properties_dialog (void) { GtkWidget *notebook; GtkWidget *cpage; GtkWidget *gpage; GtkWidget *kpage; GtkWidget *label; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *typemenu; GtkWidget *pmapmenu; GtkWidget *chkbox; GtkWidget *table; GtkWidget *dbut; GtkWidget *frame; GtkWidget *w; GtkWidget *controls_list; if (propbox) return; propbox = gtk_dialog_new_with_buttons (_("Robots Preferences"), GTK_WINDOW (app), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_has_separator (GTK_DIALOG (propbox), FALSE); gtk_container_set_border_width (GTK_CONTAINER (propbox), 5); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (propbox)->vbox), 2); /* Set up notebook and add it to hbox of the gtk_dialog */ g_signal_connect (G_OBJECT (propbox), "destroy", G_CALLBACK (gtk_widget_destroyed), &propbox); notebook = gtk_notebook_new (); gtk_container_set_border_width (GTK_CONTAINER (notebook), 5); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (propbox)->vbox), notebook, TRUE, TRUE, 0); /* The configuration page */ cpage = gtk_vbox_new (FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (cpage), 12); frame = games_frame_new (_("Game Type")); gtk_box_pack_start (GTK_BOX (cpage), frame, FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); hbox = gtk_hbox_new (TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); typemenu = gtk_combo_box_new_text (); g_signal_connect (G_OBJECT (typemenu), "changed", G_CALLBACK (type_selection), NULL); fill_typemenu (typemenu); gtk_box_pack_start (GTK_BOX (hbox), typemenu, TRUE, TRUE, 0); frame = games_frame_new (_("Options")); gtk_box_pack_start (GTK_BOX (cpage), frame, FALSE, FALSE, 0); vbox = gtk_vbox_new (TRUE, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); chkbox = gtk_check_button_new_with_mnemonic (_("_Use safe moves")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox), properties.safe_moves); g_signal_connect (G_OBJECT (chkbox), "clicked", (GCallback) safe_cb, NULL); gtk_box_pack_start (GTK_BOX (vbox), chkbox, TRUE, TRUE, 0); gtk_widget_set_tooltip_text (chkbox, _("Prevent accidental moves that result in getting killed.")); chkbox = gtk_check_button_new_with_mnemonic (_("U_se super safe moves")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox), properties.super_safe_moves); g_signal_connect (G_OBJECT (chkbox), "clicked", (GCallback) super_safe_cb, NULL); gtk_box_pack_start (GTK_BOX (vbox), chkbox, TRUE, TRUE, 0); gtk_widget_set_tooltip_text (chkbox, _("Prevents all moves that result in getting killed.")); frame = games_frame_new (_("Sound")); gtk_box_pack_start (GTK_BOX (cpage), frame, FALSE, FALSE, 0); vbox = gtk_vbox_new (TRUE, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); chkbox = gtk_check_button_new_with_mnemonic (_("_Enable sounds")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox), properties.sound); g_signal_connect (G_OBJECT (chkbox), "clicked", (GCallback) sound_cb, NULL); gtk_box_pack_start (GTK_BOX (vbox), chkbox, TRUE, TRUE, 0); gtk_widget_set_tooltip_text (chkbox, _("Play sounds for events like winning a level and dying.")); label = gtk_label_new_with_mnemonic (_("Game")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), cpage, label); /* The graphics page */ gpage = gtk_vbox_new (FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (gpage), 12); frame = games_frame_new (_("Graphics Theme")); gtk_box_pack_start (GTK_BOX (gpage), frame, FALSE, FALSE, 0); table = gtk_table_new (2, 2, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_container_add (GTK_CONTAINER (frame), table); label = gtk_label_new_with_mnemonic (_("_Image theme:")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); pmapmenu = make_theme_menu (); g_signal_connect (G_OBJECT (pmapmenu), "changed", G_CALLBACK (pmap_selection), NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), pmapmenu); gtk_table_attach_defaults (GTK_TABLE (table), pmapmenu, 1, 2, 0, 1); label = gtk_label_new_with_mnemonic (_("_Background color:")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); w = gtk_color_button_new (); gtk_color_button_set_color (GTK_COLOR_BUTTON (w), &properties.bgcolour); g_signal_connect (G_OBJECT (w), "color_set", G_CALLBACK (bg_color_callback), NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), w); gtk_table_attach_defaults (GTK_TABLE (table), w, 1, 2, 1, 2); label = gtk_label_new_with_mnemonic (_("Appearance")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), gpage, label); /* The keyboard page */ kpage = gtk_vbox_new (FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (kpage), 12); frame = games_frame_new (_("Keyboard Controls")); gtk_box_pack_start (GTK_BOX (kpage), frame, TRUE, TRUE, 0); vbox = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); controls_list = games_controls_list_new (KEY_PREFERENCES_GROUP); games_controls_list_add_controls (GAMES_CONTROLS_LIST (controls_list), "key00", _("Key to move NW"), default_keys[0], "key01", _("Key to move N"), default_keys[1], "key02", _("Key to move NE"), default_keys[2], "key03", _("Key to move W"), default_keys[3], "key05", _("Key to move E"), default_keys[5], "key06", _("Key to move SW"), default_keys[6], "key07", _("Key to move S"), default_keys[7], "key08", _("Key to move SE"), default_keys[8], "key04", _("Key to hold"), default_keys[4], "key09", _("Key to teleport"), default_keys[9], "key10", _("Key to teleport randomly"), default_keys[10], "key11", _("Key to wait"), default_keys[11], NULL); gtk_box_pack_start (GTK_BOX (vbox), controls_list, TRUE, TRUE, 0); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_START); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); dbut = gtk_button_new_with_mnemonic (_("_Restore Defaults")); g_signal_connect (G_OBJECT (dbut), "clicked", G_CALLBACK (defkey_cb), (gpointer) default_keys); gtk_box_pack_start (GTK_BOX (hbox), dbut, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic (_("Keyboard")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), kpage, label); g_signal_connect (G_OBJECT (propbox), "delete_event", G_CALLBACK (delete_cb), NULL); g_signal_connect (G_OBJECT (propbox), "response", G_CALLBACK (apply_cb), NULL); gtk_window_set_modal (GTK_WINDOW (propbox), TRUE); gtk_widget_show_all (propbox); }
void create_configure_dialog(void) { GtkWidget *config_dialog; GtkWidget *main_widget; GtkWidget *cpu_hbox; GtkWidget *cpu_frame; GtkWidget *cpuframe_vbox; GtkWidget *cpuclock_hbox; GtkWidget *baseclock_combo; GtkWidget *rate_combo; GtkWidget *times_label; GtkWidget *realclock_label; GtkWidget *confirm_widget; GtkWidget *ok_button; GtkWidget *cancel_button; GtkWidget *arch_frame; GtkWidget *arch_hbox; GtkWidget *arch_radiobutton[NELEMENTS(architecture)]; GtkWidget *sound_frame; GtkWidget *soundframe_vbox; GtkWidget *soundrate_hbox; GtkWidget *rate_label; GtkWidget *rate_radiobutton[NELEMENTS(samplingrate)]; GtkWidget *soundbuffer_hbox; GtkWidget *buffer_label; GtkWidget *ms_label; gchar buf[8]; int i; uninstall_idle_process(); config_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(config_dialog), "Configure"); gtk_window_set_position(GTK_WINDOW(config_dialog), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(config_dialog), TRUE); gtk_window_set_resizable(GTK_WINDOW(config_dialog), FALSE); gtk_container_set_border_width(GTK_CONTAINER(config_dialog), 5); g_signal_connect(GTK_OBJECT(config_dialog), "destroy", G_CALLBACK(dialog_destroy), NULL); main_widget = gtk_vbox_new(FALSE, 0); gtk_widget_show(main_widget); gtk_container_add(GTK_CONTAINER(config_dialog), main_widget); /* CPU column */ cpu_hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show(cpu_hbox); gtk_box_pack_start(GTK_BOX(main_widget), cpu_hbox, TRUE, TRUE, 0); /* * CPU frame */ cpu_frame = gtk_frame_new("CPU"); gtk_widget_show(cpu_frame); gtk_box_pack_start(GTK_BOX(cpu_hbox), cpu_frame, TRUE, TRUE, 0); cpuframe_vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(cpuframe_vbox), 5); gtk_widget_show(cpuframe_vbox); gtk_container_add(GTK_CONTAINER(cpu_frame), cpuframe_vbox); /* cpu clock */ cpuclock_hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show(cpuclock_hbox); gtk_box_pack_start(GTK_BOX(cpuframe_vbox),cpuclock_hbox, TRUE, TRUE, 2); baseclock_combo = gtk_combo_box_entry_new_text(); gtk_widget_show(baseclock_combo); gtk_box_pack_start(GTK_BOX(cpuclock_hbox), baseclock_combo, TRUE, FALSE, 0); gtk_widget_set_size_request(baseclock_combo, 96, -1); for (i = 0; i < NELEMENTS(baseclock_str); i++) { gtk_combo_box_append_text(GTK_COMBO_BOX(baseclock_combo), baseclock_str[i]); } baseclock_entry = GTK_BIN(baseclock_combo)->child; gtk_widget_show(baseclock_entry); gtk_editable_set_editable(GTK_EDITABLE(baseclock_entry), FALSE); switch (np2cfg.baseclock) { default: np2cfg.baseclock = PCBASECLOCK25; sysmng_update(SYS_UPDATECFG|SYS_UPDATECLOCK); /*FALLTHROUGH*/ case PCBASECLOCK25: gtk_entry_set_text(GTK_ENTRY(baseclock_entry),baseclock_str[1]); break; case PCBASECLOCK20: gtk_entry_set_text(GTK_ENTRY(baseclock_entry),baseclock_str[0]); break; } times_label = gtk_label_new("x"); gtk_widget_show(times_label); gtk_box_pack_start(GTK_BOX(cpuclock_hbox), times_label, TRUE, FALSE, 0); gtk_misc_set_padding(GTK_MISC(times_label), 5, 0); rate_combo = gtk_combo_box_entry_new_text(); gtk_widget_show(rate_combo); gtk_box_pack_start(GTK_BOX(cpuclock_hbox), rate_combo, TRUE, FALSE, 0); gtk_widget_set_size_request(rate_combo, 48, -1); for (i = 0; i < NELEMENTS(clockmult_str); i++) { gtk_combo_box_append_text(GTK_COMBO_BOX(rate_combo), clockmult_str[i]); } clockmult_entry = GTK_BIN(rate_combo)->child; gtk_widget_show(clockmult_entry); gtk_editable_set_editable(GTK_EDITABLE(clockmult_entry), FALSE); switch (np2cfg.multiple) { case 1: case 2: case 4: case 5: case 6: case 8: case 10: case 12: case 16: case 20: g_snprintf(buf, sizeof(buf), "%d", np2cfg.multiple); gtk_entry_set_text(GTK_ENTRY(clockmult_entry), buf); break; default: gtk_entry_set_text(GTK_ENTRY(clockmult_entry), "4"); break; } /* calculated cpu clock */ realclock_label = gtk_label_new("MHz"); gtk_widget_show(realclock_label); gtk_box_pack_start(GTK_BOX(cpuframe_vbox), realclock_label, FALSE, FALSE, 2); gtk_misc_set_alignment(GTK_MISC(realclock_label), 1.0, 0.5); g_signal_connect(GTK_OBJECT(baseclock_entry), "changed", G_CALLBACK(clock_changed), (gpointer)realclock_label); g_signal_connect(GTK_OBJECT(clockmult_entry), "changed", G_CALLBACK(clock_changed), (gpointer)realclock_label); clock_changed(NULL, realclock_label); /* OK, Cancel button base widget */ confirm_widget = gtk_vbutton_box_new(); gtk_widget_show(confirm_widget); gtk_box_pack_start(GTK_BOX(cpu_hbox), confirm_widget, TRUE, TRUE, 0); gtk_button_box_set_layout(GTK_BUTTON_BOX(confirm_widget), GTK_BUTTONBOX_END); //gtk_button_box_set_spacing(GTK_BUTTON_BOX(confirm_widget), 0); /* * Architecture frame */ arch_frame = gtk_frame_new("Architecture"); gtk_widget_show(arch_frame); gtk_box_pack_start(GTK_BOX(main_widget), arch_frame, TRUE, TRUE, 0); /* architecture */ arch_hbox = gtk_hbox_new(TRUE, 0); gtk_widget_show(arch_hbox); gtk_container_add(GTK_CONTAINER(arch_frame), arch_hbox); for (i = 0; i < NELEMENTS(architecture); i++) { arch_radiobutton[i] = gtk_radio_button_new_with_label_from_widget(i > 0 ? GTK_RADIO_BUTTON(arch_radiobutton[i-1]) : NULL, architecture[i].label); gtk_widget_show(arch_radiobutton[i]); gtk_box_pack_start(GTK_BOX(arch_hbox), arch_radiobutton[i], FALSE, FALSE, 0); #if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18) gtk_widget_set_can_focus(arch_radiobutton[i], FALSE); #else GTK_WIDGET_UNSET_FLAGS(rate_radiobutton[i], GTK_CAN_FOCUS); #endif g_signal_connect(GTK_OBJECT(arch_radiobutton[i]), "clicked", G_CALLBACK(arch_radiobutton_clicked), (gpointer)architecture[i].arch); } for (i = 0; i < NELEMENTS(architecture); i++) { if (strcmp(np2cfg.model, architecture[i].arch) == 0) { break; } } if (i == NELEMENTS(architecture)) { i = 1; milstr_ncpy(np2cfg.model, "VX", sizeof(np2cfg.model)); sysmng_update(SYS_UPDATECFG); } g_signal_emit_by_name(GTK_OBJECT(arch_radiobutton[i]), "clicked"); /* * Sound frame */ sound_frame = gtk_frame_new("Sound"); gtk_widget_show(sound_frame); gtk_box_pack_start(GTK_BOX(main_widget), sound_frame, TRUE, TRUE, 0); soundframe_vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(soundframe_vbox), 5); gtk_widget_show(soundframe_vbox); gtk_container_add(GTK_CONTAINER(sound_frame), soundframe_vbox); /* sampling rate */ soundrate_hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show(soundrate_hbox); gtk_box_pack_start(GTK_BOX(soundframe_vbox), soundrate_hbox, TRUE, TRUE, 2); rate_label = gtk_label_new("Sampling Rate"); gtk_widget_show(rate_label); gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_label, FALSE, TRUE, 3); gtk_widget_set_size_request(rate_label, 96, -1); for (i = 0; i < NELEMENTS(samplingrate); i++) { rate_radiobutton[i] = gtk_radio_button_new_with_label_from_widget((i > 0) ? GTK_RADIO_BUTTON(rate_radiobutton[i-1]) : NULL, samplingrate[i].label); gtk_widget_show(rate_radiobutton[i]); gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_radiobutton[i], FALSE, FALSE, 0); #if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18) gtk_widget_set_can_focus(rate_radiobutton[i], FALSE); #else GTK_WIDGET_UNSET_FLAGS(rate_radiobutton[i], GTK_CAN_FOCUS); #endif g_signal_connect(GTK_OBJECT(rate_radiobutton[i]), "clicked", G_CALLBACK(rate_radiobutton_clicked), GINT_TO_POINTER(samplingrate[i].rate)); } if (np2cfg.samplingrate == 11025) { i = 0; } else if (np2cfg.samplingrate == 22050) { i = 1; } else if (np2cfg.samplingrate == 44100) { i = 2; } else { i = 1; np2cfg.samplingrate = 22050; sysmng_update(SYS_UPDATECFG|SYS_UPDATERATE); } g_signal_emit_by_name(GTK_OBJECT(rate_radiobutton[i]), "clicked"); soundbuffer_hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show(soundbuffer_hbox); gtk_box_pack_start(GTK_BOX(soundframe_vbox), soundbuffer_hbox, TRUE, TRUE, 2); /* buffer size */ buffer_label = gtk_label_new("Buffer"); gtk_widget_show(buffer_label); gtk_box_pack_start(GTK_BOX(soundbuffer_hbox), buffer_label, FALSE, FALSE, 0); gtk_widget_set_size_request(buffer_label, 96, -1); buffer_entry = gtk_entry_new(); gtk_widget_show(buffer_entry); gtk_box_pack_start(GTK_BOX(soundbuffer_hbox), buffer_entry, FALSE, FALSE, 0); gtk_widget_set_size_request(buffer_entry, 48, -1); if (np2cfg.delayms >= 20 && np2cfg.delayms <= 1000) { g_snprintf(buf, sizeof(buf), "%d", np2cfg.delayms); gtk_entry_set_text(GTK_ENTRY(buffer_entry), buf); } else { gtk_entry_set_text(GTK_ENTRY(buffer_entry), "500"); np2cfg.delayms = 500; sysmng_update(SYS_UPDATECFG|SYS_UPDATESBUF); soundrenewal = 1; } ms_label = gtk_label_new(" ms"); gtk_widget_show(ms_label); gtk_box_pack_start(GTK_BOX(soundbuffer_hbox),ms_label, FALSE, FALSE, 0); #if defined(SUPPORT_RESUME) /* resume */ resume_checkbutton = gtk_check_button_new_with_label("Resume"); gtk_widget_show(resume_checkbutton); gtk_box_pack_start(GTK_BOX(main_widget), resume_checkbutton, FALSE, FALSE, 1); if (np2oscfg.resume) { g_signal_emit_by_name(GTK_OBJECT(resume_checkbutton), "clicked"); } #endif #if defined(GCC_CPU_ARCH_IA32) /* Disable MMX */ disablemmx_checkbutton = gtk_check_button_new_with_label("Disable MMX"); gtk_widget_show(disablemmx_checkbutton); gtk_box_pack_start(GTK_BOX(main_widget), disablemmx_checkbutton, FALSE, FALSE, 1); if (mmxflag & MMXFLAG_NOTSUPPORT) { gtk_widget_set_sensitive(disablemmx_checkbutton, FALSE); } else if (mmxflag & MMXFLAG_DISABLE) { g_signal_emit_by_name(GTK_OBJECT(disablemmx_checkbutton), "clicked"); } #endif /* * OK, Cancel button */ ok_button = gtk_button_new_from_stock(GTK_STOCK_OK); gtk_widget_show(ok_button); gtk_container_add(GTK_CONTAINER(confirm_widget), ok_button); #if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18) gtk_widget_set_can_default(ok_button, TRUE); gtk_widget_has_default(ok_button); #else GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); GTK_WIDGET_SET_FLAGS(ok_button, GTK_HAS_DEFAULT); #endif g_signal_connect(GTK_OBJECT(ok_button), "clicked", G_CALLBACK(ok_button_clicked), (gpointer)config_dialog); gtk_widget_grab_default(ok_button); cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); gtk_widget_show(cancel_button); gtk_container_add(GTK_CONTAINER(confirm_widget), cancel_button); #if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18) gtk_widget_set_can_default(cancel_button, TRUE); #else GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); #endif g_signal_connect_swapped(GTK_OBJECT(cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(config_dialog)); gtk_widget_show_all(config_dialog); }
static GtkWidget * balsa_vevent_widget(LibBalsaVEvent * event, gboolean may_reply, InternetAddress * sender) { GtkGrid *grid; int row = 0; LibBalsaIdentity *vevent_ident = NULL; grid = GTK_GRID(gtk_grid_new()); gtk_grid_set_row_spacing(grid, 6); gtk_grid_set_column_spacing(grid, 12); GRID_ATTACH(grid, event->summary, _("Summary:")); GRID_ATTACH_ADDRESS(grid, event->organizer, _("Organizer:")); GRID_ATTACH_DATE(grid, event->start, _("Start:")); GRID_ATTACH_DATE(grid, event->end, _("End:")); GRID_ATTACH(grid, event->location, _("Location:")); if (event->attendee) { GList *att; GString *all_atts = NULL; for (att = event->attendee; att; att = att->next) { LibBalsaAddress *lba = LIBBALSA_ADDRESS(att->data); gchar *this_att = libbalsa_vcal_attendee_to_str(lba); if (all_atts) g_string_append_printf(all_atts, "\n%s", this_att); else all_atts = g_string_new(this_att); g_free(this_att); if (may_reply && libbalsa_vcal_attendee_rsvp(lba)) { InternetAddress *ia = internet_address_mailbox_new(NULL, lba->address_list->data); GList *list; for (list = balsa_app.identities; list; list = list->next) { LibBalsaIdentity *ident = list->data; if (libbalsa_ia_rfc2821_equal(ident->ia, ia)) { vevent_ident = ident; break; } } g_object_unref(ia); } } GRID_ATTACH(grid, all_atts->str, ngettext("Attendee:", "Attendees:", g_list_length(event->attendee))); g_string_free(all_atts, TRUE); } GRID_ATTACH_TEXT(grid, event->description, _("Description:")); if (sender && vevent_ident) { GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); GtkWidget *label; GtkWidget *bbox; GtkWidget *button; /* add the callback data to the event object */ g_object_ref(event); g_object_ref(sender); g_object_set_data_full(G_OBJECT(event), "ev:sender", internet_address_to_string(sender, FALSE), (GDestroyNotify) g_free); g_object_set_data_full(G_OBJECT(event), "ev:ident", g_object_ref(vevent_ident), (GDestroyNotify) g_object_unref); /* pack everything into a box */ gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(grid)); label = gtk_label_new(_("The sender asks you for a reply to this request:")); gtk_container_add(GTK_CONTAINER(box), label); bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD); gtk_container_add(GTK_CONTAINER(box), bbox); button = gtk_button_new_with_label(_("Accept")); g_object_set_data_full(G_OBJECT(button), "event", event, (GDestroyNotify) g_object_unref); g_object_set_data(G_OBJECT(button), "mode", GINT_TO_POINTER(VCAL_PSTAT_ACCEPTED)); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(vevent_reply), bbox); gtk_container_add(GTK_CONTAINER(bbox), button); button = gtk_button_new_with_label(_("Accept tentatively")); g_object_set_data(G_OBJECT(button), "event", event); g_object_set_data(G_OBJECT(button), "mode", GINT_TO_POINTER(VCAL_PSTAT_TENTATIVE)); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(vevent_reply), bbox); gtk_container_add(GTK_CONTAINER(bbox), button); button = gtk_button_new_with_label(_("Decline")); g_object_set_data(G_OBJECT(button), "event", event); g_object_set_data(G_OBJECT(button), "mode", GINT_TO_POINTER(VCAL_PSTAT_DECLINED)); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(vevent_reply), bbox); gtk_container_add(GTK_CONTAINER(bbox), button); return box; } else return GTK_WIDGET(grid); }
GtkWidget* create_threshold_dialog (void) { GtkWidget *threshold_dialog; GtkWidget *dialogVbox; GtkWidget *allButButtonsVbox; GtkWidget *settingsOuterHbox; GtkWidget *settingsOuterVbox; GtkWidget *minValueVbox; GtkWidget *minValueLabel; GtkWidget *minValueHbox; GtkWidget *minValueSlider; GtkObject *minValueSpinner_adj; GtkWidget *minValueSpinner; GtkWidget *maxValueVbox; GtkWidget *maxValueLabel; GtkWidget *maxValueHbox; GtkWidget *maxValueSlider; GtkObject *maxValueSpinner_adj; GtkWidget *maxValueSpinner; GtkWidget *outputValuesHbox; GtkWidget *outputValuesLabel; GtkWidget *outputValuesMenu; GtkWidget *debugHbox; GtkWidget *debugLabel; GtkObject *debugSpinButton_adj; GtkWidget *debugSpinButton; GtkWidget *previewFrame; GtkWidget *previewAlignment; GtkWidget *previewVbox; GtkWidget *previewControlHbox; GtkWidget *previewOutputMenu; GtkWidget *previewSlider; GtkWidget *previewVideo; GtkWidget *previewLabel; GtkWidget *dialogButtonBox; GtkWidget *cancelButton; GtkWidget *okButton; threshold_dialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (threshold_dialog), QT_TR_NOOP("Threshold")); gtk_window_set_type_hint (GTK_WINDOW (threshold_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); dialogVbox = GTK_DIALOG (threshold_dialog)->vbox; gtk_widget_show (dialogVbox); allButButtonsVbox = gtk_vbox_new (FALSE, 12); gtk_widget_show (allButButtonsVbox); gtk_box_pack_start (GTK_BOX (dialogVbox), allButButtonsVbox, TRUE, TRUE, 0); settingsOuterHbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (settingsOuterHbox); gtk_box_pack_start (GTK_BOX (allButButtonsVbox), settingsOuterHbox, FALSE, TRUE, 0); settingsOuterVbox = gtk_vbox_new (FALSE, 12); gtk_widget_show (settingsOuterVbox); gtk_box_pack_start (GTK_BOX (settingsOuterHbox), settingsOuterVbox, TRUE, TRUE, 0); minValueVbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (minValueVbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), minValueVbox, FALSE, FALSE, 0); minValueLabel = gtk_label_new (QT_TR_NOOP("Minimum value to be in-range:")); gtk_widget_show (minValueLabel); gtk_box_pack_start (GTK_BOX (minValueVbox), minValueLabel, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (minValueLabel), 0.5, 1); gtk_misc_set_padding (GTK_MISC (minValueLabel), 0, 8); minValueHbox = gtk_hbox_new (FALSE, 5); gtk_widget_show (minValueHbox); gtk_box_pack_start (GTK_BOX (minValueVbox), minValueHbox, TRUE, TRUE, 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 255, 1, 1, 0))); #else minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 1, 0); minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (minValueSpinner_adj)); #endif gtk_widget_show (minValueSlider); gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSlider, TRUE, TRUE, 0); gtk_scale_set_draw_value (GTK_SCALE (minValueSlider), FALSE); gtk_scale_set_value_pos (GTK_SCALE (minValueSlider), GTK_POS_LEFT); gtk_scale_set_digits (GTK_SCALE (minValueSlider), 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 10, 10); #endif minValueSpinner = gtk_spin_button_new (GTK_ADJUSTMENT (minValueSpinner_adj), 1, 0); gtk_widget_show (minValueSpinner); gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSpinner, FALSE, TRUE, 0); maxValueVbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (maxValueVbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), maxValueVbox, FALSE, FALSE, 0); maxValueLabel = gtk_label_new (QT_TR_NOOP("Maximum value to be in-range:")); gtk_widget_show (maxValueLabel); gtk_box_pack_start (GTK_BOX (maxValueVbox), maxValueLabel, FALSE, FALSE, 0); maxValueHbox = gtk_hbox_new (FALSE, 5); gtk_widget_show (maxValueHbox); gtk_box_pack_start (GTK_BOX (maxValueVbox), maxValueHbox, TRUE, TRUE, 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE maxValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (255, 0, 255, 1, 1, 0))); #else maxValueSpinner_adj = gtk_adjustment_new (255, 0, 255, 1, 1, 0); maxValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (maxValueSpinner_adj)); #endif gtk_widget_show (maxValueSlider); gtk_box_pack_start (GTK_BOX (maxValueHbox), maxValueSlider, TRUE, TRUE, 0); gtk_scale_set_draw_value (GTK_SCALE (maxValueSlider), FALSE); gtk_scale_set_value_pos (GTK_SCALE (maxValueSlider), GTK_POS_LEFT); gtk_scale_set_digits (GTK_SCALE (maxValueSlider), 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE maxValueSpinner_adj = gtk_adjustment_new (255, 0, 255, 1, 10, 10); #endif maxValueSpinner = gtk_spin_button_new (GTK_ADJUSTMENT (maxValueSpinner_adj), 1, 0); gtk_widget_show (maxValueSpinner); gtk_box_pack_start (GTK_BOX (maxValueHbox), maxValueSpinner, FALSE, TRUE, 0); outputValuesHbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (outputValuesHbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), outputValuesHbox, TRUE, TRUE, 0); outputValuesLabel = gtk_label_new (QT_TR_NOOP("Output values: ")); gtk_widget_show (outputValuesLabel); gtk_box_pack_start (GTK_BOX (outputValuesHbox), outputValuesLabel, FALSE, FALSE, 0); outputValuesMenu = gtk_combo_box_new_text (); gtk_widget_show (outputValuesMenu); gtk_box_pack_start (GTK_BOX (outputValuesHbox), outputValuesMenu, TRUE, TRUE, 0); gtk_combo_box_append_text (GTK_COMBO_BOX (outputValuesMenu), QT_TR_NOOP("In-range values go black, out-of-range values go white")); gtk_combo_box_append_text (GTK_COMBO_BOX (outputValuesMenu), QT_TR_NOOP("In-range values go white, out-of-range values go black")); debugHbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (debugHbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), debugHbox, TRUE, TRUE, 0); debugLabel = gtk_label_new (QT_TR_NOOP("Debugging settings (bits): ")); gtk_widget_show (debugLabel); gtk_box_pack_start (GTK_BOX (debugHbox), debugLabel, FALSE, FALSE, 0); debugSpinButton_adj = gtk_adjustment_new (0, 0, 16777215, 1, 10, 10); debugSpinButton = gtk_spin_button_new (GTK_ADJUSTMENT (debugSpinButton_adj), 1, 0); gtk_widget_show (debugSpinButton); gtk_box_pack_start (GTK_BOX (debugHbox), debugSpinButton, TRUE, TRUE, 0); previewFrame = gtk_frame_new (NULL); gtk_widget_show (previewFrame); gtk_box_pack_start (GTK_BOX (allButButtonsVbox), previewFrame, TRUE, TRUE, 0); previewAlignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (previewAlignment); gtk_container_add (GTK_CONTAINER (previewFrame), previewAlignment); gtk_alignment_set_padding (GTK_ALIGNMENT (previewAlignment), 0, 8, 6, 8); previewVbox = gtk_vbox_new (FALSE, 5); gtk_widget_show (previewVbox); gtk_container_add (GTK_CONTAINER (previewAlignment), previewVbox); previewControlHbox = gtk_hbox_new (FALSE, 5); gtk_widget_show (previewControlHbox); gtk_box_pack_start (GTK_BOX (previewVbox), previewControlHbox, TRUE, TRUE, 0); previewOutputMenu = gtk_combo_box_new_text (); gtk_widget_show (previewOutputMenu); gtk_box_pack_start (GTK_BOX (previewControlHbox), previewOutputMenu, FALSE, TRUE, 0); previewSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 99, 1, 1, 1))); gtk_widget_show (previewSlider); gtk_box_pack_start (GTK_BOX (previewControlHbox), previewSlider, TRUE, TRUE, 0); gtk_scale_set_digits (GTK_SCALE (previewSlider), 0); previewVideo = gtk_drawing_area_new (); gtk_widget_show (previewVideo); gtk_box_pack_start (GTK_BOX (previewVbox), previewVideo, TRUE, TRUE, 0); gtk_widget_set_size_request (previewVideo, 30, 30); gtk_widget_set_events (previewVideo, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK); previewLabel = gtk_label_new (QT_TR_NOOP("Preview")); gtk_widget_show (previewLabel); gtk_frame_set_label_widget (GTK_FRAME (previewFrame), previewLabel); dialogButtonBox = GTK_DIALOG (threshold_dialog)->action_area; gtk_widget_show (dialogButtonBox); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialogButtonBox), GTK_BUTTONBOX_END); cancelButton = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelButton); gtk_dialog_add_action_widget (GTK_DIALOG (threshold_dialog), cancelButton, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelButton, GTK_CAN_DEFAULT); okButton = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okButton); gtk_dialog_add_action_widget (GTK_DIALOG (threshold_dialog), okButton, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okButton, GTK_CAN_DEFAULT); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, threshold_dialog, "threshold_dialog"); GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, dialogVbox, "dialogVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, allButButtonsVbox, "allButButtonsVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, settingsOuterHbox, "settingsOuterHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, settingsOuterVbox, "settingsOuterVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueVbox, "minValueVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueLabel, "minValueLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueHbox, "minValueHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueSlider, "minValueSlider"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueSpinner, "minValueSpinner"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueVbox, "maxValueVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueLabel, "maxValueLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueHbox, "maxValueHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueSlider, "maxValueSlider"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueSpinner, "maxValueSpinner"); GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesHbox, "outputValuesHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesLabel, "outputValuesLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesMenu, "outputValuesMenu"); GLADE_HOOKUP_OBJECT (threshold_dialog, debugHbox, "debugHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, debugLabel, "debugLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, debugSpinButton, "debugSpinButton"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewFrame, "previewFrame"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewAlignment, "previewAlignment"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewVbox, "previewVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewControlHbox, "previewControlHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewOutputMenu, "previewOutputMenu"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewSlider, "previewSlider"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewVideo, "previewVideo"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewLabel, "previewLabel"); GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, dialogButtonBox, "dialogButtonBox"); GLADE_HOOKUP_OBJECT (threshold_dialog, cancelButton, "cancelButton"); GLADE_HOOKUP_OBJECT (threshold_dialog, okButton, "okButton"); return threshold_dialog; }
GtkWidget *help_window_new(const gchar *title, const gchar *subclass, const gchar *path, const gchar *key) { GtkWidget *window; GtkWidget *text; GtkTextBuffer *buffer; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *button; GtkWidget *scrolled; /* window */ window = window_new(GTK_WINDOW_TOPLEVEL, subclass, NULL, NULL, title); gtk_window_set_resizable(GTK_WINDOW(window), TRUE); #if 0 gtk_container_set_border_width(GTK_CONTAINER(window), PREF_PAD_BORDER); #endif gtk_window_set_default_size(GTK_WINDOW(window), HELP_WINDOW_WIDTH, HELP_WINDOW_HEIGHT); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(help_window_delete_cb), NULL); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show(vbox); g_object_set_data(G_OBJECT(window), "text_vbox", vbox); /* text window */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); gtk_widget_show(hbox); scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0); gtk_widget_show(scrolled); text = gtk_text_view_new(); gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE); gtk_container_add(GTK_CONTAINER(scrolled), text); gtk_widget_show(text); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); gtk_text_buffer_create_tag(buffer, "monospace", "family", "monospace", NULL); hbox = gtk_hbutton_box_new(); gtk_container_set_border_width(GTK_CONTAINER(hbox), PREF_PAD_BORDER); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(help_window_close), window); gtk_container_add(GTK_CONTAINER(hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_grab_default(button); gtk_widget_show(button); g_object_set_data(G_OBJECT(window), "text_widget", text); help_window_load_text(text, path); gtk_widget_show(window); help_window_scroll(text, key); return window; }
void CUIHandler::ShowSettingsDlg(void) { GtkWidget* settingsDlg; GtkWidget* dialog_vbox1; GtkWidget* frame4; GtkWidget* alignment4; GtkWidget* vbox2; GtkWidget* radiobuttonBt; GtkWidget* hbox2; GtkWidget* radiobuttonInet; GtkWidget* label5; GtkWidget* inetPort; GtkWidget* label4; GtkWidget* dialog_action_area1; CUserSettings crtSettings = pSmartEngine->GetSettings(); settingsDlg = gtk_dialog_new_with_buttons("SmartCam Preferences", GTK_WINDOW(pSmartEngine->GetMainWindow()), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gtk_window_set_type_hint(GTK_WINDOW (settingsDlg), GDK_WINDOW_TYPE_HINT_DIALOG); dialog_vbox1 = GTK_DIALOG (settingsDlg)->vbox; gtk_widget_show (dialog_vbox1); frame4 = gtk_frame_new (NULL); gtk_widget_show (frame4); gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame4, TRUE, TRUE, 0); gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_IN); alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment4); gtk_container_add (GTK_CONTAINER (frame4), alignment4); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment4), 10, 10, 12, 12); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_container_add (GTK_CONTAINER (alignment4), vbox2); radiobuttonBt = gtk_radio_button_new_with_mnemonic(NULL, "Bluetooth"); gtk_box_pack_start(GTK_BOX (vbox2), radiobuttonBt, FALSE, FALSE, 0); hbox2 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox2); gtk_box_pack_start(GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0); radiobuttonInet = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radiobuttonBt), "TCP/IP (WiFi)"); gtk_box_pack_start(GTK_BOX (hbox2), radiobuttonInet, FALSE, FALSE, 0); label5 = gtk_label_new(" Port: "); gtk_box_pack_start(GTK_BOX(hbox2), label5, FALSE, FALSE, 0); inetPort = gtk_spin_button_new_with_range(1025, 65536, 1); gtk_box_pack_start(GTK_BOX(hbox2), inetPort, TRUE, TRUE, 0); label4 = gtk_label_new("Connection"); gtk_frame_set_label_widget(GTK_FRAME(frame4), label4); gtk_label_set_use_markup(GTK_LABEL(label4), TRUE); dialog_action_area1 = GTK_DIALOG(settingsDlg)->action_area; gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); g_signal_connect(G_OBJECT(radiobuttonBt), "toggled", G_CALLBACK(OnRadiobuttonBluetooth), inetPort); if(crtSettings.connectionType == CONN_BLUETOOTH) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonBt), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonInet), FALSE); g_object_set(G_OBJECT(inetPort), "sensitive", FALSE, NULL); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonBt), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonInet), TRUE); g_object_set(G_OBJECT(inetPort), "sensitive", TRUE, NULL); } gtk_spin_button_set_value(GTK_SPIN_BUTTON(inetPort), crtSettings.inetPort); gtk_widget_show_all(settingsDlg); if(gtk_dialog_run(GTK_DIALOG(settingsDlg)) == GTK_RESPONSE_OK) { CUserSettings newSettings = crtSettings; if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobuttonBt))) { newSettings.connectionType = CONN_BLUETOOTH; } else { newSettings.connectionType = CONN_INET; newSettings.inetPort = gtk_spin_button_get_value(GTK_SPIN_BUTTON(inetPort)); } pSmartEngine->SaveSettings(newSettings); } gtk_widget_destroy(settingsDlg); }
GtkWidget* create_config (void) { GtkWidget *config; GtkWidget *config_vbox; GtkWidget *frame1; GtkWidget *table1; GtkWidget *label9; GtkObject *delay_spin_adj; GtkWidget *delay_spin; GtkWidget *focus_but; GtkWidget *timer_but; GtkWidget *label8; GtkWidget *frame2; GtkWidget *table2; GtkWidget *delete_but; GtkWidget *new_but; GtkWidget *scrolledwindow2; GtkWidget *treeview; GtkWidget *edit_but; GtkWidget *label7; GtkWidget *hbuttonbox1; GtkWidget *revert_but; GtkWidget *save_but; config = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (config), "SmartEar Configuration"); gtk_window_set_destroy_with_parent (GTK_WINDOW (config), TRUE); config_vbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (config_vbox); gtk_container_add (GTK_CONTAINER (config), config_vbox); gtk_widget_set_size_request (config_vbox, -1, 640); frame1 = gtk_frame_new (NULL); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (config_vbox), frame1, FALSE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame1), 5); table1 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (frame1), table1); gtk_container_set_border_width (GTK_CONTAINER (table1), 5); gtk_table_set_row_spacings (GTK_TABLE (table1), 10); gtk_table_set_col_spacings (GTK_TABLE (table1), 10); label9 = gtk_label_new ("Time delay between playing sounds for a particular buddy:"); gtk_widget_show (label9); gtk_table_attach (GTK_TABLE (table1), label9, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5); delay_spin_adj = gtk_adjustment_new (60, 0, 1000000, 1, 10, 10); delay_spin = gtk_spin_button_new (GTK_ADJUSTMENT (delay_spin_adj), 1, 0); gtk_widget_show (delay_spin); gtk_table_attach (GTK_TABLE (table1), delay_spin, 1, 2, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (delay_spin), GTK_UPDATE_IF_VALID); focus_but = gtk_check_button_new_with_mnemonic ("Don't play sounds for the conversation that has focus."); gtk_widget_show (focus_but); gtk_table_attach (GTK_TABLE (table1), focus_but, 0, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); timer_but = gtk_check_button_new_with_mnemonic ("Also play sounds if you don't respond to a particular IM within a delay period."); gtk_widget_show (timer_but); gtk_table_attach (GTK_TABLE (table1), timer_but, 0, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); label8 = gtk_label_new ("Options"); gtk_widget_show (label8); gtk_frame_set_label_widget (GTK_FRAME (frame1), label8); frame2 = gtk_frame_new (NULL); gtk_widget_show (frame2); gtk_box_pack_start (GTK_BOX (config_vbox), frame2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame2), 5); table2 = gtk_table_new (2, 3, FALSE); gtk_widget_show (table2); gtk_container_add (GTK_CONTAINER (frame2), table2); gtk_container_set_border_width (GTK_CONTAINER (table2), 5); gtk_table_set_row_spacings (GTK_TABLE (table2), 10); gtk_table_set_col_spacings (GTK_TABLE (table2), 10); delete_but = gtk_button_new_from_stock ("gtk-delete"); gtk_widget_show (delete_but); gtk_table_attach (GTK_TABLE (table2), delete_but, 2, 3, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); GTK_WIDGET_SET_FLAGS (delete_but, GTK_CAN_DEFAULT); new_but = gtk_button_new_from_stock ("gtk-new"); gtk_widget_show (new_but); gtk_table_attach (GTK_TABLE (table2), new_but, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); GTK_WIDGET_SET_FLAGS (new_but, GTK_CAN_DEFAULT); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow2); gtk_table_attach (GTK_TABLE (table2), scrolledwindow2, 0, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); treeview = gtk_tree_view_new (); gtk_widget_show (treeview); gtk_container_add (GTK_CONTAINER (scrolledwindow2), treeview); edit_but = gtk_button_new_from_stock ("gtk-properties"); gtk_widget_show (edit_but); gtk_table_attach (GTK_TABLE (table2), edit_but, 1, 2, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); label7 = gtk_label_new ("Entries"); gtk_widget_show (label7); gtk_frame_set_label_widget (GTK_FRAME (frame2), label7); hbuttonbox1 = gtk_hbutton_box_new (); gtk_widget_show (hbuttonbox1); gtk_box_pack_start (GTK_BOX (config_vbox), hbuttonbox1, FALSE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox1), 5); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_SPREAD); revert_but = gtk_button_new_from_stock ("gtk-revert-to-saved"); gtk_widget_show (revert_but); gtk_container_add (GTK_CONTAINER (hbuttonbox1), revert_but); GTK_WIDGET_SET_FLAGS (revert_but, GTK_CAN_DEFAULT); save_but = gtk_button_new_from_stock ("gtk-save"); gtk_widget_show (save_but); gtk_container_add (GTK_CONTAINER (hbuttonbox1), save_but); GTK_WIDGET_SET_FLAGS (save_but, GTK_CAN_DEFAULT); g_signal_connect ((gpointer) config_vbox, "destroy", G_CALLBACK (on_config_destroy), NULL); g_signal_connect ((gpointer) delay_spin, "changed", G_CALLBACK (on_delay_changed), NULL); g_signal_connect ((gpointer) focus_but, "toggled", G_CALLBACK (on_focus_toggled), NULL); g_signal_connect ((gpointer) timer_but, "toggled", G_CALLBACK (on_timer_toggled), NULL); g_signal_connect ((gpointer) delete_but, "clicked", G_CALLBACK (on_delete_clicked), NULL); g_signal_connect ((gpointer) new_but, "clicked", G_CALLBACK (on_new_clicked), NULL); g_signal_connect ((gpointer) edit_but, "clicked", G_CALLBACK (on_edit_clicked), NULL); g_signal_connect ((gpointer) revert_but, "clicked", G_CALLBACK (on_revert_clicked), NULL); g_signal_connect ((gpointer) save_but, "clicked", G_CALLBACK (on_save_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (config, config, "config"); GLADE_HOOKUP_OBJECT (config, config_vbox, "config_vbox"); GLADE_HOOKUP_OBJECT (config, frame1, "frame1"); GLADE_HOOKUP_OBJECT (config, table1, "table1"); GLADE_HOOKUP_OBJECT (config, label9, "label9"); GLADE_HOOKUP_OBJECT (config, delay_spin, "delay_spin"); GLADE_HOOKUP_OBJECT (config, focus_but, "focus_but"); GLADE_HOOKUP_OBJECT (config, timer_but, "timer_but"); GLADE_HOOKUP_OBJECT (config, label8, "label8"); GLADE_HOOKUP_OBJECT (config, frame2, "frame2"); GLADE_HOOKUP_OBJECT (config, table2, "table2"); GLADE_HOOKUP_OBJECT (config, delete_but, "delete_but"); GLADE_HOOKUP_OBJECT (config, new_but, "new_but"); GLADE_HOOKUP_OBJECT (config, scrolledwindow2, "scrolledwindow2"); GLADE_HOOKUP_OBJECT (config, treeview, "treeview"); GLADE_HOOKUP_OBJECT (config, edit_but, "edit_but"); GLADE_HOOKUP_OBJECT (config, label7, "label7"); GLADE_HOOKUP_OBJECT (config, hbuttonbox1, "hbuttonbox1"); GLADE_HOOKUP_OBJECT (config, revert_but, "revert_but"); GLADE_HOOKUP_OBJECT (config, save_but, "save_but"); return config; }
GtkWidget* create_edit_win (void) { GtkWidget *edit_win; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *label29; GtkWidget *name_entry; GtkWidget *label30; GtkWidget *type_option; GtkWidget *menu1; GtkWidget *item_buddy; GtkWidget *item_group; GtkWidget *hbuttonbox2; GtkWidget *applysave_but; GtkWidget *apply_but; GtkWidget *cancel_but; GtkWidget *frame3; GtkWidget *table5; GtkWidget *label31; GtkWidget *label34; GtkWidget *label33; GtkWidget *label32; GtkWidget *unaway_sound_entry; GtkWidget *unidle_sound_entry; GtkWidget *signon_sound_entry; GtkWidget *unaway_test_but; GtkWidget *unidle_test_but; GtkWidget *signon_test_but; GtkWidget *unaway_browse_but; GtkWidget *unidle_browse_but; GtkWidget *signon_browse_but; GtkWidget *im_browse_but; GtkWidget *im_sound_entry; GtkWidget *im_test_but; GtkWidget *label24; edit_win = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (edit_win, 600, 300); gtk_window_set_title (GTK_WINDOW (edit_win), "Edit Entry"); gtk_window_set_default_size (GTK_WINDOW (edit_win), 600, 300); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (edit_win), vbox1); hbox1 = gtk_hbox_new (FALSE, 5); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 10); gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5); label29 = gtk_label_new ("Name:"); gtk_widget_show (label29); gtk_box_pack_start (GTK_BOX (hbox1), label29, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label29), 1, 0.5); name_entry = gtk_entry_new (); gtk_widget_show (name_entry); gtk_box_pack_start (GTK_BOX (hbox1), name_entry, TRUE, TRUE, 0); label30 = gtk_label_new ("Type:"); gtk_widget_show (label30); gtk_box_pack_start (GTK_BOX (hbox1), label30, FALSE, TRUE, 0); gtk_misc_set_alignment (GTK_MISC (label30), 1, 0.5); type_option = gtk_option_menu_new (); gtk_widget_show (type_option); gtk_box_pack_start (GTK_BOX (hbox1), type_option, FALSE, FALSE, 0); menu1 = gtk_menu_new (); item_buddy = gtk_menu_item_new_with_mnemonic ("Buddy"); gtk_widget_show (item_buddy); gtk_container_add (GTK_CONTAINER (menu1), item_buddy); item_group = gtk_menu_item_new_with_mnemonic ("Group"); gtk_widget_show (item_group); gtk_container_add (GTK_CONTAINER (menu1), item_group); gtk_option_menu_set_menu (GTK_OPTION_MENU (type_option), menu1); hbuttonbox2 = gtk_hbutton_box_new (); gtk_widget_show (hbuttonbox2); gtk_box_pack_end (GTK_BOX (vbox1), hbuttonbox2, FALSE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox2), 5); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_SPREAD); applysave_but = gtk_button_new_with_mnemonic ("Apply and Save"); gtk_widget_show (applysave_but); gtk_container_add (GTK_CONTAINER (hbuttonbox2), applysave_but); GTK_WIDGET_SET_FLAGS (applysave_but, GTK_CAN_DEFAULT); apply_but = gtk_button_new_from_stock ("gtk-apply"); gtk_widget_show (apply_but); gtk_container_add (GTK_CONTAINER (hbuttonbox2), apply_but); GTK_WIDGET_SET_FLAGS (apply_but, GTK_CAN_DEFAULT); cancel_but = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancel_but); gtk_container_add (GTK_CONTAINER (hbuttonbox2), cancel_but); GTK_WIDGET_SET_FLAGS (cancel_but, GTK_CAN_DEFAULT); frame3 = gtk_frame_new (NULL); gtk_widget_show (frame3); gtk_box_pack_start (GTK_BOX (vbox1), frame3, FALSE, FALSE, 0); gtk_widget_set_size_request (frame3, -1, 200); gtk_container_set_border_width (GTK_CONTAINER (frame3), 5); table5 = gtk_table_new (4, 5, FALSE); gtk_widget_show (table5); gtk_container_add (GTK_CONTAINER (frame3), table5); gtk_widget_set_size_request (table5, 600, 400); gtk_container_set_border_width (GTK_CONTAINER (table5), 5); gtk_table_set_row_spacings (GTK_TABLE (table5), 10); gtk_table_set_col_spacings (GTK_TABLE (table5), 10); label31 = gtk_label_new ("Play On IM:"); gtk_widget_show (label31); gtk_table_attach (GTK_TABLE (table5), label31, 0, 1, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label31), 0, 0.5); label34 = gtk_label_new ("Play On Unaway:"); gtk_widget_show (label34); gtk_table_attach (GTK_TABLE (table5), label34, 0, 1, 3, 4, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label34), 0, 0.5); label33 = gtk_label_new ("Play On Unidle:"); gtk_widget_show (label33); gtk_table_attach (GTK_TABLE (table5), label33, 0, 1, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label33), 0, 0.5); label32 = gtk_label_new ("Play On Signon:"); gtk_widget_show (label32); gtk_table_attach (GTK_TABLE (table5), label32, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label32), 0, 0.5); unaway_sound_entry = gtk_entry_new (); gtk_widget_show (unaway_sound_entry); gtk_table_attach (GTK_TABLE (table5), unaway_sound_entry, 1, 3, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); unidle_sound_entry = gtk_entry_new (); gtk_widget_show (unidle_sound_entry); gtk_table_attach (GTK_TABLE (table5), unidle_sound_entry, 1, 3, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); signon_sound_entry = gtk_entry_new (); gtk_widget_show (signon_sound_entry); gtk_table_attach (GTK_TABLE (table5), signon_sound_entry, 1, 3, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); unaway_test_but = gtk_button_new_with_mnemonic ("Test"); gtk_widget_show (unaway_test_but); gtk_table_attach (GTK_TABLE (table5), unaway_test_but, 4, 5, 3, 4, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); unidle_test_but = gtk_button_new_with_mnemonic ("Test"); gtk_widget_show (unidle_test_but); gtk_table_attach (GTK_TABLE (table5), unidle_test_but, 4, 5, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); signon_test_but = gtk_button_new_with_mnemonic ("Test"); gtk_widget_show (signon_test_but); gtk_table_attach (GTK_TABLE (table5), signon_test_but, 4, 5, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); unaway_browse_but = gtk_button_new_from_stock ("gtk-open"); gtk_widget_show (unaway_browse_but); gtk_table_attach (GTK_TABLE (table5), unaway_browse_but, 3, 4, 3, 4, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); unidle_browse_but = gtk_button_new_from_stock ("gtk-open"); gtk_widget_show (unidle_browse_but); gtk_table_attach (GTK_TABLE (table5), unidle_browse_but, 3, 4, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); signon_browse_but = gtk_button_new_from_stock ("gtk-open"); gtk_widget_show (signon_browse_but); gtk_table_attach (GTK_TABLE (table5), signon_browse_but, 3, 4, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); im_browse_but = gtk_button_new_from_stock ("gtk-open"); gtk_widget_show (im_browse_but); gtk_table_attach (GTK_TABLE (table5), im_browse_but, 3, 4, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); im_sound_entry = gtk_entry_new (); gtk_widget_show (im_sound_entry); gtk_table_attach (GTK_TABLE (table5), im_sound_entry, 1, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); im_test_but = gtk_button_new_with_mnemonic ("Test"); gtk_widget_show (im_test_but); gtk_table_attach (GTK_TABLE (table5), im_test_but, 4, 5, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); label24 = gtk_label_new ("Sound Events"); gtk_widget_show (label24); gtk_frame_set_label_widget (GTK_FRAME (frame3), label24); g_signal_connect ((gpointer) edit_win, "destroy", G_CALLBACK (on_edit_win_destroy), NULL); g_signal_connect ((gpointer) applysave_but, "clicked", G_CALLBACK (on_apply_clicked), NULL); g_signal_connect ((gpointer) applysave_but, "clicked", G_CALLBACK (on_save_clicked), NULL); g_signal_connect_swapped ((gpointer) applysave_but, "clicked", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (edit_win)); g_signal_connect ((gpointer) apply_but, "clicked", G_CALLBACK (on_apply_clicked), NULL); g_signal_connect_swapped ((gpointer) apply_but, "clicked", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (edit_win)); g_signal_connect_swapped ((gpointer) cancel_but, "clicked", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (edit_win)); g_signal_connect ((gpointer) unaway_test_but, "clicked", G_CALLBACK (on_unaway_test_clicked), NULL); g_signal_connect ((gpointer) unidle_test_but, "clicked", G_CALLBACK (on_unidle_test_clicked), NULL); g_signal_connect ((gpointer) signon_test_but, "clicked", G_CALLBACK (on_signon_test_clicked), NULL); g_signal_connect ((gpointer) unaway_browse_but, "clicked", G_CALLBACK (on_unaway_browse_clicked), NULL); g_signal_connect ((gpointer) unidle_browse_but, "clicked", G_CALLBACK (on_unidle_browse_clicked), NULL); g_signal_connect ((gpointer) signon_browse_but, "clicked", G_CALLBACK (on_signon_browse_clicked), NULL); g_signal_connect ((gpointer) im_browse_but, "clicked", G_CALLBACK (on_im_browse_clicked), NULL); g_signal_connect ((gpointer) im_test_but, "clicked", G_CALLBACK (on_im_test_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (edit_win, edit_win, "edit_win"); GLADE_HOOKUP_OBJECT (edit_win, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (edit_win, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (edit_win, label29, "label29"); GLADE_HOOKUP_OBJECT (edit_win, name_entry, "name_entry"); GLADE_HOOKUP_OBJECT (edit_win, label30, "label30"); GLADE_HOOKUP_OBJECT (edit_win, type_option, "type_option"); GLADE_HOOKUP_OBJECT (edit_win, menu1, "menu1"); GLADE_HOOKUP_OBJECT (edit_win, item_buddy, "item_buddy"); GLADE_HOOKUP_OBJECT (edit_win, item_group, "item_group"); GLADE_HOOKUP_OBJECT (edit_win, hbuttonbox2, "hbuttonbox2"); GLADE_HOOKUP_OBJECT (edit_win, applysave_but, "applysave_but"); GLADE_HOOKUP_OBJECT (edit_win, apply_but, "apply_but"); GLADE_HOOKUP_OBJECT (edit_win, cancel_but, "cancel_but"); GLADE_HOOKUP_OBJECT (edit_win, frame3, "frame3"); GLADE_HOOKUP_OBJECT (edit_win, table5, "table5"); GLADE_HOOKUP_OBJECT (edit_win, label31, "label31"); GLADE_HOOKUP_OBJECT (edit_win, label34, "label34"); GLADE_HOOKUP_OBJECT (edit_win, label33, "label33"); GLADE_HOOKUP_OBJECT (edit_win, label32, "label32"); GLADE_HOOKUP_OBJECT (edit_win, unaway_sound_entry, "unaway_sound_entry"); GLADE_HOOKUP_OBJECT (edit_win, unidle_sound_entry, "unidle_sound_entry"); GLADE_HOOKUP_OBJECT (edit_win, signon_sound_entry, "signon_sound_entry"); GLADE_HOOKUP_OBJECT (edit_win, unaway_test_but, "unaway_test_but"); GLADE_HOOKUP_OBJECT (edit_win, unidle_test_but, "unidle_test_but"); GLADE_HOOKUP_OBJECT (edit_win, signon_test_but, "signon_test_but"); GLADE_HOOKUP_OBJECT (edit_win, unaway_browse_but, "unaway_browse_but"); GLADE_HOOKUP_OBJECT (edit_win, unidle_browse_but, "unidle_browse_but"); GLADE_HOOKUP_OBJECT (edit_win, signon_browse_but, "signon_browse_but"); GLADE_HOOKUP_OBJECT (edit_win, im_browse_but, "im_browse_but"); GLADE_HOOKUP_OBJECT (edit_win, im_sound_entry, "im_sound_entry"); GLADE_HOOKUP_OBJECT (edit_win, im_test_but, "im_test_but"); GLADE_HOOKUP_OBJECT (edit_win, label24, "label24"); return edit_win; }
NotesTransferDialog::NotesTransferDialog(int dummy) { notestransferdialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(notestransferdialog), _("Transfer To Project Notes")); gtk_window_set_position(GTK_WINDOW(notestransferdialog), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_modal(GTK_WINDOW(notestransferdialog), TRUE); dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG(notestransferdialog)); gtk_widget_show(dialog_vbox1); vbox1 = gtk_vbox_new(FALSE, 5); gtk_widget_show(vbox1); gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, FALSE, FALSE, 0); label1 = gtk_label_new(_("This will transfer all text from the currently opened project into the Project notes.")); gtk_widget_show(label1); gtk_box_pack_start(GTK_BOX(vbox1), label1, FALSE, FALSE, 0); gtk_label_set_line_wrap(GTK_LABEL(label1), TRUE); gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); hbox1 = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0); label2 = gtk_label_new(_("The notes will be put into category")); gtk_widget_show(label2); gtk_box_pack_start(GTK_BOX(hbox1), label2, FALSE, FALSE, 0); combobox1 = gtk_combo_box_new_text(); gtk_widget_show(combobox1); gtk_box_pack_start(GTK_BOX(hbox1), combobox1, TRUE, TRUE, 0); label3 = gtk_label_new(_("The transfer cannot be undone.")); gtk_widget_show(label3); gtk_box_pack_start(GTK_BOX(vbox1), label3, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(notestransferdialog)); gtk_widget_show(dialog_action_area1); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); new InDialogHelp(notestransferdialog, NULL, NULL, NULL); cancelbutton = gtk_button_new_from_stock("gtk-cancel"); gtk_widget_show(cancelbutton); gtk_dialog_add_action_widget(GTK_DIALOG(notestransferdialog), cancelbutton, GTK_RESPONSE_CANCEL); gtk_widget_set_can_default (GTK_WIDGET (cancelbutton), true); okbutton = gtk_button_new_from_stock("gtk-ok"); gtk_widget_show(okbutton); gtk_dialog_add_action_widget(GTK_DIALOG(notestransferdialog), okbutton, GTK_RESPONSE_OK); gtk_widget_set_can_default (GTK_WIDGET (okbutton), true); g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this)); // Read all the categories and add amy new ones from the database. ReadText rt(notes_categories_filename()); notes_categories_add_from_database(rt.lines); combobox_set_strings(combobox1, rt.lines); if (!rt.lines.empty()) combobox_set_string(combobox1, rt.lines[0]); }
static void gtk_assert_dialog_init(GtkAssertDialog* dlg) { GtkWidget *continuebtn; { GtkWidget *vbox, *hbox, *image; /* start the main vbox */ gtk_widget_push_composite_child (); vbox = gtk_vbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER(vbox), 8); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))), vbox, true, true, 5); /* add the icon+message hbox */ hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); /* icon */ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 12); { GtkWidget *vbox2, *info; /* message */ vbox2 = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); info = gtk_label_new ("An assertion failed!"); gtk_box_pack_start (GTK_BOX(vbox2), info, TRUE, TRUE, 8); /* assert message */ dlg->message = gtk_label_new (NULL); gtk_label_set_selectable (GTK_LABEL (dlg->message), TRUE); gtk_label_set_line_wrap (GTK_LABEL (dlg->message), TRUE); gtk_label_set_justify (GTK_LABEL (dlg->message), GTK_JUSTIFY_LEFT); gtk_widget_set_size_request (GTK_WIDGET(dlg->message), 450, -1); gtk_box_pack_end (GTK_BOX(vbox2), GTK_WIDGET(dlg->message), TRUE, TRUE, 8); } /* add the expander */ dlg->expander = gtk_expander_new_with_mnemonic ("Back_trace:"); gtk_box_pack_start (GTK_BOX(vbox), dlg->expander, TRUE, TRUE, 0); g_signal_connect (GTK_EXPANDER(dlg->expander), "activate", G_CALLBACK(gtk_assert_dialog_expander_callback), dlg); } { GtkWidget *hbox, *vbox, *button, *sw; /* create expander's vbox */ vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (dlg->expander), vbox); /* add a scrollable window under the expander */ sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX(vbox), sw, TRUE, TRUE, 8); /* add the treeview to the scrollable window */ dlg->treeview = gtk_assert_dialog_create_backtrace_list_model (); gtk_widget_set_size_request (GTK_WIDGET(dlg->treeview), -1, 180); gtk_container_add (GTK_CONTAINER (sw), dlg->treeview); /* create button's hbox */ hbox = gtk_hbutton_box_new (); gtk_box_pack_end (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_button_box_set_layout (GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); /* add the buttons */ button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Save to _file", GTK_STOCK_SAVE); g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_save_backtrace_callback), dlg); button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Copy to clip_board", GTK_STOCK_COPY); g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_copy_callback), dlg); } /* add the checkbutton */ dlg->shownexttime = gtk_check_button_new_with_mnemonic("Show this _dialog the next time"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dlg->shownexttime), TRUE); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dlg))), dlg->shownexttime, false, true, 8); /* add the stop button */ gtk_assert_dialog_add_button (dlg, "_Stop", GTK_STOCK_QUIT, GTK_ASSERT_DIALOG_STOP); /* add the continue button */ continuebtn = gtk_assert_dialog_add_button (dlg, "_Continue", GTK_STOCK_YES, GTK_ASSERT_DIALOG_CONTINUE); gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_ASSERT_DIALOG_CONTINUE); g_signal_connect (continuebtn, "clicked", G_CALLBACK(gtk_assert_dialog_continue_callback), dlg); /* complete creation */ dlg->callback = NULL; dlg->userdata = NULL; /* the resizable property of this window is modified by the expander: when it's collapsed, the window must be non-resizable! */ gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_widget_pop_composite_child (); gtk_widget_show_all (GTK_WIDGET(dlg)); }
void i_fileinfo_gui( const gchar * filename_uri ) { static GtkWidget *fileinfowin = NULL; GtkWidget *fileinfowin_vbox, *fileinfowin_columns_hbox; GtkWidget *midiinfoboxes_vbox, *miditextboxes_vbox, *miditextboxes_paned; GtkWidget *title_hbox, *title_icon_image, *title_name_f_label, *title_name_v_entry; GtkWidget *info_frame, *info_frame_tl, *info_grid; GtkWidget *text_frame, *text_frame_tl, *text_tv, *text_tv_sw; GtkWidget *lyrics_frame, *lyrics_tv, *lyrics_tv_sw; GtkTextBuffer *text_tb, *lyrics_tb; GtkWidget *footer_hbbox, *footer_bclose; GdkPixbuf *title_icon_pixbuf; PangoAttrList *pangoattrlist; PangoAttribute *pangoattr; GString *value_gstring; gchar *title , *filename, *filename_utf8; gint bpm = 0, wavg_bpm = 0; midifile_t *mf; if ( fileinfowin ) return; mf = g_malloc(sizeof(midifile_t)); /****************** midifile parser ******************/ if ( !i_midi_parse_from_filename( filename_uri , mf ) ) return; /* midifile is filled with information at this point, bpm information is needed too */ i_midi_get_bpm( mf , &bpm , &wavg_bpm ); /*****************************************************/ fileinfowin = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_type_hint( GTK_WINDOW(fileinfowin), GDK_WINDOW_TYPE_HINT_DIALOG ); gtk_window_set_position( GTK_WINDOW(fileinfowin) , GTK_WIN_POS_CENTER ); g_signal_connect( G_OBJECT(fileinfowin) , "destroy" , G_CALLBACK(i_fileinfo_ev_destroy) , mf ); g_signal_connect( G_OBJECT(fileinfowin) , "destroy" , G_CALLBACK(gtk_widget_destroyed) , &fileinfowin ); gtk_container_set_border_width( GTK_CONTAINER(fileinfowin), 10 ); fileinfowin_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10 ); gtk_container_add( GTK_CONTAINER(fileinfowin) , fileinfowin_vbox ); /* pango attributes */ pangoattrlist = pango_attr_list_new(); pangoattr = pango_attr_weight_new( PANGO_WEIGHT_BOLD ); pangoattr->start_index = 0; pangoattr->end_index = G_MAXINT; pango_attr_list_insert( pangoattrlist , pangoattr ); /****************** *** TITLE LINE ***/ title_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5 ); gtk_box_pack_start( GTK_BOX(fileinfowin_vbox) , title_hbox , FALSE , FALSE , 0 ); title_icon_pixbuf = gdk_pixbuf_new_from_xpm_data( (const gchar **)amidiplug_xpm_midiicon ); title_icon_image = gtk_image_new_from_pixbuf( title_icon_pixbuf ); g_object_unref( title_icon_pixbuf ); gtk_misc_set_alignment( GTK_MISC(title_icon_image) , 0 , 0 ); gtk_box_pack_start( GTK_BOX(title_hbox) , title_icon_image , FALSE , FALSE , 0 ); title_name_f_label = gtk_label_new( _("Name:") ); gtk_label_set_attributes( GTK_LABEL(title_name_f_label) , pangoattrlist ); gtk_box_pack_start( GTK_BOX(title_hbox) , title_name_f_label , FALSE , FALSE , 0 ); title_name_v_entry = gtk_entry_new(); gtk_editable_set_editable( GTK_EDITABLE(title_name_v_entry) , FALSE ); gtk_widget_set_size_request( GTK_WIDGET(title_name_v_entry) , 200 , -1 ); gtk_box_pack_start(GTK_BOX(title_hbox) , title_name_v_entry , TRUE , TRUE , 0 ); fileinfowin_columns_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2 ); gtk_box_pack_start( GTK_BOX(fileinfowin_vbox) , fileinfowin_columns_hbox , TRUE , TRUE , 0 ); /********************* *** MIDI INFO BOX ***/ midiinfoboxes_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2 ); /* pick the entire space if both comments and lyrics boxes are not displayed, pick only required space if at least one of them is displayed */ if (( amidiplug_cfg_ap.ap_opts_comments_extract == 0 ) && ( amidiplug_cfg_ap.ap_opts_lyrics_extract == 0 )) gtk_box_pack_start( GTK_BOX(fileinfowin_columns_hbox) , midiinfoboxes_vbox , TRUE , TRUE , 0 ); else gtk_box_pack_start( GTK_BOX(fileinfowin_columns_hbox) , midiinfoboxes_vbox , FALSE , FALSE , 0 ); info_frame_tl = gtk_label_new( "" ); gtk_label_set_markup( GTK_LABEL(info_frame_tl) , _("<span size=\"smaller\"> MIDI Info </span>") ); gtk_box_pack_start( GTK_BOX(midiinfoboxes_vbox) , info_frame_tl , FALSE , FALSE , 0 ); info_frame = gtk_frame_new( NULL ); gtk_box_pack_start( GTK_BOX(midiinfoboxes_vbox) , info_frame , TRUE , TRUE , 0 ); info_grid = gtk_grid_new(); gtk_grid_set_row_spacing( GTK_GRID(info_grid) , 4 ); gtk_grid_set_column_spacing( GTK_GRID(info_grid) , 10 ); gtk_container_set_border_width( GTK_CONTAINER(info_grid) , 3 ); gtk_container_add( GTK_CONTAINER(info_frame) , info_grid ); value_gstring = g_string_new( "" ); /* midi format */ G_STRING_PRINTF( value_gstring , "type %i" , mf->format ); i_fileinfo_grid_add_entry( _("Format:") , value_gstring->str , info_grid , 0 , pangoattrlist ); /* midi length */ G_STRING_PRINTF( value_gstring , "%i" , (gint)(mf->length / 1000) ); i_fileinfo_grid_add_entry( _("Length (msec):") , value_gstring->str , info_grid , 1 , pangoattrlist ); /* midi num of tracks */ G_STRING_PRINTF( value_gstring , "%i" , mf->num_tracks ); i_fileinfo_grid_add_entry( _("No. of Tracks:") , value_gstring->str , info_grid , 2 , pangoattrlist ); /* midi bpm */ if ( bpm > 0 ) G_STRING_PRINTF( value_gstring , "%i" , bpm ); /* fixed bpm */ else G_STRING_PRINTF( value_gstring , _("variable") ); /* variable bpm */ i_fileinfo_grid_add_entry( _("BPM:") , value_gstring->str , info_grid , 3 , pangoattrlist ); /* midi weighted average bpm */ if ( bpm > 0 ) G_STRING_PRINTF( value_gstring , "/" ); /* fixed bpm, don't care about wavg_bpm */ else G_STRING_PRINTF( value_gstring , "%i" , wavg_bpm ); /* variable bpm, display wavg_bpm */ i_fileinfo_grid_add_entry( _("BPM (wavg):") , value_gstring->str , info_grid , 4 , pangoattrlist ); /* midi time division */ G_STRING_PRINTF( value_gstring , "%i" , mf->time_division ); i_fileinfo_grid_add_entry( _("Time Div:") , value_gstring->str , info_grid , 5 , pangoattrlist ); g_string_free( value_gstring , TRUE ); /********************************** *** MIDI COMMENTS/LYRICS BOXES ***/ miditextboxes_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2 ); gtk_box_pack_start( GTK_BOX(fileinfowin_columns_hbox) , miditextboxes_vbox , TRUE , TRUE , 0 ); text_frame_tl = gtk_label_new( "" ); gtk_label_set_markup( GTK_LABEL(text_frame_tl) , _("<span size=\"smaller\"> MIDI Comments and Lyrics </span>") ); gtk_box_pack_start( GTK_BOX(miditextboxes_vbox) , text_frame_tl , FALSE , FALSE , 0 ); miditextboxes_paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); gtk_box_pack_start( GTK_BOX(miditextboxes_vbox) , miditextboxes_paned , TRUE , TRUE , 0 ); text_frame = gtk_frame_new( NULL ); gtk_paned_pack1( GTK_PANED(miditextboxes_paned) , text_frame , TRUE , TRUE ); text_tv = gtk_text_view_new(); gtk_text_view_set_editable( GTK_TEXT_VIEW(text_tv) , FALSE ); gtk_text_view_set_cursor_visible( GTK_TEXT_VIEW(text_tv) , FALSE ); gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW(text_tv) , GTK_WRAP_WORD ); gtk_text_view_set_right_margin( GTK_TEXT_VIEW(text_tv) , 4 ); gtk_text_view_set_left_margin( GTK_TEXT_VIEW(text_tv) , 4 ); gtk_widget_set_size_request( text_tv , 300 , 113 ); text_tv_sw = gtk_scrolled_window_new( NULL , NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(text_tv_sw) , GTK_POLICY_AUTOMATIC , GTK_POLICY_ALWAYS ); gtk_container_add( GTK_CONTAINER(text_frame) , text_tv_sw ); gtk_container_add( GTK_CONTAINER(text_tv_sw) , text_tv ); lyrics_frame = gtk_frame_new( NULL ); gtk_paned_pack2( GTK_PANED(miditextboxes_paned) , lyrics_frame , TRUE , TRUE ); lyrics_tv = gtk_text_view_new(); gtk_text_view_set_editable( GTK_TEXT_VIEW(lyrics_tv) , FALSE ); gtk_text_view_set_cursor_visible( GTK_TEXT_VIEW(lyrics_tv) , FALSE ); gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW(lyrics_tv) , GTK_WRAP_WORD ); gtk_text_view_set_right_margin( GTK_TEXT_VIEW(lyrics_tv) , 4 ); gtk_text_view_set_left_margin( GTK_TEXT_VIEW(lyrics_tv) , 4 ); gtk_widget_set_size_request( lyrics_tv , 300 , 113 ); lyrics_tv_sw = gtk_scrolled_window_new( NULL , NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(lyrics_tv_sw) , GTK_POLICY_AUTOMATIC , GTK_POLICY_ALWAYS ); gtk_container_add( GTK_CONTAINER(lyrics_frame) , lyrics_tv_sw ); gtk_container_add( GTK_CONTAINER(lyrics_tv_sw) , lyrics_tv ); text_tb = gtk_text_view_get_buffer( GTK_TEXT_VIEW(text_tv) ); lyrics_tb = gtk_text_view_get_buffer( GTK_TEXT_VIEW(lyrics_tv) ); /* call the buffer fill routine if at least one between comments and lyrics is enabled */ if (( amidiplug_cfg_ap.ap_opts_comments_extract > 0 ) || ( amidiplug_cfg_ap.ap_opts_lyrics_extract > 0 )) i_fileinfo_text_fill( mf , text_tb , lyrics_tb ); if (( amidiplug_cfg_ap.ap_opts_comments_extract > 0 ) && ( gtk_text_buffer_get_char_count( text_tb ) == 0 )) { GtkTextIter start, end; GtkTextTag *tag = gtk_text_buffer_create_tag( text_tb , "italicstyle" , "style" , PANGO_STYLE_ITALIC , NULL ); /*gtk_text_view_set_justification( GTK_TEXT_VIEW(text_tv) , GTK_JUSTIFY_CENTER );*/ gtk_text_buffer_set_text( text_tb , _("* no comments available in this MIDI file *") , -1 ); gtk_text_buffer_get_iter_at_offset( text_tb , &start , 0 ); gtk_text_buffer_get_iter_at_offset( text_tb , &end , -1 ); gtk_text_buffer_apply_tag( text_tb , tag , &start , &end ); } if (( amidiplug_cfg_ap.ap_opts_lyrics_extract > 0 ) && ( gtk_text_buffer_get_char_count( lyrics_tb ) == 0 )) { GtkTextIter start, end; GtkTextTag *tag = gtk_text_buffer_create_tag( lyrics_tb , "italicstyle" , "style" , PANGO_STYLE_ITALIC , NULL ); /*gtk_text_view_set_justification( GTK_TEXT_VIEW(lyrics_tv) , GTK_JUSTIFY_CENTER );*/ gtk_text_buffer_set_text( lyrics_tb , _("* no lyrics available in this MIDI file *") , -1 ); gtk_text_buffer_get_iter_at_offset( lyrics_tb , &start , 0 ); gtk_text_buffer_get_iter_at_offset( lyrics_tb , &end , -1 ); gtk_text_buffer_apply_tag( lyrics_tb , tag , &start , &end ); } /* hide boxes for disabled options (comments and/or lyrics) */ if (( amidiplug_cfg_ap.ap_opts_comments_extract == 0 ) && ( amidiplug_cfg_ap.ap_opts_lyrics_extract == 0 )) { gtk_widget_set_no_show_all( miditextboxes_vbox , TRUE ); gtk_widget_hide( miditextboxes_vbox ); } else if ( amidiplug_cfg_ap.ap_opts_comments_extract == 0 ) { gtk_widget_set_no_show_all( text_frame , TRUE ); gtk_widget_hide( text_frame ); } else if ( amidiplug_cfg_ap.ap_opts_lyrics_extract == 0 ) { gtk_widget_set_no_show_all( lyrics_frame , TRUE ); gtk_widget_hide( lyrics_frame ); } /************** *** FOOTER ***/ footer_hbbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout( GTK_BUTTON_BOX(footer_hbbox) , GTK_BUTTONBOX_END ); footer_bclose = gtk_button_new_from_stock( GTK_STOCK_CLOSE ); g_signal_connect( G_OBJECT(footer_bclose) , "clicked" , G_CALLBACK(i_fileinfo_ev_close) , fileinfowin ); gtk_container_add( GTK_CONTAINER(footer_hbbox) , footer_bclose ); gtk_box_pack_start( GTK_BOX(fileinfowin_vbox) , footer_hbbox , FALSE , FALSE , 0 ); /* utf8-ize filename and set window title */ filename = g_filename_from_uri( filename_uri , NULL , NULL ); if ( !filename ) filename = g_strdup( filename_uri ); filename_utf8 = g_strdup(g_filename_to_utf8( filename , -1 , NULL , NULL , NULL )); if ( !filename_utf8 ) { /* utf8 fallback */ gchar *chr , *convert_str = g_strdup( filename ); for ( chr = convert_str ; *chr ; chr++ ) { if ( *chr & 0x80 ) *chr = '?'; } filename_utf8 = g_strconcat( convert_str , _(" (invalid UTF-8)") , NULL ); g_free(convert_str); } title = g_path_get_basename (filename_utf8); gtk_window_set_title( GTK_WINDOW(fileinfowin) , title); g_free(title); /* set the text for the filename header too */ gtk_entry_set_text( GTK_ENTRY(title_name_v_entry) , filename_utf8 ); gtk_editable_set_position( GTK_EDITABLE(title_name_v_entry) , -1 ); g_free(filename_utf8); g_free(filename); gtk_widget_grab_focus( GTK_WIDGET(footer_bclose) ); gtk_widget_show_all( fileinfowin ); }
void banlist_opengui (struct session *sess) { banlist_info *banl; int i; GtkWidget *table, *vbox, *bbox; char tbuf[256]; if (sess->type != SESS_CHANNEL || sess->channel[0] == 0) { fe_message (_("You can only open the Ban List window while in a channel tab."), FE_MSG_ERROR); return; } if (!sess->res->banlist) { sess->res->banlist = g_malloc0 (sizeof (banlist_info)); if (!sess->res->banlist) { fe_message (_("Banlist initialization failed."), FE_MSG_ERROR); return; } } banl = sess->res->banlist; if (banl->window) { mg_bring_tofront (banl->window); return; } /* New banlist for this session -- Initialize it */ banl->sess = sess; /* For each mode set its bit in capable/readable/writeable */ for (i = 0; i < MODE_CT; i++) modes[i].tester (banl, i); /* Force on the checkmark in the "Bans" box */ banl->checked = 1<<MODE_BAN; g_snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Ban List (%s)"), sess->server->servername); banl->window = mg_create_generic_tab ("BanList", tbuf, FALSE, TRUE, banlist_closegui, banl, 550, 200, &vbox, sess->server); gtkutil_destroy_on_esc (banl->window); gtk_container_set_border_width (GTK_CONTAINER (banl->window), 3); gtk_box_set_spacing (GTK_BOX (vbox), 3); /* create banlist view */ banl->treeview = banlist_treeview_new (vbox, banl); table = gtk_table_new (1, MODE_CT, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 16); gtk_box_pack_start (GTK_BOX (vbox), table, 0, 0, 0); for (i = 0; i < MODE_CT; i++) { if (!(banl->capable & 1<<i)) continue; banl->checkboxes[i] = gtk_check_button_new_with_label (_(modes[i].name)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (banl->checkboxes[i]), (banl->checked & 1<<i? TRUE: FALSE)); g_signal_connect (G_OBJECT (banl->checkboxes[i]), "toggled", G_CALLBACK (banlist_toggle), banl); gtk_table_attach (GTK_TABLE (table), banl->checkboxes[i], i+1, i+2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); } bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 0); gtk_widget_show (bbox); banl->but_remove = gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_unban, banl, _("Remove")); banl->but_crop = gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_crop, banl, _("Crop")); banl->but_clear = gtkutil_button (bbox, GTK_STOCK_CLEAR, 0, banlist_clear, banl, _("Clear")); banl->but_refresh = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, banlist_refresh, banl, _("Refresh")); banlist_do_refresh (banl); gtk_widget_show_all (banl->window); }
static SyncDialog *sync_dialog_new(void) { SyncDialog *sd; GtkWidget *dialog; GtkWidget *dialog1_vbox; GtkWidget *scrolledwindow2; GtkWidget *treeview2; GtkWidget *dialog1_action_area; GtkWidget *button8; GtkWidget *button7; GtkWidget *button6; GtkWidget *label; GtkWidget *hbox; GtkTreeViewColumn *column; GtkTreeModel *model; GtkListStore *store; GtkCellRenderer *cr_text, *cr_toggle; sd = g_new0(SyncDialog, 1); sd->sna = sync_dialog_netarea_new(); dialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(dialog), "Network Updater"); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_window_set_icon(GTK_WINDOW(dialog), icon_cache_get_pixbuf("syncmanager.png")); gtk_window_set_default_size(GTK_WINDOW(dialog), 420, 260); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); dialog1_vbox = GTK_DIALOG(dialog)->vbox; gtk_box_set_spacing(GTK_BOX(dialog1_vbox), 5); gtk_container_set_border_width(GTK_CONTAINER(dialog1_vbox), 4); gtk_widget_show(dialog1_vbox); hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(dialog1_vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new(LABEL_SYNC_DEFAULT); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_use_markup(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_box_pack_start(GTK_BOX(hbox), icon_cache_get_image("syncmanager.png"), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); gtk_widget_show_all(hbox); gtk_box_pack_start(GTK_BOX(dialog1_vbox), sd->sna->vbox, TRUE, TRUE, 0); scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow2); gtk_box_pack_start(GTK_BOX(dialog1_vbox), scrolledwindow2, TRUE, TRUE, 0); gtk_widget_set_size_request(scrolledwindow2, -1, 200); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN); store = gtk_list_store_new(3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); model = GTK_TREE_MODEL(store); treeview2 = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview2), FALSE); gtk_widget_show(treeview2); gtk_container_add(GTK_CONTAINER(scrolledwindow2), treeview2); column = gtk_tree_view_column_new(); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview2), column); cr_toggle = gtk_cell_renderer_toggle_new(); gtk_tree_view_column_pack_start(column, cr_toggle, FALSE); g_signal_connect(cr_toggle, "toggled", G_CALLBACK(sel_toggle), model); gtk_tree_view_column_add_attribute(column, cr_toggle, "active", 0); cr_text = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, cr_text, TRUE); gtk_tree_view_column_add_attribute(column, cr_text, "markup", 1); populate_store(store); dialog1_action_area = GTK_DIALOG(dialog)->action_area; gtk_widget_show(dialog1_action_area); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog1_action_area), GTK_BUTTONBOX_END); button8 = gtk_button_new_from_stock(GTK_STOCK_CANCEL); gtk_widget_show(button8); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button8, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS(button8, GTK_CAN_DEFAULT); button7 = gtk_button_new_with_mnemonic("_Synchronize"); gtk_widget_show(button7); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button7, GTK_RESPONSE_ACCEPT); GTK_WIDGET_SET_FLAGS(button7, GTK_CAN_DEFAULT); button6 = gtk_button_new_from_stock(GTK_STOCK_CLOSE); g_signal_connect(G_OBJECT(button6), "clicked", (GCallback) close_clicked, NULL); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button6, GTK_RESPONSE_ACCEPT); GTK_WIDGET_SET_FLAGS(button6, GTK_CAN_DEFAULT); sd->dialog = dialog; sd->button_sync = button7; sd->button_cancel = button8; sd->button_close = button6; sd->scroll_box = scrolledwindow2; sd->label = label; return sd; }
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), _("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, _("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, _("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, _("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 (_("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 (_("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 (_("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 (_("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, 10); 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 (_("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, 10); 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 (_("0 - None")); gtk_widget_show (_0___none1); gtk_container_add (GTK_CONTAINER (menu4), _0___none1); _1__very_low1 = gtk_menu_item_new_with_mnemonic (_("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 (_("2- Low")); gtk_widget_show (_2__low1); gtk_container_add (GTK_CONTAINER (menu4), _2__low1); _3__medium1 = gtk_menu_item_new_with_mnemonic (_("3- Medium")); gtk_widget_show (_3__medium1); gtk_container_add (GTK_CONTAINER (menu4), _3__medium1); _4__high1 = gtk_menu_item_new_with_mnemonic (_("4- High")); gtk_widget_show (_4__high1); gtk_container_add (GTK_CONTAINER (menu4), _4__high1); _5__very_high1 = gtk_menu_item_new_with_mnemonic (_("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 (_("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 (_("H263 Quantizer")); gtk_widget_show (h263_quantizer1); gtk_container_add (GTK_CONTAINER (menu5), h263_quantizer1); mpeg_quantizer1 = gtk_menu_item_new_with_mnemonic (_("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 (_("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 (_("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 (_("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 (_("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 (_("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, 10); 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, 10); 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, 10); 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, 10); 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 (_("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 (_("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 (_("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 *table2; GtkWidget *label1; GtkWidget *label2; GtkObject *spinbutton_width_adj; GtkWidget *spinbutton_width; GtkObject *spinbutton_height_adj; GtkWidget *spinbutton_height; GtkWidget *label5; GtkWidget *label6; GtkWidget *optionmenu_source; GtkWidget *menu1; GtkWidget *item1_1; GtkWidget *_4_1; GtkWidget *_16_1; GtkWidget *optionmenu_dest; GtkWidget *menu2; GtkWidget *menuitem1; GtkWidget *menuitem2; GtkWidget *menuitem3; GtkWidget *label3; GtkWidget *label_errorx; GtkWidget *label7; GtkWidget *label_errory; GtkWidget *checkbutton_16; GtkWidget *optionmenu1; GtkWidget *menu3; GtkWidget *bilinear1; GtkWidget *bicubic1; GtkWidget *lanczos1; GtkWidget *alignment1; GtkWidget *fixed1; GtkWidget *fixed2; GtkWidget *hscale1; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *applybutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Resize")); gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG); 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); table2 = gtk_table_new (4, 4, FALSE); gtk_widget_show (table2); gtk_box_pack_start (GTK_BOX (vbox1), table2, FALSE, FALSE, 0); label1 = gtk_label_new (QT_TR_NOOP(" Width ")); gtk_widget_show (label1); gtk_table_attach (GTK_TABLE (table2), 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(" Height ")); gtk_widget_show (label2); gtk_table_attach (GTK_TABLE (table2), label2, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5); spinbutton_width_adj = gtk_adjustment_new (2, 0, 3000, 1, 10, 10); spinbutton_width = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_width_adj), 1, 0); gtk_widget_show (spinbutton_width); gtk_table_attach (GTK_TABLE (table2), spinbutton_width, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton_width), TRUE); spinbutton_height_adj = gtk_adjustment_new (1, 0, 3000, 1, 10, 10); spinbutton_height = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_height_adj), 1, 0); gtk_widget_show (spinbutton_height); gtk_table_attach (GTK_TABLE (table2), spinbutton_height, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton_height), TRUE); label5 = gtk_label_new (QT_TR_NOOP("Source :")); gtk_widget_show (label5); gtk_table_attach (GTK_TABLE (table2), label5, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); label6 = gtk_label_new (QT_TR_NOOP("Destination")); gtk_widget_show (label6); gtk_table_attach (GTK_TABLE (table2), label6, 2, 3, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); optionmenu_source = gtk_option_menu_new (); gtk_widget_show (optionmenu_source); gtk_table_attach (GTK_TABLE (table2), optionmenu_source, 3, 4, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); menu1 = gtk_menu_new (); item1_1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("1:1")); gtk_widget_show (item1_1); gtk_container_add (GTK_CONTAINER (menu1), item1_1); _4_1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("4:3")); gtk_widget_show (_4_1); gtk_container_add (GTK_CONTAINER (menu1), _4_1); _16_1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("16:9")); gtk_widget_show (_16_1); gtk_container_add (GTK_CONTAINER (menu1), _16_1); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_source), menu1); optionmenu_dest = gtk_option_menu_new (); gtk_widget_show (optionmenu_dest); gtk_table_attach (GTK_TABLE (table2), optionmenu_dest, 3, 4, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); menu2 = gtk_menu_new (); menuitem1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("1:1")); gtk_widget_show (menuitem1); gtk_container_add (GTK_CONTAINER (menu2), menuitem1); menuitem2 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("4:3")); gtk_widget_show (menuitem2); gtk_container_add (GTK_CONTAINER (menu2), menuitem2); menuitem3 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("16:9")); gtk_widget_show (menuitem3); gtk_container_add (GTK_CONTAINER (menu2), menuitem3); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_dest), menu2); label3 = gtk_label_new (QT_TR_NOOP(" Error X:")); gtk_widget_show (label3); gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5); label_errorx = gtk_label_new (QT_TR_NOOP("0")); gtk_widget_show (label_errorx); gtk_table_attach (GTK_TABLE (table2), label_errorx, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_errorx), 0, 0.5); label7 = gtk_label_new (QT_TR_NOOP(" Error Y:")); gtk_widget_show (label7); gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); label_errory = gtk_label_new (QT_TR_NOOP("0")); gtk_widget_show (label_errory); gtk_table_attach (GTK_TABLE (table2), label_errory, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_errory), 0, 0.5); checkbutton_16 = gtk_check_button_new_with_mnemonic (QT_TR_NOOP("16 round up")); gtk_widget_show (checkbutton_16); gtk_table_attach (GTK_TABLE (table2), checkbutton_16, 3, 4, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); optionmenu1 = gtk_option_menu_new (); gtk_widget_show (optionmenu1); gtk_table_attach (GTK_TABLE (table2), optionmenu1, 3, 4, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); menu3 = gtk_menu_new (); bilinear1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("Bilinear")); gtk_widget_show (bilinear1); gtk_container_add (GTK_CONTAINER (menu3), bilinear1); bicubic1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("Bicubic")); gtk_widget_show (bicubic1); gtk_container_add (GTK_CONTAINER (menu3), bicubic1); lanczos1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("Lanczos3")); gtk_widget_show (lanczos1); gtk_container_add (GTK_CONTAINER (menu3), lanczos1); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu1), menu3); alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment1); gtk_table_attach (GTK_TABLE (table2), alignment1, 2, 3, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); fixed1 = gtk_fixed_new (); gtk_widget_show (fixed1); gtk_container_add (GTK_CONTAINER (alignment1), fixed1); fixed2 = gtk_fixed_new (); gtk_widget_show (fixed2); gtk_table_attach (GTK_TABLE (table2), fixed2, 2, 3, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (100, 0, 100, 1, 1, 0))); gtk_widget_show (hscale1); gtk_box_pack_start (GTK_BOX (vbox1), hscale1, FALSE, FALSE, 0); gtk_scale_set_digits (GTK_SCALE (hscale1), 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); applybutton1 = gtk_button_new_from_stock ("gtk-apply"); gtk_widget_show (applybutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), 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 (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); /* g_signal_connect ((gpointer) _4_1, "activate", G_CALLBACK (on_4_1_activate), NULL); g_signal_connect ((gpointer) _16_1, "activate", G_CALLBACK (on_16_1_activate), NULL); g_signal_connect ((gpointer) menuitem2, "activate", G_CALLBACK (on_4_1_activate), NULL); g_signal_connect ((gpointer) menuitem3, "activate", G_CALLBACK (on_16_1_activate), NULL); g_signal_connect ((gpointer) bilinear1, "activate", G_CALLBACK (on_bilinear1_activate), NULL); g_signal_connect ((gpointer) bicubic1, "activate", G_CALLBACK (on_bicubic1_activate), NULL); g_signal_connect ((gpointer) lanczos1, "activate", G_CALLBACK (on_lanczos1_activate), NULL); */ /* 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, table2, "table2"); GLADE_HOOKUP_OBJECT (dialog1, label1, "label1"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT (dialog1, spinbutton_width, "spinbutton_width"); GLADE_HOOKUP_OBJECT (dialog1, spinbutton_height, "spinbutton_height"); GLADE_HOOKUP_OBJECT (dialog1, label5, "label5"); GLADE_HOOKUP_OBJECT (dialog1, label6, "label6"); GLADE_HOOKUP_OBJECT (dialog1, optionmenu_source, "optionmenu_source"); GLADE_HOOKUP_OBJECT (dialog1, menu1, "menu1"); GLADE_HOOKUP_OBJECT (dialog1, item1_1, "item1_1"); GLADE_HOOKUP_OBJECT (dialog1, _4_1, "_4_1"); GLADE_HOOKUP_OBJECT (dialog1, _16_1, "_16_1"); GLADE_HOOKUP_OBJECT (dialog1, optionmenu_dest, "optionmenu_dest"); GLADE_HOOKUP_OBJECT (dialog1, menu2, "menu2"); GLADE_HOOKUP_OBJECT (dialog1, menuitem1, "menuitem1"); GLADE_HOOKUP_OBJECT (dialog1, menuitem2, "menuitem2"); GLADE_HOOKUP_OBJECT (dialog1, menuitem3, "menuitem3"); GLADE_HOOKUP_OBJECT (dialog1, label3, "label3"); GLADE_HOOKUP_OBJECT (dialog1, label_errorx, "label_errorx"); GLADE_HOOKUP_OBJECT (dialog1, label7, "label7"); GLADE_HOOKUP_OBJECT (dialog1, label_errory, "label_errory"); GLADE_HOOKUP_OBJECT (dialog1, checkbutton_16, "checkbutton_16"); GLADE_HOOKUP_OBJECT (dialog1, optionmenu1, "optionmenu1"); GLADE_HOOKUP_OBJECT (dialog1, menu3, "menu3"); GLADE_HOOKUP_OBJECT (dialog1, bilinear1, "bilinear1"); GLADE_HOOKUP_OBJECT (dialog1, bicubic1, "bicubic1"); GLADE_HOOKUP_OBJECT (dialog1, lanczos1, "lanczos1"); GLADE_HOOKUP_OBJECT (dialog1, alignment1, "alignment1"); GLADE_HOOKUP_OBJECT (dialog1, fixed1, "fixed1"); GLADE_HOOKUP_OBJECT (dialog1, fixed2, "fixed2"); GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, applybutton1, "applybutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }
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, 0); 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, 0); 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, 0))); 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; }
int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *hbox, *vbox; GtkWidget *vbox2, *bbox; GtkWidget *button; GtkTreeViewColumn *column; GtkCellRenderer *cell; GtkWidget *swindow; GtkTreeModel *sample_model; GdkContentFormats *targets; gint i; gtk_init (); /* First initialize all the models for signal purposes */ left_tree_model = (GtkTreeModel *) gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); sample_model = (GtkTreeModel *) gtk_list_store_new (1, G_TYPE_STRING); sample_tree_view_top = gtk_tree_view_new_with_model (sample_model); sample_tree_view_bottom = gtk_tree_view_new_with_model (sample_model); top_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_top)); bottom_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_bottom)); top_right_tree_view = gtk_tree_view_new_with_model (top_right_tree_model); bottom_right_tree_view = gtk_tree_view_new_with_model (bottom_right_tree_model); for (i = 0; i < 10; i++) { GtkTreeIter iter; gchar *string = g_strdup_printf ("%d", i); gtk_list_store_append (GTK_LIST_STORE (sample_model), &iter); gtk_list_store_set (GTK_LIST_STORE (sample_model), &iter, 0, string, -1); g_free (string); } /* Set up the test windows. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_default_size (GTK_WINDOW (window), 300, 300); gtk_window_set_title (GTK_WINDOW (window), "Top Window"); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (window), swindow); gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_top); gtk_widget_show (window); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_default_size (GTK_WINDOW (window), 300, 300); gtk_window_set_title (GTK_WINDOW (window), "Bottom Window"); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (window), swindow); gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_bottom); gtk_widget_show (window); /* Set up the main window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_default_size (GTK_WINDOW (window), 500, 300); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); gtk_container_add (GTK_CONTAINER (window), vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox); /* Left Pane */ cell = gtk_cell_renderer_text_new (); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); left_tree_view = gtk_tree_view_new_with_model (left_tree_model); gtk_container_add (GTK_CONTAINER (swindow), left_tree_view); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (left_tree_view), -1, "Unattached Columns", cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), left_tree_view); column = gtk_tree_view_column_new_with_attributes ("Visible", cell, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_box_pack_start (GTK_BOX (hbox), swindow); /* Middle Pane */ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); gtk_box_pack_start (GTK_BOX (hbox), vbox2); bbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start (GTK_BOX (vbox2), bbox); button = gtk_button_new_with_mnemonic ("<< (_Q)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), top_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (top_right_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button); button = gtk_button_new_with_mnemonic (">> (_W)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), top_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button); bbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start (GTK_BOX (vbox2), bbox); button = gtk_button_new_with_mnemonic ("<< (_E)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), bottom_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (bottom_right_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button); button = gtk_button_new_with_mnemonic (">> (_R)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), bottom_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button); /* Right Pane */ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); gtk_box_pack_start (GTK_BOX (hbox), vbox2); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (top_right_tree_view), FALSE); cell = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (top_right_tree_view), -1, NULL, cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), top_right_tree_view); column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column); gtk_container_add (GTK_CONTAINER (swindow), top_right_tree_view); gtk_box_pack_start (GTK_BOX (vbox2), swindow); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (bottom_right_tree_view), FALSE); cell = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (bottom_right_tree_view), -1, NULL, cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), bottom_right_tree_view); column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (bottom_right_tree_view), column); gtk_container_add (GTK_CONTAINER (swindow), bottom_right_tree_view); gtk_box_pack_start (GTK_BOX (vbox2), swindow); /* Drag and Drop */ targets = gdk_content_formats_new (row_targets, G_N_ELEMENTS (row_targets)); gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (left_tree_view), GDK_BUTTON1_MASK, targets, GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (left_tree_view), targets, GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (top_right_tree_view), GDK_BUTTON1_MASK, targets, GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (top_right_tree_view), targets, GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (bottom_right_tree_view), GDK_BUTTON1_MASK, targets, GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (bottom_right_tree_view), targets, GDK_ACTION_MOVE); gdk_content_formats_unref (targets); gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox); button = gtk_button_new_with_mnemonic ("_Add new Column"); g_signal_connect (button, "clicked", G_CALLBACK (add_clicked), left_tree_model); gtk_box_pack_start (GTK_BOX (hbox), button); gtk_widget_show (window); gtk_main (); return 0; }
static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpointer data) { ThemesPage *prefs_themes = (ThemesPage *)page; ThemesData *tdata = prefs_themes_data; GtkWidget *vbox1; GtkWidget *frame1; GtkWidget *vbox2; GtkWidget *hbox3; GtkWidget *menu_themes; GtkWidget *btn_install; GtkWidget *btn_more; GtkWidget *label_global_status; GtkWidget *frame_info; GtkWidget *table1; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *label_name; GtkWidget *label_author; GtkWidget *label_url; GtkWidget *label4; GtkWidget *label_status; GtkWidget *frame_preview; GtkWidget *hbox1; GtkWidget *icon_1; GtkWidget *icon_2; GtkWidget *icon_3; GtkWidget *icon_4; GtkWidget *icon_5; GtkWidget *icon_6; GtkWidget *icon_7; GtkWidget *frame_buttons; GtkWidget *hbuttonbox1; GtkWidget *btn_remove; GtkCellRenderer *renderer; vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); gtk_widget_show (vbox1); vbox2 = gtkut_get_options_frame(vbox1, &frame1, _("Selector")); hbox3 = gtk_hbox_new (FALSE, 5); gtk_widget_show (hbox3); gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox3), 5); menu_themes = gtk_combo_box_new(); gtk_widget_show (menu_themes); gtk_box_pack_start (GTK_BOX (hbox3), menu_themes, FALSE, FALSE, 0); btn_install = gtk_button_new_with_label (_("Install new...")); gtk_widget_show (btn_install); gtk_box_pack_start (GTK_BOX (hbox3), btn_install, FALSE, FALSE, 0); gtkut_widget_set_can_default (btn_install, TRUE); btn_more = gtkut_get_link_btn((GtkWidget *)window, THEMES_URI, _("Get more...")); gtk_widget_show (btn_more); gtk_box_pack_start (GTK_BOX (hbox3), btn_more, FALSE, FALSE, 0); label_global_status = gtk_label_new (""); gtk_widget_show (label_global_status); gtk_box_pack_start (GTK_BOX (vbox2), label_global_status, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label_global_status), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label_global_status), 0, 0.5); gtk_misc_set_padding (GTK_MISC (label_global_status), 6, 0); PACK_FRAME(vbox1, frame_info, _("Information")); table1 = gtk_table_new (4, 2, FALSE); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (frame_info), table1); label1 = gtk_label_new (_("Name: ")); gtk_widget_show (label1); gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 8, 2); gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); label2 = gtk_label_new (_("Author: ")); gtk_widget_show (label2); gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 8, 2); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5); label3 = gtk_label_new (_("URL:")); gtk_widget_show (label3); gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 8, 2); gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5); label_name = gtk_label_new (""); gtk_widget_show (label_name); gtk_table_attach (GTK_TABLE (table1), label_name, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_name), 0, 0.5); label_author = gtk_label_new (""); gtk_widget_show (label_author); gtk_table_attach (GTK_TABLE (table1), label_author, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_author), 0, 0.5); label_url = gtk_label_new (""); gtk_widget_show (label_url); gtk_table_attach (GTK_TABLE (table1), label_url, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_url), 0, 0.5); label4 = gtk_label_new (_("Status:")); gtk_widget_show (label4); gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 8, 2); gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); label_status = gtk_label_new (""); gtk_widget_show (label_status); gtk_table_attach (GTK_TABLE (table1), label_status, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_status), 0, 0.5); PACK_FRAME(vbox1, frame_preview, _("Preview")); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_container_add (GTK_CONTAINER (frame_preview), hbox1); icon_1 = gtk_image_new(); gtk_widget_show (icon_1); gtk_box_pack_start (GTK_BOX (hbox1), icon_1, TRUE, TRUE, 2); gtk_misc_set_padding (GTK_MISC (icon_1), 0, 5); icon_2 = gtk_image_new(); gtk_widget_show (icon_2); gtk_box_pack_start (GTK_BOX (hbox1), icon_2, TRUE, TRUE, 2); gtk_misc_set_padding (GTK_MISC (icon_2), 0, 5); icon_3 = gtk_image_new(); gtk_widget_show (icon_3); gtk_box_pack_start (GTK_BOX (hbox1), icon_3, TRUE, TRUE, 2); gtk_misc_set_padding (GTK_MISC (icon_3), 0, 5); icon_4 = gtk_image_new(); gtk_widget_show (icon_4); gtk_box_pack_start (GTK_BOX (hbox1), icon_4, TRUE, TRUE, 2); gtk_misc_set_padding (GTK_MISC (icon_4), 0, 5); icon_5 = gtk_image_new(); gtk_widget_show (icon_5); gtk_box_pack_start (GTK_BOX (hbox1), icon_5, TRUE, TRUE, 2); gtk_misc_set_padding (GTK_MISC (icon_5), 0, 5); icon_6 = gtk_image_new(); gtk_widget_show (icon_6); gtk_box_pack_start (GTK_BOX (hbox1), icon_6, TRUE, TRUE, 0); gtk_misc_set_padding (GTK_MISC (icon_6), 0, 5); icon_7 = gtk_image_new(); gtk_widget_show (icon_7); gtk_box_pack_start (GTK_BOX (hbox1), icon_7, TRUE, TRUE, 0); gtk_misc_set_padding (GTK_MISC (icon_7), 0, 5); PACK_FRAME(vbox1, frame_buttons, _("Actions")); hbuttonbox1 = gtk_hbutton_box_new (); gtk_widget_show (hbuttonbox1); gtk_container_add (GTK_CONTAINER (frame_buttons), hbuttonbox1); gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox1), 5); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_START); gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 5); btn_remove = gtk_button_new_with_label (_("Remove")); gtk_widget_show (btn_remove); gtk_container_add (GTK_CONTAINER (hbuttonbox1), btn_remove); gtkut_widget_set_can_default (btn_remove, TRUE); g_signal_connect(G_OBJECT(btn_remove), "clicked", G_CALLBACK(prefs_themes_btn_remove_clicked_cb), NULL); g_signal_connect(G_OBJECT(btn_install), "clicked", G_CALLBACK(prefs_themes_btn_install_clicked_cb), NULL); prefs_themes->window = GTK_WIDGET(window); prefs_themes->name = label_name; prefs_themes->author = label_author; prefs_themes->url = label_url; prefs_themes->status = label_status; prefs_themes->global = label_global_status; prefs_themes->icons[0] = icon_1; prefs_themes->icons[1] = icon_2; prefs_themes->icons[2] = icon_3; prefs_themes->icons[3] = icon_4; prefs_themes->icons[4] = icon_5; prefs_themes->icons[5] = icon_6; prefs_themes->icons[6] = icon_7; prefs_themes->btn_remove = btn_remove; prefs_themes->btn_install = btn_install; prefs_themes->btn_more = btn_more; prefs_themes->op_menu = menu_themes; prefs_themes->page.widget = vbox1; prefs_themes_set_themes_menu(GTK_COMBO_BOX(menu_themes), tdata); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(menu_themes), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(menu_themes), renderer, "text", 0, NULL); prefs_themes_get_theme_info(tdata); prefs_themes_display_global_stats(tdata); }