Ejemplo n.º 1
0
void msgwin_show_hide(gboolean show)
{
	ui_prefs.msgwindow_visible = show;
	ignore_callback = TRUE;
	gtk_check_menu_item_set_active(
		GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, "menu_show_messages_window1")),
		show);
	ignore_callback = FALSE;
	ui_widget_show_hide(ui_lookup_widget(main_widgets.window, "scrolledwindow1"), show);
	/* set the input focus back to the editor */
	keybindings_send_command(GEANY_KEY_GROUP_FOCUS, GEANY_KEYS_FOCUS_EDITOR);
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: P-Ruiz/geany
/* special things for the initial setup of the checkboxes and related stuff
 * an action on a setting is only performed if the setting is not equal to the program default
 * (all the following code is not perfect but it works for the moment) */
static void apply_settings(void)
{
	ui_update_fold_items();

	/* toolbar, message window and sidebar are by default visible, so don't change it if it is true */
	toolbar_show_hide();
	if (! ui_prefs.msgwindow_visible)
	{
		ignore_callback = TRUE;
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, "menu_show_messages_window1")), FALSE);
		gtk_widget_hide(ui_lookup_widget(main_widgets.window, "scrolledwindow1"));
		ignore_callback = FALSE;
	}
	if (! ui_prefs.sidebar_visible)
	{
		ignore_callback = TRUE;
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, "menu_show_sidebar1")), FALSE);
		ignore_callback = FALSE;
	}

	toolbar_apply_settings();
	toolbar_update_ui();

	ui_update_view_editor_menu_items();

	/* hide statusbar if desired */
	if (! interface_prefs.statusbar_visible)
	{
		gtk_widget_hide(ui_widgets.statusbar);
	}

	/* set the tab placements of the notebooks */
	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.tab_pos_editor);
	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), interface_prefs.tab_pos_msgwin);
	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.sidebar_notebook), interface_prefs.tab_pos_sidebar);

	/* whether to show notebook tabs or not */
	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);

#ifdef HAVE_VTE
	if (! vte_info.have_vte)
#endif
	{
		gtk_widget_set_sensitive(
			ui_lookup_widget(main_widgets.window, "send_selection_to_vte1"), FALSE);
	}

	if (interface_prefs.sidebar_pos != GTK_POS_LEFT)
		ui_swap_sidebar_pos();

	gtk_orientable_set_orientation(GTK_ORIENTABLE(ui_lookup_widget(main_widgets.window, "vpaned1")),
		interface_prefs.msgwin_orientation);
}
Ejemplo n.º 3
0
void vte_append_preferences_tab(void)
{
	if (vte_info.have_vte)
	{
		GtkWidget *frame_term, *button_shell, *entry_shell;
		GtkWidget *check_run_in_vte, *check_skip_script;
		GtkWidget *font_button, *fg_color_button, *bg_color_button;

		button_shell = GTK_WIDGET(ui_lookup_widget(ui_widgets.prefs_dialog, "button_term_shell"));
		entry_shell = GTK_WIDGET(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_shell"));
		ui_setup_open_button_callback(button_shell, NULL,
			GTK_FILE_CHOOSER_ACTION_OPEN, GTK_ENTRY(entry_shell));

		check_skip_script = GTK_WIDGET(ui_lookup_widget(ui_widgets.prefs_dialog, "check_skip_script"));
		gtk_widget_set_sensitive(check_skip_script, vc->run_in_vte);

		check_run_in_vte = GTK_WIDGET(ui_lookup_widget(ui_widgets.prefs_dialog, "check_run_in_vte"));
		g_signal_connect(G_OBJECT(check_run_in_vte), "toggled",
			G_CALLBACK(on_check_run_in_vte_toggled), check_skip_script);

		font_button = ui_lookup_widget(ui_widgets.prefs_dialog, "font_term");
		g_signal_connect(font_button, "font-set",  G_CALLBACK(on_term_font_set), NULL);

		fg_color_button = ui_lookup_widget(ui_widgets.prefs_dialog, "color_fore");
		g_signal_connect(fg_color_button, "color-set", G_CALLBACK(on_term_fg_color_set), NULL);

		bg_color_button = ui_lookup_widget(ui_widgets.prefs_dialog, "color_back");
		g_signal_connect(bg_color_button, "color-set", G_CALLBACK(on_term_bg_color_set), NULL);

		frame_term = ui_lookup_widget(ui_widgets.prefs_dialog, "frame_term");
		gtk_widget_show_all(frame_term);
	}
}
Ejemplo n.º 4
0
static void vte_popup_menu_clicked(GtkMenuItem *menuitem, gpointer user_data)
{
	switch (GPOINTER_TO_INT(user_data))
	{
		case POPUP_COPY:
		{
			if (vf->vte_terminal_get_has_selection(VTE_TERMINAL(vc->vte)))
				vf->vte_terminal_copy_clipboard(VTE_TERMINAL(vc->vte));
			break;
		}
		case POPUP_PASTE:
		{
			vf->vte_terminal_paste_clipboard(VTE_TERMINAL(vc->vte));
			break;
		}
		case POPUP_SELECTALL:
		{
			vte_select_all();
			break;
		}
		case POPUP_CHANGEPATH:
		{
			GeanyDocument *doc = document_get_current();
			if (doc != NULL)
				vte_cwd(doc->file_name, TRUE);
			break;
		}
		case POPUP_RESTARTTERMINAL:
		{
			vte_restart(vc->vte);
			break;
		}
		case POPUP_PREFERENCES:
		{
			GtkWidget *notebook, *tab_page;

			prefs_show_dialog();

			notebook = ui_lookup_widget(ui_widgets.prefs_dialog, "notebook2");
			tab_page = ui_lookup_widget(ui_widgets.prefs_dialog, "frame_term");

			gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook),
				gtk_notebook_page_num(GTK_NOTEBOOK(notebook), GTK_WIDGET(tab_page)));

			break;
		}
	}
}
Ejemplo n.º 5
0
/* ---------------------------------------------------------------------
 * Initialization
 * ---------------------------------------------------------------------
 */
