1999-02-04 01:31:33 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2007-06-06 08:44:52 +00:00
|
|
|
* This is a plug-in for GIMP.
|
1999-02-04 01:31:33 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1999 Andy Thomas alt@picnic.demon.co.uk
|
|
|
|
*
|
2000-07-16 12:49:04 +00:00
|
|
|
* Note some portions of the UI comes from the dbbrowser plugin.
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1999-02-04 01:31:33 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1999-02-04 01:31:33 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-02-04 01:31:33 +00:00
|
|
|
*/
|
|
|
|
|
2000-01-08 15:23:28 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
1999-02-04 01:31:33 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2000-01-08 15:23:28 +00:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2000-02-28 00:45:58 +00:00
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
2000-01-08 15:23:28 +00:00
|
|
|
|
2000-01-03 13:01:51 +00:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2000-05-01 17:01:18 +00:00
|
|
|
|
2005-08-15 11:07:27 +00:00
|
|
|
#define PLUG_IN_PROC "plug-in-plug-in-details"
|
|
|
|
#define PLUG_IN_BINARY "plugin-browser"
|
2011-04-08 20:31:34 +02:00
|
|
|
#define PLUG_IN_ROLE "gimp-plugin-browser"
|
2005-05-18 22:21:07 +00:00
|
|
|
#define DBL_LIST_WIDTH 250
|
|
|
|
#define DBL_WIDTH (DBL_LIST_WIDTH + 400)
|
|
|
|
#define DBL_HEIGHT 250
|
|
|
|
|
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-05-18 22:21:07 +00:00
|
|
|
LIST_COLUMN_NAME,
|
|
|
|
LIST_COLUMN_DATE,
|
2005-10-12 10:12:36 +00:00
|
|
|
LIST_COLUMN_DATE_STRING,
|
2005-05-18 22:21:07 +00:00
|
|
|
LIST_COLUMN_PATH,
|
|
|
|
LIST_COLUMN_IMAGE_TYPES,
|
|
|
|
LIST_COLUMN_PINFO,
|
|
|
|
N_LIST_COLUMNS
|
2004-09-30 00:33:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_PATH_NAME,
|
|
|
|
TREE_COLUMN_DATE,
|
2005-10-12 10:12:36 +00:00
|
|
|
TREE_COLUMN_DATE_STRING,
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_IMAGE_TYPES,
|
|
|
|
TREE_COLUMN_MPATH,
|
|
|
|
TREE_COLUMN_PINFO,
|
|
|
|
N_TREE_OLUMNS
|
2004-09-30 00:33:34 +00:00
|
|
|
};
|
|
|
|
|
2003-10-01 22:52:27 +00:00
|
|
|
typedef struct
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2004-09-30 00:33:34 +00:00
|
|
|
GtkWidget *dialog;
|
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
GtkWidget *browser;
|
2004-09-30 10:57:57 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
GtkTreeView *list_view;
|
|
|
|
GtkTreeView *tree_view;
|
2004-09-30 10:57:57 +00:00
|
|
|
} PluginBrowser;
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *menu;
|
|
|
|
gchar *accel;
|
|
|
|
gchar *prog;
|
2019-09-08 14:54:17 +02:00
|
|
|
gchar *procedure;
|
|
|
|
gint instime;
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
} PInfo;
|
|
|
|
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
typedef struct _Browser Browser;
|
|
|
|
typedef struct _BrowserClass BrowserClass;
|
|
|
|
|
|
|
|
struct _Browser
|
|
|
|
{
|
|
|
|
GimpPlugIn parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _BrowserClass
|
|
|
|
{
|
|
|
|
GimpPlugInClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Declare local functions.
|
1999-02-04 01:31:33 +00:00
|
|
|
*/
|
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
#define BROWSER_TYPE (browser_get_type ())
|
|
|
|
#define BROWSER (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BROWSER_TYPE, Browser))
|
|
|
|
|
|
|
|
GType browser_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
static GList * browser_query_procedures (GimpPlugIn *plug_in);
|
|
|
|
static GimpProcedure * browser_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name);
|
|
|
|
|
|
|
|
static GimpValueArray * browser_run (GimpProcedure *procedure,
|
2023-06-15 16:53:54 +02:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-06 19:11:56 +02:00
|
|
|
gpointer run_data);
|
2000-02-28 00:45:58 +00:00
|
|
|
|
2004-09-30 10:57:57 +00:00
|
|
|
static GtkWidget * browser_dialog_new (void);
|
|
|
|
static void browser_dialog_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
PluginBrowser *browser);
|
|
|
|
static void browser_list_selection_changed (GtkTreeSelection *selection,
|
|
|
|
PluginBrowser *browser);
|
|
|
|
static void browser_tree_selection_changed (GtkTreeSelection *selection,
|
|
|
|
PluginBrowser *browser);
|
2004-01-17 00:26:49 +00:00
|
|
|
|
2004-09-30 10:57:57 +00:00
|
|
|
static gboolean find_existing_mpath (GtkTreeModel *model,
|
2005-10-19 20:34:20 +00:00
|
|
|
const gchar *mpath,
|
2004-09-30 10:57:57 +00:00
|
|
|
GtkTreeIter *return_iter);
|
2004-01-17 00:26:49 +00:00
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
G_DEFINE_TYPE (Browser, browser, GIMP_TYPE_PLUG_IN)
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
GIMP_MAIN (BROWSER_TYPE)
|
2022-05-26 00:59:36 +02:00
|
|
|
DEFINE_STD_SET_I18N
|
1999-02-04 01:31:33 +00:00
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
|
1999-02-04 01:31:33 +00:00
|
|
|
static void
|
2019-08-06 19:11:56 +02:00
|
|
|
browser_class_init (BrowserClass *klass)
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2019-08-06 19:11:56 +02:00
|
|
|
GimpPlugInClass *plug_in_class = GIMP_PLUG_IN_CLASS (klass);
|
|
|
|
|
|
|
|
plug_in_class->query_procedures = browser_query_procedures;
|
|
|
|
plug_in_class->create_procedure = browser_create_procedure;
|
2022-05-26 00:59:36 +02:00
|
|
|
plug_in_class->set_i18n = STD_SET_I18N;
|
1999-02-04 01:31:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-08-06 19:11:56 +02:00
|
|
|
browser_init (Browser *browser)
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2019-08-06 19:11:56 +02:00
|
|
|
}
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
static GList *
|
|
|
|
browser_query_procedures (GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
return g_list_append (NULL, g_strdup (PLUG_IN_PROC));
|
|
|
|
}
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
static GimpProcedure *
|
|
|
|
browser_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *procedure_name)
|
|
|
|
{
|
|
|
|
GimpProcedure *procedure = NULL;
|
2000-01-03 13:01:51 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
if (! strcmp (procedure_name, PLUG_IN_PROC))
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2023-06-16 18:34:53 +02:00
|
|
|
procedure = gimp_procedure_new (plug_in, procedure_name,
|
|
|
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
|
|
|
browser_run, NULL, NULL);
|
2019-08-06 19:11:56 +02:00
|
|
|
|
2022-07-04 22:50:53 +02:00
|
|
|
gimp_procedure_set_menu_label (procedure, _("_Plug-In Browser"));
|
2019-08-09 00:05:49 +02:00
|
|
|
gimp_procedure_set_icon_name (procedure, GIMP_ICON_PLUGIN);
|
2023-07-13 15:34:40 +02:00
|
|
|
gimp_procedure_add_menu_path (procedure, "<Image>/Help/[Programming]");
|
2019-08-06 19:11:56 +02:00
|
|
|
|
|
|
|
gimp_procedure_set_documentation (procedure,
|
2022-07-04 22:50:53 +02:00
|
|
|
_("Display information about plug-ins"),
|
2023-04-15 23:43:48 +00:00
|
|
|
_("Allows one to browse the plug-in "
|
|
|
|
"menus system. You can search for "
|
|
|
|
"plug-in names, sort by name or menu "
|
|
|
|
"location and you can view a tree "
|
|
|
|
"representation of the plug-in menus. "
|
|
|
|
"Can also be of help to find where "
|
|
|
|
"new plug-ins have installed "
|
|
|
|
"themselves in the menus."),
|
2019-08-06 19:11:56 +02:00
|
|
|
PLUG_IN_PROC);
|
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Andy Thomas",
|
|
|
|
"Andy Thomas",
|
|
|
|
"1999");
|
|
|
|
|
2019-08-19 10:02:07 +02:00
|
|
|
GIMP_PROC_ARG_ENUM (procedure, "run-mode",
|
|
|
|
"Run mode",
|
|
|
|
"The run mode",
|
|
|
|
GIMP_TYPE_RUN_MODE,
|
|
|
|
GIMP_RUN_INTERACTIVE,
|
|
|
|
G_PARAM_READWRITE);
|
2019-08-06 19:11:56 +02:00
|
|
|
}
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
return procedure;
|
|
|
|
}
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
static GimpValueArray *
|
|
|
|
browser_run (GimpProcedure *procedure,
|
2023-06-15 16:53:54 +02:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-06 19:11:56 +02:00
|
|
|
gpointer run_data)
|
|
|
|
{
|
|
|
|
browser_dialog_new ();
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
|
1999-02-04 01:31:33 +00:00
|
|
|
}
|
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
static gboolean
|
|
|
|
find_existing_mpath_helper (GtkTreeModel *model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreePath *path,
|
2005-10-19 20:34:20 +00:00
|
|
|
const gchar *mpath,
|
2004-01-11 22:00:06 +00:00
|
|
|
GtkTreeIter *return_iter)
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2004-01-11 22:00:06 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
GtkTreeIter child;
|
|
|
|
gchar *picked_mpath;
|
2003-10-01 22:52:27 +00:00
|
|
|
|
2004-04-21 23:09:16 +00:00
|
|
|
gtk_tree_model_get (model, iter,
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_MPATH, &picked_mpath,
|
2004-01-11 22:00:06 +00:00
|
|
|
-1);
|
2004-09-30 00:33:34 +00:00
|
|
|
|
|
|
|
if (! strcmp (mpath, picked_mpath))
|
|
|
|
{
|
|
|
|
*return_iter = *iter;
|
|
|
|
g_free (picked_mpath);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-01-11 22:00:06 +00:00
|
|
|
|
|
|
|
if (gtk_tree_model_iter_children (model, &child, iter))
|
|
|
|
{
|
|
|
|
gtk_tree_path_down (path);
|
2004-09-30 00:33:34 +00:00
|
|
|
|
2004-04-21 23:09:16 +00:00
|
|
|
if (find_existing_mpath_helper (model, &child, path,
|
2004-09-30 00:33:34 +00:00
|
|
|
mpath, return_iter))
|
|
|
|
{
|
|
|
|
g_free (picked_mpath);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_path_up (path);
|
|
|
|
}
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_path_next (path);
|
|
|
|
g_free (picked_mpath);
|
|
|
|
}
|
|
|
|
while (gtk_tree_model_iter_next (model, iter));
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
find_existing_mpath (GtkTreeModel *model,
|
2005-10-19 20:34:20 +00:00
|
|
|
const gchar *mpath,
|
2004-01-11 22:00:06 +00:00
|
|
|
GtkTreeIter *return_iter)
|
|
|
|
{
|
2005-10-19 20:34:20 +00:00
|
|
|
GtkTreePath *path = gtk_tree_path_new_first ();
|
2004-01-11 22:00:06 +00:00
|
|
|
GtkTreeIter parent;
|
2005-05-18 22:21:07 +00:00
|
|
|
gboolean found;
|
2004-01-11 22:00:06 +00:00
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
if (! gtk_tree_model_get_iter (model, &parent, path))
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_path_free (path);
|
|
|
|
return FALSE;
|
1999-02-04 01:31:33 +00:00
|
|
|
}
|
|
|
|
|
2005-10-19 20:34:20 +00:00
|
|
|
found = find_existing_mpath_helper (model, &parent, path, mpath, return_iter);
|
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_path_free (path);
|
2005-05-18 22:21:07 +00:00
|
|
|
|
|
|
|
return found;
|
2004-01-11 22:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-09-30 10:57:57 +00:00
|
|
|
get_parent (PluginBrowser *browser,
|
2005-10-19 20:34:20 +00:00
|
|
|
const gchar *mpath,
|
2004-09-30 10:57:57 +00:00
|
|
|
GtkTreeIter *parent)
|
2004-01-11 22:00:06 +00:00
|
|
|
{
|
|
|
|
GtkTreeIter last_parent;
|
|
|
|
gchar *tmp_ptr;
|
|
|
|
gchar *str_ptr;
|
|
|
|
GtkTreeStore *tree_store;
|
|
|
|
|
2005-10-19 20:34:20 +00:00
|
|
|
if (! mpath)
|
2004-01-11 22:00:06 +00:00
|
|
|
return;
|
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
2004-01-11 22:00:06 +00:00
|
|
|
|
|
|
|
/* Lookup for existing mpath */
|
|
|
|
if (find_existing_mpath (GTK_TREE_MODEL (tree_store), mpath, parent))
|
|
|
|
return;
|
|
|
|
|
2000-02-28 00:45:58 +00:00
|
|
|
tmp_ptr = g_strdup (mpath);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2005-10-19 20:34:20 +00:00
|
|
|
/* Strip off trailing ellipsis */
|
|
|
|
str_ptr = strstr (mpath, "...");
|
|
|
|
if (str_ptr && str_ptr == (mpath + strlen (mpath) - 3))
|
|
|
|
*str_ptr = '\0';
|
|
|
|
|
|
|
|
str_ptr = strrchr (tmp_ptr, '/');
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2000-02-28 00:45:58 +00:00
|
|
|
if (str_ptr == NULL)
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_store_append (tree_store, parent, NULL);
|
|
|
|
gtk_tree_store_set (tree_store, parent,
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_MPATH, mpath,
|
|
|
|
TREE_COLUMN_PATH_NAME, mpath,
|
2004-01-11 22:00:06 +00:00
|
|
|
-1);
|
1999-02-04 01:31:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-03 13:16:16 +05:30
|
|
|
gchar *leaf_ptr;
|
2000-02-28 00:45:58 +00:00
|
|
|
|
2011-10-03 13:15:23 +05:30
|
|
|
leaf_ptr = g_strdup (str_ptr + 1);
|
2005-05-18 22:21:07 +00:00
|
|
|
*str_ptr = '\0';
|
2000-02-28 00:45:58 +00:00
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
get_parent (browser, tmp_ptr, &last_parent);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_store_append (tree_store, parent, &last_parent);
|
|
|
|
gtk_tree_store_set (tree_store, parent,
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_MPATH, mpath,
|
|
|
|
TREE_COLUMN_PATH_NAME, leaf_ptr,
|
2004-01-11 22:00:06 +00:00
|
|
|
-1);
|
2011-10-03 13:16:16 +05:30
|
|
|
|
|
|
|
g_free (leaf_ptr);
|
1999-02-04 01:31:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-09-30 10:57:57 +00:00
|
|
|
insert_into_tree_view (PluginBrowser *browser,
|
2005-10-12 10:12:36 +00:00
|
|
|
const gchar *name,
|
|
|
|
gint64 xtime,
|
|
|
|
const gchar *xtimestr,
|
2019-09-08 14:54:17 +02:00
|
|
|
const gchar *menu_path,
|
2005-10-12 10:12:36 +00:00
|
|
|
const gchar *types_str,
|
2004-09-30 10:57:57 +00:00
|
|
|
PInfo *pinfo)
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2004-01-11 22:00:06 +00:00
|
|
|
GtkTreeStore *tree_store;
|
2019-09-10 19:47:12 +02:00
|
|
|
GtkTreeIter parent, iter;
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-09-08 14:54:17 +02:00
|
|
|
get_parent (browser, menu_path, &parent);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_store_append (tree_store, &iter, &parent);
|
|
|
|
gtk_tree_store_set (tree_store, &iter,
|
2019-09-08 14:54:17 +02:00
|
|
|
TREE_COLUMN_MPATH, menu_path,
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_PATH_NAME, name,
|
|
|
|
TREE_COLUMN_IMAGE_TYPES, types_str,
|
2005-10-12 10:12:36 +00:00
|
|
|
TREE_COLUMN_DATE, xtime,
|
|
|
|
TREE_COLUMN_DATE_STRING, xtimestr,
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_PINFO, pinfo,
|
2004-01-11 22:00:06 +00:00
|
|
|
-1);
|
1999-02-04 01:31:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-05-18 22:21:07 +00:00
|
|
|
browser_search (GimpBrowser *gimp_browser,
|
2005-05-18 23:48:47 +00:00
|
|
|
const gchar *search_text,
|
2005-05-18 22:21:07 +00:00
|
|
|
gint search_type,
|
|
|
|
PluginBrowser *browser)
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2019-08-06 19:11:56 +02:00
|
|
|
GimpValueArray *return_vals;
|
2020-12-23 21:15:43 +01:00
|
|
|
const gchar **procedure_strs;
|
2019-08-06 19:11:56 +02:00
|
|
|
gint num_plugins = 0;
|
|
|
|
gchar *str;
|
|
|
|
GtkListStore *list_store;
|
|
|
|
GtkTreeStore *tree_store;
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
gimp_browser_show_message (GIMP_BROWSER (browser->browser),
|
2005-10-05 23:31:49 +00:00
|
|
|
_("Searching by name"));
|
2004-09-30 10:57:57 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
return_vals = gimp_pdb_run_procedure (gimp_get_pdb (),
|
2019-09-11 23:58:47 +02:00
|
|
|
"gimp-plug-ins-query",
|
2023-10-17 15:49:32 +02:00
|
|
|
"search-string", search_text,
|
libgimp: PDB procedure arguments are not order-based anymore (API-wise).
As far as plug-in API is concerned, at least the calling API, order of arguments
when calling PDB procedures doesn't matter anymore.
Order still matters for creating procedures with standard arguments (for
instance, "run-mode" is first, then image, or file, drawables or whatnot,
depending on the subtype of procedure), but not for calling with libgimp.
Concretely in this commit:
- gimp_pdb_run_procedure_argv() was removed as it's intrinsically order-based.
- gimp_pdb_run_procedure() and gimp_pdb_run_procedure_valist() stay but their
semantic changes. Instead of an ordered list of (type, value) couple, it's now
an unordered list of (name, type, value) triplets. This way, you can also
ignore as many args as you want if you intend to keep them default. For
instance, say you have a procedure with 20 args and you only want to change
the last one and keep the 19 first with default values: while you used to have
to write down all 20 args annoyingly, now you can just list the only arg you
care about.
There are 2 important consequences here:
1. Calling PDB procedures becomes much more semantic, which means scripts with
PDB calls are simpler (smaller list of arguments) and easier to read (when
you had 5 int arguments in a row, you couldn't know what they refer to,
except by always checking the PDB source; now you'll have associated names,
such as "width", "height" and so on) hence maintain.
2. We will have the ability to add arguments and even order the new arguments in
middle of existing arguments without breaking compatibility. The only thing
which will matter will be that default values of new arguments will have to
behave like when the arg didn't exist. This way, existing scripts will not be
broken. This will avoid us having to always create variants of PDB procedure
(like original "file-bla-save", then variant "file-bla-save-2" and so on)
each time we add arguments.
Note: gimp_pdb_run_procedure_array() was not removed yet because it's currently
used by the PDB. To be followed.
2023-10-16 16:44:06 +02:00
|
|
|
NULL);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-08-20 01:03:38 +02:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-08-06 19:11:56 +02:00
|
|
|
{
|
2020-12-23 21:15:43 +01:00
|
|
|
procedure_strs = GIMP_VALUES_GET_STRV (return_vals, 1);
|
|
|
|
num_plugins = g_strv_length ((gchar **) procedure_strs);
|
2019-08-06 19:11:56 +02:00
|
|
|
}
|
2004-09-30 00:33:34 +00:00
|
|
|
|
2005-07-06 01:51:17 +00:00
|
|
|
if (! search_text || strlen (search_text) == 0)
|
|
|
|
{
|
2006-06-27 07:49:14 +00:00
|
|
|
str = g_strdup_printf (ngettext ("%d plug-in", "%d plug-ins",
|
|
|
|
num_plugins),
|
|
|
|
num_plugins);
|
2005-07-06 01:51:17 +00:00
|
|
|
}
|
2005-05-13 15:58:16 +00:00
|
|
|
else
|
2005-07-06 01:51:17 +00:00
|
|
|
{
|
|
|
|
switch (num_plugins)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
str = g_strdup (_("No matches for your query"));
|
|
|
|
break;
|
|
|
|
default:
|
2005-10-05 23:31:49 +00:00
|
|
|
str = g_strdup_printf (ngettext ("%d plug-in matches your query",
|
|
|
|
"%d plug-ins match your query",
|
|
|
|
num_plugins), num_plugins);
|
2005-07-06 01:51:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-10-29 10:47:59 +00:00
|
|
|
|
2010-12-31 18:19:37 +01:00
|
|
|
gimp_browser_set_search_summary (gimp_browser, str);
|
2005-05-13 15:58:16 +00:00
|
|
|
g_free (str);
|
2004-09-30 00:33:34 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
list_store = GTK_LIST_STORE (gtk_tree_view_get_model (browser->list_view));
|
|
|
|
gtk_list_store_clear (list_store);
|
2004-01-11 22:00:06 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
|
|
|
gtk_tree_store_clear (tree_store);
|
2004-01-11 22:00:06 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
if (num_plugins > 0)
|
|
|
|
{
|
|
|
|
GtkTreeSelection *sel;
|
|
|
|
GtkTreeIter iter;
|
2019-08-06 19:11:56 +02:00
|
|
|
const gchar **accel_strs;
|
|
|
|
const gchar **prog_strs;
|
|
|
|
const gint *time_ints;
|
2005-05-13 15:58:16 +00:00
|
|
|
gint i;
|
|
|
|
|
2020-12-23 21:15:43 +01:00
|
|
|
accel_strs = GIMP_VALUES_GET_STRV (return_vals, 2);
|
|
|
|
prog_strs = GIMP_VALUES_GET_STRV (return_vals, 3);
|
|
|
|
time_ints = GIMP_VALUES_GET_INT32_ARRAY (return_vals, 5);
|
2005-05-13 15:58:16 +00:00
|
|
|
|
|
|
|
for (i = 0; i < num_plugins; i++)
|
2004-01-11 22:00:06 +00:00
|
|
|
{
|
2019-09-08 14:54:17 +02:00
|
|
|
GimpProcedure *procedure;
|
|
|
|
const gchar *types;
|
|
|
|
PInfo *pinfo;
|
|
|
|
gchar *menu_label;
|
|
|
|
gchar *tmp;
|
|
|
|
GList *menu_paths;
|
|
|
|
const gchar *menu_path;
|
|
|
|
gchar xtimestr[50];
|
|
|
|
struct tm *x;
|
|
|
|
time_t tx;
|
|
|
|
gint ret;
|
|
|
|
|
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (),
|
|
|
|
procedure_strs[i]);
|
|
|
|
|
|
|
|
types = gimp_procedure_get_image_types (procedure);
|
|
|
|
menu_label = g_strdup (gimp_procedure_get_menu_label (procedure));
|
|
|
|
menu_paths = gimp_procedure_get_menu_paths (procedure);
|
|
|
|
|
|
|
|
menu_path = menu_paths->data;
|
2005-10-19 20:34:20 +00:00
|
|
|
|
|
|
|
/* Strip off trailing ellipsis */
|
2019-09-08 14:54:17 +02:00
|
|
|
tmp = strstr (menu_label, "...");
|
|
|
|
if (tmp && tmp == (menu_label + strlen (menu_label) - 3))
|
|
|
|
*tmp = '\0';
|
2004-01-11 22:00:06 +00:00
|
|
|
|
2019-09-08 14:54:17 +02:00
|
|
|
tmp = gimp_strip_uline (menu_label);
|
|
|
|
g_free (menu_label);
|
|
|
|
menu_label = tmp;
|
2004-01-11 22:00:06 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
tx = time_ints[i];
|
2004-01-11 22:00:06 +00:00
|
|
|
if (tx)
|
|
|
|
{
|
2004-08-28 18:56:46 +00:00
|
|
|
const gchar *format = "%c"; /* gcc workaround to avoid warning */
|
2004-09-30 00:33:34 +00:00
|
|
|
gchar *utf8;
|
2003-08-13 23:50:27 +00:00
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
x = localtime (&tx);
|
2004-08-28 18:56:46 +00:00
|
|
|
ret = strftime (xtimestr, sizeof (xtimestr), format, x);
|
2004-01-11 22:00:06 +00:00
|
|
|
xtimestr[ret] = 0;
|
2003-08-13 23:50:27 +00:00
|
|
|
|
|
|
|
if ((utf8 = g_locale_to_utf8 (xtimestr, -1, NULL, NULL, NULL)))
|
|
|
|
{
|
2019-08-14 23:52:38 +02:00
|
|
|
g_strlcpy (xtimestr, utf8, sizeof (xtimestr));
|
2003-08-13 23:50:27 +00:00
|
|
|
g_free (utf8);
|
|
|
|
}
|
2004-01-11 22:00:06 +00:00
|
|
|
}
|
|
|
|
else
|
2005-05-13 15:58:16 +00:00
|
|
|
{
|
|
|
|
strcpy (xtimestr, "");
|
|
|
|
}
|
2004-01-11 22:00:06 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
pinfo = g_new0 (PInfo, 1);
|
|
|
|
|
2019-09-08 14:54:17 +02:00
|
|
|
pinfo->menu = g_strdup (menu_path);
|
|
|
|
pinfo->accel = g_strdup (accel_strs[i]);
|
|
|
|
pinfo->prog = g_strdup (prog_strs[i]);
|
|
|
|
pinfo->instime = time_ints[i];
|
|
|
|
pinfo->procedure = g_strdup (procedure_strs[i]);
|
2004-01-11 22:00:06 +00:00
|
|
|
|
|
|
|
gtk_list_store_append (list_store, &iter);
|
|
|
|
gtk_list_store_set (list_store, &iter,
|
2019-09-08 14:54:17 +02:00
|
|
|
LIST_COLUMN_NAME, menu_label,
|
2005-10-12 10:12:36 +00:00
|
|
|
LIST_COLUMN_DATE, (gint64) tx,
|
|
|
|
LIST_COLUMN_DATE_STRING, xtimestr,
|
2019-09-08 14:54:17 +02:00
|
|
|
LIST_COLUMN_PATH, menu_path,
|
|
|
|
LIST_COLUMN_IMAGE_TYPES, types,
|
2005-05-18 22:21:07 +00:00
|
|
|
LIST_COLUMN_PINFO, pinfo,
|
2004-01-11 22:00:06 +00:00
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Now do the tree view.... */
|
2004-09-30 00:33:34 +00:00
|
|
|
insert_into_tree_view (browser,
|
2019-09-08 14:54:17 +02:00
|
|
|
menu_label,
|
2005-10-12 10:12:36 +00:00
|
|
|
(gint64) tx,
|
2004-01-11 22:00:06 +00:00
|
|
|
xtimestr,
|
2019-09-08 14:54:17 +02:00
|
|
|
menu_path,
|
|
|
|
types,
|
2004-01-11 22:00:06 +00:00
|
|
|
pinfo);
|
2019-08-06 19:11:56 +02:00
|
|
|
|
2019-09-08 14:54:17 +02:00
|
|
|
g_free (menu_label);
|
2004-01-11 22:00:06 +00:00
|
|
|
}
|
2004-09-30 10:57:57 +00:00
|
|
|
|
|
|
|
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (browser->list_view));
|
|
|
|
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (browser->tree_view));
|
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
|
2005-05-18 22:21:07 +00:00
|
|
|
LIST_COLUMN_NAME,
|
2004-01-11 22:00:06 +00:00
|
|
|
GTK_SORT_ASCENDING);
|
2004-09-30 10:57:57 +00:00
|
|
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree_store),
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_PATH_NAME,
|
2004-09-30 10:57:57 +00:00
|
|
|
GTK_SORT_ASCENDING);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser->list_view));
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store),
|
|
|
|
&iter);
|
|
|
|
gtk_tree_selection_select_iter (sel, &iter);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-18 22:21:07 +00:00
|
|
|
gimp_browser_show_message (GIMP_BROWSER (browser->browser),
|
|
|
|
_("No matches"));
|
2003-11-06 15:27:05 +00:00
|
|
|
}
|
2004-09-30 10:57:57 +00:00
|
|
|
|
2019-08-06 19:11:56 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-11-06 15:27:05 +00:00
|
|
|
}
|
1999-02-04 01:31:33 +00:00
|
|
|
|
|
|
|
static GtkWidget *
|
2004-09-30 10:57:57 +00:00
|
|
|
browser_dialog_new (void)
|
1999-02-04 01:31:33 +00:00
|
|
|
{
|
2005-08-15 11:07:27 +00:00
|
|
|
PluginBrowser *browser;
|
2005-05-18 22:21:07 +00:00
|
|
|
GtkWidget *label, *notebook;
|
|
|
|
GtkWidget *scrolled_window;
|
2004-01-11 22:00:06 +00:00
|
|
|
GtkListStore *list_store;
|
|
|
|
GtkTreeStore *tree_store;
|
|
|
|
GtkWidget *list_view;
|
|
|
|
GtkWidget *tree_view;
|
2009-10-10 15:10:14 +02:00
|
|
|
GtkWidget *parent;
|
2004-01-11 22:00:06 +00:00
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
GtkCellRenderer *renderer;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkTreeIter iter;
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2019-09-20 19:39:00 +02:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-09-30 10:57:57 +00:00
|
|
|
browser = g_new0 (PluginBrowser, 1);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2017-03-21 17:45:50 +01:00
|
|
|
browser->dialog = gimp_dialog_new (_("Plug-in Browser"), PLUG_IN_ROLE,
|
2005-05-13 15:58:16 +00:00
|
|
|
NULL, 0,
|
2005-08-15 11:07:27 +00:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
2000-01-08 15:23:28 +00:00
|
|
|
|
2017-02-12 16:18:24 +01:00
|
|
|
_("_Close"), GTK_RESPONSE_CLOSE,
|
2000-01-08 15:23:28 +00:00
|
|
|
|
2005-05-13 15:58:16 +00:00
|
|
|
NULL);
|
2023-04-15 23:43:48 +00:00
|
|
|
gtk_window_set_default_size (GTK_WINDOW (browser->dialog), DBL_WIDTH,
|
|
|
|
DBL_WIDTH - DBL_LIST_WIDTH);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
g_signal_connect (browser->dialog, "response",
|
2004-09-30 10:57:57 +00:00
|
|
|
G_CALLBACK (browser_dialog_response),
|
2004-09-30 00:33:34 +00:00
|
|
|
browser);
|
2000-01-08 15:23:28 +00:00
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
browser->browser = gimp_browser_new ();
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (browser->browser), 12);
|
2011-03-04 10:44:58 +01:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (browser->dialog))),
|
|
|
|
browser->browser, TRUE, TRUE, 0);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_widget_show (browser->browser);
|
2005-05-13 15:58:16 +00:00
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
g_signal_connect (browser->browser, "search",
|
|
|
|
G_CALLBACK (browser_search),
|
2005-05-13 15:58:16 +00:00
|
|
|
browser);
|
2004-09-30 00:33:34 +00:00
|
|
|
|
1999-02-04 01:31:33 +00:00
|
|
|
/* left = notebook */
|
|
|
|
|
2000-02-28 00:45:58 +00:00
|
|
|
notebook = gtk_notebook_new ();
|
2010-12-31 18:19:37 +01:00
|
|
|
gtk_box_pack_start (GTK_BOX (gimp_browser_get_left_vbox (GIMP_BROWSER (browser->browser))),
|
2005-05-18 22:21:07 +00:00
|
|
|
notebook, TRUE, TRUE, 0);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
|
|
|
/* list : list in a scrolled_win */
|
2005-05-18 22:21:07 +00:00
|
|
|
list_store = gtk_list_store_new (N_LIST_COLUMNS,
|
2004-01-17 00:26:49 +00:00
|
|
|
G_TYPE_STRING,
|
2005-10-12 10:12:36 +00:00
|
|
|
G_TYPE_INT64,
|
2004-01-17 00:26:49 +00:00
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_POINTER);
|
|
|
|
|
|
|
|
list_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
|
|
|
|
g_object_unref (list_store);
|
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
browser->list_view = GTK_TREE_VIEW (list_view);
|
2004-01-11 22:00:06 +00:00
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2004-01-17 00:26:49 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Name"),
|
|
|
|
renderer,
|
2005-05-18 22:21:07 +00:00
|
|
|
"text", LIST_COLUMN_NAME,
|
2004-01-17 00:26:49 +00:00
|
|
|
NULL);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, LIST_COLUMN_NAME);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (list_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2004-09-30 00:33:34 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Menu Path"),
|
2004-01-17 00:26:49 +00:00
|
|
|
renderer,
|
2005-05-18 22:21:07 +00:00
|
|
|
"text", LIST_COLUMN_PATH,
|
2004-01-17 00:26:49 +00:00
|
|
|
NULL);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, LIST_COLUMN_PATH);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (list_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2004-09-30 00:33:34 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Image Types"),
|
2004-01-17 00:26:49 +00:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-05-18 22:21:07 +00:00
|
|
|
LIST_COLUMN_IMAGE_TYPES,
|
2004-01-17 00:26:49 +00:00
|
|
|
NULL);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, LIST_COLUMN_IMAGE_TYPES);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (list_view), column);
|
|
|
|
|
2005-07-06 00:31:59 +00:00
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
|
|
|
|
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Installation Date"),
|
|
|
|
renderer,
|
2005-10-12 10:12:36 +00:00
|
|
|
"text",
|
|
|
|
LIST_COLUMN_DATE_STRING,
|
2005-07-06 00:31:59 +00:00
|
|
|
NULL);
|
|
|
|
gtk_tree_view_column_set_sort_column_id (column, LIST_COLUMN_DATE);
|
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (list_view), column);
|
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 2);
|
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
2004-05-25 13:55:42 +00:00
|
|
|
GTK_SHADOW_IN);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
2004-01-11 22:00:06 +00:00
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
gtk_widget_set_size_request (list_view, DBL_LIST_WIDTH, DBL_HEIGHT);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view));
|
|
|
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
2004-09-30 00:33:34 +00:00
|
|
|
|
2004-01-17 00:26:49 +00:00
|
|
|
g_signal_connect (selection, "changed",
|
2004-09-30 10:57:57 +00:00
|
|
|
G_CALLBACK (browser_list_selection_changed),
|
2004-09-30 00:33:34 +00:00
|
|
|
browser);
|
2003-10-01 22:52:27 +00:00
|
|
|
|
2000-02-28 00:45:58 +00:00
|
|
|
label = gtk_label_new (_("List View"));
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scrolled_window, label);
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), list_view);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_widget_show (list_view);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_widget_show (scrolled_window);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
|
|
|
/* notebook->ctree */
|
2005-05-18 22:21:07 +00:00
|
|
|
tree_store = gtk_tree_store_new (N_LIST_COLUMNS,
|
2004-01-17 00:26:49 +00:00
|
|
|
G_TYPE_STRING,
|
2005-10-12 10:12:36 +00:00
|
|
|
G_TYPE_INT64,
|
2004-01-17 00:26:49 +00:00
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_POINTER);
|
|
|
|
|
|
|
|
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (tree_store));
|
|
|
|
g_object_unref (tree_store);
|
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
browser->tree_view = GTK_TREE_VIEW (tree_view);
|
2004-01-11 22:00:06 +00:00
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2005-10-19 20:34:20 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Menu Path"),
|
2004-01-11 22:00:06 +00:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_PATH_NAME,
|
2004-01-11 22:00:06 +00:00
|
|
|
NULL);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, TREE_COLUMN_PATH_NAME);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2005-07-06 00:31:59 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Image Types"),
|
2004-01-11 22:00:06 +00:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-07-06 00:31:59 +00:00
|
|
|
TREE_COLUMN_IMAGE_TYPES,
|
2004-01-11 22:00:06 +00:00
|
|
|
NULL);
|
2005-07-06 00:31:59 +00:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, TREE_COLUMN_IMAGE_TYPES);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2005-07-06 00:31:59 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Installation Date"),
|
2004-01-11 22:00:06 +00:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-10-12 10:12:36 +00:00
|
|
|
TREE_COLUMN_DATE_STRING,
|
2004-01-11 22:00:06 +00:00
|
|
|
NULL);
|
2005-07-06 00:31:59 +00:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, TREE_COLUMN_DATE);
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 2);
|
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
2004-05-25 13:55:42 +00:00
|
|
|
GTK_SHADOW_IN);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
2004-01-11 22:00:06 +00:00
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
gtk_widget_set_size_request (tree_view, DBL_LIST_WIDTH, DBL_HEIGHT);
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
|
|
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
2004-09-30 00:33:34 +00:00
|
|
|
|
2004-01-17 00:26:49 +00:00
|
|
|
g_signal_connect (selection, "changed",
|
2004-09-30 10:57:57 +00:00
|
|
|
G_CALLBACK (browser_tree_selection_changed),
|
2004-09-30 00:33:34 +00:00
|
|
|
browser);
|
2000-07-16 12:49:04 +00:00
|
|
|
|
2004-11-10 13:01:06 +00:00
|
|
|
label = gtk_label_new (_("Tree View"));
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scrolled_window, label);
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
|
2000-07-16 12:49:04 +00:00
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
gtk_widget_show (tree_view);
|
2005-05-18 22:21:07 +00:00
|
|
|
gtk_widget_show (scrolled_window);
|
2000-02-28 00:45:58 +00:00
|
|
|
gtk_widget_show (notebook);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2010-12-31 18:19:37 +01:00
|
|
|
parent = gtk_widget_get_parent (gimp_browser_get_right_vbox (GIMP_BROWSER (browser->browser)));
|
2009-10-10 15:10:14 +02:00
|
|
|
parent = gtk_widget_get_parent (parent);
|
|
|
|
|
|
|
|
gtk_widget_set_size_request (parent, DBL_WIDTH - DBL_LIST_WIDTH, -1);
|
2003-10-01 22:52:27 +00:00
|
|
|
|
1999-02-04 01:31:33 +00:00
|
|
|
/* now build the list */
|
2005-05-18 23:48:47 +00:00
|
|
|
browser_search (GIMP_BROWSER (browser->browser), "", 0, browser);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
gtk_widget_show (browser->dialog);
|
2003-10-01 22:52:27 +00:00
|
|
|
|
2004-01-11 22:00:06 +00:00
|
|
|
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))
|
2004-09-30 00:33:34 +00:00
|
|
|
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view)),
|
|
|
|
&iter);
|
1999-02-04 01:31:33 +00:00
|
|
|
|
2004-09-30 00:33:34 +00:00
|
|
|
return browser->dialog;
|
1999-02-04 01:31:33 +00:00
|
|
|
}
|
2004-09-30 10:57:57 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
browser_dialog_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
PluginBrowser *browser)
|
|
|
|
{
|
2005-05-13 15:58:16 +00:00
|
|
|
gtk_widget_destroy (browser->dialog);
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
2004-09-30 10:57:57 +00:00
|
|
|
static void
|
|
|
|
browser_list_selection_changed (GtkTreeSelection *selection,
|
|
|
|
PluginBrowser *browser)
|
|
|
|
{
|
|
|
|
PInfo *pinfo = NULL;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
gchar *mpath = NULL;
|
|
|
|
|
|
|
|
g_return_if_fail (browser != NULL);
|
|
|
|
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
|
|
|
gtk_tree_model_get (model, &iter,
|
2005-05-18 22:21:07 +00:00
|
|
|
LIST_COLUMN_PINFO, &pinfo,
|
|
|
|
LIST_COLUMN_PATH, &mpath,
|
2004-09-30 10:57:57 +00:00
|
|
|
-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pinfo || !mpath)
|
|
|
|
return;
|
|
|
|
|
|
|
|
model = gtk_tree_view_get_model (browser->tree_view);
|
|
|
|
|
|
|
|
if (find_existing_mpath (model, mpath, &iter))
|
|
|
|
{
|
|
|
|
GtkTreeSelection *tree_selection;
|
|
|
|
GtkTreePath *tree_path;
|
|
|
|
|
|
|
|
tree_path = gtk_tree_model_get_path (model, &iter);
|
|
|
|
gtk_tree_view_expand_to_path (browser->tree_view, tree_path);
|
|
|
|
tree_selection = gtk_tree_view_get_selection (browser->tree_view);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func (tree_selection,
|
|
|
|
browser_tree_selection_changed,
|
|
|
|
browser);
|
|
|
|
gtk_tree_selection_select_iter (tree_selection, &iter);
|
|
|
|
g_signal_handlers_unblock_by_func (tree_selection,
|
|
|
|
browser_tree_selection_changed,
|
|
|
|
browser);
|
|
|
|
|
|
|
|
gtk_tree_view_scroll_to_cell (browser->tree_view,
|
|
|
|
tree_path, NULL,
|
|
|
|
TRUE, 0.5, 0.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Failed to find node in tree");
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (mpath);
|
|
|
|
|
2019-08-05 14:17:18 +02:00
|
|
|
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
2019-09-08 14:54:17 +02:00
|
|
|
gimp_proc_view_new (pinfo->procedure));
|
2004-09-30 10:57:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
browser_tree_selection_changed (GtkTreeSelection *selection,
|
|
|
|
PluginBrowser *browser)
|
|
|
|
{
|
|
|
|
PInfo *pinfo = NULL;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
gchar *mpath = NULL;
|
|
|
|
gboolean valid, found;
|
|
|
|
|
|
|
|
g_return_if_fail (browser != NULL);
|
|
|
|
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
|
|
|
gtk_tree_model_get (model, &iter,
|
2005-05-18 22:21:07 +00:00
|
|
|
TREE_COLUMN_PINFO, &pinfo,
|
|
|
|
TREE_COLUMN_MPATH, &mpath,
|
2004-09-30 10:57:57 +00:00
|
|
|
-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pinfo || !mpath)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Get the first iter in the list */
|
|
|
|
model = gtk_tree_view_get_model (browser->list_view);
|
|
|
|
valid = gtk_tree_model_get_iter_first (model, &iter);
|
|
|
|
found = FALSE;
|
|
|
|
|
|
|
|
while (valid)
|
|
|
|
{
|
|
|
|
/* Walk through the list, reading each row */
|
|
|
|
gchar *picked_mpath;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, &iter,
|
2005-05-18 22:21:07 +00:00
|
|
|
LIST_COLUMN_PATH, &picked_mpath,
|
2004-09-30 10:57:57 +00:00
|
|
|
-1);
|
|
|
|
if (picked_mpath && !strcmp (mpath, picked_mpath))
|
|
|
|
{
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2005-10-19 20:34:20 +00:00
|
|
|
|
2004-09-30 10:57:57 +00:00
|
|
|
g_free (picked_mpath);
|
|
|
|
valid = gtk_tree_model_iter_next (model, &iter);
|
|
|
|
}
|
2005-10-19 20:34:20 +00:00
|
|
|
|
2004-09-30 10:57:57 +00:00
|
|
|
g_free (mpath);
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
{
|
|
|
|
GtkTreeSelection *list_selection;
|
|
|
|
GtkTreePath *tree_path;
|
|
|
|
|
|
|
|
tree_path = gtk_tree_model_get_path (model, &iter);
|
|
|
|
list_selection = gtk_tree_view_get_selection (browser->list_view);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func (list_selection,
|
|
|
|
browser_list_selection_changed,
|
|
|
|
browser);
|
|
|
|
gtk_tree_selection_select_iter (list_selection, &iter);
|
|
|
|
g_signal_handlers_unblock_by_func (list_selection,
|
|
|
|
browser_list_selection_changed,
|
|
|
|
browser);
|
|
|
|
|
|
|
|
gtk_tree_view_scroll_to_cell (browser->list_view,
|
|
|
|
tree_path, NULL,
|
|
|
|
TRUE, 0.5, 0.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Failed to find node in list");
|
|
|
|
}
|
|
|
|
|
2005-05-18 22:21:07 +00:00
|
|
|
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
2019-09-08 14:54:17 +02:00
|
|
|
gimp_proc_view_new (pinfo->procedure));
|
2004-09-30 10:57:57 +00:00
|
|
|
}
|