├── outliner ├── NEWS ├── po │ ├── ChangeLog │ ├── .cvsignore │ ├── POTFILES.in │ └── Makefile.in.in ├── src │ ├── outliner-marshal.list │ ├── .cvsignore │ ├── outliner-opml.h │ ├── Makefile.am │ ├── outliner-file.h │ ├── xml-gnomevfs.h │ ├── outliner-text-view.h │ ├── outliner-window.h │ ├── outliner-fprops-dialog.h │ ├── outliner-cell-renderer.h │ ├── outliner-view.h │ ├── outliner-actions.h │ ├── xml-gnomevfs.c │ ├── outliner-text-view.c │ ├── outliner-main.c │ ├── outliner-document.h │ ├── outliner-cell-renderer.c │ ├── outliner-file.c │ ├── outliner-fprops-dialog.c │ ├── outliner-actions.c │ ├── outliner-opml.c │ ├── outliner-view.c │ ├── outliner-document.c │ └── outliner-window.c ├── README ├── Makefile.am ├── .cvsignore ├── COPYRIGHT ├── AUTHORS ├── autogen.sh ├── ChangeLog ├── configure.ac ├── INSTALL └── COPYING └── CVSROOT ├── checkoutlist ├── notify ├── cvswrappers ├── rcsinfo ├── commitinfo ├── taginfo ├── config ├── editinfo ├── verifymsg ├── modules ├── loginfo └── syncmail /outliner/NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /outliner/po/ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /outliner/src/outliner-marshal.list: -------------------------------------------------------------------------------- 1 | VOID:POINTER,POINTER 2 | -------------------------------------------------------------------------------- /outliner/po/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | POTFILES 4 | *.gmo 5 | *.mo 6 | *.pot 7 | -------------------------------------------------------------------------------- /outliner/README: -------------------------------------------------------------------------------- 1 | For now, please see the website for more information: 2 | http://gnomeoutliner.sourceforge.net/ 3 | -------------------------------------------------------------------------------- /outliner/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src \ 2 | po 3 | 4 | EXTRA_DIST = intltool-extract.in intltool-merge.in intltool-update.in 5 | -------------------------------------------------------------------------------- /outliner/src/.cvsignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | Makefile 4 | Makefile.in 5 | gnome-outliner 6 | .*.swp 7 | *.lo 8 | *.o 9 | outliner-marshal.c 10 | outliner-marshal.h 11 | -------------------------------------------------------------------------------- /outliner/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | aclocal.m4 4 | autom4te.cache 5 | config.h 6 | config.h.in 7 | config.log 8 | config.status 9 | configure 10 | intltool-extract 11 | intltool-merge 12 | intltool-update 13 | libtool 14 | stamp-h1 15 | -------------------------------------------------------------------------------- /outliner/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Gnome Outliner 2 | Copyright (C) 2004, 2005 by the following: 3 | 4 | If you have contributed to Gnome Outliner, you deserve to be on this list. 5 | Contact us (see: AUTHORS) and we'll add you. 6 | 7 | James Bowes 8 | Abel Daniel 9 | Nathan Fredrickson 10 | Javier Amor García 11 | Steven Garrity 12 | Dan Korostelev 13 | David Maddock 14 | Christian Neumair 15 | -------------------------------------------------------------------------------- /outliner/AUTHORS: -------------------------------------------------------------------------------- 1 | Gnome Outliner 2 | ------------------------------------------- 3 | 4 | Steven Garrity - Architect 5 | Email: steven@silverorange.com 6 | 7 | Dan Korostelev - Developer 8 | Email: dan@ats.energo.ru 9 | 10 | Nathan Fredrickson - Maintainer/Developer 11 | Email: nathan@silverorange.com 12 | Jabber: nathan@jabber.silverorange.com 13 | 14 | ------------------------------------------- 15 | see COPYRIGHT for full list of contributors 16 | -------------------------------------------------------------------------------- /outliner/po/POTFILES.in: -------------------------------------------------------------------------------- 1 | src/outliner-window.c 2 | src/outliner-window.h 3 | src/outliner-actions.c 4 | src/outliner-actions.h 5 | src/outliner-view.c 6 | src/outliner-view.h 7 | src/outliner-document.c 8 | src/outliner-document.h 9 | src/outliner-file.c 10 | src/outliner-file.h 11 | src/outliner-opml.c 12 | src/outliner-opml.h 13 | src/xml-gnomevfs.c 14 | src/xml-gnomevfs.h 15 | src/outliner-cell-renderer.c 16 | src/outliner-cell-renderer.h 17 | src/outliner-text-view.c 18 | src/outliner-text-view.h 19 | src/outliner-main.c 20 | -------------------------------------------------------------------------------- /CVSROOT/checkoutlist: -------------------------------------------------------------------------------- 1 | # The "checkoutlist" file is used to support additional version controlled 2 | # administrative files in $CVSROOT/CVSROOT, such as template files. 3 | # 4 | # The first entry on a line is a filename which will be checked out from 5 | # the corresponding RCS file in the $CVSROOT/CVSROOT directory. 6 | # The remainder of the line is an error message to use if the file cannot 7 | # be checked out. 8 | # 9 | # File format: 10 | # 11 | # [][] 12 | # 13 | # comment lines begin with '#' 14 | -------------------------------------------------------------------------------- /outliner/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | srcdir=`dirname $0` 5 | test -z "$srcdir" && srcdir=. 6 | 7 | PKG_NAME="gnome-outliner" 8 | 9 | (test -f $srcdir/configure.ac) || { 10 | echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" 11 | echo " top-level $PKG_NAME directory" 12 | exit 1 13 | } 14 | 15 | which gnome-autogen.sh || { 16 | echo "You need to install gnome-common 2.4.0 or newer" 17 | exit 1 18 | } 19 | REQUIRED_AUTOMAKE_VERSION=1.6 USE_GNOME2_MACROS=1 . gnome-autogen.sh 20 | -------------------------------------------------------------------------------- /CVSROOT/notify: -------------------------------------------------------------------------------- 1 | # The "notify" file controls where notifications from watches set by 2 | # "cvs watch add" or "cvs edit" are sent. The first entry on a line is 3 | # a regular expression which is tested against the directory that the 4 | # change is being made to, relative to the $CVSROOT. If it matches, 5 | # then the remainder of the line is a filter program that should contain 6 | # one occurrence of %s for the user to notify, and information on its 7 | # standard input. 8 | # 9 | # "ALL" or "DEFAULT" can be used in place of the regular expression. 10 | # 11 | # For example: 12 | #ALL mail -s "CVS notification" %s 13 | # 14 | -------------------------------------------------------------------------------- /CVSROOT/cvswrappers: -------------------------------------------------------------------------------- 1 | # This file affects handling of files based on their names. 2 | # 3 | # The -m option specifies whether CVS attempts to merge files. 4 | # 5 | # The -k option specifies keyword expansion (e.g. -kb for binary). 6 | # 7 | # Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) 8 | # 9 | # wildcard [option value][option value]... 10 | # 11 | # where option is one of 12 | # -f from cvs filter value: path to filter 13 | # -t to cvs filter value: path to filter 14 | # -m update methodology value: MERGE or COPY 15 | # -k expansion mode value: b, o, kkv, &c 16 | # 17 | # and value is a single-quote delimited value. 18 | # For example: 19 | #*.gif -k 'b' 20 | -------------------------------------------------------------------------------- /CVSROOT/rcsinfo: -------------------------------------------------------------------------------- 1 | # The "rcsinfo" file is used to control templates with which the editor 2 | # is invoked on commit and import. 3 | # 4 | # The first entry on a line is a regular expression which is tested 5 | # against the directory that the change is being made to, relative to the 6 | # $CVSROOT. For the first match that is found, then the remainder of the 7 | # line is the name of the file that contains the template. 8 | # 9 | # If the repository name does not match any of the regular expressions in this 10 | # file, the "DEFAULT" line is used, if it is specified. 11 | # 12 | # If the name "ALL" appears as a regular expression it is always used 13 | # in addition to the first matching regex or "DEFAULT". 14 | -------------------------------------------------------------------------------- /outliner/ChangeLog: -------------------------------------------------------------------------------- 1 | version 0.2cvs: 2 | * Command line options. 3 | 4 | version 0.1: 5 | * More support for the OPML head elements and non-destructive with 6 | any non-supported attributes in an existing file (David Maddock) 7 | * Item checkboxes (David Maddock) 8 | * Delete key deletes selected row(s) (David Maddock) 9 | * Drag and drop into the outline (David Maddock) 10 | * "Save Changes" confirmation (Javier Amor García) 11 | * Multiple select and multiple row operations 12 | * Item actions (move up/down, indent/unindent, delete) now operate on 13 | on subtrees 14 | * Setup keyboard accelerators and override default bindings for Tab 15 | * Combined code from Dan Korostelev, Christian Neumair, and 16 | myself (Nathan Fredrickson) to get us started in structured way 17 | * Created Changelog File :) 18 | -------------------------------------------------------------------------------- /CVSROOT/commitinfo: -------------------------------------------------------------------------------- 1 | # The "commitinfo" file is used to control pre-commit checks. 2 | # The filter on the right is invoked with the repository and a list 3 | # of files to check. A non-zero exit of the filter program will 4 | # cause the commit to be aborted. 5 | # 6 | # The first entry on a line is a regular expression which is tested 7 | # against the directory that the change is being committed to, relative 8 | # to the $CVSROOT. For the first match that is found, then the remainder 9 | # of the line is the name of the filter to run. 10 | # 11 | # If the repository name does not match any of the regular expressions in this 12 | # file, the "DEFAULT" line is used, if it is specified. 13 | # 14 | # If the name "ALL" appears as a regular expression it is always used 15 | # in addition to the first matching regex or "DEFAULT". 16 | -------------------------------------------------------------------------------- /outliner/configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ(2.53) 2 | AC_INIT(gnome-outliner, 0.2cvs) 3 | AC_CONFIG_SRCDIR(src/outliner-main.c) 4 | AM_INIT_AUTOMAKE 5 | AM_CONFIG_HEADER(config.h) 6 | 7 | AC_PROG_CC 8 | AC_PROG_INSTALL 9 | AC_STDC_HEADERS 10 | AC_DISABLE_STATIC 11 | AC_PROG_INTLTOOL 12 | AC_PROG_LIBTOOL 13 | AC_PROG_LN_S 14 | 15 | PKG_CHECK_MODULES(DEPS, glib-2.0 >= 2.4.0 gtk+-2.0 >= 2.4.0 libxml-2.0 >= 2.6.8 libgnome-2.0 >= 2.6.0 libgnomeui-2.0 >= 2.6.0) 16 | AC_SUBST(DEPS_CFLAGS) 17 | AC_SUBST(DEPS_LIBS) 18 | 19 | ALL_LINGUAS="" 20 | AM_GLIB_GNU_GETTEXT 21 | 22 | GETTEXT_PACKAGE=$PACKAGE_NAME 23 | AC_SUBST(GETTEXT_PACKAGE) 24 | AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [gettext domain]) 25 | 26 | AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) 27 | 28 | AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in]) 29 | AC_OUTPUT 30 | -------------------------------------------------------------------------------- /CVSROOT/taginfo: -------------------------------------------------------------------------------- 1 | # The "taginfo" file is used to control pre-tag checks. 2 | # The filter on the right is invoked with the following arguments: 3 | # 4 | # $1 -- tagname 5 | # $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d 6 | # $3 -- repository 7 | # $4-> file revision [file revision ...] 8 | # 9 | # A non-zero exit of the filter program will cause the tag to be aborted. 10 | # 11 | # The first entry on a line is a regular expression which is tested 12 | # against the directory that the change is being committed to, relative 13 | # to the $CVSROOT. For the first match that is found, then the remainder 14 | # of the line is the name of the filter to run. 15 | # 16 | # If the repository name does not match any of the regular expressions in this 17 | # file, the "DEFAULT" line is used, if it is specified. 18 | # 19 | # If the name "ALL" appears as a regular expression it is always used 20 | # in addition to the first matching regex or "DEFAULT". 21 | -------------------------------------------------------------------------------- /CVSROOT/config: -------------------------------------------------------------------------------- 1 | # Set this to "no" if pserver shouldn't check system users/passwords 2 | #SystemAuth=no 3 | 4 | # Put CVS lock files in this directory rather than directly in the repository. 5 | #LockDir=/var/lock/cvs 6 | 7 | # Set `TopLevelAdmin' to `yes' to create a CVS directory at the top 8 | # level of the new working directory when using the `cvs checkout' 9 | # command. 10 | #TopLevelAdmin=no 11 | 12 | # Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the 13 | # history file, or a subset as needed (ie `TMAR' logs all write operations) 14 | #LogHistory=TOEFWUPCGMAR 15 | 16 | # Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg 17 | # script to change the log message. Set it to `stat' to force CVS to verify# that the file has changed before reading it (this can take up to an extra 18 | # second per directory being committed, so it is not recommended for large 19 | # repositories. Set it to `never' (the previous CVS behavior) to prevent 20 | # verifymsg scripts from changing the log message. 21 | #RereadLogAfterVerify=always 22 | -------------------------------------------------------------------------------- /CVSROOT/editinfo: -------------------------------------------------------------------------------- 1 | # The "editinfo" file is used to allow verification of logging 2 | # information. It works best when a template (as specified in the 3 | # rcsinfo file) is provided for the logging procedure. Given a 4 | # template with locations for, a bug-id number, a list of people who 5 | # reviewed the code before it can be checked in, and an external 6 | # process to catalog the differences that were code reviewed, the 7 | # following test can be applied to the code: 8 | # 9 | # Making sure that the entered bug-id number is correct. 10 | # Validating that the code that was reviewed is indeed the code being 11 | # checked in (using the bug-id number or a seperate review 12 | # number to identify this particular code set.). 13 | # 14 | # If any of the above test failed, then the commit would be aborted. 15 | # 16 | # Actions such as mailing a copy of the report to each reviewer are 17 | # better handled by an entry in the loginfo file. 18 | # 19 | # One thing that should be noted is the the ALL keyword is not 20 | # supported. There can be only one entry that matches a given 21 | # repository. 22 | -------------------------------------------------------------------------------- /CVSROOT/verifymsg: -------------------------------------------------------------------------------- 1 | # The "verifymsg" file is used to allow verification of logging 2 | # information. It works best when a template (as specified in the 3 | # rcsinfo file) is provided for the logging procedure. Given a 4 | # template with locations for, a bug-id number, a list of people who 5 | # reviewed the code before it can be checked in, and an external 6 | # process to catalog the differences that were code reviewed, the 7 | # following test can be applied to the code: 8 | # 9 | # Making sure that the entered bug-id number is correct. 10 | # Validating that the code that was reviewed is indeed the code being 11 | # checked in (using the bug-id number or a seperate review 12 | # number to identify this particular code set.). 13 | # 14 | # If any of the above test failed, then the commit would be aborted. 15 | # 16 | # Actions such as mailing a copy of the report to each reviewer are 17 | # better handled by an entry in the loginfo file. 18 | # 19 | # One thing that should be noted is the the ALL keyword is not 20 | # supported. There can be only one entry that matches a given 21 | # repository. 22 | -------------------------------------------------------------------------------- /CVSROOT/modules: -------------------------------------------------------------------------------- 1 | # Three different line formats are valid: 2 | # key -a aliases... 3 | # key [options] directory 4 | # key [options] directory files... 5 | # 6 | # Where "options" are composed of: 7 | # -i prog Run "prog" on "cvs commit" from top-level of module. 8 | # -o prog Run "prog" on "cvs checkout" of module. 9 | # -e prog Run "prog" on "cvs export" of module. 10 | # -t prog Run "prog" on "cvs rtag" of module. 11 | # -u prog Run "prog" on "cvs update" of module. 12 | # -d dir Place module in directory "dir" instead of module name. 13 | # -l Top-level directory only -- do not recurse. 14 | # 15 | # NOTE: If you change any of the "Run" options above, you'll have to 16 | # release and re-checkout any working directories of these modules. 17 | # 18 | # And "directory" is a path to a directory relative to $CVSROOT. 19 | # 20 | # The "-a" option specifies an alias. An alias is interpreted as if 21 | # everything on the right of the "-a" had been typed on the command line. 22 | # 23 | # You can encode a module within a module by using the special '&' 24 | # character to interpose another module into the current module. This 25 | # can be useful for creating a module that consists of many directories 26 | # spread out over the entire source repository. 27 | -------------------------------------------------------------------------------- /outliner/src/outliner-opml.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-opml.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_OPML_H 25 | #define OUTLINER_OPML_H 26 | 27 | #include "outliner-document.h" 28 | #include "outliner-window.h" 29 | 30 | #include 31 | 32 | void outliner_opml_save_file(OutlinerWindow *window, OutlinerDocument *doc, gchar *filename); 33 | void outliner_opml_load_file(OutlinerDocument *doc, gchar *filename); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /outliner/src/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = gnome-outliner 2 | 3 | gnome_outliner_SOURCES = \ 4 | outliner-marshal.h \ 5 | outliner-marshal.c \ 6 | outliner-window.c \ 7 | outliner-window.h \ 8 | outliner-actions.c \ 9 | outliner-actions.h \ 10 | outliner-view.c \ 11 | outliner-view.h \ 12 | outliner-document.c \ 13 | outliner-document.h \ 14 | outliner-file.c \ 15 | outliner-file.h \ 16 | outliner-fprops-dialog.c \ 17 | outliner-fprops-dialog.h \ 18 | outliner-opml.c \ 19 | outliner-opml.h \ 20 | xml-gnomevfs.c \ 21 | xml-gnomevfs.h \ 22 | outliner-cell-renderer.c \ 23 | outliner-cell-renderer.h \ 24 | outliner-text-view.c \ 25 | outliner-text-view.h \ 26 | outliner-main.c 27 | 28 | gnome_outliner_LDADD = $(DEPS_LIBS) 29 | 30 | AM_CPPFLAGS = $(DEPS_CFLAGS) \ 31 | -DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\" \ 32 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)/"\" 33 | 34 | # Signal Marshallers 35 | 36 | GENMARSHAL_FLAGS = --prefix="outliner_marshal" --g-fatal-warnings 37 | 38 | outliner-marshal.h: outliner-marshal.list 39 | @GLIB_GENMARSHAL@ $(GENMARSHAL_FLAGS) \ 40 | --header outliner-marshal.list > outliner-marshal.h 41 | 42 | outliner-marshal.c: outliner-marshal.h 43 | @GLIB_GENMARSHAL@ $(GENMARSHAL_FLAGS) \ 44 | --body outliner-marshal.list > outliner-marshal.c 45 | 46 | EXTRA_DIST = outliner-marshal.list 47 | CLEANFILES = outliner-marshal.c outliner-marshal.h 48 | -------------------------------------------------------------------------------- /outliner/src/outliner-file.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-file.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_FILE_H 25 | #define OUTLINER_FILE_H 26 | 27 | #include "outliner-window.h" 28 | #include "outliner-document.h" 29 | 30 | void outliner_file_save_as(OutlinerWindow *window, OutlinerDocument *doc); 31 | void outliner_file_save(OutlinerWindow *window, OutlinerDocument *doc); 32 | gint outliner_file_save_changed(OutlinerWindow *window, OutlinerDocument *doc); 33 | void outliner_file_open(OutlinerWindow *window, OutlinerDocument *doc); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /outliner/src/xml-gnomevfs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * xml-gnomevfs.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_XML_GNOMEVFS_H 25 | #define OUTLINER_XML_GNOMEVFS_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | GnomeVFSHandle *xml_gnomevfs_openread(gchar *filename); 32 | gint xml_gnomevfs_read(GnomeVFSHandle *handle, gchar *buf, gint len); 33 | gint xml_gnomevfs_close(GnomeVFSHandle *handle); 34 | gint xml_gnomevfs_write(GnomeVFSHandle *handle, const gchar *buf, gint len); 35 | xmlOutputBufferPtr xml_gnomevfs_create_ouputbuffer(GnomeVFSHandle *handle); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /outliner/src/outliner-text-view.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-text-view.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_TEXT_VIEW_H 25 | #define OUTLINER_TEXT_VIEW_H 26 | 27 | #include 28 | 29 | #define OUTLINER_TYPE_TEXT_VIEW (outliner_text_view_get_type()) 30 | #define OUTLINER_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OUTLINER_TYPE_TEXT_VIEW, OutlinerTextView)) 31 | #define OUTLINER_IS_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OUTLINER_TYPE_TEXT_VIEW)) 32 | 33 | typedef struct _OutlinerTextView OutlinerTextView; 34 | typedef struct _OutlinerTextViewClass OutlinerTextViewClass; 35 | 36 | struct _OutlinerTextView { 37 | GtkTextView parent; 38 | }; 39 | 40 | struct _OutlinerTextViewClass { 41 | GtkTextViewClass parent_class; 42 | }; 43 | 44 | #endif /* OUTLINER_TEXT_VIEW_H */ 45 | -------------------------------------------------------------------------------- /outliner/src/outliner-window.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-window.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_WINDOW_H 25 | #define OUTLINER_WINDOW_H 26 | 27 | #include "outliner-view.h" 28 | 29 | #include 30 | 31 | #define OUTLINER_TYPE_WINDOW (outliner_window_get_type ()) 32 | #define OUTLINER_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OUTLINER_TYPE_WINDOW, OutlinerWindow)) 33 | 34 | typedef struct _OutlinerWindow OutlinerWindow; 35 | typedef struct _OutlinerWindowClass OutlinerWindowClass; 36 | 37 | struct _OutlinerWindow { 38 | GtkWindow parent; 39 | }; 40 | 41 | struct _OutlinerWindowClass { 42 | GtkWindowClass parent_class; 43 | }; 44 | 45 | GType outliner_window_get_type (void); 46 | GtkWidget *outliner_window_new (void); 47 | OutlinerView *outliner_window_get_view (OutlinerWindow *window); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /outliner/src/outliner-fprops-dialog.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-fprops-dialog.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_FPROPS_DIALOG_H 25 | #define OUTLINER_FPROPS_DIALOG_H 26 | 27 | #include "outliner-window.h" 28 | #include "outliner-view.h" 29 | #include "outliner-document.h" 30 | 31 | #include 32 | 33 | #define OUTLINER_TYPE_FPROPS_DIALOG (outliner_fprops_dialog_get_type ()) 34 | 35 | typedef struct _OutlinerFPropsDialog OutlinerFPropsDialog; 36 | typedef struct _OutlinerFPropsDialogClass OutlinerFPropsDialogClass; 37 | 38 | struct _OutlinerFPropsDialog { 39 | GtkWindow parent; 40 | }; 41 | 42 | struct _OutlinerFPropsDialogClass { 43 | GtkWindowClass parent_class; 44 | }; 45 | 46 | GType outliner_fprops_dialog_get_type (void); 47 | GtkWidget *outliner_fprops_dialog_new (OutlinerDocument *tmpdoc); 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /CVSROOT/loginfo: -------------------------------------------------------------------------------- 1 | # The "loginfo" file controls where "cvs commit" log information 2 | # is sent. The first entry on a line is a regular expression which must match 3 | # the directory that the change is being made to, relative to the 4 | # $CVSROOT. If a match is found, then the remainder of the line is a filter 5 | # program that should expect log information on its standard input. 6 | # 7 | # If the repository name does not match any of the regular expressions in this 8 | # file, the "DEFAULT" line is used, if it is specified. 9 | # 10 | # If the name ALL appears as a regular expression it is always used 11 | # in addition to the first matching regex or DEFAULT. 12 | # 13 | # You may specify a format string as part of the 14 | # filter. The string is composed of a `%' followed 15 | # by a single format character, or followed by a set of format 16 | # characters surrounded by `{' and `}' as separators. The format 17 | # characters are: 18 | # 19 | # s = file name 20 | # V = old version number (pre-checkin) 21 | # v = new version number (post-checkin) 22 | # t = tag or branch name 23 | # 24 | # For example: 25 | #DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog 26 | # or 27 | #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog 28 | # 29 | #CVSROOT /cvsroot/sitedocs/CVSROOT/cvstools/syncmail %{sVv} noif@users.sourceforge.net 30 | #DEFAULT /cvsroot/sitedocs/CVSROOT/cvstools/syncmail %{sVv} gnomeoutliner-commits@lists.sourceforge.net 31 | #CVSROOT $CVSROOT/CVSROOT/syncmail %{sVv} noif@users.sourceforge.net 32 | #DEFAULT $CVSROOT/CVSROOT/syncmail %{sVv} gnomeoutliner-commits@lists.sourceforge.net 33 | gnome-outliner /cvsroot/sitedocs/CVSROOT/cvstools/syncmail -u %{sVv} nathan@silverorange.com 34 | outliner /cvsroot/sitedocs/CVSROOT/cvstools/syncmail -u %{sVv} gnomeoutliner-commits@lists.sourceforge.net 35 | -------------------------------------------------------------------------------- /outliner/src/outliner-cell-renderer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-cell-renderer.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_CELL_RENDERER_TEXT_H 25 | #define OUTLINER_CELL_RENDERER_TEXT_H 26 | 27 | #include 28 | 29 | #define OUTLINER_TYPE_CELL_RENDERER_TEXT (outliner_cell_renderer_text_get_type()) 30 | #define OUTLINER_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OUTLINER_TYPE_CELL_RENDERER_TEXT, OutlinerCellRendererText)) 31 | #define OUTLINER_IS_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OUTLINER_TYPE_CELL_RENDERER_TEXT)) 32 | 33 | typedef struct _OutlinerCellRendererText OutlinerCellRendererText; 34 | typedef struct _OutlinerCellRendererTextClass OutlinerCellRendererTextClass; 35 | 36 | struct _OutlinerCellRendererText { 37 | GtkCellRendererText parent; 38 | }; 39 | 40 | struct _OutlinerCellRendererTextClass { 41 | GtkCellRendererTextClass parent_class; 42 | }; 43 | 44 | #endif /* OUTLINER_CELL_RENDERER_TEXT_H */ 45 | -------------------------------------------------------------------------------- /outliner/src/outliner-view.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-view.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_VIEW_H 25 | #define OUTLINER_VIEW_H 26 | 27 | #include 28 | #include "outliner-document.h" 29 | 30 | #define OUTLINER_TYPE_VIEW (outliner_view_get_type ()) 31 | #define OUTLINER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OUTLINER_TYPE_VIEW, OutlinerView)) 32 | #define OUTLINER_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OUTLINER_TYPE_VIEW)) 33 | 34 | typedef struct _OutlinerView OutlinerView; 35 | typedef struct _OutlinerViewClass OutlinerViewClass; 36 | 37 | struct _OutlinerView { 38 | GtkTreeView parent; 39 | }; 40 | 41 | struct _OutlinerViewClass { 42 | GtkTreeViewClass parent_class; 43 | }; 44 | 45 | GType outliner_view_get_type (void); 46 | GtkWidget *outliner_view_new (OutlinerDocument *doc); 47 | OutlinerDocument *outliner_view_get_document (OutlinerView *view); 48 | void outliner_view_add_item (OutlinerView *view); 49 | 50 | typedef void (* OutlinerViewForeachFunc) (OutlinerDocument *doc, 51 | GtkTreePath *path, 52 | gpointer data); 53 | 54 | void outliner_view_foreach_selected_subtree (OutlinerView *view, OutlinerViewForeachFunc func, 55 | gboolean backwards, gpointer data); 56 | 57 | void outliner_view_indent (OutlinerView *view, GtkTreePath *path, gpointer data); 58 | 59 | gboolean outliner_view_get_last_selected (OutlinerView *view, GtkTreeIter *item); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /outliner/src/outliner-actions.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-actions.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_ACTIONS_H 25 | #define OUTLINER_ACTIONS_H 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* action callbacks */ 33 | void outliner_action_new (GtkAction *action, OutlinerWindow *window); 34 | void outliner_action_open (GtkAction *action, OutlinerWindow *window); 35 | void outliner_action_open_location (GtkAction *action, OutlinerWindow *window); 36 | void outliner_action_save (GtkAction *action, OutlinerWindow *window); 37 | void outliner_action_save_as (GtkAction *action, OutlinerWindow *window); 38 | void outliner_action_export (GtkAction *action, OutlinerWindow *window); 39 | void outliner_action_properties (GtkAction *action, OutlinerWindow *window); 40 | void outliner_action_quit (GtkAction *action, OutlinerWindow *window); 41 | 42 | void outliner_action_delete_item (GtkAction *action, OutlinerWindow *window); 43 | void outliner_action_select_all (GtkAction *action, OutlinerWindow *window); 44 | 45 | void outliner_action_add_item (GtkAction *action, OutlinerWindow *window); 46 | void outliner_action_indent (GtkAction *action, OutlinerWindow *window); 47 | void outliner_action_unindent (GtkAction *action, OutlinerWindow *window); 48 | void outliner_action_move_down (GtkAction *action, OutlinerWindow *window); 49 | void outliner_action_move_up (GtkAction *action, OutlinerWindow *window); 50 | void outliner_action_expand_all (GtkAction *action, OutlinerWindow *window); 51 | void outliner_action_collapse_all (GtkAction *action, OutlinerWindow *window); 52 | 53 | void outliner_action_about (GtkAction *action, OutlinerWindow *window); 54 | 55 | void outliner_action_dummy (GtkAction *action, OutlinerWindow *window); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /outliner/src/xml-gnomevfs.c: -------------------------------------------------------------------------------- 1 | /** 2 | * xml-gnomevfs.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "xml-gnomevfs.h" 25 | 26 | /* 27 | Here are GnomeVFS wrappers for libXML IO layer 28 | */ 29 | 30 | /* open for reading wrapper */ 31 | GnomeVFSHandle *xml_gnomevfs_openread(gchar *filename) { 32 | g_message("gnomevfs-openread"); 33 | GnomeVFSHandle *handle; 34 | if (gnome_vfs_open(&handle, filename, GNOME_VFS_OPEN_READ) == GNOME_VFS_OK) 35 | return handle; 36 | else 37 | return NULL; 38 | }; 39 | 40 | /* read wrapper */ 41 | gint xml_gnomevfs_read(GnomeVFSHandle *handle, gchar *buf, gint len) { 42 | g_message("gnomevfs-read"); 43 | GnomeVFSFileSize bread; 44 | if (gnome_vfs_read(handle, buf, len, &bread) == GNOME_VFS_OK) 45 | return (int)bread; 46 | else 47 | return -1; 48 | }; 49 | 50 | /* close wrapper */ 51 | gint xml_gnomevfs_close(GnomeVFSHandle *handle) { 52 | g_message("gnomevfs-close"); 53 | if (gnome_vfs_close(handle) == GNOME_VFS_OK) 54 | return 0; 55 | else 56 | return -1; 57 | }; 58 | 59 | /* write wrapper */ 60 | gint xml_gnomevfs_write(GnomeVFSHandle *handle, const gchar *buf, gint len) { 61 | g_message("gnomevfs-write"); 62 | GnomeVFSFileSize written; 63 | if (gnome_vfs_write(handle, buf, len, &written) == GNOME_VFS_OK) 64 | return (gint)written; 65 | else 66 | return -1; 67 | } 68 | 69 | /* This function creates an output buffer for LibXML */ 70 | xmlOutputBufferPtr xml_gnomevfs_create_ouputbuffer(GnomeVFSHandle *handle) { 71 | xmlOutputBufferPtr ret; 72 | 73 | xmlRegisterDefaultOutputCallbacks(); 74 | 75 | if (handle == NULL) return NULL; 76 | if ((ret = xmlAllocOutputBuffer(xmlGetCharEncodingHandler(XML_CHAR_ENCODING_UTF8))) != NULL) { 77 | ret->context = handle; 78 | ret->writecallback = (xmlOutputWriteCallback)xml_gnomevfs_write; 79 | ret->closecallback = (xmlOutputCloseCallback)xml_gnomevfs_close; 80 | g_message("GNOMEVFS output buffer ready"); 81 | } 82 | 83 | return ret; 84 | } 85 | -------------------------------------------------------------------------------- /outliner/src/outliner-text-view.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-text-view.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-text-view.h" 25 | 26 | #include 27 | 28 | #include 29 | 30 | #include 31 | 32 | static void outliner_text_view_init (OutlinerTextView *view); 33 | static void outliner_text_view_class_init (OutlinerTextViewClass *class); 34 | 35 | static void outliner_text_view_cell_editable_iface_init (GtkCellEditableIface *iface); 36 | static void outliner_text_view_start_editing (GtkCellEditable *editable, 37 | GdkEvent *event); 38 | 39 | static gboolean 40 | outliner_text_view_editable_key_press (GtkWidget *widget, GdkEventKey *event) 41 | { 42 | guint modifiers; 43 | modifiers = gtk_accelerator_get_default_mod_mask(); 44 | 45 | switch (event->keyval) 46 | { 47 | case GDK_Return: 48 | { 49 | if ((event->state & modifiers) == 0) { 50 | gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget)); 51 | gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (widget)); 52 | return TRUE; 53 | } 54 | break; 55 | } 56 | case GDK_Escape: 57 | { 58 | gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget)); 59 | gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (widget)); 60 | return TRUE; 61 | break; 62 | } 63 | } 64 | return FALSE; 65 | } 66 | 67 | static void 68 | outliner_text_view_editable_focus_out (GtkWidget *widget, GdkEventFocus *event) 69 | { 70 | gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget)); 71 | gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (widget)); 72 | } 73 | 74 | static void 75 | outliner_text_view_start_editing (GtkCellEditable *editable, GdkEvent *event) 76 | { 77 | g_signal_connect (editable, "key-press-event", 78 | G_CALLBACK (outliner_text_view_editable_key_press), NULL); 79 | g_signal_connect (editable, "focus-out-event", 80 | G_CALLBACK (outliner_text_view_editable_focus_out), NULL); 81 | } 82 | 83 | static void 84 | outliner_text_view_init (OutlinerTextView *view) 85 | { 86 | /* dummy */ 87 | } 88 | 89 | static void 90 | outliner_text_view_class_init (OutlinerTextViewClass *class) 91 | { 92 | /* dummy */ 93 | } 94 | 95 | static void 96 | outliner_text_view_cell_editable_iface_init (GtkCellEditableIface *iface) 97 | { 98 | iface->start_editing = outliner_text_view_start_editing; 99 | } 100 | 101 | G_DEFINE_TYPE_WITH_CODE (OutlinerTextView, outliner_text_view, GTK_TYPE_TEXT_VIEW, 102 | G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE, 103 | outliner_text_view_cell_editable_iface_init)); 104 | -------------------------------------------------------------------------------- /outliner/src/outliner-main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-main.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-window.h" 25 | #include "outliner-opml.h" 26 | #include "outliner-view.h" 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include 30 | #endif 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | void parse_command_line(int argc, char *argv[]); 39 | void parse_command_line_file_arg(OutlinerWindow* window, int argc, char *argv[]); 40 | 41 | static char* short_options=""; 42 | 43 | static struct option long_options[] = 44 | { 45 | {0, 0, 0, 0} 46 | }; 47 | 48 | 49 | int 50 | main (int argc, char *argv[]) 51 | { 52 | GtkWidget *win; 53 | 54 | gtk_init (&argc, &argv); 55 | 56 | gnome_program_init(PACKAGE_NAME, PACKAGE_VERSION, 57 | LIBGNOMEUI_MODULE, argc, argv, NULL); 58 | 59 | parse_command_line(argc, argv); 60 | 61 | win = outliner_window_new (); 62 | gtk_window_present (GTK_WINDOW (win)); 63 | g_signal_connect (win, "destroy",gtk_main_quit, NULL); 64 | 65 | parse_command_line_file_arg((OutlinerWindow*) win, argc, argv); 66 | 67 | gtk_main (); 68 | 69 | 70 | } 71 | 72 | void parse_command_line(int argc, char *argv[]) 73 | { 74 | int c, option_index; 75 | 76 | while (-1 != (c = getopt_long (argc, argv, short_options, long_options, &option_index))) { 77 | switch (c) { 78 | case '?': 79 | if (isprint (optopt)) 80 | g_fprintf (stderr, "Unknown option `-%c'.\n", optopt); 81 | else 82 | g_fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); 83 | exit(1); 84 | 85 | default: 86 | g_assert_not_reached(); 87 | } 88 | } 89 | } 90 | 91 | void parse_command_line_file_arg(OutlinerWindow *window, int argc, char *argv[]) 92 | { 93 | if (optind < argc) { 94 | int i; 95 | OutlinerView* view = outliner_window_get_view(window); 96 | OutlinerDocument* doc = outliner_view_get_document(view); 97 | gchar *filename = gnome_vfs_make_uri_from_shell_arg((const gchar*) argv[optind]); 98 | 99 | outliner_opml_load_file(doc, filename); 100 | g_free(filename); 101 | 102 | for (i=optind+1; i < argc; i++) { 103 | GError *err = NULL; 104 | gchar *command= ""; 105 | int j ; 106 | 107 | for (j=0; j < optind; j++) 108 | command = g_strjoin(" ", command, argv[j]); 109 | 110 | command = g_strjoin(" ", command, argv[i]); 111 | 112 | if (g_spawn_command_line_async (command, &err) == FALSE) { 113 | g_fprintf (stderr, "Error spawning %s: %s", command, err->message); 114 | exit(1); 115 | } 116 | 117 | g_free(command); 118 | } 119 | } 120 | } 121 | 122 | -------------------------------------------------------------------------------- /outliner/src/outliner-document.h: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-document.h 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OUTLINER_DOCUMENT_H 25 | #define OUTLINER_DOCUMENT_H 26 | 27 | #include 28 | 29 | #define OUTLINER_TYPE_DOCUMENT (outliner_document_get_type ()) 30 | #define OUTLINER_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OUTLINER_TYPE_DOCUMENT, OutlinerDocument)) 31 | #define OUTLINER_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OUTLINER_TYPE_DOCUMENT)) 32 | 33 | typedef struct _OutlinerDocument OutlinerDocument; 34 | typedef struct _OutlinerDocumentClass OutlinerDocumentClass; 35 | 36 | struct _OutlinerDocument { 37 | GtkTreeStore parent; 38 | }; 39 | 40 | struct _OutlinerDocumentClass { 41 | GtkTreeStoreClass parent_class; 42 | 43 | void (*row_moved) (OutlinerDocument *doc, GtkTreePath *oldpath, GtkTreePath *newpath); 44 | }; 45 | 46 | enum { 47 | COL_TEXT = 0, 48 | COL_STATUS, 49 | COL_OTHER, 50 | NUM_COLS 51 | }; 52 | 53 | 54 | GType outliner_document_get_type (void); 55 | OutlinerDocument *outliner_document_new (void); 56 | 57 | void outliner_document_indent (OutlinerDocument *doc, GtkTreePath *path, gpointer data); 58 | void outliner_document_unindent (OutlinerDocument *doc, GtkTreePath *path, gpointer data); 59 | void outliner_document_move_down (OutlinerDocument *doc, GtkTreePath *path, gpointer data); 60 | void outliner_document_move_up (OutlinerDocument *doc, GtkTreePath *path, gpointer data); 61 | void outliner_document_delete_item (OutlinerDocument *doc, GtkTreePath *path, gpointer data); 62 | 63 | /*Accesor methods for document's attributes */ 64 | const GString* outliner_document_get_title (OutlinerDocument *doc); 65 | const GString* outliner_document_get_author (OutlinerDocument *doc); 66 | const GString* outliner_document_get_email (OutlinerDocument *doc); 67 | const GString* outliner_document_get_uri (OutlinerDocument *doc); 68 | gboolean outliner_document_get_changed (OutlinerDocument *doc); 69 | gint outliner_document_get_w_top (OutlinerDocument *doc); 70 | gint outliner_document_get_w_left (OutlinerDocument *doc); 71 | gint outliner_document_get_w_right (OutlinerDocument *doc); 72 | gint outliner_document_get_w_bottom (OutlinerDocument *doc); 73 | const GArray* outliner_document_get_expanded (OutlinerDocument *doc); 74 | const GSList* outliner_document_get_column_names (OutlinerDocument *doc); 75 | 76 | /*Modifier methods for document's attributes */ 77 | void outliner_document_set_title (OutlinerDocument *doc, gchar *title); 78 | void outliner_document_set_author (OutlinerDocument *doc, gchar *author); 79 | void outliner_document_set_email (OutlinerDocument *doc, gchar *email); 80 | void outliner_document_set_uri (OutlinerDocument *doc, gchar *uri); 81 | void outliner_document_set_changed (OutlinerDocument *doc, gboolean changed); 82 | void outliner_document_set_w_top (OutlinerDocument *doc, gint w_top); 83 | void outliner_document_set_w_left (OutlinerDocument *doc, gint w_left); 84 | void outliner_document_set_w_right (OutlinerDocument *doc, gint w_right); 85 | void outliner_document_set_w_bottom (OutlinerDocument *doc, gint w_bottom); 86 | void outliner_document_set_expanded (OutlinerDocument *doc, GArray *expanded); 87 | void outliner_document_set_column_names (OutlinerDocument *doc, GSList *column_names); 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /outliner/src/outliner-cell-renderer.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-cell-renderer.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-cell-renderer.h" 25 | #include "outliner-text-view.h" 26 | 27 | #include 28 | 29 | #include 30 | 31 | static void outliner_cell_renderer_text_init (OutlinerCellRendererText *renderer); 32 | static void outliner_cell_renderer_text_class_init (OutlinerCellRendererTextClass *class); 33 | 34 | static void 35 | outliner_cell_renderer_text_size_request (GtkCellEditable *editable, GtkRequisition *req, gpointer data) 36 | { 37 | g_message("got size request: %d %d\n", req->width, req->height); 38 | } 39 | 40 | static void 41 | outliner_cell_renderer_text_size_allocate (GtkCellEditable *editable, GtkAllocation *alloc, gpointer data) 42 | { 43 | g_message("got size allocate: %d %d\n", alloc->width, alloc->height); 44 | } 45 | 46 | static void 47 | outliner_cell_renderer_text_editing_done (GtkCellEditable *editable, gpointer data) 48 | { 49 | const gchar *path, *new_text; 50 | GtkTextBuffer *buffer; 51 | GtkTextIter start, end; 52 | 53 | path = g_object_get_data (G_OBJECT (editable), "gtk-cell-renderer-text-path"); 54 | 55 | buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (editable)); 56 | gtk_text_buffer_get_bounds (buffer, &start, &end); 57 | 58 | new_text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE); 59 | 60 | g_signal_emit_by_name (data, "edited", path, new_text, 0); 61 | } 62 | 63 | static GtkCellEditable * 64 | outliner_cell_renderer_text_start_editing (GtkCellRenderer *cell, 65 | GdkEvent *event, 66 | GtkWidget *widget, 67 | const gchar *path, 68 | GdkRectangle *background_area, 69 | GdkRectangle *cell_area, 70 | GtkCellRendererState flags) 71 | { 72 | GtkCellRendererText *celltext; 73 | GtkWidget *textview; 74 | GtkTextBuffer *textbuffer; 75 | GtkTextIter textiter; 76 | 77 | celltext = GTK_CELL_RENDERER_TEXT (cell); 78 | 79 | /* If the cell isn't editable we return NULL. */ 80 | if (celltext->editable == FALSE) 81 | return NULL; 82 | 83 | textview = g_object_new (OUTLINER_TYPE_TEXT_VIEW, 84 | "height-request", cell_area->height); 85 | 86 | if (celltext->text) { 87 | textbuffer = gtk_text_buffer_new (NULL); 88 | gtk_text_buffer_get_start_iter (textbuffer, &textiter); 89 | gtk_text_buffer_insert (textbuffer, &textiter, celltext->text, -1); 90 | 91 | gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), textbuffer); 92 | } 93 | 94 | g_object_set_data_full (G_OBJECT (textview), "gtk-cell-renderer-text-path", g_strdup (path), g_free); 95 | 96 | //g_signal_emit_by_name (textview, "select-all", TRUE, NULL); 97 | 98 | gtk_widget_show (textview); 99 | g_signal_connect (textview, "editing-done", 100 | G_CALLBACK (outliner_cell_renderer_text_editing_done), 101 | celltext); 102 | g_signal_connect (textview, "size-request", 103 | G_CALLBACK (outliner_cell_renderer_text_size_request), 104 | celltext); 105 | g_signal_connect (textview, "size-allocate", 106 | G_CALLBACK (outliner_cell_renderer_text_size_allocate), 107 | celltext); 108 | 109 | return GTK_CELL_EDITABLE (textview); 110 | } 111 | 112 | static void 113 | outliner_cell_renderer_text_init (OutlinerCellRendererText *renderer) 114 | { 115 | /* dummy */ 116 | } 117 | 118 | static void 119 | outliner_cell_renderer_text_class_init (OutlinerCellRendererTextClass *class) 120 | { 121 | GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class); 122 | 123 | cell_class->start_editing = outliner_cell_renderer_text_start_editing; 124 | } 125 | 126 | G_DEFINE_TYPE (OutlinerCellRendererText, outliner_cell_renderer_text, GTK_TYPE_CELL_RENDERER_TEXT); 127 | -------------------------------------------------------------------------------- /outliner/src/outliner-file.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-file.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-file.h" 25 | #include "outliner-opml.h" 26 | #include "outliner-document.h" 27 | #include "outliner-window.h" 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | void 34 | outliner_file_save_as(OutlinerWindow *window, OutlinerDocument *doc) 35 | { 36 | GtkWidget *dialog, *overwrite; 37 | gboolean done = FALSE; 38 | 39 | dialog = gtk_file_chooser_dialog_new(_("Save file"), GTK_WINDOW (window), 40 | GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 41 | GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); 42 | 43 | gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); 44 | 45 | /* TODO: HIGify */ 46 | overwrite = gtk_message_dialog_new(GTK_WINDOW(dialog), GTK_DIALOG_DESTROY_WITH_PARENT, 47 | GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("File already exists, overwrite?")); 48 | gtk_widget_hide(overwrite); 49 | gtk_dialog_set_default_response(GTK_DIALOG (dialog), GTK_RESPONSE_NO); 50 | 51 | while (!done) { 52 | if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_CANCEL) 53 | done = TRUE; 54 | else { 55 | if (gnome_vfs_uri_exists(gnome_vfs_uri_new(gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog))))) { 56 | if (gtk_dialog_run(GTK_DIALOG(overwrite)) == GTK_RESPONSE_YES) { 57 | outliner_opml_save_file(window, doc, gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog))); 58 | done = TRUE; 59 | } 60 | gtk_widget_hide(overwrite); 61 | } else { 62 | outliner_opml_save_file(window, doc, gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog))); 63 | done = TRUE; 64 | } 65 | } 66 | } 67 | gtk_widget_destroy(overwrite); 68 | gtk_widget_destroy(dialog); 69 | } 70 | 71 | void 72 | outliner_file_save(OutlinerWindow *window, OutlinerDocument *doc) 73 | { 74 | const GString* uri = outliner_document_get_uri(doc); 75 | if (uri->len != 0) 76 | outliner_opml_save_file(window, doc, uri->str); 77 | else 78 | outliner_file_save_as(window, doc); 79 | } 80 | 81 | gint 82 | outliner_file_save_changed(OutlinerWindow *window, OutlinerDocument *doc) 83 | { 84 | GtkWidget *save_file_dialog; 85 | gint response; 86 | 87 | if (outliner_document_get_changed(doc) == TRUE) 88 | { 89 | 90 | save_file_dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(window), 91 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 92 | GTK_MESSAGE_WARNING, 93 | GTK_BUTTONS_NONE, 94 | _("Save changes to document \"%s\" before closing it?\n\nIf you close without saving, the changes will be discarded"), outliner_document_get_title(doc)->str); 95 | gtk_dialog_add_buttons(GTK_DIALOG(save_file_dialog), 96 | _("Close without Saving"), GTK_RESPONSE_NO, 97 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 98 | GTK_STOCK_SAVE, GTK_RESPONSE_YES, 99 | NULL); 100 | gtk_dialog_set_default_response(GTK_DIALOG (save_file_dialog), GTK_RESPONSE_YES); 101 | gtk_window_set_resizable (GTK_WINDOW(save_file_dialog), FALSE); 102 | 103 | response = gtk_dialog_run(GTK_DIALOG(save_file_dialog)); 104 | if ( response == GTK_RESPONSE_YES) 105 | outliner_file_save(window, doc); 106 | 107 | gtk_widget_destroy(save_file_dialog); 108 | } 109 | else 110 | response = GTK_RESPONSE_OK; 111 | 112 | 113 | return response; 114 | } 115 | 116 | 117 | 118 | void 119 | outliner_file_open(OutlinerWindow *window, OutlinerDocument *doc) 120 | { 121 | GtkWidget *dialog; 122 | GdkScreen *screen; 123 | gint w, h; /* width, height */ 124 | 125 | dialog = gtk_file_chooser_dialog_new(_("Open file"), GTK_WINDOW (window), 126 | GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 127 | GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); 128 | 129 | gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); 130 | 131 | if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { 132 | outliner_opml_load_file(doc, gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog))); 133 | 134 | /* We shouldn't resize a window larger than the screen size */ 135 | screen = gtk_window_get_screen(GTK_WINDOW(window)); 136 | if (outliner_document_get_w_right(doc) > gdk_screen_get_width(screen)) 137 | outliner_document_set_w_right(doc, gdk_screen_get_width(screen) - 10); 138 | if (outliner_document_get_w_bottom(doc) > gdk_screen_get_height(screen)) 139 | outliner_document_set_w_bottom(doc, gdk_screen_get_height(screen) - 10); 140 | 141 | w = outliner_document_get_w_right(doc) - outliner_document_get_w_left(doc); 142 | h = outliner_document_get_w_bottom(doc) - outliner_document_get_w_top(doc); 143 | gtk_window_resize(GTK_WINDOW(window), w, h); 144 | gtk_window_move(GTK_WINDOW(window), outliner_document_get_w_left(doc), outliner_document_get_w_top(doc)); 145 | 146 | } 147 | gtk_widget_destroy(dialog); 148 | } 149 | 150 | -------------------------------------------------------------------------------- /CVSROOT/syncmail: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | # -*- Python -*- 3 | 4 | """Complicated notification for CVS checkins. 5 | 6 | This script is used to provide email notifications of changes to the CVS 7 | repository. These email changes will include context diffs of the changes. 8 | Really big diffs will be trimmed. 9 | 10 | This script is run from a CVS loginfo file (see $CVSROOT/CVSROOT/loginfo). To 11 | set this up, create a loginfo entry that looks something like this: 12 | 13 | mymodule /path/to/this/script %%s some-email-addr@your.domain 14 | 15 | In this example, whenever a checkin that matches `mymodule' is made, this 16 | script is invoked, which will generate the diff containing email, and send it 17 | to some-email-addr@your.domain. 18 | 19 | Note: This module used to also do repository synchronizations via 20 | rsync-over-ssh, but since the repository has been moved to SourceForge, 21 | this is no longer necessary. The syncing functionality has been ripped 22 | out in the 3.0, which simplifies it considerably. Access the 2.x versions 23 | to refer to this functionality. Because of this, the script is misnamed. 24 | 25 | It no longer makes sense to run this script from the command line. Doing so 26 | will only print out this usage information. 27 | 28 | Usage: 29 | 30 | %(PROGRAM)s [options] <%%S> email-addr [email-addr ...] 31 | 32 | Where options is: 33 | 34 | --cvsroot= 35 | Use as the environment variable CVSROOT. Otherwise this 36 | variable must exist in the environment. 37 | 38 | --help 39 | -h 40 | Print this text. 41 | 42 | --context=# 43 | -C # 44 | Include # lines of context around lines that differ (default: 2). 45 | 46 | -c 47 | Produce a context diff (default). 48 | 49 | -u 50 | Produce a unified diff (smaller, but harder to read). 51 | 52 | <%%S> 53 | CVS %%s loginfo expansion. When invoked by CVS, this will be a single 54 | string containing the directory the checkin is being made in, relative 55 | to $CVSROOT, followed by the list of files that are changing. If the 56 | %%s in the loginfo file is %%{sVv}, context diffs for each of the 57 | modified files are included in any email messages that are generated. 58 | 59 | email-addrs 60 | At least one email address. 61 | 62 | """ 63 | 64 | import os 65 | import sys 66 | import string 67 | import time 68 | import getopt 69 | 70 | # Notification command 71 | MAILCMD = '/bin/mail -s "CVS: %(SUBJECT)s" %(PEOPLE)s 2>&1 > /dev/null' 72 | 73 | # Diff trimming stuff 74 | DIFF_HEAD_LINES = 20 75 | DIFF_TAIL_LINES = 20 76 | DIFF_TRUNCATE_IF_LARGER = 1000 77 | 78 | PROGRAM = sys.argv[0] 79 | 80 | 81 | 82 | def usage(code, msg=''): 83 | print __doc__ % globals() 84 | if msg: 85 | print msg 86 | sys.exit(code) 87 | 88 | 89 | 90 | def calculate_diff(filespec, contextlines): 91 | try: 92 | file, oldrev, newrev = string.split(filespec, ',') 93 | except ValueError: 94 | # No diff to report 95 | return '***** Bogus filespec: %s' % filespec 96 | if oldrev == 'NONE': 97 | try: 98 | if os.path.exists(file): 99 | fp = open(file) 100 | else: 101 | update_cmd = 'cvs -fn update -r %s -p %s' % (newrev, file) 102 | fp = os.popen(update_cmd) 103 | lines = fp.readlines() 104 | fp.close() 105 | lines.insert(0, '--- NEW FILE: %s ---\n' % file) 106 | except IOError, e: 107 | lines = ['***** Error reading new file: ', 108 | str(e), '\n***** file: ', file, ' cwd: ', os.getcwd()] 109 | elif newrev == 'NONE': 110 | lines = ['--- %s DELETED ---\n' % file] 111 | else: 112 | # This /has/ to happen in the background, otherwise we'll run into CVS 113 | # lock contention. What a crock. 114 | if contextlines > 0: 115 | difftype = "-C " + str(contextlines) 116 | else: 117 | difftype = "-u" 118 | diffcmd = "/usr/bin/cvs -f diff -kk %s --minimal -p -r %s -r %s '%s'" % ( 119 | difftype, oldrev, newrev, file) 120 | fp = os.popen(diffcmd) 121 | lines = fp.readlines() 122 | sts = fp.close() 123 | # ignore the error code, it always seems to be 1 :( 124 | ## if sts: 125 | ## return 'Error code %d occurred during diff\n' % (sts >> 8) 126 | if len(lines) > DIFF_TRUNCATE_IF_LARGER: 127 | removedlines = len(lines) - DIFF_HEAD_LINES - DIFF_TAIL_LINES 128 | del lines[DIFF_HEAD_LINES:-DIFF_TAIL_LINES] 129 | lines.insert(DIFF_HEAD_LINES, 130 | '[...%d lines suppressed...]\n' % removedlines) 131 | return string.join(lines, '') 132 | 133 | 134 | 135 | def blast_mail(mailcmd, filestodiff, contextlines): 136 | # cannot wait for child process or that will cause parent to retain cvs 137 | # lock for too long. Urg! 138 | if not os.fork(): 139 | # in the child 140 | # give up the lock you cvs thang! 141 | time.sleep(2) 142 | fp = os.popen(mailcmd, 'w') 143 | fp.write(sys.stdin.read()) 144 | fp.write('\n') 145 | # append the diffs if available 146 | for file in filestodiff: 147 | fp.write(calculate_diff(file, contextlines)) 148 | fp.write('\n') 149 | fp.close() 150 | # doesn't matter what code we return, it isn't waited on 151 | os._exit(0) 152 | 153 | 154 | 155 | # scan args for options 156 | def main(): 157 | contextlines = 0 158 | try: 159 | opts, args = getopt.getopt(sys.argv[1:], 'hC:cu', 160 | ['context=', 'cvsroot=', 'help']) 161 | except getopt.error, msg: 162 | usage(1, msg) 163 | 164 | # parse the options 165 | for opt, arg in opts: 166 | if opt in ('-h', '--help'): 167 | usage(0) 168 | elif opt == '--cvsroot': 169 | os.environ['CVSROOT'] = arg 170 | elif opt in ('-C', '--context'): 171 | contextlines = int(arg) 172 | elif opt == '-c': 173 | if contextlines <= 0: 174 | contextlines = 2 175 | elif opt == '-u': 176 | contextlines = 0 177 | 178 | # What follows is the specification containing the files that were 179 | # modified. The argument actually must be split, with the first component 180 | # containing the directory the checkin is being made in, relative to 181 | # $CVSROOT, followed by the list of files that are changing. 182 | if not args: 183 | usage(1, 'No CVS module specified') 184 | SUBJECT = args[0] 185 | specs = string.split(args[0]) 186 | del args[0] 187 | 188 | # The remaining args should be the email addresses 189 | if not args: 190 | usage(1, 'No recipients specified') 191 | 192 | # Now do the mail command 193 | PEOPLE = string.join(args) 194 | mailcmd = MAILCMD % vars() 195 | 196 | print 'Mailing %s...' % PEOPLE 197 | if specs == ['-', 'Imported', 'sources']: 198 | return 199 | if specs[-3:] == ['-', 'New', 'directory']: 200 | del specs[-3:] 201 | elif len(specs) > 2: 202 | L = specs[:2] 203 | for s in specs[2:]: 204 | prev = L[-1] 205 | if string.count(prev, ",") < 2: 206 | L[-1] = "%s %s" % (prev, s) 207 | else: 208 | L.append(s) 209 | specs = L 210 | print 'Generating notification message...' 211 | blast_mail(mailcmd, specs[1:], contextlines) 212 | print 'Generating notification message... done.' 213 | 214 | 215 | 216 | if __name__ == '__main__': 217 | main() 218 | sys.exit(0) 219 | -------------------------------------------------------------------------------- /outliner/src/outliner-fprops-dialog.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-fprops-dialog.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-fprops-dialog.h" 25 | #include "outliner-document.h" 26 | 27 | #include 28 | #include 29 | 30 | #define OUTLINER_FPROPS_DIALOG_GET_PRIVATE(obj) \ 31 | (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OUTLINER_TYPE_FPROPS_DIALOG, OutlinerFPropsDialogPrivate)) 32 | 33 | typedef struct _OutlinerFPropsDialogPrivate OutlinerFPropsDialogPrivate; 34 | struct _OutlinerFPropsDialogPrivate { 35 | GtkWidget *window; 36 | 37 | GtkWidget *title_label; 38 | GtkWidget *file_label; 39 | GtkWidget *created_label; 40 | GtkWidget *modified_label; 41 | GtkWidget *author_label; 42 | GtkWidget *email_label; 43 | 44 | GtkWidget *title_entry; 45 | GtkWidget *file_label2; 46 | GtkWidget *created_label2; 47 | GtkWidget *modified_label2; 48 | GtkWidget *author_entry; 49 | GtkWidget *email_entry; 50 | }; 51 | 52 | static GtkWindowClass *parent_class = NULL; 53 | static OutlinerDocument *doc = NULL; 54 | 55 | static void outliner_fprops_dialog_init (OutlinerFPropsDialog *dialog); 56 | static void outliner_fprops_dialog_set (OutlinerFPropsDialog *dialog); 57 | static void outliner_fprops_dialog_get (OutlinerFPropsDialog *dialog); 58 | static void outliner_fprops_dialog_finalize (GObject *object); 59 | 60 | 61 | static void 62 | outliner_fprops_dialog_init (OutlinerFPropsDialog *dialog) 63 | { 64 | GtkWidget *table; 65 | 66 | OutlinerFPropsDialogPrivate *priv = OUTLINER_FPROPS_DIALOG_GET_PRIVATE (dialog); 67 | 68 | if (priv->window) 69 | { 70 | gtk_window_present (GTK_WINDOW(priv->window)); 71 | return; 72 | } 73 | 74 | 75 | priv->window = gtk_dialog_new_with_buttons ("File Properties", 76 | GTK_WINDOW(dialog), GTK_DIALOG_DESTROY_WITH_PARENT, 77 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); 78 | 79 | g_signal_connect_swapped (priv->window, "response", 80 | G_CALLBACK (outliner_fprops_dialog_get), dialog); 81 | 82 | table = gtk_table_new (8, 2, FALSE); 83 | gtk_table_set_row_spacings (GTK_TABLE(table), 5); 84 | gtk_table_set_col_spacings (GTK_TABLE(table), 10); 85 | 86 | gtk_box_pack_end (GTK_BOX(GTK_DIALOG(priv->window)->vbox), 87 | table, TRUE, TRUE, 0); 88 | 89 | priv->title_label = gtk_label_new ("Title:"); 90 | gtk_misc_set_alignment (GTK_MISC(priv->title_label), 0, 0.5); 91 | gtk_table_attach (GTK_TABLE(table), priv->title_label, 0, 1, 0, 1, GTK_FILL, GTK_EXPAND, 0, 0); 92 | 93 | 94 | priv->file_label = gtk_label_new ("File:"); 95 | gtk_misc_set_alignment (GTK_MISC(priv->file_label), 0, 0.5); 96 | gtk_table_attach (GTK_TABLE(table), priv->file_label, 0, 1, 1, 2, GTK_FILL, GTK_EXPAND, 0, 0); 97 | 98 | priv->created_label = gtk_label_new ("Created:"); 99 | gtk_misc_set_alignment (GTK_MISC(priv->created_label), 0, 0.5); 100 | gtk_table_attach (GTK_TABLE(table), priv->created_label, 0, 1, 3, 4, GTK_FILL, GTK_EXPAND, 0, 0); 101 | 102 | 103 | priv->modified_label = gtk_label_new ("Modified:"); 104 | gtk_misc_set_alignment (GTK_MISC(priv->modified_label), 0, 0.5); 105 | gtk_table_attach (GTK_TABLE(table), priv->modified_label, 0, 1, 4, 5, GTK_FILL, GTK_EXPAND, 0, 0); 106 | 107 | priv->author_label = gtk_label_new ("Author:"); 108 | gtk_misc_set_alignment (GTK_MISC(priv->author_label), 0, 0.5); 109 | gtk_table_attach (GTK_TABLE(table), priv->author_label, 0, 1, 6, 7, GTK_FILL, GTK_EXPAND, 0, 0); 110 | 111 | priv->email_label = gtk_label_new ("Author Email:"); 112 | gtk_misc_set_alignment (GTK_MISC(priv->email_label), 0, 0.5); 113 | gtk_table_attach (GTK_TABLE(table), priv->email_label, 0, 1, 7, 8, GTK_FILL, GTK_EXPAND, 0, 0); 114 | 115 | priv->title_entry = gtk_entry_new (); 116 | gtk_entry_set_text(GTK_ENTRY(priv->title_entry), outliner_document_get_title(doc)->str); 117 | gtk_table_attach (GTK_TABLE(table), priv->title_entry, 1, 2, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 0); 118 | 119 | priv->file_label2 = gtk_label_new (NULL); 120 | gtk_label_set_text(GTK_LABEL(priv->file_label2), outliner_document_get_uri(doc)->str); 121 | gtk_label_set_selectable(GTK_LABEL(priv->file_label2), TRUE); 122 | gtk_table_attach (GTK_TABLE(table), priv->file_label2, 1, 2, 1, 2, GTK_EXPAND, GTK_EXPAND, 0, 0); 123 | 124 | priv->created_label2 = gtk_label_new (NULL); 125 | gtk_label_set_selectable(GTK_LABEL(priv->created_label2), TRUE); 126 | gtk_table_attach (GTK_TABLE(table), priv->created_label2, 1, 2, 3, 4, GTK_EXPAND, GTK_EXPAND, 0, 0); 127 | 128 | priv->modified_label2 = gtk_label_new (NULL); 129 | gtk_label_set_selectable(GTK_LABEL(priv->modified_label2), TRUE); 130 | gtk_table_attach (GTK_TABLE(table), priv->modified_label2, 1, 2, 4, 5, GTK_EXPAND, GTK_EXPAND, 0, 0); 131 | 132 | priv->author_entry = gtk_entry_new (); 133 | gtk_entry_set_text(GTK_ENTRY(priv->author_entry), outliner_document_get_author(doc)->str); 134 | gtk_table_attach (GTK_TABLE(table), priv->author_entry, 1, 2, 6, 7, GTK_EXPAND, GTK_EXPAND, 0, 0); 135 | 136 | priv->email_entry = gtk_entry_new (); 137 | gtk_entry_set_text(GTK_ENTRY(priv->email_entry), outliner_document_get_email(doc)->str); 138 | gtk_table_attach (GTK_TABLE(table), priv->email_entry, 1, 2, 7, 8, GTK_EXPAND, GTK_EXPAND, 0, 0); 139 | 140 | gtk_widget_show_all (priv->window); 141 | } 142 | 143 | 144 | static void 145 | outliner_fprops_dialog_class_init (OutlinerFPropsDialogClass *class) 146 | { 147 | GObjectClass *object_class = G_OBJECT_CLASS (class); 148 | parent_class = g_type_class_peek_parent (class); 149 | 150 | object_class->finalize = outliner_fprops_dialog_finalize; 151 | 152 | g_type_class_add_private (class, sizeof (OutlinerFPropsDialogPrivate)); 153 | } 154 | 155 | 156 | GtkWidget * 157 | outliner_fprops_dialog_new (OutlinerDocument *tmpdoc) 158 | { 159 | doc = tmpdoc; 160 | GtkWidget *dialog = g_object_new (OUTLINER_TYPE_FPROPS_DIALOG, NULL); 161 | 162 | return dialog; 163 | } 164 | 165 | 166 | static void 167 | outliner_fprops_dialog_get (OutlinerFPropsDialog *dialog) 168 | { 169 | OutlinerFPropsDialogPrivate *priv = OUTLINER_FPROPS_DIALOG_GET_PRIVATE (dialog); 170 | 171 | outliner_document_set_title(doc, gtk_entry_get_text(GTK_ENTRY(priv->title_entry))); 172 | outliner_document_set_author(doc, gtk_entry_get_text(GTK_ENTRY(priv->author_entry))); 173 | outliner_document_set_email(doc, gtk_entry_get_text(GTK_ENTRY(priv->email_entry))); 174 | 175 | gtk_widget_destroy(GTK_WIDGET(dialog)); 176 | } 177 | 178 | static void 179 | outliner_fprops_dialog_finalize (GObject *object) 180 | { 181 | OutlinerFPropsDialogPrivate *priv = OUTLINER_FPROPS_DIALOG_GET_PRIVATE (object); 182 | 183 | G_OBJECT_CLASS (parent_class)->finalize (object); 184 | } 185 | 186 | 187 | G_DEFINE_TYPE (OutlinerFPropsDialog, outliner_fprops_dialog, GTK_TYPE_WINDOW); 188 | -------------------------------------------------------------------------------- /outliner/src/outliner-actions.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-actions.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-window.h" 25 | #include "outliner-fprops-dialog.h" 26 | #include "outliner-view.h" 27 | #include "outliner-document.h" 28 | #include "outliner-file.h" 29 | 30 | #ifdef HAVE_CONFIG_H 31 | #include 32 | #endif 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | void 39 | outliner_action_dummy (GtkAction *action, 40 | OutlinerWindow *window) 41 | { 42 | const gchar *name = gtk_action_get_name(action); 43 | g_message(name); 44 | } 45 | 46 | 47 | /* file actions */ 48 | void 49 | outliner_action_new (GtkAction *action, OutlinerWindow *window) 50 | { 51 | OutlinerView *view; 52 | OutlinerDocument *doc; 53 | 54 | view = outliner_window_get_view(window); 55 | doc = outliner_view_get_document(view); 56 | 57 | if (outliner_file_save_changed(window, doc) != GTK_RESPONSE_CANCEL) 58 | { 59 | gtk_tree_store_clear(GTK_TREE_STORE (doc)); 60 | outliner_view_add_item(view); 61 | } 62 | } 63 | 64 | void 65 | outliner_action_open (GtkAction *action, OutlinerWindow *window) 66 | { 67 | OutlinerView *view; 68 | OutlinerDocument *doc; 69 | 70 | view = outliner_window_get_view(window); 71 | doc = outliner_view_get_document(view); 72 | 73 | if (outliner_file_save_changed(window, doc) != GTK_RESPONSE_CANCEL) 74 | { 75 | outliner_file_open(window, doc); 76 | } 77 | } 78 | 79 | void 80 | outliner_action_open_location (GtkAction *action, OutlinerWindow *window) 81 | { 82 | OutlinerView *view; 83 | OutlinerDocument *doc; 84 | 85 | view = outliner_window_get_view(window); 86 | doc = outliner_view_get_document(view); 87 | 88 | if (outliner_file_save_changed(window, doc) != GTK_RESPONSE_CANCEL) 89 | { 90 | ;/* TODO: open doc from location */ 91 | } 92 | } 93 | 94 | void 95 | outliner_action_save (GtkAction *action, OutlinerWindow *window) 96 | { 97 | OutlinerView *view; 98 | OutlinerDocument *doc; 99 | 100 | view = outliner_window_get_view(window); 101 | doc = outliner_view_get_document(view); 102 | 103 | outliner_file_save(window, doc); 104 | } 105 | 106 | void 107 | outliner_action_save_as (GtkAction *action, OutlinerWindow *window) 108 | { 109 | OutlinerView *view; 110 | OutlinerDocument *doc; 111 | 112 | view = outliner_window_get_view(window); 113 | doc = outliner_view_get_document(view); 114 | 115 | outliner_file_save_as(window, doc); 116 | } 117 | 118 | void 119 | outliner_action_export (GtkAction *action, OutlinerWindow *window) 120 | { 121 | OutlinerView *view; 122 | OutlinerDocument *doc; 123 | 124 | view = outliner_window_get_view(window); 125 | doc = outliner_view_get_document(view); 126 | 127 | /* TODO: export the doc */ 128 | } 129 | 130 | void 131 | outliner_action_properties (GtkAction *action, OutlinerWindow *window) 132 | { 133 | OutlinerView *view; 134 | OutlinerDocument *doc; 135 | GtkWidget *dialog; 136 | 137 | view = outliner_window_get_view(window); 138 | doc = outliner_view_get_document(view); 139 | 140 | outliner_fprops_dialog_new(doc); 141 | } 142 | 143 | void 144 | outliner_action_quit (GtkAction *action, OutlinerWindow *window) 145 | { 146 | OutlinerView *view; 147 | OutlinerDocument *doc; 148 | 149 | view = outliner_window_get_view(window); 150 | doc = outliner_view_get_document(view); 151 | 152 | if (outliner_file_save_changed(window, doc) != GTK_RESPONSE_CANCEL) 153 | { 154 | gtk_main_quit(); 155 | } 156 | } 157 | 158 | 159 | /* outline actions */ 160 | void 161 | outliner_action_add_item (GtkAction *action, OutlinerWindow *window) 162 | { 163 | OutlinerView *view; 164 | view = outliner_window_get_view(window); 165 | outliner_view_add_item(view); 166 | } 167 | 168 | void 169 | outliner_action_indent (GtkAction *action, OutlinerWindow *window) 170 | { 171 | OutlinerView *view; 172 | view = outliner_window_get_view(window); 173 | outliner_view_foreach_selected_subtree(view, outliner_document_indent, FALSE, NULL); 174 | } 175 | 176 | void 177 | outliner_action_unindent (GtkAction *action, OutlinerWindow *window) 178 | { 179 | OutlinerView *view; 180 | view = outliner_window_get_view(window); 181 | outliner_view_foreach_selected_subtree(view, outliner_document_unindent, TRUE, NULL); 182 | } 183 | 184 | void 185 | outliner_action_move_up (GtkAction *action, OutlinerWindow *window) 186 | { 187 | OutlinerView *view; 188 | view = outliner_window_get_view(window); 189 | outliner_view_foreach_selected_subtree(view, outliner_document_move_up, FALSE, NULL); 190 | } 191 | 192 | void 193 | outliner_action_move_down (GtkAction *action, OutlinerWindow *window) 194 | { 195 | OutlinerView *view; 196 | view = outliner_window_get_view(window); 197 | outliner_view_foreach_selected_subtree(view, outliner_document_move_down, TRUE, NULL); 198 | } 199 | 200 | void 201 | outliner_action_expand_all (GtkAction *action, OutlinerWindow *window) 202 | { 203 | OutlinerView *view; 204 | view = outliner_window_get_view(window); 205 | gtk_tree_view_expand_all(GTK_TREE_VIEW (view)); 206 | } 207 | 208 | void 209 | outliner_action_collapse_all (GtkAction *action, OutlinerWindow *window) 210 | { 211 | OutlinerView *view; 212 | view = outliner_window_get_view(window); 213 | gtk_tree_view_collapse_all(GTK_TREE_VIEW (view)); 214 | } 215 | 216 | void 217 | outliner_action_delete_item (GtkAction *action, OutlinerWindow *window) 218 | { 219 | OutlinerView *view; 220 | view = outliner_window_get_view(window); 221 | outliner_view_foreach_selected_subtree(view, outliner_document_delete_item, TRUE, NULL); 222 | } 223 | 224 | void 225 | outliner_action_select_all (GtkAction *action, OutlinerWindow *window) 226 | { 227 | OutlinerView *view; 228 | view = outliner_window_get_view(window); 229 | gtk_tree_selection_select_all(gtk_tree_view_get_selection(GTK_TREE_VIEW (view))); 230 | } 231 | 232 | 233 | /* help actions */ 234 | void 235 | outliner_action_about (GtkAction *action, OutlinerWindow *window) 236 | { 237 | static GtkWidget *about_dialog = NULL; 238 | 239 | const gchar *authors[] = { 240 | "Steven Garrity ", 241 | "Dan Korostelev ", 242 | "Nathan Fredrickson ", 243 | NULL 244 | }; 245 | 246 | const gchar *documenters[] = { 247 | NULL 248 | }; 249 | 250 | if (about_dialog) 251 | { 252 | gtk_window_present (GTK_WINDOW (about_dialog)); 253 | return; 254 | } 255 | 256 | about_dialog = gnome_about_new ("Gnome Outliner", PACKAGE_VERSION, 257 | "Copyright \xc2\xa9 2004", 258 | _("Gnome Outliner is a simple outliner editor for organization and note taking."), 259 | authors, documenters, 260 | NULL, NULL); 261 | 262 | gtk_window_set_transient_for (GTK_WINDOW (about_dialog), GTK_WINDOW (window)); 263 | g_object_add_weak_pointer (G_OBJECT (about_dialog), 264 | (gpointer *) &about_dialog); 265 | 266 | gtk_widget_show (about_dialog); 267 | } 268 | 269 | -------------------------------------------------------------------------------- /outliner/po/Makefile.in.in: -------------------------------------------------------------------------------- 1 | # Makefile for program source directory in GNU NLS utilities package. 2 | # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper 3 | # 4 | # This file file be copied and used freely without restrictions. It can 5 | # be used in projects which are not available under the GNU Public License 6 | # but which still want to provide support for the GNU gettext functionality. 7 | # Please note that the actual code is *not* freely available. 8 | # 9 | # - Modified by Owen Taylor to use GETTEXT_PACKAGE 10 | # instead of PACKAGE and to look for po2tbl in ./ not in intl/ 11 | # 12 | # - Modified by jacob berkman to install 13 | # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize 14 | 15 | GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ 16 | PACKAGE = @PACKAGE@ 17 | VERSION = @VERSION@ 18 | 19 | SHELL = /bin/sh 20 | @SET_MAKE@ 21 | 22 | srcdir = @srcdir@ 23 | top_srcdir = @top_srcdir@ 24 | top_builddir = .. 25 | VPATH = @srcdir@ 26 | 27 | prefix = @prefix@ 28 | exec_prefix = @exec_prefix@ 29 | datadir = @datadir@ 30 | libdir = @libdir@ 31 | localedir = $(libdir)/locale 32 | gnulocaledir = $(datadir)/locale 33 | gettextsrcdir = $(datadir)/glib-2.0/gettext/po 34 | subdir = po 35 | 36 | INSTALL = @INSTALL@ 37 | INSTALL_DATA = @INSTALL_DATA@ 38 | MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ 39 | 40 | CC = @CC@ 41 | GENCAT = @GENCAT@ 42 | GMSGFMT = @GMSGFMT@ 43 | MSGFMT = @MSGFMT@ 44 | XGETTEXT = @XGETTEXT@ 45 | INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ 46 | INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ 47 | MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist 48 | GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot 49 | 50 | DEFS = @DEFS@ 51 | CFLAGS = @CFLAGS@ 52 | CPPFLAGS = @CPPFLAGS@ 53 | 54 | INCLUDES = -I.. -I$(top_srcdir)/intl 55 | 56 | COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) 57 | 58 | SOURCES = 59 | POFILES = @POFILES@ 60 | GMOFILES = @GMOFILES@ 61 | DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ 62 | $(POFILES) $(GMOFILES) $(SOURCES) 63 | 64 | POTFILES = \ 65 | 66 | CATALOGS = @CATALOGS@ 67 | CATOBJEXT = @CATOBJEXT@ 68 | INSTOBJEXT = @INSTOBJEXT@ 69 | 70 | .SUFFIXES: 71 | .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat 72 | 73 | .c.o: 74 | $(COMPILE) $< 75 | 76 | .po.pox: 77 | $(MAKE) $(GETTEXT_PACKAGE).pot 78 | $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*pox 79 | 80 | .po.mo: 81 | $(MSGFMT) -o $@ $< 82 | 83 | .po.gmo: 84 | file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ 85 | && rm -f $$file && $(GMSGFMT) -o $$file $< 86 | 87 | .po.cat: 88 | sed -f ../intl/po2msg.sed < $< > $*.msg \ 89 | && rm -f $@ && $(GENCAT) $@ $*.msg 90 | 91 | 92 | all: all-@USE_NLS@ 93 | 94 | all-yes: $(CATALOGS) 95 | all-no: 96 | 97 | $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) 98 | $(GENPOT) 99 | 100 | install: install-exec install-data 101 | install-exec: 102 | install-data: install-data-@USE_NLS@ 103 | install-data-no: all 104 | install-data-yes: all 105 | if test -r "$(MKINSTALLDIRS)"; then \ 106 | $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ 107 | else \ 108 | $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ 109 | fi 110 | @catalogs='$(CATALOGS)'; \ 111 | for cat in $$catalogs; do \ 112 | cat=`basename $$cat`; \ 113 | case "$$cat" in \ 114 | *.gmo) destdir=$(gnulocaledir);; \ 115 | *) destdir=$(localedir);; \ 116 | esac; \ 117 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 118 | dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ 119 | if test -r "$(MKINSTALLDIRS)"; then \ 120 | $(MKINSTALLDIRS) $$dir; \ 121 | else \ 122 | $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ 123 | fi; \ 124 | if test -r $$cat; then \ 125 | $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ 126 | echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ 127 | else \ 128 | $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ 129 | echo "installing $(srcdir)/$$cat as" \ 130 | "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ 131 | fi; \ 132 | if test -r $$cat.m; then \ 133 | $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ 134 | echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ 135 | else \ 136 | if test -r $(srcdir)/$$cat.m ; then \ 137 | $(INSTALL_DATA) $(srcdir)/$$cat.m \ 138 | $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ 139 | echo "installing $(srcdir)/$$cat as" \ 140 | "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ 141 | else \ 142 | true; \ 143 | fi; \ 144 | fi; \ 145 | done 146 | if test "$(PACKAGE)" = "glib"; then \ 147 | if test -r "$(MKINSTALLDIRS)"; then \ 148 | $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ 149 | else \ 150 | $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ 151 | fi; \ 152 | $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ 153 | $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ 154 | else \ 155 | : ; \ 156 | fi 157 | 158 | # Define this as empty until I found a useful application. 159 | installcheck: 160 | 161 | uninstall: 162 | catalogs='$(CATALOGS)'; \ 163 | for cat in $$catalogs; do \ 164 | cat=`basename $$cat`; \ 165 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 166 | rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ 167 | rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ 168 | rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ 169 | rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ 170 | done 171 | if test "$(PACKAGE)" = "glib"; then \ 172 | rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ 173 | fi 174 | 175 | check: all 176 | 177 | dvi info tags TAGS ID: 178 | 179 | mostlyclean: 180 | rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp 181 | rm -fr *.o 182 | rm -f .intltool-merge-cache 183 | 184 | clean: mostlyclean 185 | 186 | distclean: clean 187 | rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m 188 | 189 | maintainer-clean: distclean 190 | @echo "This command is intended for maintainers to use;" 191 | @echo "it deletes files that may require special tools to rebuild." 192 | rm -f $(GMOFILES) 193 | 194 | distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir) 195 | dist distdir: update-po $(DISTFILES) 196 | dists="$(DISTFILES)"; \ 197 | for file in $$dists; do \ 198 | ln $(srcdir)/$$file $(distdir) 2> /dev/null \ 199 | || cp -p $(srcdir)/$$file $(distdir); \ 200 | done 201 | 202 | update-po: Makefile 203 | $(MAKE) $(GETTEXT_PACKAGE).pot 204 | tmpdir=`pwd`; \ 205 | cd $(srcdir); \ 206 | catalogs='$(CATALOGS)'; \ 207 | for cat in $$catalogs; do \ 208 | cat=`basename $$cat`; \ 209 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 210 | echo "$$lang:"; \ 211 | if $$tmpdir/$(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist -o $$tmpdir/$$lang.new.po $$lang; then \ 212 | if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 213 | rm -f $$tmpdir/$$lang.new.po; \ 214 | else \ 215 | if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 216 | :; \ 217 | else \ 218 | echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 219 | rm -f $$tmpdir/$$lang.new.po; \ 220 | exit 1; \ 221 | fi; \ 222 | fi; \ 223 | else \ 224 | echo "msgmerge for $$cat failed!"; \ 225 | rm -f $$tmpdir/$$lang.new.po; \ 226 | fi; \ 227 | done 228 | 229 | # POTFILES is created from POTFILES.in by stripping comments, empty lines 230 | # and Intltool tags (enclosed in square brackets), and appending a full 231 | # relative path to them 232 | POTFILES: POTFILES.in 233 | ( if test 'x$(srcdir)' != 'x.'; then \ 234 | posrcprefix='$(top_srcdir)/'; \ 235 | else \ 236 | posrcprefix="../"; \ 237 | fi; \ 238 | rm -f $@-t $@ \ 239 | && (sed -e '/^#/d' \ 240 | -e "s/^\[.*\] +//" \ 241 | -e '/^[ ]*$$/d' \ 242 | -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ 243 | | sed -e '$$s/\\$$//') > $@-t \ 244 | && chmod a-w $@-t \ 245 | && mv $@-t $@ ) 246 | 247 | Makefile: Makefile.in.in ../config.status POTFILES 248 | cd .. \ 249 | && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ 250 | $(SHELL) ./config.status 251 | 252 | # Tell versions [3.59,3.63) of GNU make not to export all variables. 253 | # Otherwise a system limit (for SysV at least) may be exceeded. 254 | .NOEXPORT: 255 | -------------------------------------------------------------------------------- /outliner/INSTALL: -------------------------------------------------------------------------------- 1 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software 2 | Foundation, Inc. 3 | 4 | This file is free documentation; the Free Software Foundation gives 5 | unlimited permission to copy, distribute and modify it. 6 | 7 | Basic Installation 8 | ================== 9 | 10 | These are generic installation instructions. 11 | 12 | The `configure' shell script attempts to guess correct values for 13 | various system-dependent variables used during compilation. It uses 14 | those values to create a `Makefile' in each directory of the package. 15 | It may also create one or more `.h' files containing system-dependent 16 | definitions. Finally, it creates a shell script `config.status' that 17 | you can run in the future to recreate the current configuration, and a 18 | file `config.log' containing compiler output (useful mainly for 19 | debugging `configure'). 20 | 21 | It can also use an optional file (typically called `config.cache' 22 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 23 | the results of its tests to speed up reconfiguring. (Caching is 24 | disabled by default to prevent problems with accidental use of stale 25 | cache files.) 26 | 27 | If you need to do unusual things to compile the package, please try 28 | to figure out how `configure' could check whether to do them, and mail 29 | diffs or instructions to the address given in the `README' so they can 30 | be considered for the next release. If you are using the cache, and at 31 | some point `config.cache' contains results you don't want to keep, you 32 | may remove or edit it. 33 | 34 | The file `configure.ac' (or `configure.in') is used to create 35 | `configure' by a program called `autoconf'. You only need 36 | `configure.ac' if you want to change it or regenerate `configure' using 37 | a newer version of `autoconf'. 38 | 39 | The simplest way to compile this package is: 40 | 41 | 1. `cd' to the directory containing the package's source code and type 42 | `./configure' to configure the package for your system. If you're 43 | using `csh' on an old version of System V, you might need to type 44 | `sh ./configure' instead to prevent `csh' from trying to execute 45 | `configure' itself. 46 | 47 | Running `configure' takes awhile. While running, it prints some 48 | messages telling which features it is checking for. 49 | 50 | 2. Type `make' to compile the package. 51 | 52 | 3. Optionally, type `make check' to run any self-tests that come with 53 | the package. 54 | 55 | 4. Type `make install' to install the programs and any data files and 56 | documentation. 57 | 58 | 5. You can remove the program binaries and object files from the 59 | source code directory by typing `make clean'. To also remove the 60 | files that `configure' created (so you can compile the package for 61 | a different kind of computer), type `make distclean'. There is 62 | also a `make maintainer-clean' target, but that is intended mainly 63 | for the package's developers. If you use it, you may have to get 64 | all sorts of other programs in order to regenerate files that came 65 | with the distribution. 66 | 67 | Compilers and Options 68 | ===================== 69 | 70 | Some systems require unusual options for compilation or linking that 71 | the `configure' script does not know about. Run `./configure --help' 72 | for details on some of the pertinent environment variables. 73 | 74 | You can give `configure' initial values for configuration parameters 75 | by setting variables in the command line or in the environment. Here 76 | is an example: 77 | 78 | ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix 79 | 80 | *Note Defining Variables::, for more details. 81 | 82 | Compiling For Multiple Architectures 83 | ==================================== 84 | 85 | You can compile the package for more than one kind of computer at the 86 | same time, by placing the object files for each architecture in their 87 | own directory. To do this, you must use a version of `make' that 88 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 89 | directory where you want the object files and executables to go and run 90 | the `configure' script. `configure' automatically checks for the 91 | source code in the directory that `configure' is in and in `..'. 92 | 93 | If you have to use a `make' that does not support the `VPATH' 94 | variable, you have to compile the package for one architecture at a 95 | time in the source code directory. After you have installed the 96 | package for one architecture, use `make distclean' before reconfiguring 97 | for another architecture. 98 | 99 | Installation Names 100 | ================== 101 | 102 | By default, `make install' will install the package's files in 103 | `/usr/local/bin', `/usr/local/man', etc. You can specify an 104 | installation prefix other than `/usr/local' by giving `configure' the 105 | option `--prefix=PATH'. 106 | 107 | You can specify separate installation prefixes for 108 | architecture-specific files and architecture-independent files. If you 109 | give `configure' the option `--exec-prefix=PATH', the package will use 110 | PATH as the prefix for installing programs and libraries. 111 | Documentation and other data files will still use the regular prefix. 112 | 113 | In addition, if you use an unusual directory layout you can give 114 | options like `--bindir=PATH' to specify different values for particular 115 | kinds of files. Run `configure --help' for a list of the directories 116 | you can set and what kinds of files go in them. 117 | 118 | If the package supports it, you can cause programs to be installed 119 | with an extra prefix or suffix on their names by giving `configure' the 120 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 121 | 122 | Optional Features 123 | ================= 124 | 125 | Some packages pay attention to `--enable-FEATURE' options to 126 | `configure', where FEATURE indicates an optional part of the package. 127 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 128 | is something like `gnu-as' or `x' (for the X Window System). The 129 | `README' should mention any `--enable-' and `--with-' options that the 130 | package recognizes. 131 | 132 | For packages that use the X Window System, `configure' can usually 133 | find the X include and library files automatically, but if it doesn't, 134 | you can use the `configure' options `--x-includes=DIR' and 135 | `--x-libraries=DIR' to specify their locations. 136 | 137 | Specifying the System Type 138 | ========================== 139 | 140 | There may be some features `configure' cannot figure out 141 | automatically, but needs to determine by the type of machine the package 142 | will run on. Usually, assuming the package is built to be run on the 143 | _same_ architectures, `configure' can figure that out, but if it prints 144 | a message saying it cannot guess the machine type, give it the 145 | `--build=TYPE' option. TYPE can either be a short name for the system 146 | type, such as `sun4', or a canonical name which has the form: 147 | 148 | CPU-COMPANY-SYSTEM 149 | 150 | where SYSTEM can have one of these forms: 151 | 152 | OS KERNEL-OS 153 | 154 | See the file `config.sub' for the possible values of each field. If 155 | `config.sub' isn't included in this package, then this package doesn't 156 | need to know the machine type. 157 | 158 | If you are _building_ compiler tools for cross-compiling, you should 159 | use the `--target=TYPE' option to select the type of system they will 160 | produce code for. 161 | 162 | If you want to _use_ a cross compiler, that generates code for a 163 | platform different from the build platform, you should specify the 164 | "host" platform (i.e., that on which the generated programs will 165 | eventually be run) with `--host=TYPE'. 166 | 167 | Sharing Defaults 168 | ================ 169 | 170 | If you want to set default values for `configure' scripts to share, 171 | you can create a site shell script called `config.site' that gives 172 | default values for variables like `CC', `cache_file', and `prefix'. 173 | `configure' looks for `PREFIX/share/config.site' if it exists, then 174 | `PREFIX/etc/config.site' if it exists. Or, you can set the 175 | `CONFIG_SITE' environment variable to the location of the site script. 176 | A warning: not all `configure' scripts look for a site script. 177 | 178 | Defining Variables 179 | ================== 180 | 181 | Variables not defined in a site shell script can be set in the 182 | environment passed to `configure'. However, some packages may run 183 | configure again during the build, and the customized values of these 184 | variables may be lost. In order to avoid this problem, you should set 185 | them in the `configure' command line, using `VAR=value'. For example: 186 | 187 | ./configure CC=/usr/local2/bin/gcc 188 | 189 | will cause the specified gcc to be used as the C compiler (unless it is 190 | overridden in the site shell script). 191 | 192 | `configure' Invocation 193 | ====================== 194 | 195 | `configure' recognizes the following options to control how it 196 | operates. 197 | 198 | `--help' 199 | `-h' 200 | Print a summary of the options to `configure', and exit. 201 | 202 | `--version' 203 | `-V' 204 | Print the version of Autoconf used to generate the `configure' 205 | script, and exit. 206 | 207 | `--cache-file=FILE' 208 | Enable the cache: use and save the results of the tests in FILE, 209 | traditionally `config.cache'. FILE defaults to `/dev/null' to 210 | disable caching. 211 | 212 | `--config-cache' 213 | `-C' 214 | Alias for `--cache-file=config.cache'. 215 | 216 | `--quiet' 217 | `--silent' 218 | `-q' 219 | Do not print messages saying which checks are being made. To 220 | suppress all normal output, redirect it to `/dev/null' (any error 221 | messages will still be shown). 222 | 223 | `--srcdir=DIR' 224 | Look for the package's source code in directory DIR. Usually 225 | `configure' can determine that directory automatically. 226 | 227 | `configure' also accepts some other, not widely useful, options. Run 228 | `configure --help' for more details. 229 | 230 | -------------------------------------------------------------------------------- /outliner/src/outliner-opml.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-opml.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-opml.h" 25 | #include "outliner-document.h" 26 | #include "outliner-window.h" 27 | #include "xml-gnomevfs.h" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | static void 35 | save_attrs(gchar *name, gchar *value, xmlNodePtr cur) 36 | { 37 | xmlNewProp(cur, name, value); 38 | } 39 | 40 | static void 41 | save_recursively(OutlinerDocument *doc, xmlNodePtr parent, GtkTreeIter *iter) 42 | { 43 | gboolean val = TRUE; 44 | gchar *string; 45 | gboolean status; 46 | GHashTable *attr_hash; 47 | xmlNodePtr cur; 48 | GtkTreeIter child; 49 | 50 | while (val) { 51 | cur = xmlNewChild(parent, NULL, "outline", NULL); 52 | gtk_tree_model_get(GTK_TREE_MODEL(doc), iter, COL_TEXT, &string, -1); 53 | xmlNewProp(cur, "text", string); 54 | g_free(string); 55 | 56 | gtk_tree_model_get(GTK_TREE_MODEL(doc), iter, COL_STATUS, &status, -1); 57 | switch (status) 58 | { 59 | case TRUE: 60 | { 61 | xmlNewProp(cur, "_status", "checked"); 62 | break; 63 | } 64 | case FALSE: 65 | { 66 | xmlNewProp(cur, "_status", "unchecked"); 67 | break; 68 | } 69 | default: 70 | { 71 | xmlNewProp(cur, "_status", "none"); 72 | break; 73 | } 74 | } 75 | 76 | gtk_tree_model_get(GTK_TREE_MODEL(doc), iter, COL_OTHER, &attr_hash, -1); 77 | g_hash_table_foreach(attr_hash, (GHFunc)save_attrs, cur); 78 | 79 | 80 | if (gtk_tree_model_iter_children(GTK_TREE_MODEL(doc), &child, iter)) 81 | save_recursively(doc, cur, &child); 82 | val = gtk_tree_model_iter_next(GTK_TREE_MODEL(doc), iter); 83 | } 84 | } 85 | 86 | static void 87 | save_head(OutlinerWindow *window, OutlinerDocument *doc, xmlNodePtr head) 88 | { 89 | GString *string = g_string_new(NULL); 90 | gint h,w,t,l; /* height, width, top, left */ 91 | 92 | gtk_window_get_size(GTK_WINDOW(window), &w, &h); 93 | gtk_window_get_position(GTK_WINDOW(window), &l, &t); 94 | outliner_document_set_w_top (doc, t); 95 | outliner_document_set_w_left (doc, l); 96 | outliner_document_set_w_bottom (doc, t+h); 97 | outliner_document_set_w_right (doc, l+w); 98 | 99 | /* XXX */ 100 | 101 | xmlNewTextChild(head, NULL, "title", outliner_document_get_title(doc)->str ); 102 | xmlNewTextChild(head, NULL, "ownerName", outliner_document_get_author(doc)->str ); 103 | xmlNewTextChild(head, NULL, "ownerEmail", outliner_document_get_email(doc)->str ); 104 | 105 | g_string_printf(string, "%i", outliner_document_get_w_top(doc)); 106 | xmlNewTextChild(head, NULL, "windowTop", string->str); 107 | g_string_printf(string, "%i", outliner_document_get_w_bottom(doc)); 108 | xmlNewTextChild(head, NULL, "windowBottom", string->str); 109 | g_string_printf(string, "%i", outliner_document_get_w_left(doc)); 110 | xmlNewTextChild(head, NULL, "windowLeft", string->str); 111 | g_string_printf(string, "%i", outliner_document_get_w_right(doc)); 112 | xmlNewTextChild(head, NULL, "windowRight", string->str); 113 | g_string_free(string, TRUE); 114 | 115 | } 116 | 117 | void 118 | outliner_opml_save_file(OutlinerWindow *window, OutlinerDocument *doc, gchar *filename) 119 | { 120 | GnomeVFSHandle *handle; 121 | GnomeVFSResult result; 122 | xmlOutputBufferPtr output; 123 | xmlDocPtr xmldoc; 124 | xmlNodePtr opml, body, head; 125 | GtkTreeIter iter; 126 | 127 | result = gnome_vfs_create(&handle, filename, GNOME_VFS_OPEN_WRITE, FALSE, S_IREAD|S_IWRITE); 128 | if (result == GNOME_VFS_OK) { 129 | xmldoc = xmlNewDoc(NULL); 130 | opml = xmlNewDocNode(xmldoc, NULL, "opml", NULL); 131 | xmlDocSetRootElement(xmldoc, opml); 132 | head = xmlNewChild(opml, NULL, "head", NULL); 133 | body = xmlNewChild(opml, NULL, "body", NULL); 134 | 135 | save_head(window, doc, head); 136 | 137 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(doc), &iter)) { 138 | save_recursively(doc, body, &iter); 139 | } 140 | 141 | output = xml_gnomevfs_create_ouputbuffer(handle); 142 | xmlSaveFormatFileTo(output, xmldoc, NULL, 1); 143 | /* XXX */ 144 | 145 | outliner_document_set_uri(doc, filename); 146 | /* 147 | outliner_mainwindow_set_title(); 148 | */ 149 | 150 | outliner_document_set_changed (doc, FALSE); 151 | } 152 | } 153 | 154 | static void 155 | parse_recursively(OutlinerDocument *doc, xmlNodePtr cur, GtkTreeIter *parent) 156 | { 157 | GtkTreeIter iter; 158 | gboolean status; 159 | gchar *string; 160 | xmlAttr *cur_attr; 161 | GHashTable *attr_hash; 162 | 163 | while (cur != NULL) { 164 | status = FALSE; 165 | attr_hash = g_hash_table_new(g_str_hash, g_str_equal); 166 | if ((!xmlStrcmp(cur->name, "outline"))) { 167 | gtk_tree_store_append(GTK_TREE_STORE (doc), &iter, parent); 168 | cur_attr = cur->properties; 169 | while (cur_attr != NULL) { 170 | if ((!xmlStrcmp(cur_attr->name, "text"))) { 171 | gtk_tree_store_set(GTK_TREE_STORE (doc), &iter, COL_TEXT, xmlGetProp(cur, "text"), -1); 172 | } 173 | else if ((!xmlStrcmp(cur_attr->name, "_status"))) { 174 | string = xmlGetProp(cur, "_status"); 175 | 176 | /* TODO: handle none/indeterminate values */ 177 | if (g_ascii_strncasecmp(string, "checked", strlen(string)) == 0) 178 | status = TRUE; 179 | else if (g_ascii_strncasecmp(string, "unchecked", strlen(string)) == 0) 180 | status = FALSE; 181 | gtk_tree_store_set(GTK_TREE_STORE (doc), &iter, COL_STATUS, status, -1); 182 | } 183 | else { 184 | if (!g_slist_find(outliner_document_get_column_names(doc), cur_attr->name)) { 185 | g_slist_append(outliner_document_get_column_names(doc), cur_attr->name); 186 | } 187 | g_hash_table_insert(attr_hash, g_strdup(cur_attr->name), g_strdup(xmlGetProp(cur, cur_attr->name))); 188 | } 189 | cur_attr = cur_attr->next; 190 | } 191 | /* Is this the right way to store an object? */ 192 | gtk_tree_store_set(GTK_TREE_STORE (doc), &iter, COL_OTHER, attr_hash, -1); 193 | } 194 | if (cur->xmlChildrenNode != NULL) 195 | parse_recursively(doc, cur->xmlChildrenNode, &iter); 196 | cur = cur->next; 197 | } 198 | } 199 | 200 | static void 201 | parse_head(OutlinerDocument *doc, xmlDocPtr xmldoc, xmlNodePtr cur) 202 | { 203 | 204 | 205 | while (cur != NULL) { 206 | 207 | if ((!xmlStrcmp(cur->name, "windowTop"))) 208 | outliner_document_set_w_top (doc, atoi(xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1))); 209 | else if ((!xmlStrcmp(cur->name, "windowLeft"))) 210 | outliner_document_set_w_left (doc, atoi(xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1))); 211 | else if ((!xmlStrcmp(cur->name, "windowRight"))) 212 | outliner_document_set_w_right (doc, atoi(xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1))); 213 | else if ((!xmlStrcmp(cur->name, "windowBottom"))) 214 | outliner_document_set_w_bottom (doc, atoi(xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1))); 215 | 216 | if ((!xmlStrcmp(cur->name, "title"))) 217 | outliner_document_set_title(doc, xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1)); 218 | else if ((!xmlStrcmp(cur->name, "ownerName"))) 219 | outliner_document_set_author(doc, xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1)); 220 | else if ((!xmlStrcmp(cur->name, "ownerEmail"))) 221 | outliner_document_set_email(doc, xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1)); 222 | 223 | if ((!xmlStrcmp(cur->name, "expansionState"))) 224 | { 225 | gchar **rows; 226 | gint i; 227 | GArray* new_expanded = g_array_new(FALSE, FALSE, sizeof(gint)); 228 | rows = g_strsplit(xmlNodeListGetString(xmldoc, cur->xmlChildrenNode, 1), ",", 0); 229 | for(i = 0; rows[i] != NULL; i++) 230 | g_array_append_val(new_expanded, rows[i]); 231 | g_array_free(new_expanded, FALSE); 232 | g_strfreev(rows); 233 | } 234 | 235 | cur = cur->next; 236 | } 237 | 238 | } 239 | 240 | static int 241 | yeah(const char *f) 242 | { 243 | return 1; 244 | } 245 | 246 | void 247 | outliner_opml_load_file(OutlinerDocument *doc, gchar *filename) 248 | { 249 | xmlDocPtr xmldoc; 250 | xmlNodePtr cur; 251 | 252 | if (xmlRegisterInputCallbacks((xmlInputMatchCallback)yeah, 253 | (xmlInputOpenCallback)xml_gnomevfs_openread, 254 | (xmlInputReadCallback)xml_gnomevfs_read, 255 | (xmlInputCloseCallback)xml_gnomevfs_close) == -1) { 256 | g_error("Failed to register input callbacks"); 257 | return; 258 | } 259 | if ((xmldoc = xmlParseFile(filename)) == NULL) { 260 | g_error("Failed to parse file"); 261 | return; 262 | } 263 | 264 | cur = xmlDocGetRootElement(xmldoc); 265 | if (xmlStrcmp(cur->name, (const xmlChar *) "opml")) { 266 | g_error("The file is not an OPML file"); 267 | return; 268 | } 269 | 270 | gtk_tree_store_clear(GTK_TREE_STORE (doc)); 271 | cur = cur->xmlChildrenNode; 272 | while (cur != NULL) { 273 | if ((!xmlStrcmp(cur->name, "head")) && cur->xmlChildrenNode != NULL) { 274 | parse_head(doc, xmldoc, cur->xmlChildrenNode); 275 | } 276 | if ((!xmlStrcmp(cur->name, "body")) && cur->xmlChildrenNode != NULL) 277 | parse_recursively(doc, cur->xmlChildrenNode, NULL); 278 | cur = cur->next; 279 | } 280 | 281 | outliner_document_set_uri(doc, filename); 282 | /* 283 | outliner_mainwindow_set_title(); 284 | */ 285 | outliner_document_set_changed (doc, FALSE); 286 | } 287 | 288 | -------------------------------------------------------------------------------- /outliner/src/outliner-view.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-view.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-view.h" 25 | #include "outliner-document.h" 26 | #include "outliner-cell-renderer.h" 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include 30 | #endif 31 | 32 | #include 33 | #include 34 | 35 | #define OUTLINER_VIEW_GET_PRIVATE(obj) \ 36 | (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OUTLINER_TYPE_VIEW, OutlinerViewPrivate)) 37 | 38 | typedef struct _OutlinerViewPrivate OutlinerViewPrivate; 39 | struct _OutlinerViewPrivate { 40 | OutlinerDocument *document; 41 | GtkCellRenderer *text_renderer; 42 | GtkCellRenderer *toggle_renderer; 43 | GtkTreeViewColumn *column; 44 | GtkTreeSelection *sel; 45 | }; 46 | 47 | static GtkTreeViewClass *parent_class = NULL; 48 | 49 | static void outliner_view_init (OutlinerView *view); 50 | static void outliner_view_class_init (OutlinerViewClass *class); 51 | static void outliner_view_finalize (GObject *object); 52 | 53 | OutlinerDocument * 54 | outliner_view_get_document (OutlinerView *view) 55 | { 56 | OutlinerViewPrivate *priv = OUTLINER_VIEW_GET_PRIVATE (view); 57 | return OUTLINER_DOCUMENT (priv->document); 58 | } 59 | 60 | void 61 | outliner_view_add_item (OutlinerView *view) 62 | { 63 | OutlinerDocument *doc; 64 | GtkTreeIter cur, new; 65 | GtkTreePath *path; 66 | GtkTreeSelection *sel; 67 | 68 | doc = outliner_view_get_document(view); 69 | 70 | if (outliner_view_get_last_selected(view, &cur)) { 71 | if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL (doc), &cur)) 72 | gtk_tree_store_prepend(GTK_TREE_STORE (doc), &new, &cur); 73 | else 74 | gtk_tree_store_insert_after(GTK_TREE_STORE (doc), &new, NULL, &cur); 75 | } 76 | else 77 | gtk_tree_store_prepend(GTK_TREE_STORE (doc), &new, NULL); 78 | 79 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW (view)); 80 | gtk_tree_selection_select_iter(sel, &new); 81 | path = gtk_tree_model_get_path(GTK_TREE_MODEL (doc), &new); 82 | gtk_tree_view_expand_to_path(GTK_TREE_VIEW (view), path); 83 | gtk_tree_view_set_cursor_on_cell(GTK_TREE_VIEW (view), path, 84 | gtk_tree_view_get_column(GTK_TREE_VIEW (view), 0), NULL, TRUE); 85 | gtk_tree_path_free(path); 86 | 87 | outliner_document_set_changed(doc, TRUE); 88 | } 89 | 90 | void 91 | outliner_view_foreach_selected_subtree (OutlinerView *view, OutlinerViewForeachFunc func, 92 | gboolean backwards, gpointer data) 93 | { 94 | OutlinerDocument *doc; 95 | GtkTreePath *path, *ancestor = NULL; 96 | GtkTreeSelection *sel; 97 | GList *sellist, *reflist = NULL, *li; 98 | GtkTreeRowReference *rowref; 99 | 100 | doc = outliner_view_get_document(view); 101 | 102 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW (view)); 103 | sellist = gtk_tree_selection_get_selected_rows(sel, NULL); 104 | 105 | for (li = sellist; li!= NULL; li = g_list_next(li)) { 106 | path = (GtkTreePath *)(li->data); 107 | if (ancestor==NULL || !gtk_tree_path_is_descendant(path, ancestor)) { 108 | if (backwards) 109 | reflist = g_list_prepend(reflist, gtk_tree_row_reference_new(GTK_TREE_MODEL (doc), path)); 110 | else 111 | reflist = g_list_append(reflist, gtk_tree_row_reference_new(GTK_TREE_MODEL (doc), path)); 112 | ancestor = path; 113 | } 114 | } 115 | g_list_foreach(sellist, (GFunc)gtk_tree_path_free, NULL); 116 | g_list_free(sellist); 117 | 118 | for (li = reflist; li!= NULL; li = g_list_next(li)) { 119 | rowref = (GtkTreeRowReference *)(li->data); 120 | path = gtk_tree_row_reference_get_path(rowref); 121 | (*func)(doc, path, data); 122 | } 123 | g_list_foreach(reflist, (GFunc)gtk_tree_row_reference_free, NULL); 124 | g_list_free(reflist); 125 | } 126 | 127 | gboolean 128 | outliner_view_get_last_selected (OutlinerView *view, GtkTreeIter *item) 129 | { 130 | OutlinerDocument *doc; 131 | GtkTreePath *path; 132 | GtkTreeSelection *sel; 133 | GList *sellist, *li; 134 | gboolean ret = FALSE; 135 | 136 | doc = outliner_view_get_document(view); 137 | 138 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW (view)); 139 | sellist = gtk_tree_selection_get_selected_rows(sel, NULL); 140 | 141 | if (g_list_length(sellist) > 0) { 142 | li = g_list_last(sellist); 143 | path = (GtkTreePath *)(li->data); 144 | gtk_tree_model_get_iter(GTK_TREE_MODEL (doc), item, path); 145 | ret = TRUE; 146 | } 147 | 148 | g_list_foreach(sellist, (GFunc)gtk_tree_path_free, NULL); 149 | g_list_free(sellist); 150 | return ret; 151 | } 152 | 153 | static void 154 | save_celltext(GtkCellRenderer *rend, gchar *path, gchar *string, OutlinerView *view) 155 | { 156 | GtkTreeIter iter; 157 | OutlinerViewPrivate *priv = OUTLINER_VIEW_GET_PRIVATE (view); 158 | GtkTreeStore *store = GTK_TREE_STORE (priv->document); 159 | 160 | gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store), &iter, path); 161 | gtk_tree_store_set(store, &iter, COL_TEXT, string, -1); 162 | } 163 | 164 | static void 165 | save_status(GtkCellRenderer *rend, gchar *path, OutlinerView *view) 166 | { 167 | GtkTreeIter iter; 168 | gboolean status; 169 | 170 | OutlinerViewPrivate *priv = OUTLINER_VIEW_GET_PRIVATE (view); 171 | GtkTreeStore *store = GTK_TREE_STORE (priv->document); 172 | 173 | gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store), &iter, path); 174 | 175 | status = gtk_cell_renderer_toggle_get_active(rend); 176 | gtk_tree_store_set(store, &iter, COL_STATUS, !status, -1); 177 | gtk_cell_renderer_toggle_set_active(rend, !status); 178 | } 179 | 180 | static void 181 | row_moved_cb (OutlinerDocument *doc, GtkTreePath *oldpath, GtkTreePath *newpath, gpointer data) 182 | { 183 | GtkTreeView *tree; 184 | GtkTreeSelection *sel; 185 | OutlinerView *view = data; 186 | GtkTreeIter iter; 187 | 188 | tree = GTK_TREE_VIEW (view); 189 | sel = gtk_tree_view_get_selection(tree); 190 | 191 | g_message("row-moved: %s -> %s", gtk_tree_path_to_string(oldpath), gtk_tree_path_to_string(newpath)); 192 | 193 | if (gtk_tree_selection_path_is_selected(sel, oldpath)) { 194 | gtk_tree_view_expand_to_path(tree, newpath); 195 | gtk_tree_view_collapse_row(tree, newpath); 196 | gtk_tree_selection_select_path(sel, newpath); 197 | gtk_tree_view_scroll_to_cell(tree, newpath, NULL, FALSE, 0, 0); 198 | } 199 | 200 | if (gtk_tree_view_row_expanded(tree, oldpath)) 201 | gtk_tree_view_expand_row(tree, newpath, FALSE); 202 | 203 | } 204 | 205 | static void 206 | row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data) 207 | { 208 | GtkTreeView *tree; 209 | GtkTreeSelection *sel; 210 | OutlinerView *view = data; 211 | OutlinerViewPrivate *priv = OUTLINER_VIEW_GET_PRIVATE (view); 212 | 213 | tree = GTK_TREE_VIEW (view); 214 | sel = gtk_tree_view_get_selection(tree); 215 | 216 | if (gtk_tree_selection_count_selected_rows(sel) == 0) { 217 | //gtk_tree_selection_select_path(sel, path); 218 | gtk_tree_view_set_cursor(tree, path, priv->column, TRUE); 219 | } 220 | } 221 | 222 | /* 223 | static void 224 | expand (OutlinerView *view) 225 | { 226 | 227 | gint row = 1; 228 | gint i; 229 | for(i = 0; i < expanded->len ; i++) { 230 | if (g_array_index(expanded, gint, i) == row) 231 | gtk_tree_store( 232 | } 233 | 234 | } 235 | */ 236 | 237 | /*-------------*/ 238 | 239 | static void 240 | outliner_view_init (OutlinerView *view) 241 | { 242 | gtk_tree_view_set_reorderable (view, TRUE); 243 | } 244 | 245 | static void 246 | outliner_view_class_init (OutlinerViewClass *class) 247 | { 248 | GObjectClass *object_class = G_OBJECT_CLASS (class); 249 | parent_class = g_type_class_peek_parent (class); 250 | 251 | object_class->finalize = outliner_view_finalize; 252 | 253 | g_type_class_add_private (class, sizeof (OutlinerViewPrivate)); 254 | } 255 | 256 | GtkWidget * 257 | outliner_view_new (OutlinerDocument *doc) 258 | { 259 | OutlinerView *view; 260 | GtkTreeView *tree; 261 | OutlinerViewPrivate *priv; 262 | GtkTreeIter root, a, b, c; 263 | 264 | g_return_val_if_fail (doc != NULL, NULL); 265 | 266 | view = OUTLINER_VIEW (g_object_new (OUTLINER_TYPE_VIEW, NULL)); 267 | g_return_val_if_fail (view != NULL, NULL); 268 | tree = GTK_TREE_VIEW (view); 269 | 270 | gtk_tree_view_set_headers_visible (tree, FALSE); 271 | 272 | gtk_tree_view_set_model (tree, GTK_TREE_MODEL(doc)); 273 | g_message("set model"); 274 | 275 | priv = OUTLINER_VIEW_GET_PRIVATE (view); 276 | priv->document = doc; 277 | g_signal_connect(G_OBJECT (priv->document), "row_moved", 278 | G_CALLBACK(row_moved_cb), view); 279 | g_signal_connect(G_OBJECT (priv->document), "row-deleted", 280 | G_CALLBACK(row_deleted_cb), view); 281 | 282 | priv->column = gtk_tree_view_column_new(); 283 | priv->text_renderer = g_object_new (OUTLINER_TYPE_CELL_RENDERER_TEXT, NULL); 284 | priv->toggle_renderer = gtk_cell_renderer_toggle_new(); 285 | gtk_tree_view_column_pack_end(priv->column, priv->text_renderer, TRUE); 286 | gtk_tree_view_column_add_attribute(priv->column, priv->text_renderer, "text", COL_TEXT); 287 | gtk_tree_view_column_pack_end(priv->column, priv->toggle_renderer, FALSE); 288 | gtk_tree_view_column_add_attribute(priv->column, priv->toggle_renderer, "active", COL_STATUS); 289 | gtk_tree_view_insert_column (GTK_TREE_VIEW (view), priv->column, -1); 290 | g_object_set(priv->text_renderer, "editable", TRUE, NULL); 291 | g_signal_connect(priv->text_renderer, "edited", G_CALLBACK(save_celltext), view); 292 | g_signal_connect(priv->toggle_renderer, "toggled", G_CALLBACK(save_status), view); 293 | g_message("setup column"); 294 | 295 | priv->sel = gtk_tree_view_get_selection(tree); 296 | gtk_tree_selection_set_mode(priv->sel, GTK_SELECTION_MULTIPLE); 297 | 298 | return GTK_WIDGET (view); 299 | } 300 | 301 | static void 302 | outliner_view_finalize (GObject *object) 303 | { 304 | OutlinerViewPrivate *priv = OUTLINER_VIEW_GET_PRIVATE (object); 305 | 306 | /* 307 | g_object_unref (priv->action_group); 308 | g_object_unref (priv->merge); 309 | */ 310 | 311 | G_OBJECT_CLASS (parent_class)->finalize (object); 312 | } 313 | 314 | G_DEFINE_TYPE (OutlinerView, outliner_view, GTK_TYPE_TREE_VIEW); 315 | -------------------------------------------------------------------------------- /outliner/src/outliner-document.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-document.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-document.h" 25 | #include "outliner-marshal.h" 26 | 27 | #ifdef HAVE_CONFIG_H 28 | #include 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #define OUTLINER_DOCUMENT_GET_PRIVATE(obj) \ 35 | (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OUTLINER_TYPE_DOCUMENT, OutlinerDocumentPrivate)) 36 | 37 | typedef struct _OutlinerDocumentPrivate OutlinerDocumentPrivate; 38 | struct _OutlinerDocumentPrivate { 39 | gboolean changed; 40 | 41 | gint w_top, w_left, w_right, w_bottom; 42 | 43 | GArray *expanded; 44 | GSList *column_names; 45 | GString *title; 46 | GString *uri; 47 | GString *author; 48 | GString *email; 49 | }; 50 | 51 | static GtkTreeStoreClass *parent_class = NULL; 52 | 53 | static void outliner_document_init (OutlinerDocument *doc); 54 | static void outliner_document_class_init (OutlinerDocumentClass *class); 55 | static void outliner_document_finalize (GObject *object); 56 | 57 | enum { 58 | ROW_MOVED, 59 | LAST_SIGNAL 60 | }; 61 | 62 | 63 | static guint outliner_document_signals[LAST_SIGNAL] = { 0 }; 64 | 65 | static void 66 | copy_subtree (GtkTreeStore *store, GtkTreeIter *olditer, GtkTreeIter *newparent, GtkTreeIter *newsibling) 67 | { 68 | GtkTreeIter newiter, child; 69 | GtkTreePath *oldpath, *newpath; 70 | gchar *string; 71 | gboolean *status; 72 | GHashTable *attr_hash; 73 | gint i; 74 | 75 | if (newsibling) 76 | gtk_tree_store_insert_after(store, &newiter, newparent, newsibling); 77 | else 78 | gtk_tree_store_append(store, &newiter, newparent); 79 | 80 | gtk_tree_model_get(GTK_TREE_MODEL (store), olditer, COL_TEXT, &string, -1); 81 | gtk_tree_store_set(store, &newiter, COL_TEXT, string, -1); 82 | gtk_tree_model_get(GTK_TREE_MODEL (store), olditer, COL_STATUS, &status, -1); 83 | gtk_tree_store_set(store, &newiter, COL_STATUS, status, -1); 84 | gtk_tree_model_get(GTK_TREE_MODEL (store), olditer, COL_OTHER, &attr_hash, -1); 85 | gtk_tree_store_set(store, &newiter, COL_OTHER, attr_hash, -1); 86 | 87 | for (i = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), olditer); i > 0; i--) { 88 | gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &child, olditer, i-1); 89 | copy_subtree (store, &child, &newiter, NULL); 90 | } 91 | 92 | oldpath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), olditer); 93 | newpath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), &newiter); 94 | g_signal_emit(G_OBJECT (store), outliner_document_signals[ROW_MOVED], 0, oldpath, newpath); 95 | gtk_tree_path_free(oldpath); 96 | gtk_tree_path_free(newpath); 97 | 98 | } 99 | 100 | static void 101 | remove_subtree (GtkTreeStore *store, GtkTreeIter *olditer) 102 | { 103 | GtkTreeIter child; 104 | 105 | while (gtk_tree_model_iter_children(GTK_TREE_MODEL (store), &child, olditer)) 106 | remove_subtree (store, &child); 107 | 108 | gtk_tree_store_remove(store, olditer); 109 | } 110 | 111 | static void 112 | move_subtree (GtkTreeStore *store, GtkTreeIter *olditer, GtkTreeIter *newparent, GtkTreeIter *newsibling) 113 | { 114 | copy_subtree (store, olditer, newparent, newsibling); 115 | remove_subtree (store, olditer); 116 | } 117 | 118 | void 119 | outliner_document_indent (OutlinerDocument *doc, GtkTreePath *path, gpointer data) 120 | { 121 | GtkTreeIter cur, prev, new; 122 | 123 | 124 | GtkTreeModel *model = GTK_TREE_MODEL (doc); 125 | GtkTreeStore *store = GTK_TREE_STORE (doc); 126 | 127 | gtk_tree_model_get_iter(model, &cur, path); 128 | if (!gtk_tree_path_prev(path)) 129 | return; 130 | gtk_tree_model_get_iter(model, &prev, path); 131 | 132 | move_subtree (store, &cur, &prev, NULL); 133 | 134 | outliner_document_set_changed(doc, TRUE); 135 | } 136 | 137 | void 138 | outliner_document_unindent (OutlinerDocument *doc, GtkTreePath *path, gpointer data) 139 | { 140 | GtkTreeIter cur, parent, grandparent, new; 141 | 142 | GtkTreeModel *model = GTK_TREE_MODEL (doc); 143 | GtkTreeStore *store = GTK_TREE_STORE (doc); 144 | 145 | gtk_tree_model_get_iter(model, &cur, path); 146 | if (!gtk_tree_model_iter_parent(model, &parent, &cur)) 147 | return; 148 | 149 | if (gtk_tree_model_iter_parent(model, &grandparent, &parent)) 150 | move_subtree (store, &cur, &grandparent, &parent); 151 | else 152 | move_subtree (store, &cur, NULL, &parent); 153 | 154 | outliner_document_set_changed(doc, TRUE); 155 | } 156 | 157 | void 158 | outliner_document_move_up (OutlinerDocument *doc, GtkTreePath *path, gpointer data) 159 | { 160 | GtkTreeIter cur, prev; 161 | 162 | GtkTreeModel *model = GTK_TREE_MODEL (doc); 163 | GtkTreeStore *store = GTK_TREE_STORE (doc); 164 | 165 | gtk_tree_model_get_iter(model, &cur, path); 166 | if (!gtk_tree_path_prev(path)) 167 | return; 168 | gtk_tree_model_get_iter(model, &prev, path); 169 | 170 | /* this will fail on top-level items: waiting on gnome bug #139785 */ 171 | gtk_tree_store_swap(store, &cur, &prev); 172 | 173 | outliner_document_set_changed(doc, TRUE); 174 | } 175 | 176 | void 177 | outliner_document_move_down (OutlinerDocument *doc, GtkTreePath *path, gpointer data) 178 | { 179 | GtkTreeIter cur, next; 180 | 181 | GtkTreeModel *model = GTK_TREE_MODEL (doc); 182 | GtkTreeStore *store = GTK_TREE_STORE (doc); 183 | 184 | gtk_tree_model_get_iter(model, &cur, path); 185 | next = cur; 186 | gtk_tree_model_iter_next(model, &next); 187 | 188 | /* this will fail on top-level items: waiting on gnome bug #139785 */ 189 | gtk_tree_store_swap(store, &cur, &next); 190 | 191 | outliner_document_set_changed(doc, TRUE); 192 | } 193 | 194 | void 195 | outliner_document_delete_item (OutlinerDocument *doc, GtkTreePath *path, gpointer data) 196 | { 197 | GtkTreeIter cur; 198 | 199 | GtkTreeModel *model = GTK_TREE_MODEL (doc); 200 | GtkTreeStore *store = GTK_TREE_STORE (doc); 201 | 202 | gtk_tree_model_get_iter(model, &cur, path); 203 | gtk_tree_store_remove(store, &cur); 204 | 205 | outliner_document_set_changed(doc, TRUE); 206 | } 207 | 208 | 209 | /* Accesor methods */ 210 | 211 | const GString* 212 | outliner_document_get_title (OutlinerDocument *doc) 213 | { 214 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 215 | return priv->title; 216 | } 217 | 218 | const GString* 219 | outliner_document_get_author (OutlinerDocument *doc) 220 | { 221 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 222 | return priv->author; 223 | } 224 | 225 | const GString* 226 | outliner_document_get_email (OutlinerDocument *doc) 227 | { 228 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 229 | return priv->email; 230 | } 231 | 232 | const GString* 233 | outliner_document_get_uri (OutlinerDocument *doc) 234 | { 235 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 236 | return priv->uri; 237 | } 238 | 239 | gboolean 240 | outliner_document_get_changed (OutlinerDocument *doc) 241 | { 242 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 243 | return priv->changed; 244 | } 245 | 246 | gint 247 | outliner_document_get_w_top (OutlinerDocument *doc) 248 | { 249 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 250 | return priv->w_top; 251 | } 252 | 253 | gint 254 | outliner_document_get_w_left (OutlinerDocument *doc) 255 | { 256 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 257 | return priv->w_left; 258 | } 259 | 260 | gint 261 | outliner_document_get_w_right (OutlinerDocument *doc) 262 | { 263 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 264 | return priv->w_right; 265 | } 266 | 267 | gint 268 | outliner_document_get_w_bottom (OutlinerDocument *doc) 269 | { 270 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 271 | return priv->w_bottom; 272 | } 273 | 274 | const GArray* 275 | outliner_document_get_expanded(OutlinerDocument *doc) 276 | { 277 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 278 | return priv->expanded; 279 | } 280 | 281 | const GSList* 282 | outliner_document_get_column_names (OutlinerDocument *doc) 283 | { 284 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 285 | return priv->column_names; 286 | } 287 | 288 | 289 | 290 | /* Modifier methods*/ 291 | 292 | void 293 | outliner_document_set_title (OutlinerDocument *doc, gchar *title) 294 | { 295 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 296 | GString *new_title = g_string_new(title); 297 | 298 | g_string_free(priv->title, TRUE); 299 | priv->title = new_title; 300 | priv->changed = TRUE; 301 | } 302 | 303 | void 304 | outliner_document_set_author (OutlinerDocument *doc, gchar *author) 305 | { 306 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 307 | GString *new_author = g_string_new(author); 308 | g_string_free(priv->author, TRUE); 309 | priv->author = new_author; 310 | priv->changed = TRUE; 311 | } 312 | 313 | void 314 | outliner_document_set_email (OutlinerDocument *doc, gchar *email) 315 | { 316 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 317 | GString *new_email = g_string_new(email); 318 | g_string_free(priv->email, TRUE); 319 | priv->email = new_email; 320 | priv->changed = TRUE; 321 | } 322 | 323 | void 324 | outliner_document_set_uri (OutlinerDocument *doc, gchar *uri) 325 | { 326 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 327 | GString *new_uri = g_string_new(uri); 328 | g_string_free(priv->uri, TRUE); 329 | priv->uri = new_uri; 330 | } 331 | 332 | void outliner_document_set_expanded(OutlinerDocument *doc, GArray *expanded) 333 | { 334 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 335 | GArray *new_expanded = g_array_sized_new(FALSE, FALSE, sizeof(gint),expanded->len); 336 | g_array_insert_vals (new_expanded, 0, expanded->data, expanded->len); 337 | g_array_free(priv->expanded, TRUE); 338 | priv->expanded = new_expanded; 339 | } 340 | 341 | void 342 | outliner_document_set_changed (OutlinerDocument *doc, gboolean changed) 343 | { 344 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 345 | priv->changed = changed; 346 | } 347 | 348 | void 349 | outliner_document_set_w_top (OutlinerDocument *doc, gint w_top) 350 | { 351 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 352 | priv->w_top = w_top; 353 | } 354 | 355 | void 356 | outliner_document_set_w_left (OutlinerDocument *doc, gint w_left) 357 | { 358 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 359 | priv->w_left = w_left; 360 | } 361 | 362 | void 363 | outliner_document_set_w_right (OutlinerDocument *doc, gint w_right) 364 | { 365 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 366 | priv->w_right = w_right; 367 | } 368 | 369 | void 370 | outliner_document_set_w_bottom(OutlinerDocument *doc, gint w_bottom) 371 | { 372 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 373 | priv->w_bottom = w_bottom; 374 | } 375 | 376 | void outliner_document_set_column_names(OutlinerDocument *doc, GSList *column_names) 377 | { 378 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 379 | GSList* new_column_names = g_slist_copy(column_names); 380 | g_slist_free(priv->column_names); 381 | priv->column_names = new_column_names; 382 | } 383 | 384 | /*-------------*/ 385 | 386 | static void 387 | outliner_document_init (OutlinerDocument *doc) 388 | { 389 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE(doc); 390 | priv->column_names = NULL; 391 | priv->title = g_string_new("Untitled"); 392 | priv->author = g_string_new(NULL); 393 | priv->email = g_string_new(NULL); 394 | priv->uri = g_string_new(NULL); 395 | priv->changed = FALSE; 396 | } 397 | 398 | static void 399 | outliner_document_class_init (OutlinerDocumentClass *class) 400 | { 401 | GObjectClass *object_class = G_OBJECT_CLASS (class); 402 | parent_class = g_type_class_peek_parent (class); 403 | 404 | object_class->finalize = outliner_document_finalize; 405 | 406 | outliner_document_signals[ROW_MOVED] = 407 | g_signal_new ("row_moved", 408 | OUTLINER_TYPE_DOCUMENT, 409 | G_SIGNAL_RUN_FIRST, 410 | G_STRUCT_OFFSET (OutlinerDocumentClass, row_moved), 411 | NULL, NULL, 412 | outliner_marshal_VOID__POINTER_POINTER, 413 | G_TYPE_NONE, 2, 414 | G_TYPE_POINTER, G_TYPE_POINTER); 415 | 416 | g_type_class_add_private (class, sizeof (OutlinerDocumentPrivate)); 417 | } 418 | 419 | OutlinerDocument * 420 | outliner_document_new (void) 421 | { 422 | OutlinerDocument *doc; 423 | 424 | doc = g_object_new (OUTLINER_TYPE_DOCUMENT, 425 | NULL); 426 | 427 | GType columns[] = { G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_POINTER }; 428 | 429 | gtk_tree_store_set_column_types (GTK_TREE_STORE (doc), NUM_COLS, columns); 430 | 431 | return doc; 432 | } 433 | 434 | static void 435 | outliner_document_finalize (GObject *object) 436 | { 437 | OutlinerDocumentPrivate *priv = OUTLINER_DOCUMENT_GET_PRIVATE (object); 438 | 439 | G_OBJECT_CLASS (parent_class)->finalize (object); 440 | } 441 | 442 | G_DEFINE_TYPE (OutlinerDocument, outliner_document, GTK_TYPE_TREE_STORE); 443 | -------------------------------------------------------------------------------- /outliner/src/outliner-window.c: -------------------------------------------------------------------------------- 1 | /** 2 | * outliner-window.c 3 | * 4 | * Gnome Outliner is the legal property of its developers, whose names are 5 | * too numerous to list here. Please refer to the COPYRIGHT file distributed 6 | * with this source distribution. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #include "outliner-window.h" 25 | #include "outliner-actions.h" 26 | #include "outliner-view.h" 27 | #include "outliner-document.h" 28 | 29 | #ifdef HAVE_CONFIG_H 30 | #include 31 | #endif 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #define OUTLINER_WINDOW_GET_PRIVATE(obj) \ 39 | (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OUTLINER_TYPE_WINDOW, OutlinerWindowPrivate)) 40 | 41 | typedef struct _OutlinerWindowPrivate OutlinerWindowPrivate; 42 | struct _OutlinerWindowPrivate { 43 | GtkUIManager *merge; 44 | GtkActionGroup *action_group; 45 | 46 | GtkWidget *vbox; 47 | GtkWidget *sw; 48 | GtkWidget *view; 49 | GtkWidget *statusbar; 50 | }; 51 | 52 | static GtkWindowClass *parent_class = NULL; 53 | 54 | static void outliner_window_init (OutlinerWindow *window); 55 | static void outliner_window_class_init (OutlinerWindowClass *window); 56 | static void outliner_window_finalize (GObject *object); 57 | 58 | static GtkActionEntry action_entries[] = { 59 | { "FileMenuAction", NULL, N_("_File") }, 60 | { "EditMenuAction", NULL, N_("_Edit") }, 61 | { "OutlineMenuAction", NULL, N_("_Outline") }, 62 | { "HelpMenuAction", NULL, N_("_Help") }, 63 | 64 | /* File Menu */ 65 | { "NewAction", GTK_STOCK_NEW, NULL, NULL, 66 | N_("Create a new outline"), G_CALLBACK (outliner_action_new) }, 67 | { "OpenAction", GTK_STOCK_OPEN, NULL, NULL, 68 | N_("Open an outline"), G_CALLBACK (outliner_action_open) }, 69 | { "OpenLocationAction", NULL, N_("Open _Location..."), "L", 70 | N_("Open an outline at a specified location"), G_CALLBACK (outliner_action_open_location) }, 71 | 72 | { "SaveAction", GTK_STOCK_SAVE, NULL, NULL, 73 | N_("Save this outline to current file"), G_CALLBACK (outliner_action_save) }, 74 | { "SaveAsAction", GTK_STOCK_SAVE_AS, NULL, NULL, 75 | N_("Save this outline to a file"), G_CALLBACK (outliner_action_save_as) }, 76 | { "ExportAction", NULL, N_("E_xport"), "X", 77 | N_("Export this outline to another format"), G_CALLBACK (outliner_action_export) }, 78 | 79 | { "PrintPreviewAction", GTK_STOCK_PRINT_PREVIEW, NULL, NULL, 80 | NULL, G_CALLBACK (outliner_action_dummy) }, 81 | { "PrintAction", GTK_STOCK_PRINT, NULL, NULL, 82 | N_("Print this outline"), G_CALLBACK (outliner_action_dummy) }, 83 | 84 | { "PropertiesAction", GTK_STOCK_PROPERTIES, NULL, NULL, 85 | N_("Show the properties of this outline"), G_CALLBACK (outliner_action_properties) }, 86 | 87 | { "QuitAction", GTK_STOCK_QUIT, NULL, NULL, 88 | N_("Quit Gnome Outliner"), G_CALLBACK(outliner_action_quit) }, 89 | 90 | /* Edit Menu */ 91 | { "UndoAction", GTK_STOCK_UNDO, NULL, "Z", 92 | N_("Undo the last action"), G_CALLBACK (outliner_action_dummy) }, 93 | { "RedoAction", GTK_STOCK_REDO, NULL, "Z", 94 | N_("Redo the undone action"), G_CALLBACK (outliner_action_dummy) }, 95 | { "CutAction", GTK_STOCK_CUT, NULL, NULL, 96 | N_("Cut selection to the clipboard"), G_CALLBACK (outliner_action_dummy) }, 97 | { "CopyAction", GTK_STOCK_COPY, NULL, NULL, 98 | N_("Copy selection to the clipboard"), G_CALLBACK (outliner_action_dummy) }, 99 | { "PasteAction", GTK_STOCK_PASTE, NULL, NULL, 100 | N_("Paste the clipboard contents"), G_CALLBACK (outliner_action_dummy) }, 101 | { "DeleteAction", GTK_STOCK_DELETE, NULL, NULL, 102 | N_("Delete selection"), G_CALLBACK (outliner_action_delete_item) }, 103 | { "SelectAllAction", NULL, N_("Select _All"), "A", 104 | N_("Select entire outline"), G_CALLBACK (outliner_action_select_all) }, 105 | { "PreferencesAction", GTK_STOCK_PREFERENCES, NULL, NULL, 106 | N_("Edit application preferences"), G_CALLBACK (outliner_action_dummy) }, 107 | 108 | /* Outline Menu */ 109 | { "AddItemAction", GTK_STOCK_ADD, N_("_Add Item"), NULL, 110 | N_("Add a new item"), G_CALLBACK (outliner_action_add_item) }, 111 | { "IndentAction", GTK_STOCK_GO_FORWARD, N_("_Indent"), "Tab", 112 | N_("Indent the current selection"), G_CALLBACK (outliner_action_indent) }, 113 | { "UnindentAction", GTK_STOCK_GO_BACK, N_("_Unindent"), "Tab", 114 | N_("Unindent the current selection"), G_CALLBACK (outliner_action_unindent) }, 115 | { "MoveUpAction", GTK_STOCK_GO_UP, N_("Move _Up"), "Up", 116 | N_("Move the current selection up"), G_CALLBACK (outliner_action_move_up) }, 117 | { "MoveDownAction", GTK_STOCK_GO_DOWN, N_("Move _Down"), "Down", 118 | N_("Move the current selection down"), G_CALLBACK (outliner_action_move_down) }, 119 | 120 | { "ExpandAllAction", NULL, N_("E_xpand All"), NULL, 121 | N_("Expand all items"), G_CALLBACK (outliner_action_expand_all) }, 122 | { "CollapseAllAction", NULL, N_("_Collapse All"), NULL, 123 | N_("Collapse all items"), G_CALLBACK (outliner_action_collapse_all) }, 124 | 125 | /* Help Menu */ 126 | { "AboutAction", GNOME_STOCK_ABOUT, NULL, NULL, 127 | N_("About Gnome Outliner"), G_CALLBACK (outliner_action_about) } 128 | }; 129 | 130 | static const gchar *ui_info = 131 | "" 132 | "" 133 | " " 134 | " " 135 | " " 136 | " " 137 | " " 138 | " " 139 | " " 140 | " " 141 | " " 142 | " " 143 | " " 144 | " " 145 | " " 146 | " " 147 | " " 148 | " " 149 | " " 150 | " " 151 | " " 152 | " " 153 | " " 154 | " " 155 | " " 156 | " " 157 | " " 158 | " " 159 | " " 160 | " " 161 | " " 162 | " " 163 | " " 164 | " " 165 | " " 166 | " " 167 | " " 168 | " " 169 | " " 170 | " " 171 | " " 172 | " " 173 | " " 174 | " " 175 | "" 176 | "" 177 | " " 178 | " " 179 | " " 180 | " " 181 | " " 182 | " " 183 | " " 184 | " " 185 | "" 186 | ""; 187 | 188 | OutlinerView * 189 | outliner_window_get_view (OutlinerWindow *window) { 190 | OutlinerWindowPrivate *priv = OUTLINER_WINDOW_GET_PRIVATE (window); 191 | return OUTLINER_VIEW (priv->view); 192 | } 193 | 194 | static void 195 | set_tip (GtkWidget *proxy, 196 | OutlinerWindow *window) 197 | { 198 | OutlinerWindowPrivate *priv; 199 | GtkAction *action; 200 | gchar *tooltip; 201 | 202 | priv = OUTLINER_WINDOW_GET_PRIVATE (window); 203 | 204 | action = g_object_get_data (G_OBJECT (proxy), "gtk-action"); 205 | g_return_if_fail (action != NULL); 206 | 207 | g_object_get (G_OBJECT (action), "tooltip", &tooltip, NULL); 208 | 209 | if (tooltip) { 210 | gtk_statusbar_push (GTK_STATUSBAR (priv->statusbar), 0, tooltip); 211 | g_free (tooltip); 212 | } 213 | } 214 | 215 | static void 216 | unset_tip (GtkWidget *proxy, 217 | OutlinerWindow *window) 218 | { 219 | OutlinerWindowPrivate *priv = OUTLINER_WINDOW_GET_PRIVATE (window); 220 | 221 | gtk_statusbar_pop (GTK_STATUSBAR (priv->statusbar), 0); 222 | } 223 | 224 | static void 225 | merge_connect_proxy (GtkUIManager *merge, 226 | GtkAction *action, 227 | GtkWidget *proxy, 228 | gpointer data) 229 | { 230 | gchar *tooltip; 231 | 232 | if (GTK_IS_MENU_ITEM (proxy)) 233 | { 234 | g_object_get (G_OBJECT (action), "tooltip", &tooltip, NULL); 235 | 236 | if (tooltip) { 237 | g_object_set_data (G_OBJECT (proxy), "action-tooltip", tooltip); 238 | 239 | g_signal_connect (proxy, "select", G_CALLBACK (set_tip), data); 240 | g_signal_connect (proxy, "deselect", G_CALLBACK (unset_tip), data); 241 | } 242 | } 243 | } 244 | 245 | static void 246 | merge_disconnect_proxy (GtkUIManager *merge, 247 | GtkAction *action, 248 | GtkWidget *proxy, 249 | gpointer data) 250 | { 251 | gchar *tooltip; 252 | 253 | if (GTK_IS_MENU_ITEM (proxy)) 254 | { 255 | g_signal_handlers_disconnect_by_func (proxy, set_tip, data); 256 | g_signal_handlers_disconnect_by_func (proxy, unset_tip, data); 257 | 258 | tooltip = g_object_get_data (G_OBJECT (proxy), "action-tooltip"); 259 | g_warning ("discon: %s", tooltip); 260 | g_free (tooltip); 261 | } 262 | } 263 | 264 | static void 265 | merge_add_widget (GtkUIManager *merge, 266 | GtkWidget *widget, 267 | GtkContainer *container) 268 | { 269 | gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); 270 | gtk_widget_show (widget); 271 | } 272 | 273 | #define IS_TAB(x) ((x == GDK_Tab) || (x == GDK_ISO_Left_Tab) || (x == GDK_KP_Tab)) 274 | 275 | static gboolean 276 | key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) 277 | { 278 | OutlinerWindow *window = data; 279 | OutlinerWindowPrivate *priv = OUTLINER_WINDOW_GET_PRIVATE (window); 280 | 281 | /* intercept Tab or Left Arrow */ 282 | if (event->keyval == GDK_Left || 283 | (IS_TAB(event->keyval) && (event->state & GDK_SHIFT_MASK))) { 284 | outliner_action_unindent(gtk_ui_manager_get_action(priv->merge, "/ui/Outline/UnindentAction"), window); 285 | return TRUE; 286 | } 287 | /* intercept Tab or Right Arrow */ 288 | else if (IS_TAB(event->keyval) || event->keyval == GDK_Right) { 289 | outliner_action_indent(gtk_ui_manager_get_action(priv->merge, "/ui/Outline/IndentAction"), window); 290 | return TRUE; 291 | } 292 | /* intercept Return */ 293 | else if (event->keyval == GDK_Return) { 294 | outliner_action_add_item(gtk_ui_manager_get_action(priv->merge, "/ui/Outline/UnindentAction"), window); 295 | return TRUE; 296 | } 297 | /* intercept Delete */ 298 | else if (event->keyval == GDK_Delete) { 299 | outliner_action_delete_item(gtk_ui_manager_get_action(priv->merge, "/ui/Outline/DeleteAction"), window); 300 | return TRUE; 301 | } 302 | return FALSE; 303 | } 304 | 305 | static gboolean 306 | on_delete(GtkWidget *widget, gpointer data) 307 | { 308 | OutlinerWindow *window = (OutlinerWindow*) widget; 309 | outliner_action_quit(NULL, window); 310 | 311 | } 312 | 313 | static void 314 | outliner_onDragDataReceived(GtkWidget *widget, GdkDragContext *context, 315 | int x, int y, GtkSelectionData *seldata, guint info, 316 | guint time, gpointer userdata) 317 | { 318 | OutlinerWindow *window; 319 | OutlinerView *view; 320 | OutlinerDocument *doc; 321 | GtkTreeIter cur, new; 322 | 323 | window = OUTLINER_WINDOW(userdata); 324 | view = outliner_window_get_view(window); 325 | doc = outliner_view_get_document(view); 326 | 327 | if (outliner_view_get_last_selected(view, &cur)) { 328 | if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL (doc), &cur)) 329 | gtk_tree_store_prepend(GTK_TREE_STORE (doc), &new, &cur); 330 | else 331 | gtk_tree_store_insert_after(GTK_TREE_STORE (doc), &new, NULL, &cur); 332 | } 333 | else 334 | gtk_tree_store_prepend(GTK_TREE_STORE (doc), &new, NULL); 335 | 336 | gtk_tree_store_set(GTK_TREE_STORE(doc), &new, COL_TEXT, (gchar*)seldata->data, -1); 337 | } 338 | 339 | static void 340 | outliner_window_init (OutlinerWindow *window) 341 | { 342 | GError *error = NULL; 343 | OutlinerWindowPrivate *priv = OUTLINER_WINDOW_GET_PRIVATE (window); 344 | 345 | priv->vbox = gtk_vbox_new (FALSE, 0); 346 | gtk_container_add (GTK_CONTAINER (window), priv->vbox); 347 | gtk_widget_show (priv->vbox); 348 | 349 | priv->statusbar = gtk_statusbar_new (); 350 | gtk_box_pack_end (GTK_BOX (priv->vbox), priv->statusbar, FALSE, TRUE, 0); 351 | gtk_widget_show (priv->statusbar); 352 | 353 | priv->sw = gtk_scrolled_window_new (0, 0); 354 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(priv->sw), 355 | GTK_POLICY_AUTOMATIC, 356 | GTK_POLICY_AUTOMATIC); 357 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(priv->sw), 358 | GTK_SHADOW_IN); 359 | 360 | priv->view = outliner_view_new (outliner_document_new ()); 361 | gtk_container_add (GTK_CONTAINER (priv->sw), priv->view); 362 | gtk_box_pack_end (GTK_BOX (priv->vbox), priv->sw, TRUE, TRUE, 0); 363 | gtk_widget_show (priv->view); 364 | gtk_widget_show (priv->sw); 365 | 366 | priv->action_group = gtk_action_group_new ("OutlinerWindowActions"); 367 | gtk_action_group_add_actions (priv->action_group, action_entries, 368 | G_N_ELEMENTS (action_entries), window); 369 | 370 | priv->merge = gtk_ui_manager_new (); 371 | gtk_ui_manager_insert_action_group (priv->merge, priv->action_group, 0); 372 | g_signal_connect (priv->merge, "add-widget", 373 | G_CALLBACK (merge_add_widget), priv->vbox); 374 | g_signal_connect (priv->merge, "connect-proxy", 375 | G_CALLBACK (merge_connect_proxy), window); 376 | 377 | /* Set up drag and drop from external apps */ 378 | enum { 379 | TARGET_STRING, 380 | TARGET_URL 381 | }; 382 | 383 | static GtkTargetEntry targetentries[] = 384 | { 385 | { "STRING", 0, TARGET_STRING }, 386 | { "text/plain", 0, TARGET_STRING }, 387 | { "text/uri-list", 0, TARGET_URL }, 388 | }; 389 | 390 | gtk_drag_dest_set(GTK_WIDGET(window), GTK_DEST_DEFAULT_ALL, targetentries, 3, 391 | GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_LINK); 392 | 393 | g_signal_connect(window, "drag_data_received", 394 | G_CALLBACK(outliner_onDragDataReceived), window); 395 | 396 | if (!gtk_ui_manager_add_ui_from_string (priv->merge, ui_info, -1, &error)) { 397 | g_message ("%s", error->message); 398 | g_error_free (error); 399 | gtk_exit(0); 400 | } 401 | 402 | /* 403 | if (!gtk_ui_manager_add_ui_from_file (priv->merge, PACKAGE_DATA_DIR"ui.xml", &error)) { 404 | g_message ("%s", error->message); 405 | g_error_free (error); 406 | g_message ("Trying source dir instead: %s", PACKAGE_SOURCE_DIR"/data/ui.xml"); 407 | if (!gtk_ui_manager_add_ui_from_file (priv->merge, PACKAGE_SOURCE_DIR"/data/ui.xml", &error)) { 408 | g_message ("%s", error->message); 409 | g_error_free (error); 410 | gtk_exit(0); 411 | } 412 | } 413 | */ 414 | 415 | gtk_window_add_accel_group(GTK_WINDOW (window), 416 | gtk_ui_manager_get_accel_group(priv->merge)); 417 | 418 | gtk_ui_manager_ensure_update(priv->merge); 419 | 420 | gtk_window_set_title(GTK_WINDOW (window), _("Gnome Outliner")); 421 | gtk_window_set_default_size(GTK_WINDOW(window), 600, 400); 422 | 423 | gtk_widget_show(GTK_WIDGET(window)); 424 | outliner_view_add_item(OUTLINER_VIEW(priv->view)); 425 | 426 | g_signal_connect(G_OBJECT (priv->view), "key_press_event", 427 | G_CALLBACK(key_press_cb), window); 428 | g_signal_connect(G_OBJECT (window), "delete_event", G_CALLBACK(on_delete), NULL); 429 | } 430 | 431 | static void 432 | outliner_window_class_init (OutlinerWindowClass *class) 433 | { 434 | GObjectClass *object_class = G_OBJECT_CLASS (class); 435 | parent_class = g_type_class_peek_parent (class); 436 | 437 | object_class->finalize = outliner_window_finalize; 438 | 439 | g_type_class_add_private (class, sizeof (OutlinerWindowPrivate)); 440 | } 441 | 442 | GtkWidget * 443 | outliner_window_new (void) 444 | { 445 | return g_object_new (OUTLINER_TYPE_WINDOW, NULL); 446 | } 447 | 448 | static void 449 | outliner_window_finalize (GObject *object) 450 | { 451 | OutlinerWindowPrivate *priv = OUTLINER_WINDOW_GET_PRIVATE (object); 452 | 453 | g_object_unref (priv->action_group); 454 | g_object_unref (priv->merge); 455 | 456 | G_OBJECT_CLASS (parent_class)->finalize (object); 457 | } 458 | 459 | G_DEFINE_TYPE (OutlinerWindow, outliner_window, GTK_TYPE_WINDOW); 460 | 461 | -------------------------------------------------------------------------------- /outliner/COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | --------------------------------------------------------------------------------