Revision: 60 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=60&view=rev Author: eht16 Date: 2008-06-03 09:09:07 -0700 (Tue, 03 Jun 2008)
Log Message: ----------- Compilation fixes. Version bump.
Modified Paths: -------------- trunk/backupcopy/ChangeLog trunk/backupcopy/configure.in trunk/backupcopy/src/backupcopy.c
Modified: trunk/backupcopy/ChangeLog =================================================================== --- trunk/backupcopy/ChangeLog 2008-06-03 16:06:14 UTC (rev 59) +++ trunk/backupcopy/ChangeLog 2008-06-03 16:09:07 UTC (rev 60) @@ -1,3 +1,11 @@ +2008-06-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/backupcopy.c: + Compilation fixes. + * configure.in: + Version bump. + + 2008-05-20 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/backupcopy.c:
Modified: trunk/backupcopy/configure.in =================================================================== --- trunk/backupcopy/configure.in 2008-06-03 16:06:14 UTC (rev 59) +++ trunk/backupcopy/configure.in 2008-06-03 16:09:07 UTC (rev 60) @@ -2,7 +2,7 @@ # $Id: configure.in 2 2008-04-02 14:52:33Z eht16 $
AC_INIT(configure.in) -AM_INIT_AUTOMAKE(backupcopy, 0.1) +AM_INIT_AUTOMAKE(backupcopy, 0.2)
AM_CONFIG_HEADER(config.h)
@@ -56,6 +56,7 @@
echo "----------------------------------------" echo "Install Backup Copy in : ${libdir}" +echo "Install Backup Copy files in : ${prefix}" echo "Using Geany version : ${GEANY_VERSION}" echo "Using GTK version : ${GTK_VERSION}" echo ""
Modified: trunk/backupcopy/src/backupcopy.c =================================================================== --- trunk/backupcopy/src/backupcopy.c 2008-06-03 16:06:14 UTC (rev 59) +++ trunk/backupcopy/src/backupcopy.c 2008-06-03 16:09:07 UTC (rev 60) @@ -27,7 +27,7 @@ #include <errno.h> #include <time.h>
-#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H # include <locale.h> #endif
@@ -46,10 +46,10 @@ GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(51) +PLUGIN_VERSION_CHECK(67)
-PLUGIN_INFO(_("Backup Copy"), _("Creates a backup of the current file when saving"), - "0.1", "Enrico Tröger") +PLUGIN_SET_INFO(_("Backup Copy"), _("Creates a backup of the current file when saving"), + "0.2", "Enrico Tröger")
static gchar *config_file; @@ -93,7 +93,7 @@ time_t t = time(NULL); struct tm *now = localtime(&t);
- locale_filename_src = p_utils->get_locale_from_utf8(doc_list[idx].file_name); + locale_filename_src = p_utils->get_locale_from_utf8(documents[idx]->file_name);
if ((src = g_fopen(locale_filename_src, "r")) == NULL) { @@ -131,7 +131,7 @@ }
-GeanyCallback geany_callbacks[] = +PluginCallback plugin_callbacks[] = { { "document-save", (GCallback) &on_document_save, FALSE, NULL }, { NULL, NULL, FALSE, NULL } @@ -143,7 +143,7 @@ #ifdef ENABLE_NLS gchar *locale_dir = NULL;
-#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); #endif
@@ -164,7 +164,7 @@ }
-void init(GeanyData *data) +void plugin_init(GeanyData *data) { GKeyFile *config = g_key_file_new(); gchar *tmp; @@ -224,59 +224,17 @@ }
-void configure(GtkWidget *parent) +static void on_configure_response(GtkDialog *dialog, gint response, gpointer user_data) { - GtkWidget *dialog, *label, *vbox, *hbox, *entry_dir, *entry_time, *button, *image; - - dialog = gtk_dialog_new_with_buttons(_("Backup Copy"), - GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - vbox = p_ui->dialog_vbox_new(GTK_DIALOG(dialog)); - gtk_widget_set_name(dialog, "GeanyDialog"); - gtk_box_set_spacing(GTK_BOX(vbox), 6); - - label = gtk_label_new(_("Directory to save backup files in:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - - entry_dir = gtk_entry_new(); - if (NZV(backup_dir)) - gtk_entry_set_text(GTK_ENTRY(entry_dir), backup_dir); - - button = gtk_button_new(); - g_signal_connect((gpointer) button, "clicked", G_CALLBACK(on_dir_button_clicked), entry_dir); - - image = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON); - gtk_container_add(GTK_CONTAINER(button), image); - - hbox = gtk_hbox_new(FALSE, 6); - gtk_box_pack_start_defaults(GTK_BOX(hbox), entry_dir); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - - label = gtk_label_new(_("Date/Time format for backup files ("man strftime" for details):")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - - entry_time = gtk_entry_new(); - if (NZV(time_fmt)) - gtk_entry_set_text(GTK_ENTRY(entry_time), time_fmt); - gtk_box_pack_start(GTK_BOX(vbox), entry_time, FALSE, FALSE, 0); - - gtk_widget_show_all(vbox); - - /* run the dialog and check for the response code */ -retry: - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) { GKeyFile *config = g_key_file_new(); gchar *data; const gchar *text_dir, *text_time; gchar *config_dir = g_path_get_dirname(config_file);
- text_dir = gtk_entry_get_text(GTK_ENTRY(entry_dir)); - text_time = gtk_entry_get_text(GTK_ENTRY(entry_time)); + text_dir = gtk_entry_get_text(GTK_ENTRY(g_object_get_data(G_OBJECT(dialog), "entry_dir"))); + text_time = gtk_entry_get_text(GTK_ENTRY(g_object_get_data(G_OBJECT(dialog), "entry_time")));
if (NZV(text_dir) && set_backup_dir(text_dir)) { @@ -304,18 +262,60 @@ _("Backup directory does not exist or is not writable.")); g_free(config_dir); g_key_file_free(config); - goto retry; - } g_free(config_dir); g_key_file_free(config); } - gtk_widget_destroy(dialog); }
-void cleanup(void) +GtkWidget *plugin_configure(GtkDialog *dialog) { + GtkWidget *label, *vbox, *hbox, *entry_dir, *entry_time, *button, *image; + + vbox = gtk_vbox_new(FALSE, 6); + + label = gtk_label_new(_("Directory to save backup files in:")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + + entry_dir = gtk_entry_new(); + if (NZV(backup_dir)) + gtk_entry_set_text(GTK_ENTRY(entry_dir), backup_dir); + + button = gtk_button_new(); + g_signal_connect((gpointer) button, "clicked", G_CALLBACK(on_dir_button_clicked), entry_dir); + + image = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON); + gtk_container_add(GTK_CONTAINER(button), image); + + hbox = gtk_hbox_new(FALSE, 6); + gtk_box_pack_start_defaults(GTK_BOX(hbox), entry_dir); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(_("Date/Time format for backup files ("man strftime" for details):")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + + entry_time = gtk_entry_new(); + if (NZV(time_fmt)) + gtk_entry_set_text(GTK_ENTRY(entry_time), time_fmt); + gtk_box_pack_start(GTK_BOX(vbox), entry_time, FALSE, FALSE, 0); + + g_object_set_data(G_OBJECT(dialog), "entry_dir", entry_dir); + g_object_set_data(G_OBJECT(dialog), "entry_time", entry_time); + g_signal_connect(dialog, "response", G_CALLBACK(on_configure_response), NULL); + + gtk_widget_show_all(vbox); + + return vbox; +} + + +void plugin_cleanup(void) +{ g_free(backup_dir); g_free(config_file); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org