Exemplo n.º 1
0
void plugin_init(G_GNUC_UNUSED GeanyData *data){

   /* init gettext and friends */
   main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);

   menu_item_shift_left = gtk_menu_item_new_with_mnemonic(_("Shift Left"));
   gtk_widget_show(menu_item_shift_left);
   gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu),
       menu_item_shift_left);
   g_signal_connect(menu_item_shift_left, "activate",
       G_CALLBACK(shift_left_cb), NULL);

   menu_item_shift_right = gtk_menu_item_new_with_mnemonic(_("Shift Right"));
   gtk_widget_show(menu_item_shift_right);
   gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu),
       menu_item_shift_right);
   g_signal_connect(menu_item_shift_right, "activate",
       G_CALLBACK(shift_right_cb), NULL);

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

   /* setup keybindings */
   keybindings_set_item(plugin_key_group, KB_SHIFT_LEFT, kb_shift_left,
      0, GDK_CONTROL_MASK, "shift_left", _("Shift Left"), menu_item_shift_left);
   keybindings_set_item(plugin_key_group, KB_SHIFT_RIGHT, kb_shift_right,
      0, GDK_CONTROL_MASK, "shift_right", _("Shift Right"), menu_item_shift_right);
   }
Exemplo n.º 2
0
PLUGIN_EXPORT
void plugin_init(GeanyData *data)
{
	gchar *libname=NULL;

	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);

	geany_data=data;
	/* first try the user config path */
	libname=g_build_path(G_DIR_SEPARATOR_S, data->app->configdir, "plugins", "geanylua", SUPPORT_LIB, NULL);
	if (!load_support_lib(libname)) {
		/* try the system path */
		gchar *libdir=get_lib_dir();
		g_free(libname);
		libname=g_build_path(G_DIR_SEPARATOR_S, libdir, "geany-plugins", "geanylua", SUPPORT_LIB, NULL);
		g_free(libdir);
		if (!load_support_lib(libname)) {
			g_printerr(_("%s: Can't find support library %s!\n"), PLUGIN_NAME, libname);
			g_free(libname);
			return;
		}
	}
	g_free(libname);
	copy_callbacks();

	glspi_init(data, geany_functions, geany_plugin);
}
Exemplo n.º 3
0
/* Called by Geany to initialize the plugin */
void
plugin_init(G_GNUC_UNUSED GeanyData * data)
{
	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
	tools_menu_init();

	xproject_init();
	create_sidebar();
	reload_project();
}
Exemplo n.º 4
0
/* Called by Geany to initialize the plugin */
void plugin_init(G_GNUC_UNUSED GeanyData *data)
{
	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
	load_settings();
	tools_menu_init();

	xproject_init();
	if (display_sidebar)
		create_sidebar();
	reload_project();

	keybindings_set_item(plugin_key_group, KB_FIND_IN_PROJECT,
		kb_find_in_project, 0, 0, "find_in_project",
			_("Find a text in geanyprj's project"), NULL);
}
Exemplo n.º 5
0
void geany_load_module(GeanyPlugin *plugin)
{
	/* main_locale_init() must be called for your package before any localization can be done */
	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
	plugin->info->name = _("Demo");
	plugin->info->description = _("Example plugin.");
	plugin->info->version = "0.4";
	plugin->info->author =  _("The Geany developer team");

	plugin->funcs->init = demo_init;
	plugin->funcs->configure = demo_configure;
	plugin->funcs->help = NULL; /* This demo has no help but it is an option */
	plugin->funcs->cleanup = demo_cleanup;
	plugin->funcs->callbacks = demo_callbacks;

	GEANY_PLUGIN_REGISTER(plugin, 225);
}
Exemplo n.º 6
0
void
plugin_init(G_GNUC_UNUSED GeanyData * data)
{
	gchar *kb_label1;
	gchar *kb_label2;

	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
	kb_label1 = _("Document current word");
	kb_label2 = _("Document interactive");

	config_init();

	keyb1 = gtk_menu_item_new();
	keyb2 = gtk_menu_item_new();

	keybindings_set_item(plugin_key_group, KB_DOCUMENT_WORD, kb_doc,
				0, 0, kb_label1, kb_label1, keyb1);
	keybindings_set_item(plugin_key_group, KB_DOCUMENT_WORD_ASK, kb_doc_ask,
				0, 0, kb_label2, kb_label2, keyb2);
}
Exemplo n.º 7
0
/* Called by Geany to initialize the plugin */
void
plugin_init(G_GNUC_UNUSED GeanyData *data)
{
	GtkWidget *menu_lipsum = NULL;
	GKeyFile *config = g_key_file_new();
	gchar *config_file = NULL;
	GeanyKeyGroup *key_group;

	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);

	config_file = g_strconcat(geany->app->configdir,
		G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S,
		"geanylipsum", G_DIR_SEPARATOR_S, "lipsum.conf", NULL);

	/* Initialising options from config file  if there is any*/
	g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
	lipsum = utils_get_setting_string(config, "snippets", "lipsumtext", default_loremipsum);

	g_key_file_free(config);
	g_free(config_file);

	/* Building menu entry */
	menu_lipsum = gtk_image_menu_item_new_with_mnemonic(_("_Lipsum"));
	gtk_widget_set_tooltip_text(menu_lipsum, _("Include Pseudotext to your code"));
	gtk_widget_show(menu_lipsum);
	g_signal_connect((gpointer) menu_lipsum, "activate",
			 G_CALLBACK(lipsum_activated), NULL);
	gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_lipsum);


	ui_add_document_sensitive(menu_lipsum);

	main_menu_item = menu_lipsum;

	/* init keybindings */
	key_group = plugin_set_key_group(geany_plugin, "geanylipsum", COUNT_KB, NULL);
	keybindings_set_item(key_group, LIPSUM_KB_INSERT, kblipsum_insert,
		0, 0, "insert_lipsum", _("Insert Lipsum text"), menu_lipsum);
}
Exemplo n.º 8
0
void plugin_init(GeanyData *data)
{
    /* initializes the libxml2 */
    LIBXML_TEST_VERSION

    /* mutilanguage support */
    main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);

    /* put the menu into the Tools */
    main_menu_item = gtk_menu_item_new_with_mnemonic(_("PrettyPrinter XML"));
    ui_add_document_sensitive(main_menu_item);

    gtk_widget_show(main_menu_item);
    gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), main_menu_item);

    /* init keybindings */
    keybindings_set_item(plugin_key_group, 0, kb_run_xml_pretty_print,
                         0, 0, "run_pretty_printer_xml", _("Run the PrettyPrinter XML"),
                         main_menu_item);

    /* add activation callback */
    g_signal_connect(main_menu_item, "activate", G_CALLBACK(xml_format), NULL);
}
Exemplo n.º 9
0
void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
{
	GeanyKeyGroup *scope_key_group;
	char *gladefile = g_build_filename(PLUGINDATADIR, "scope.glade", NULL);
	GError *gerror = NULL;
	GtkWidget *menubar1 = find_widget(geany->main_widgets->window, "menubar1");
	guint item;
	const MenuKey *menu_key = debug_menu_keys;
	ToolItem *tool_item = toolbar_items;
	const ScopeCallback *scb;

	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
	scope_key_group = plugin_set_key_group(geany_plugin, "scope", COUNT_KB, NULL);
	builder = gtk_builder_new();
	gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
	scp_tree_store_register_dynamic();

	if (!gtk_builder_add_from_file(builder, gladefile, &gerror))
	{
		msgwin_status_add(_("Scope: %s."), gerror->message);
		g_warning(_("Scope: %s."), gerror->message);
		g_error_free(gerror);
		g_object_unref(builder);
		builder = NULL;
	}

	g_free(gladefile);
	if (!builder)
		return;

	/* interface */
#ifndef G_OS_UNIX
	gtk_widget_hide(get_widget("terminal_show"));
#endif
	debug_item = get_widget("debug_item");
	if (menubar1)
		gtk_menu_shell_insert(GTK_MENU_SHELL(menubar1), debug_item, DEBUG_MENU_ITEM_POS);
	else
		gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), debug_item);

	menu_connect("debug_menu", &debug_menu_info, NULL);
	ui_add_document_sensitive(get_widget("scope_reset_markers"));
	ui_add_document_sensitive(get_widget("scope_cleanup_files"));

	for (item = 0; item < EVALUATE_KB; item++, menu_key++)
	{
		keybindings_set_item(scope_key_group, item, on_scope_key, 0, 0, menu_key->name,
			_(menu_key->label), debug_menu_items[item].widget);
	}

	geany_statusbar = GTK_STATUSBAR(gtk_widget_get_parent(geany->main_widgets->progressbar));
	debug_statusbar = get_widget("debug_statusbar");
	debug_state_label = GTK_LABEL(get_widget("debug_state_label"));
	gtk_box_pack_end(GTK_BOX(geany_statusbar), debug_statusbar, FALSE, FALSE, 0);

	debug_panel = get_widget("debug_panel");
	gtk_notebook_append_page(GTK_NOTEBOOK(geany->main_widgets->message_window_notebook),
		debug_panel, get_widget("debug_label"));

	/* startup */
	gtk216_init();
	program_init();
	prefs_init();
	conterm_init();
	inspect_init();
	register_init();
	parse_init();
	debug_init();
	views_init();
	thread_init();
	break_init();
	watch_init();
	stack_init();
	local_init();
	memory_init();
	menu_init();
	menu_set_popup_keybindings(scope_key_group, item);

	for (item = 0; tool_item->index != -1; item++, tool_item++)
	{
		GtkMenuItem *menu_item = GTK_MENU_ITEM(debug_menu_items[tool_item->index].widget);
		GtkToolItem *button = gtk_tool_button_new(NULL, gtk_menu_item_get_label(menu_item));

		gtk_tool_button_set_use_underline(GTK_TOOL_BUTTON(button),
			gtk_menu_item_get_use_underline(menu_item));
		g_signal_connect(button, "clicked", G_CALLBACK(on_toolbar_button_clicked),
			GINT_TO_POINTER(tool_item->index));
		g_signal_connect(button, "toolbar-reconfigured",
			G_CALLBACK(on_toolbar_reconfigured), tool_item);
		tool_item->widget = GTK_WIDGET(button);
		plugin_add_toolbar_item(geany_plugin, button);
	}

	toolbar_update_state(DS_INACTIVE);
	views_update_state(DS_INACTIVE);
	configure_toolbar();

	g_signal_connect(debug_panel, "switch-page", G_CALLBACK(on_view_changed), NULL);
	for (scb = scope_callbacks; scb->name; scb++)
		plugin_signal_connect(geany_plugin, NULL, scb->name, FALSE, scb->callback, NULL);
}
Exemplo n.º 10
0
void
plugin_init(GeanyData * data)
{
	GKeyFile *kf = g_key_file_new();
	GError *err = NULL;
	gchar *glob_file;
	gchar *user_file;
	gchar *old_config_dir;

	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);

	gdbui_setup.main_window = geany->main_widgets->window;

	gdbio_setup.temp_dir = g_build_filename(geany->app->configdir, "plugins", UNIX_NAME, NULL);
	old_config_dir = g_build_filename(geany->app->configdir, "plugins", UNIX_NAME_OLD, NULL);

	if (g_file_test(old_config_dir, G_FILE_TEST_IS_DIR)
			&& !g_file_test(gdbio_setup.temp_dir, G_FILE_TEST_EXISTS))
		g_rename(old_config_dir, gdbio_setup.temp_dir);

	/*
	 * the tty helper binary is either in the user's config dir or globally
	 * installed in $LIBDIR/geany/
	 */
	glob_file = g_build_filename(TTYHELPERDIR, "ttyhelper", NULL);
	user_file = g_build_filename(geany->app->configdir, "plugins", UNIX_NAME, "ttyhelper", NULL);
	gdbio_setup.tty_helper = NULL;

	if (utils_mkdir(gdbio_setup.temp_dir, TRUE) != 0)
	{
		dialogs_show_msgbox(GTK_MESSAGE_ERROR,
					   _("Plugin configuration directory (%s) could not be created."), gdbio_setup.temp_dir);
	}

	/* the global ttyhelper has higher priority */
	if (!g_file_test(glob_file, G_FILE_TEST_IS_REGULAR))
	{
		if (g_file_test(user_file, G_FILE_TEST_IS_REGULAR)
				&& g_file_test(user_file, G_FILE_TEST_IS_EXECUTABLE))
		{
			gdbio_setup.tty_helper = g_strdup(user_file);
		}
	}
	else if (g_file_test(glob_file, G_FILE_TEST_IS_EXECUTABLE))
		gdbio_setup.tty_helper = g_strdup(glob_file);

	if (NULL == gdbio_setup.tty_helper)
		dialogs_show_msgbox(GTK_MESSAGE_ERROR,
					   _("geanygdb: ttyhelper program not found."));

	config_file = g_build_filename(gdbio_setup.temp_dir,"debugger.cfg", NULL);
	gdbui_opts_init();

	if (g_key_file_load_from_file(kf, config_file, G_KEY_FILE_NONE, NULL))
	{
		GET_KEY_STR(mono_font);
		GET_KEY_STR(term_cmd);
		GET_KEY_BOOL(show_tooltips);
		GET_KEY_BOOL(show_icons);
	}

	g_key_file_free(kf);

	gdbui_setup.warn_func = warn_message_cb;
	gdbui_setup.info_func = info_message_cb;
	gdbui_setup.opts_func = update_settings_cb;
	gdbui_setup.location_query = location_query_cb;
	gdbui_setup.line_func = goto_file_line_cb;


	g_free(old_config_dir);
	g_free(glob_file);
	g_free(user_file);
	msgbook = GTK_NOTEBOOK(ui_lookup_widget(geany->main_widgets->window, "notebook_info"));
	compwin = gtk_widget_get_parent(ui_lookup_widget(geany->main_widgets->window, "treeview5"));
	frame = gtk_frame_new(NULL);
	gtk_notebook_append_page(GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), frame,
				 gtk_label_new("Debug"));

	menudbg = gtk_menu_item_new_with_mnemonic (_("Debu_g"));
	gtk_widget_show (menudbg);
	gtk_menu_insert (
		GTK_CONTAINER (	ui_lookup_widget(geany->main_widgets->window, "menubar1"))
		, menudbg, 7);

	btmframe = gtk_frame_new(NULL);
	gtk_widget_show_all(btmframe);
	gtk_notebook_append_page(
		GTK_NOTEBOOK(ui_lookup_widget(geany->main_widgets->window, "notebook_info")),
		btmframe,
		gtk_label_new(_("Debug")));


	gdbui_create_menu(menudbg);
	gdbui_create_widgets(frame);
	gtk_widget_show_all(frame);
}
Exemplo n.º 11
0
void plugin_init(GeanyData * data)
{
    load_settings();
    main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
    add_menu_item();
}