Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sun, 04 Mar 2012 21:41:55 Commit: 65de310d8355ca8f31632bc9f1d4b776013d52f9 https://github.com/geany/geany-plugins/commit/65de310d8355ca8f31632bc9f1d4b7...
Log Message: ----------- Use new project preference open/close signals
Modified Paths: -------------- gproject/src/gproject-main.c gproject/src/gproject-project.c gproject/src/gproject-project.h
Modified: gproject/src/gproject-main.c 32 files changed, 26 insertions(+), 6 deletions(-) =================================================================== @@ -32,7 +32,7 @@ #include "gproject-sidebar.h" #include "gproject-menu.h"
-PLUGIN_VERSION_CHECK(211); +PLUGIN_VERSION_CHECK(214); PLUGIN_SET_INFO(_("GProject"), _("Glob-pattern-based project management plugin for Geany."), VERSION, @@ -43,6 +43,9 @@ GeanyFunctions *geany_functions;
+static gint page_index = -1; + + void plugin_init(G_GNUC_UNUSED GeanyData * data); void plugin_cleanup(void);
@@ -94,18 +97,33 @@ static void on_build_start(GObject *obj, gpointer user_data) }
-static void on_project_dialog_create(G_GNUC_UNUSED GObject * obj, GtkWidget * notebook, +static void on_project_dialog_open(G_GNUC_UNUSED GObject * obj, GtkWidget * notebook, G_GNUC_UNUSED gpointer user_data) { - gprj_project_add_properties_tab(notebook); + if (g_prj && page_index == -1) + page_index = gprj_project_add_properties_tab(notebook); }
static void on_project_dialog_confirmed(G_GNUC_UNUSED GObject * obj, GtkWidget * notebook, G_GNUC_UNUSED gpointer user_data) { - gprj_project_read_properties_tab(); - gprj_sidebar_update(TRUE); + if (g_prj) + { + gprj_project_read_properties_tab(); + gprj_sidebar_update(TRUE); + } +} + + +static void on_project_dialog_close(G_GNUC_UNUSED GObject * obj, GtkWidget * notebook, + G_GNUC_UNUSED gpointer user_data) +{ + if (page_index != -1) + { + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), page_index); + page_index = -1; + } }
@@ -119,6 +137,7 @@ static void on_project_open(G_GNUC_UNUSED GObject * obj, GKeyFile * config, }
+ static void on_project_close(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED gpointer user_data) { gprj_project_close(); @@ -149,8 +168,9 @@ static void on_project_save(G_GNUC_UNUSED GObject * obj, GKeyFile * config, {"document-activate", (GCallback) & on_doc_activate, TRUE, NULL}, {"document-close", (GCallback) & on_doc_close, TRUE, NULL}, {"build-start", (GCallback) & on_build_start, TRUE, NULL}, - {"project-dialog-create", (GCallback) & on_project_dialog_create, TRUE, NULL}, + {"project-dialog-open", (GCallback) & on_project_dialog_open, TRUE, NULL}, {"project-dialog-confirmed", (GCallback) & on_project_dialog_confirmed, TRUE, NULL}, + {"project-dialog-close", (GCallback) & on_project_dialog_close, TRUE, NULL}, {"project-open", (GCallback) & on_project_open, TRUE, NULL}, {"project-close", (GCallback) & on_project_close, TRUE, NULL}, {"project-save", (GCallback) & on_project_save, TRUE, NULL},
Modified: gproject/src/gproject-project.c 8 files changed, 6 insertions(+), 2 deletions(-) =================================================================== @@ -387,12 +387,13 @@ void gprj_project_read_properties_tab() }
-void gprj_project_add_properties_tab(GtkWidget *notebook) +gint gprj_project_add_properties_tab(GtkWidget *notebook) { GtkWidget *vbox, *hbox, *hbox1; GtkWidget *table; GtkWidget *label; gchar *str; + gint page_index;
e = g_new0(PropertyDialogElements, 1);
@@ -456,7 +457,10 @@ void gprj_project_add_properties_tab(GtkWidget *notebook) hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 6);
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), hbox, label); + page_index = gtk_notebook_append_page(GTK_NOTEBOOK(notebook), hbox, label); + gtk_widget_show_all(notebook); + + return page_index; }
Modified: gproject/src/gproject-project.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -40,7 +40,7 @@
void gprj_project_open(GKeyFile * key_file);
-void gprj_project_add_properties_tab(GtkWidget *notebook); +gint gprj_project_add_properties_tab(GtkWidget *notebook);
void gprj_project_close(void);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
plugins-commits@lists.geany.org