eog r4481 - in trunk: . plugins plugins/statusbar-date po



Author: csaavedra
Date: Thu Mar 20 03:17:24 2008
New Revision: 4481
URL: http://svn.gnome.org/viewvc/eog?rev=4481&view=rev

Log:
2008-03-20  Claudio Saavedra  <csaavedra alumnos utalca cl>

	* configure.ac: Add plugins/statusbar-date/Makefile
	* po/POTFILES.in: Add statusbar-date.eog-plugin.desktop.in

	Added a plugin to show the EXIF date on the statusbar. Fixes
	bug #466566.



Added:
   trunk/plugins/ChangeLog
   trunk/plugins/statusbar-date/
   trunk/plugins/statusbar-date/Makefile.am
   trunk/plugins/statusbar-date/eog-statusbar-date-plugin.c
   trunk/plugins/statusbar-date/eog-statusbar-date-plugin.h
   trunk/plugins/statusbar-date/statusbar-date.eog-plugin.desktop.in
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/plugins/Makefile.am
   trunk/po/POTFILES.in

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu Mar 20 03:17:24 2008
@@ -391,6 +391,7 @@
 plugins/Makefile
 plugins/reload/Makefile
 plugins/fullscreen/Makefile
+plugins/statusbar-date/Makefile
 bindings/Makefile
 bindings/python/Makefile
 ])

Modified: trunk/plugins/Makefile.am
==============================================================================
--- trunk/plugins/Makefile.am	(original)
+++ trunk/plugins/Makefile.am	Thu Mar 20 03:17:24 2008
@@ -1,4 +1,8 @@
-SUBDIRS = fullscreen reload 
+SUBDIRS = fullscreen reload
+
+if HAVE_EXIF
+SUBDIRS += statusbar-date
+endif
 
 plugindir = $(libdir)/eog/plugins
 

Added: trunk/plugins/statusbar-date/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/plugins/statusbar-date/Makefile.am	Thu Mar 20 03:17:24 2008
@@ -0,0 +1,29 @@
+plugindir = $(libdir)/eog/plugins
+
+INCLUDES = \
+	-I$(top_srcdir)/src 				\
+	$(EOG_CFLAGS) 					\
+	$(WARN_CFLAGS)					\
+	-DEOG_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+
+plugin_LTLIBRARIES = libstatusbar-date.la
+
+libstatusbar_date_la_SOURCES = \
+	eog-statusbar-date-plugin.h				\
+	eog-statusbar-date-plugin.c	
+
+libstatusbar_date_la_LDFLAGS = \
+	$(EOG_LIBS)
+
+# Plugin Info
+
+plugin_in_files = statusbar-date.eog-plugin.desktop.in
+
+%.eog-plugin: %.eog-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.eog-plugin.desktop.in=.eog-plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)