void
goto_file_init(void)
{
	GtkWidget* edit_menu;

	log_func();

	edit_menu = ui_lookup_widget(geany->main_widgets->window, "edit1_menu");

	/* Add the menu item, sensitive only when a document is opened */
	menu_item = gtk_menu_item_new_with_mnemonic(_("Go to File..."));
	gtk_widget_show(menu_item);
	gtk_container_add(GTK_CONTAINER(edit_menu), menu_item);
	ui_add_document_sensitive(menu_item);

	/* Callback connection */
	g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(menu_item_activate), NULL);

	/* Initialize the key binding : */
	keybindings_set_item(	plugin_key_group,
 							KEY_ID_GOTO_FILE,
 							(GeanyKeyCallback)(&menu_item_activate),
 							GDK_g, GDK_MOD1_MASK | GDK_SHIFT_MASK,
 							"goto_file",
 							_("Go to File"),	/* used in the Preferences dialog */
 							menu_item);
}
Ejemplo n.º 6
0
/* ---------------------------------------------------------------------
 *  Initialization
 * ---------------------------------------------------------------------
 */
void
switch_head_impl_init()
{
	log_func();

	GtkWidget* edit_menu = ui_lookup_widget(geany->main_widgets->window, "edit1_menu");

	/* Add the menu item and make it sensitive only when a document is opened */
	menu_item = gtk_menu_item_new_with_mnemonic(_("Switch header/implementation"));
	gtk_widget_show(menu_item);
	gtk_container_add(GTK_CONTAINER(edit_menu), menu_item);
	ui_add_document_sensitive(menu_item);

	/* Callback connection */
	g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(menu_item_activate), NULL);

	/* Initialize the key binding : */
	keybindings_set_item(	plugin_key_group,
 							KEY_ID_SWITCH_HEAD_IMPL,
 							(GeanyKeyCallback)(&menu_item_activate),
 							GDK_s, GDK_MOD1_MASK | GDK_SHIFT_MASK,
 							"switch_head_impl",
 							_("Switch header/implementation"),	/* used in the Preferences dialog */
 							menu_item);

	/* TODO : we should use the languages specified by the user or the default list */
	fill_default_languages_list();
}
Ejemplo n.º 7
0
static void create_set_filetype_menu(gboolean config)
{
	GtkWidget *group_menus[GEANY_FILETYPE_GROUP_COUNT] = {NULL};
	GSList *node;
	GtkWidget *menu;

	menu = config ? ui_widgets.config_files_filetype_menu :
		ui_lookup_widget(main_widgets.window, "set_filetype1_menu");

	group_menus[GEANY_FILETYPE_GROUP_COMPILED] = create_sub_menu(menu, _("_Programming Languages"));
	group_menus[GEANY_FILETYPE_GROUP_SCRIPT] = create_sub_menu(menu, _("_Scripting Languages"));
	group_menus[GEANY_FILETYPE_GROUP_MARKUP] = create_sub_menu(menu, _("_Markup Languages"));
	group_menus[GEANY_FILETYPE_GROUP_MISC] = create_sub_menu(menu, _("M_iscellaneous"));

	/* Append all filetypes to the menu */
	foreach_slist(node, filetypes_by_title)
	{
		GeanyFiletype *ft = node->data;
		GtkWidget *parent = (ft->group != GEANY_FILETYPE_GROUP_NONE) ? group_menus[ft->group] : menu;

		/* we already have filetypes.common config entry */
		if (config && ft->id == GEANY_FILETYPES_NONE)
			continue;

		if (config)
		{
			gchar *filename = filetypes_get_filename(ft, TRUE);

			ui_add_config_file_menu_item(filename, NULL, GTK_CONTAINER(parent));
			g_free(filename);
		}
		else
			create_radio_menu_item(parent, ft);
	}
Ejemplo n.º 8
0
void
plugin_configure_single(G_GNUC_UNUSED GtkWidget * parent)
{
	int ret;
	GtkWidget *dialog;
	GtkWidget *cbTypes;
	GKeyFile *config;
	gchar *current;

	/* example configuration dialog */
	dialog = create_Configure();
	init_Configure(dialog);

	cbTypes = ui_lookup_widget(dialog, "comboboxType");

	/* run the dialog and check for the response code */

	ret = gtk_dialog_run(GTK_DIALOG(dialog));
	config = (GKeyFile *) g_object_get_data(G_OBJECT(cbTypes), "config");
	current = g_object_get_data(G_OBJECT(cbTypes), "current");
	if (ret == GTK_RESPONSE_OK)
	{
		on_comboboxType_changed(GTK_COMBO_BOX(cbTypes), NULL);
		config_set(config);
	}
	else
	{
		g_key_file_free(config);
	}
	g_free(current);
	gtk_widget_destroy(dialog);
}
Ejemplo n.º 9
0
/* Initialize project-related preferences in the Preferences dialog. */
void project_setup_prefs(void)
{
	GtkWidget *path_entry = ui_lookup_widget(ui_widgets.prefs_dialog, "project_file_path_entry");
	GtkWidget *path_btn = ui_lookup_widget(ui_widgets.prefs_dialog, "project_file_path_button");
	static gboolean callback_setup = FALSE;

	g_return_if_fail(local_prefs.project_file_path != NULL);

	gtk_entry_set_text(GTK_ENTRY(path_entry), local_prefs.project_file_path);
	if (! callback_setup)
	{	/* connect the callback only once */
		callback_setup = TRUE;
		ui_setup_open_button_callback(path_btn, NULL,
			GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(path_entry));
	}
}
Ejemplo n.º 10
0
/* adds the menu item in the editor's popup menu */
static void
add_edit_menu_item (PluginData *pdata)
{
  GtkWidget *parent_menu;
  
  parent_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (
    ui_lookup_widget (geany->main_widgets->editor_menu, "comments")));
  if (! parent_menu) {
    parent_menu = geany->main_widgets->editor_menu;
    pdata->separator_item = gtk_separator_menu_item_new ();
    gtk_menu_shell_append (GTK_MENU_SHELL (parent_menu), pdata->separator_item);
    gtk_widget_show (pdata->separator_item);
  }
  pdata->edit_menu_item = gtk_menu_item_new_with_label (_("Insert Documentation Comment"));
  pdata->edit_menu_item_hid = g_signal_connect (pdata->edit_menu_item, "activate",
                                                G_CALLBACK (editor_menu_acivated_handler),
                                                pdata);
  gtk_menu_shell_append (GTK_MENU_SHELL (parent_menu), pdata->edit_menu_item);
  gtk_widget_show (pdata->edit_menu_item);
  /* make item document-presence sensitive */
  ui_add_document_sensitive (pdata->edit_menu_item);
  /* and attach a keybinding */
  keybindings_set_item (pdata->kb_group, KB_INSERT, insert_comment_keybinding_handler,
                        GDK_d, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
                        "instert_doc", _("Insert Documentation Comment"),
                        pdata->edit_menu_item);
}
Ejemplo n.º 11
0
GtkWidget *plugme_ui_add_config_file_menu_item(const gchar *real_path, const gchar *label,
		GtkContainer *parent)
{
	GtkWidget *item;

	if (!parent)
	{
		item = ui_lookup_widget(geany->main_widgets->window, "configuration_files1");
		parent = GTK_CONTAINER(gtk_menu_item_get_submenu(GTK_MENU_ITEM(item)));
	}

	if (!label)
	{
		gchar *base_name;

		base_name = g_path_get_basename(real_path);
		item = gtk_menu_item_new_with_label(base_name);
		g_free(base_name);
	}
	else
		item = gtk_menu_item_new_with_mnemonic(label);

	gtk_widget_show(item);
	gtk_container_add(parent, item);
	g_signal_connect_data(item, "activate", G_CALLBACK(on_config_file_clicked),
			g_strdup(real_path), free_on_closure_notify, 0);

	return item;
}
Ejemplo n.º 12
0
/* Update project-related preferences after using the Preferences dialog. */
void project_apply_prefs(void)
{
	GtkWidget *path_entry = ui_lookup_widget(ui_widgets.prefs_dialog, "project_file_path_entry");
	const gchar *str;

	str = gtk_entry_get_text(GTK_ENTRY(path_entry));
	SETPTR(local_prefs.project_file_path, g_strdup(str));
}
Ejemplo n.º 13
0
static void
overview_ui_add_menu_item (void)
{
  static const gchar *view_menu_name = "menu_view1_menu";
  static const gchar *prev_item_name = "menu_show_sidebar1";
  GtkWidget          *main_window = geany_data->main_widgets->window;
  GtkWidget          *view_menu;
  GtkWidget          *prev_item;
  gint                item_pos;
  gboolean            visible = FALSE;

  view_menu = ui_lookup_widget (main_window, view_menu_name);
  if (! GTK_IS_MENU (view_menu))
    {
      g_critical ("failed to locate the View menu (%s) in Geany's main menu",
                  view_menu_name);
      return;
    }

  overview_ui_menu_item = gtk_check_menu_item_new_with_label (_("Show Overview"));
  prev_item = ui_lookup_widget (main_window, prev_item_name);
  if (! GTK_IS_MENU_ITEM (prev_item))
    {
      g_critical ("failed to locate the Show Sidebar menu item (%s) in Geany's UI",
                  prev_item_name);
      overview_ui_menu_sep = gtk_separator_menu_item_new ();
      gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), overview_ui_menu_sep);
      gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), overview_ui_menu_item);
      gtk_widget_show (overview_ui_menu_sep);
    }
  else
    {
      item_pos = overview_ui_get_menu_item_pos (view_menu, prev_item);
      overview_ui_menu_sep = NULL;
      gtk_menu_shell_insert (GTK_MENU_SHELL (view_menu), overview_ui_menu_item, item_pos);
    }

  g_object_get (overview_ui_prefs, "visible", &visible, NULL);
  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (overview_ui_menu_item), visible);
  g_object_bind_property (overview_ui_menu_item, "active",
                          overview_ui_prefs, "visible",
                          G_BINDING_DEFAULT);

  gtk_widget_show (overview_ui_menu_item);
}
Ejemplo n.º 14
0
static void main_init(void)
{
	/* add our icon path in case we aren't installed in the system prefix */
	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), utils_resource_dir(RESOURCE_DIR_ICON));

	/* inits */
	ui_init_stock_items();

	ui_init_builder();

	main_widgets.window				= NULL;
	app->project			= NULL;
	ui_widgets.open_fontsel		= NULL;
	ui_widgets.open_colorsel	= NULL;
	ui_widgets.prefs_dialog		= NULL;
	main_status.main_window_realized = FALSE;
	file_prefs.tab_order_ltr		= FALSE;
	file_prefs.tab_order_beside		= FALSE;
	main_status.quitting			= FALSE;
	ignore_callback	= FALSE;
	app->tm_workspace		= tm_get_workspace();
	ui_prefs.recent_queue				= g_queue_new();
	ui_prefs.recent_projects_queue		= g_queue_new();
	main_status.opening_session_files	= FALSE;

	main_widgets.window = create_window1();
	g_signal_connect(main_widgets.window, "notify::is-active", G_CALLBACK(on_window_active_changed), NULL);

	/* add recent projects to the Project menu */
	ui_widgets.recent_projects_menuitem = ui_lookup_widget(main_widgets.window, "recent_projects1");
	ui_widgets.recent_projects_menu_menubar = gtk_menu_new();
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_projects_menuitem),
							ui_widgets.recent_projects_menu_menubar);

	/* store important pointers for later reference */
	main_widgets.toolbar = toolbar_init();
	main_widgets.sidebar_notebook = ui_lookup_widget(main_widgets.window, "notebook3");
	main_widgets.notebook = ui_lookup_widget(main_widgets.window, "notebook1");
	main_widgets.editor_menu = create_edit_menu1();
	main_widgets.tools_menu = ui_lookup_widget(main_widgets.window, "tools1_menu");
	main_widgets.message_window_notebook = ui_lookup_widget(main_widgets.window, "notebook_info");
	main_widgets.project_menu = ui_lookup_widget(main_widgets.window, "menu_project1_menu");

	ui_widgets.toolbar_menu = create_toolbar_popup_menu1();
	ui_init();
#ifdef MAC_INTEGRATION
	osx_ui_init();
#endif

	/* set widget names for matching with .gtkrc-2.0 */
	gtk_widget_set_name(main_widgets.window, "GeanyMainWindow");
	gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu");
	gtk_widget_set_name(main_widgets.editor_menu, "GeanyEditMenu");
	gtk_widget_set_name(ui_lookup_widget(main_widgets.window, "menubar1"), "GeanyMenubar");
	gtk_widget_set_name(main_widgets.toolbar, "GeanyToolbar");

	gtk_window_set_default_size(GTK_WINDOW(main_widgets.window),
		GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
}
Ejemplo n.º 15
0
void msgwin_init(void)
{
	msgwindow.notebook = ui_lookup_widget(main_widgets.window, "notebook_info");
	msgwindow.tree_status = ui_lookup_widget(main_widgets.window, "treeview3");
	msgwindow.tree_msg = ui_lookup_widget(main_widgets.window, "treeview4");
	msgwindow.tree_compiler = ui_lookup_widget(main_widgets.window, "treeview5");
	msgwindow.scribble = ui_lookup_widget(main_widgets.window, "textview_scribble");
	msgwindow.messages_dir = NULL;

	prepare_status_tree_view();
	prepare_msg_tree_view();
	prepare_compiler_tree_view();
	msgwindow.popup_status_menu = create_message_popup_menu(MSG_STATUS);
	msgwindow.popup_msg_menu = create_message_popup_menu(MSG_MESSAGE);
	msgwindow.popup_compiler_menu = create_message_popup_menu(MSG_COMPILER);

	ui_widget_modify_font_from_string(msgwindow.scribble, interface_prefs.msgwin_font);
	g_signal_connect(msgwindow.scribble, "populate-popup", G_CALLBACK(on_scribble_populate), NULL);
}
Ejemplo n.º 16
0
static void create_set_filetype_menu(void)
{
	GSList *node;
	GtkWidget *filetype_menu = ui_lookup_widget(main_widgets.window, "set_filetype1_menu");

	/* Append all filetypes to the filetype menu */
	foreach_slist(node, filetypes_by_title)
	{
		GeanyFiletype *ft = node->data;

		create_radio_menu_item(filetype_menu, ft);
	}
Ejemplo n.º 17
0
static void
on_comboboxType_changed(GtkComboBox * combobox, G_GNUC_UNUSED gpointer user_data)
{
	gchar *from, *to;
	GtkWidget *cmd0 = ui_lookup_widget(GTK_WIDGET(combobox), "entryCommand0");
	GtkWidget *cmd1 = ui_lookup_widget(GTK_WIDGET(combobox), "entryCommand1");
	GtkWidget *intern = ui_lookup_widget(GTK_WIDGET(combobox), "cbIntern");

	gchar *cmd0_txt = (gchar *) gtk_entry_get_text(GTK_ENTRY(cmd0));
	gchar *cmd1_txt = (gchar *) gtk_entry_get_text(GTK_ENTRY(cmd1));
	gboolean intern_b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(intern));
	GKeyFile *config = (GKeyFile *) g_object_get_data(G_OBJECT(combobox), "config");

	from = g_object_get_data(G_OBJECT(combobox), "current");
	to = gtk_combo_box_get_active_text(combobox);

	if (from != NULL)
	{
		if (! EMPTY(cmd0_txt))
			g_key_file_set_string(config, from, "command0", cmd0_txt);
		else
			g_key_file_remove_key(config, from, "command0", NULL);
		if (! EMPTY(cmd1_txt))
			g_key_file_set_string(config, from, "command1", cmd1_txt);
		else
			g_key_file_remove_key(config, from, "command1", NULL);
		g_key_file_set_boolean(config, from, "internal", intern_b);
		g_free(from);
	}
	g_object_set_data(G_OBJECT(combobox), "current", g_strdup(to));

	cmd0_txt = utils_get_setting_string(config, to, "command0", "");
	cmd1_txt = utils_get_setting_string(config, to, "command1", "");
	intern_b = utils_get_setting_boolean(config, to, "internal", FALSE);

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(intern), intern_b);
	gtk_entry_set_text(GTK_ENTRY(cmd0), cmd0_txt);
	gtk_entry_set_text(GTK_ENTRY(cmd1), cmd1_txt);
}
Ejemplo n.º 18
0
Archivo: main.c Proyecto: hauk142/geany
static void main_init(void)
{
	/* inits */
	ui_init_builder();

	main_widgets.window				= NULL;
	app->project			= NULL;
	ui_widgets.open_fontsel		= NULL;
	ui_widgets.open_colorsel	= NULL;
	ui_widgets.prefs_dialog		= NULL;
	main_status.main_window_realized = FALSE;
	file_prefs.tab_order_ltr		= FALSE;
	file_prefs.tab_order_beside		= FALSE;
	main_status.quitting			= FALSE;
	ignore_callback	= FALSE;
	app->tm_workspace		= tm_get_workspace();
	ui_prefs.recent_queue				= g_queue_new();
	ui_prefs.recent_projects_queue		= g_queue_new();
	main_status.opening_session_files	= FALSE;

	ui_init_stock_items();

	main_widgets.window = create_window1();

	/* add recent projects to the Project menu */
	ui_widgets.recent_projects_menuitem = ui_lookup_widget(main_widgets.window, "recent_projects1");
	ui_widgets.recent_projects_menu_menubar = gtk_menu_new();
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_projects_menuitem),
							ui_widgets.recent_projects_menu_menubar);

	/* store important pointers for later reference */
	main_widgets.toolbar = toolbar_init();
	main_widgets.sidebar_notebook = ui_lookup_widget(main_widgets.window, "notebook3");
	main_widgets.notebook = ui_lookup_widget(main_widgets.window, "notebook1");
	main_widgets.editor_menu = create_edit_menu1();
	main_widgets.tools_menu = ui_lookup_widget(main_widgets.window, "tools1_menu");
	main_widgets.message_window_notebook = ui_lookup_widget(main_widgets.window, "notebook_info");
	main_widgets.project_menu = ui_lookup_widget(main_widgets.window, "menu_project1_menu");

	ui_widgets.toolbar_menu = create_toolbar_popup_menu1();
	ui_init();

	/* set widget names for matching with .gtkrc-2.0 */
	gtk_widget_set_name(main_widgets.window, "GeanyMainWindow");
	gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu");
	gtk_widget_set_name(main_widgets.editor_menu, "GeanyEditMenu");
	gtk_widget_set_name(ui_lookup_widget(main_widgets.window, "menubar1"), "GeanyMenubar");
	gtk_widget_set_name(main_widgets.toolbar, "GeanyToolbar");

	gtk_window_set_default_size(GTK_WINDOW(main_widgets.window),
		GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
}
Ejemplo n.º 19
0
/* edit actions, c&p & co, from menu bar and from popup menu */
static void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	GtkWidget *item;
	GeanyDocument *doc = document_get_current();

	ui_update_menu_copy_items(doc);
	ui_update_insert_include_item(doc, 1);

	item = ui_lookup_widget(main_widgets.window, "plugin_preferences1");
#ifndef HAVE_PLUGINS
	gtk_widget_hide(item);
#else
	gtk_widget_set_sensitive(item, plugins_have_preferences());
#endif
}
Ejemplo n.º 20
0
static void create_properties_dialog(PropertyDialogElements *e)
{
	GtkWidget *base_path_button;
	static guint base_path_button_handler_id = 0;
	static guint radio_long_line_handler_id = 0;

	e->dialog = create_project_dialog();
	e->notebook = ui_lookup_widget(e->dialog, "project_notebook");
	e->file_name = ui_lookup_widget(e->dialog, "label_project_dialog_filename");
	e->name = ui_lookup_widget(e->dialog, "entry_project_dialog_name");
	e->description = ui_lookup_widget(e->dialog, "textview_project_dialog_description");
	e->base_path = ui_lookup_widget(e->dialog, "entry_project_dialog_base_path");
	e->patterns = ui_lookup_widget(e->dialog, "entry_project_dialog_file_patterns");

	gtk_entry_set_max_length(GTK_ENTRY(e->name), MAX_NAME_LEN);

	ui_entry_add_clear_icon(GTK_ENTRY(e->name));
	ui_entry_add_clear_icon(GTK_ENTRY(e->base_path));
	ui_entry_add_clear_icon(GTK_ENTRY(e->patterns));

	/* Workaround for bug in Glade 3.8.1, see comment above signal handler */
	if (base_path_button_handler_id == 0)
	{
		base_path_button = ui_lookup_widget(e->dialog, "button_project_dialog_base_path");
		base_path_button_handler_id =
			g_signal_connect(base_path_button, "clicked",
			G_CALLBACK(on_project_properties_base_path_button_clicked),
			e->base_path);
	}

	/* Same as above, should be in Glade but can't due to bug in 3.8.1 */
	if (radio_long_line_handler_id == 0)
	{
		radio_long_line_handler_id =
			g_signal_connect(ui_lookup_widget(e->dialog,
			"radio_long_line_custom_project"), "toggled",
			G_CALLBACK(on_radio_long_line_custom_toggled),
			ui_lookup_widget(e->dialog, "spin_long_line_project"));
	}
}
Ejemplo n.º 21
0
static void
init_Configure(GtkWidget * dialog)
{
	guint i;
	GtkWidget *cbTypes;

	cbTypes = ui_lookup_widget(dialog, "comboboxType");
	g_object_set(cbTypes, "wrap-width", 3, NULL);

	for (i = 0; i < geany->filetypes_array->len; i++)
	{
		gtk_combo_box_append_text(GTK_COMBO_BOX(cbTypes),
					  ((struct GeanyFiletype *) (filetypes[i]))->
					  name);
	}
	g_object_set_data(G_OBJECT(cbTypes), "config", config_clone());
	g_object_set_data(G_OBJECT(cbTypes), "current", NULL);
	gtk_combo_box_set_active(GTK_COMBO_BOX(cbTypes), 0);
}
Ejemplo n.º 22
0
static void create_set_filetype_menu(void)
{
	GSList *node;
	GtkWidget *filetype_menu = ui_lookup_widget(main_widgets.window, "set_filetype1_menu");

	create_sub_menu(filetype_menu, GEANY_FILETYPE_GROUP_COMPILED, _("_Programming Languages"));
	create_sub_menu(filetype_menu, GEANY_FILETYPE_GROUP_SCRIPT, _("_Scripting Languages"));
	create_sub_menu(filetype_menu, GEANY_FILETYPE_GROUP_MARKUP, _("_Markup Languages"));
	create_sub_menu(filetype_menu, GEANY_FILETYPE_GROUP_MISC, _("M_iscellaneous"));

	/* Append all filetypes to the filetype menu */
	foreach_slist(node, filetypes_by_title)
	{
		GeanyFiletype *ft = node->data;

		if (ft->group != GEANY_FILETYPE_GROUP_NONE)
			create_radio_menu_item(group_menus[ft->group], ft);
		else
			create_radio_menu_item(filetype_menu, ft);
	}
Ejemplo n.º 23
0
void menu_init(void)
{
	GtkMenuShell *shell = GTK_MENU_SHELL(geany->main_widgets->editor_menu);
	GList *children = gtk_container_get_children(GTK_CONTAINER(shell));
	GtkWidget *search2 = ui_lookup_widget(GTK_WIDGET(shell), "search2");

	popup_item = get_widget("popup_item");
	menu_connect("popup_menu", &popup_menu_info, NULL);
	g_signal_connect(get_widget("popup_evaluate"), "button-release-event",
		G_CALLBACK(on_popup_evaluate_button_release), geany->main_widgets->editor_menu);

	if (search2)
		gtk_menu_shell_insert(shell, popup_item, g_list_index(children, search2) + 1);
	else
		gtk_menu_shell_append(shell, popup_item);

	modify_dialog = dialog_connect("modify_dialog");
	modify_value_label = GTK_LABEL(get_widget("modify_value_label"));
	modify_value = get_widget("modify_value");
	modify_text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(modify_value));
	modify_ok = get_widget("modify_ok");
	utils_enter_to_clicked(modify_value, modify_ok);
}
Ejemplo n.º 24
0
static void
kb_doc_ask(G_GNUC_UNUSED guint key_id)
{
	gchar *word = NULL;
	GtkWidget *dialog, *entry;

	/* example configuration dialog */
	dialog = create_Interactive();

	/* run the dialog and check for the response code */
	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
	{
		entry = ui_lookup_widget(dialog, "entry_word");
		word = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
	}
	gtk_widget_destroy(dialog);

	if (word)
	{
		show_doc(word, 0);
		g_free(word);
	}
}
Ejemplo n.º 25
0
/** 
 * name: plugin_init
 * 
 * The Geany plugin initialization function. This is called automatically by Geany when a user installs the plugin.
 *   
 * @param data GeanyData.
 * @return void
 **/
