Commit f71b1a38 authored by Naba Kumar's avatar Naba Kumar

Fixed xml format.

	* TODO.tasks: Fixed xml format.

	* plugins/editor/aneditor.cxx: Added code to trap 'tab' key (does not
	work yet).

	* plugins/editor/text_editor.c, plugins/editor/text_editor.h: Code
	cleanups.

	* plugins/gtodo/interface.c, plugins/gtodo/libgtodo.c: Fixed xml
	format during save (removed unwanted text nodes). Fixed scrollbars.
parent a7fff621
2005-02-01 Naba Kumar <naba@gnome.org>
* TODO.tasks: Fixed xml format.
* plugins/editor/aneditor.cxx: Added code to trap 'tab' key (does not
work yet).
* plugins/editor/text_editor.c, plugins/editor/text_editor.h: Code
cleanups.
* plugins/gtodo/interface.c, plugins/gtodo/libgtodo.c: Fixed xml
format during save (removed unwanted text nodes). Fixed scrollbars.
2005-01-31 Naba Kumar <naba@gnome.org>
* libanjuta/interfaces/libanjuta.idl,
......
<?xml version="1.0"?>
<gtodo>
<category title="Unfiled" place="0">
<item><attribute id="1098255975" priority="2" done="1" start_date="731874" completed_date="731972" notify="0" last_edited="1106752594"/><summary>Anjuta 2.0 write up</summary><comment>Write a publication describing what's happening with anjuta
development and what's new in Anjuta 2.0 release.</comment></item></category>
<category title="libanjuta" place="1">
<item>
<attribute id="1098255692" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1098255692"/>
<summary>Move encodings source files</summary>
<comment>Move encodings source files (anjuta-encodings.h and anjuta-encodings.c)
into editor plugin.</comment>
</item>
<item>
<attribute id="1098253494" priority="2" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1098256210"/>
<summary>Preferences keys with no defaults do not register</summary>
<comment>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.</comment>
<attribute id="1098255975" priority="2" done="1" start_date="731874" completed_date="731972" notify="0" last_edited="1106752594"/>
<summary>Anjuta 2.0 write up</summary>
<comment>Write a publication describing what's happening with anjuta
development and what's new in Anjuta 2.0 release.</comment>
</item>
</category>
<category title="libanjuta" place="1">
<item>
<attribute id="1098253934" priority="1" done="1" start_date="731874" completed_date="731901" notify="0" last_edited="1100584623"/>
<summary>Key notification API</summary>
......@@ -32,16 +23,21 @@ We have problem with dynamic class registeration.
Until we figure out that, the plugins should not be unloaded
when deactivated.</comment>
</item>
</category>
<category title="Plugin: Editor" place="3">
<item>
<attribute id="1098253712" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1098253712"/>
<summary>Configure syntax highlighting</summary>
<comment>Add Syntax highlighting configuration dialog in editor
preferences page. A button in the page, which will pop up the
configuration dialog.</comment>
<attribute id="1098255692" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1107240311"/>
<summary>Move encodings source files</summary>
<comment>Move encodings source files (anjuta-encodings.h and anjuta-encodings.c)
by CVS surgery into editor plugin.</comment>
</item>
<item>
<attribute id="1098253494" priority="2" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1107249856"/>
<summary>Preferences keys with no defaults do not register</summary>
<comment>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.</comment>
</item>
</category>
<category title="Plugin: Editor" place="4">
<item>
<attribute id="1098255400" priority="1" done="1" start_date="731874" completed_date="731902" notify="0" last_edited="1100696776"/>
<summary>Add "saved" signal</summary>
......@@ -53,8 +49,47 @@ configuration dialog.</comment>
<comment>Connect to save point state signal of editor and
accordingly update undo/redo ui sensitivity.</comment>
</item>
<item><attribute id="1098253642" priority="1" done="0" start_date="731874" notify="0" last_edited="1105392177"/><summary>Apply prefererences</summary><comment>Editor preferences are not applied now.</comment></item></category>
<category title="Plugin: Project Manager" place="6">
<item>
<attribute id="1098253642" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1107239862"/>
<summary>Apply prefererences</summary>
<comment>Hidden editor preferences (those which are not settable from
preferences dialog) are not applied now.</comment>
</item>
<item>
<attribute id="1098253712" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1107239957"/>
<summary>Update on configure syntax highlighting</summary>
<comment>When syntax highlighting colors/fonts are changed, the
changes are not propagated to all editors, but it should, just
like a gconf key.</comment>
</item>
<item>
<attribute id="1107240087" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240087"/>
<summary>Enable 'Tab' auto-indentation</summary>
<comment>Automatic indentation (ala emacs) is working in Editor. For cpp lexer,
'Tab' should be be trapped from the editor and used to auto-indent
current line. Currently, trapping 'Tab' key in editor does not work.</comment>
</item>
<item>
<attribute id="1107240185" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240185"/>
<summary>Expose editor functions to IAnjutaEditor</summary>
<comment>Currently, only a limited numbers of Editor are exposed through
IAnjutaEditor, IAnjutaMarkable and IAnjutaFileSavable interface.
Most of the API should be exposed.</comment>
</item>
<item>
<attribute id="1107240279" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240279"/>
<summary>Move CVS directories</summary>
<comment>Move data/properties/ and scintilla/ directories (by CVS surgery, and
not by add/remove) into plugins/editor/ directory.</comment>
</item>
<item>
<attribute id="1107240796" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240796"/>
<summary>Add editor view on idle</summary>
<comment>Add editor view using gtk_idle_add() to minimize UI freeze. Also set
busy/unbusy on AnjutaStatus during split operation</comment>
</item>
</category>
<category title="Plugin: Project Manager" place="7">
<item>
<attribute id="1098254033" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1098254070"/>
<summary>Context menu</summary>
......@@ -62,15 +97,24 @@ accordingly update undo/redo ui sensitivity.</comment>
Export currenct selected target or source.
Added context menu based on current selected target or source.</comment>
</item>
<item>
<attribute id="1100059926" priority="1" done="0" start_date="731895" enddate="99999999" notify="0" endtime="-60" last_edited="1100059926"/>
<summary>Display progress window</summary>
<comment>Display a "Loading project" window before loading a project and update gtk events.</comment>
</item>
<item><attribute id="1100059875" priority="1" done="1" start_date="731895" completed_date="731972" notify="0" last_edited="1106752638"/><summary>Error messages for loading project</summary><comment>Display error messages after loading of project fails.</comment></item></category>
<category title="Plugin: File Manager" place="5"/>
<category title="Plugin: Automake Build" place="2">
<item>
<attribute id="1100059875" priority="1" done="1" start_date="731895" completed_date="731972" notify="0" last_edited="1106752638"/>
<summary>Error messages for loading project</summary>
<comment>Display error messages after loading of project fails.</comment>
</item>
<item>
<attribute id="1107240342" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240342"/>
<summary>Implemente IAnjutaProjectManager</summary>
<comment>Implemente IAnjutaProjectManager interface.</comment>
</item>
</category>
<category title="Plugin: File Manager" place="6"/>
<category title="Plugin: Automake Build" place="3">
<item>
<attribute id="1098254207" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1098255751"/>
<summary>Project manager watch</summary>
......@@ -78,13 +122,19 @@ Added context menu based on current selected target or source.</comment>
merge context menu into project manager.</comment>
</item>
<item>
<attribute id="1100521161" priority="1" done="0" start_date="731900" enddate="99999999" notify="0" endtime="-60" last_edited="1100521161"/>
<attribute id="1100521161" priority="1" done="0" start_date="731900" enddate="99999999" notify="0" endtime="-60" last_edited="1107241480"/>
<summary>Define compile commands</summary>
<comment>Define compile commands for various file extensions.
</comment>
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).</comment>
</item>
</category>
<category title="Plugin: Symbol Browser" place="7">
<category title="Plugin: Symbol Browser" place="9">
<item>
<attribute id="1098255485" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1098255485"/>
<summary>Updated tags image on file save</summary>
......@@ -115,15 +165,36 @@ 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.</comment>
</item>
<item>
<attribute id="1107240408" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240408"/>
<summary>Update on Add/Remove files in project</summary>
<comment>Using IAnjutaProjectManager interface, update symbol database
on add/remove of sources.</comment>
</item>
<item>
<attribute id="1107240520" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240535"/>
<summary>Tags search do not retrieve all matching symbols</summary>
<comment>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.
</comment>
</item>
<item>
<attribute id="1107240571" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240571"/>
<summary>Possible memory leak</summary>
<comment>Investigate possible memory lead on load/unload of symbol-browser.</comment>
</item>
</category>
<category title="Documentation" place="8">
<category title="Documentation" place="11">
<item>
<attribute id="1098255636" priority="1" done="0" start_date="731874" notify="0" last_edited="1101603303"/>
<summary>Update</summary>
<comment>All documents need update.</comment>
</item>
</category>
<category title="Plugin: File Loader" place="4">
<category title="Plugin: File Loader" place="5">
<item>
<attribute id="1098254131" priority="1" done="0" start_date="731874" enddate="99999999" notify="0" endtime="-60" last_edited="1098256394"/>
<summary>Project manager watch</summary>
......@@ -136,4 +207,62 @@ with context menu in project manager.</comment>
<comment>Add open with plugins menus along with open with programs menus.</comment>
</item>
</category>
<category title="libanjuta-interfaces" place="2">
<item>
<attribute id="1107240705" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240705"/>
<summary>Documentation</summary>
<comment>Add gdoc API documentation in libanjuta.idl.</comment>
</item>
</category>
<category title="Plugin: Task Manager" place="10">
<item>
<attribute id="1107240955" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107240955"/>
<summary>Proper deactivation</summary>
<comment>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.</comment>
</item>
<item>
<attribute id="1107241016" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107241016"/>
<summary>Text wrap</summary>
<comment>Text (title and description) are not automatically wrapped for long lines.</comment>
</item>
<item>
<attribute id="1107241155" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107241155"/>
<summary>Create text version TODO file</summary>
<comment>Create human readable TODO file, which will be plain text,
during save.</comment>
</item>
<item>
<attribute id="1107240984" priority="1" done="1" start_date="731978" completed_date="731978" notify="0" last_edited="1107250499"/>
<summary>Scrollbars</summary>
<comment>Set horizontal and vertical scrollbars AUTOMATIC.</comment>
</item>
<item>
<attribute id="1107241255" priority="1" done="1" start_date="731978" completed_date="731978" notify="0" last_edited="1107250502"/>
<summary>Remove text nodes during save</summary>
<comment>Remove text nodes between tags that do not have text contents.
It can be done either during save or load. Without this fix, the save xml is distorted.</comment>
</item>
</category>
<category title="Plugin: Project Wizard" place="8">
<item>
<attribute id="1107241611" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107241611"/>
<summary>Proper message output</summary>
<comment>Produce a proper message output when files are created from
templates. For example, 'Creating project-name/file-path/file-name.c'
instead of full path names.</comment>
</item>
<item>
<attribute id="1107241649" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107241649"/>
<summary>More templates</summary>
<comment>Create more project templates, such as gnome, sdl, x11 etc..</comment>
</item>
<item>
<attribute id="1107241699" priority="1" done="0" start_date="731978" enddate="99999999" notify="0" endtime="-60" last_edited="1107241699"/>
<summary>Prompt error when autogen could not be found</summary>
<comment>Prompt user with an error when 'autogen' could not be found and
abort the process.</comment>
</item>
</category>
</gtodo>
......@@ -505,6 +505,9 @@ AnEditor::AnEditor(PropSetFile* p) {
SendEditor(SCI_USEPOPUP, false);
/* Set default editor mode */
SendEditor(SCI_SETEOLMODE, SC_EOL_LF);
// Trap 'TAB' key for automatic indentation.
// SendEditor (SCI_ASSIGNCMDKEY, SCK_TAB, SCI_NULL);
#if 0
/* Register images to be used for autocomplete */
......@@ -3355,17 +3358,39 @@ void AnEditor::Notify(SCNotification *notification) {
ResumeCallTip (false);
break;
case SCN_KEY: {
if(!accelGroup) break;
int mods = 0;
if (notification->modifiers & SCMOD_SHIFT)
mods |= GDK_SHIFT_MASK;
if (notification->modifiers & SCMOD_CTRL)
mods |= GDK_CONTROL_MASK;
if (notification->modifiers & SCMOD_ALT)
mods |= GDK_MOD1_MASK;
gtk_accel_groups_activate(G_OBJECT (accelGroup), notification->ch,
static_cast<GdkModifierType>(mods));
// Trap 'TAB' key for automatic indentation.
// printf ("Key is '%c'\n", notification->ch);
if (notification->ch == SCK_TAB) {
if ((lexLanguage == SCLEX_CPP) &&
(notification->modifiers == 0) &&
(!indentMaintain) &&
(props->GetInt("indent.automatic"))) {
CharacterRange crange = GetSelection();
int selStart = crange.cpMin;
int selEnd = crange.cpMax;
if (selStart == selEnd) {
AutomaticIndentation('\t');
} else {
SendEditor (SCI_TAB);
}
} else {
SendEditor (SCI_TAB);
}
break;
}
if(!accelGroup) break;
int mods = 0;
if (notification->modifiers & SCMOD_SHIFT)
mods |= GDK_SHIFT_MASK;
if (notification->modifiers & SCMOD_CTRL)
mods |= GDK_CONTROL_MASK;
if (notification->modifiers & SCMOD_ALT)
mods |= GDK_MOD1_MASK;
gtk_accel_groups_activate(G_OBJECT (accelGroup), notification->ch,
static_cast<GdkModifierType>(mods));
}
case SCN_CHARADDED:
CharAdded(static_cast<char>(notification->ch));
......
......@@ -1725,12 +1725,14 @@ text_editor_line_from_handle (TextEditor* te, gint marker_handle)
return linenum_scintilla_to_text_editor (line);
}
gint text_editor_get_bookmark_line( TextEditor* te, const glong nLineStart )
gint
text_editor_get_bookmark_line( TextEditor* te, const glong nLineStart )
{
return aneditor_command (te->editor_id, ANE_GETBOOKMARK_POS, nLineStart, 0 );
return aneditor_command (te->editor_id, ANE_GETBOOKMARK_POS, nLineStart, 0);
}
gint text_editor_get_num_bookmarks(TextEditor* te)
gint
text_editor_get_num_bookmarks(TextEditor* te)
{
gint nLineNo = -1 ;
gint nMarkers = 0 ;
......@@ -1746,10 +1748,12 @@ gint text_editor_get_num_bookmarks(TextEditor* te)
return nMarkers ;
}
/* Get the current selection. If there is no selection, or if the selection
** is all blanks, get the word under teh cursor.
*/
gchar *text_editor_get_current_word(TextEditor *te)
/*
*Get the current selection. If there is no selection, or if the selection
* is all blanks, get the word under teh cursor.
*/
gchar
*text_editor_get_current_word(TextEditor *te)
{
char *buf = text_editor_get_selection(te);
if (buf)
......
......@@ -95,20 +95,40 @@ struct _TextEditorClass
GType text_editor_get_type (void);
/* New instance of TextEditor */
GtkWidget* text_editor_new (AnjutaPreferences * pr, const gchar *uri,
const gchar *tab_name);
/* Freeze and thaw editor */
void text_editor_freeze (TextEditor * te);
void text_editor_thaw (TextEditor * te);
/* Set context pop up menu */
void text_editor_set_popup_menu (TextEditor *te, GtkWidget *popup_menu);
/*
* Sets the custom (forced) highlight style for the editor. Pass a dummy file
* name (with extension) to force particular highlight style. This function
* does not actualy rehighlight the editor, but only sets the highlight type
* which will be used in subsequent call to text_editor_hil().
*/
void text_editor_set_hilite_type (TextEditor * te, const gchar *file_extension);
/*
* (Re) highlights the Editor. The 'force' parameter is used to tell if the
* preferences setting for 'Disable highlight' should not be considered.
* If force == FALSE, there will be no highlight if 'Disable highlight' is
* set ON.
*/
void text_editor_hilite (TextEditor *te, gboolean force);
/*
* Set the zoom factor. Zoom factor basically increases or decreases the
* text font size by a factor of (2*zfac)
*/
void text_editor_set_zoom_factor (TextEditor * te, gint zfac);
/* Undo or redo last action */
void text_editor_undo (TextEditor * te);
void text_editor_redo (TextEditor * te);
......@@ -118,74 +138,87 @@ text_editor_find (TextEditor * te, const gchar * str, gint scope,
gboolean forward, gboolean regexp, gboolean ignore_case,
gboolean whole_word, gboolean wrap);
/* Replaces current selection with given string */
void text_editor_replace_selection (TextEditor * te, const gchar * r_str);
guint text_editor_get_total_lines (TextEditor * te);
glong text_editor_get_current_position (TextEditor * te);
guint text_editor_get_current_lineno (TextEditor * te);
guint text_editor_get_current_column (TextEditor * te);
guint text_editor_get_line_from_position (TextEditor * te, glong pos);
gchar* text_editor_get_selection (TextEditor * te);
/* Various editor information */
guint text_editor_get_total_lines (TextEditor * te);
glong text_editor_get_current_position (TextEditor * te);
guint text_editor_get_current_lineno (TextEditor * te);
guint text_editor_get_current_column (TextEditor * te);
guint text_editor_get_line_from_position (TextEditor * te, glong pos);
gchar* text_editor_get_selection (TextEditor * te);
gboolean text_editor_get_overwrite (TextEditor * te);
glong text_editor_get_selection_start (TextEditor * te);
glong text_editor_get_selection_end (TextEditor * te);
gboolean text_editor_has_selection (TextEditor * te);
gboolean text_editor_is_saved (TextEditor * te);
/* Jump to various locations */
gboolean text_editor_goto_point (TextEditor * te, glong num);
gboolean text_editor_goto_line (TextEditor * te, glong num,
gboolean mark, gboolean ensure_visible);
gint text_editor_goto_block_start (TextEditor* te);
gint text_editor_goto_block_end (TextEditor* te);
void text_editor_set_line_marker (TextEditor * te, glong line);
gint text_editor_set_marker (TextEditor * te, glong line, gint marker);
gint text_editor_set_indicator (TextEditor *te, glong line, gint indicator);
/* Save or load file */
gboolean text_editor_load_file (TextEditor * te);
gboolean text_editor_save_file (TextEditor * te, gboolean update);
gboolean text_editor_is_saved (TextEditor * te);
gboolean text_editor_has_selection (TextEditor * te);
glong text_editor_get_selection_start (TextEditor * te);
glong text_editor_get_selection_end (TextEditor * te);
void text_editor_update_controls (TextEditor * te);
gboolean text_editor_save_yourself (TextEditor * te, FILE * stream);
gboolean text_editor_recover_yourself (TextEditor * te, FILE * stream);
gboolean text_editor_check_disk_status (TextEditor * te, const gboolean bForce );
/* Autoformats code using 'indent' program */
void text_editor_autoformat (TextEditor * te);
gboolean text_editor_is_marker_set (TextEditor* te, glong line, gint marker);
void text_editor_delete_marker (TextEditor* te, glong line, gint marker);
void text_editor_delete_marker_all (TextEditor *te, gint marker);
gint text_editor_line_from_handle (TextEditor* te, gint marker_handle);
gint text_editor_get_bookmark_line ( TextEditor* te, const glong nLineStart );
gint text_editor_get_num_bookmarks (TextEditor* te);
/* Markers and indicators */
void text_editor_set_line_marker (TextEditor * te, glong line);
gint text_editor_set_marker (TextEditor * te, glong line, gint marker);
gboolean text_editor_is_marker_set (TextEditor* te, glong line, gint marker);
void text_editor_delete_marker (TextEditor* te, glong line, gint marker);
void text_editor_delete_marker_all (TextEditor *te, gint marker);
gint text_editor_line_from_handle (TextEditor* te, gint marker_handle);
gint text_editor_get_bookmark_line (TextEditor* te, const glong nLineStart);
gint text_editor_get_num_bookmarks (TextEditor* te);
gint text_editor_set_indicator (TextEditor *te, glong line, gint indicator);
/* Get currect word near by cursor location */
gchar* text_editor_get_current_word (TextEditor *te);
/* Updates linewidth according to total line numbers */
void text_editor_set_line_number_width (TextEditor* te);
/* Grab focus */
void text_editor_grab_focus (TextEditor *te);
/* Select the function block where the cursor is content */
void text_editor_function_select(TextEditor *te);
/* Get the global properties set */
gint text_editor_get_props (void);
/* Set busy cursor on Editor window */
void text_editor_set_busy (TextEditor *te, gboolean state);
/* Multiple views addition and removal */
void text_editor_add_view (TextEditor *te);
void text_editor_remove_view (TextEditor *te);
/* Direct editor commands to AnEditor and Scintilla */
void text_editor_command(TextEditor *te, gint command,
glong wparam, glong lparam);
void text_editor_scintilla_command (TextEditor *te, gint command,
glong wparam, glong lparam);
/*
* Conversion from scintilla line number to TextEditor line
* number representation
*/
#define linenum_text_editor_to_scintilla(x) (x-1)
#define linenum_scintilla_to_text_editor(x) (x+1)
/* Editor preferences */
#define DISABLE_SYNTAX_HILIGHTING "disable.syntax.hilighting"
#define SAVE_AUTOMATIC "save.automatic"
......
......@@ -190,7 +190,9 @@ GtkWidget * gui_create_todo_widget()
sw = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(sw), mw.treeview);
gtk_box_pack_end(GTK_BOX(mw.vbox), sw, TRUE, TRUE, 0);
......@@ -224,8 +226,9 @@ GtkWidget * gui_create_todo_widget()
gtk_tree_sortable_set_sort_func((GtkTreeSortable *)mw.sortmodel,0, (GtkTreeIterCompareFunc)sort_function_test, NULL, NULL);
gtk_tree_sortable_set_sort_column_id((GtkTreeSortable *)mw.sortmodel,0, settings.sortorder);
gtk_tree_view_column_set_fixed_width(column, 10);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
// gtk_tree_view_column_set_fixed_width(column, 10);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (mw.treeview), column);
/* handlers */
g_signal_connect(G_OBJECT(mw.treeview), "motion-notify-event", G_CALLBACK(mw_motion_cb), NULL);
......
......@@ -684,6 +684,49 @@ int gtodo_client_check_file(GTodoClient *cl, GError **error)
return FALSE;
}
/* Remove unwanted text nodes from the document */
static void
gtodo_client_cleanup_doc (GTodoClient *cl)
{
xmlNodePtr level1, next1;
level1 = cl->root->xmlChildrenNode;
while(level1 != NULL){
xmlNodePtr level2, next2;
next1 = level1->next;
if(xmlNodeIsText(level1)) {
xmlUnlinkNode(level1);
xmlFreeNode(level1);
} else {
level2 = level1->xmlChildrenNode;
while(level2 != NULL) {
xmlNodePtr level3, next3;
next2 = level2->next;
if(xmlNodeIsText(level2)) {
xmlUnlinkNode(level2);
xmlFreeNode(level2);
} else {
level3 = level2->xmlChildrenNode;
while (level3 != NULL) {
// xmlNodePtr level4, next4;
next3 = level3->next;
if(xmlNodeIsText(level3)) {
xmlUnlinkNode(level3);
xmlFreeNode(level3);
}
level3 = next3;
}
}
level2 = next2;
}
}
level1 = next1;
}
}
/* save the gtodo_Client */
int gtodo_client_save_xml(GTodoClient *cl, GError **error)
......@@ -693,6 +736,7 @@ int gtodo_client_save_xml(GTodoClient *cl, GError **error)
g_return_val_if_fail(error == NULL || *error == NULL,FALSE);
if(debug)g_print("** DEBUG ** saving %s\n", cl->xml_path);
gtodo_client_cleanup_doc (cl);
if(gtodo_client_save_xml_to_file(cl, cl->xml_path, &tmp_error))
{
g_propagate_error(error, tmp_error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment