Revision: 5235 http://geany.svn.sourceforge.net/geany/?rev=5235&view=rev Author: ntrel Date: 2010-09-16 15:14:09 +0000 (Thu, 16 Sep 2010)
Log Message: ----------- Add plugin signals project-dialog-create and project-dialog-confirmed so plugins can append a Project Properties notebook tab (patch by Ji?\197?\153?\195?\173 Techet, thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/doc/pluginsignals.c trunk/src/geanyobject.c trunk/src/geanyobject.h trunk/src/project.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-09-16 14:52:04 UTC (rev 5234) +++ trunk/ChangeLog 2010-09-16 15:14:09 UTC (rev 5235) @@ -10,6 +10,11 @@ Prompt for reloading if the document has an undo stack to avoid losing undo ability on accidental reloading (patch by Colomban Wendling, thanks). + * src/project.c, src/geanyobject.c, src/geanyobject.h, + doc/pluginsignals.c: + Add plugin signals project-dialog-create and + project-dialog-confirmed so plugins can append a Project Properties + notebook tab (patch by Jiří Techet, thanks).
2010-09-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/doc/pluginsignals.c =================================================================== --- trunk/doc/pluginsignals.c 2010-09-16 14:52:04 UTC (rev 5234) +++ trunk/doc/pluginsignals.c 2010-09-16 15:14:09 UTC (rev 5235) @@ -160,6 +160,26 @@ */ signal void (*project_close)(GObject *obj, gpointer user_data);
+/** Sent after a project dialog is created but before it is displayed. Plugins + * can append their own project settings tabs by using this signal. + * @param obj a GeanyObject instance, should be ignored. + * @param notebook a GtkNotebook instance that can be used by plugins to append their + * settings tabs. + * @param user_data user data. + */ +signal void (*project_dialog_create)(GObject *obj, GtkWidget *notebook, gpointer user_data); + +/** Sent when the settings dialog is confirmed by the user. Plugins can use + * this signal to read the settings widgets previously added by using the + * @c project-dialog-create signal. + * @warning The dialog will still be running afterwards if the user chose 'Apply'. + * @param obj a GeanyObject instance, should be ignored. + * @param notebook a GtkNotebook instance that can be used by plugins to read their + * settings widgets. + * @param user_data user data. + */ +signal void (*project_dialog_confirmed)(GObject *obj, GtkWidget *notebook, gpointer user_data); + /** 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.
Modified: trunk/src/geanyobject.c =================================================================== --- trunk/src/geanyobject.c 2010-09-16 14:52:04 UTC (rev 5234) +++ trunk/src/geanyobject.c 2010-09-16 15:14:09 UTC (rev 5235) @@ -262,6 +262,24 @@ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + geany_object_signals[GCB_PROJECT_DIALOG_CREATE] = g_signal_new ( + "project-dialog-create", + G_OBJECT_CLASS_TYPE (g_object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GeanyObjectClass, project_dialog_create), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + geany_object_signals[GCB_PROJECT_DIALOG_CONFIRMED] = g_signal_new ( + "project-dialog-confirmed", + G_OBJECT_CLASS_TYPE (g_object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GeanyObjectClass, project_dialog_confirmed), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER);
/* Editor signals */ geany_object_signals[GCB_UPDATE_EDITOR_MENU] = g_signal_new (
Modified: trunk/src/geanyobject.h =================================================================== --- trunk/src/geanyobject.h 2010-09-16 14:52:04 UTC (rev 5234) +++ trunk/src/geanyobject.h 2010-09-16 15:14:09 UTC (rev 5235) @@ -42,6 +42,8 @@ GCB_PROJECT_OPEN, GCB_PROJECT_SAVE, GCB_PROJECT_CLOSE, + GCB_PROJECT_DIALOG_CREATE, + GCB_PROJECT_DIALOG_CONFIRMED, GCB_UPDATE_EDITOR_MENU, GCB_EDITOR_NOTIFY, GCB_GEANY_STARTUP_COMPLETE, @@ -88,6 +90,8 @@ void (*project_open)(GKeyFile *keyfile); void (*project_save)(GKeyFile *keyfile); void (*project_close)(void); + void (*project_dialog_create)(GtkWidget *notebook); + void (*project_dialog_confirmed)(GtkWidget *notebook); void (*update_editor_menu)(const gchar *word, gint click_pos, GeanyDocument *doc); gboolean (*editor_notify)(GeanyEditor *editor, gpointer scnt); void (*geany_startup_complete)(void);
Modified: trunk/src/project.c =================================================================== --- trunk/src/project.c 2010-09-16 14:52:04 UTC (rev 5234) +++ trunk/src/project.c 2010-09-16 15:14:09 UTC (rev 5235) @@ -191,6 +191,9 @@ { if (update_config(e)) { + write_config(TRUE); + ui_set_statusbar(TRUE, _("Project "%s" created."), app->project->name); + ui_add_recent_project_file(app->project->file_name); break; } @@ -563,6 +566,7 @@ } #endif
+ g_signal_emit_by_name(geany_object, "project-dialog-create", e->notebook); gtk_widget_show_all(e->dialog);
/* note: notebook page must be shown before setting current page */ @@ -575,6 +579,9 @@ { if (update_config(e)) { + g_signal_emit_by_name(geany_object, "project-dialog-confirmed", e->notebook); + write_config(TRUE); + ui_set_statusbar(TRUE, _("Project "%s" saved."), app->project->name); stash_group_update(indent_group, e->dialog); break; } @@ -791,11 +798,6 @@ g_free(tmp); #endif } - write_config(TRUE); - if (new_project) - ui_set_statusbar(TRUE, _("Project "%s" created."), p->name); - else - ui_set_statusbar(TRUE, _("Project "%s" saved."), p->name);
update_ui();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.