void plugin_init (GeanyData *data) { /* even though it's not really a good idea to keep all the library we load * into memory, this is needed for webkit. first, without this we creash after * module unloading, and webkitgtk inserts static data into the GLib * (g_quark_from_static_string() for example) so it's not safe to remove it */ plugin_module_make_resident (geany_plugin); /* webkit uses threads but don't initialize the thread system */ if (! g_thread_supported ()) { g_thread_init (NULL); } load_config (); gwh_keybindings_init (); G_browser = gwh_browser_new (); g_signal_connect (G_browser, "populate-popup", G_CALLBACK (on_browser_populate_popup), NULL); attach_browser (); gtk_widget_show_all (G_browser); plugin_signal_connect (geany_plugin, G_OBJECT (G_settings), "notify::browser-position", FALSE, G_CALLBACK (on_settings_browser_position_notify), NULL); plugin_signal_connect (geany_plugin, G_OBJECT (G_settings), "notify::wm-secondary-windows-skip-taskbar", FALSE, G_CALLBACK (on_settings_windows_attrs_notify), NULL); plugin_signal_connect (geany_plugin, G_OBJECT (G_settings), "notify::wm-secondary-windows-are-transient", FALSE, G_CALLBACK (on_settings_windows_attrs_notify), NULL); plugin_signal_connect (geany_plugin, G_OBJECT (G_settings), "notify::wm-secondary-windows-type", FALSE, G_CALLBACK (on_settings_windows_attrs_notify), NULL); plugin_signal_connect (geany_plugin, NULL, "document-save", TRUE, G_CALLBACK (on_document_save), NULL); /* add keybindings */ keybindings_set_item (gwh_keybindings_get_group (), GWH_KB_TOGGLE_INSPECTOR, on_kb_toggle_inspector, GDK_F12, 0, "toggle_inspector", _("Toggle Web Inspector"), NULL); keybindings_set_item (gwh_keybindings_get_group (), GWH_KB_SHOW_HIDE_SEPARATE_WINDOW, on_kb_show_hide_separate_window, 0, 0, "show_hide_separate_window", _("Show/Hide Web View's Window"), NULL); keybindings_set_item (gwh_keybindings_get_group (), GWH_KB_TOGGLE_BOOKMARK, on_kb_toggle_bookmark, 0, 0, "toggle_bookmark", _("Toggle bookmark for the current website"), NULL); }
GeanyDBusApplication* geany_dbus_application_construct (GType object_type, GeanyApp* app) { GeanyDBusApplication * self; g_return_val_if_fail (app != NULL, NULL); self = (GeanyDBusApplication*) g_object_new (object_type, NULL); self->priv->app = app; plugin_signal_connect (geany_plugin, NULL, "build-start", TRUE, (GCallback) geany_dbus_application_on_build_start, self); return self; }
void overview_ui_init (OverviewPrefs *prefs) { overview_ui_prefs = g_object_ref (prefs); overview_ui_add_menu_item (); overview_ui_hijack_all_editor_views (); g_signal_connect (prefs, "notify::position", G_CALLBACK (on_position_pref_notify), NULL); plugin_signal_connect (geany_plugin, NULL, "document-new", TRUE, G_CALLBACK (on_document_open_new), NULL); plugin_signal_connect (geany_plugin, NULL, "document-open", TRUE, G_CALLBACK (on_document_open_new), NULL); plugin_signal_connect (geany_plugin, NULL, "document-activate", TRUE, G_CALLBACK (on_document_activate_reload), NULL); plugin_signal_connect (geany_plugin, NULL, "document-reload", TRUE, G_CALLBACK (on_document_activate_reload), NULL); plugin_signal_connect (geany_plugin, NULL, "document-close", TRUE, G_CALLBACK (on_document_close), NULL); }
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); }
void ao_enclose_words_init (gchar *config_file_name, GeanyKeyGroup *key_group) { GKeyFile *config = g_key_file_new(); gchar key_name[] = "Enclose_x"; gint i; config_file = g_strdup (config_file_name); g_key_file_load_from_file (config, config_file, G_KEY_FILE_NONE, NULL); for (i = 0; i < 8; i++) { key_name [8] = (gchar) (i + '0'); enclose_chars [i] = utils_get_setting_string (config, "addons", key_name, " "); key_name [8] = (gchar) ((i + 1) + '0'); keybindings_set_item (key_group, i+4, (GeanyKeyCallback) enclose_text_action, 0, 0, key_name, key_name, NULL); } plugin_signal_connect(geany_plugin, G_OBJECT(geany->main_widgets->window), "key-press-event", FALSE, G_CALLBACK(on_key_press), NULL); }
void prefs_init(void) { guint i; MarkerStyle *style = pref_marker_styles; StashGroup *group; char *configdir = g_build_filename(geany->app->configdir, "plugins", "scope", NULL); char *configfile = prefs_file_name(); GKeyFile *config = g_key_file_new(); gchar *tmp_string; group = stash_group_new("scope"); stash_group_add_string(group, &pref_gdb_executable, "gdb_executable", "gdb"); stash_group_add_boolean(group, &pref_gdb_async_mode, "gdb_async_mode", FALSE); stash_group_add_integer(group, &pref_gdb_buffer_length, "gdb_buffer_length", 16383); stash_group_add_integer(group, &pref_gdb_wait_death, "gdb_wait_death", 20); #ifndef G_OS_UNIX stash_group_add_integer(group, &pref_gdb_send_interval, "gdb_send_interval", 5); stash_group_add_boolean(group, &pref_async_break_bugs, "async_break_bugs", TRUE); #endif stash_group_add_boolean(group, &pref_auto_view_source, "auto_view_source", FALSE); stash_group_add_boolean(group, &pref_keep_exec_point, "keep_exec_point", FALSE); stash_group_add_integer(group, &pref_visual_beep_length, "visual_beep_length", 25); #ifdef G_OS_UNIX stash_group_add_boolean(group, &pref_debug_console_vte, "debug_console_vte", TRUE); #endif stash_group_add_integer(group, &pref_sci_marker_1st, "sci_marker_first", 17); stash_group_add_integer(group, &pref_sci_caret_policy, "sci_caret_policy", CARET_SLOP | CARET_JUMPS | CARET_EVEN); stash_group_add_integer(group, &pref_sci_caret_slop, "sci_caret_slop", 3); stash_group_add_boolean(group, &pref_unmark_current_line, "unmark_current_line", FALSE); stash_group_add_boolean(group, &pref_scope_goto_cursor, "scope_run_to_cursor", FALSE); stash_group_add_boolean(group, &pref_seek_with_navqueue, "seek_with_navqueue", FALSE); stash_group_add_integer(group, &pref_panel_tab_pos, "panel_tab_pos", GTK_POS_TOP); stash_group_add_integer(group, &pref_show_recent_items, "show_recent_items", 10); stash_group_add_integer(group, &pref_show_toolbar_items, "show_toolbar_items", 0xFF); stash_group_add_integer(group, &pref_tooltips_fail_action, "tooltips_fail_action", 0); stash_group_add_integer(group, &pref_tooltips_send_delay, "tooltips_send_delay", 25); stash_group_add_integer(group, &pref_tooltips_length, "tooltips_length", 2048); stash_group_add_integer(group, &pref_memory_bytes_per_line, "memory_line_bytes", 16); stash_group_add_string(group, &pref_memory_font, "memory_font", ""); scope_group = group; config_item = ui_add_config_file_menu_item(configfile, NULL, NULL); plugin_signal_connect(geany_plugin, NULL, "document-save", FALSE, G_CALLBACK(on_document_save), NULL); group = stash_group_new("terminal"); #ifdef G_OS_UNIX stash_group_add_boolean(group, &pref_terminal_save_pos, "save_pos", TRUE); stash_group_add_boolean(group, &pref_terminal_padding, "padding", TRUE); stash_group_add_integer(group, &pref_terminal_window_x, "window_x", 70); stash_group_add_integer(group, &pref_terminal_window_y, "window_y", 50); stash_group_add_integer(group, &pref_terminal_width, "width", 640); stash_group_add_integer(group, &pref_terminal_height, "height", 480); #endif /* G_OS_UNIX */ terminal_group = group; for (i = 0; i < MARKER_COUNT; i++, style++) { group = stash_group_new(style->name); stash_group_add_integer(group, &style->mark, "mark", style->default_mark); stash_group_add_integer(group, &style->alpha, "alpha", style->default_alpha); marker_group[i] = group; } g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL); load_scope_prefs(config); pref_sci_marker_first = pref_sci_marker_1st; prefs_configure(); program_load_config(config); if (pref_panel_tab_pos == GTK_POS_LEFT || pref_panel_tab_pos == GTK_POS_RIGHT) { gtk_label_set_label(GTK_LABEL(get_widget("program_terminal_label")), _("Program")); gtk_label_set_label(GTK_LABEL(get_widget("break_view_label")), _("Breaks")); gtk_label_set_label(GTK_LABEL(get_widget("debug_console_label")), _("Console")); } if (!g_file_test(configfile, G_FILE_TEST_IS_REGULAR)) { gint error = utils_mkdir(configdir, TRUE); if (error) msgwin_status_add(_("Scope: %s: %s."), configdir, g_strerror(error)); else { save_scope_prefs(config); if (utils_key_file_write_to_file(config, configfile)) msgwin_status_add(_("Scope: created configuration file.")); } } g_key_file_free(config); g_free(configfile); g_free(configdir); configfile = g_build_filename(geany_data->app->configdir, "geany.conf", NULL); config = g_key_file_new(); g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL); pref_vte_blinken = utils_get_setting_boolean(config, "VTE", "cursor_blinks", FALSE); pref_vte_emulation = utils_get_setting_string(config, "VTE", "emulation", "xterm"); pref_vte_font = utils_get_setting_string(config, "VTE", "font", "Monospace 10"); pref_vte_scrollback = utils_get_setting_integer(config, "VTE", "scrollback_lines", 500); tmp_string = utils_get_setting_string(config, "VTE", "colour_fore", "#ffffff"); gdk_color_parse(tmp_string, &pref_vte_colour_fore); g_free(tmp_string); tmp_string = utils_get_setting_string(config, "VTE", "colour_back", "#000000"); gdk_color_parse(tmp_string, &pref_vte_colour_back); g_free(tmp_string); g_key_file_free(config); g_free(configfile); }
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); }
static void signal_manager_connect_signals(SignalManager *man) { plugin_signal_connect(geany_plugin, NULL, "build-start", TRUE, G_CALLBACK(on_build_start), man); plugin_signal_connect(geany_plugin, NULL, "document-activate", TRUE, G_CALLBACK(on_document_activate), man); plugin_signal_connect(geany_plugin, NULL, "document-before-save", TRUE, G_CALLBACK(on_document_before_save), man); plugin_signal_connect(geany_plugin, NULL, "document-close", TRUE, G_CALLBACK(on_document_close), man); plugin_signal_connect(geany_plugin, NULL, "document-filetype-set", TRUE, G_CALLBACK(on_document_filetype_set), man); plugin_signal_connect(geany_plugin, NULL, "document-new", TRUE, G_CALLBACK(on_document_new), man); plugin_signal_connect(geany_plugin, NULL, "document-open", TRUE, G_CALLBACK(on_document_open), man); plugin_signal_connect(geany_plugin, NULL, "document-reload", TRUE, G_CALLBACK(on_document_reload), man); plugin_signal_connect(geany_plugin, NULL, "document-save", TRUE, G_CALLBACK(on_document_save), man); plugin_signal_connect(geany_plugin, NULL, "editor-notify", TRUE, G_CALLBACK(on_editor_notify), man); plugin_signal_connect(geany_plugin, NULL, "geany-startup-complete", TRUE, G_CALLBACK(on_geany_startup_complete), man); plugin_signal_connect(geany_plugin, NULL, "project-close", TRUE, G_CALLBACK(on_project_close), man); plugin_signal_connect(geany_plugin, NULL, "project-dialog-confirmed", TRUE, G_CALLBACK(on_project_dialog_confirmed), man); plugin_signal_connect(geany_plugin, NULL, "project-dialog-open", TRUE, G_CALLBACK(on_project_dialog_open), man); plugin_signal_connect(geany_plugin, NULL, "project-dialog-close", TRUE, G_CALLBACK(on_project_dialog_close), man); plugin_signal_connect(geany_plugin, NULL, "project-open", TRUE, G_CALLBACK(on_project_open), man); plugin_signal_connect(geany_plugin, NULL, "project-save", TRUE, G_CALLBACK(on_project_save), man); plugin_signal_connect(geany_plugin, NULL, "update-editor-menu", TRUE, G_CALLBACK(on_update_editor_menu), man); }
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); }