anjuta r4610 - in trunk: . plugins/gtodo



Author: jhs
Date: Mon Jan 19 17:17:01 2009
New Revision: 4610
URL: http://svn.gnome.org/viewvc/anjuta?rev=4610&view=rev

Log:
2009-01-19  Jens Georg  <mail jensge org>
 
 	* plugins/gtodo/Makefile.am:
 	* plugins/gtodo/callback.c (message_box):
	* plugins/gtodo/egg-datetime.c (egg_datetime_get_type),
 	(egg_datetime_set_property):
 	* plugins/gtodo/egg-datetime.h:
 	* plugins/gtodo/export.c (export_gui), (on_file_type_changed_cb),
 	(gtodo_export_gui_create_extra_widget):
 	* plugins/gtodo/interface.c (gtodo_load_settings),
 	(on_export_clicked_cb), (gui_create_todo_widget), (stock_icons):
 	* plugins/gtodo/libgtodo.c (gtodo_client_export):
 	* plugins/gtodo/libgtodo.h:
 	* plugins/gtodo/main.h:
 	* plugins/gtodo/preferences.c (preferences_widget),
 	(pref_gconf_set_notifications):
 	
 	- #531717 - remove tray icon
 	- enable export button which is now able to save to XML, HTML and plaintext
 	- port patches from libegg to eggdatetime.[ch]
 	
 	* TODO: synced with gtodo plugin (now that we have export ;)

Added:
   trunk/plugins/gtodo/gtodo-plain.xsl
Removed:
   trunk/plugins/gtodo/eggtrayicon.c
   trunk/plugins/gtodo/eggtrayicon.h
Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/configure.in
   trunk/plugins/gtodo/Makefile.am
   trunk/plugins/gtodo/callback.c
   trunk/plugins/gtodo/egg-datetime.c
   trunk/plugins/gtodo/egg-datetime.h
   trunk/plugins/gtodo/export.c
   trunk/plugins/gtodo/interface.c
   trunk/plugins/gtodo/libgtodo.c
   trunk/plugins/gtodo/libgtodo.h
   trunk/plugins/gtodo/main.h
   trunk/plugins/gtodo/preferences.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Mon Jan 19 17:17:01 2009
@@ -1,3 +1,188 @@
+To Do List
+=================================
 
