pdb: allow file procedures to register themselves for handling URIs

and store the flag in pluginrc. There are no URIs passed to procedures
yet and no procedure registers as such, this is just preparation.
This commit is contained in:
Michael Natterer
2012-11-17 16:01:52 +01:00
parent c5f1fd1fda
commit 07f77e5ec8
11 changed files with 176 additions and 4 deletions

View File

@ -39,7 +39,7 @@
#include "gimp-intl.h"
#define PLUG_IN_RC_FILE_VERSION 1
#define PLUG_IN_RC_FILE_VERSION 2
/*
@ -90,6 +90,7 @@ enum
PREFIX,
MAGIC,
MIME_TYPE,
HANDLES_URI,
THUMB_LOADER
};
@ -153,6 +154,8 @@ plug_in_rc_parse (Gimp *gimp,
"magic", GINT_TO_POINTER (MAGIC));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"mime-type", GINT_TO_POINTER (MIME_TYPE));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"handles-uri", GINT_TO_POINTER (HANDLES_URI));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"thumb-loader", GINT_TO_POINTER (THUMB_LOADER));
@ -162,6 +165,8 @@ plug_in_rc_parse (Gimp *gimp,
"prefix", GINT_TO_POINTER (PREFIX));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"mime-type", GINT_TO_POINTER (MIME_TYPE));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"handles-uri", GINT_TO_POINTER (HANDLES_URI));
token = G_TOKEN_LEFT_PAREN;
@ -598,7 +603,7 @@ plug_in_file_proc_deserialize (GScanner *scanner,
if (! gimp_scanner_parse_string_no_validate (scanner, &value))
return G_TOKEN_STRING;
}
else
else if (symbol != HANDLES_URI)
{
if (! gimp_scanner_parse_string (scanner, &value))
return G_TOKEN_STRING;
@ -626,6 +631,10 @@ plug_in_file_proc_deserialize (GScanner *scanner,
g_free (value);
break;
case HANDLES_URI:
gimp_plug_in_procedure_set_handles_uri (proc);
break;
case THUMB_LOADER:
gimp_plug_in_procedure_set_thumb_loader (proc, value);
g_free (value);
@ -917,6 +926,12 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_close (writer);
}
if (proc->handles_uri)
{
gimp_config_writer_open (writer, "handles-uri");
gimp_config_writer_close (writer);
}
if (proc->thumb_loader)
{
gimp_config_writer_open (writer, "thumb-loader");