[Geany-devel] GProject - the second attempt

Jiří Techet techet at xxxxx
Sat Jul 3 22:54:17 UTC 2010

Hi everybody,

here's my second attempt to create a project management plugin for big projects:


and here's a screenshot for those who are scared to compile and install it ;-) :


The main change since the first version is that now it extends the
current project management rather than trying to replace it. One
consequence is that now only a single project can be open at a time
but the rest of the functionality is preserved (header/source
swapping, finding project file, tag generation for all project files,
search in only those files that satisfy the given pattern). One more
change is that the project base path is used to define the directory
that should be scanned for project files.

This time I did my best to integrate the plugin to geany as well as
possible so there are more patches for geany itself than before. Apart
from patches needed for gproject there are several more patches that
fix some bugs in geany or are meant to improve the usability. The
geany patches are here:


under the "for_review" branch. Below there is a detailed log of the
changes. I expect some discussion for some of the patches (they
represent my view on the problem but you may have a different opinion)
so when replying to this email it's probably best to take the commit
title as the email's title and also keep the detailed commit message
in the body of the email so everybody knows what we're talking about.
Once there is some agreement about the future of the patches, I can
resend them by email - I just don't want to spam the mailing list with
too many messages.

Finally, I have renamed the original gproject to "multiproject" and
it's available together with the geany patches here:


I probably won't maintain it any longer since the new version of the
plugin is much more compatible with the geany handling of projects. If
anyone wishes to take over the old plugin, feel free to do so.