-TODO is maintained in TODO.tasks files (xml format). Use Anjuta task manager
-to view/edit it.
+Unfiled
+=======================================================================================
+
+ - Bug fixing batch #1:
+   [Skill: Medium, Work: 12hrs, Bounty: $25]
+
+* Bug #346777    Cannot change the editor font
+* Bug #351214    Anjuta doesn't respect Gnome blinking cursor preference
+* Bug #357151    a + character in a directory name confuses anjuta
+* Bug #357541    can't launch Anjuta project file from Nautilus
+* Bug #357820    Goto / Previous history should return to previous cursor ...
+
+
+ - Automated tests for Anjuta:
+   [Skill: Basic, Work: 20hrs]
+
+Implement automated tests for Anjuta using either LDTP (http://ldtp.freedesktop.org/wiki/) or Dogtail (http://people.redhat.com/zcerza/dogtail/), which ever is better. Test cases should cover existing features and be able to easily extend for future features. The implementation should alow running the test cases in an automated setup (such as a remote server with a sutable running platform).
+
+
+ - Implement IAnjutaEditorPrint:
+   Implement it using Gtk 2.10 Printing stuff
+
+
+ - Relocate 'Autoformat' code from document-manager plugin:
+   [Skill: Basic, Work: 3hr, Bounty: $50]
+
+Relocate 'Autoformat' code from document-manager plugin to language-support-cpp-java plugin.
+
+Currently Autoformat code that is specific to c and c++ (uses indent program) is located in document-manager plugin (legacy). It should now be moved to language-support-cpp-java plugin that specializes in c/c++ processing. Preferences, UI, and processing should all be moved to the new place. At the same time, the indent configuration dialog should be fixed to fit in smaller size, presumably using notebook widget (currently it is huge and not screen appropriate for lower resolution).
+
+This is partly done but somebody has to fix the new "indent" plugin!
+
+libanjuta
+=======================================================================================
+
+ - Plugins reference counting:
+   Implement plugins reference counting. Loading a plugin gets 1 ref and when ref count reaches 0, plugin is deactivated.
+
+
+ - Preferences keys with no defaults do not register:
+   Preferences keys without default values (defined in .glade file) are not registered during preferences registeration. This results in gconf type mismatch when the keys are queried.
+
+Plugin: Editor
+=======================================================================================
+
+ - Apply prefererences:
+   Hidden editor preferences (those which are not settable from preferences dialog) are not applied now.
+
+
+ - Update on configure syntax highlighting:
+   When syntax highlighting colors/fonts are changed, the changes are not propagated to all editors, but it should, just like a gconf key.
+
+
+ - Move CVS directories:
+   Move data/properties/ and scintilla/ directories (by CVS surgery, and not by add/remove) into plugins/editor/ directory.
+
+Plugin: Project Manager
+=======================================================================================
+
+ - Complete Makefile project manager backend:
+   [Skill: High, Work: 50hrs, Bounty: $700]
+
+There is some initial work done for makefile based project management in gnome-build (src/backends/libgbf_mkfile) and Anjuta. Most of the base implementations have been done. The tasks is to completed this backend so that it works just like automake-backend. All the project interfaces from Anjuta via gnome-build should work meaningfully for this backend (as far as Makefile based structure would allow). Further details can be acquired by following the mailing list thread:
+
+http://sourceforge.net/mailarchive/message.php?msg_id=12687933
+
+Plugin: Automake Build
+=======================================================================================
+
+ - Define compile commands:
+   Define compile commands for various file extensions. Normally, plugin should search for a Makefile and invoke it with correct target (for example for a c file, it will be 'make file.o'). There should be a file that contains regexs for deriving target from a file name for invoking 'make'. Also, if there is no Makefile found in the directory with which to invoke the compile command, user should be prompted to create a Makefile (possibly filling it up with some template contents).
+
+
+ - Build parameters dialog:
+   Add a 'Build parameters dialog' in Build menu that brings up a dialog to configure environment variables and make parameters for the build. They would be set when ever the build is started. Also they need to be session saved and restored.
+
+Plugin: Symbol Browser
+=======================================================================================
+
+ - Possible memory leak:
+   Investigate possible memory lead on load/unload of symbol-browser.
+
+
+ - Workspace symbols not updated:
+   Although, file symbols are updated when the file is saved, corresponding workspace symbols are not updated. That is when "goto symbol" to a symbol in this file from some other place is activated (eg. symbol pane), the old location is used.
+
+
+ - Tags search do not retrieve all matching symbols:
+   Tags search (plugins/editor/aneditor.cxx) during calltips query do not retrieve all matching function prototypes. Perhaps, the tags are not sorted, leading to incomplete binary search. Investigate it in tag-manager/ directory.
+
+Documentation
+=======================================================================================
+
+ - Update:
+   All documents need update.
+
+Plugin: File Loader
+=======================================================================================
+libanjuta-interfaces
+=======================================================================================
+
+ - Documentation:
+   Add gdoc API documentation in libanjuta.idl.
+
+Plugin: Task Manager
+=======================================================================================
+
+ - Proper deactivation:
+   Some stuffs are left out during deactivation of the plugin. For example, gnome-vfs monitor for TODO.tasks is not removed, leading to crash when the file changes when the plugin is not active.
+
+
+ - Create text version TODO file:
+   Create human readable TODO file, which will be plain text, during save.
+
+Plugin: Project Wizard
+=======================================================================================
+
+ - More templates:
+   Create more project templates, such as gnome, sdl, x11 etc..
+
+anjuta
+=======================================================================================
+
+ - Apply http://live.gnome.org/GnomeGoals:
+   [Skill: Low, Work: 20hrs]
+
+Investigate general usability and HIG issues in Anjuta, come up with solutions that counter them and solve them. Issues such as Dialog consistencies, Navigational usabilities, Menus organization, features usablities should be investigated.
+
+Plugin: Macros
+=======================================================================================
+Plugin: Message Manager
+=======================================================================================
+Plugin: Debugger
+=======================================================================================
+
+ - Remote debugging support:
+   [Skill: medium, Work: 40h]
+Remote debugging support in Anjuta debugger.
+
+
+ - Rewrite a working inspect/evaluate dialog:
+   [Skill: Medium, Work: 20hrs]
+
+Currently, this dialog use the same debug tree widget used by the local  variables and watch display. I think we should keep the same widget for all this but we need perhaps to add a few options (local variables cannot be removed by example).
+
+Plugin: Terminal
+=======================================================================================
+
+ - Be able to create multiple terminals:
+   Be able to create multiple terminals
+
+Plugin: Default Profile
+=======================================================================================
+Plugin: Subversion
+=======================================================================================
+Plugin: Executer
+=======================================================================================
+Plugin: Glade
+=======================================================================================
+
+ - Polish up interface:
+   Add a label before the list of loaded glade projects ("Files:").
+Add stock icon. Deactivate glade plugin when last glade file is closed.
+
+
+ - Connect callback signal:
+   Connect signal callback selection signal from glade and goto the signal implementation when a signal handler is selected in glade. Create the signal prototype if it is not found.
+
+
+ - Complete Glade 3 integration:
+   [Skill: High, Work: 30hrs, Bounty: $100]
+
+We already have glade3 integration in anjuta working. But the implementation is incomplete and not fully usable. It should interface with Anjuta glade plugin for signals navigation, stubs creations and project files negotiations.
+
+Signals navigation" means when user selects a signal in glade properties editor, Anjuta automatically brings up the implementation of that signal in its editor. This can be accomplished with SymbolBrowser plugin in anjuta, that keeps tab on all symbol updates in the project. Using the signal handler signature, Anjuta glade plugin can take help of symbol-browser plugin to find the location of function definitions in the project.
+
+"Stubs creation" means when the user adds new signals, Anjuta glade plugin automatically creates the stub for the signal handler using gtk signal introspection. The signal prototype can be identified with the introspection. Where and how the stubs are added in project is a matter
+of dissussion.
+
+"Project files negotiation" means when user adds file via glade (e.g. images in dialogs), glade will notify anjuta to add the file in project and give a change to relocate it within the project. Anjuta needs to handle this request and add the files in project (possibly prompting user for relocation). Anjuta also needs to make sure glade is able to find them later.
+
+Also, the the glade widget editor should be embed in Anjuta (glade-3 already has the necessary widgets).
+
+Pluing: Class wizard
+=======================================================================================

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Jan 19 17:17:01 2009
@@ -158,7 +158,7 @@
 
 PKG_CHECK_MODULES(GLADE, libglade-2.0 >= $LIBGLADE_REQUIRED)
 
-PKG_CHECK_MODULES(GNOME, libgnome-2.0 >= $GNOME_REQUIRED libgnomeui-2.0 >= $GNOME_REQUIRED libgnomecanvas-2.0 >= $GNOME_REQUIRED libgnomeprint-2.2 >= $GNOME_REQUIRED libgnomeprintui-2.2 >= $GNOME_REQUIRED)
+PKG_CHECK_MODULES(GNOME, libgnome-2.0 >= $GNOME_REQUIRED libgnomeui-2.0 >= $GNOME_REQUIRED)
 
 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= $GCONF_REQUIRED)
 

