Commit 30164f1b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added back the .xcf.gz and .xcf.bz2 extensions because they are the only

2004-11-18  Michael Natterer  <mitch@gimp.org>

	* plug-ins/common/compressor.c (compressors): added back the
	.xcf.gz and .xcf.bz2 extensions because they are the only way
	to figure the special nature of this plug-in's extensions.

	* app/widgets/gimpfileprocview.[ch]: keep a list of "meta
	extensions" (extensions which have a '.' themselves).

	* app/widgets/gimpfiledialog.c (gimp_file_dialog_proc_changed):
	try to replace the whole extension if the last extension is one of
	the meta extensions kept by GimpFileProcView. Fixes bug #158377.
parent 48d44edf
2004-11-18 Michael Natterer <mitch@gimp.org>
* plug-ins/common/compressor.c (compressors): added back the
.xcf.gz and .xcf.bz2 extensions because they are the only way
to figure the special nature of this plug-in's extensions.
* app/widgets/gimpfileprocview.[ch]: keep a list of "meta
extensions" (extensions which have a '.' themselves).
* app/widgets/gimpfiledialog.c (gimp_file_dialog_proc_changed):
try to replace the whole extension if the last extension is one of
the meta extensions kept by GimpFileProcView. Fixes bug #158377.
2004-11-18 Sven Neumann <sven@gimp.org>
 
* plug-ins/maze/maze.[ch]
......
......@@ -652,6 +652,35 @@ gimp_file_dialog_proc_changed (GimpFileProcView *view,
{
const gchar *last_dot = strrchr (uri, '.');
/* check if the uri has a "meta extension" (e.g. foo.bar.gz)
* and try to truncate both extensions away.
*/
if (last_dot && last_dot != uri)
{
GList *list;
for (list = view->meta_extensions;
list;
list = g_list_next (list))
{
const gchar *ext = list->data;
if (! strcmp (ext, last_dot + 1))
{
const gchar *p = last_dot - 1;
while (p > uri && *p != '.')
p--;
if (p != uri && *p == '.')
{
last_dot = p;
break;
}
}
}
}
if (last_dot != uri)
{
GString *s = g_string_new (uri);
......
......@@ -58,11 +58,14 @@ enum
static void gimp_file_proc_view_class_init (GimpFileProcViewClass *klass);
static void gimp_file_proc_view_finalize (GObject *object);
static void gimp_file_proc_view_selection_changed (GtkTreeSelection *selection,
GimpFileProcView *view);
static guint view_signals[LAST_SIGNAL] = { 0 };
static GtkTreeViewClass *parent_class = NULL;
static guint view_signals[LAST_SIGNAL] = { 0 };
GType
......@@ -96,7 +99,11 @@ gimp_file_proc_view_get_type (void)
static void
gimp_file_proc_view_class_init (GimpFileProcViewClass *klass)
{
klass->changed = NULL;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_file_proc_view_finalize;
view_signals[CHANGED] = g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
......@@ -106,8 +113,24 @@ gimp_file_proc_view_class_init (GimpFileProcViewClass *klass)
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->changed = NULL;
}
static void
gimp_file_proc_view_finalize (GObject *object)
{
GimpFileProcView *view = GIMP_FILE_PROC_VIEW (object);
if (view->meta_extensions)
{
g_list_foreach (view->meta_extensions, (GFunc) g_free, NULL);
g_list_free (view->meta_extensions);
view->meta_extensions = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GtkWidget *
gimp_file_proc_view_new (Gimp *gimp,
......@@ -132,6 +155,13 @@ gimp_file_proc_view_new (Gimp *gimp,
GDK_TYPE_PIXBUF, /* COLUMN_PIXBUF */
G_TYPE_STRING); /* COLUMN_HELP_ID */
view = g_object_new (GIMP_TYPE_FILE_PROC_VIEW,
"model", store,
"rules_hint", TRUE,
NULL);
g_object_unref (store);
for (list = procedures; list; list = g_slist_next (list))
{
PlugInProcDef *proc = list->data;
......@@ -144,6 +174,7 @@ gimp_file_proc_view_new (Gimp *gimp,
gchar *help_id;
const gchar *stock_id;
GdkPixbuf *pixbuf;
GSList *list2;
locale_domain = plug_ins_locale_domain (gimp, proc->prog, NULL);
help_domain = plug_ins_help_domain (gimp, proc->prog, NULL);
......@@ -171,6 +202,20 @@ gimp_file_proc_view_new (Gimp *gimp,
if (pixbuf)
g_object_unref (pixbuf);
for (list2 = proc->extensions_list;
list2;
list2 = g_slist_next (list2))
{
GimpFileProcView *proc_view = GIMP_FILE_PROC_VIEW (view);
const gchar *ext = list2->data;
const gchar *dot = strchr (ext, '.');
if (dot && dot != ext)
proc_view->meta_extensions =
g_list_append (proc_view->meta_extensions,
g_strdup (dot + 1));
}
}
}
......@@ -185,13 +230,6 @@ gimp_file_proc_view_new (Gimp *gimp,
-1);
}
view = g_object_new (GIMP_TYPE_FILE_PROC_VIEW,
"model", store,
"rules_hint", TRUE,
NULL);
g_object_unref (store);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, _("File Type"));
gtk_tree_view_column_set_expand (column, TRUE);
......
......@@ -39,6 +39,8 @@ typedef struct _GimpFileProcViewClass GimpFileProcViewClass;
struct _GimpFileProcView
{
GtkTreeView parent_instance;
GList *meta_extensions;
};
struct _GimpFileProcViewClass
......
......@@ -152,7 +152,7 @@ static const Compressor compressors[] =
{
N_("gzip archive"),
"application/x-gzip",
"gz,xcfgz",
"xcf.gz,gz,xcfgz",
"0,string,\037\213",
".xcfgz",
".gz",
......@@ -173,7 +173,7 @@ static const Compressor compressors[] =
{
N_("bzip archive"),
"application/x-bzip",
"bz2,xcfbz2",
"xcf.bz2,bz2,xcfbz2",
"0,string,BZh",
".xcfbz2",
".bz2",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment