summaryrefslogtreecommitdiff
path: root/image-converter
diff options
context:
space:
mode:
Diffstat (limited to 'image-converter')
-rw-r--r--image-converter/caja-image-converter.c28
-rw-r--r--image-converter/caja-image-converter.h6
-rw-r--r--image-converter/caja-image-resizer.c56
-rw-r--r--image-converter/caja-image-resizer.h4
-rw-r--r--image-converter/caja-image-rotator.c56
-rw-r--r--image-converter/caja-image-rotator.h4
-rw-r--r--image-converter/image-converter.c6
7 files changed, 80 insertions, 80 deletions
diff --git a/image-converter/caja-image-converter.c b/image-converter/caja-image-converter.c
index 8840258..61c0084 100644
--- a/image-converter/caja-image-converter.c
+++ b/image-converter/caja-image-converter.c
@@ -1,6 +1,6 @@
/*
* caja-image-converter.c
- *
+ *
* Copyright (C) 2004-2005 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Jürg Billeter <[email protected]>
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -50,7 +50,7 @@ image_converter_file_is_image (CajaFileInfo *file_info)
gchar *uri_scheme;
gchar *mime_type;
gboolean maybe_image;
-
+
maybe_image = TRUE;
uri_scheme = caja_file_info_get_uri_scheme (file_info);
if (strcmp (uri_scheme, "file") != 0)
@@ -61,7 +61,7 @@ image_converter_file_is_image (CajaFileInfo *file_info)
if (strncmp (mime_type, "image/", 6) != 0)
maybe_image = FALSE;
g_free (mime_type);
-
+
return maybe_image;
}
@@ -70,14 +70,14 @@ image_converter_filter_images (GList *files)
{
GList *images;
GList *file;
-
+
images = NULL;
-
+
for (file = files; file != NULL; file = file->next) {
if (image_converter_file_is_image (file->data))
images = g_list_prepend (images, file->data);
}
-
+
return images;
}
@@ -113,7 +113,7 @@ caja_image_converter_get_file_items (CajaMenuProvider *provider,
CajaMenuItem *item;
GList *file;
GList *items = NULL;
-
+
for (file = files; file != NULL; file = file->next) {
if (image_converter_file_is_image (file->data)) {
item = caja_menu_item_new ("CajaImageConverter::resize",
@@ -123,7 +123,7 @@ caja_image_converter_get_file_items (CajaMenuProvider *provider,
g_signal_connect (item, "activate",
G_CALLBACK (image_resize_callback),
caja_file_info_list_copy (files));
-
+
items = g_list_prepend (items, item);
item = caja_menu_item_new ("CajaImageConverter::rotate",
@@ -135,13 +135,13 @@ caja_image_converter_get_file_items (CajaMenuProvider *provider,
caja_file_info_list_copy (files));
items = g_list_prepend (items, item);
-
+
items = g_list_reverse (items);
return items;
}
}
-
+
return NULL;
}
@@ -152,7 +152,7 @@ caja_image_converter_menu_provider_iface_init (CajaMenuProviderIface *iface)
iface->get_file_items = caja_image_converter_get_file_items;
}
-static void
+static void
caja_image_converter_instance_init (CajaImageConverter *img)
{
}
@@ -163,7 +163,7 @@ caja_image_converter_class_init (CajaImageConverterClass *class)
}
GType
-caja_image_converter_get_type (void)
+caja_image_converter_get_type (void)
{
return image_converter_type;
}
@@ -176,7 +176,7 @@ caja_image_converter_register_type (GTypeModule *module)
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) caja_image_converter_class_init,
- NULL,
+ NULL,
NULL,
sizeof (CajaImageConverter),
0,
diff --git a/image-converter/caja-image-converter.h b/image-converter/caja-image-converter.h
index 09839c7..c8beba7 100644
--- a/image-converter/caja-image-converter.h
+++ b/image-converter/caja-image-converter.h
@@ -1,6 +1,6 @@
/*
* caja-image-converter.h
- *
+ *
* Copyright (C) 2004-2005 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Jürg Billeter <[email protected]>
- *
+ *
*/
#ifndef CAJA_IMAGE_CONVERTER_H
@@ -29,7 +29,7 @@
G_BEGIN_DECLS
/* Declarations for the open terminal extension object. This object will be
- * instantiated by caja. It implements the GInterfaces
+ * instantiated by caja. It implements the GInterfaces
* exported by libcaja. */
diff --git a/image-converter/caja-image-resizer.c b/image-converter/caja-image-resizer.c
index 3409d91..ae33b23 100644
--- a/image-converter/caja-image-resizer.c
+++ b/image-converter/caja-image-resizer.c
@@ -1,6 +1,6 @@
/*
* caja-image-resizer.c
- *
+ *
* Copyright (C) 2004-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Jürg Billeter <[email protected]>
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -34,18 +34,18 @@
#include <gtk/gtk.h>
#include <libcaja-extension/caja-file-info.h>
-
+
typedef struct _CajaImageResizerPrivate CajaImageResizerPrivate;
struct _CajaImageResizerPrivate {
GList *files;
-
+
gchar *suffix;
-
+
int images_resized;
int images_total;
gboolean cancelled;
-
+
gchar *size;
GtkDialog *resize_dialog;
@@ -84,9 +84,9 @@ caja_image_resizer_finalize(GObject *object)
{
CajaImageResizer *dialog = CAJA_IMAGE_RESIZER (object);
CajaImageResizerPrivate *priv = CAJA_IMAGE_RESIZER_GET_PRIVATE (dialog);
-
+
g_free (priv->suffix);
-
+
G_OBJECT_CLASS(caja_image_resizer_parent_class)->finalize(object);
}
@@ -162,17 +162,17 @@ caja_image_resizer_transform_filename (CajaImageResizer *resizer, GFile *orig_fi
GFile *parent_file, *new_file;
char *basename, *extension, *new_basename;
-
+
g_return_val_if_fail (G_IS_FILE (orig_file), NULL);
parent_file = g_file_get_parent (orig_file);
basename = g_strdup (g_file_get_basename (orig_file));
-
+
extension = g_strdup (strrchr (basename, '.'));
if (extension != NULL)
basename[strlen (basename) - strlen (extension)] = '\0';
-
+
new_basename = g_strdup_printf ("%s%s%s", basename,
priv->suffix == NULL ? ".tmp" : priv->suffix,
extension == NULL ? "" : extension);
@@ -192,11 +192,11 @@ op_finished (GPid pid, gint status, gpointer data)
{
CajaImageResizer *resizer = CAJA_IMAGE_RESIZER (data);
CajaImageResizerPrivate *priv = CAJA_IMAGE_RESIZER_GET_PRIVATE (resizer);
-
+
gboolean retry = TRUE;
-
+
CajaFileInfo *file = CAJA_FILE_INFO (priv->files->data);
-
+
if (status != 0) {
/* resizing failed */
char *name = caja_file_info_get_name (file);
@@ -207,12 +207,12 @@ op_finished (GPid pid, gint status, gpointer data)
"'%s' cannot be resized. Check whether you have permission to write to this folder.",
name);
g_free (name);
-
+
gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Skip"), 1);
gtk_dialog_add_button (GTK_DIALOG (msg_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Retry"), 0);
gtk_dialog_set_default_response (GTK_DIALOG (msg_dialog), 0);
-
+
int response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog));
gtk_widget_destroy (msg_dialog);
if (response_id == 0) {
@@ -222,7 +222,7 @@ op_finished (GPid pid, gint status, gpointer data)
} else if (response_id == 1) {
retry = FALSE;
}
-
+
} else if (priv->suffix == NULL) {
/* resize image in place */
GFile *orig_location = caja_file_info_get_location (file);
@@ -237,7 +237,7 @@ op_finished (GPid pid, gint status, gpointer data)
priv->images_resized++;
priv->files = priv->files->next;
}
-
+
if (!priv->cancelled && priv->files != NULL) {
/* process next image */
run_op (resizer);
@@ -251,9 +251,9 @@ static void
run_op (CajaImageResizer *resizer)
{
CajaImageResizerPrivate *priv = CAJA_IMAGE_RESIZER_GET_PRIVATE (resizer);
-
+
g_return_if_fail (priv->files != NULL);
-
+
CajaFileInfo *file = CAJA_FILE_INFO (priv->files->data);
GFile *orig_location = caja_file_info_get_location (file);
@@ -264,7 +264,7 @@ run_op (CajaImageResizer *resizer)
g_object_unref (new_location);
/* FIXME: check whether new_uri already exists and provide "Replace _All", "_Skip", and "_Replace" options */
-
+
gchar *argv[6];
argv[0] = "/usr/bin/convert";
argv[1] = filename;
@@ -272,32 +272,32 @@ run_op (CajaImageResizer *resizer)
argv[3] = priv->size;
argv[4] = new_filename;
argv[5] = NULL;
-
+
pid_t pid;
if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL)) {
// FIXME: error handling
return;
}
-
+
g_free (filename);
g_free (new_filename);
-
+
g_child_watch_add (pid, op_finished, resizer);
-
+
char *tmp;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar), (double) (priv->images_resized + 1) / priv->images_total);
tmp = g_strdup_printf (_("Resizing image: %d of %d"), priv->images_resized + 1, priv->images_total);
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress_bar), tmp);
g_free (tmp);
-
+
char *name = caja_file_info_get_name (file);
tmp = g_strdup_printf (_("<i>Resizing \"%s\"</i>"), name);
g_free (name);
gtk_label_set_markup (GTK_LABEL (priv->progress_label), tmp);
g_free (tmp);
-
+
}
static void
@@ -325,7 +325,7 @@ caja_image_resizer_response_cb (GtkDialog *dialog, gint response_id, gpointer us
} else {
priv->size = g_strdup_printf ("%dx%d", (int) gtk_spin_button_get_value (priv->width_spinbutton), (int) gtk_spin_button_get_value (priv->height_spinbutton));
}
-
+
run_op (resizer);
}
diff --git a/image-converter/caja-image-resizer.h b/image-converter/caja-image-resizer.h
index 177165b..f55d160 100644
--- a/image-converter/caja-image-resizer.h
+++ b/image-converter/caja-image-resizer.h
@@ -1,6 +1,6 @@
/*
* caja-image-resize-dialog.h
- *
+ *
* Copyright (C) 2004-2005 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Jürg Billeter <[email protected]>
- *
+ *
*/
#ifndef CAJA_IMAGE_RESIZER_H
diff --git a/image-converter/caja-image-rotator.c b/image-converter/caja-image-rotator.c
index 32c3d09..30b8094 100644
--- a/image-converter/caja-image-rotator.c
+++ b/image-converter/caja-image-rotator.c
@@ -1,6 +1,6 @@
/*
* caja-image-rotator.c
- *
+ *
* Copyright (C) 2004-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Jürg Billeter <[email protected]>
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -34,18 +34,18 @@
#include <gtk/gtk.h>
#include <libcaja-extension/caja-file-info.h>
-
+
typedef struct _CajaImageRotatorPrivate CajaImageRotatorPrivate;
struct _CajaImageRotatorPrivate {
GList *files;
-
+
gchar *suffix;
-
+
int images_rotated;
int images_total;
gboolean cancelled;
-
+
gchar *angle;
GtkDialog *rotate_dialog;
@@ -81,9 +81,9 @@ caja_image_rotator_finalize(GObject *object)
{
CajaImageRotator *dialog = CAJA_IMAGE_ROTATOR (object);
CajaImageRotatorPrivate *priv = CAJA_IMAGE_ROTATOR_GET_PRIVATE (dialog);
-
+
g_free (priv->suffix);
-
+
G_OBJECT_CLASS(caja_image_rotator_parent_class)->finalize(object);
}
@@ -159,17 +159,17 @@ caja_image_rotator_transform_filename (CajaImageRotator *rotator, GFile *orig_fi
GFile *parent_file, *new_file;
char *basename, *extension, *new_basename;
-
+
g_return_val_if_fail (G_IS_FILE (orig_file), NULL);
parent_file = g_file_get_parent (orig_file);
basename = g_strdup (g_file_get_basename (orig_file));
-
+
extension = g_strdup (strrchr (basename, '.'));
if (extension != NULL)
basename[strlen (basename) - strlen (extension)] = '\0';
-
+
new_basename = g_strdup_printf ("%s%s%s", basename,
priv->suffix == NULL ? ".tmp" : priv->suffix,
extension == NULL ? "" : extension);
@@ -189,11 +189,11 @@ op_finished (GPid pid, gint status, gpointer data)
{
CajaImageRotator *rotator = CAJA_IMAGE_ROTATOR (data);
CajaImageRotatorPrivate *priv = CAJA_IMAGE_ROTATOR_GET_PRIVATE (rotator);
-
+
gboolean retry = TRUE;
-
+
CajaFileInfo *file = CAJA_FILE_INFO (priv->files->data);
-
+
if (status != 0) {
/* rotating failed */
char *name = caja_file_info_get_name (file);
@@ -204,12 +204,12 @@ op_finished (GPid pid, gint status, gpointer data)
"'%s' cannot be rotated. Check whether you have permission to write to this folder.",
name);
g_free (name);
-
+
gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Skip"), 1);
gtk_dialog_add_button (GTK_DIALOG (msg_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Retry"), 0);
gtk_dialog_set_default_response (GTK_DIALOG (msg_dialog), 0);
-
+
int response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog));
gtk_widget_destroy (msg_dialog);
if (response_id == 0) {
@@ -219,7 +219,7 @@ op_finished (GPid pid, gint status, gpointer data)
} else if (response_id == 1) {
retry = FALSE;
}
-
+
} else if (priv->suffix == NULL) {
/* rotate image in place */
GFile *orig_location = caja_file_info_get_location (file);
@@ -234,7 +234,7 @@ op_finished (GPid pid, gint status, gpointer data)
priv->images_rotated++;
priv->files = priv->files->next;
}
-
+
if (!priv->cancelled && priv->files != NULL) {
/* process next image */
run_op (rotator);
@@ -248,9 +248,9 @@ static void
run_op (CajaImageRotator *rotator)
{
CajaImageRotatorPrivate *priv = CAJA_IMAGE_ROTATOR_GET_PRIVATE (rotator);
-
+
g_return_if_fail (priv->files != NULL);
-
+
CajaFileInfo *file = CAJA_FILE_INFO (priv->files->data);
GFile *orig_location = caja_file_info_get_location (file);
@@ -261,7 +261,7 @@ run_op (CajaImageRotator *rotator)
g_object_unref (new_location);
/* FIXME: check whether new_uri already exists and provide "Replace _All", "_Skip", and "_Replace" options */
-
+
gchar *argv[8];
argv[0] = "/usr/bin/convert";
argv[1] = filename;
@@ -271,32 +271,32 @@ run_op (CajaImageRotator *rotator)
argv[5] = "TopLeft";
argv[6] = new_filename;
argv[7] = NULL;
-
+
pid_t pid;
if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL)) {
// FIXME: error handling
return;
}
-
+
g_free (filename);
g_free (new_filename);
-
+
g_child_watch_add (pid, op_finished, rotator);
-
+
char *tmp;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar), (double) (priv->images_rotated + 1) / priv->images_total);
tmp = g_strdup_printf (_("Rotating image: %d of %d"), priv->images_rotated + 1, priv->images_total);
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress_bar), tmp);
g_free (tmp);
-
+
char *name = caja_file_info_get_name (file);
tmp = g_strdup_printf (_("<i>Rotating \"%s\"</i>"), name);
g_free (name);
gtk_label_set_markup (GTK_LABEL (priv->progress_label), tmp);
g_free (tmp);
-
+
}
static void
@@ -336,7 +336,7 @@ caja_image_rotator_response_cb (GtkDialog *dialog, gint response_id, gpointer us
} else {
g_assert_not_reached ();
}
-
+
run_op (rotator);
}
diff --git a/image-converter/caja-image-rotator.h b/image-converter/caja-image-rotator.h
index 81ea848..55222d3 100644
--- a/image-converter/caja-image-rotator.h
+++ b/image-converter/caja-image-rotator.h
@@ -1,6 +1,6 @@
/*
* caja-image-rotator.h
- *
+ *
* Copyright (C) 2004-2006 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Jürg Billeter <[email protected]>
- *
+ *
*/
#ifndef CAJA_IMAGE_ROTATOR_H
diff --git a/image-converter/image-converter.c b/image-converter/image-converter.c
index c6fed17..d793ef9 100644
--- a/image-converter/image-converter.c
+++ b/image-converter/image-converter.c
@@ -1,6 +1,6 @@
/*
* image-converter.c
- *
+ *
* Copyright (C) 2004-2005 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Jürg Billeter <[email protected]>
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -49,7 +49,7 @@ caja_module_shutdown (void)
g_print ("Shutting down caja-image-converter extension\n");
}
-void
+void
caja_module_list_types (const GType **types,
int *num_types)
{