Modified: trunk/plugins/gtodo/Makefile.am
==============================================================================
--- trunk/plugins/gtodo/Makefile.am	(original)
+++ trunk/plugins/gtodo/Makefile.am	Mon Jan 19 17:17:01 2009
@@ -3,14 +3,15 @@
 gtodo_ui_DATA = anjuta-gtodo.ui
 
 gtodo_datadir = $(anjuta_data_dir)/gtodo
-gtodo_data_DATA = gtodo.css gtodo.xsl
+gtodo_data_DATA = gtodo.css \
+				  gtodo.xsl \
+				  gtodo-plain.xsl
 
 # Plugin pixmaps
 gtodo_pixmapsdir = $(anjuta_image_dir)
 gtodo_pixmaps_DATA = \
 	anjuta-gtodo-plugin.svg \
 	anjuta-gtodo-plugin-48.png \
-	gtodo_tray.png \
 	gtodo-about.png \
 	gtodo-edit.png
 
@@ -51,8 +52,6 @@
 	debug_printf.h\
 	egg-datetime.c\
 	egg-datetime.h\
-	eggtrayicon.c\
-	eggtrayicon.h\
 	export.c\
 	interface.c\
 	libgtodo.c\
@@ -63,9 +62,7 @@
 	notification.c\
 	preferences.c\
 	tasklists.c\
-	todo_db.c\
-	tray-icon.c\
-	tray-icon.h
+	todo_db.c
 
 EXTRA_DIST = \
 	$(gtodo_pixmaps_DATA) \

Modified: trunk/plugins/gtodo/callback.c
==============================================================================
--- trunk/plugins/gtodo/callback.c	(original)
+++ trunk/plugins/gtodo/callback.c	Mon Jan 19 17:17:01 2009
@@ -128,7 +128,7 @@
 			GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 			type,
 			GTK_BUTTONS_NONE,