void plugin_init(G_GNUC_UNUSED GeanyData *data)
{
	//Get hold of the Edit menu widget.
	GtkWidget* parent_menu = ui_lookup_widget(GTK_WIDGET(geany->main_widgets->window), "edit1_menu");//"tools1_menu"
	
	// Create the 'LispEdit: eval' menu, assign it to the callback function cb_eval
	// and attach it to parent_menu.
	eval_menu_item = gtk_menu_item_new_with_mnemonic(EVAL_MENU_STR);
	gtk_widget_show(eval_menu_item);
	gtk_container_add(GTK_CONTAINER(parent_menu),							
		eval_menu_item);
	g_signal_connect(eval_menu_item, "activate",
		G_CALLBACK(cb_eval), NULL);
   
    // Create the 'LispEdit: macroexpand-1' menu, assign it to the callback function cb_macroexpand_1
	// and attach it to parent_menu.
	macroexpand_1_menu_item = gtk_menu_item_new_with_mnemonic(MACROEXPAND_MENU_STR);
	gtk_widget_show(macroexpand_1_menu_item);
	gtk_container_add(GTK_CONTAINER(parent_menu),
		macroexpand_1_menu_item);
	g_signal_connect(macroexpand_1_menu_item, "activate",
		G_CALLBACK(cb_macroexpand_1), NULL);

	/* make sure our menu items aren't called when there is no doc open */
	ui_add_document_sensitive(eval_menu_item);
	ui_add_document_sensitive(macroexpand_1_menu_item);

	// setup keybindings for the callback functions.
	keybindings_set_item(plugin_key_group, KB_MACROEXPAND, on_macroexpand_1_key,
		GDK_Return, MACROEXPAND_KEY_SEQ, MACROEXPAND_ID_STR, MACROEXPAND_MENU_STR, macroexpand_1_menu_item);
	keybindings_set_item(plugin_key_group, KB_EVAL, on_eval_key,
		GDK_Return, EVAL_KEY_SEQ, EVAL_ID_STR, EVAL_MENU_STR, eval_menu_item);
	
	//Initialiase the binding to the Geany virtual terminal (VTE).
	init_vte();

}
Ejemplo n.º 26
0
/* Verifies data for New & Properties dialogs.
 * Returns: FALSE if the user needs to change any data. */
