Add ui_get_toolbar_insert_position() for plugins to get a position to insert new toolbar items.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2930 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-09-08 14:28:59 +00:00
parent 872d2dd2fa
commit b747234117
5 changed files with 27 additions and 1 deletions

View File

@ -3,6 +3,9 @@
* scripts/missing-mnemonics.sh, scripts/svn-add.sh:
Remove bashisms.
Add support for passing asterisk wildcards to missing-mnemonics.sh.
* src/plugindata.h, src/plugins.c, src/ui_utils.c, src/ui_utils.h:
Add ui_get_toolbar_insert_position() for plugins to get a position to
insert new toolbar items.
2008-09-07 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>

View File

@ -335,6 +335,7 @@ typedef struct UIUtilsFuncs
void (*table_add_row) (GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
GtkWidget* (*path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
GtkWidget* (*button_new_with_image) (const gchar *stock_id, const gchar *text);
gint (*get_toolbar_insert_position) (void);
}
UIUtilsFuncs;

View File

@ -173,7 +173,7 @@ static UtilsFuncs utils_funcs = {
&utils_get_setting_integer,
&utils_get_setting_string,
&utils_spawn_sync,
&utils_spawn_async,
&utils_spawn_async
};
static UIUtilsFuncs uiutils_funcs = {
@ -183,6 +183,7 @@ static UIUtilsFuncs uiutils_funcs = {
&ui_table_add_row,
&ui_path_box_new,
&ui_button_new_with_image,
&ui_get_toolbar_insert_position
};
static DialogFuncs dialog_funcs = {

View File

@ -1532,3 +1532,22 @@ void ui_init(void)
}
/** Returns the position for adding new toolbar items. The returned position can be used
* to add new toolbar items with @c gtk_toolbar_insert(). The toolbar object can be accessed
* with @a geany->main_widgets->toolbar.
* The position is always the last one before the Quit button (if it is shown).
*
* @return The position for new toolbar items or @c -1 if an error occurred.
*/
gint ui_get_toolbar_insert_position(void)
{
GtkWidget *quit = lookup_widget(main_widgets.window, "toolbutton_quit");
gint pos = gtk_toolbar_get_item_index(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOL_ITEM(quit));
if (pos > 0)
pos--; /* use one position before the real position of the quit button to place new
* items between the last separator and the quit button */
return pos;
}

View File

@ -231,4 +231,6 @@ gboolean ui_tree_view_find_previous(GtkTreeView *treeview, TVMatchCallback cb);
void ui_statusbar_showhide(gboolean state);
gint ui_get_toolbar_insert_position(void);
#endif