Hi,

Currently UIUtilsFuncs contain ui_path_box_new(), so a
file-chooser-dialog button can be created programatically in a plugin.
But there's no ui_setup_open_button_callback(), so it's impossible to
load such a button from a .glade file and setup it, as in Geany.

geanyprj uses ui_path_box_new(), and other plugins (saveactions,
spellcheck, debugger, ...) create file-chooser-dialog buttons manually,
so they seem common. I'm writing a new plugin, and would prefer to
use .glade for the interface as much as possible (and practical).

-- 
E-gards: Jimmy
>From 3a2ffc4931342c193eeb69e2960c11eb6b5fdf06 Mon Sep 17 00:00:00 2001
From: Dimitar Zhekov <dimitar.zhe...@gmail.com>
Date: Thu, 5 Apr 2012 21:51:15 +0300
Subject: [PATCH] public ui_setup_open_button_callback()

---
 plugins/geanyfunctions.h |    2 ++
 src/plugindata.h         |    2 ++
 src/plugins.c            |    3 ++-
 3 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/plugins/geanyfunctions.h b/plugins/geanyfunctions.h
index d41d77e..7ef54df 100644
--- a/plugins/geanyfunctions.h
+++ b/plugins/geanyfunctions.h
@@ -304,6 +304,8 @@
 	geany_functions->p_ui->ui_menu_add_document_items_sorted
 #define ui_lookup_stock_label \
 	geany_functions->p_ui->ui_lookup_stock_label
+#define ui_setup_open_button_callback \
+	geany_functions->p_ui->ui_setup_open_button_callback
 #define dialogs_show_question \
 	geany_functions->p_dialogs->dialogs_show_question
 #define dialogs_show_msgbox \
diff --git a/src/plugindata.h b/src/plugindata.h
index 77d6964..a5120a3 100644
--- a/src/plugindata.h
+++ b/src/plugindata.h
@@ -482,6 +482,8 @@ typedef struct UIUtilsFuncs
 	void		(*ui_menu_add_document_items_sorted) (GtkMenu *menu, struct GeanyDocument *active,
 				GCallback callback, GCompareFunc compare_func);
 	const gchar* (*ui_lookup_stock_label)(const gchar *stock_id);
+	void		(*ui_setup_open_button_callback)(GtkWidget *open_btn, const gchar *title,
+				GtkFileChooserAction action, GtkEntry *entry);
 }
 UIUtilsFuncs;
 
diff --git a/src/plugins.c b/src/plugins.c
index 42bec5d..6e02984 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -248,7 +248,8 @@ static UIUtilsFuncs uiutils_funcs = {
 	&ui_get_gtk_settings_integer,
 	&ui_combo_box_add_to_history,
 	&ui_menu_add_document_items_sorted,
-	&ui_lookup_stock_label
+	&ui_lookup_stock_label,
+	&ui_setup_open_button_callback
 };
 
 static DialogFuncs dialog_funcs = {
-- 
1.7.9.1

_______________________________________________
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

Reply via email to