commit 8b9e9c923197180a6ebc592b3f6f5c7205b0338a
Author: Jiří Techet <techet at gmail.com>
Date:   Sat Jul 3 23:49:03 2010 +0200

    Rewrite tab switching queue

    There was one more bug related to the tab switching. When we switch
    so many times that we return back to the original document (so we
    actually don't switch at all) then the following switch attempt
    doesn't switch immediately to the next document.

    After spending two hours thinking what is wrong, I gave up and rewrote
    the whole thing in a different way. The problem with the previous
    implementation was that before you couldn't just look what's in the queue
    "now" - you had to imagine what will be inserted there in the next step
    because the switch_in_progress variable was set after the first switch
    (this is also why I put the long comment why mru_pos = 2 - that is not
    clear at all when you first look at it). Also there were some not very
    nice "workarounds" like the idle function that was executed after the
    switch and removed the double entry on top of the queue.

    So with the new implementation things are much simpler IMO. The queue
    starts with the current document and the previously opened documments
    follow. It's *always* like that, no exceptions. The idle function
    is gone and cb_func_switch_tablastused() is simplified too. The rest of
    the functionality should be clear from the code.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/keybindings.c |   61 +++++++++++++++++++++-------------------------------
 1 files changed, 25 insertions(+), 36 deletions(-)

commit 430c3409fbbd47816ddce95f6c055143683d9ecc
Author: Jiří Techet <techet at gmail.com>
Date:   Sat Jul 3 01:27:10 2010 +0200

    Remove the "set" button from the project properties dialog

    Unless I miss something the button just adds %d to the corresponding
    fields, but this is already the default settings so I don't see any
    point of doing it.

 src/build.c   |   12 ------------
 src/build.h   |    2 --
 src/project.c |   30 +++---------------------------
 3 files changed, 3 insertions(+), 41 deletions(-)

commit 61d21ddfbdb84b2da2e1b11f7aae15ae1fb7a4dc
Author: Jiří Techet <techet at gmail.com>
Date:   Fri Jul 2 00:03:56 2010 +0200

    Use relative paths in the project files

    Right now projects cannot be moved to other directories without
    losing the base directory setting of the project and the list
    of open files. This makes the project totally unportable to different
    machines because even if the directory structure under your home is
    identical, the user name can be different so the path is different too.

    The paths should be relative to the project file, which is what
    every other IDE I know does. If you keep the project file in the
    same relative path to the project files, you can move it wherever you

    This patch does this in a backwards-compatible way - when the path
    in the project settings file is absolute, it uses the absoulte path.
    However, when the project is saved, all paths are converted to relative.
    This means that all new applications will be able to read the old
    project definition files but the old applications won't read
    the new files (or more precisely, the paths in them).

    For the global session file absolute paths are still used mainly because in
    Windows you cannot create a relative path to a different volume and the
    global settings file can be at a volume different from the project dir.
    (I don't expect anyone has the project definition file at different
    volume than the project files so this shouldn't be an issue for projects).

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/keyfile.c |   39 ++++++++++++++++++++++++++++++++++-----
 src/keyfile.h |    2 +-
 src/project.c |   26 +++++++++++++++++++++++---
 3 files changed, 58 insertions(+), 9 deletions(-)

commit 54946954e282768e1a03493804fd6b1f9c8aa4ff
Author: Jiří Techet <techet at gmail.com>
Date:   Thu Jul 1 22:55:15 2010 +0200

    File name in the project settings dialog shouldn't look it is editable

    Use selectable GtkLabel so it's possible to copy the file name but
    it is immediatelly clear that it cannot be edited.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/project.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

commit 73e0e38dc348fcba0d5860d824a367c2b3ebb712
Author: Jiří Techet <techet at gmail.com>
Date:   Thu Jul 1 22:46:46 2010 +0200

    New utils function to get relative path from one directory to another

    This is used by the patch that writes relative paths to the project
    file. I put it to utils because I use it in gproject as well and
    might be useful for others.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 plugins/geanyfunctions.h |    2 ++
 src/plugindata.h         |    2 +-
 src/plugins.c            |    3 ++-
 src/utils.c              |   41 +++++++++++++++++++++++++++++++++++++++++
 src/utils.h              |    2 ++
 5 files changed, 48 insertions(+), 2 deletions(-)

commit b708498f0fe312d4b7eed2674ea27732a9d00c75
Author: Jiří Techet <techet at gmail.com>
Date:   Thu Jul 1 01:51:18 2010 +0200

    Use wider entry for project file path

    30 is too little. For instance


    is 39 characters long and this is really short path. I find 50
    characters to be about minimal usable size so users do not have
    to scroll inside the edit box too often.

 src/project.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

commit 590b694964a6441c1e0e1aa75baaf341919d4146
Author: Jiří Techet <techet at gmail.com>
Date:   Thu Jul 1 01:50:49 2010 +0200

    When closing tab, return to the document at the top of the MRU list

    This is a pretty frequent work pattern of mine:

    1. Editing file A
    2. Searching for function and opening file B
    3. Closing file B because I just wanted to look at the function definition
    4. Without this patch I get to the file following the B's tab (which
    is just a random file) but my brain expects that I get to A

    I know it's possible to kind of simulate the behaviour I want with
    the "next to current" placement option but I really don't see a single
    advantage of having tabs closed in sequential order. This is also
    why I didn't make this behaviour optional. But maybe I miss some
    use case of tabs being closed sequentially - just tell me.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/keybindings.c |   10 ++++++++++
 src/notebook.c    |    9 ---------
 2 files changed, 10 insertions(+), 9 deletions(-)

commit 3c93a352849736f8da89b3bdd3f6ac00ec2bc006
Author: Jiří Techet <techet at gmail.com>
Date:   Mon Jun 28 23:22:26 2010 +0200

    Open the file in the msgwindow even if no linenumber is specified

    Plugins may need to open a file from the message window without
    specifying the line number (e.g. gproject has the feature "find project
    file"). In addition to the original behaviour this patch makes it possible
    to open files when the message is of the form


    so for instance

    /home/techet/geany/foo.c: this the file you were searching for

    are both valid and the file is opened when the message is clicked.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/msgwindow.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

commit 9f3fdbb165ecbcad938785090f8d594a74d97960
Author: Jiří Techet <techet at gmail.com>
Date:   Wed Jun 30 00:02:13 2010 +0200

    Make it possible for plugins to change the base directory of msgwindow

    Plugins might want to open file relatively to certain directory
    so make it possible by this patch.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 plugins/geanyfunctions.h |    2 ++
 src/msgwindow.c          |   23 +++++++++++++++++++----
 src/msgwindow.h          |    4 +++-
 src/plugindata.h         |    1 +
 src/plugins.c            |    3 ++-
 src/search.c             |    3 +--
 6 files changed, 28 insertions(+), 8 deletions(-)

commit f5085f2264fa83cd2f074667a6359be2ffff9f19
Author: Jiří Techet <techet at gmail.com>
Date:   Tue Jun 29 23:54:52 2010 +0200

    Don't be annoying when not necessary

    When reloading a file with ctrl+R don't display the warning dialog
    that the unsaved changes might be lost when the file has not been

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/callbacks.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

commit 0a1bfd3e8a9367a8f1fe15d4048d923ebb0630c2
Author: Jiří Techet <techet at gmail.com>
Date:   Mon Jun 28 23:19:37 2010 +0200

    Make it possible to change project patterns by plugins

    Plugins can override project patterns. In that case the "file patterns"
    field is made inactive in the Project tab of the project properties

    Signed-off-by: Jiří Techet <techet at gmail.com>

 plugins/geanyfunctions.h |    2 +
 src/plugindata.h         |    9 +++++++
 src/plugins.c            |    8 +++++-
 src/project.c            |   57 +++++++++++++++++++++++++++++----------------
 src/project.h            |    1 +
 5 files changed, 56 insertions(+), 21 deletions(-)

commit 5bc03552353655f45af696b14792ed987be81680
Author: Jiří Techet <techet at gmail.com>
Date:   Mon Jun 28 23:18:12 2010 +0200

    Use project patterns in the FIF dialog

    When "use project patterns" is selected, the project patterns are copied
    to the "files" edit box and it becomes not editable. It should be considered
    whether the "files" checkbox should exist - it may not be clear if the
    edit box is greyed out because "use project patterns" is selected or because
    "files" is unselected. The "use project patterns" checkbox is inactive when
    no project is loaded.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/search.c |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 52 insertions(+), 5 deletions(-)

commit a2094786952d1b5a3a6eac8ecf965a245ec97668
Author: Jiří Techet <techet at gmail.com>
Date:   Sun Jun 27 22:53:27 2010 +0200

    Make the project menu accessible by plugins

    Not really a hard requirement but since the project plugin settings
    can now be also integrated to the project settings dialog, it
    looks strange when the project-related items are in the Tools menu.

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/main.c     |    1 +
 src/ui_utils.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

commit 7695f16a2a57e0dd973a3f0bd441fb1717c1cbfa
Author: Jiří Techet <techet at gmail.com>
Date:   Sun Jun 27 22:52:54 2010 +0200

    Add signals for project options dialog opening and closing

    These signals can be used by plugins to add their settings tab and
    read the settings when the user presses OK. The code had to be
    reorganized slightly because first project-dialog-confirmed has
    to be emitted (so the plugin can read the settings) and project-save

    Signed-off-by: Jiří Techet <techet at gmail.com>

 doc/pluginsignals.c |   19 +++++++++++++++++++
 src/geanyobject.c   |   18 ++++++++++++++++++
 src/geanyobject.h   |    4 ++++
 src/project.c       |   14 +++++++++-----
 4 files changed, 50 insertions(+), 5 deletions(-)

commit 923259ca214403ada159749aa838c9e34d37c154
Author: Jiří Techet <techet at gmail.com>
Date:   Sat Jun 5 14:24:06 2010 +0200

    Prevent -Wmissing-prototypes report warning when compiling a plugin

    Signed-off-by: Jiří Techet <techet at gmail.com>

 src/plugindata.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

More information about the Devel mailing list