void plugin_init(GeanyData *data) { GeanyKeyGroup *group; group = plugin_set_key_group (geany_plugin, "Pair Tag Highlighter", KB_COUNT, NULL); keybindings_set_item (group, KB_MATCH_TAG, on_kb_goto_matching_tag, 0, 0, "goto_matching_tag", _("Go To Matching Tag"), NULL); }
/* * init hotkeys */ gboolean keys_init() { /* keys count */ int count = 0; while (keys[count++].key_name) ; /* set keygroup */ key_group = plugin_set_key_group( geany_plugin, _("Debug"), count - 1, keys_callback); /* add keys */ int _index = 0; while (keys[_index].key_name) { keybindings_set_item( key_group, keys[_index].key_id, NULL, 0, 0, keys[_index].key_name, _(keys[_index].key_label), NULL); _index++; } return 1; }
void plugin_init(GeanyData *data) { home = g_getenv("HOME"); if (!home) { home = g_get_home_dir(); } conf = g_build_path(G_DIR_SEPARATOR_S, geany_data->app->configdir, "plugins", "quick-opener.conf", NULL); config = g_key_file_new(); g_key_file_load_from_file(config, conf, G_KEY_FILE_NONE, NULL); include_path = utils_get_setting_boolean(config, "main", "include-path", include_path); pathRegexSetting.text = utils_get_setting_string(config, "main", "path-regex", pathRegexSetting.DEFAULT); nameRegexSetting.text = utils_get_setting_string(config, "main", "name-regex", nameRegexSetting.DEFAULT); opener_path = utils_get_setting_string(config, "main", "path", home); setup_regex(); GeanyKeyGroup *key_group; key_group = plugin_set_key_group(geany_plugin, "quick_open_keyboard_shortcut", COUNT_KB, NULL); keybindings_set_item(key_group, KB_QUICK_OPEN_PROJECT, quick_open_project_keyboard_shortcut, 0, 0, "quick_open_project_keyboard_shortcut", _("Quick Open Project Files..."), NULL); keybindings_set_item(key_group, KB_QUICK_OPEN, quick_open_keyboard_shortcut, 0, 0, "quick_open_keyboard_shortcut", _("Quick Open..."), NULL); quick_open_project_menu = gtk_menu_item_new_with_mnemonic("Quick Open Project Files..."); gtk_widget_show(quick_open_project_menu); gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), quick_open_project_menu); g_signal_connect(quick_open_project_menu, "activate", G_CALLBACK(quick_open_project_menu_callback), NULL); quick_open_menu = gtk_menu_item_new_with_mnemonic("Quick Open..."); gtk_widget_show(quick_open_menu); gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), quick_open_menu); g_signal_connect(quick_open_menu, "activate", G_CALLBACK(quick_open_menu_callback), NULL); }
void plugin_init(GeanyData *data) { GKeyFile *config = g_key_file_new(); GeanyKeyGroup *key_group; ao_info = g_new0(AddonsInfo, 1); ao_info->config_file = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "addons", G_DIR_SEPARATOR_S, "addons.conf", NULL); g_key_file_load_from_file(config, ao_info->config_file, G_KEY_FILE_NONE, NULL); ao_info->enable_doclist = utils_get_setting_boolean(config, "addons", "show_toolbar_doclist_item", TRUE); ao_info->doclist_sort_mode = utils_get_setting_integer(config, "addons", "doclist_sort_mode", DOCLIST_SORT_BY_OCCURRENCE); ao_info->enable_openuri = utils_get_setting_boolean(config, "addons", "enable_openuri", FALSE); ao_info->enable_tasks = utils_get_setting_boolean(config, "addons", "enable_tasks", TRUE); ao_info->tasks_scan_all_documents = utils_get_setting_boolean(config, "addons", "tasks_scan_all_documents", FALSE); ao_info->tasks_token_list = utils_get_setting_string(config, "addons", "tasks_token_list", "TODO;FIXME"); ao_info->enable_systray = utils_get_setting_boolean(config, "addons", "enable_systray", FALSE); ao_info->enable_bookmarklist = utils_get_setting_boolean(config, "addons", "enable_bookmarklist", FALSE); ao_info->enable_markword = utils_get_setting_boolean(config, "addons", "enable_markword", FALSE); ao_info->strip_trailing_blank_lines = utils_get_setting_boolean(config, "addons", "strip_trailing_blank_lines", FALSE); ao_info->enable_xmltagging = utils_get_setting_boolean(config, "addons", "enable_xmltagging", FALSE); plugin_module_make_resident(geany_plugin); ao_info->doclist = ao_doc_list_new(ao_info->enable_doclist, ao_info->doclist_sort_mode); ao_info->openuri = ao_open_uri_new(ao_info->enable_openuri); ao_info->systray = ao_systray_new(ao_info->enable_systray); ao_info->bookmarklist = ao_bookmark_list_new(ao_info->enable_bookmarklist); ao_info->markword = ao_mark_word_new(ao_info->enable_markword); ao_info->tasks = ao_tasks_new(ao_info->enable_tasks, ao_info->tasks_token_list, ao_info->tasks_scan_all_documents); ao_blanklines_set_enable(ao_info->strip_trailing_blank_lines); /* setup keybindings */ key_group = plugin_set_key_group(geany_plugin, "addons", KB_COUNT, NULL); keybindings_set_item(key_group, KB_FOCUS_BOOKMARK_LIST, kb_bmlist_activate, 0, 0, "focus_bookmark_list", _("Focus Bookmark List"), NULL); keybindings_set_item(key_group, KB_FOCUS_TASKS, kb_tasks_activate, 0, 0, "focus_tasks", _("Focus Tasks List"), NULL); keybindings_set_item(key_group, KB_UPDATE_TASKS, kb_tasks_update, 0, 0, "update_tasks", _("Update Tasks List"), NULL); keybindings_set_item(key_group, KB_XMLTAGGING, kb_ao_xmltagging, 0, 0, "xml_tagging", _("Run XML tagging"), NULL); }
static void init_keybindings() { const int COUNT_KB = 1; const int KB_COMPLETE_IDX = 0; GeanyKeyGroup* key_group = plugin_set_key_group(geany_plugin, completion_framework->get_plugin_name(), COUNT_KB, NULL); keybindings_set_item(key_group, KB_COMPLETE_IDX, force_completion, 0, (GdkModifierType)0, "exec", _("complete"), NULL); }
void plugin_init(GeanyData *data) { /* read & prepare configuration */ gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, geany_data->app->configdir, "plugins", "unixtsconverter", NULL); plugin_config_path = g_build_path(G_DIR_SEPARATOR_S, config_dir, "unixtsconverter.conf", NULL); g_mkdir_with_parents(config_dir, S_IRUSR | S_IWUSR | S_IXUSR); g_free(config_dir); keyfile_plugin = g_key_file_new(); if (!g_key_file_load_from_file(keyfile_plugin, plugin_config_path, G_KEY_FILE_NONE, NULL)) { config_set_defaults(keyfile_plugin); config_save_setting(keyfile_plugin, plugin_config_path); } else { showResultInMsgPopupWindow = config_get_setting(keyfile_plugin, "show_result_in_message_window"); showErrors = config_get_setting(keyfile_plugin, "show_failure_messages"); useClipboard = config_get_setting(keyfile_plugin, "use_clipboard_too"); autodetectTimestampInMsAndUs = config_get_setting( keyfile_plugin, "autodetect_timestamp_in_ms_us"); } /* ---------------------------- */ main_menu_item = gtk_menu_item_new_with_mnemonic( "Unix Timestamp Converter"); gtk_widget_show(main_menu_item); gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), main_menu_item); g_signal_connect(main_menu_item, "activate", G_CALLBACK(item_activate_cb), NULL); /* Register shortcut key group */ geany_key_group = plugin_set_key_group( geany_plugin, _("unix_ts_converter"), 1, NULL); /* Ctrl + Alt + c */ keybindings_set_item(geany_key_group, 0, kb_run_unix_ts_converter, GDK_c, GDK_CONTROL_MASK | GDK_MOD1_MASK, "run_unix_ts_converter", _("Run the Unix Timestamp Converter"), main_menu_item); }
void plugin_init (GeanyData *data) { GeanyKeyGroup *group; group = plugin_set_key_group (geany_plugin, "commander", KB_COUNT, NULL); keybindings_set_item (group, KB_SHOW_PANEL, on_kb_show_panel, 0, 0, "show_panel", _("Show Command Panel"), NULL); /* delay for other plugins to have a chance to load before, so we will * include their items */ plugin_idle_add (geany_plugin, on_plugin_idle_init, NULL); }
void plugin_init(GeanyData *data) { GeanyKeyGroup *key_group; GKeyFile *config = g_key_file_new(); gchar *default_lang; default_lang = sc_speller_get_default_lang(); sc_info = g_new0(SpellCheck, 1); sc_info->config_file = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "spellcheck", G_DIR_SEPARATOR_S, "spellcheck.conf", NULL); g_key_file_load_from_file(config, sc_info->config_file, G_KEY_FILE_NONE, NULL); sc_info->default_language = utils_get_setting_string(config, "spellcheck", "language", default_lang); sc_info->check_while_typing = utils_get_setting_boolean(config, "spellcheck", "check_while_typing", FALSE); sc_info->check_on_document_open = utils_get_setting_boolean(config, "spellcheck", "check_on_document_open", FALSE); sc_info->show_toolbar_item = utils_get_setting_boolean(config, "spellcheck", "show_toolbar_item", TRUE); sc_info->show_editor_menu_item = utils_get_setting_boolean(config, "spellcheck", "show_editor_menu_item", TRUE); sc_info->show_editor_menu_item_sub_menu = utils_get_setting_boolean(config, "spellcheck", "show_editor_menu_item_sub_menu", TRUE); sc_info->dictionary_dir = utils_get_setting_string(config, "spellcheck", "dictionary_dir", NULL); sc_info->use_msgwin = utils_get_setting_boolean(config, "spellcheck", "use_msgwin", FALSE); g_key_file_free(config); g_free(default_lang); sc_info->menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_SPELL_CHECK, NULL); ui_add_document_sensitive(sc_info->menu_item); sc_gui_update_toolbar(); sc_gui_init(); sc_speller_init(); sc_gui_update_menu(); gtk_widget_show_all(sc_info->menu_item); /* setup keybindings */ key_group = plugin_set_key_group(geany_plugin, "spellcheck", KB_COUNT, NULL); keybindings_set_item(key_group, KB_SPELL_CHECK, sc_gui_kb_run_activate_cb, 0, 0, "spell_check", _("Run Spell Check"), sc_info->submenu_item_default); keybindings_set_item(key_group, KB_SPELL_TOOGLE_TYPING, sc_gui_kb_toggle_typing_activate_cb, 0, 0, "spell_toggle_typing", _("Toggle Check While Typing"), NULL); }
void plugin_init(GeanyData *data) { GeanyDocument *doc = document_get_current(); GeanyKeyGroup *group; GtkWidget *menu; load_config(); /* menu items and keybindings */ group = plugin_set_key_group(geany_plugin, "vimode", KB_COUNT, NULL); menu_items.parent_item = gtk_menu_item_new_with_mnemonic(_("_Vim Mode")); gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_items.parent_item); menu = gtk_menu_new (); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_items.parent_item), menu); menu_items.enable_vim_item = gtk_check_menu_item_new_with_mnemonic(_("Enable _Vim Mode")); gtk_container_add(GTK_CONTAINER(menu), menu_items.enable_vim_item); g_signal_connect((gpointer) menu_items.enable_vim_item, "activate", G_CALLBACK(on_enable_vim_mode), NULL); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items.enable_vim_item), vi_get_enabled()); keybindings_set_item_full(group, KB_ENABLE_VIM, 0, 0, "enable_vim", _("Enable Vim Mode"), NULL, on_enable_vim_mode_kb, NULL, NULL); menu_items.insert_for_dummies_item = gtk_check_menu_item_new_with_mnemonic(_("Insert Mode for _Dummies")); gtk_container_add(GTK_CONTAINER(menu), menu_items.insert_for_dummies_item); g_signal_connect((gpointer) menu_items.insert_for_dummies_item, "activate", G_CALLBACK(on_insert_for_dummies), NULL); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items.insert_for_dummies_item), vi_get_insert_for_dummies()); keybindings_set_item_full(group, KB_INSERT_FOR_DUMMIES, 0, 0, "insert_for_dummies", _("Insert Mode for Dummies"), NULL, on_insert_for_dummies_kb, NULL, NULL); menu_items.start_in_insert_item = gtk_check_menu_item_new_with_mnemonic(_("Start in _Insert Mode")); gtk_container_add(GTK_CONTAINER(menu), menu_items.start_in_insert_item); g_signal_connect((gpointer) menu_items.start_in_insert_item, "activate", G_CALLBACK(on_start_in_insert), NULL); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items.start_in_insert_item), start_in_insert); gtk_widget_show_all(menu_items.parent_item); cb.on_mode_change = on_mode_change; cb.on_save = on_save; cb.on_save_all = on_save_all; cb.on_quit = on_quit; vi_init(geany_data->main_widgets->window, &cb); vi_set_mode(start_in_insert ? VI_MODE_INSERT : VI_MODE_COMMAND); if (doc) vi_set_active_sci(doc->editor->sci); }
/** Sets up or resizes a keybinding group for the plugin * * You should then call keybindings_set_item() or keybindings_set_item_full() for each * keybinding in the group. * @param plugin Must be @ref geany_plugin. * @param section_name Name of the section used for this group in the keybindings configuration file, i.e. @c "html_chars". * @param count Number of keybindings for the group. * @param cb @nullable New-style group callback, or @c NULL if you only want individual keybinding callbacks. * @param pdata Plugin specific data, passed to the group callback @a cb. * @param destroy_notify Function that is invoked to free the plugin data when not needed anymore. * @return @transfer{none} The plugin's keybinding group. * * @since 1.26 (API 226) * @see See keybindings_set_item * @see See keybindings_set_item_full **/ GEANY_API_SYMBOL GeanyKeyGroup *plugin_set_key_group_full(GeanyPlugin *plugin, const gchar *section_name, gsize count, GeanyKeyGroupFunc cb, gpointer pdata, GDestroyNotify destroy_notify) { GeanyKeyGroup *group; group = plugin_set_key_group(plugin, section_name, count, NULL); group->cb_func = cb; group->cb_data = pdata; group->cb_data_destroy = destroy_notify; return group; }
PyObject * kb_manager_init(PyObject *module, PyObject *args, PyObject *kwargs) { gchar *pgn; gchar *plugin_group_name; const gchar *temp_name; plugin_group_name = name_to_key("GeanyPy"); if (!plugin_group) { plugin_group = plugin_set_key_group(geany_plugin, plugin_group_name, KB_MAX, (GeanyKeyGroupCallback) on_keybinding_activate); } if (plugin_group) { Py_RETURN_TRUE; } else { Py_RETURN_FALSE; } }
/* Called by Geany to initialize the plugin */ void plugin_init(GeanyData G_GNUC_UNUSED *data) { GKeyFile *config = g_key_file_new(); gchar *kb_label = _("Send file by mail"); GtkWidget *menu_mail = NULL; GeanyKeyGroup *key_group; config_file = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "geanysendmail", G_DIR_SEPARATOR_S, "mail.conf", NULL); /* Initialising options from config file */ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); mailer = g_key_file_get_string(config, "tools", "mailer", NULL); address = g_key_file_get_string(config, "tools", "address", NULL); use_address_dialog = g_key_file_get_boolean(config, "tools", "address_usage", NULL); icon_in_toolbar = g_key_file_get_boolean(config, "icon", "show_icon", NULL); g_key_file_free(config); add_stock_item(); if (icon_in_toolbar == TRUE) { show_icon(); } /* Build up menu entry */ menu_mail = gtk_menu_item_new_with_mnemonic(_("_Mail document")); gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_mail); gtk_widget_set_tooltip_text(menu_mail, _("Sends the opened file as unzipped attachment by any mailer from your $PATH")); g_signal_connect(G_OBJECT(menu_mail), "activate", G_CALLBACK(send_as_attachment), NULL); /* setup keybindings */ key_group = plugin_set_key_group(geany_plugin, "sendmail", COUNT_KB, NULL); keybindings_set_item(key_group, SENDMAIL_KB, key_send_as_attachment, 0, 0, "send_file_as_attachment", kb_label, menu_mail); gtk_widget_show_all(menu_mail); ui_add_document_sensitive(menu_mail); main_menu_item = menu_mail; }
void plugin_init(G_GNUC_UNUSED GeanyData * data) { GeanyKeyGroup *key_group; gchar *kb_label1; gchar *kb_label2; kb_label1 = _("Document current word"); kb_label2 = _("Document interactive"); config_init(); keyb1 = gtk_menu_item_new(); keyb2 = gtk_menu_item_new(); key_group = plugin_set_key_group(geany_plugin, "doc_chars", KB_COUNT, NULL); keybindings_set_item(key_group, KB_DOCUMENT_WORD, kb_doc, 0, 0, kb_label1, kb_label1, keyb1); keybindings_set_item(key_group, KB_DOCUMENT_WORD_ASK, kb_doc_ask, 0, 0, kb_label2, kb_label2, keyb2); }
void plugin_init(GeanyData *data) { GtkWidget *item, *menu; GeanyKeyGroup *key_group; menu_items.main = item = gtk_menu_item_new_with_mnemonic(_("_Split Window")); gtk_menu_shell_append(GTK_MENU_SHELL(geany_data->main_widgets->tools_menu), item); ui_add_document_sensitive(item); menu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_items.main), menu); menu_items.horizontal = item = gtk_menu_item_new_with_mnemonic(_("_Side by Side")); g_signal_connect(item, "activate", G_CALLBACK(on_split_horizontally), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); menu_items.vertical = item = gtk_menu_item_new_with_mnemonic(_("_Top and Bottom")); g_signal_connect(item, "activate", G_CALLBACK(on_split_vertically), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); menu_items.unsplit = item = gtk_menu_item_new_with_mnemonic(_("_Unsplit")); g_signal_connect(item, "activate", G_CALLBACK(on_unsplit), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); gtk_widget_show_all(menu_items.main); set_state(STATE_UNSPLIT); /* setup keybindings */ key_group = plugin_set_key_group(geany_plugin, "split_window", KB_COUNT, NULL); keybindings_set_item(key_group, KB_SPLIT_HORIZONTAL, kb_activate, 0, 0, "split_horizontal", _("Side by Side"), menu_items.horizontal); keybindings_set_item(key_group, KB_SPLIT_VERTICAL, kb_activate, 0, 0, "split_vertical", _("Top and Bottom"), menu_items.vertical); keybindings_set_item(key_group, KB_SPLIT_UNSPLIT, kb_activate, 0, 0, "split_unsplit", _("_Unsplit"), menu_items.unsplit); }
void plugin_init(G_GNUC_UNUSED GeanyData *data) { GeanyKeyGroup *plugin_key_group; plugin_key_group = plugin_set_key_group(geany_plugin, "insert_numbers", COUNT_KB, NULL); start_value = 1; step_value = 1; base_value = 10; main_menu_item = gtk_menu_item_new_with_mnemonic(_("Insert _Numbers")); gtk_widget_show(main_menu_item); gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), main_menu_item); g_signal_connect(main_menu_item, "activate", G_CALLBACK(on_insert_numbers_activate), NULL); keybindings_set_item(plugin_key_group, INSERT_NUMBERS_KB, on_insert_numbers_key, 0, 0, "insert_numbers", _("Insert Numbers"), main_menu_item); plugin_signal_connect(geany_plugin, G_OBJECT(geany->main_widgets->tools_menu), "show", FALSE, (GCallback) on_tools_show, NULL); }
/* 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); }
void plugin_init (GeanyData *data) { GeanyKeyGroup *group; group = plugin_set_key_group (geany_plugin, "commander", KB_COUNT, NULL); keybindings_set_item_full (group, KB_SHOW_PANEL, 0, 0, "show_panel", _("Show Command Panel"), NULL, on_kb_show_panel, NULL, NULL); keybindings_set_item_full (group, KB_SHOW_PANEL_COMMANDS, 0, 0, "show_panel_commands", _("Show Command Panel (Commands Only)"), NULL, on_kb_show_panel, (gpointer) "c:", NULL); keybindings_set_item_full (group, KB_SHOW_PANEL_FILES, 0, 0, "show_panel_files", _("Show Command Panel (Files Only)"), NULL, on_kb_show_panel, (gpointer) "f:", NULL); /* delay for other plugins to have a chance to load before, so we will * include their items */ plugin_idle_add (geany_plugin, on_plugin_idle_init, NULL); }
void plugin_init(G_GNUC_UNUSED GeanyData * data) { GeanyKeyGroup *key_group = plugin_set_key_group(geany_plugin, "GeanyCtags", KB_COUNT, kb_callback); s_context_sep_item = gtk_separator_menu_item_new(); gtk_widget_show(s_context_sep_item); gtk_menu_shell_prepend(GTK_MENU_SHELL(geany->main_widgets->editor_menu), s_context_sep_item); s_context_fdec_item = gtk_menu_item_new_with_mnemonic(_("Find Tag Declaration (geanyctags)")); gtk_widget_show(s_context_fdec_item); gtk_menu_shell_prepend(GTK_MENU_SHELL(geany->main_widgets->editor_menu), s_context_fdec_item); g_signal_connect((gpointer) s_context_fdec_item, "activate", G_CALLBACK(on_find_declaration), NULL); s_context_fdef_item = gtk_menu_item_new_with_mnemonic(_("Find Tag Definition (geanyctags)")); gtk_widget_show(s_context_fdef_item); gtk_menu_shell_prepend(GTK_MENU_SHELL(geany->main_widgets->editor_menu), s_context_fdef_item); g_signal_connect((gpointer) s_context_fdef_item, "activate", G_CALLBACK(on_find_definition), NULL); s_sep_item = gtk_separator_menu_item_new(); gtk_widget_show(s_sep_item); gtk_container_add(GTK_CONTAINER(geany->main_widgets->project_menu), s_sep_item); s_gt_item = gtk_menu_item_new_with_mnemonic(_("Generate tags")); gtk_widget_show(s_gt_item); gtk_container_add(GTK_CONTAINER(geany->main_widgets->project_menu), s_gt_item); g_signal_connect((gpointer) s_gt_item, "activate", G_CALLBACK(on_generate_tags), NULL); keybindings_set_item(key_group, KB_GENERATE_TAGS, NULL, 0, 0, "generate_tags", _("Generate tags"), s_gt_item); s_ft_item = gtk_menu_item_new_with_mnemonic(_("Find tag...")); gtk_widget_show(s_ft_item); gtk_container_add(GTK_CONTAINER(geany->main_widgets->project_menu), s_ft_item); g_signal_connect((gpointer) s_ft_item, "activate", G_CALLBACK(on_find_tag), NULL); keybindings_set_item(key_group, KB_FIND_TAG, NULL, 0, 0, "find_tag", _("Find tag"), s_ft_item); set_widgets_sensitive(geany_data->app->project != NULL); }
pdata->tools_menu_item); } /* destroys plugin's menus */ static void destroy_menus (PluginData *pdata) { gtk_widget_destroy (pdata->tools_menu_item); pdata->tools_menu_item = NULL; remove_edit_menu_item (pdata); } void plugin_init (GeanyData *data G_GNUC_UNUSED) { plugin->kb_group = plugin_set_key_group (geany_plugin, GGD_PLUGIN_CNAME, NUM_KB, NULL); load_configuration (); build_menus (plugin); plugin_signal_connect (geany_plugin, NULL, "update-editor-menu", FALSE, G_CALLBACK (update_editor_menu_handler), plugin); } void plugin_cleanup (void) { destroy_menus (plugin); unload_configuration (); plugin->kb_group = NULL; } void
void plugin_init(GeanyData *data) { conf = g_build_path(G_DIR_SEPARATOR_S, geany_data->app->configdir, "plugins", "quick-find.conf", NULL); config = g_key_file_new(); g_key_file_load_from_file(config, conf, G_KEY_FILE_NONE, NULL); executable = utils_get_setting_string(config, "main", "executable", DEFAULT_EXECUTABLE); trim_file = g_regex_new(g_strconcat("^.*", G_DIR_SEPARATOR_S, NULL), G_REGEX_OPTIMIZE | G_REGEX_CASELESS, 0, NULL); trim_regex = g_regex_new("\n$", G_REGEX_OPTIMIZE | G_REGEX_CASELESS, 0, NULL); label = gtk_label_new(_("Find")); panel = gtk_vbox_new(FALSE, 6); scrollable_table = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollable_table), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(panel), scrollable_table, TRUE, TRUE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), panel, label); entry = gtk_entry_new(); gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FIND); g_signal_connect(entry, "activate", G_CALLBACK(on_activate), NULL); GtkWidget *button_box = gtk_hbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(button_box), entry, TRUE, TRUE, 0); GtkWidget *button = gtk_button_new_with_label(_("Find")); g_signal_connect(button, "clicked", G_CALLBACK(on_click), NULL); gtk_box_pack_end(GTK_BOX(button_box), button, FALSE, TRUE, 0); check_case = gtk_check_button_new_with_label(_("Case Sensitive")); ui_widget_set_tooltip_text(check_case, _("Perform a case-sensitive search.")); gtk_box_pack_end(GTK_BOX(panel), check_case, FALSE, TRUE, 0); gtk_box_pack_end(GTK_BOX(panel), button_box, FALSE, TRUE, 0); gtk_container_set_focus_child(GTK_CONTAINER(panel), entry); GtkTreeViewColumn *number_column, *line_column, *file_column, *text_column; GtkCellRenderer *render; list = gtk_tree_store_new(4, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list)); render = gtk_cell_renderer_text_new(); number_column = gtk_tree_view_column_new_with_attributes("#", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), number_column); gtk_tree_view_column_set_alignment(number_column, 1.0); gtk_cell_renderer_set_alignment(render, 1.0, 0.0); gtk_tree_view_column_add_attribute(number_column, render, "text", 0); render = gtk_cell_renderer_text_new(); line_column = gtk_tree_view_column_new_with_attributes("Line", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), line_column); gtk_tree_view_column_set_alignment(line_column, 1.0); gtk_cell_renderer_set_alignment(render, 1.0, 0.0); gtk_tree_view_column_add_attribute(line_column, render, "text", 1); render = gtk_cell_renderer_text_new(); file_column = gtk_tree_view_column_new_with_attributes("File", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), file_column); gtk_tree_view_column_add_attribute(file_column, render, "text", 2); gtk_tree_view_column_set_cell_data_func(file_column, render, (GtkTreeCellDataFunc)cell_data, NULL, NULL); render = gtk_cell_renderer_text_new(); text_column = gtk_tree_view_column_new_with_attributes("Text", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), text_column); gtk_tree_view_column_add_attribute(text_column, render, "text", 3); g_object_unref(GTK_TREE_MODEL(list)); GtkTreeSelection *select = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); g_signal_connect(select, "changed", G_CALLBACK(selected_row), NULL); gtk_container_add(GTK_CONTAINER(scrollable_table), tree); gtk_widget_show(label); gtk_widget_show_all(panel); g_signal_connect(geany->main_widgets->window, "key-release-event", G_CALLBACK(panel_focus_tab), NULL); GeanyKeyGroup *key_group; key_group = plugin_set_key_group(geany_plugin, "quick_find_keyboard_shortcut", KB_GROUP, NULL); keybindings_set_item(key_group, KB_QUICK_FIND, entry_focus, 0, 0, "quick_find", _("Quick Find..."), NULL); }
/* Called by Geany to initialize the plugin */ void plugin_init(GeanyData G_GNUC_UNUSED *data) { GKeyFile *config = g_key_file_new(); gchar *config_file_old = NULL; gchar *config_dir = NULL; gchar *config_dir_old = NULL; gchar *kb_label = _("Send file by mail"); GtkWidget *menu_mail = NULL; GeanyKeyGroup *key_group; config_file = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "sendmail", G_DIR_SEPARATOR_S, "mail.conf", NULL); #ifndef G_OS_WIN32 /* We try only to move if we are on not Windows platform */ config_file_old = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "geanysendmail", G_DIR_SEPARATOR_S, "mail.conf", NULL); config_dir = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "sendmail", NULL); config_dir_old = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "geanysendmail", NULL); if (g_file_test(config_file_old, G_FILE_TEST_EXISTS)) { if (dialogs_show_question( _("Renamed plugin detected!\n" "\n" "GeanySendMail has been renamed to sendmail -- you surely have " "already recognised it. \n" "Geany is able to migrate your old plugin configuration by " "moving the old configuration file to new location.\n" "Move now?"))) { if (g_rename(config_dir_old, config_dir) == 0) { dialogs_show_msgbox(GTK_MESSAGE_INFO, _("Your configuration directory has been " "successfully moved from \"%s\" to \"%s\"."), config_dir_old, config_dir); } else { /* If there was an error on migrating we need * to load from original one. * When saving new configuration it will go to * new folder so migration should * be implicit. */ g_free(config_file); config_file = g_strdup(config_file_old); dialogs_show_msgbox( GTK_MESSAGE_WARNING, _("Your old configuration directory \"%s\" could " "not be moved to \"%s\" (%s). " "Please move manually the directory to the new location."), config_dir_old, config_dir, g_strerror(errno)); } } } g_free(config_dir_old); g_free(config_dir); g_free(config_file_old); #endif /* Initialising options from config file */ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); mailer = g_key_file_get_string(config, "tools", "mailer", NULL); address = g_key_file_get_string(config, "tools", "address", NULL); use_address_dialog = g_key_file_get_boolean(config, "tools", "address_usage", NULL); icon_in_toolbar = g_key_file_get_boolean(config, "icon", "show_icon", NULL); g_key_file_free(config); add_stock_item(); if (icon_in_toolbar == TRUE) { show_icon(); } /* Build up menu entry */ menu_mail = gtk_menu_item_new_with_mnemonic(_("_Mail document")); gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_mail); gtk_widget_set_tooltip_text(menu_mail, _("Sends the opened file as unzipped attachment by any mailer from your $PATH")); g_signal_connect(G_OBJECT(menu_mail), "activate", G_CALLBACK(send_as_attachment), NULL); /* setup keybindings */ key_group = plugin_set_key_group(geany_plugin, "sendmail", COUNT_KB, NULL); keybindings_set_item(key_group, SENDMAIL_KB, key_send_as_attachment, 0, 0, "send_file_as_attachment", kb_label, menu_mail); gtk_widget_show_all(menu_mail); ui_add_document_sensitive(menu_mail); main_menu_item = menu_mail; }
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); }
void plugin_init(G_GNUC_UNUSED GeanyData *data) { GtkContainer *menu; GtkWidget *item; GeanyKeyGroup *plugin_key_group; plugin_key_group = plugin_set_key_group(geany_plugin, "extra_select", COUNT_KB, NULL); item = gtk_menu_item_new_with_mnemonic(_("E_xtra Selection")); main_menu_item = item; gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), item); ui_add_document_sensitive(item); menu = GTK_CONTAINER(gtk_menu_new()); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), GTK_WIDGET(menu)); item = gtk_check_menu_item_new_with_mnemonic(_("_Column Mode")); column_mode_item = GTK_CHECK_MENU_ITEM(item); gtk_container_add(menu, item); g_signal_connect(item, "toggled", G_CALLBACK(on_column_mode_toggled), NULL); keybindings_set_item(plugin_key_group, COLUMN_MODE_KB, on_column_mode_key, 0, 0, "column_mode", _("Column mode"), item); item = gtk_menu_item_new_with_mnemonic(_("Select to _Line")); gtk_container_add(menu, item); g_signal_connect(item, "activate", G_CALLBACK(on_goto_line_activate), NULL); keybindings_set_item(plugin_key_group, GOTO_LINE_EXTEND_KB, on_goto_line_key, 0, 0, "goto_line_extend", _("Select to line"), item); item = gtk_menu_item_new_with_mnemonic(_("Select to Matching _Brace")); gtk_container_add(menu, item); g_signal_connect(item, "activate", G_CALLBACK(on_brace_match_activate), NULL); keybindings_set_item(plugin_key_group, BRACE_MATCH_EXTEND_KB, on_brace_match_key, 0, 0, "brace_match_extend", _("Select to matching brace"), item); item = gtk_menu_item_new_with_mnemonic(_("_Toggle Stream/Rectangular")); gtk_container_add(menu, item); g_signal_connect(item, "activate", G_CALLBACK(on_convert_selection_activate), NULL); keybindings_set_item(plugin_key_group, CONVERT_SELECTION_KB, on_convert_selection_key, 0, 0, "convert_selection", _("Convert selection"), item); g_signal_connect(main_menu_item, "activate", G_CALLBACK(on_extra_select_activate), item); gtk_container_add(menu, gtk_separator_menu_item_new()); item = gtk_menu_item_new_with_mnemonic(_("_Set Anchor")); gtk_container_add(menu, item); g_signal_connect(item, "activate", G_CALLBACK(on_set_anchor_activate), NULL); keybindings_set_item(plugin_key_group, SET_ANCHOR_KB, on_set_anchor_key, 0, 0, "set_anchor", _("Set anchor"), item); item = gtk_menu_item_new_with_mnemonic(_("Select to _Anchor")); gtk_container_add(menu, item); g_signal_connect(item, "activate", G_CALLBACK(on_select_to_anchor_activate), NULL); keybindings_set_item(plugin_key_group, ANCHOR_EXTEND_KB, on_select_to_anchor_key, 0, 0, "select_to_anchor", _("Select to anchor"), item); item = gtk_menu_item_new_with_mnemonic(_("_Rectangle Select to Anchor")); anchor_rect_select_item = item; gtk_container_add(menu, item); g_signal_connect(item, "activate", G_CALLBACK(on_select_rectangle_activate), NULL); keybindings_set_item(plugin_key_group, ANCHOR_RECTEXTEND_KB, on_select_rectangle_key, 0, 0, "rect_select_to_anchor", _("Rectangle select to anchor"), item); gtk_widget_show_all(main_menu_item); go_to_line1_item = g_object_get_data((gpointer) geany->main_widgets->window, "go_to_line1"); update_home_key(); plugin_signal_connect(geany_plugin, G_OBJECT(geany->main_widgets->window), "key-press-event", FALSE, G_CALLBACK(on_key_press_event), NULL); }
void plugin_init(G_GNUC_UNUSED GeanyData *data) { GeanyKeyGroup *group; GtkWidget *menu, *item; fmt_prefs_init(); #define CONNECT(sig, cb) \ plugin_signal_connect(geany_plugin, NULL, sig, TRUE, G_CALLBACK(cb), NULL) CONNECT("editor-notify", on_editor_notify); CONNECT("project-dialog-open", on_project_dialog_open); CONNECT("project-dialog-close", on_project_dialog_close); CONNECT("project-dialog-confirmed", on_project_dialog_confirmed); CONNECT("project-open", on_project_open); CONNECT("project-close", on_project_close); CONNECT("project-save", on_project_save); CONNECT("document-before-save", on_document_before_save); #undef CONNECT group = plugin_set_key_group(geany_plugin, _("Code Formatting"), 3, (GeanyKeyGroupCallback)on_key_binding); main_menu_item = gtk_menu_item_new_with_label(_("Code Format")); ui_add_document_sensitive(main_menu_item); g_signal_connect(main_menu_item, "map", G_CALLBACK(on_tools_item_map), NULL); menu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(main_menu_item), menu); item = gtk_check_menu_item_new_with_label(_("Auto-Formatting")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); g_signal_connect(item, "toggled", G_CALLBACK(on_auto_format_item_toggled), NULL); g_signal_connect(item, "map", G_CALLBACK(on_auto_format_item_map), NULL); item = gtk_separator_menu_item_new(); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); item = gtk_menu_item_new_with_label(_("Current Line or Selection")); g_signal_connect(item, "activate", G_CALLBACK(on_menu_item_activate), GINT_TO_POINTER(FORMAT_KEY_REGION)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); keybindings_set_item(group, FORMAT_KEY_REGION, NULL, 0, 0, "format_region", _("Format current line or selection"), item); item = gtk_menu_item_new_with_label(_("Entire Document")); g_signal_connect(item, "activate", G_CALLBACK(on_menu_item_activate), GINT_TO_POINTER(FORMAT_KEY_DOCUMENT)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); keybindings_set_item(group, FORMAT_KEY_DOCUMENT, NULL, 0, 0, "format_document", _("Format entire document"), item); item = gtk_menu_item_new_with_label(_("Entire Session")); g_signal_connect(item, "activate", G_CALLBACK(on_menu_item_activate), GINT_TO_POINTER(FORMAT_KEY_SESSION)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); keybindings_set_item(group, FORMAT_KEY_SESSION, NULL, 0, 0, "format_session", _("Format entire session"), item); item = gtk_separator_menu_item_new(); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); item = gtk_menu_item_new_with_label(_("Open Configuration File")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); g_signal_connect(item, "activate", G_CALLBACK(on_open_config_file), NULL); g_signal_connect(item, "map", G_CALLBACK(on_open_config_item_map), NULL); gtk_widget_show_all(main_menu_item); gtk_menu_shell_append(GTK_MENU_SHELL(geany_data->main_widgets->tools_menu), main_menu_item); }
/* 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; gchar *config_file_old = NULL; gchar *config_dir = NULL; gchar *config_dir_old = NULL; GeanyKeyGroup *key_group; config_file = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, "geanylipsum", G_DIR_SEPARATOR_S, "lipsum.conf", NULL); #ifndef G_OS_WIN32 /* We try only to move if we are on not Windows platform */ config_dir_old = g_build_filename(geany->app->configdir, "plugins", "geanylipsum", NULL); config_file_old = g_build_filename(config_dir_old, "lipsum.conf", NULL); config_dir = g_build_filename(geany->app->configdir, "plugins", "lipsum", NULL); if (g_file_test(config_file_old, G_FILE_TEST_EXISTS)) { if (dialogs_show_question( _("Renamed plugin detected!\n" "\n" "As you may have already noticed, GeanyLipsum has been " "renamed to just Lipsum. \n" "Geany is able to migrate your old plugin configuration by " "moving the old configuration file to new location.\n" "Warning: This will not include your keybindings.\n" "Move now?"))) { if (g_rename(config_dir_old, config_dir) == 0) { dialogs_show_msgbox(GTK_MESSAGE_INFO, _("Your configuration directory has been " "successfully moved from \"%s\" to \"%s\"."), config_dir_old, config_dir); } else { /* If there was an error on migrating we need * to load from original one. * When saving new configuration it will go to * new folder so migration should * be implicit. */ g_free(config_file); config_file = g_strdup(config_file_old); dialogs_show_msgbox( GTK_MESSAGE_WARNING, _("Your old configuration directory \"%s\" could " "not be moved to \"%s\" (%s). " "Please manually move the directory to the new location."), config_dir_old, config_dir, g_strerror(errno)); } } } g_free(config_dir_old); g_free(config_dir); g_free(config_file_old); #endif /* 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, "lipsum", COUNT_KB, NULL); keybindings_set_item(key_group, LIPSUM_KB_INSERT, kblipsum_insert, 0, 0, "insert_lipsum", _("Insert Lipsum text"), menu_lipsum); }