Added: trunk/plugins/statusbar-date/eog-statusbar-date-plugin.c
==============================================================================
--- (empty file)
+++ trunk/plugins/statusbar-date/eog-statusbar-date-plugin.c	Thu Mar 20 03:17:24 2008
@@ -0,0 +1,171 @@
+/* Statusbar Date -- Shows the EXIF date in EOG's statusbar
+ *
+ * Copyright (C) 2008 The Free Software Foundation
+ *
+ * Author: Claudio Saavedra  <csaavedra gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "eog-statusbar-date-plugin.h"
+
+#include <gmodule.h>
+#include <glib/gi18n-lib.h>
+
+#include <eog-debug.h>
+#include <eog-scroll-view.h>
+#include <eog-image.h>
+#include <eog-thumb-view.h>
+#ifdef HAVE_EXIF
+#include "eog-exif-util.h"
+#include <libexif/exif-data.h>
+#endif
+
+#define WINDOW_DATA_KEY "EogStatusbarDateWindowData"
+
+EOG_PLUGIN_REGISTER_TYPE(EogStatusbarDatePlugin, eog_statusbar_date_plugin)
+
+typedef struct
+{
+	GtkWidget *statusbar_date;
+	gulong signal_id;
+} WindowData;
+
+static void
+free_window_data (WindowData *data)
+{
+	g_return_if_fail (data != NULL);
+	
+	eog_debug (DEBUG_PLUGINS);
+
+	g_free (data);
+}
+
+static void
+selection_changed_cb (EogThumbView *view, WindowData *data)
+{
+	EogImage *image;
+	gchar *date = NULL;
+	gchar time_buffer[32];
+	ExifData *exif_data;
+
+	if (eog_thumb_view_get_n_selected (EOG_THUMB_VIEW (view)) == 0)
+		return;
+	
+	image = eog_thumb_view_get_first_selected_image (EOG_THUMB_VIEW (view));
+
+	exif_data = (ExifData *) eog_image_get_exif_info (image);
+	if (exif_data) {
+		date = eog_exif_util_format_date (
+			eog_exif_util_get_value (exif_data, EXIF_TAG_DATE_TIME_ORIGINAL, time_buffer, 32));
+	}
+
+	gtk_statusbar_pop (GTK_STATUSBAR (data->statusbar_date), 0);
+	if (date) {
+		gtk_statusbar_push (GTK_STATUSBAR (data->statusbar_date), 0, date);
+		gtk_widget_show (data->statusbar_date);
+	} else {
+		gtk_widget_hide (data->statusbar_date);
+	}
+#ifdef HAVE_EXIF
+	if (exif_data) {
+		exif_data_unref (exif_data);
+	}
+#endif
+	if (date) {
+		g_free (date);
+	}
+}
+static void
+eog_statusbar_date_plugin_init (EogStatusbarDatePlugin *plugin)
+{
+	eog_debug_message (DEBUG_PLUGINS, "EogStatusbarDatePlugin initializing");
+}
+
+static void
+eog_statusbar_date_plugin_finalize (GObject *object)
+{
+	eog_debug_message (DEBUG_PLUGINS, "EogStatusbarDatePlugin finalizing");
+
+	G_OBJECT_CLASS (eog_statusbar_date_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (EogPlugin *plugin,
+	       EogWindow *window)
+{
+	GtkWidget *statusbar = eog_window_get_statusbar (window);
+	GtkWidget *thumbview = eog_window_get_thumb_view (window);
+	WindowData *data;
+
+	eog_debug (DEBUG_PLUGINS);
+	
+	data = g_new (WindowData, 1);
+	data->statusbar_date = gtk_statusbar_new ();
+	gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (data->statusbar_date),
+					   FALSE);
+	gtk_widget_set_size_request (data->statusbar_date, 150, 10);
+	gtk_box_pack_end (GTK_BOX (statusbar),
+			  data->statusbar_date,
+			  FALSE, FALSE, 0);
+
+	data->signal_id = g_signal_connect_after (G_OBJECT (thumbview), "selection_changed",
+						  G_CALLBACK (selection_changed_cb), data);
+
+	g_object_set_data_full (G_OBJECT (window), 
+				WINDOW_DATA_KEY, 
+				data,
+				(GDestroyNotify) free_window_data);
+}
+
+static void
+impl_deactivate	(EogPlugin *plugin,
+		 EogWindow *window)
+{
+	GtkWidget *statusbar = eog_window_get_statusbar (window);
+	WindowData *data;
+
+	data = (WindowData *) g_object_get_data (G_OBJECT (window), 
+						 WINDOW_DATA_KEY);
+
+	gtk_container_remove (GTK_CONTAINER (statusbar), data->statusbar_date);
+
+	g_object_set_data (G_OBJECT (window),
+			   WINDOW_DATA_KEY,
+			   NULL);
+}
+
+static void
+impl_update_ui (EogPlugin *plugin,
+		EogWindow *window)
+{
+}
+
+static void
+eog_statusbar_date_plugin_class_init (EogStatusbarDatePluginClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	EogPluginClass *plugin_class = EOG_PLUGIN_CLASS (klass);
+
+	object_class->finalize = eog_statusbar_date_plugin_finalize;
+
+	plugin_class->activate = impl_activate;
+	plugin_class->deactivate = impl_deactivate;
+	plugin_class->update_ui = impl_update_ui;
+}

Added: trunk/plugins/statusbar-date/eog-statusbar-date-plugin.h
==============================================================================
--- (empty file)
+++ trunk/plugins/statusbar-date/eog-statusbar-date-plugin.h	Thu Mar 20 03:17:24 2008
@@ -0,0 +1,74 @@
+/* Statusbar Date -- Shows the EXIF date in EOG's statusbar
+ *
+ * Copyright (C) 2008 The Free Software Foundation
+ *
+ * Author: Claudio Saavedra  <csaavedra gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EOG_STATUSBAR_DATE_PLUGIN_H__
+#define __EOG_STATUSBAR_DATE_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <eog-plugin.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define EOG_TYPE_STATUSBAR_DATE_PLUGIN		(eog_statusbar_date_plugin_get_type ())
+#define EOG_STATUSBAR_DATE_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_STATUSBAR_DATE_PLUGIN, EogStatusbarDatePlugin))
+#define EOG_STATUSBAR_DATE_PLUGIN_CLASS(k)		G_TYPE_CHECK_CLASS_CAST((k),      EOG_TYPE_STATUSBAR_DATE_PLUGIN, EogStatusbarDatePluginClass))
+#define EOG_IS_STATUSBAR_DATE_PLUGIN(o)	        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_STATUSBAR_DATE_PLUGIN))
+#define EOG_IS_STATUSBAR_DATE_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k),    EOG_TYPE_STATUSBAR_DATE_PLUGIN))
+#define EOG_STATUSBAR_DATE_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o),  EOG_TYPE_STATUSBAR_DATE_PLUGIN, EogStatusbarDatePluginClass))
+
+/* Private structure type */
+typedef struct _EogStatusbarDatePluginPrivate	EogStatusbarDatePluginPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _EogStatusbarDatePlugin		EogStatusbarDatePlugin;
+
+struct _EogStatusbarDatePlugin
+{
+	EogPlugin parent_instance;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _EogStatusbarDatePluginClass	EogStatusbarDatePluginClass;
+
+struct _EogStatusbarDatePluginClass
+{
+	EogPluginClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType	eog_statusbar_date_plugin_get_type		(void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT GType register_eog_plugin (GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* __EOG_STATUSBAR_DATE_PLUGIN_H__ */

Added: trunk/plugins/statusbar-date/statusbar-date.eog-plugin.desktop.in
==============================================================================
--- (empty file)
+++ trunk/plugins/statusbar-date/statusbar-date.eog-plugin.desktop.in	Thu Mar 20 03:17:24 2008
@@ -0,0 +1,9 @@
+
+[Eog Plugin]
+Module=statusbar-date
+IAge=2
+_Name=Date in statusbar
+_Description=Shows the image date in the window statusbar
+Authors=Claudio Saavedra  <csaavedra gnome org>
+Copyright=Copyright  2008 Free Software Foundation
+Website=http://www.gnome.org/projects/eog

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Thu Mar 20 03:17:24 2008
@@ -8,6 +8,7 @@
 plugins/fullscreen/eog-fullscreen-plugin.c
 plugins/reload/reload.eog-plugin.desktop.in
 plugins/reload/eog-reload-plugin.c
+plugins/statusbar-date/statusbar-date.eog-plugin.desktop.in
 data/eog.desktop.in.in
 data/eog-image-properties-dialog.glade
 data/eog-multiple-save-as-dialog.glade



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]