mirror of https://github.com/GNOME/gimp.git
app: keep the plug-in executable path around as GFile
This commit is contained in:
parent
4bd2f3e87c
commit
c3573c3c45
|
@ -52,7 +52,7 @@
|
|||
/* local function prototypes */
|
||||
|
||||
static void plug_in_actions_menu_branch_added (GimpPlugInManager *manager,
|
||||
const gchar *progname,
|
||||
GFile *file,
|
||||
const gchar *menu_path,
|
||||
const gchar *menu_label,
|
||||
GimpActionGroup *group);
|
||||
|
@ -175,7 +175,7 @@ plug_in_actions_setup (GimpActionGroup *group)
|
|||
GimpPlugInMenuBranch *branch = list->data;
|
||||
|
||||
plug_in_actions_menu_branch_added (manager,
|
||||
branch->prog_name,
|
||||
branch->file,
|
||||
branch->menu_path,
|
||||
branch->menu_label,
|
||||
group);
|
||||
|
@ -192,7 +192,7 @@ plug_in_actions_setup (GimpActionGroup *group)
|
|||
{
|
||||
GimpPlugInProcedure *plug_in_proc = list->data;
|
||||
|
||||
if (plug_in_proc->prog)
|
||||
if (plug_in_proc->file)
|
||||
plug_in_actions_register_procedure (group->gimp->pdb,
|
||||
GIMP_PROCEDURE (plug_in_proc),
|
||||
group);
|
||||
|
@ -300,7 +300,7 @@ plug_in_actions_update (GimpActionGroup *group,
|
|||
|
||||
static void
|
||||
plug_in_actions_menu_branch_added (GimpPlugInManager *manager,
|
||||
const gchar *progname,
|
||||
GFile *file,
|
||||
const gchar *menu_path,
|
||||
const gchar *menu_label,
|
||||
GimpActionGroup *group)
|
||||
|
@ -311,8 +311,7 @@ plug_in_actions_menu_branch_added (GimpPlugInManager *manager,
|
|||
gchar *full;
|
||||
gchar *full_translated;
|
||||
|
||||
locale_domain = gimp_plug_in_manager_get_locale_domain (manager,
|
||||
progname, NULL);
|
||||
locale_domain = gimp_plug_in_manager_get_locale_domain (manager, file, NULL);
|
||||
|
||||
path_translated = dgettext (locale_domain, menu_path);
|
||||
label_translated = dgettext (locale_domain, menu_label);
|
||||
|
|
|
@ -52,6 +52,7 @@ VOID: OBJECT, BOOLEAN
|
|||
VOID: OBJECT, INT
|
||||
VOID: OBJECT, OBJECT
|
||||
VOID: OBJECT, POINTER
|
||||
VOID: OBJECT, STRING, STRING
|
||||
VOID: POINTER
|
||||
VOID: POINTER, BOXED
|
||||
VOID: POINTER, ENUM
|
||||
|
|
|
@ -126,7 +126,7 @@ plug_in_menus_setup (GimpUIManager *manager,
|
|||
{
|
||||
GimpPlugInProcedure *plug_in_proc = list->data;
|
||||
|
||||
if (! plug_in_proc->prog)
|
||||
if (! plug_in_proc->file)
|
||||
continue;
|
||||
|
||||
g_signal_connect_object (plug_in_proc, "menu-path-added",
|
||||
|
@ -143,17 +143,17 @@ plug_in_menus_setup (GimpUIManager *manager,
|
|||
if (g_str_has_prefix (path->data, manager->name))
|
||||
{
|
||||
PlugInMenuEntry *entry = g_slice_new0 (PlugInMenuEntry);
|
||||
const gchar *progname;
|
||||
GFile *file;
|
||||
const gchar *locale_domain;
|
||||
|
||||
entry->proc = plug_in_proc;
|
||||
entry->menu_path = path->data;
|
||||
|
||||
progname = gimp_plug_in_procedure_get_progname (plug_in_proc);
|
||||
file = gimp_plug_in_procedure_get_file (plug_in_proc);
|
||||
|
||||
locale_domain =
|
||||
gimp_plug_in_manager_get_locale_domain (plug_in_manager,
|
||||
progname, NULL);
|
||||
file, NULL);
|
||||
|
||||
if (plug_in_proc->menu_label)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ help_invoker (GimpProcedure *procedure,
|
|||
if (! help_domain && manager->current_plug_in)
|
||||
help_domain = (gchar *)
|
||||
gimp_plug_in_manager_get_help_domain (manager,
|
||||
manager->current_plug_in->prog,
|
||||
manager->current_plug_in->file,
|
||||
NULL);
|
||||
|
||||
gimp_help (gimp, progress, help_domain, help_id);
|
||||
|
|
|
@ -218,7 +218,7 @@ plugin_menu_branch_register_invoker (GimpProcedure *procedure,
|
|||
if (plug_in)
|
||||
{
|
||||
gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager,
|
||||
plug_in->prog, menu_path, menu_name);
|
||||
plug_in->file, menu_path, menu_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@ gimp_plug_in_handle_message (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"sent a CONFIG message. This should not happen.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
break;
|
||||
|
||||
|
@ -111,7 +111,7 @@ gimp_plug_in_handle_message (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"sent a TILE_ACK message. This should not happen.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
break;
|
||||
|
||||
|
@ -120,7 +120,7 @@ gimp_plug_in_handle_message (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"sent a TILE_DATA message. This should not happen.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
break;
|
||||
|
||||
|
@ -137,7 +137,7 @@ gimp_plug_in_handle_message (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"sent a TEMP_PROC_RUN message. This should not happen.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
break;
|
||||
|
||||
|
@ -240,7 +240,7 @@ gimp_plug_in_handle_tile_put (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"tried writing to invalid drawable %d (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
tile_info->drawable_ID);
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
|
@ -252,7 +252,7 @@ gimp_plug_in_handle_tile_put (GimpPlugIn *plug_in,
|
|||
"tried writing to drawable %d which was removed "
|
||||
"from the image (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
tile_info->drawable_ID);
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
|
@ -278,7 +278,7 @@ gimp_plug_in_handle_tile_put (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"tried writing to a locked drawable %d (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
tile_info->drawable_ID);
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
|
@ -289,7 +289,7 @@ gimp_plug_in_handle_tile_put (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"tried writing to a group layer %d (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
tile_info->drawable_ID);
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
|
@ -308,7 +308,7 @@ gimp_plug_in_handle_tile_put (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"requested invalid tile (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ gimp_plug_in_handle_tile_get (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"tried reading from invalid drawable %d (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
request->drawable_ID);
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
|
@ -377,7 +377,7 @@ gimp_plug_in_handle_tile_get (GimpPlugIn *plug_in,
|
|||
"tried reading from drawable %d which was removed "
|
||||
"from the image (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
request->drawable_ID);
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
|
@ -404,7 +404,7 @@ gimp_plug_in_handle_tile_get (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"requested invalid tile (killing)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
return;
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in,
|
|||
"called deprecated procedure '%s'.\n"
|
||||
"It should call '%s' instead!",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
canonical, proc_name);
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n"
|
||||
"called deprecated procedure '%s'.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
canonical);
|
||||
}
|
||||
else
|
||||
|
@ -568,7 +568,7 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in,
|
|||
"called deprecated procedure '%s'.\n"
|
||||
"It should call '%s' instead!",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
canonical, procedure->deprecated);
|
||||
}
|
||||
}
|
||||
|
@ -696,7 +696,7 @@ gimp_plug_in_handle_temp_proc_return (GimpPlugIn *plug_in,
|
|||
"sent a TEMP_PROC_RETURN message while not running "
|
||||
"a temporary procedure. This should not happen.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
|
|||
"which fails to comply with the array parameter "
|
||||
"passing standard. Argument %d is noncompliant.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
canonical, i);
|
||||
g_free (canonical);
|
||||
return;
|
||||
|
@ -794,7 +794,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"attempted to install a procedure NULL parameter name.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
g_free (canonical);
|
||||
return;
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
|
|||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"attempted to install a procedure with invalid UTF-8 strings.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
g_free (canonical);
|
||||
return;
|
||||
}
|
||||
|
@ -817,7 +817,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
|
|||
case GIMP_PLUGIN:
|
||||
case GIMP_EXTENSION:
|
||||
procedure = gimp_plug_in_procedure_new (proc_install->type,
|
||||
plug_in->prog);
|
||||
plug_in->file);
|
||||
break;
|
||||
|
||||
case GIMP_TEMPORARY:
|
||||
|
@ -939,7 +939,7 @@ gimp_plug_in_handle_extension_ack (GimpPlugIn *plug_in)
|
|||
"sent an EXTENSION_ACK message while not being started "
|
||||
"as an extension. This should not happen.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -958,7 +958,7 @@ gimp_plug_in_handle_has_init (GimpPlugIn *plug_in)
|
|||
"sent an HAS_INIT message while not in query(). "
|
||||
"This should not happen.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
gimp_plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ static void
|
|||
gimp_plug_in_init (GimpPlugIn *plug_in)
|
||||
{
|
||||
plug_in->manager = NULL;
|
||||
plug_in->prog = NULL;
|
||||
plug_in->file = NULL;
|
||||
|
||||
plug_in->call_mode = GIMP_PLUG_IN_CALL_NONE;
|
||||
plug_in->open = FALSE;
|
||||
|
@ -168,7 +168,7 @@ gimp_plug_in_finalize (GObject *object)
|
|||
{
|
||||
GimpPlugIn *plug_in = GIMP_PLUG_IN (object);
|
||||
|
||||
g_free (plug_in->prog);
|
||||
g_object_unref (plug_in->file);
|
||||
|
||||
gimp_plug_in_proc_frame_dispose (&plug_in->main_proc_frame, plug_in);
|
||||
|
||||
|
@ -183,7 +183,7 @@ gimp_plug_in_new (GimpPlugInManager *manager,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpPlugInProcedure *procedure,
|
||||
const gchar *prog)
|
||||
GFile *file)
|
||||
{
|
||||
GimpPlugIn *plug_in;
|
||||
|
||||
|
@ -192,20 +192,20 @@ gimp_plug_in_new (GimpPlugInManager *manager,
|
|||
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
|
||||
g_return_val_if_fail (procedure == NULL ||
|
||||
GIMP_IS_PLUG_IN_PROCEDURE (procedure), NULL);
|
||||
g_return_val_if_fail (prog == NULL || g_path_is_absolute (prog), NULL);
|
||||
g_return_val_if_fail ((procedure != NULL || prog != NULL) &&
|
||||
! (procedure != NULL && prog != NULL), NULL);
|
||||
g_return_val_if_fail (file == NULL || G_IS_FILE (file), NULL);
|
||||
g_return_val_if_fail ((procedure != NULL || file != NULL) &&
|
||||
! (procedure != NULL && file != NULL), NULL);
|
||||
|
||||
plug_in = g_object_new (GIMP_TYPE_PLUG_IN, NULL);
|
||||
|
||||
if (! prog)
|
||||
prog = gimp_plug_in_procedure_get_progname (procedure);
|
||||
if (! file)
|
||||
file = gimp_plug_in_procedure_get_file (procedure);
|
||||
|
||||
gimp_object_take_name (GIMP_OBJECT (plug_in),
|
||||
g_filename_display_basename (prog));
|
||||
g_path_get_basename (gimp_file_get_utf8_name (file)));
|
||||
|
||||
plug_in->manager = manager;
|
||||
plug_in->prog = g_strdup (prog);
|
||||
plug_in->file = g_object_ref (file);
|
||||
|
||||
gimp_plug_in_proc_frame_init (&plug_in->main_proc_frame,
|
||||
context, progress, procedure);
|
||||
|
@ -218,6 +218,7 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
|
|||
GimpPlugInCallMode call_mode,
|
||||
gboolean synchronous)
|
||||
{
|
||||
gchar *progname;
|
||||
gint my_read[2];
|
||||
gint my_write[2];
|
||||
gchar **envp;
|
||||
|
@ -243,7 +244,7 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
|
|||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Unable to run plug-in \"%s\"\n(%s)\n\npipe() failed: %s",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -312,8 +313,10 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
|
|||
|
||||
stm = g_strdup_printf ("%d", plug_in->manager->gimp->stack_trace_mode);
|
||||
|
||||
progname = g_file_get_path (plug_in->file);
|
||||
|
||||
interp = gimp_interpreter_db_resolve (plug_in->manager->interpreter_db,
|
||||
plug_in->prog, &interp_arg);
|
||||
progname, &interp_arg);
|
||||
|
||||
argc = 0;
|
||||
|
||||
|
@ -323,7 +326,7 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
|
|||
if (interp_arg)
|
||||
args[argc++] = interp_arg;
|
||||
|
||||
args[argc++] = plug_in->prog;
|
||||
args[argc++] = progname;
|
||||
args[argc++] = "-gimp";
|
||||
args[argc++] = read_fd;
|
||||
args[argc++] = write_fd;
|
||||
|
@ -342,7 +345,7 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
|
|||
if (plug_in->manager->debug)
|
||||
{
|
||||
gchar **debug_argv = gimp_plug_in_debug_argv (plug_in->manager->debug,
|
||||
plug_in->prog,
|
||||
progname,
|
||||
debug_flag, args);
|
||||
|
||||
if (debug_argv)
|
||||
|
@ -364,9 +367,10 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
|
|||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Unable to run plug-in \"%s\"\n(%s)\n\n%s",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
g_clear_error (&error);
|
||||
g_free (progname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -408,6 +412,7 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
|
|||
g_free (stm);
|
||||
g_free (interp);
|
||||
g_free (interp_arg);
|
||||
g_free (progname);
|
||||
|
||||
return plug_in->open;
|
||||
}
|
||||
|
@ -445,7 +450,7 @@ gimp_plug_in_close (GimpPlugIn *plug_in,
|
|||
{
|
||||
if (plug_in->manager->gimp->be_verbose)
|
||||
g_print ("Terminating plug-in: '%s'\n",
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
|
||||
/* If the plug-in opened a process group, kill the group instead
|
||||
* of only the plug-in, so we kill the plug-in's children too
|
||||
|
@ -484,7 +489,7 @@ gimp_plug_in_close (GimpPlugIn *plug_in,
|
|||
{
|
||||
if (plug_in->manager->gimp->be_verbose)
|
||||
g_print ("Terminating plug-in: '%s'\n",
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
|
@ -641,7 +646,7 @@ gimp_plug_in_recv_message (GIOChannel *channel,
|
|||
"state. You may want to save your images and restart "
|
||||
"GIMP to be on the safe side."),
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog));
|
||||
gimp_file_get_utf8_name (plug_in->file));
|
||||
}
|
||||
|
||||
g_object_unref (plug_in);
|
||||
|
@ -892,7 +897,7 @@ gimp_plug_in_menu_register (GimpPlugIn *plug_in,
|
|||
"It has however not installed that procedure. This "
|
||||
"is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
menu_path, proc_name);
|
||||
|
||||
return FALSE;
|
||||
|
@ -924,7 +929,7 @@ gimp_plug_in_menu_register (GimpPlugIn *plug_in,
|
|||
"pass just the menu's label to "
|
||||
"gimp_install_procedure().",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
menu_path, proc_name);
|
||||
|
||||
return FALSE;
|
||||
|
@ -938,7 +943,7 @@ gimp_plug_in_menu_register (GimpPlugIn *plug_in,
|
|||
"in the menu \"%s\", but the procedure has no label. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name, menu_path);
|
||||
|
||||
return FALSE;
|
||||
|
@ -1004,10 +1009,10 @@ gimp_plug_in_add_temp_proc (GimpPlugIn *plug_in,
|
|||
GIMP_TEMPORARY_PROCEDURE (overridden));
|
||||
|
||||
locale_domain = gimp_plug_in_manager_get_locale_domain (plug_in->manager,
|
||||
plug_in->prog,
|
||||
plug_in->file,
|
||||
NULL);
|
||||
help_domain = gimp_plug_in_manager_get_help_domain (plug_in->manager,
|
||||
plug_in->prog,
|
||||
plug_in->file,
|
||||
NULL);
|
||||
|
||||
gimp_plug_in_procedure_set_locale_domain (GIMP_PLUG_IN_PROCEDURE (proc),
|
||||
|
|
|
@ -42,7 +42,7 @@ struct _GimpPlugIn
|
|||
GimpObject parent_instance;
|
||||
|
||||
GimpPlugInManager *manager;
|
||||
gchar *prog; /* Plug-in's full path name */
|
||||
GFile *file; /* Plug-in's full path name */
|
||||
|
||||
GimpPlugInCallMode call_mode; /* QUERY, INIT or RUN */
|
||||
guint open : 1; /* Is the plug-in open? */
|
||||
|
@ -83,7 +83,7 @@ GimpPlugIn * gimp_plug_in_new (GimpPlugInManager *manager,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpPlugInProcedure *procedure,
|
||||
const gchar *prog);
|
||||
GFile *file);
|
||||
|
||||
gboolean gimp_plug_in_open (GimpPlugIn *plug_in,
|
||||
GimpPlugInCallMode call_mode,
|
||||
|
|
|
@ -62,7 +62,7 @@ gimp_plug_in_def_finalize (GObject *object)
|
|||
{
|
||||
GimpPlugInDef *plug_in_def = GIMP_PLUG_IN_DEF (object);
|
||||
|
||||
g_free (plug_in_def->prog);
|
||||
g_object_unref (plug_in_def->file);
|
||||
g_free (plug_in_def->locale_domain_name);
|
||||
g_free (plug_in_def->locale_domain_path);
|
||||
g_free (plug_in_def->help_domain_name);
|
||||
|
@ -80,7 +80,7 @@ gimp_plug_in_def_get_memsize (GimpObject *object,
|
|||
GimpPlugInDef *plug_in_def = GIMP_PLUG_IN_DEF (object);
|
||||
gint64 memsize = 0;
|
||||
|
||||
memsize += gimp_string_get_memsize (plug_in_def->prog);
|
||||
memsize += gimp_g_object_get_memsize (G_OBJECT (plug_in_def->file));
|
||||
memsize += gimp_string_get_memsize (plug_in_def->locale_domain_name);
|
||||
memsize += gimp_string_get_memsize (plug_in_def->locale_domain_path);
|
||||
memsize += gimp_string_get_memsize (plug_in_def->help_domain_name);
|
||||
|
@ -96,15 +96,15 @@ gimp_plug_in_def_get_memsize (GimpObject *object,
|
|||
/* public functions */
|
||||
|
||||
GimpPlugInDef *
|
||||
gimp_plug_in_def_new (const gchar *prog)
|
||||
gimp_plug_in_def_new (GFile *file)
|
||||
{
|
||||
GimpPlugInDef *plug_in_def;
|
||||
|
||||
g_return_val_if_fail (prog != NULL, NULL);
|
||||
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
||||
|
||||
plug_in_def = g_object_new (GIMP_TYPE_PLUG_IN_DEF, NULL);
|
||||
|
||||
plug_in_def->prog = g_strdup (prog);
|
||||
plug_in_def->file = g_object_ref (file);
|
||||
|
||||
return plug_in_def;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ struct _GimpPlugInDef
|
|||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *prog;
|
||||
GFile *file;
|
||||
GSList *procedures;
|
||||
gchar *locale_domain_name;
|
||||
gchar *locale_domain_path;
|
||||
|
@ -56,7 +56,7 @@ struct _GimpPlugInDefClass
|
|||
|
||||
GType gimp_plug_in_def_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpPlugInDef * gimp_plug_in_def_new (const gchar *prog);
|
||||
GimpPlugInDef * gimp_plug_in_def_new (GFile *file);
|
||||
|
||||
void gimp_plug_in_def_add_procedure (GimpPlugInDef *plug_in_def,
|
||||
GimpPlugInProcedure *proc);
|
||||
|
|
|
@ -63,7 +63,7 @@ gimp_plug_in_manager_call_query (GimpPlugInManager *manager,
|
|||
g_return_if_fail (GIMP_IS_PLUG_IN_DEF (plug_in_def));
|
||||
|
||||
plug_in = gimp_plug_in_new (manager, context, NULL,
|
||||
NULL, plug_in_def->prog);
|
||||
NULL, plug_in_def->file);
|
||||
|
||||
if (plug_in)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ gimp_plug_in_manager_call_init (GimpPlugInManager *manager,
|
|||
g_return_if_fail (GIMP_IS_PLUG_IN_DEF (plug_in_def));
|
||||
|
||||
plug_in = gimp_plug_in_new (manager, context, NULL,
|
||||
NULL, plug_in_def->prog);
|
||||
NULL, plug_in_def->file);
|
||||
|
||||
if (plug_in)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "plug-in-types.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "plug-in-types.h"
|
||||
|
||||
|
@ -33,7 +33,7 @@ typedef struct _GimpPlugInHelpDomain GimpPlugInHelpDomain;
|
|||
|
||||
struct _GimpPlugInHelpDomain
|
||||
{
|
||||
gchar *prog_name;
|
||||
GFile *file;
|
||||
gchar *domain_name;
|
||||
gchar *domain_uri;
|
||||
};
|
||||
|
@ -50,7 +50,7 @@ gimp_plug_in_manager_help_domain_exit (GimpPlugInManager *manager)
|
|||
{
|
||||
GimpPlugInHelpDomain *domain = list->data;
|
||||
|
||||
g_free (domain->prog_name);
|
||||
g_object_unref (domain->file);
|
||||
g_free (domain->domain_name);
|
||||
g_free (domain->domain_uri);
|
||||
g_slice_free (GimpPlugInHelpDomain, domain);
|
||||
|
@ -62,19 +62,19 @@ gimp_plug_in_manager_help_domain_exit (GimpPlugInManager *manager)
|
|||
|
||||
void
|
||||
gimp_plug_in_manager_add_help_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar *domain_name,
|
||||
const gchar *domain_uri)
|
||||
{
|
||||
GimpPlugInHelpDomain *domain;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
||||
g_return_if_fail (prog_name != NULL);
|
||||
g_return_if_fail (G_IS_FILE (file));
|
||||
g_return_if_fail (domain_name != NULL);
|
||||
|
||||
domain = g_slice_new (GimpPlugInHelpDomain);
|
||||
|
||||
domain->prog_name = g_strdup (prog_name);
|
||||
domain->file = g_object_ref (file);
|
||||
domain->domain_name = g_strdup (domain_name);
|
||||
domain->domain_uri = g_strdup (domain_uri);
|
||||
|
||||
|
@ -89,26 +89,27 @@ gimp_plug_in_manager_add_help_domain (GimpPlugInManager *manager,
|
|||
|
||||
const gchar *
|
||||
gimp_plug_in_manager_get_help_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar **domain_uri)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
|
||||
g_return_val_if_fail (file == NULL || G_IS_FILE (file), NULL);
|
||||
|
||||
if (domain_uri)
|
||||
*domain_uri = NULL;
|
||||
|
||||
/* A NULL prog_name is GIMP itself, return the default domain */
|
||||
if (! prog_name)
|
||||
if (! file)
|
||||
return NULL;
|
||||
|
||||
for (list = manager->help_domains; list; list = list->next)
|
||||
{
|
||||
GimpPlugInHelpDomain *domain = list->data;
|
||||
|
||||
if (domain && domain->prog_name &&
|
||||
! strcmp (domain->prog_name, prog_name))
|
||||
if (domain && domain->file &&
|
||||
g_file_equal (domain->file, file))
|
||||
{
|
||||
if (domain_uri && domain->domain_uri)
|
||||
*domain_uri = domain->domain_uri;
|
||||
|
|
|
@ -25,13 +25,13 @@ void gimp_plug_in_manager_help_domain_exit (GimpPlugInManager *manage
|
|||
|
||||
/* Add a help domain */
|
||||
void gimp_plug_in_manager_add_help_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar *domain_name,
|
||||
const gchar *domain_uri);
|
||||
|
||||
/* Retrieve a plug-ins help domain */
|
||||
const gchar * gimp_plug_in_manager_get_help_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar **help_uri);
|
||||
|
||||
/* Retrieve all help domains */
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct _GimpPlugInLocaleDomain GimpPlugInLocaleDomain;
|
|||
|
||||
struct _GimpPlugInLocaleDomain
|
||||
{
|
||||
gchar *prog_name;
|
||||
GFile *file;
|
||||
gchar *domain_name;
|
||||
gchar *domain_path;
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ gimp_plug_in_manager_locale_domain_exit (GimpPlugInManager *manager)
|
|||
{
|
||||
GimpPlugInLocaleDomain *domain = list->data;
|
||||
|
||||
g_free (domain->prog_name);
|
||||
g_object_unref (domain->file);
|
||||
g_free (domain->domain_name);
|
||||
g_free (domain->domain_path);
|
||||
g_slice_free (GimpPlugInLocaleDomain, domain);
|
||||
|
@ -67,19 +67,19 @@ gimp_plug_in_manager_locale_domain_exit (GimpPlugInManager *manager)
|
|||
|
||||
void
|
||||
gimp_plug_in_manager_add_locale_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar *domain_name,
|
||||
const gchar *domain_path)
|
||||
{
|
||||
GimpPlugInLocaleDomain *domain;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
||||
g_return_if_fail (prog_name != NULL);
|
||||
g_return_if_fail (G_IS_FILE (file));
|
||||
g_return_if_fail (domain_name != NULL);
|
||||
|
||||
domain = g_slice_new (GimpPlugInLocaleDomain);
|
||||
|
||||
domain->prog_name = g_strdup (prog_name);
|
||||
domain->file = g_object_ref (file);
|
||||
domain->domain_name = g_strdup (domain_name);
|
||||
domain->domain_path = g_strdup (domain_path);
|
||||
|
||||
|
@ -95,26 +95,27 @@ gimp_plug_in_manager_add_locale_domain (GimpPlugInManager *manager,
|
|||
|
||||
const gchar *
|
||||
gimp_plug_in_manager_get_locale_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar **domain_path)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
|
||||
g_return_val_if_fail (file == NULL || G_IS_FILE (file), NULL);
|
||||
|
||||
if (domain_path)
|
||||
*domain_path = gimp_locale_directory ();
|
||||
|
||||
/* A NULL prog_name is GIMP itself, return the default domain */
|
||||
if (! prog_name)
|
||||
if (! file)
|
||||
return NULL;
|
||||
|
||||
for (list = manager->locale_domains; list; list = list->next)
|
||||
{
|
||||
GimpPlugInLocaleDomain *domain = list->data;
|
||||
|
||||
if (domain && domain->prog_name &&
|
||||
! strcmp (domain->prog_name, prog_name))
|
||||
if (domain && domain->file &&
|
||||
g_file_equal (domain->file, file))
|
||||
{
|
||||
if (domain_path && domain->domain_path)
|
||||
*domain_path = domain->domain_path;
|
||||
|
|
|
@ -25,13 +25,13 @@ void gimp_plug_in_manager_locale_domain_exit (GimpPlugInManager *mana
|
|||
|
||||
/* Add a locale domain */
|
||||
void gimp_plug_in_manager_add_locale_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar *domain_name,
|
||||
const gchar *domain_path);
|
||||
|
||||
/* Retrieve a plug-ins locale domain */
|
||||
const gchar * gimp_plug_in_manager_get_locale_domain (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar **locale_path);
|
||||
|
||||
/* Retrieve all locale domains */
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "plug-in-types.h"
|
||||
|
||||
|
@ -41,7 +41,7 @@ gimp_plug_in_manager_menu_branch_exit (GimpPlugInManager *manager)
|
|||
{
|
||||
GimpPlugInMenuBranch *branch = list->data;
|
||||
|
||||
g_free (branch->prog_name);
|
||||
g_object_unref (branch->file);
|
||||
g_free (branch->menu_path);
|
||||
g_free (branch->menu_label);
|
||||
g_slice_free (GimpPlugInMenuBranch, branch);
|
||||
|
@ -53,27 +53,27 @@ gimp_plug_in_manager_menu_branch_exit (GimpPlugInManager *manager)
|
|||
|
||||
void
|
||||
gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar *menu_path,
|
||||
const gchar *menu_label)
|
||||
{
|
||||
GimpPlugInMenuBranch *branch;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
||||
g_return_if_fail (prog_name != NULL);
|
||||
g_return_if_fail (G_IS_FILE (file));
|
||||
g_return_if_fail (menu_path != NULL);
|
||||
g_return_if_fail (menu_label != NULL);
|
||||
|
||||
branch = g_slice_new (GimpPlugInMenuBranch);
|
||||
|
||||
branch->prog_name = g_strdup (prog_name);
|
||||
branch->file = g_object_ref (file);
|
||||
branch->menu_path = plug_in_menu_path_map (menu_path, menu_label);
|
||||
branch->menu_label = g_strdup (menu_label);
|
||||
|
||||
manager->menu_branches = g_slist_append (manager->menu_branches, branch);
|
||||
|
||||
g_signal_emit_by_name (manager, "menu-branch-added",
|
||||
branch->prog_name,
|
||||
branch->file,
|
||||
branch->menu_path,
|
||||
branch->menu_label);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
struct _GimpPlugInMenuBranch
|
||||
{
|
||||
gchar *prog_name;
|
||||
GFile *file;
|
||||
gchar *menu_path;
|
||||
gchar *menu_label;
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ void gimp_plug_in_manager_menu_branch_exit (GimpPlugInManager *manager);
|
|||
|
||||
/* Add a menu branch */
|
||||
void gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar *menu_path,
|
||||
const gchar *menu_label);
|
||||
GSList * gimp_plug_in_manager_get_menu_branches (GimpPlugInManager *manager);
|
||||
|
|
|
@ -89,7 +89,7 @@ gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
|||
{
|
||||
GimpPlugInProcedure *proc = list->data;
|
||||
|
||||
if (proc->prog && proc->menu_paths)
|
||||
if (proc->file && proc->menu_paths)
|
||||
{
|
||||
gchar *name;
|
||||
|
||||
|
@ -142,7 +142,7 @@ gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
|||
|
||||
(*menu_strs)[i] = gimp_strip_uline (name);
|
||||
(*accel_strs)[i] = NULL;
|
||||
(*prog_strs)[i] = g_strdup (proc->prog);
|
||||
(*prog_strs)[i] = g_file_get_path (proc->file);
|
||||
(*types_strs)[i] = g_strdup (proc->image_types);
|
||||
(*realname_strs)[i] = g_strdup (gimp_object_get_name (proc));
|
||||
(*time_ints)[i] = proc->mtime;
|
||||
|
|
|
@ -149,20 +149,20 @@ gimp_plug_in_manager_restore (GimpPlugInManager *manager,
|
|||
|
||||
if (plug_in_def->locale_domain_name)
|
||||
gimp_plug_in_manager_add_locale_domain (manager,
|
||||
plug_in_def->prog,
|
||||
plug_in_def->file,
|
||||
plug_in_def->locale_domain_name,
|
||||
plug_in_def->locale_domain_path);
|
||||
else
|
||||
/* set the default plug-in locale domain */
|
||||
gimp_plug_in_def_set_locale_domain (plug_in_def,
|
||||
gimp_plug_in_manager_get_locale_domain (manager,
|
||||
plug_in_def->prog,
|
||||
plug_in_def->file,
|
||||
NULL),
|
||||
NULL);
|
||||
|
||||
if (plug_in_def->help_domain_name)
|
||||
gimp_plug_in_manager_add_help_domain (manager,
|
||||
plug_in_def->prog,
|
||||
plug_in_def->file,
|
||||
plug_in_def->help_domain_name,
|
||||
plug_in_def->help_domain_uri);
|
||||
}
|
||||
|
@ -347,14 +347,15 @@ gimp_plug_in_manager_query_new (GimpPlugInManager *manager,
|
|||
{
|
||||
gchar *basename;
|
||||
|
||||
basename = g_filename_display_basename (plug_in_def->prog);
|
||||
basename =
|
||||
g_path_get_basename (gimp_file_get_utf8_name (plug_in_def->file));
|
||||
status_callback (NULL, basename,
|
||||
(gdouble) nth++ / (gdouble) n_plugins);
|
||||
g_free (basename);
|
||||
|
||||
if (manager->gimp->be_verbose)
|
||||
g_print ("Querying plug-in: '%s'\n",
|
||||
gimp_filename_to_utf8 (plug_in_def->prog));
|
||||
gimp_file_get_utf8_name (plug_in_def->file));
|
||||
|
||||
gimp_plug_in_manager_call_query (manager, context, plug_in_def);
|
||||
}
|
||||
|
@ -395,14 +396,15 @@ gimp_plug_in_manager_init_plug_ins (GimpPlugInManager *manager,
|
|||
{
|
||||
gchar *basename;
|
||||
|
||||
basename = g_filename_display_basename (plug_in_def->prog);
|
||||
basename =
|
||||
g_path_get_basename (gimp_file_get_utf8_name (plug_in_def->file));
|
||||
status_callback (NULL, basename,
|
||||
(gdouble) nth++ / (gdouble) n_plugins);
|
||||
g_free (basename);
|
||||
|
||||
if (manager->gimp->be_verbose)
|
||||
g_print ("Initializing plug-in: '%s'\n",
|
||||
gimp_filename_to_utf8 (plug_in_def->prog));
|
||||
gimp_file_get_utf8_name (plug_in_def->file));
|
||||
|
||||
gimp_plug_in_manager_call_init (manager, context, plug_in_def);
|
||||
}
|
||||
|
@ -428,7 +430,7 @@ gimp_plug_in_manager_run_extensions (GimpPlugInManager *manager,
|
|||
{
|
||||
GimpPlugInProcedure *proc = list->data;
|
||||
|
||||
if (proc->prog &&
|
||||
if (proc->file &&
|
||||
GIMP_PROCEDURE (proc)->proc_type == GIMP_EXTENSION &&
|
||||
GIMP_PROCEDURE (proc)->num_args == 0)
|
||||
{
|
||||
|
@ -550,6 +552,7 @@ gimp_plug_in_manager_add_from_file (const GimpDatafileData *file_data,
|
|||
{
|
||||
GimpPlugInManager *manager = data;
|
||||
GimpPlugInDef *plug_in_def;
|
||||
GFile *file;
|
||||
GSList *list;
|
||||
|
||||
/* When we scan build dirs for plug-ins, there will be some
|
||||
|
@ -562,10 +565,14 @@ gimp_plug_in_manager_add_from_file (const GimpDatafileData *file_data,
|
|||
|
||||
for (list = manager->plug_in_defs; list; list = list->next)
|
||||
{
|
||||
gchar *path;
|
||||
gchar *plug_in_name;
|
||||
|
||||
plug_in_def = list->data;
|
||||
plug_in_name = g_path_get_basename (plug_in_def->prog);
|
||||
|
||||
path = g_file_get_path (plug_in_def->file);
|
||||
plug_in_name = g_path_get_basename (path);
|
||||
g_free (path);
|
||||
|
||||
if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0)
|
||||
{
|
||||
|
@ -580,7 +587,9 @@ gimp_plug_in_manager_add_from_file (const GimpDatafileData *file_data,
|
|||
g_free (plug_in_name);
|
||||
}
|
||||
|
||||
plug_in_def = gimp_plug_in_def_new (file_data->filename);
|
||||
file = g_file_new_for_path (file_data->filename);
|
||||
plug_in_def = gimp_plug_in_def_new (file);
|
||||
g_object_unref (file);
|
||||
|
||||
gimp_plug_in_def_set_mtime (plug_in_def, file_data->mtime);
|
||||
gimp_plug_in_def_set_needs_query (plug_in_def, TRUE);
|
||||
|
@ -593,20 +602,24 @@ gimp_plug_in_manager_add_from_rc (GimpPlugInManager *manager,
|
|||
GimpPlugInDef *plug_in_def)
|
||||
{
|
||||
GSList *list;
|
||||
gchar *path1;
|
||||
gchar *basename1;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
||||
g_return_if_fail (plug_in_def != NULL);
|
||||
g_return_if_fail (plug_in_def->prog != NULL);
|
||||
g_return_if_fail (plug_in_def->file != NULL);
|
||||
|
||||
if (! g_path_is_absolute (plug_in_def->prog))
|
||||
path1 = g_file_get_path (plug_in_def->file);
|
||||
|
||||
if (! g_path_is_absolute (path1))
|
||||
{
|
||||
g_warning ("plug_ins_def_add_from_rc: filename not absolute (skipping)");
|
||||
g_object_unref (plug_in_def);
|
||||
g_free (path1);
|
||||
return;
|
||||
}
|
||||
|
||||
basename1 = g_path_get_basename (plug_in_def->prog);
|
||||
basename1 = g_path_get_basename (path1);
|
||||
|
||||
/* If this is a file load or save plugin, make sure we have
|
||||
* something for one of the extensions, prefixes, or magic number.
|
||||
|
@ -635,14 +648,19 @@ gimp_plug_in_manager_add_from_rc (GimpPlugInManager *manager,
|
|||
for (list = manager->plug_in_defs; list; list = list->next)
|
||||
{
|
||||
GimpPlugInDef *ondisk_plug_in_def = list->data;
|
||||
gchar *path2;
|
||||
gchar *basename2;
|
||||
|
||||
basename2 = g_path_get_basename (ondisk_plug_in_def->prog);
|
||||
path2 = g_file_get_path (ondisk_plug_in_def->file);
|
||||
|
||||
basename2 = g_path_get_basename (path2);
|
||||
|
||||
g_free (path2);
|
||||
|
||||
if (! strcmp (basename1, basename2))
|
||||
{
|
||||
if (! g_ascii_strcasecmp (plug_in_def->prog,
|
||||
ondisk_plug_in_def->prog) &&
|
||||
if (g_file_equal (plug_in_def->file,
|
||||
ondisk_plug_in_def->file) &&
|
||||
(plug_in_def->mtime == ondisk_plug_in_def->mtime))
|
||||
{
|
||||
/* Use pluginrc entry, deleting on-disk entry */
|
||||
|
@ -665,13 +683,14 @@ gimp_plug_in_manager_add_from_rc (GimpPlugInManager *manager,
|
|||
}
|
||||
|
||||
g_free (basename1);
|
||||
g_free (path1);
|
||||
|
||||
manager->write_pluginrc = TRUE;
|
||||
|
||||
if (manager->gimp->be_verbose)
|
||||
{
|
||||
g_printerr ("pluginrc lists '%s', but it wasn't found\n",
|
||||
gimp_filename_to_utf8 (plug_in_def->prog));
|
||||
gimp_file_get_utf8_name (plug_in_def->file));
|
||||
}
|
||||
|
||||
g_object_unref (plug_in_def);
|
||||
|
@ -736,10 +755,10 @@ gimp_plug_in_manager_file_proc_compare (gconstpointer a,
|
|||
const gchar *label_b;
|
||||
gint retval = 0;
|
||||
|
||||
if (g_str_has_prefix (proc_a->prog, "gimp-xcf"))
|
||||
if (g_str_has_prefix (gimp_file_get_utf8_name (proc_a->file), "gimp-xcf"))
|
||||
return -1;
|
||||
|
||||
if (g_str_has_prefix (proc_b->prog, "gimp-xcf"))
|
||||
if (g_str_has_prefix (gimp_file_get_utf8_name (proc_b->file), "gimp-xcf"))
|
||||
return 1;
|
||||
|
||||
label_a = gimp_plug_in_procedure_get_label (proc_a);
|
||||
|
|
|
@ -113,9 +113,9 @@ gimp_plug_in_manager_class_init (GimpPlugInManagerClass *klass)
|
|||
G_STRUCT_OFFSET (GimpPlugInManagerClass,
|
||||
menu_branch_added),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__STRING_STRING_STRING,
|
||||
gimp_marshal_VOID__OBJECT_STRING_STRING,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_FILE,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
|
||||
|
@ -359,7 +359,7 @@ gimp_plug_in_manager_add_procedure (GimpPlugInManager *manager,
|
|||
g_printerr ("Removing duplicate PDB procedure '%s' "
|
||||
"registered by '%s'\n",
|
||||
gimp_object_get_name (tmp_proc),
|
||||
gimp_filename_to_utf8 (tmp_proc->prog));
|
||||
gimp_file_get_utf8_name (tmp_proc->file));
|
||||
|
||||
/* search the plugin list to see if any plugins had references to
|
||||
* the tmp_proc.
|
||||
|
|
|
@ -74,7 +74,7 @@ struct _GimpPlugInManagerClass
|
|||
GimpPlugIn *plug_in);
|
||||
|
||||
void (* menu_branch_added) (GimpPlugInManager *manager,
|
||||
const gchar *prog_name,
|
||||
GFile *file,
|
||||
const gchar *menu_path,
|
||||
const gchar *menu_label);
|
||||
void (* history_changed) (GimpPlugInManager *manager);
|
||||
|
|
|
@ -71,7 +71,7 @@ static void gimp_plug_in_procedure_execute_async (GimpProcedure *proc
|
|||
GimpValueArray *args,
|
||||
GimpObject *display);
|
||||
|
||||
const gchar * gimp_plug_in_procedure_real_get_progname (const GimpPlugInProcedure *procedure);
|
||||
GFile * gimp_plug_in_procedure_real_get_file (const GimpPlugInProcedure *procedure);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpPlugInProcedure, gimp_plug_in_procedure,
|
||||
|
@ -106,7 +106,7 @@ gimp_plug_in_procedure_class_init (GimpPlugInProcedureClass *klass)
|
|||
proc_class->execute = gimp_plug_in_procedure_execute;
|
||||
proc_class->execute_async = gimp_plug_in_procedure_execute_async;
|
||||
|
||||
klass->get_progname = gimp_plug_in_procedure_real_get_progname;
|
||||
klass->get_file = gimp_plug_in_procedure_real_get_file;
|
||||
klass->menu_path_added = NULL;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ gimp_plug_in_procedure_finalize (GObject *object)
|
|||
{
|
||||
GimpPlugInProcedure *proc = GIMP_PLUG_IN_PROCEDURE (object);
|
||||
|
||||
g_free (proc->prog);
|
||||
g_object_unref (proc->file);
|
||||
g_free (proc->menu_label);
|
||||
|
||||
g_list_free_full (proc->menu_paths, (GDestroyNotify) g_free);
|
||||
|
@ -157,7 +157,7 @@ gimp_plug_in_procedure_get_memsize (GimpObject *object,
|
|||
GList *list;
|
||||
GSList *slist;
|
||||
|
||||
memsize += gimp_string_get_memsize (proc->prog);
|
||||
memsize += gimp_g_object_get_memsize (G_OBJECT (proc->file));
|
||||
memsize += gimp_string_get_memsize (proc->menu_label);
|
||||
|
||||
for (list = proc->menu_paths; list; list = g_list_next (list))
|
||||
|
@ -238,10 +238,10 @@ gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
|
|||
}
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gimp_plug_in_procedure_real_get_progname (const GimpPlugInProcedure *procedure)
|
||||
GFile *
|
||||
gimp_plug_in_procedure_real_get_file (const GimpPlugInProcedure *procedure)
|
||||
{
|
||||
return procedure->prog;
|
||||
return procedure->file;
|
||||
}
|
||||
|
||||
|
||||
|
@ -249,17 +249,17 @@ gimp_plug_in_procedure_real_get_progname (const GimpPlugInProcedure *procedure)
|
|||
|
||||
GimpProcedure *
|
||||
gimp_plug_in_procedure_new (GimpPDBProcType proc_type,
|
||||
const gchar *prog)
|
||||
GFile *file)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
|
||||
g_return_val_if_fail (proc_type == GIMP_PLUGIN ||
|
||||
proc_type == GIMP_EXTENSION, NULL);
|
||||
g_return_val_if_fail (prog != NULL, NULL);
|
||||
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
||||
|
||||
proc = g_object_new (GIMP_TYPE_PLUG_IN_PROCEDURE, NULL);
|
||||
|
||||
proc->prog = g_strdup (prog);
|
||||
proc->file = g_object_ref (file);
|
||||
|
||||
GIMP_PROCEDURE (proc)->proc_type = proc_type;
|
||||
|
||||
|
@ -283,12 +283,12 @@ gimp_plug_in_procedure_find (GSList *list,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gimp_plug_in_procedure_get_progname (const GimpPlugInProcedure *proc)
|
||||
GFile *
|
||||
gimp_plug_in_procedure_get_file (const GimpPlugInProcedure *proc)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), NULL);
|
||||
|
||||
return GIMP_PLUG_IN_PROCEDURE_GET_CLASS (proc)->get_progname (proc);
|
||||
return GIMP_PLUG_IN_PROCEDURE_GET_CLASS (proc)->get_file (proc);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -345,7 +345,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
|
|||
p = strchr (menu_path, '>');
|
||||
if (p == NULL || (*(++p) && *p != '/'))
|
||||
{
|
||||
basename = g_filename_display_basename (proc->prog);
|
||||
basename = g_path_get_basename (gimp_file_get_utf8_name (proc->file));
|
||||
|
||||
g_set_error (error, GIMP_PLUG_IN_ERROR, GIMP_PLUG_IN_FAILED,
|
||||
"Plug-In \"%s\"\n(%s)\n"
|
||||
|
@ -353,7 +353,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
|
|||
"in the invalid menu location \"%s\".\n"
|
||||
"The menu path must look like either \"<Prefix>\" "
|
||||
"or \"<Prefix>/path/to/item\".",
|
||||
basename, gimp_filename_to_utf8 (proc->prog),
|
||||
basename, gimp_file_get_utf8_name (proc->file),
|
||||
gimp_object_get_name (proc),
|
||||
menu_path);
|
||||
goto failure;
|
||||
|
@ -467,7 +467,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
|
|||
}
|
||||
else
|
||||
{
|
||||
basename = g_filename_display_basename (proc->prog);
|
||||
basename = g_path_get_basename (gimp_file_get_utf8_name (proc->file));
|
||||
|
||||
g_set_error (error, GIMP_PLUG_IN_ERROR, GIMP_PLUG_IN_FAILED,
|
||||
"Plug-In \"%s\"\n(%s)\n"
|
||||
|
@ -478,7 +478,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
|
|||
"\"<Colormap>\", \"<Brushes>\", \"<Dynamics>\", "
|
||||
"\"<Gradients>\", \"<Palettes>\", \"<Patterns>\", "
|
||||
"\"<ToolPresets>\", \"<Fonts>\" or \"<Buffers>\".",
|
||||
basename, gimp_filename_to_utf8 (proc->prog),
|
||||
basename, gimp_file_get_utf8_name (proc->file),
|
||||
gimp_object_get_name (proc),
|
||||
menu_path);
|
||||
goto failure;
|
||||
|
@ -503,14 +503,14 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
|
|||
p = strchr (prefix, '>') + 1;
|
||||
*p = '\0';
|
||||
|
||||
basename = g_filename_display_basename (proc->prog);
|
||||
basename = g_path_get_basename (gimp_file_get_utf8_name (proc->file));
|
||||
|
||||
g_set_error (error, GIMP_PLUG_IN_ERROR, GIMP_PLUG_IN_FAILED,
|
||||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"attempted to install %s procedure \"%s\" "
|
||||
"which does not take the standard %s Plug-In "
|
||||
"arguments: (%s).",
|
||||
basename, gimp_filename_to_utf8 (proc->prog),
|
||||
basename, gimp_file_get_utf8_name (proc->file),
|
||||
prefix, gimp_object_get_name (proc), prefix,
|
||||
required);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ struct _GimpPlugInProcedure
|
|||
GimpProcedure parent_instance;
|
||||
|
||||
/* common members */
|
||||
gchar *prog;
|
||||
GFile *file;
|
||||
GQuark locale_domain;
|
||||
GQuark help_domain;
|
||||
gchar *menu_label;
|
||||
|
@ -71,23 +71,23 @@ struct _GimpPlugInProcedureClass
|
|||
GimpProcedureClass parent_class;
|
||||
|
||||
/* virtual functions */
|
||||
const gchar * (* get_progname) (const GimpPlugInProcedure *procedure);
|
||||
GFile * (* get_file) (const GimpPlugInProcedure *procedure);
|
||||
|
||||
/* signals */
|
||||
void (* menu_path_added) (GimpPlugInProcedure *procedure,
|
||||
const gchar *menu_path);
|
||||
void (* menu_path_added) (GimpPlugInProcedure *procedure,
|
||||
const gchar *menu_path);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_plug_in_procedure_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpProcedure * gimp_plug_in_procedure_new (GimpPDBProcType proc_type,
|
||||
const gchar *prog);
|
||||
GFile *file);
|
||||
|
||||
GimpPlugInProcedure * gimp_plug_in_procedure_find (GSList *list,
|
||||
const gchar *proc_name);
|
||||
|
||||
const gchar * gimp_plug_in_procedure_get_progname (const GimpPlugInProcedure *proc);
|
||||
GFile * gimp_plug_in_procedure_get_file (const GimpPlugInProcedure *proc);
|
||||
|
||||
void gimp_plug_in_procedure_set_locale_domain (GimpPlugInProcedure *proc,
|
||||
const gchar *locale_domain);
|
||||
|
|
|
@ -51,7 +51,7 @@ static void gimp_temporary_procedure_execute_async (GimpProcedure *proce
|
|||
GimpValueArray *args,
|
||||
GimpObject *display);
|
||||
|
||||
const gchar * gimp_temporary_procedure_get_progname (const GimpPlugInProcedure *procedure);
|
||||
static GFile * gimp_temporary_procedure_get_file (const GimpPlugInProcedure *procedure);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpTemporaryProcedure, gimp_temporary_procedure,
|
||||
|
@ -72,7 +72,7 @@ gimp_temporary_procedure_class_init (GimpTemporaryProcedureClass *klass)
|
|||
proc_class->execute = gimp_temporary_procedure_execute;
|
||||
proc_class->execute_async = gimp_temporary_procedure_execute_async;
|
||||
|
||||
plug_class->get_progname = gimp_temporary_procedure_get_progname;
|
||||
plug_class->get_file = gimp_temporary_procedure_get_file;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -130,10 +130,10 @@ gimp_temporary_procedure_execute_async (GimpProcedure *procedure,
|
|||
}
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gimp_temporary_procedure_get_progname (const GimpPlugInProcedure *procedure)
|
||||
static GFile *
|
||||
gimp_temporary_procedure_get_file (const GimpPlugInProcedure *procedure)
|
||||
{
|
||||
return GIMP_TEMPORARY_PROCEDURE (procedure)->plug_in->prog;
|
||||
return GIMP_TEMPORARY_PROCEDURE (procedure)->plug_in->file;
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,7 +150,7 @@ gimp_temporary_procedure_new (GimpPlugIn *plug_in)
|
|||
|
||||
proc->plug_in = plug_in;
|
||||
|
||||
GIMP_PLUG_IN_PROCEDURE (proc)->prog = g_strdup ("none");
|
||||
GIMP_PLUG_IN_PROCEDURE (proc)->file = g_file_new_for_path ("none");
|
||||
|
||||
return GIMP_PROCEDURE (proc);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ static GTokenType plug_in_def_deserialize (Gimp *gimp,
|
|||
GSList **plug_in_defs);
|
||||
static GTokenType plug_in_procedure_deserialize (GScanner *scanner,
|
||||
Gimp *gimp,
|
||||
const gchar *prog,
|
||||
GFile *file,
|
||||
GimpPlugInProcedure **proc);
|
||||
static GTokenType plug_in_menu_path_deserialize (GScanner *scanner,
|
||||
GimpPlugInProcedure *proc);
|
||||
|
@ -261,6 +261,7 @@ plug_in_def_deserialize (Gimp *gimp,
|
|||
GimpPlugInProcedure *proc = NULL;
|
||||
gchar *name;
|
||||
gchar *path;
|
||||
GFile *file;
|
||||
gint64 mtime;
|
||||
GTokenType token;
|
||||
|
||||
|
@ -270,9 +271,12 @@ plug_in_def_deserialize (Gimp *gimp,
|
|||
path = gimp_config_path_expand (name, TRUE, NULL);
|
||||
g_free (name);
|
||||
|
||||
plug_in_def = gimp_plug_in_def_new (path);
|
||||
file = g_file_new_for_path (path);
|
||||
g_free (path);
|
||||
|
||||
plug_in_def = gimp_plug_in_def_new (file);
|
||||
g_object_unref (file);
|
||||
|
||||
if (! gimp_scanner_parse_int64 (scanner, &mtime))
|
||||
{
|
||||
g_object_unref (plug_in_def);
|
||||
|
@ -298,7 +302,7 @@ plug_in_def_deserialize (Gimp *gimp,
|
|||
{
|
||||
case PROC_DEF:
|
||||
token = plug_in_procedure_deserialize (scanner, gimp,
|
||||
plug_in_def->prog,
|
||||
plug_in_def->file,
|
||||
&proc);
|
||||
|
||||
if (token == G_TOKEN_LEFT_PAREN)
|
||||
|
@ -353,7 +357,7 @@ plug_in_def_deserialize (Gimp *gimp,
|
|||
static GTokenType
|
||||
plug_in_procedure_deserialize (GScanner *scanner,
|
||||
Gimp *gimp,
|
||||
const gchar *prog,
|
||||
GFile *file,
|
||||
GimpPlugInProcedure **proc)
|
||||
{
|
||||
GimpProcedure *procedure;
|
||||
|
@ -374,7 +378,7 @@ plug_in_procedure_deserialize (GScanner *scanner,
|
|||
return G_TOKEN_INT;
|
||||
}
|
||||
|
||||
procedure = gimp_plug_in_procedure_new (proc_type, prog);
|
||||
procedure = gimp_plug_in_procedure_new (proc_type, file);
|
||||
|
||||
*proc = GIMP_PLUG_IN_PROCEDURE (procedure);
|
||||
|
||||
|
@ -820,9 +824,12 @@ plug_in_rc_write (GSList *plug_in_defs,
|
|||
if (plug_in_def->procedures)
|
||||
{
|
||||
GSList *list2;
|
||||
gchar *path;
|
||||
gchar *utf8;
|
||||
|
||||
utf8 = g_filename_to_utf8 (plug_in_def->prog, -1, NULL, NULL, NULL);
|
||||
path = g_file_get_path (plug_in_def->file);
|
||||
utf8 = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
|
||||
g_free (path);
|
||||
|
||||
if (! utf8)
|
||||
continue;
|
||||
|
|
|
@ -82,6 +82,7 @@ void
|
|||
xcf_init (Gimp *gimp)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
GFile *file;
|
||||
GimpProcedure *procedure;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
@ -96,7 +97,10 @@ xcf_init (Gimp *gimp)
|
|||
*/
|
||||
|
||||
/* gimp-xcf-save */
|
||||
procedure = gimp_plug_in_procedure_new (GIMP_PLUGIN, "gimp-xcf-save");
|
||||
file = g_file_new_for_path ("gimp-xcf-save");
|
||||
procedure = gimp_plug_in_procedure_new (GIMP_PLUGIN, file);
|
||||
g_object_unref (file);
|
||||
|
||||
procedure->proc_type = GIMP_INTERNAL;
|
||||
procedure->marshal_func = xcf_save_invoker;
|
||||
|
||||
|
@ -167,7 +171,10 @@ xcf_init (Gimp *gimp)
|
|||
g_object_unref (procedure);
|
||||
|
||||
/* gimp-xcf-load */
|
||||
procedure = gimp_plug_in_procedure_new (GIMP_PLUGIN, "gimp-xcf-load");
|
||||
file = g_file_new_for_path ("gimp-xcf-load");
|
||||
procedure = gimp_plug_in_procedure_new (GIMP_PLUGIN, file);
|
||||
g_object_unref (file);
|
||||
|
||||
procedure->proc_type = GIMP_INTERNAL;
|
||||
procedure->marshal_func = xcf_load_invoker;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ HELP
|
|||
if (! help_domain && manager->current_plug_in)
|
||||
help_domain = (gchar *)
|
||||
gimp_plug_in_manager_get_help_domain (manager,
|
||||
manager->current_plug_in->prog,
|
||||
manager->current_plug_in->file,
|
||||
NULL);
|
||||
|
||||
gimp_help (gimp, progress, help_domain, help_id);
|
||||
|
|
|
@ -216,7 +216,7 @@ HELP
|
|||
if (plug_in)
|
||||
{
|
||||
gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager,
|
||||
plug_in->prog, menu_path, menu_name);
|
||||
plug_in->file, menu_path, menu_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue