Revision: 2930 http://geany.svn.sourceforge.net/geany/?rev=2930&view=rev Author: eht16 Date: 2008-09-08 14:28:59 +0000 (Mon, 08 Sep 2008)
Log Message: ----------- Add ui_get_toolbar_insert_position() for plugins to get a position to insert new toolbar items.
Modified Paths: -------------- trunk/ChangeLog trunk/src/plugindata.h trunk/src/plugins.c trunk/src/ui_utils.c trunk/src/ui_utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-09-08 14:27:46 UTC (rev 2929) +++ trunk/ChangeLog 2008-09-08 14:28:59 UTC (rev 2930) @@ -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>
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2008-09-08 14:27:46 UTC (rev 2929) +++ trunk/src/plugindata.h 2008-09-08 14:28:59 UTC (rev 2930) @@ -335,6 +335,7 @@ 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;
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2008-09-08 14:27:46 UTC (rev 2929) +++ trunk/src/plugins.c 2008-09-08 14:28:59 UTC (rev 2930) @@ -173,7 +173,7 @@ &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 @@ &ui_table_add_row, &ui_path_box_new, &ui_button_new_with_image, + &ui_get_toolbar_insert_position };
static DialogFuncs dialog_funcs = {
Modified: trunk/src/ui_utils.c =================================================================== --- trunk/src/ui_utils.c 2008-09-08 14:27:46 UTC (rev 2929) +++ trunk/src/ui_utils.c 2008-09-08 14:28:59 UTC (rev 2930) @@ -1532,3 +1532,22 @@ }
+/** 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; +} +
Modified: trunk/src/ui_utils.h =================================================================== --- trunk/src/ui_utils.h 2008-09-08 14:27:46 UTC (rev 2929) +++ trunk/src/ui_utils.h 2008-09-08 14:28:59 UTC (rev 2930) @@ -231,4 +231,6 @@
void ui_statusbar_showhide(gboolean state);
+gint ui_get_toolbar_insert_position(void); + #endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.