-			text
+			"%s", text
 			);
 	if(type == GTK_MESSAGE_WARNING)
 	{

Modified: trunk/plugins/gtodo/egg-datetime.c
==============================================================================
--- trunk/plugins/gtodo/egg-datetime.c	(original)
+++ trunk/plugins/gtodo/egg-datetime.c	Mon Jan 19 17:17:01 2009
@@ -249,10 +249,10 @@
 static GtkHBoxClass *parent_class = NULL;
 
 
-	GtkType
+GType
 egg_datetime_get_type (void)
 {
-	static GtkType datetime_type = 0;
+	static GType datetime_type = 0;
 
 	if (!datetime_type) {
 		static const GTypeInfo datetime_info = {
@@ -605,7 +605,7 @@
 			priv->year = g_value_get_uint (value);
 			break;
 		case ARG_MONTH:
-			priv->minute = g_value_get_uint (value);
+			priv->month = g_value_get_uint (value);
 			break;
 		case ARG_DAY:
 			priv->day = g_value_get_uint (value);

Modified: trunk/plugins/gtodo/egg-datetime.h
==============================================================================
--- trunk/plugins/gtodo/egg-datetime.h	(original)
+++ trunk/plugins/gtodo/egg-datetime.h	Mon Jan 19 17:17:01 2009
@@ -85,7 +85,7 @@
 
 
 /* Constructors */
-GtkType			 egg_datetime_get_type			(void);
+GType			 egg_datetime_get_type			(void);
 GtkWidget		*egg_datetime_new			(void); 
 GtkWidget		*egg_datetime_new_from_time_t		(time_t t);
 GtkWidget		*egg_datetime_new_from_struct_tm	(struct tm *tm);

Modified: trunk/plugins/gtodo/export.c
==============================================================================
--- trunk/plugins/gtodo/export.c	(original)
+++ trunk/plugins/gtodo/export.c	Mon Jan 19 17:17:01 2009
@@ -1,98 +1,25 @@
 #include <gtk/gtk.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
-#include <string.h>
-#include <libxslt/xslt.h>
-#include <libxslt/xsltInternals.h>
-#include <libxslt/transform.h>
-#include <libxslt/xsltutils.h>
-#include <gdk/gdkkeysyms.h>
 #include "main.h"
 
 
+static GtkWidget* gtodo_export_gui_create_extra_widget (void);
 
-
-static
-void file_open(GtkWidget *button, GtkEntry *entry)
+enum
 {
-	GtkWidget *selection = NULL;
-	selection = gtk_file_selection_new(_("Export to"));
-	gtk_file_selection_set_filename(GTK_FILE_SELECTION(selection), gtk_entry_get_text(entry));
-	switch(gtk_dialog_run(GTK_DIALOG(selection)))
-	{
-		case GTK_RESPONSE_OK:
-			gtk_entry_set_text(entry, gtk_file_selection_get_filename(GTK_FILE_SELECTION(selection)));
-		default:
-			gtk_widget_destroy(selection);
-	}
-}
-
-
-
-void export_backup_xml(void)
-{
-	GtkWidget *dialog;
-	GtkWidget *entry;
-	GtkWidget *label; 
-	GtkWidget *hbox;
-	GtkWidget *browse;
-	char *temp;
-	GError *error = NULL;
-	GFile *file = NULL;
-
-	/* setup the dialog */
-	dialog = gtk_dialog_new_with_buttons("Export Task List",
-			GTK_WINDOW(mw.window),
-			GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 
-			GTK_STOCK_CANCEL,
-			GTK_RESPONSE_REJECT,
-			GTK_STOCK_OK,
-			GTK_RESPONSE_ACCEPT,			
-			NULL);
-	/* the widgets in the dialog */
-	hbox  = gtk_hbox_new(FALSE, 6);
-	label = gtk_label_new("Save Location:");
-	entry = gtk_entry_new();
-	temp = g_strdup_printf("%s/backup.tasks", g_getenv("HOME"));
-	gtk_entry_set_text(GTK_ENTRY(entry), temp);
-	g_free(temp);
-
-	browse = gtk_button_new_from_stock(GTK_STOCK_SAVE);
-	/* pack the log */
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), browse, FALSE, TRUE, 0);
-        gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
-	gtk_container_set_border_width(GTK_CONTAINER(hbox), 12);
-
-	g_signal_connect(G_OBJECT(browse), "clicked", G_CALLBACK(file_open), entry);
-	gtk_widget_show_all(dialog);
-	switch(gtk_dialog_run(GTK_DIALOG(dialog)))
-	{
-		case GTK_RESPONSE_ACCEPT:
-			g_print("saving to: %s\n", gtk_entry_get_text(GTK_ENTRY(entry)));
-			file = g_file_parse_name ((char *)gtk_entry_get_text(GTK_ENTRY(entry)));
-			if(gtodo_client_save_xml_to_file(cl, file, &error))
-			{
-			g_print("Other error\n");
-			}
-			if(error != NULL)
-			{
-			g_print("Error: %s\n", error->message);
-			}
-
-			g_object_unref (file);
-		default:
-			gtk_widget_destroy(dialog);
-
-
-	}
-
-}
-
-
+	FILE_TYPE_XML,
+	FILE_TYPE_PLAIN,
+	FILE_TYPE_HTML,
+	FILE_TYPE_COUNT
+};
+
+typedef struct _ExportExtraWidget
+{
+	GtkWidget *file_type;
+	GtkWidget *emb_cb;
+	GtkWidget *cust_cb;
+	GtkWidget *cust_browser;
+	GtkWidget *cb_curcat;
+} ExportExtraWidget;
 
 static
 void cust_cb_clicked(GtkToggleButton *but, GtkWidget *entry)
@@ -107,106 +34,61 @@
 }
 
 
-static
-void export_xslt()
+void export_gui()
 {
 	GtkWidget *dialog;
-	xmlDocPtr res;
-	xsltStylesheetPtr cur;
-	GtkWidget *label, *hbox;
-	GtkWidget *loc_entry, *loc_browser;
-	GtkWidget *emb_cb, *cust_cb, *cust_browser, *cb_curcat;;
-	GtkWidget *box, *but;
-	GFile* file;
 	char *tmp_string;
-	xmlChar *string;
-	int length;
 	char **param_string= NULL;
+	ExportExtraWidget *eex = NULL;
+	GError *error = NULL;
 
-	/* setup the dialog */
-	dialog = gtk_dialog_new_with_buttons("Export to html",
-			GTK_WINDOW(mw.window),
-			GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, NULL);
-	/*			GTK_STOCK_CANCEL,
-				GTK_RESPONSE_REJECT,
-				GTK_STOCK_OK,
-				GTK_RESPONSE_ACCEPT,			
-				NULL);
-				*/	but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);		
-	gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
-	//	gtk_widget_add_accelerator(but, "clicked", NULL, GDK_Escape,0 , GTK_ACCEL_VISIBLE); 
-	box = gtk_vbox_new(FALSE, 6);
-	/* I can't use the vbox of the dialog, somehow it wont set a border that way */
-	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box);
-	gtk_container_set_border_width(GTK_CONTAINER(box), 12);
-
-	/* the location */
-	hbox = gtk_hbox_new(FALSE, 6);
-	label       = gtk_label_new("Save location:");
-	loc_entry   = gtk_entry_new();
-	loc_browser = gtk_button_new_from_stock(GTK_STOCK_OPEN);
-	/* add them to the hor. box */
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), loc_entry, TRUE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), loc_browser, FALSE, TRUE, 0);
-	/* add to vbox */
-	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
-	/* signals */
-	g_signal_connect(G_OBJECT(loc_browser), "clicked",G_CALLBACK(file_open), loc_entry);
-	tmp_string = g_strdup_printf("%s/output.html", g_getenv("HOME"));
-	gtk_entry_set_text(GTK_ENTRY(loc_entry), tmp_string);
-	g_free(tmp_string);
-
-	/* add the embed css style sheet tb */
-	emb_cb = gtk_check_button_new_with_label("Embed default (CSS) style sheet");
-	gtk_box_pack_start(GTK_BOX(box), emb_cb, FALSE, TRUE, 0);
-	/* add the custom stylesheet stuff */
-	hbox         = gtk_hbox_new(FALSE, 6);
-	cust_cb      = gtk_check_button_new_with_label("Custom (CSS) style sheet");
-	cust_browser = gtk_entry_new();
-	gtk_entry_set_text(GTK_ENTRY(cust_browser),"gtodo.css");
-	gtk_widget_set_sensitive(cust_browser, FALSE);
-	/* add them to the hor. box */
-	gtk_box_pack_start(GTK_BOX(hbox), cust_cb, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), cust_browser, FALSE, TRUE, 0);             	
-	/* add to vbox */   
-	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(cust_cb), "toggled",G_CALLBACK(cust_cb_clicked), cust_browser);
-	g_signal_connect(G_OBJECT(emb_cb), "toggled",G_CALLBACK(emb_cb_clicked), hbox);
-
+	dialog = gtk_file_chooser_dialog_new (_("Export task list"),
+			NULL,
+			GTK_FILE_CHOOSER_ACTION_SAVE,
+			GTK_STOCK_CANCEL,
+			GTK_RESPONSE_REJECT,
+			GTK_STOCK_OK,
+			GTK_RESPONSE_ACCEPT,
+			NULL);
 
-	/* add the embed css style sheet tb */
-	cb_curcat = gtk_check_button_new_with_label("Export current category only");
-	gtk_box_pack_start(GTK_BOX(box), cb_curcat, FALSE, TRUE, 0);           	
+	tmp_string = g_build_filename (g_get_home_dir(), "output.html", NULL);
+	gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), tmp_string);
+	gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
+	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
+	gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), 
+			gtodo_export_gui_create_extra_widget ());
+	g_free(tmp_string);
 
-	gtk_widget_show_all(dialog);	
+	gtk_widget_show_all(dialog);
 	switch(gtk_dialog_run(GTK_DIALOG(dialog)))
 	{
 		case GTK_RESPONSE_ACCEPT:
+			gtk_widget_hide (dialog);
 			break;
 		default:
 			gtk_widget_destroy(dialog);
 			return;
 	}
 
+	eex = g_object_get_data (G_OBJECT (gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (dialog))),
+			"eex");
 
-	cur= xsltParseStylesheetFile((xmlChar *)DATADIR"/gtodo/gtodo.xsl");
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(emb_cb)))
+	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(eex->emb_cb)))
 	{
 		param_string = g_realloc(param_string, 3*sizeof(gchar *));
 		param_string[0] = g_strdup("css");
 		param_string[1] = g_strdup_printf("\"embed\"");
 		param_string[2] = NULL;
 	}
-	else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cust_cb)))
+	else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(eex->cust_cb)))
 	{
 		param_string = g_realloc(param_string, 3*sizeof(gchar *));
 		param_string[0] = g_strdup("css");
-		param_string[1] = g_strdup_printf("\"%s\"", gtk_entry_get_text(GTK_ENTRY(cust_browser)));
+		param_string[1] = g_strdup_printf("\"%s\"", gtk_entry_get_text(GTK_ENTRY(eex->cust_browser)));
 		param_string[2] = NULL;                                   
 	}
 
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_curcat)))
+	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(eex->cb_curcat)))
 	{
 		int i= 0, cat = 0;
 		for(i=0;param_string[i] != NULL;i++);
@@ -221,36 +103,97 @@
 		}
 	}	
 
-	if(param_string == NULL)
-	{
-		res = xsltApplyStylesheet(cur, cl->gtodo_doc, NULL);
-	}
-	else
+	switch (gtk_combo_box_get_active (GTK_COMBO_BOX (eex->file_type)))
 	{
-		int i;
-		res = xsltApplyStylesheet(cur, cl->gtodo_doc, (const char **)param_string);
-		/* free info */
-		for(i=0; param_string[i] != NULL; i++)
-		{
-			g_free(param_string[i]);
-		}
-		g_free(param_string);
+		case FILE_TYPE_HTML:
+			gtodo_client_export (cl, gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)), 
+				DATADIR"/gtodo/gtodo.xsl", param_string, &error);
+			break;
+		case FILE_TYPE_PLAIN:
+			gtodo_client_export (cl, gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)), 
+				DATADIR"/gtodo/gtodo-plain.xsl", param_string, &error);
+			break;
+		case FILE_TYPE_XML:
+			gtodo_client_save_xml_to_file (cl, gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)),
+					&error);
+			break;
+		default:
+			break;
 	}
-	xsltSaveResultToString(&string,&length , res, cur);
-	
-	file = g_file_parse_name (gtk_entry_get_text (GTK_ENTRY (loc_entry)));
-	g_file_replace_contents (file, (char *)string, length, NULL, FALSE,
-			G_FILE_CREATE_NONE, NULL, NULL, NULL);
+
+	g_strfreev (param_string);
+
+	g_free (eex);
 
 	/* clean up some junk*/
-	xmlFree(string);
-	xsltFreeStylesheet(cur);
-	xmlFreeDoc(res);
-	xsltCleanupGlobals();
 	gtk_widget_destroy(dialog);
 }
 
