1999-02-04 09:31:33 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2007-06-06 16:44:52 +08:00
|
|
|
* This is a plug-in for GIMP.
|
1999-02-04 09:31:33 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 1999 Andy Thomas alt@picnic.demon.co.uk
|
|
|
|
*
|
2000-07-16 20:49:04 +08:00
|
|
|
* Note some portions of the UI comes from the dbbrowser plugin.
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1999-02-04 09:31:33 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1999-02-04 09:31:33 +08: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-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-02-04 09:31:33 +08:00
|
|
|
*/
|
|
|
|
|
2000-01-08 23:23:28 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1999-02-04 09:31:33 +08:00
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2000-01-08 23:23:28 +08:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
2000-01-08 23:23:28 +08:00
|
|
|
|
2000-01-03 21:01:51 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2000-05-02 01:01:18 +08:00
|
|
|
|
2005-08-15 19:07:27 +08:00
|
|
|
#define PLUG_IN_PROC "plug-in-plug-in-details"
|
|
|
|
#define PLUG_IN_BINARY "plugin-browser"
|
2011-04-09 02:31:34 +08:00
|
|
|
#define PLUG_IN_ROLE "gimp-plugin-browser"
|
2005-05-19 06:21:07 +08:00
|
|
|
#define DBL_LIST_WIDTH 250
|
|
|
|
#define DBL_WIDTH (DBL_LIST_WIDTH + 400)
|
|
|
|
#define DBL_HEIGHT 250
|
|
|
|
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
enum
|
|
|
|
{
|
2005-05-19 06:21:07 +08:00
|
|
|
LIST_COLUMN_NAME,
|
|
|
|
LIST_COLUMN_DATE,
|
2005-10-12 18:12:36 +08:00
|
|
|
LIST_COLUMN_DATE_STRING,
|
2005-05-19 06:21:07 +08:00
|
|
|
LIST_COLUMN_PATH,
|
|
|
|
LIST_COLUMN_IMAGE_TYPES,
|
|
|
|
LIST_COLUMN_PINFO,
|
|
|
|
N_LIST_COLUMNS
|
2004-09-30 08:33:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_PATH_NAME,
|
|
|
|
TREE_COLUMN_DATE,
|
2005-10-12 18:12:36 +08:00
|
|
|
TREE_COLUMN_DATE_STRING,
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_IMAGE_TYPES,
|
|
|
|
TREE_COLUMN_MPATH,
|
|
|
|
TREE_COLUMN_PINFO,
|
|
|
|
N_TREE_OLUMNS
|
2004-09-30 08:33:34 +08:00
|
|
|
};
|
|
|
|
|
2003-10-02 06:52:27 +08:00
|
|
|
typedef struct
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2004-09-30 08:33:34 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
|
2005-05-19 06:21:07 +08:00
|
|
|
GtkWidget *browser;
|
2004-09-30 18:57:57 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
GtkTreeView *list_view;
|
|
|
|
GtkTreeView *tree_view;
|
2004-09-30 18:57:57 +08: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-20 01:12:00 +08:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *menu;
|
|
|
|
gchar *accel;
|
|
|
|
gchar *prog;
|
2019-09-08 20:54:17 +08: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-20 01:12:00 +08:00
|
|
|
} PInfo;
|
|
|
|
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-08-07 01:11:56 +08: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 09:31:33 +08:00
|
|
|
*/
|
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
#define BROWSER_TYPE (browser_get_type ())
|
2023-10-19 00:29:37 +08:00
|
|
|
#define BROWSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BROWSER_TYPE, Browser))
|
2019-08-07 01:11:56 +08:00
|
|
|
|
|
|
|
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 22:53:54 +08:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-07 01:11:56 +08:00
|
|
|
gpointer run_data);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2004-09-30 18:57:57 +08: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 08:26:49 +08:00
|
|
|
|
2004-09-30 18:57:57 +08:00
|
|
|
static gboolean find_existing_mpath (GtkTreeModel *model,
|
2005-10-20 04:34:20 +08:00
|
|
|
const gchar *mpath,
|
2004-09-30 18:57:57 +08:00
|
|
|
GtkTreeIter *return_iter);
|
2004-01-17 08:26:49 +08: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-20 01:12:00 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
G_DEFINE_TYPE (Browser, browser, GIMP_TYPE_PLUG_IN)
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
GIMP_MAIN (BROWSER_TYPE)
|
2022-05-26 06:59:36 +08:00
|
|
|
DEFINE_STD_SET_I18N
|
1999-02-04 09:31:33 +08: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-20 01:12:00 +08:00
|
|
|
|
1999-02-04 09:31:33 +08:00
|
|
|
static void
|
2019-08-07 01:11:56 +08:00
|
|
|
browser_class_init (BrowserClass *klass)
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2019-08-07 01:11:56 +08: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 06:59:36 +08:00
|
|
|
plug_in_class->set_i18n = STD_SET_I18N;
|
1999-02-04 09:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-08-07 01:11:56 +08:00
|
|
|
browser_init (Browser *browser)
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2019-08-07 01:11:56 +08: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-20 01:12:00 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
static GList *
|
|
|
|
browser_query_procedures (GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
return g_list_append (NULL, g_strdup (PLUG_IN_PROC));
|
|
|
|
}
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
static GimpProcedure *
|
|
|
|
browser_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *procedure_name)
|
|
|
|
{
|
|
|
|
GimpProcedure *procedure = NULL;
|
2000-01-03 21:01:51 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
if (! strcmp (procedure_name, PLUG_IN_PROC))
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2023-06-17 00:34:53 +08:00
|
|
|
procedure = gimp_procedure_new (plug_in, procedure_name,
|
|
|
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
|
|
|
browser_run, NULL, NULL);
|
2019-08-07 01:11:56 +08:00
|
|
|
|
2022-07-05 04:50:53 +08:00
|
|
|
gimp_procedure_set_menu_label (procedure, _("_Plug-In Browser"));
|
2019-08-09 06:05:49 +08:00
|
|
|
gimp_procedure_set_icon_name (procedure, GIMP_ICON_PLUGIN);
|
2023-07-13 21:34:40 +08:00
|
|
|
gimp_procedure_add_menu_path (procedure, "<Image>/Help/[Programming]");
|
2019-08-07 01:11:56 +08:00
|
|
|
|
|
|
|
gimp_procedure_set_documentation (procedure,
|
2022-07-05 04:50:53 +08:00
|
|
|
_("Display information about plug-ins"),
|
2023-04-16 07:43:48 +08: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-07 01:11:56 +08:00
|
|
|
PLUG_IN_PROC);
|
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Andy Thomas",
|
|
|
|
"Andy Thomas",
|
|
|
|
"1999");
|
|
|
|
|
2024-06-13 00:53:12 +08:00
|
|
|
gimp_procedure_add_enum_argument (procedure, "run-mode",
|
|
|
|
"Run mode",
|
|
|
|
"The run mode",
|
|
|
|
GIMP_TYPE_RUN_MODE,
|
|
|
|
GIMP_RUN_INTERACTIVE,
|
|
|
|
G_PARAM_READWRITE);
|
2019-08-07 01:11:56 +08:00
|
|
|
}
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
return procedure;
|
|
|
|
}
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
static GimpValueArray *
|
|
|
|
browser_run (GimpProcedure *procedure,
|
2023-06-15 22:53:54 +08:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-07 01:11:56 +08:00
|
|
|
gpointer run_data)
|
|
|
|
{
|
|
|
|
browser_dialog_new ();
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
|
1999-02-04 09:31:33 +08:00
|
|
|
}
|
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
static gboolean
|
|
|
|
find_existing_mpath_helper (GtkTreeModel *model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreePath *path,
|
2005-10-20 04:34:20 +08:00
|
|
|
const gchar *mpath,
|
2004-01-12 06:00:06 +08:00
|
|
|
GtkTreeIter *return_iter)
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2004-01-12 06:00:06 +08:00
|
|
|
do
|
|
|
|
{
|
|
|
|
GtkTreeIter child;
|
|
|
|
gchar *picked_mpath;
|
2003-10-02 06:52:27 +08:00
|
|
|
|
2004-04-22 07:09:16 +08:00
|
|
|
gtk_tree_model_get (model, iter,
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_MPATH, &picked_mpath,
|
2004-01-12 06:00:06 +08:00
|
|
|
-1);
|
2004-09-30 08:33:34 +08:00
|
|
|
|
|
|
|
if (! strcmp (mpath, picked_mpath))
|
|
|
|
{
|
|
|
|
*return_iter = *iter;
|
|
|
|
g_free (picked_mpath);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-01-12 06:00:06 +08:00
|
|
|
|
|
|
|
if (gtk_tree_model_iter_children (model, &child, iter))
|
|
|
|
{
|
|
|
|
gtk_tree_path_down (path);
|
2004-09-30 08:33:34 +08:00
|
|
|
|
2004-04-22 07:09:16 +08:00
|
|
|
if (find_existing_mpath_helper (model, &child, path,
|
2004-09-30 08:33:34 +08:00
|
|
|
mpath, return_iter))
|
|
|
|
{
|
|
|
|
g_free (picked_mpath);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_path_up (path);
|
|
|
|
}
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_path_next (path);
|
|
|
|
g_free (picked_mpath);
|
|
|
|
}
|
|
|
|
while (gtk_tree_model_iter_next (model, iter));
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
find_existing_mpath (GtkTreeModel *model,
|
2005-10-20 04:34:20 +08:00
|
|
|
const gchar *mpath,
|
2004-01-12 06:00:06 +08:00
|
|
|
GtkTreeIter *return_iter)
|
|
|
|
{
|
2005-10-20 04:34:20 +08:00
|
|
|
GtkTreePath *path = gtk_tree_path_new_first ();
|
2004-01-12 06:00:06 +08:00
|
|
|
GtkTreeIter parent;
|
2005-05-19 06:21:07 +08:00
|
|
|
gboolean found;
|
2004-01-12 06:00:06 +08:00
|
|
|
|
2005-05-19 06:21:07 +08:00
|
|
|
if (! gtk_tree_model_get_iter (model, &parent, path))
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_path_free (path);
|
|
|
|
return FALSE;
|
1999-02-04 09:31:33 +08:00
|
|
|
}
|
|
|
|
|
2005-10-20 04:34:20 +08:00
|
|
|
found = find_existing_mpath_helper (model, &parent, path, mpath, return_iter);
|
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_path_free (path);
|
2005-05-19 06:21:07 +08:00
|
|
|
|
|
|
|
return found;
|
2004-01-12 06:00:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-09-30 18:57:57 +08:00
|
|
|
get_parent (PluginBrowser *browser,
|
2005-10-20 04:34:20 +08:00
|
|
|
const gchar *mpath,
|
2004-09-30 18:57:57 +08:00
|
|
|
GtkTreeIter *parent)
|
2004-01-12 06:00:06 +08:00
|
|
|
{
|
|
|
|
GtkTreeIter last_parent;
|
|
|
|
gchar *tmp_ptr;
|
|
|
|
gchar *str_ptr;
|
|
|
|
GtkTreeStore *tree_store;
|
|
|
|
|
2005-10-20 04:34:20 +08:00
|
|
|
if (! mpath)
|
2004-01-12 06:00:06 +08:00
|
|
|
return;
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
2004-01-12 06:00:06 +08:00
|
|
|
|
|
|
|
/* Lookup for existing mpath */
|
|
|
|
if (find_existing_mpath (GTK_TREE_MODEL (tree_store), mpath, parent))
|
|
|
|
return;
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
tmp_ptr = g_strdup (mpath);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2005-10-20 04:34:20 +08: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 09:31:33 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
if (str_ptr == NULL)
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_store_append (tree_store, parent, NULL);
|
|
|
|
gtk_tree_store_set (tree_store, parent,
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_MPATH, mpath,
|
|
|
|
TREE_COLUMN_PATH_NAME, mpath,
|
2004-01-12 06:00:06 +08:00
|
|
|
-1);
|
1999-02-04 09:31:33 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-03 15:46:16 +08:00
|
|
|
gchar *leaf_ptr;
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2011-10-03 15:45:23 +08:00
|
|
|
leaf_ptr = g_strdup (str_ptr + 1);
|
2005-05-19 06:21:07 +08:00
|
|
|
*str_ptr = '\0';
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
get_parent (browser, tmp_ptr, &last_parent);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_store_append (tree_store, parent, &last_parent);
|
|
|
|
gtk_tree_store_set (tree_store, parent,
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_MPATH, mpath,
|
|
|
|
TREE_COLUMN_PATH_NAME, leaf_ptr,
|
2004-01-12 06:00:06 +08:00
|
|
|
-1);
|
2011-10-03 15:46:16 +08:00
|
|
|
|
|
|
|
g_free (leaf_ptr);
|
1999-02-04 09:31:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-09-30 18:57:57 +08:00
|
|
|
insert_into_tree_view (PluginBrowser *browser,
|
2005-10-12 18:12:36 +08:00
|
|
|
const gchar *name,
|
|
|
|
gint64 xtime,
|
|
|
|
const gchar *xtimestr,
|
2019-09-08 20:54:17 +08:00
|
|
|
const gchar *menu_path,
|
2005-10-12 18:12:36 +08:00
|
|
|
const gchar *types_str,
|
2004-09-30 18:57:57 +08:00
|
|
|
PInfo *pinfo)
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2004-01-12 06:00:06 +08:00
|
|
|
GtkTreeStore *tree_store;
|
2019-09-11 01:47:12 +08:00
|
|
|
GtkTreeIter parent, iter;
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-09-08 20:54:17 +08:00
|
|
|
get_parent (browser, menu_path, &parent);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_store_append (tree_store, &iter, &parent);
|
|
|
|
gtk_tree_store_set (tree_store, &iter,
|
2019-09-08 20:54:17 +08:00
|
|
|
TREE_COLUMN_MPATH, menu_path,
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_PATH_NAME, name,
|
|
|
|
TREE_COLUMN_IMAGE_TYPES, types_str,
|
2005-10-12 18:12:36 +08:00
|
|
|
TREE_COLUMN_DATE, xtime,
|
|
|
|
TREE_COLUMN_DATE_STRING, xtimestr,
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_PINFO, pinfo,
|
2004-01-12 06:00:06 +08:00
|
|
|
-1);
|
1999-02-04 09:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-05-19 06:21:07 +08:00
|
|
|
browser_search (GimpBrowser *gimp_browser,
|
2005-05-19 07:48:47 +08:00
|
|
|
const gchar *search_text,
|
2005-05-19 06:21:07 +08:00
|
|
|
gint search_type,
|
|
|
|
PluginBrowser *browser)
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
libgimp, plug-ins: move gimp_pdb_run_procedure*() to gimp_procedure_run*().
The gimp_procedure_run() already existed, though it was with an ordered
GimpValueArray array of arguments. Its usage feels redundant to the series of
gimp_pdb_run_procedure*() functions (which is confusing), but
gimp_procedure_run() was actually a bit more generic, because it does not
necessarily calls GimpProcedure-s through the PDB! For instance, it can runs a
local GimpProcedure, such as the case of one procedure which would want to call
another procedure in the same plug-in, but without having to go through PDB. Of
course, for local code, you may as well run relevant functions directly, yet it
makes sense that if one of the redundant-looking function is removed, it should
be the more specific one. Also gimp_procedure_run() feels a lot simpler and
logical, API wise.
A main difference in usage is that now, plug-in developers have to first
explicitly look up the GimpPdbProcedure with gimp_pdb_lookup_procedure() when
they wish to call PDB procedures on the wire. This was done anyway in the
gimp_pdb_run_procedure*() code, now it's explicit (rather than calling by name
directly).
Concretely:
* gimp_pdb_run_procedure(), gimp_pdb_run_procedure_config() and
gimp_pdb_run_procedure_valist() are removed.
* gimp_procedure_run() API is modified to use a variable args list instead of a
GimpValueArray.
* gimp_procedure_run_config() and gimp_procedure_run_valist() are added.
* gimp_procedure_run_config() in particular will be the one used in bindings
which don't have variable args support through a (rename-to
gimp_procedure_run) annotation.
2023-10-18 23:11:20 +08:00
|
|
|
GimpProcedure *procedure;
|
2019-08-07 01:11:56 +08:00
|
|
|
GimpValueArray *return_vals;
|
2020-12-24 04:15:43 +08:00
|
|
|
const gchar **procedure_strs;
|
2019-08-07 01:11:56 +08:00
|
|
|
gint num_plugins = 0;
|
|
|
|
gchar *str;
|
|
|
|
GtkListStore *list_store;
|
|
|
|
GtkTreeStore *tree_store;
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2005-05-19 06:21:07 +08:00
|
|
|
gimp_browser_show_message (GIMP_BROWSER (browser->browser),
|
2005-10-06 07:31:49 +08:00
|
|
|
_("Searching by name"));
|
2004-09-30 18:57:57 +08:00
|
|
|
|
libgimp, plug-ins: move gimp_pdb_run_procedure*() to gimp_procedure_run*().
The gimp_procedure_run() already existed, though it was with an ordered
GimpValueArray array of arguments. Its usage feels redundant to the series of
gimp_pdb_run_procedure*() functions (which is confusing), but
gimp_procedure_run() was actually a bit more generic, because it does not
necessarily calls GimpProcedure-s through the PDB! For instance, it can runs a
local GimpProcedure, such as the case of one procedure which would want to call
another procedure in the same plug-in, but without having to go through PDB. Of
course, for local code, you may as well run relevant functions directly, yet it
makes sense that if one of the redundant-looking function is removed, it should
be the more specific one. Also gimp_procedure_run() feels a lot simpler and
logical, API wise.
A main difference in usage is that now, plug-in developers have to first
explicitly look up the GimpPdbProcedure with gimp_pdb_lookup_procedure() when
they wish to call PDB procedures on the wire. This was done anyway in the
gimp_pdb_run_procedure*() code, now it's explicit (rather than calling by name
directly).
Concretely:
* gimp_pdb_run_procedure(), gimp_pdb_run_procedure_config() and
gimp_pdb_run_procedure_valist() are removed.
* gimp_procedure_run() API is modified to use a variable args list instead of a
GimpValueArray.
* gimp_procedure_run_config() and gimp_procedure_run_valist() are added.
* gimp_procedure_run_config() in particular will be the one used in bindings
which don't have variable args support through a (rename-to
gimp_procedure_run) annotation.
2023-10-18 23:11:20 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (),
|
|
|
|
"gimp-plug-ins-query");
|
|
|
|
return_vals = gimp_procedure_run (procedure,
|
|
|
|
"search-string", search_text,
|
|
|
|
NULL);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-08-20 07:03:38 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-08-07 01:11:56 +08:00
|
|
|
{
|
2020-12-24 04:15:43 +08:00
|
|
|
procedure_strs = GIMP_VALUES_GET_STRV (return_vals, 1);
|
|
|
|
num_plugins = g_strv_length ((gchar **) procedure_strs);
|
2019-08-07 01:11:56 +08:00
|
|
|
}
|
2004-09-30 08:33:34 +08:00
|
|
|
|
2005-07-06 09:51:17 +08:00
|
|
|
if (! search_text || strlen (search_text) == 0)
|
|
|
|
{
|
2006-06-27 15:49:14 +08:00
|
|
|
str = g_strdup_printf (ngettext ("%d plug-in", "%d plug-ins",
|
|
|
|
num_plugins),
|
|
|
|
num_plugins);
|
2005-07-06 09:51:17 +08:00
|
|
|
}
|
2005-05-13 23:58:16 +08:00
|
|
|
else
|
2005-07-06 09:51:17 +08:00
|
|
|
{
|
|
|
|
switch (num_plugins)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
str = g_strdup (_("No matches for your query"));
|
|
|
|
break;
|
|
|
|
default:
|
2005-10-06 07:31:49 +08: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 09:51:17 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-10-29 18:47:59 +08:00
|
|
|
|
2011-01-01 01:19:37 +08:00
|
|
|
gimp_browser_set_search_summary (gimp_browser, str);
|
2005-05-13 23:58:16 +08:00
|
|
|
g_free (str);
|
2004-09-30 08:33:34 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
list_store = GTK_LIST_STORE (gtk_tree_view_get_model (browser->list_view));
|
|
|
|
gtk_list_store_clear (list_store);
|
2004-01-12 06:00:06 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
|
|
|
gtk_tree_store_clear (tree_store);
|
2004-01-12 06:00:06 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
if (num_plugins > 0)
|
|
|
|
{
|
|
|
|
GtkTreeSelection *sel;
|
|
|
|
GtkTreeIter iter;
|
2019-08-07 01:11:56 +08:00
|
|
|
const gchar **accel_strs;
|
|
|
|
const gchar **prog_strs;
|
|
|
|
const gint *time_ints;
|
2005-05-13 23:58:16 +08:00
|
|
|
gint i;
|
|
|
|
|
2020-12-24 04:15:43 +08: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 23:58:16 +08:00
|
|
|
|
|
|
|
for (i = 0; i < num_plugins; i++)
|
2004-01-12 06:00:06 +08:00
|
|
|
{
|
2019-09-08 20:54:17 +08: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-20 04:34:20 +08:00
|
|
|
|
|
|
|
/* Strip off trailing ellipsis */
|
2019-09-08 20:54:17 +08:00
|
|
|
tmp = strstr (menu_label, "...");
|
|
|
|
if (tmp && tmp == (menu_label + strlen (menu_label) - 3))
|
|
|
|
*tmp = '\0';
|
2004-01-12 06:00:06 +08:00
|
|
|
|
2019-09-08 20:54:17 +08:00
|
|
|
tmp = gimp_strip_uline (menu_label);
|
|
|
|
g_free (menu_label);
|
|
|
|
menu_label = tmp;
|
2004-01-12 06:00:06 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
tx = time_ints[i];
|
2004-01-12 06:00:06 +08:00
|
|
|
if (tx)
|
|
|
|
{
|
2004-08-29 02:56:46 +08:00
|
|
|
const gchar *format = "%c"; /* gcc workaround to avoid warning */
|
2004-09-30 08:33:34 +08:00
|
|
|
gchar *utf8;
|
2003-08-14 07:50:27 +08:00
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
x = localtime (&tx);
|
2004-08-29 02:56:46 +08:00
|
|
|
ret = strftime (xtimestr, sizeof (xtimestr), format, x);
|
2004-01-12 06:00:06 +08:00
|
|
|
xtimestr[ret] = 0;
|
2003-08-14 07:50:27 +08:00
|
|
|
|
|
|
|
if ((utf8 = g_locale_to_utf8 (xtimestr, -1, NULL, NULL, NULL)))
|
|
|
|
{
|
2019-08-15 05:52:38 +08:00
|
|
|
g_strlcpy (xtimestr, utf8, sizeof (xtimestr));
|
2003-08-14 07:50:27 +08:00
|
|
|
g_free (utf8);
|
|
|
|
}
|
2004-01-12 06:00:06 +08:00
|
|
|
}
|
|
|
|
else
|
2005-05-13 23:58:16 +08:00
|
|
|
{
|
|
|
|
strcpy (xtimestr, "");
|
|
|
|
}
|
2004-01-12 06:00:06 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
pinfo = g_new0 (PInfo, 1);
|
|
|
|
|
2019-09-08 20:54:17 +08: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-12 06:00:06 +08:00
|
|
|
|
|
|
|
gtk_list_store_append (list_store, &iter);
|
|
|
|
gtk_list_store_set (list_store, &iter,
|
2019-09-08 20:54:17 +08:00
|
|
|
LIST_COLUMN_NAME, menu_label,
|
2005-10-12 18:12:36 +08:00
|
|
|
LIST_COLUMN_DATE, (gint64) tx,
|
|
|
|
LIST_COLUMN_DATE_STRING, xtimestr,
|
2019-09-08 20:54:17 +08:00
|
|
|
LIST_COLUMN_PATH, menu_path,
|
|
|
|
LIST_COLUMN_IMAGE_TYPES, types,
|
2005-05-19 06:21:07 +08:00
|
|
|
LIST_COLUMN_PINFO, pinfo,
|
2004-01-12 06:00:06 +08:00
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Now do the tree view.... */
|
2004-09-30 08:33:34 +08:00
|
|
|
insert_into_tree_view (browser,
|
2019-09-08 20:54:17 +08:00
|
|
|
menu_label,
|
2005-10-12 18:12:36 +08:00
|
|
|
(gint64) tx,
|
2004-01-12 06:00:06 +08:00
|
|
|
xtimestr,
|
2019-09-08 20:54:17 +08:00
|
|
|
menu_path,
|
|
|
|
types,
|
2004-01-12 06:00:06 +08:00
|
|
|
pinfo);
|
2019-08-07 01:11:56 +08:00
|
|
|
|
2019-09-08 20:54:17 +08:00
|
|
|
g_free (menu_label);
|
2004-01-12 06:00:06 +08:00
|
|
|
}
|
2004-09-30 18:57:57 +08: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-12 06:00:06 +08:00
|
|
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
|
2005-05-19 06:21:07 +08:00
|
|
|
LIST_COLUMN_NAME,
|
2004-01-12 06:00:06 +08:00
|
|
|
GTK_SORT_ASCENDING);
|
2004-09-30 18:57:57 +08:00
|
|
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree_store),
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_PATH_NAME,
|
2004-09-30 18:57:57 +08:00
|
|
|
GTK_SORT_ASCENDING);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser->list_view));
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store),
|
|
|
|
&iter);
|
|
|
|
gtk_tree_selection_select_iter (sel, &iter);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-19 06:21:07 +08:00
|
|
|
gimp_browser_show_message (GIMP_BROWSER (browser->browser),
|
|
|
|
_("No matches"));
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
2004-09-30 18:57:57 +08:00
|
|
|
|
2019-08-07 01:11:56 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
1999-02-04 09:31:33 +08:00
|
|
|
|
|
|
|
static GtkWidget *
|
2004-09-30 18:57:57 +08:00
|
|
|
browser_dialog_new (void)
|
1999-02-04 09:31:33 +08:00
|
|
|
{
|
2005-08-15 19:07:27 +08:00
|
|
|
PluginBrowser *browser;
|
2005-05-19 06:21:07 +08:00
|
|
|
GtkWidget *label, *notebook;
|
|
|
|
GtkWidget *scrolled_window;
|
2004-01-12 06:00:06 +08:00
|
|
|
GtkListStore *list_store;
|
|
|
|
GtkTreeStore *tree_store;
|
|
|
|
GtkWidget *list_view;
|
|
|
|
GtkWidget *tree_view;
|
2009-10-10 21:10:14 +08:00
|
|
|
GtkWidget *parent;
|
2004-01-12 06:00:06 +08:00
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
GtkCellRenderer *renderer;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkTreeIter iter;
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2019-09-21 01:39:00 +08:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-09-30 18:57:57 +08:00
|
|
|
browser = g_new0 (PluginBrowser, 1);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2017-03-22 00:45:50 +08:00
|
|
|
browser->dialog = gimp_dialog_new (_("Plug-in Browser"), PLUG_IN_ROLE,
|
2005-05-13 23:58:16 +08:00
|
|
|
NULL, 0,
|
2005-08-15 19:07:27 +08:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
2000-01-08 23:23:28 +08:00
|
|
|
|
2017-02-12 23:18:24 +08:00
|
|
|
_("_Close"), GTK_RESPONSE_CLOSE,
|
2000-01-08 23:23:28 +08:00
|
|
|
|
2005-05-13 23:58:16 +08:00
|
|
|
NULL);
|
2023-04-16 07:43:48 +08:00
|
|
|
gtk_window_set_default_size (GTK_WINDOW (browser->dialog), DBL_WIDTH,
|
|
|
|
DBL_WIDTH - DBL_LIST_WIDTH);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
g_signal_connect (browser->dialog, "response",
|
2004-09-30 18:57:57 +08:00
|
|
|
G_CALLBACK (browser_dialog_response),
|
2004-09-30 08:33:34 +08:00
|
|
|
browser);
|
2000-01-08 23:23:28 +08:00
|
|
|
|
2005-05-19 06:21:07 +08:00
|
|
|
browser->browser = gimp_browser_new ();
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (browser->browser), 12);
|
2011-03-04 17:44:58 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (browser->dialog))),
|
|
|
|
browser->browser, TRUE, TRUE, 0);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_widget_show (browser->browser);
|
2005-05-13 23:58:16 +08:00
|
|
|
|
2005-05-19 06:21:07 +08:00
|
|
|
g_signal_connect (browser->browser, "search",
|
|
|
|
G_CALLBACK (browser_search),
|
2005-05-13 23:58:16 +08:00
|
|
|
browser);
|
2004-09-30 08:33:34 +08:00
|
|
|
|
1999-02-04 09:31:33 +08:00
|
|
|
/* left = notebook */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
notebook = gtk_notebook_new ();
|
2011-01-01 01:19:37 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (gimp_browser_get_left_vbox (GIMP_BROWSER (browser->browser))),
|
2005-05-19 06:21:07 +08:00
|
|
|
notebook, TRUE, TRUE, 0);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
|
|
|
/* list : list in a scrolled_win */
|
2005-05-19 06:21:07 +08:00
|
|
|
list_store = gtk_list_store_new (N_LIST_COLUMNS,
|
2004-01-17 08:26:49 +08:00
|
|
|
G_TYPE_STRING,
|
2005-10-12 18:12:36 +08:00
|
|
|
G_TYPE_INT64,
|
2004-01-17 08:26:49 +08: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 08:33:34 +08:00
|
|
|
browser->list_view = GTK_TREE_VIEW (list_view);
|
2004-01-12 06:00:06 +08:00
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2004-01-17 08:26:49 +08:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Name"),
|
|
|
|
renderer,
|
2005-05-19 06:21:07 +08:00
|
|
|
"text", LIST_COLUMN_NAME,
|
2004-01-17 08:26:49 +08:00
|
|
|
NULL);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, LIST_COLUMN_NAME);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (list_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2004-09-30 08:33:34 +08:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Menu Path"),
|
2004-01-17 08:26:49 +08:00
|
|
|
renderer,
|
2005-05-19 06:21:07 +08:00
|
|
|
"text", LIST_COLUMN_PATH,
|
2004-01-17 08:26:49 +08:00
|
|
|
NULL);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, LIST_COLUMN_PATH);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (list_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2004-09-30 08:33:34 +08:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Image Types"),
|
2004-01-17 08:26:49 +08:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-05-19 06:21:07 +08:00
|
|
|
LIST_COLUMN_IMAGE_TYPES,
|
2004-01-17 08:26:49 +08:00
|
|
|
NULL);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, LIST_COLUMN_IMAGE_TYPES);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (list_view), column);
|
|
|
|
|
2005-07-06 08:31:59 +08:00
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
|
|
|
|
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Installation Date"),
|
|
|
|
renderer,
|
2005-10-12 18:12:36 +08:00
|
|
|
"text",
|
|
|
|
LIST_COLUMN_DATE_STRING,
|
2005-07-06 08:31:59 +08: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-19 06:21:07 +08: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 21:55:42 +08:00
|
|
|
GTK_SHADOW_IN);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
2004-01-12 06:00:06 +08:00
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
gtk_widget_set_size_request (list_view, DBL_LIST_WIDTH, DBL_HEIGHT);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view));
|
|
|
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
2004-09-30 08:33:34 +08:00
|
|
|
|
2004-01-17 08:26:49 +08:00
|
|
|
g_signal_connect (selection, "changed",
|
2004-09-30 18:57:57 +08:00
|
|
|
G_CALLBACK (browser_list_selection_changed),
|
2004-09-30 08:33:34 +08:00
|
|
|
browser);
|
2003-10-02 06:52:27 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("List View"));
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scrolled_window, label);
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), list_view);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_widget_show (list_view);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_widget_show (scrolled_window);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
|
|
|
/* notebook->ctree */
|
2005-05-19 06:21:07 +08:00
|
|
|
tree_store = gtk_tree_store_new (N_LIST_COLUMNS,
|
2004-01-17 08:26:49 +08:00
|
|
|
G_TYPE_STRING,
|
2005-10-12 18:12:36 +08:00
|
|
|
G_TYPE_INT64,
|
2004-01-17 08:26:49 +08: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 08:33:34 +08:00
|
|
|
browser->tree_view = GTK_TREE_VIEW (tree_view);
|
2004-01-12 06:00:06 +08:00
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2005-10-20 04:34:20 +08:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Menu Path"),
|
2004-01-12 06:00:06 +08:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-05-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_PATH_NAME,
|
2004-01-12 06:00:06 +08:00
|
|
|
NULL);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, TREE_COLUMN_PATH_NAME);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2005-07-06 08:31:59 +08:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Image Types"),
|
2004-01-12 06:00:06 +08:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-07-06 08:31:59 +08:00
|
|
|
TREE_COLUMN_IMAGE_TYPES,
|
2004-01-12 06:00:06 +08:00
|
|
|
NULL);
|
2005-07-06 08:31:59 +08:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, TREE_COLUMN_IMAGE_TYPES);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2005-07-06 08:31:59 +08:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Installation Date"),
|
2004-01-12 06:00:06 +08:00
|
|
|
renderer,
|
|
|
|
"text",
|
2005-10-12 18:12:36 +08:00
|
|
|
TREE_COLUMN_DATE_STRING,
|
2004-01-12 06:00:06 +08:00
|
|
|
NULL);
|
2005-07-06 08:31:59 +08:00
|
|
|
gtk_tree_view_column_set_sort_column_id (column, TREE_COLUMN_DATE);
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
|
|
|
|
2005-05-19 06:21:07 +08: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 21:55:42 +08:00
|
|
|
GTK_SHADOW_IN);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
2004-01-12 06:00:06 +08: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 08:33:34 +08:00
|
|
|
|
2004-01-17 08:26:49 +08:00
|
|
|
g_signal_connect (selection, "changed",
|
2004-09-30 18:57:57 +08:00
|
|
|
G_CALLBACK (browser_tree_selection_changed),
|
2004-09-30 08:33:34 +08:00
|
|
|
browser);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2004-11-10 21:01:06 +08:00
|
|
|
label = gtk_label_new (_("Tree View"));
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scrolled_window, label);
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
gtk_widget_show (tree_view);
|
2005-05-19 06:21:07 +08:00
|
|
|
gtk_widget_show (scrolled_window);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (notebook);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2011-01-01 01:19:37 +08:00
|
|
|
parent = gtk_widget_get_parent (gimp_browser_get_right_vbox (GIMP_BROWSER (browser->browser)));
|
2009-10-10 21:10:14 +08:00
|
|
|
parent = gtk_widget_get_parent (parent);
|
|
|
|
|
|
|
|
gtk_widget_set_size_request (parent, DBL_WIDTH - DBL_LIST_WIDTH, -1);
|
2003-10-02 06:52:27 +08:00
|
|
|
|
1999-02-04 09:31:33 +08:00
|
|
|
/* now build the list */
|
2005-05-19 07:48:47 +08:00
|
|
|
browser_search (GIMP_BROWSER (browser->browser), "", 0, browser);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_widget_show (browser->dialog);
|
2003-10-02 06:52:27 +08:00
|
|
|
|
2004-01-12 06:00:06 +08:00
|
|
|
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view)),
|
|
|
|
&iter);
|
1999-02-04 09:31:33 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
return browser->dialog;
|
1999-02-04 09:31:33 +08:00
|
|
|
}
|
2004-09-30 18:57:57 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
browser_dialog_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
PluginBrowser *browser)
|
|
|
|
{
|
2005-05-13 23:58:16 +08:00
|
|
|
gtk_widget_destroy (browser->dialog);
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
2004-09-30 18:57:57 +08: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-19 06:21:07 +08:00
|
|
|
LIST_COLUMN_PINFO, &pinfo,
|
|
|
|
LIST_COLUMN_PATH, &mpath,
|
2004-09-30 18:57:57 +08: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 20:17:18 +08:00
|
|
|
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
2019-09-08 20:54:17 +08:00
|
|
|
gimp_proc_view_new (pinfo->procedure));
|
2004-09-30 18:57:57 +08: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-19 06:21:07 +08:00
|
|
|
TREE_COLUMN_PINFO, &pinfo,
|
|
|
|
TREE_COLUMN_MPATH, &mpath,
|
2004-09-30 18:57:57 +08: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-19 06:21:07 +08:00
|
|
|
LIST_COLUMN_PATH, &picked_mpath,
|
2004-09-30 18:57:57 +08:00
|
|
|
-1);
|
|
|
|
if (picked_mpath && !strcmp (mpath, picked_mpath))
|
|
|
|
{
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2005-10-20 04:34:20 +08:00
|
|
|
|
2004-09-30 18:57:57 +08:00
|
|
|
g_free (picked_mpath);
|
|
|
|
valid = gtk_tree_model_iter_next (model, &iter);
|
|
|
|
}
|
2005-10-20 04:34:20 +08:00
|
|
|
|
2004-09-30 18:57:57 +08: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-19 06:21:07 +08:00
|
|
|
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
2019-09-08 20:54:17 +08:00
|
|
|
gimp_proc_view_new (pinfo->procedure));
|
2004-09-30 18:57:57 +08:00
|
|
|
}
|