Revision: 4527 http://geany.svn.sourceforge.net/geany/?rev=4527&view=rev Author: eht16 Date: 2010-01-17 15:17:30 +0000 (Sun, 17 Jan 2010)
Log Message: ----------- Add new signal: "geany-startup-complete" which is sent once all initialization and startup tasks has been done.
Modified Paths: -------------- trunk/ChangeLog trunk/doc/plugins.dox trunk/src/geanyobject.c trunk/src/geanyobject.h trunk/src/main.c trunk/src/plugindata.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-01-17 14:52:28 UTC (rev 4526) +++ trunk/ChangeLog 2010-01-17 15:17:30 UTC (rev 4527) @@ -4,6 +4,10 @@ Add a little test program which can load and test Geany plugins to verify it is loadable at runtime and all necessary symbols are defined. + * doc/plugins.dox, src/geanyobject.c, src/geanyobject.h, src/main.c, + src/plugindata.h: + Add new signal: "geany-startup-complete" which is sent once all + initialization and startup tasks has been done.
2010-01-16 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/doc/plugins.dox =================================================================== --- trunk/doc/plugins.dox 2010-01-17 14:52:28 UTC (rev 4526) +++ trunk/doc/plugins.dox 2010-01-17 15:17:30 UTC (rev 4527) @@ -225,6 +225,19 @@ * @param user_data user data. * @endsignaldef * + * @signaldef geany-startup-complete + * @signalproto + * void user_function(GObject *obj, gpointer user_data); + * @endsignalproto + * @signaldesc + * Sent once Geany has finished all initialization and startup tasks and the GUI has been + * realized. This signal is the very last step in the startup process and is sent once + * the GTK main event loop has been entered. + * + * @param obj a GeanyObject instance, should be ignored. + * @param user_data user data. + * @endsignaldef + * * @signaldef update-editor-menu * @signalproto * void user_function(GObject *obj, const gchar *word, gint pos, GeanyDocument *doc,
Modified: trunk/src/geanyobject.c =================================================================== --- trunk/src/geanyobject.c 2010-01-17 14:52:28 UTC (rev 4526) +++ trunk/src/geanyobject.c 2010-01-17 15:17:30 UTC (rev 4527) @@ -286,6 +286,16 @@ G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_POINTER);
+ /* General signals */ + geany_object_signals[GCB_GEANY_STARTUP_COMPLETE] = g_signal_new ( + "geany-startup-complete", + G_OBJECT_CLASS_TYPE (g_object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GeanyObjectClass, geany_startup_complete), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + /* Core-only signals */ geany_object_signals[GCB_SAVE_SETTINGS] = g_signal_new ( "save-settings",
Modified: trunk/src/geanyobject.h =================================================================== --- trunk/src/geanyobject.h 2010-01-17 14:52:28 UTC (rev 4526) +++ trunk/src/geanyobject.h 2010-01-17 15:17:30 UTC (rev 4527) @@ -44,6 +44,7 @@ GCB_PROJECT_CLOSE, GCB_UPDATE_EDITOR_MENU, GCB_EDITOR_NOTIFY, + GCB_GEANY_STARTUP_COMPLETE, GCB_SAVE_SETTINGS, GCB_LOAD_SETTINGS, GCB_MAX @@ -88,6 +89,7 @@ void (*project_close)(void); void (*update_editor_menu)(const gchar *word, gint click_pos, GeanyDocument *doc); gboolean (*editor_notify)(GeanyEditor *editor, gpointer scnt); + void (*geany_startup_complete)(void); void (*save_settings)(GKeyFile *keyfile); void (*load_settings)(GKeyFile *keyfile); };
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2010-01-17 14:52:28 UTC (rev 4526) +++ trunk/src/main.c 2010-01-17 15:17:30 UTC (rev 4527) @@ -392,6 +392,9 @@ * This is because the main window is realized (i.e. actually drawn on the screen) at the * end of the startup process. * + * @note Maybe you want to use the @ref geany-startup-complete signal to get notified about + * the completed startup process. + * * @return @c TRUE if the Geany main window has been realized or @c FALSE otherwise. * * @since 0.19 @@ -888,6 +891,13 @@ }
+static gboolean send_startup_complete(gpointer data) +{ + g_signal_emit_by_name(geany_object, "geany-startup-complete"); + return FALSE; +} + + gint main(gint argc, gchar **argv) { GeanyDocument *doc; @@ -1079,6 +1089,10 @@ } #endif
+ /* when we are really done with setting everything up and the main event loop is running, + * tell other components, mainly plugins, that startup is complete */ + g_idle_add_full(G_PRIORITY_LOW, send_startup_complete, NULL, NULL); + gtk_main(); return 0; }
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2010-01-17 14:52:28 UTC (rev 4526) +++ trunk/src/plugindata.h 2010-01-17 15:17:30 UTC (rev 4527) @@ -50,7 +50,7 @@ enum { /** The Application Programming Interface (API) version, incremented * whenever any plugin data types are modified or appended to. */ - GEANY_API_VERSION = 169, + GEANY_API_VERSION = 170,
/** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.