-void export_gui(void)
+static void
+on_file_type_changed_cb (GtkComboBox *box, GtkWidget* xml_export_options)
 {
-	export_xslt();
+	gtk_widget_set_sensitive (xml_export_options, 
+			gtk_combo_box_get_active (box) == 2);
 }
+
+GtkWidget*
+gtodo_export_gui_create_extra_widget ()
+{
+	GtkWidget *extra_widget;
+	GtkWidget *box;
+	GtkWidget *hbox;
+	GtkWidget *w;
+	ExportExtraWidget *eex = g_new0 (ExportExtraWidget, 1);
+
+
+	extra_widget = gtk_vbox_new (FALSE, 0);
+	
+	eex->file_type = gtk_combo_box_new_text ();
+	gtk_combo_box_insert_text (GTK_COMBO_BOX (eex->file_type), FILE_TYPE_XML, _("XML"));
+	gtk_combo_box_insert_text (GTK_COMBO_BOX (eex->file_type), FILE_TYPE_PLAIN, _("Plain Text"));
+	gtk_combo_box_insert_text (GTK_COMBO_BOX (eex->file_type), FILE_TYPE_HTML, _("HTML"));
+	gtk_combo_box_set_active (GTK_COMBO_BOX (eex->file_type), FILE_TYPE_HTML);
+
+
+	gtk_box_pack_start (GTK_BOX (extra_widget), eex->file_type, FALSE, FALSE, 0);
+
+	/* add the embed css style sheet tb */
+	eex->cb_curcat = gtk_check_button_new_with_label(_("Export current category only"));
+	gtk_box_pack_start(GTK_BOX(extra_widget), eex->cb_curcat, FALSE, TRUE, 0);           	
+
+	w = gtk_label_new (NULL);
+	gtk_label_set_markup (GTK_LABEL (w), _("<b>HTML export options:</b>"));
+	gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
+	gtk_box_pack_start (GTK_BOX (extra_widget), w, FALSE, FALSE, 0);
+
+	w = gtk_alignment_new (0, 0, 1, 1);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0);
+	gtk_box_pack_start (GTK_BOX (extra_widget), w, FALSE, FALSE, 0);
+
+	box = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (w), box);
+	eex->emb_cb = gtk_check_button_new_with_label(_("Embed default (CSS) style sheet"));
+	gtk_box_pack_start(GTK_BOX(box), eex->emb_cb, FALSE, TRUE, 0);
+	/* add the custom stylesheet stuff */
+	hbox         = gtk_hbox_new(FALSE, 6);
+	eex->cust_cb      = gtk_check_button_new_with_label(_("Custom (CSS) style sheet"));
+	eex->cust_browser = gtk_entry_new();
+	gtk_entry_set_text(GTK_ENTRY(eex->cust_browser),"gtodo.css");
+	gtk_widget_set_sensitive(eex->cust_browser, FALSE);
+	/* add them to the hor. box */
+	gtk_box_pack_start(GTK_BOX(hbox), eex->cust_cb, FALSE, TRUE, 0);
+	gtk_box_pack_start(GTK_BOX(hbox), eex->cust_browser, FALSE, TRUE, 0);             	
+	/* add to vbox */   
+	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
+	g_signal_connect(G_OBJECT(eex->cust_cb), "toggled",G_CALLBACK(cust_cb_clicked), eex->cust_browser);
+	g_signal_connect(G_OBJECT(eex->emb_cb), "toggled",G_CALLBACK(emb_cb_clicked), hbox);
+
+
+
+	g_object_set_data (G_OBJECT (extra_widget), "eex", eex);
+
+	g_signal_connect (G_OBJECT (eex->file_type), "changed",
+			G_CALLBACK (on_file_type_changed_cb), box);
+	return extra_widget;
+}
+

Added: trunk/plugins/gtodo/gtodo-plain.xsl
==============================================================================
--- (empty file)
+++ trunk/plugins/gtodo/gtodo-plain.xsl	Mon Jan 19 17:17:01 2009
@@ -0,0 +1,92 @@
+<!--
+
+Copyright (C) 2004 Peter J Jones (pjones pmade org)
+All Rights Reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+3. Neither the name of the Author nor the names of its contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-->
+<!--=================================================================================================-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+	<!--=================================================================================================-->
+	<xsl:output 
+		method="text" 
+		indent="yes"
+		omit-xml-declaration="yes"
+		/>
+	<!--=================================================================================================-->
+	<xsl:param name="title"	    select="'To Do List'"/>
+	<xsl:param name="category"  select="''"/>
+	<!--=================================================================================================-->
+	<xsl:template match="/">
+<xsl:value-of select="$title" />
+=================================
+
+<xsl:apply-templates/>
+</xsl:template>
+	<!--=================================================================================================-->
+<xsl:template match="gtodo">
+<xsl:choose>
+<xsl:when test="string-length($category) != 0">
+<xsl:apply-templates select="category[ title = $category]"/>
+</xsl:when>
+
+<xsl:otherwise>
+<xsl:for-each select="category">
+<xsl:if test="count(item) &gt; 0">
+<xsl:apply-templates select="."/>
+</xsl:if>
+</xsl:for-each>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+	<!--=================================================================================================-->
+<xsl:template match="category">
+<xsl:value-of select="@title"/>
+=======================================================================================
+<xsl:apply-templates select="item">
+<xsl:sort select="attribute/@enddate" data-type="number"/>
+</xsl:apply-templates>
+</xsl:template>
+	<!--=================================================================================================-->
+<xsl:template match="item">
+	<xsl:if test="attribute/@done = 0">
+ - <xsl:apply-templates select="summary"/>:
+   <xsl:apply-templates select="comment" indent="yes"/>
+<xsl:text>
+
+</xsl:text>
+
+</xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+<!--=================================================================================================-->
+<!--
+vim:tw=300
+-->

Modified: trunk/plugins/gtodo/interface.c
==============================================================================
--- trunk/plugins/gtodo/interface.c	(original)
+++ trunk/plugins/gtodo/interface.c	Mon Jan 19 17:17:01 2009
@@ -3,7 +3,7 @@
 #include <string.h>
 #include <stdio.h>
 #include "main.h"
-#include "tray-icon.h"
+#include <libanjuta/anjuta-utils.h>
 #include "debug_printf.h"
 
 /* the main window struct */
@@ -51,8 +51,6 @@
 
 	debug_printf(DEBUG_INFO, "Loading settings from gconf");
 
-	/* Enable tray by default..  user won't know if he/she doesnt have tray */
-	/* this is just for people who don't want it in there tray */
 	settings.place = gconf_client_get_bool(client, "/apps/gtodo/prefs/restore-position",NULL);;
 	settings.size =  gconf_client_get_bool(client, "/apps/gtodo/prefs/restore-size",NULL);;
 	settings.ask_delete_category 	=  gconf_client_get_bool(client, "/apps/gtodo/prefs/ask-delete-category",NULL);
@@ -111,6 +109,11 @@
 	check_for_notification_event();
 }
 
+static void on_export_clicked_cb (GtkWidget *foo, gpointer user_data)
+{
+	export_gui();
+}
+
 
 GtkWidget * gui_create_todo_widget()
 {
@@ -161,12 +164,15 @@
 	gtk_container_add(GTK_CONTAINER(lb), hbox);
 	gtk_container_add(GTK_CONTAINER(mw.tbeditbut), lb);
 
-
 	lb = gtk_image_new_from_stock("gtodo-edit", GTK_ICON_SIZE_BUTTON);
 	gtk_box_pack_start(GTK_BOX(hbox), lb, FALSE, TRUE, 0);
 	mw.tbeditlb = gtk_label_new_with_mnemonic(_("_Edit"));
 	gtk_box_pack_start(GTK_BOX(hbox), mw.tbeditlb, FALSE, TRUE,0);
 
+	mw.tbexport = anjuta_util_button_new_with_stock_image (_("_Export"), GTK_STOCK_SAVE_AS);
+	gtk_size_group_add_widget(sgroup, mw.tbaddbut);
+	gtk_box_pack_start (GTK_BOX (mw.toolbar), mw.tbexport, FALSE, FALSE, 0);
+
 	/* add them */
 	gtk_box_pack_end(GTK_BOX(mw.toolbar), mw.tbaddbut, FALSE, FALSE, 0);
 	gtk_box_pack_end(GTK_BOX(mw.toolbar), mw.tbdelbut, FALSE, FALSE, 0);
@@ -179,6 +185,7 @@
 	g_signal_connect(G_OBJECT(mw.tbaddbut), "clicked", G_CALLBACK(gui_add_todo_item), GINT_TO_POINTER(0));
 	g_signal_connect(G_OBJECT(mw.tbeditbut), "clicked", G_CALLBACK(gui_add_todo_item), GINT_TO_POINTER(1));
 	g_signal_connect(G_OBJECT(mw.tbdelbut), "clicked", G_CALLBACK(remove_todo_item), FALSE);
+	g_signal_connect(G_OBJECT(mw.tbexport), "clicked", G_CALLBACK(on_export_clicked_cb), NULL);
 
 
 	/* add the todo list */
@@ -269,12 +276,6 @@
 	gtk_icon_set_add_source(icons, icon_source);
 	gtk_icon_factory_add(factory, "gtodo", icons);
 
-	icons = gtk_icon_set_new();
-	icon_source = gtk_icon_source_new();
-	gtk_icon_source_set_filename(icon_source, PIXMAP_PATH"/gtodo_tray.png");
-	gtk_icon_set_add_source(icons, icon_source);
-	gtk_icon_factory_add(factory, "gtodo-tray", icons);
-
 	/* added this because there isn no about availible in the default stock set. */
 	/* I call it gnome about so it still uses the one out off the current icon theme */
 	icons = gtk_icon_set_new();

Modified: trunk/plugins/gtodo/libgtodo.c
==============================================================================
--- trunk/plugins/gtodo/libgtodo.c	(original)
+++ trunk/plugins/gtodo/libgtodo.c	Mon Jan 19 17:17:01 2009
@@ -7,6 +7,10 @@
 #include <time.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
 #include <libanjuta/anjuta-debug.h>
 #include "libgtodo.h"
 
@@ -1533,3 +1537,44 @@
 	if(cl == NULL) return FALSE;
 	return cl->read_only;	
 }
