Example #1
0
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);
}
Example #2
0
// Finds all tracks that match the given pattern.
//
// Prints track number and title.
void find_track_regex(char pattern[])
{
    
    regex_t r;
    const char * regex_text = pattern;
    if (!setup_regex(& r, regex_text)){
        run_regex(& r);
        regfree (& r);
    }

}
Example #3
0
static void dialog_response(GtkDialog *configure, gint response, gpointer user_data)
{
	if(response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) {
		include_path = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_search_path));
		g_free(pathRegexSetting.text);
		g_free(nameRegexSetting.text);
		pathRegexSetting.text = g_strdup(gtk_entry_get_text(GTK_ENTRY(pathRegexSetting.entry)));
		nameRegexSetting.text = g_strdup(gtk_entry_get_text(GTK_ENTRY(nameRegexSetting.entry)));
		opener_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(button_folder_picker));
		g_key_file_set_boolean(config, "main", "include-path", include_path);
		g_key_file_set_string(config, "main", "path-regex", pathRegexSetting.text);
		g_key_file_set_string(config, "main", "name-regex", nameRegexSetting.text);
		g_key_file_set_string(config, "main", "path", opener_path);
		
		g_regex_unref(pathRegexSetting.regex);
		g_regex_unref(nameRegexSetting.regex);
		setup_regex();
	}
}
Example #4
0
void main() {
  setup_regex();

  file_count=0;

  FILE *f;
  char row[BUFSIZE];
  int line=0;
  f=fopen("osm2shp.cfg", "r");

  while(fgets(row, BUFSIZE, f)) {
    line++;
    rtrim(row);
    if(!parse_line(row)) {
      fprintf(stderr, "Error parsing line %d: '%s'\n", line, row);
      exit(1);
    }
  }

  regex_t r_type;
  regcomp(&r_type, "%TYPE_([0-9])%", REG_EXTENDED);

  FILE *template;