Commit 2a0cf427 authored by Lucas Rocha's avatar Lucas Rocha Committed by Lucas Almeida Rocha

new "Reload Image" plugin. Fixes bug #470185.

2007-11-13  Lucas Rocha  <lucasr@gnome.org>

	* reload/eog-reload-plugin.c, reload/eog-reload-plugin.h,
	reload/reload.eog-plugin.desktop.in, reload/Makefile.am, configure.ac: 
	new "Reload Image" plugin. Fixes bug #470185.

svn path=/trunk/; revision=7
parent b47f159e
2007-11-13 Lucas Rocha <lucasr@gnome.org>
* reload/eog-reload-plugin.c, reload/eog-reload-plugin.h,
reload/reload.eog-plugin.desktop.in, reload/Makefile.am, configure.ac:
new "Reload Image" plugin. Fixes bug #470185.
2007-11-13 Lucas Rocha <lucasr@gnome.org>
* plugin/postr/eog-postr-plugin.c: remove remaining junk code from
......
......@@ -66,9 +66,9 @@ EOG_HAS_PYTHON=1
AC_MSG_CHECKING([which plugins to build])
ALL_PLUGINS="postr"
USEFUL_PLUGINS="postr"
DEFAULT_PLUGINS="postr"
ALL_PLUGINS="postr reload"
USEFUL_PLUGINS="postr reload"
DEFAULT_PLUGINS="postr reload"
PYTHON_ALL_PLUGINS=""
PYTHON_USEFUL_PLUGINS=""
......@@ -88,7 +88,7 @@ fi
AC_ARG_WITH([plugins],
[ --with-plugins=plugin1,plugin2,...
build the specified plugins. Available:
postr, as well as the aliases default,
postr, reload, as well as the aliases default,
all, and really-all],
[plugins=$with_plugins],
[plugins="default"])
......@@ -295,7 +295,6 @@ then
fi
PLUGINS=$(echo $PLUGINS | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
PLUGINS="postr"
AC_SUBST([DIST_PLUGINS])
AC_SUBST([BUILD_PLUGINS],[$PLUGINS])
......@@ -311,6 +310,7 @@ AC_CONFIG_FILES([
Makefile
plugins/Makefile
plugins/postr/Makefile
plugins/reload/Makefile
po/Makefile.in])
AC_OUTPUT
......
......@@ -10,12 +10,12 @@ G_BEGIN_DECLS
/*
* Type checking and casting macros
*/
#define EOG_TYPE_POSTR_PLUGIN (eog_docinfo_plugin_get_type ())
#define EOG_POSTR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_DOCINFO_PLUGIN, EogPostrPlugin))
#define EOG_POSTR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EOG_TYPE_DOCINFO_PLUGIN, EogPostrPluginClass))
#define EOG_IS_DOCINFO_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_DOCINFO_PLUGIN))
#define EOG_IS_DOCINFO_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EOG_TYPE_DOCINFO_PLUGIN))
#define EOG_POSTR_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EOG_TYPE_DOCINFO_PLUGIN, EogPostrPluginClass))
#define EOG_TYPE_POSTR_PLUGIN (eog_postr_plugin_get_type ())
#define EOG_POSTR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_POSTR_PLUGIN, EogPostrPlugin))
#define EOG_POSTR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EOG_TYPE_POSTR_PLUGIN, EogPostrPluginClass))
#define EOG_IS_POSTR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_POSTR_PLUGIN))
#define EOG_IS_POSTR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EOG_TYPE_POSTR_PLUGIN))
#define EOG_POSTR_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EOG_TYPE_POSTR_PLUGIN, EogPostrPluginClass))
/* Private structure type */
typedef struct _EogPostrPluginPrivate EogPostrPluginPrivate;
......
# Postr plugin
plugindir = $(libdir)/eog/plugins
INCLUDES = \
-I$(top_srcdir) \
$(EOG_CFLAGS) \
$(WARN_CFLAGS) \
-DEOG_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
plugin_LTLIBRARIES = libreload.la
libreload_la_SOURCES = \
eog-reload-plugin.h \
eog-reload-plugin.c
libreload_la_LDFLAGS = \
$(PLUGIN_LIBTOOL_FLAGS) \
$(EOG_LIBS)
# Plugin Info
plugin_in_files = reload.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)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "eog-reload-plugin.h"
#include <gmodule.h>
#include <glib/gi18n-lib.h>
#include <eog/eog-debug.h>
#include <eog/eog-scroll-view.h>
#include <eog/eog-thumb-view.h>
#include <eog/eog-image.h>
#define WINDOW_DATA_KEY "EogReloadWindowData"
/*#define MENU_PATH "/MainMenu/ImageMenu/Reload"*/
#define MENU_PATH "/MainMenu/ToolsMenu/ToolsOps_3"
EOG_PLUGIN_REGISTER_TYPE(EogReloadPlugin, eog_reload_plugin)
typedef struct
{
GtkActionGroup *ui_action_group;
guint ui_id;
} WindowData;
static void
reload_cb (GtkAction *action,
EogWindow *window)
{
static EogImage *current_image = NULL;
GtkWidget *thumbview = eog_window_get_thumb_view (window);
GtkWidget *view = eog_window_get_view (window);
eog_scroll_view_set_image (EOG_SCROLL_VIEW (view), NULL);
/* Re-select current image in order to trigger the image reload */
eog_thumb_view_select_single (EOG_THUMB_VIEW (thumbview),
EOG_THUMB_VIEW_SELECT_CURRENT);
}
static const GtkActionEntry action_entries[] =
{
{ "RunReload",
GTK_STOCK_REFRESH,
N_("Reload Image"),
"<control><shift>R",
N_("Reload current image"),
G_CALLBACK (reload_cb) }
};
static void
free_window_data (WindowData *data)
{
g_return_if_fail (data != NULL);
eog_debug (DEBUG_PLUGINS);
g_object_unref (data->ui_action_group);
g_free (data);
}
static void
eog_reload_plugin_init (EogReloadPlugin *plugin)
{
eog_debug_message (DEBUG_PLUGINS, "EogReloadPlugin initializing");
}
static void
eog_reload_plugin_finalize (GObject *object)
{
eog_debug_message (DEBUG_PLUGINS, "EogReloadPlugin finalizing");
G_OBJECT_CLASS (eog_reload_plugin_parent_class)->finalize (object);
}
static void
impl_activate (EogPlugin *plugin,
EogWindow *window)
{
GtkUIManager *manager;
GList *action_groups, i;
WindowData *data;
eog_debug (DEBUG_PLUGINS);
data = g_new (WindowData, 1);
manager = eog_window_get_ui_manager (window);
action_groups = gtk_ui_manager_get_action_groups (manager);
data->ui_action_group = gtk_action_group_new ("EogReloadPluginActions");
gtk_action_group_set_translation_domain (data->ui_action_group,
GETTEXT_PACKAGE);
gtk_action_group_add_actions (data->ui_action_group,
action_entries,
G_N_ELEMENTS (action_entries),
window);
gtk_ui_manager_insert_action_group (manager,
data->ui_action_group,
-1);
data->ui_id = gtk_ui_manager_new_merge_id (manager);
g_object_set_data_full (G_OBJECT (window),
WINDOW_DATA_KEY,
data,
(GDestroyNotify) free_window_data);
gtk_ui_manager_add_ui (manager,
data->ui_id,
MENU_PATH,
"RunReload",
"RunReload",
GTK_UI_MANAGER_MENUITEM,
FALSE);
}
static void
impl_deactivate (EogPlugin *plugin,
EogWindow *window)
{
GtkUIManager *manager;
WindowData *data;
eog_debug (DEBUG_PLUGINS);
manager = eog_window_get_ui_manager (window);
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
gtk_ui_manager_remove_ui (manager,
data->ui_id);
gtk_ui_manager_remove_action_group (manager,
data->ui_action_group);
g_object_set_data (G_OBJECT (window),
WINDOW_DATA_KEY,
NULL);
}
static void
impl_update_ui (EogPlugin *plugin,
EogWindow *window)
{
}
static void
eog_reload_plugin_class_init (EogReloadPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
EogPluginClass *plugin_class = EOG_PLUGIN_CLASS (klass);
object_class->finalize = eog_reload_plugin_finalize;
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
plugin_class->update_ui = impl_update_ui;
}
#ifndef __EOG_RELOAD_PLUGIN_H__
#define __EOG_RELOAD_PLUGIN_H__
#include <glib.h>
#include <glib-object.h>
#include <eog/eog-plugin.h>
G_BEGIN_DECLS
/*
* Type checking and casting macros
*/
#define EOG_TYPE_RELOAD_PLUGIN (eog_reload_plugin_get_type ())
#define EOG_RELOAD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_RELOAD_PLUGIN, EogReloadPlugin))
#define EOG_RELOAD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EOG_TYPE_RELOAD_PLUGIN, EogReloadPluginClass))
#define EOG_IS_RELOAD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_RELOAD_PLUGIN))
#define EOG_IS_RELOAD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EOG_TYPE_RELOAD_PLUGIN))
#define EOG_RELOAD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EOG_TYPE_RELOAD_PLUGIN, EogReloadPluginClass))
/* Private structure type */
typedef struct _EogReloadPluginPrivate EogReloadPluginPrivate;
/*
* Main object structure
*/
typedef struct _EogReloadPlugin EogReloadPlugin;
struct _EogReloadPlugin
{
EogPlugin parent_instance;
};
/*
* Class definition
*/
typedef struct _EogReloadPluginClass EogReloadPluginClass;
struct _EogReloadPluginClass
{
EogPluginClass parent_class;
};
/*
* Public methods
*/
GType eog_reload_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_RELOAD_PLUGIN_H__ */
[Eog Plugin]
Module=reload
IAge=2
_Name=Reload Image
Icon=gtk-refresh
_Description=Reload current image
Authors=Lucas Rocha <lucasr@gnome.org>
Copyright=Copyright © 2007 Lucas Rocha
Website=http://www.gnome.org/projects/eog
plugins/postr/postr.eog-plugin.desktop.in
plugins/postr/eog-postr-plugin.c
plugins/reload/reload.eog-plugin.desktop.in
plugins/reload/eog-reload-plugin.c
Markdown is supported
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