static gboolean update_config(const PropertyDialogElements *e, gboolean new_project)
{
	const gchar *name, *file_name, *base_path;
	gchar *locale_filename;
	gsize name_len;
	gint err_code = 0;
	GeanyProject *p;

	g_return_val_if_fail(e != NULL, TRUE);

	name = gtk_entry_get_text(GTK_ENTRY(e->name));
	name_len = strlen(name);
	if (name_len == 0)
	{
		SHOW_ERR(_("The specified project name is too short."));
		gtk_widget_grab_focus(e->name);
		return FALSE;
	}
	else if (name_len > MAX_NAME_LEN)
	{
		SHOW_ERR1(_("The specified project name is too long (max. %d characters)."), MAX_NAME_LEN);
		gtk_widget_grab_focus(e->name);
		return FALSE;
	}

	if (new_project)
		file_name = gtk_entry_get_text(GTK_ENTRY(e->file_name));
	else
		file_name = gtk_label_get_text(GTK_LABEL(e->file_name));

	if (G_UNLIKELY(! NZV(file_name)))
	{
		SHOW_ERR(_("You have specified an invalid project filename."));
		gtk_widget_grab_focus(e->file_name);
		return FALSE;
	}

	locale_filename = utils_get_locale_from_utf8(file_name);
	base_path = gtk_entry_get_text(GTK_ENTRY(e->base_path));
	if (NZV(base_path))
	{	/* check whether the given directory actually exists */
		gchar *locale_path = utils_get_locale_from_utf8(base_path);

		if (! g_path_is_absolute(locale_path))
		{	/* relative base path, so add base dir of project file name */
			gchar *dir = g_path_get_dirname(locale_filename);
			SETPTR(locale_path, g_strconcat(dir, G_DIR_SEPARATOR_S, locale_path, NULL));
			g_free(dir);
		}

		if (! g_file_test(locale_path, G_FILE_TEST_IS_DIR))
		{
			gboolean create_dir;

			create_dir = dialogs_show_question_full(NULL, GTK_STOCK_OK, GTK_STOCK_CANCEL,
				_("Create the project's base path directory?"),
				_("The path \"%s\" does not exist."),
				base_path);

			if (create_dir)
				err_code = utils_mkdir(locale_path, TRUE);

			if (! create_dir || err_code != 0)
			{
				if (err_code != 0)
					SHOW_ERR1(_("Project base directory could not be created (%s)."),
						g_strerror(err_code));
				gtk_widget_grab_focus(e->base_path);
				utils_free_pointers(2, locale_path, locale_filename, NULL);
				return FALSE;
			}
		}
		g_free(locale_path);
	}
	/* finally test whether the given project file can be written */
	if ((err_code = utils_is_file_writable(locale_filename)) != 0 ||
		(err_code = g_file_test(locale_filename, G_FILE_TEST_IS_DIR) ? EISDIR : 0) != 0)
	{
		SHOW_ERR1(_("Project file could not be written (%s)."), g_strerror(err_code));
		gtk_widget_grab_focus(e->file_name);
		g_free(locale_filename);
		return FALSE;
	}
	g_free(locale_filename);

	if (app->project == NULL)
	{
		create_project();
		new_project = TRUE;
	}
	p = app->project;

	SETPTR(p->name, g_strdup(name));
	SETPTR(p->file_name, g_strdup(file_name));
	/* use "." if base_path is empty */
	SETPTR(p->base_path, g_strdup(NZV(base_path) ? base_path : "./"));

	if (! new_project)	/* save properties specific fields */
	{
		GtkTextIter start, end;
		GtkTextBuffer *buffer;
		GeanyDocument *doc = document_get_current();
		GeanyBuildCommand *oldvalue;
		GeanyFiletype *ft = doc ? doc->file_type : NULL;
		GtkWidget *widget;
		gchar *tmp;
		GString *str;
		GSList *node;

		/* get and set the project description */
		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
		gtk_text_buffer_get_start_iter(buffer, &start);
		gtk_text_buffer_get_end_iter(buffer, &end);
		SETPTR(p->description, g_strdup(gtk_text_buffer_get_text(buffer, &start, &end, FALSE)));

		foreach_slist(node, stash_groups)
			stash_group_update(node->data, e->dialog);

		/* read the project build menu */
		oldvalue = ft ? ft->projfilecmds : NULL;
		build_read_project(ft, e->build_properties);

		if (ft != NULL && ft->projfilecmds != oldvalue && ft->project_list_entry < 0)
		{
			if (p->build_filetypes_list == NULL)
				p->build_filetypes_list = g_ptr_array_new();
			ft->project_list_entry = p->build_filetypes_list->len;
			g_ptr_array_add(p->build_filetypes_list, ft);
		}
		build_menu_update(doc);

		widget = ui_lookup_widget(e->dialog, "radio_long_line_disabled_project");
		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
			p->long_line_behaviour = 0;
		else
		{
			widget = ui_lookup_widget(e->dialog, "radio_long_line_default_project");
			if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
				p->long_line_behaviour = 1;
			else
				/* "Custom" radio button must be checked */
				p->long_line_behaviour = 2;
		}

		widget = ui_lookup_widget(e->dialog, "spin_long_line_project");
		p->long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
		apply_editor_prefs();

		/* get and set the project file patterns */
		tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(e->patterns)));
		g_strfreev(p->file_patterns);
		g_strstrip(tmp);
		str = g_string_new(tmp);
		do {} while (utils_string_replace_all(str, "  ", " "));
		p->file_patterns = g_strsplit(str->str, " ", -1);
		g_string_free(str, TRUE);
		g_free(tmp);
	}

	update_ui();

	return TRUE;
}
Ejemplo n.º 27
0
static void show_project_properties(gboolean show_build)
{
	GeanyProject *p = app->project;
	GtkWidget *widget = NULL;
	GtkWidget *radio_long_line_custom;
	static PropertyDialogElements e;
	GSList *node;

	g_return_if_fail(app->project != NULL);

	entries_modified = FALSE;

	if (e.dialog == NULL)
		create_properties_dialog(&e);

	insert_build_page(&e);

	foreach_slist(node, stash_groups)
		stash_group_display(node->data, e.dialog);

	/* fill the elements with the appropriate data */
	gtk_entry_set_text(GTK_ENTRY(e.name), p->name);
	gtk_label_set_text(GTK_LABEL(e.file_name), p->file_name);
	gtk_entry_set_text(GTK_ENTRY(e.base_path), p->base_path);

	radio_long_line_custom = ui_lookup_widget(e.dialog, "radio_long_line_custom_project");
	switch (p->long_line_behaviour)
	{
		case 0: widget = ui_lookup_widget(e.dialog, "radio_long_line_disabled_project"); break;
		case 1: widget = ui_lookup_widget(e.dialog, "radio_long_line_default_project"); break;
		case 2: widget = radio_long_line_custom; break;
	}
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);

	widget = ui_lookup_widget(e.dialog, "spin_long_line_project");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (gdouble)p->long_line_column);
	on_radio_long_line_custom_toggled(GTK_TOGGLE_BUTTON(radio_long_line_custom), widget);

	if (p->description != NULL)
	{	/* set text */
		GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e.description));
		gtk_text_buffer_set_text(buffer, p->description, -1);
	}

	if (p->file_patterns != NULL)
	{	/* set the file patterns */
		gchar *str;

		str = g_strjoinv(" ", p->file_patterns);
		gtk_entry_set_text(GTK_ENTRY(e.patterns), str);
		g_free(str);
	}

	g_signal_emit_by_name(geany_object, "project-dialog-open", e.notebook);
	gtk_widget_show_all(e.dialog);

	/* note: notebook page must be shown before setting current page */
	if (show_build)
		gtk_notebook_set_current_page(GTK_NOTEBOOK(e.notebook), e.build_page_num);
	else
		gtk_notebook_set_current_page(GTK_NOTEBOOK(e.notebook), 0);

	while (gtk_dialog_run(GTK_DIALOG(e.dialog)) == GTK_RESPONSE_OK)
	{
		if (update_config(&e, FALSE))
		{
			g_signal_emit_by_name(geany_object, "project-dialog-confirmed", e.notebook);
			if (!write_config(TRUE))
				SHOW_ERR(_("Project file could not be written"));
			else
			{
				ui_set_statusbar(TRUE, _("Project \"%s\" saved."), app->project->name);
				break;
			}
		}
	}

	build_free_fields(e.build_properties);
	g_signal_emit_by_name(geany_object, "project-dialog-close", e.notebook);
	gtk_notebook_remove_page(GTK_NOTEBOOK(e.notebook), e.build_page_num);
	gtk_widget_hide(e.dialog);
}
Ejemplo n.º 28
0
Archivo: main.c Proyecto: P-Ruiz/geany
static void main_init(void)
{
	/* add our icon path in case we aren't installed in the system prefix */
	gchar *path;
#ifdef G_OS_WIN32
	gchar *install_dir = win32_get_installation_dir();
	path = g_build_filename(install_dir, "share", "icons", NULL);
	g_free(install_dir);
#else
	path = g_build_filename(GEANY_DATADIR, "icons", NULL);
#endif
	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), path);
	g_free(path);

	/* inits */
	ui_init_stock_items();

	ui_init_builder();

	main_widgets.window				= NULL;
	app->project			= NULL;
	ui_widgets.open_fontsel		= NULL;
	ui_widgets.open_colorsel	= NULL;
	ui_widgets.prefs_dialog		= NULL;
	main_status.main_window_realized = FALSE;
	file_prefs.tab_order_ltr		= FALSE;
	file_prefs.tab_order_beside		= FALSE;
	main_status.quitting			= FALSE;
	ignore_callback	= FALSE;
	app->tm_workspace		= tm_get_workspace();
	ui_prefs.recent_queue				= g_queue_new();
	ui_prefs.recent_projects_queue		= g_queue_new();
	main_status.opening_session_files	= FALSE;

	main_widgets.window = create_window1();

	/* add recent projects to the Project menu */
	ui_widgets.recent_projects_menuitem = ui_lookup_widget(main_widgets.window, "recent_projects1");
	ui_widgets.recent_projects_menu_menubar = gtk_menu_new();
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_projects_menuitem),
							ui_widgets.recent_projects_menu_menubar);

	/* store important pointers for later reference */
	main_widgets.toolbar = toolbar_init();
	main_widgets.sidebar_notebook = ui_lookup_widget(main_widgets.window, "notebook3");
	main_widgets.notebook = ui_lookup_widget(main_widgets.window, "notebook1");
	main_widgets.editor_menu = create_edit_menu1();
	main_widgets.tools_menu = ui_lookup_widget(main_widgets.window, "tools1_menu");
	main_widgets.message_window_notebook = ui_lookup_widget(main_widgets.window, "notebook_info");
	main_widgets.project_menu = ui_lookup_widget(main_widgets.window, "menu_project1_menu");

	ui_widgets.toolbar_menu = create_toolbar_popup_menu1();
	ui_init();

	/* set widget names for matching with .gtkrc-2.0 */
	gtk_widget_set_name(main_widgets.window, "GeanyMainWindow");
	gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu");
	gtk_widget_set_name(main_widgets.editor_menu, "GeanyEditMenu");
	gtk_widget_set_name(ui_lookup_widget(main_widgets.window, "menubar1"), "GeanyMenubar");
	gtk_widget_set_name(main_widgets.toolbar, "GeanyToolbar");

	gtk_window_set_default_size(GTK_WINDOW(main_widgets.window),
		GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
}
Ejemplo n.º 29
0
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++;
}
Ejemplo n.º 30
0
/* hides toolbar from toolbar popup menu */
static void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	GtkWidget *tool_item = ui_lookup_widget(GTK_WIDGET(main_widgets.window), "menu_show_toolbar1");
	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tool_item), FALSE);
}