+
+
+gboolean 
+gtodo_client_export(GTodoClient *source, GFile *dest, const gchar *path_to_xsl, gchar **params, GError **error)
+{
+	xsltStylesheetPtr cur;
+	xmlChar *string;
+	xmlDocPtr res;
+	int length;
+	GError *err;
+
+	g_return_val_if_fail(path_to_xsl != NULL, FALSE);
+
+	cur= xsltParseStylesheetFile(BAD_CAST (path_to_xsl));
+
+	if (params == NULL)
+	{
+		res = xsltApplyStylesheet(cur, source->gtodo_doc, NULL);
+	}
+	else
+	{
+		res = xsltApplyStylesheet(cur, source->gtodo_doc, (const char **)params);
+	}
+
+	xsltSaveResultToString (&string, &length, res, cur);
+
+	if (!g_file_replace_contents (dest, (char *)string, length, NULL, FALSE,
+			G_FILE_CREATE_NONE, NULL, NULL, &err))
+	{
+		DEBUG_PRINT ("Error exporting file: %s", 
+				err->message);
+		g_propagate_error (error, err);
+	}
+
+	xmlFree (string);
+	xsltFreeStylesheet (cur);
+	xmlFreeDoc (res);
+	xsltCleanupGlobals ();
+
+	return TRUE;
+}

Modified: trunk/plugins/gtodo/libgtodo.h
==============================================================================
--- trunk/plugins/gtodo/libgtodo.h	(original)
+++ trunk/plugins/gtodo/libgtodo.h	Mon Jan 19 17:17:01 2009
@@ -383,4 +383,6 @@
 /* could be usefull for syncronising */
 void gtodo_client_save_client_to_client(GTodoClient *source, GTodoClient *duplicate);
 
+gboolean gtodo_client_export(GTodoClient *source, GFile *dest, const gchar *path_to_xsl, gchar **params, GError **error);
+
 #endif

Modified: trunk/plugins/gtodo/main.h
==============================================================================
--- trunk/plugins/gtodo/main.h	(original)
+++ trunk/plugins/gtodo/main.h	Mon Jan 19 17:17:01 2009
@@ -51,6 +51,7 @@
 	GtkTreeModel *sortmodel;
 	GtkWidget *tbdelbut, *tbaddbut, *tbeditbut;
 	GtkWidget *tbeditlb;
+	GtkWidget *tbexport;
 	GtkWidget *option, *menu;
 	catitems **mitems;
 	GtkAccelGroup *accel_group;

Modified: trunk/plugins/gtodo/preferences.c
==============================================================================
--- trunk/plugins/gtodo/preferences.c	(original)
+++ trunk/plugins/gtodo/preferences.c	Mon Jan 19 17:17:01 2009
@@ -1,9 +1,7 @@
 #include <config.h>
 #include <gtk/gtk.h>
-#include <tray-icon.h>
 #include "main.h"
 
-void preferences_cb_do_tray(GtkWidget *chbox, GtkWidget *hwin);
 static void preferences_cb_show_date(GtkWidget *chbox);
 static void preferences_cb_do_tooltip(GtkWidget *chbox);
 static void preferences_cb_auto_purge(GtkWidget *cb, GtkWidget *hbox);
@@ -13,7 +11,6 @@
 static void preferences_cb_toggle_show_notification(GtkWidget *chbox);
 static void preferences_cb_toggle_show_category_column(GtkWidget *chbox);
 static void preferences_cb_toggle_show_priority_column(GtkWidget *chbox);
-static void preferences_cb_toggle_enable_tray(GtkWidget *chbox);
 
 void gui_preferences(void)
 {
@@ -226,12 +223,6 @@
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), gconf_client_get_bool(client, "/apps/gtodo/prefs/do_notification",NULL));
 	g_signal_connect(G_OBJECT(cb), "toggled", G_CALLBACK(preferences_cb_toggle_show_notification), NULL);
 
-	cb = gtk_check_button_new_with_label(_("Show Notification Tray Icon"));
-	gtk_box_pack_start(GTK_BOX(vbox),cb, FALSE, TRUE, 0); 	
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), 
-		gconf_client_get_bool(client, "/apps/gtodo/view/enable-tray",NULL));
-	g_signal_connect(G_OBJECT(cb), "toggled", 
-			G_CALLBACK(preferences_cb_toggle_enable_tray), NULL);
 	gtk_widget_show_all (notebook);
 	return notebook;
 }
@@ -258,12 +249,6 @@
 	category_changed();
 }
 
-static void preferences_cb_toggle_enable_tray(GtkWidget *chbox)
-{
-	gconf_client_set_bool(client, "/apps/gtodo/view/enable-tray", 
-			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);
-}
-
 static void preferences_cb_toggle_show_notification(GtkWidget *chbox)
 {
 	gconf_client_set_bool(client, "/apps/gtodo/prefs/do_notification", 
@@ -390,19 +375,6 @@
 	category_changed();
 }
 
-static void  pref_gconf_changed_enable_tray(GConfClient *client)
-{
-	if(gconf_client_get_bool(client, "/apps/gtodo/view/enable-tray",NULL))
-	{
-	    if (mw.window)
-		tray_init(mw.window);	
-	}
-	else
-	{
-		tray_icon_remove();
-	}
-}
-
 static void  pref_gconf_changed_hl_indays(GConfClient *client)
 {
 	settings.hl_indays= gconf_client_get_bool(client,"/apps/gtodo/prefs/hl-indays",NULL);
@@ -461,9 +433,4 @@
 			NULL,
 			NULL, NULL);	
 
-	gconf_client_notify_add(client,"/apps/gtodo/view/enable-tray",
-			(GConfClientNotifyFunc) pref_gconf_changed_enable_tray,
-			NULL,
-			NULL, NULL);	
-	
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]