コード例 #1
0
static void on_project_close(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED gpointer user_data)
{
	prjorg_project_close();
	prjorg_sidebar_update(TRUE);
	prjorg_sidebar_activate(FALSE);
	prjorg_menu_activate_menu_items(FALSE);
}
コード例 #2
0
ファイル: prjorg-sidebar.c プロジェクト: dmaphy/geany-plugins
static void on_add_external(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data)
{
	gchar *utf8_base_path = get_project_base_path();
	gchar *locale_path = utils_get_locale_from_utf8(utf8_base_path);
	GtkWidget *dialog;

	dialog = gtk_file_chooser_dialog_new(_("Add External Directory"),
		GTK_WINDOW(geany->main_widgets->window), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
		_("_Cancel"), GTK_RESPONSE_CANCEL,
		_("Add"), GTK_RESPONSE_ACCEPT, NULL);
	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path);

	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
	{
		gchar *locale_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
		gchar *utf8_filename = utils_get_utf8_from_locale(locale_filename);

		prjorg_project_add_external_dir(utf8_filename);
		prjorg_sidebar_update(TRUE);
		project_write_config();

		g_free(utf8_filename);
		g_free(locale_filename);
	}

	gtk_widget_destroy(dialog);

	g_free(utf8_base_path);
	g_free(locale_path);
}
コード例 #3
0
static void on_project_dialog_confirmed(G_GNUC_UNUSED GObject * obj, GtkWidget * notebook,
		G_GNUC_UNUSED gpointer user_data)
{
	if (prj_org)
	{
		prjorg_project_read_properties_tab();
		prjorg_sidebar_update(TRUE);
	}
}
コード例 #4
0
static void on_doc_open(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GeanyDocument * doc,
	    G_GNUC_UNUSED gpointer user_data)
{
	g_return_if_fail(doc != NULL && doc->file_name != NULL);

	if (prjorg_project_is_in_project(doc->file_name))
		prjorg_project_remove_single_tm_file(doc->file_name);

	prjorg_sidebar_update(FALSE);
}
コード例 #5
0
void plugin_cleanup(void)
{
	if (geany_data->app->project)
	{
		prjorg_project_close();
		prjorg_sidebar_update(TRUE);
	}

	prjorg_menu_cleanup();
	prjorg_sidebar_cleanup();
}
コード例 #6
0
static void on_project_open(G_GNUC_UNUSED GObject * obj, GKeyFile * config,
		G_GNUC_UNUSED gpointer user_data)
{
	if (!prj_org)
	{
		prjorg_project_open(config);
		prjorg_sidebar_update(TRUE);
		prjorg_sidebar_activate(TRUE);
		prjorg_menu_activate_menu_items(TRUE);
	}
}
コード例 #7
0
/* May be called also after plugin_init(), see plugin_init() for more info */
static void on_project_save(G_GNUC_UNUSED GObject * obj, GKeyFile * config,
		G_GNUC_UNUSED gpointer user_data)
{
	if (!prj_org)
	{
		/* happens when the project is created or the plugin is loaded */
		prjorg_project_open(config);
		prjorg_sidebar_update(TRUE);
		prjorg_sidebar_activate(TRUE);
		prjorg_menu_activate_menu_items(TRUE);
	}

	prjorg_project_save(config);
}
コード例 #8
0
static void on_doc_close(G_GNUC_UNUSED GObject * obj, GeanyDocument * doc,
		G_GNUC_UNUSED gpointer user_data)
{
	g_return_if_fail(doc != NULL);

	if (doc->file_name == NULL)
		return;

	/* tags of open files managed by geany - when the file gets closed,
	 * we should take care of it */
	if (prjorg_project_is_in_project(doc->file_name))
		prjorg_project_add_single_tm_file(doc->file_name);

	prjorg_sidebar_update(FALSE);
}
コード例 #9
0
static void on_remove_external_dir(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
{
	GtkTreeSelection *treesel;
	GtkTreeModel *model;
	GtkTreeIter iter, parent;
	gchar *name;
	
	treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(s_file_view));
	if (!gtk_tree_selection_get_selected(treesel, &model, &iter))
		return;

	if (gtk_tree_model_iter_parent(model, &parent, &iter))
		return;
		
	gtk_tree_model_get(model, &iter, FILEVIEW_COLUMN_NAME, &name, -1);
	prjorg_project_remove_external_dir(name);
	prjorg_sidebar_update(TRUE);
	project_write_config();
	
	g_free(name);
}
コード例 #10
0
static void on_reload_project(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
{
	prjorg_project_rescan();
	prjorg_sidebar_update(TRUE);
}
コード例 #11
0
static void on_follow_active(GtkToggleToolButton *button, G_GNUC_UNUSED gpointer user_data)
{
	s_follow_editor = gtk_toggle_tool_button_get_active(button);
	prjorg_sidebar_update(FALSE);
}
コード例 #12
0
static void on_doc_activate(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GeanyDocument * doc,
		G_GNUC_UNUSED gpointer user_data)
{
	prjorg_sidebar_update(FALSE);
}