示例#1
0
文件: project.c 项目: Nordvind/geany
static void insert_build_page(PropertyDialogElements *e)
{
	GtkWidget *build_table, *label;
	GeanyDocument *doc = document_get_current();
	GeanyFiletype *ft = NULL;

	if (doc != NULL)
		ft = doc->file_type;

	build_table = build_commands_table(doc, GEANY_BCS_PROJ, &(e->build_properties), ft);
	gtk_container_set_border_width(GTK_CONTAINER(build_table), 6);
	label = gtk_label_new(_("Build"));
	e->build_page_num = gtk_notebook_append_page(GTK_NOTEBOOK(e->notebook),
		build_table, label);
}
示例#2
0
文件: project.c 项目: cirne100/geany
static void create_properties_dialog(PropertyDialogElements *e)
{
	GtkWidget *table, *notebook, *build_table;
	GtkWidget *bbox;
	GtkWidget *label;
	GtkWidget *swin;
	GeanyDocument *doc = document_get_current();
	GeanyFiletype *ft = NULL;

	e->dialog = create_project_dialog();
	gtk_window_set_transient_for(GTK_WINDOW(e->dialog), GTK_WINDOW(main_widgets.window));
	gtk_window_set_destroy_with_parent(GTK_WINDOW(e->dialog), TRUE);
	gtk_widget_set_name(e->dialog, "GeanyDialogProject");

	ui_entry_add_clear_icon(GTK_ENTRY(ui_lookup_widget(e->dialog, "spin_indent_width")));

	table = gtk_table_new(5, 2, FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(table), 6);
	gtk_table_set_row_spacings(GTK_TABLE(table), 5);
	gtk_table_set_col_spacings(GTK_TABLE(table), 10);

	label = gtk_label_new(_("Filename:"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);

	e->file_name = gtk_label_new("");
	gtk_label_set_selectable(GTK_LABEL(e->file_name), TRUE);
	gtk_table_attach(GTK_TABLE(table), e->file_name, 1, 2, 0, 1,
					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment(GTK_MISC(e->file_name), 0, 0);

	label = gtk_label_new(_("Name:"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);

	e->name = gtk_entry_new();
	ui_entry_add_clear_icon(GTK_ENTRY(e->name));
	gtk_entry_set_max_length(GTK_ENTRY(e->name), MAX_NAME_LEN);
	gtk_table_attach(GTK_TABLE(table), e->name, 1, 2, 1, 2,
					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);

	label = gtk_label_new(_("Description:"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (GTK_FILL), 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);

	e->description = gtk_text_view_new();
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(e->description), GTK_WRAP_WORD);
	swin = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_set_size_request(swin, 250, 80);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
				GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), GTK_WIDGET(e->description));
	gtk_table_attach(GTK_TABLE(table), swin, 1, 2, 2, 3,
					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);

	label = gtk_label_new(_("Base path:"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);

	e->base_path = gtk_entry_new();
	ui_entry_add_clear_icon(GTK_ENTRY(e->base_path));
	gtk_widget_set_tooltip_text(e->base_path,
		_("Base directory of all files that make up the project. "
		"This can be a new path, or an existing directory tree. "
		"You can use paths relative to the project filename."));
	bbox = ui_path_box_new(_("Choose Project Base Path"),
		GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
	gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 3, 4,
					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);

	if (doc != NULL) ft = doc->file_type;
	build_table = build_commands_table(doc, GEANY_BCS_PROJ, &(e->build_properties), ft);
	gtk_container_set_border_width(GTK_CONTAINER(build_table), 6);
	label = gtk_label_new(_("Build"));
	notebook = ui_lookup_widget(e->dialog, "project_notebook");
	build_page_num = gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), build_table, label, 2);
	e->notebook = notebook;

	g_signal_connect(ui_lookup_widget(e->dialog, "radio_long_line_custom"), "toggled",
		G_CALLBACK(on_radio_long_line_custom_toggled), ui_lookup_widget(e->dialog, "spin_long_line"));

	label = gtk_label_new(_("File patterns:"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);

	e->patterns = gtk_entry_new();
	gtk_widget_set_tooltip_text(e->patterns,
		_("Space separated list of file patterns used for the find in files dialog "
		  "(e.g. *.c *.h)"));
	gtk_table_attach(GTK_TABLE(table), e->patterns, 1, 2, 4, 5,
					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
					(GtkAttachOptions) (0), 0, 0);

	label = gtk_label_new(_("Project"));
	gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), table, label, 0);
	build_page_num++;
}