Commit 32abf914 authored by Lucas Almeida Rocha's avatar Lucas Almeida Rocha

Initial import

svn path=/trunk/; revision=2
parents
Lucas Rocha <lucasr@gnome.org>
This diff is collapsed.
2007-08-06 Lucas Rocha <lucasr@gnome.org>
* Initial import.
Lucas Rocha <lucasr@gnome.org>
SUBDIRS = plugins po
EXTRA_DIST = \
autogen.sh \
ChangeLog \
gnome-doc-utils.make \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
DISTCLEANFILES = \
gnome-doc-utils.make \
intltool-extract \
intltool-merge \
intltool-update
DISTCHECK_CONFIGURE_FLAGS = --with-plugins=really-all
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="eog-plugins"
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME Subversion"
exit 1
}
REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh
Process this file with autoconf to produce a configure script.
EOG_MAJOR=2.20.0
EOG_PLUGINS_MAJOR=2.20.0
AC_INIT(eog-plugins, 2.19.6, http://bugzilla.gnome.org/enter_bug.cgi?product=eog-plugins)
AC_CONFIG_SRCDIR([plugins])
AC_PREFIX_PROGRAM([eog])
AC_SUBST(EOG_PLUGINS_MAJOR)
AC_PREREQ(2.59)
AM_INIT_AUTOMAKE([1.8 dist-bzip2 no-dist-gzip])
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS([config.h])
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
# ***********
# Translation
# ***********
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.35.0])
GETTEXT_PACKAGE=eog-plugins
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
# ***************
# gnome-doc-utils
# ***************
GNOME_DOC_INIT
# **********
# GNOME Libs
# **********
PKG_CHECK_MODULES(EOG, [
glib-2.0 >= 2.12.0
gtk+-2.0 >= 2.10.0
eog >= 2.19.0
libglade-2.0 >= 2.3.6
gnome-vfs-2.0 >= 2.10.0
])
AC_SUBST(EOG_LIBS)
AC_SUBST(EOG_CFLAGS)
# *******
# Plugins
# *******
#FIXME
EOG_HAS_PYTHON=1
#/FIXME
AC_MSG_CHECKING([which plugins to build])
ALL_PLUGINS="postr"
USEFUL_PLUGINS="postr"
DEFAULT_PLUGINS="postr"
PYTHON_ALL_PLUGINS=""
PYTHON_USEFUL_PLUGINS=""
PYTHON_DEFAULT_PLUGINS=""
DIST_PLUGINS="$ALL_PLUGINS $PYTHON_ALL_PLUGINS"
if test $EOG_HAS_PYTHON
then
ALL_PLUGINS="$ALL_PLUGINS $PYTHON_ALL_PLUGINS"
USEFUL_PLUGINS="$USEFUL_PLUGINS $PYTHON_USEFUL_PLUGINS"
DEFAULT_PLUGINS="$DEFAULT_PLUGINS $PYTHON_DEFAULT_PLUGINS"
else
AC_MSG_WARN([eog compiled without python support, plugins $PYTHON_ALL_PLUGINS will not be available])
fi
AC_ARG_WITH([plugins],
[ --with-plugins=plugin1,plugin2,...
build the specified plugins. Available:
postr, as well as the aliases default,
all, and really-all],
[plugins=$with_plugins],
[plugins="default"])
if test "x$with_plugins" = xyes
then
plugins="default"
fi
need_python=no
explicit_plugins=
PLUGINS=
IFS="${IFS= }"; eogpl_save_ifs="$IFS"; IFS=","
for pl in $plugins
do
if echo "$ALL_PLUGINS" | egrep "(^| )$pl(\$| )" > /dev/null
then
PLUGINS="$PLUGINS $pl"
explicit_plugins="$explicit_plugins $pl"
elif test "x$pl" = "xdefault"
then
PLUGINS="$PLUGINS $DEFAULT_PLUGINS"
elif test "x$pl" = "xall"
then
PLUGINS="$PLUGINS $USEFUL_PLUGINS"
elif test "x$pl" = "xreally-all"
then
PLUGINS="$PLUGINS $ALL_PLUGINS"
else
AC_MSG_ERROR([the specified plugin $pl does not exist])
fi
if echo "$PYTHON_ALL_PLUGINS" | egrep "(^| )$pl(\$| )" > /dev/null
then
need_python=yes
fi
done
IFS="$eogpl_save_ifs"
AC_MSG_RESULT([$PLUGINS])
# *****
# GConf
# *****
AC_PATH_PROG(GCONFTOOL, gconftool-2)
AM_GCONF_SOURCE_2
# **************
# Python Support
# **************
AC_MSG_CHECKING([whether Python support is requested])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--enable-python],[Enable python support]),
[enable_python=$enableval have_python=$enableval],
[enable_python=autodetect have_python=yes])
AC_MSG_RESULT([$enable_python])
if test "x$have_python" != "xno"; then
AM_PATH_PYTHON([2.3],[],[no])
if test "x$PYTHON" = "x:"; then
have_python=no
fi
fi
if test "x$have_python" != "xno"; then
PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
PYTHON_LIBS="-lpython$PYTHON_VERSION"
PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/Makefile"
PYTHON_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
PYTHON_EXTRA_LIBS="$PYTHON_LOCALMODLIBS $PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
AC_SUBST([PYTHON_LIBS])
AC_SUBST([PYTHON_LIB_LOC])
AC_SUBST([PYTHON_CFLAGS])
AC_SUBST([PYTHON_EXTRA_LIBS])
fi
if test "x$have_python" != "xno"; then
PYGOBJECT_REQUIRED=2.11.5
PYGTK_REQUIRED=2.9.7
GNOME_PYTHON_REQUIRED=2.18.2
PKG_CHECK_MODULES([PYGTK], [
pygobject-2.0 >= $PYGOBJECT_REQUIRED
gnome-python-2.0 >= $GNOME_PYTHON_REQUIRED
pygtk-2.0 >= $PYGTK_REQUIRED],
[],[have_python=no])
AC_SUBST([PYGTK_CFLAGS])
AC_SUBST([PYGTK_LIBS])
fi
if test "x$have_python" != "xno"; then
AC_MSG_CHECKING([for pygtk defs])
PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
AC_MSG_RESULT([$PYGTK_DEFSDIR])
AC_MSG_CHECKING([for pygtk codegen])
PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
AC_MSG_RESULT([$PYGTK_CODEGEN])
AC_MSG_CHECKING([for pygtk h2def])
PYGTK_H2DEF="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/h2def.py"
AC_MSG_RESULT([$PYGTK_H2DEF])
AC_SUBST([PYGTK_DEFSDIR])
AC_SUBST([PYGTK_CODEGEN])
AC_SUBST([PYGTK_H2DEF])
dnl Check for -fno-strict-aliasing
FLAGS="-fno-strict-aliasing"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $FLAGS"
AC_MSG_CHECKING([whether [$]CC understands $FLAGS])
AC_TRY_COMPILE([], [], [compiler_has_option=yes], [compiler_has_option=no])
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($compiler_has_option)
if test $compiler_has_option = yes; then
NO_STRICT_ALIASING_CFLAGS="$FLAGS"
fi
AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
fi
if test "x$have_python" != "xyes"; then
if test "x$enable_python" = "xyes"; then
AC_MSG_ERROR([Python not found])
elif test "x$enable_python" = "xautodetect"; then
enable_python=no
AC_MSG_WARN([Python not found, disabling python support])
fi
elif test "x$enable_python" != "xno"; then
enable_python=yes
AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
fi
AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
disabled_plugins=
# *******************
# Plugin Dependencies
# *******************
check_plugin_defined() {
if echo "$2" | egrep "\b($1)\b" > /dev/null;
then
return 1
else
return 0
fi
}
plugin_defined() {
check_plugin_defined "$1" "$PLUGINS"
return $?
}
plugin_defined_explicit() {
check_plugin_defined "$1" "$explicit_plugins"
return $?
}
undef_plugin() {
if test -z "$disabled_plugins"
then
disabled_plugins="$1 ($2)"
else
disabled_plugins="$disabled_plugins, $1 ($2)"
fi
PLUGINS=$(echo "$PLUGINS" | sed -e "s/[[^a-zA-Z0-9_]]$1[[ \t\r\n\f]]\{1,\}/ /" -e "s/[[^a-zA-Z0-9_]]$1$//" -e "s/^$1[[ \t\r\n\f]]\{1,\}//")
}
# Disable python plugins if there is no python support
if test "x$enable_python" = "xno"
then
for pl in $PYTHON_ALL_PLUGINS
do
undef_plugin "$pl" "no python support"
done
fi
# *****
# Postr
# *****
plugin_defined postr
if test "$?" = 1
then
AC_PATH_PROG(POSTR, postr)
fi
if test -z "$disabled_plugins"
then
disabled_plugins="none"
fi
PLUGINS=$(echo $PLUGINS | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
PLUGINS="postr"
AC_SUBST([DIST_PLUGINS])
AC_SUBST([BUILD_PLUGINS],[$PLUGINS])
# ****
# Misc
# ****
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
AC_CONFIG_FILES([
Makefile
plugins/Makefile
plugins/postr/Makefile
po/Makefile.in])
AC_OUTPUT
echo "
Configure summary:
Source code location:..: ${srcdir}
Compiler...............: ${CC}
Prefix ................: ${prefix}
Python Support ........: $enable_python
Plugins ...............: $PLUGINS
Disabled plugins ......: $disabled_plugins
Note: you have to install these plugins into the same prefix than your eog
installation (probably /usr if you're using your distro packages, /usr/local
if you have compiled it on your own).
"
SUBDIRS = $(BUILD_PLUGINS)
DIST_SUBDIRS = $(DIST_PLUGINS)
plugindir = $(libdir)/eog/plugins
plugin_PYTHON =
DISTCLEANFILES =
EXTRA_DIST =
# Postr plugin
plugindir = $(libdir)/eog/plugins
INCLUDES = \
-I$(top_srcdir) \
$(EOG_CFLAGS) \
$(WARN_CFLAGS) \
-DEOG_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
plugin_LTLIBRARIES = libpostr.la
libpostr_la_SOURCES = \
eog-postr-plugin.h \
eog-postr-plugin.c
libpostr_la_LDFLAGS = \
$(PLUGIN_LIBTOOL_FLAGS) \
$(EOG_LIBS)
# Plugin Info
plugin_in_files = postr.eog-plugin.in
%.eog-plugin: %.eog-plugin.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.in=.eog-plugin)
EXTRA_DIST = $(plugin_in_files)
CLEANFILES = $(plugin_DATA)
DISTCLEANFILES = $(plugin_DATA)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "eog-postr-plugin.h"
#include <string.h> /* For strlen (...) */
#include <gmodule.h>
#include <glib/gi18n-lib.h>
#include <eog/eog-debug.h>
#include <eog/eog-thumb-view.h>
#include <eog/eog-image.h>
#define WINDOW_DATA_KEY "EogPostrWindowData"
#define MENU_PATH "/MainMenu/ToolsMenu/ToolsOps_2"
EOG_PLUGIN_REGISTER_TYPE(EogPostrPlugin, eog_postr_plugin)
typedef struct
{
GtkActionGroup *ui_action_group;
guint ui_id;
} WindowData;
static void
postr_cb (GtkAction *action,
EogWindow *window)
{
GtkWidget *thumbview = eog_window_get_thumb_view (window);
GList *images, *i;
gchar *cmd = g_strdup ("postr ");
images = eog_thumb_view_get_selected_images (EOG_THUMB_VIEW (thumbview));
for (i = g_list_first (images); i; i = i->next) {
EogImage *image = (EogImage *) i->data;
cmd = g_strconcat (cmd, eog_image_get_uri_for_display (image), " ", NULL);
}
g_spawn_command_line_async (cmd, NULL);
}
static const GtkActionEntry action_entries[] =
{
{ "RunPostr",
"postr",
"Upload to Flickr",
NULL,
"Upload your pictures to Flickr",
G_CALLBACK (postr_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
update_ui_real (EogWindow *window,
WindowData *data)
{
#if 0
EogView *view;
eog_debug (DEBUG_PLUGINS);
view = eog_window_get_active_view (window);
gtk_action_group_set_sensitive (data->ui_action_group,
(view != NULL));
if (data->dialog != NULL)
{
gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog->dialog),
GTK_RESPONSE_OK,
(view != NULL));
}
#endif
}
static void
eog_postr_plugin_init (EogPostrPlugin *plugin)
{
eog_debug_message (DEBUG_PLUGINS, "EogPostrPlugin initializing");
}
static void
eog_postr_plugin_finalize (GObject *object)
{
eog_debug_message (DEBUG_PLUGINS, "EogPostrPlugin finalizing");
G_OBJECT_CLASS (eog_postr_plugin_parent_class)->finalize (object);
}
static void
impl_activate (EogPlugin *plugin,
EogWindow *window)
{
GtkUIManager *manager;
WindowData *data;
eog_debug (DEBUG_PLUGINS);
data = g_new (WindowData, 1);
manager = eog_window_get_ui_manager (window);
data->ui_action_group = gtk_action_group_new ("EogPostrPluginActions");
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,
"RunPostr",
"RunPostr",
GTK_UI_MANAGER_MENUITEM,
FALSE);
update_ui_real (window, data);
}
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)
{
WindowData *data;
eog_debug (DEBUG_PLUGINS);
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
update_ui_real (window, data);
}
static void
eog_postr_plugin_class_init (EogPostrPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
EogPluginClass *plugin_class = EOG_PLUGIN_CLASS (klass);
object_class->finalize = eog_postr_plugin_finalize;
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
plugin_class->update_ui = impl_update_ui;
}
#ifndef __EOG_POSTR_PLUGIN_H__
#define __EOG_POSTR_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_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))
/* Private structure type */
typedef struct _EogPostrPluginPrivate EogPostrPluginPrivate;
/*
* Main object structure
*/
typedef struct _EogPostrPlugin EogPostrPlugin;
struct _EogPostrPlugin
{
EogPlugin parent_instance;
};
/*
* Class definition
*/
typedef struct _EogPostrPluginClass EogPostrPluginClass;
struct _EogPostrPluginClass
{
EogPluginClass parent_class;
};
/*
* Public methods
*/
GType eog_postr_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_POSTR_PLUGIN_H__ */
[Eog Plugin]
Module=postr
IAge=2
_Name=Flickr Uploader
Icon=postr
_Description=Upload your photos to Flickr.
Authors=Lucas Rocha <lucasr@gnome.org>
Copyright=Copyright © 2007 Lucas Rocha
Website=http://www.gnome.org/projects/eog
# eog plugins translations
#
# please keep this list sorted alphabetically
#
plugins/postr/postr.eog-plugin.in
plugins/postr/eog-postr-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