Commit eb7a431c authored by Michael J. Chudobiak's avatar Michael J. Chudobiak Committed by Michael J. Chudobiak

Previous commit reverted, as per Paolo's request. See bug 389197.

2007-01-01  Michael J. Chudobiak  <mjc@cvs.gnome.org>

        * README:
        * configure.in:
        * data/GNOME_GThumb.server.in.in:
        * data/Makefile.am:
        * libgthumb/Makefile.am:
        * libgthumb/jpegutils/Makefile.am:
        * src/.cvsignore:
        * src/GNOME_GThumb.idl:
        * src/Makefile.am:
        * src/gth-application.c:
        * src/gth-application.h:
        * src/main.c: (release_data), (open_viewer_window),
        (open_browser_window), (load_session), (prepare_app):
        Previous commit reverted, as per Paolo's request. See bug 389197.


svn path=/trunk/; revision=1242
parent 1663d9e5
2007-01-01 Michael J. Chudobiak <mjc@cvs.gnome.org>
* README:
* configure.in:
* data/GNOME_GThumb.server.in.in:
* data/Makefile.am:
* libgthumb/Makefile.am:
* libgthumb/jpegutils/Makefile.am:
* src/.cvsignore:
* src/GNOME_GThumb.idl:
* src/Makefile.am:
* src/gth-application.c:
* src/gth-application.h:
* src/main.c: (release_data), (open_viewer_window),
(open_browser_window), (load_session), (prepare_app):
Additional clean-up to remove bonobo references.
Bug 389197. Patch by Björn Lindqvist.
2006-12-28 Paolo Bacchilega <paobac@cvs.gnome.org>
* src/dlg-redeye-removal.c (dlg_redeye_removal):
......
......@@ -64,6 +64,11 @@ What is gThumb
+ Find duplicated images.
+ Write images to CD/DVD.
* gThumb is a Bonobo component
+ Image viewer component. Differences with the EOG component:
display GIF animations, print the image and its comment.
Licensing
=========
......@@ -89,6 +94,8 @@ Compiling
* libglade version >= 2.4.0
* libgnomeprint version >= 2.6.0
* libgnomeprintui version >= 2.6.0
* libbonobo version >= 2.6.0
* libbonoboui version >= 2.6.0
* intltool version >= 0.35.0
* libexif version >= 0.6.9
* libjpeg
......
......@@ -30,6 +30,8 @@ LIBGNOMEUI_REQUIRED=2.6.0
LIBGNOMECANVAS_REQUIRED=2.6.0
GNOME_VFS_REQUIRED=2.6.0
LIBGLADE_REQUIRED=2.4.0
LIBBONOBO_REQUIRED=2.6.0
LIBBONOBOUI_REQUIRED=2.6.0
LIBEXIF_REQUIRED=0.6.13
LIBIPTCDATA_REQUIRED=0.2.1
LIBGPHOTO_REQUIRED=2.1.3
......@@ -42,12 +44,16 @@ AC_SUBST(LIBGNOMEUI_REQUIRED)
AC_SUBST(LIBGNOMECANVAS_REQUIRED)
AC_SUBST(GNOME_VFS_REQUIRED)
AC_SUBST(LIBGLADE_REQUIRED)
AC_SUBST(LIBBONOBO_REQUIRED)
AC_SUBST(LIBBONOBOUI_REQUIRED)
AC_SUBST(LIBEXIF_REQUIRED)
AC_SUBST(LIBIPTCDATA_REQUIRED)
AC_SUBST(LIBGPHOTO_REQUIRED)
dnl ===========================================================================
AM_PATH_ORBIT2
PKG_CHECK_MODULES(GTHUMB, \
glib-2.0 >= $GLIB_REQUIRED \
gthread-2.0 \
......@@ -224,6 +230,13 @@ fi
dnl ###############################################
IDL_MODULES="bonobo-activation-2.0 libbonobo-2.0 libbonoboui-2.0"
IDL_INCLUDES="`$PKG_CONFIG --variable=idldir $IDL_MODULES | $srcdir/add-include-prefix`"
AC_SUBST(IDL_INCLUDES)
dnl ###############################################
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
......
<oaf_info>
<oaf_server iid="OAFIID:GNOME_GThumb_Application_Factory" type="exe" location="goo">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/ObjectFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="GThumb Application Factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_GThumb_Application" type="factory" location="OAFIID:GNOME_GThumb_Application_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Unknown:1.0"/>
<item value="IDL:GNOME/Goobox/Application:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="GThumb Application"/>
</oaf_server>
</oaf_info>
......@@ -32,6 +32,12 @@ schema_DATA = $(schema_in_files:.schemas.in=.schemas)
@INTLTOOL_SCHEMAS_RULE@
bonobodir = $(libdir)/bonobo
serverdir = $(libdir)/bonobo/servers
server_in_files = GNOME_GThumb.server.in.in
server_DATA = $(server_in_files:.server.in.in=.server)
$(server_in_files:.server.in.in=.server.in): $(server_in_files)
sed -e "s|\@BONOBODIR\@|$(bonobodir)|" $< > $@
@INTLTOOL_SERVER_RULE@
if GCONF_SCHEMAS_INSTALL
......@@ -46,10 +52,13 @@ EXTRA_DIST = \
$(desktop_in_files) \
$(desktop_DATA) \
$(icon_DATA) \
$(man_MANS)
$(man_MANS) \
$(server_in_files)
DISTCLEANFILES = \
$(schema_DATA) \
$(desktop_DATA) \
$(server_DATA)
$(server_DATA) \
GNOME_GThumb.server.in \
GNOME_GThumb.server
......@@ -2,7 +2,7 @@ SUBDIRS = icons cursors jpegutils
DIST_SUBDIRS = icons cursors jpegutils
if ENABLE_DEPRECATIONS
DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED
DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED
else
DISABLE_DEPRECATED =
endif
......
if ENABLE_DEPRECATIONS
DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED
DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED
else
DISABLE_DEPRECATED =
endif
......
......@@ -9,3 +9,8 @@ Makefile.in
glade1
gthumb
gthumb.schemas
gnome_gthumb_idl_stamp
GNOME_GThumb-common.c
GNOME_GThumb-skels.c
GNOME_GThumb-stubs.c
GNOME_GThumb.h
#include <Bonobo.idl>
module GNOME {
module GThumb {
interface Application : Bonobo::Unknown {
oneway void open_browser (in string uri);
oneway void open_viewer (in string uri);
oneway void load_image (in string uri);
oneway void import_photos ();
};
};
};
......@@ -4,7 +4,7 @@ DIST_SUBDIRS = icons
gladedir = $(datadir)/gthumb/glade
if ENABLE_DEPRECATIONS
DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED
DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED
else
DISABLE_DEPRECATED =
endif
......@@ -20,13 +20,26 @@ INCLUDES = \
-DGTHUMB_DATADIR=\"$(datadir)\" \
-DGTHUMB_LIBDIR=\"$(libdir)\" \
-DPIXMAPSDIR=\""$(datadir)/pixmaps/"\" \
-DBONOBO_UIDIR=\""$(uidir)/"\" \
-DGTHUMB_GLADEDIR=\""$(gladedir)"\" \
-I$(top_srcdir)/libgthumb \
-I../libgthumb
bin_PROGRAMS = gthumb
gnome_gthumb_idl_sources = \
GNOME_GThumb-stubs.c \
GNOME_GThumb-skels.c \
GNOME_GThumb.h \
GNOME_GThumb-common.c
$(gnome_gthumb_idl_sources): gnome_gthumb_idl_stamp
gnome_gthumb_idl_stamp: GNOME_GThumb.idl $(ORBIT_IDL)
$(ORBIT_IDL) $(IDL_INCLUDES) $<
touch $@
gthumb_SOURCES = \
$(gnome_gthumb_idl_sources) \
bookmark-list.c \
bookmark-list.h \
catalog-list.c \
......@@ -75,6 +88,8 @@ gthumb_SOURCES = \
dlg-write-to-cd.h \
gs-fade.c \
gs-fade.h \
gth-application.c \
gth-application.h \
gth-batch-op.c \
gth-batch-op.h \
gth-browser.c \
......@@ -197,9 +212,13 @@ libphotoimporter_la_LIBADD = $(top_builddir)/libgthumb/jpegutils/libgthumb-jpeg
libphotoimporter_la_DEPENDENCIES = gthumb$(EXEEXT)
EXTRA_DIST = \
GNOME_GThumb.idl \
albumtheme.c \
albumtheme.y \
albumtheme.l \
lex.albumtheme.c
CLEANFILES = \
$(gnome_gthumb_idl_sources) \
gnome_gthumb_idl_stamp
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2005 Free Software Foundation, Inc.
*
* 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 Street #330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <gdk/gdkx.h>
#include <bonobo/bonobo-generic-factory.h>
#include "gth-application.h"
#include "gth-browser.h"
#include "gth-viewer.h"
#include "gth-browser-actions-callbacks.h"
#include "main.h"
static BonoboObject *
gth_application_factory (BonoboGenericFactory *this_factory,
const char *iid,
gpointer user_data)
{
if (strcmp (iid, "OAFIID:GNOME_GThumb_Application") != 0)
return NULL;
else
return BONOBO_OBJECT (g_object_new (GTH_TYPE_APPLICATION, NULL));
}
BonoboObject *
gth_application_new (GdkScreen *screen)
{
BonoboGenericFactory *factory;
char *display_name;
char *registration_id;
display_name = gdk_screen_make_display_name (screen);
registration_id = bonobo_activation_make_registration_id ("OAFIID:GNOME_GThumb_Application_Factory", display_name);
factory = bonobo_generic_factory_new (registration_id,
gth_application_factory,
NULL);
g_free (display_name);
g_free (registration_id);
return BONOBO_OBJECT (factory);
}
static void
show_grabbing_focus (GtkWidget *new_window)
{
const char *startup_id = NULL;
guint32 timestamp = 0;
gtk_widget_realize (new_window);
startup_id = g_getenv ("DESKTOP_STARTUP_ID");
if (startup_id != NULL) {
char *startup_id_str = g_strdup (startup_id);
char *ts;
ts = g_strrstr (startup_id_str, "_TIME");
if (ts != NULL) {
ts = ts + 5;
errno = 0;
timestamp = strtoul (ts, NULL, 0);
if ((errno == EINVAL) || (errno == ERANGE))
timestamp = 0;
}
g_free (startup_id_str);
}
if (timestamp == 0)
timestamp = gdk_x11_get_server_time (new_window->window);
gdk_x11_window_set_user_time (new_window->window, timestamp);
gtk_window_present (GTK_WINDOW (new_window));
}
static void
impl_gth_application_open_browser (PortableServer_Servant _servant,
const CORBA_char *uri,
CORBA_Environment *ev)
{
if (*uri == '\0')
uri = NULL;
show_grabbing_focus (gth_browser_new (uri));
}
static void
impl_gth_application_open_viewer (PortableServer_Servant _servant,
const CORBA_char *uri,
CORBA_Environment *ev)
{
if (*uri == '\0')
uri = NULL;
show_grabbing_focus (gth_viewer_new (uri));
}
static void
impl_gth_application_load_image (PortableServer_Servant _servant,
const CORBA_char *uri,
CORBA_Environment *ev)
{
if (*uri == '\0')
uri = NULL;
if (UseViewer) {
GtkWidget *viewer = gth_viewer_get_current_viewer ();
if (viewer == NULL)
show_grabbing_focus (gth_viewer_new (uri));
else {
gth_viewer_load (GTH_VIEWER (viewer), uri);
show_grabbing_focus (viewer);
}
} else {
GtkWidget *browser = gth_browser_get_current_browser ();
if (browser == NULL)
show_grabbing_focus (gth_browser_new (uri));
else {
gth_browser_load_uri (GTH_BROWSER (browser), uri);
show_grabbing_focus (browser);
}
}
}
static void
impl_gth_application_import_photos (PortableServer_Servant _servant,
CORBA_Environment *ev)
{
gth_browser_activate_action_file_camera_import (NULL, NULL);
}
static void
gth_application_class_init (GthApplicationClass *klass)
{
POA_GNOME_GThumb_Application__epv *epv = &klass->epv;
epv->open_browser = impl_gth_application_open_browser;
epv->open_viewer = impl_gth_application_open_viewer;
epv->load_image = impl_gth_application_load_image;
epv->import_photos = impl_gth_application_import_photos;
}
static void
gth_application_init (GthApplication *c)
{
}
BONOBO_TYPE_FUNC_FULL (
GthApplication,
GNOME_GThumb_Application,
BONOBO_TYPE_OBJECT,
gth_application);
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2005 Free Software Foundation, Inc.
*
* 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 Street #330, Boston, MA 02111-1307, USA.
*/
#ifndef GTH_APPLICATION_H
#define GTH_APPLICATION_H
#include <gtk/gtk.h>
#include <bonobo/bonobo-object.h>
#include "GNOME_GThumb.h"
#define GTH_TYPE_APPLICATION (gth_application_get_type ())
#define GTH_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_APPLICATION, GthApplication))
#define GTH_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_APPLICATION_TYPE, GthApplicationClass))
#define GTH_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_APPLICATION))
#define GTH_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_APPLICATION))
#define GTH_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTH_TYPE_APPLICATION, GthApplicationClass))
typedef struct _GthApplication GthApplication;
typedef struct _GthApplicationClass GthApplicationClass;
struct _GthApplication
{
BonoboObject __parent;
};
struct _GthApplicationClass
{
BonoboObjectClass __parent_class;
POA_GNOME_GThumb_Application__epv epv;
};
GType gth_application_get_type (void);
BonoboObject * gth_application_new (GdkScreen *screen);
#endif /* GTH_APPLICATION_H */
......@@ -27,6 +27,7 @@
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomevfs/gnome-vfs-init.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libbonobo.h>
#include "catalog.h"
#include "comments.h"
......@@ -34,6 +35,7 @@
#include "file-utils.h"
#include "gconf-utils.h"
#include "gtk-utils.h"
#include "gth-application.h"
#include "gth-browser.h"
#include "gth-browser-actions-callbacks.h"
#include "gth-dir-list.h"
......@@ -79,6 +81,7 @@ static gboolean view_single_image = FALSE;
static GdkPixbuf *icon_pixbuf[ICON_NAMES] = { 0 };
static GtkWidget *first_window = NULL;
static GnomeIconTheme *icon_theme = NULL;
static BonoboObject *gth_application = NULL;
struct poptOption options[] = {
{ "fullscreen", 'f', POPT_ARG_NONE, &StartInFullscreen, 0,
......@@ -491,6 +494,9 @@ initialize_data (poptContext pctx)
static void
release_data (void)
{
if (gth_application != NULL)
bonobo_object_unref (gth_application);
free_icon_pixbufs ();
g_object_unref (icon_theme);
......@@ -506,10 +512,20 @@ release_data (void)
static void
open_viewer_window (const char *uri)
open_viewer_window (const char *uri,
gboolean use_factory,
GNOME_GThumb_Application app,
CORBA_Environment *env)
{
GtkWidget *current_window;
if (use_factory) {
if (uri == NULL)
uri = "";
GNOME_GThumb_Application_open_viewer (app, uri, env);
return;
}
current_window = gth_viewer_new (uri);
gtk_widget_show (current_window);
if (first_window == NULL)
......@@ -519,10 +535,20 @@ open_viewer_window (const char *uri)
static void
open_browser_window (const char *uri,
gboolean show_window)
gboolean show_window,
gboolean use_factory,
GNOME_GThumb_Application app,
CORBA_Environment *env)
{
GtkWidget *current_window;
if (use_factory) {
if (uri == NULL)
uri = "";
GNOME_GThumb_Application_open_browser (app, uri, env);
return;
}
current_window = gth_browser_new (uri);
if (show_window)
gtk_widget_show (current_window);
......@@ -532,7 +558,9 @@ open_browser_window (const char *uri,
static void
load_session (void)
load_session (gboolean use_factory,
GNOME_GThumb_Application app,
CORBA_Environment *env)
{
int i, n;
......@@ -547,9 +575,9 @@ load_session (void)
location = gnome_config_get_string (key);
if (uri_scheme_is_file (location) && path_is_file (location))
open_viewer_window (location);
open_viewer_window (location, use_factory, app, env);
else
open_browser_window (location, TRUE);
open_browser_window (location, TRUE, use_factory, app, env);
g_free (location);
g_free (key);
......@@ -563,26 +591,48 @@ load_session (void)
static void
prepare_app (void)
{
CORBA_Object factory;
gboolean use_factory = FALSE;
CORBA_Environment env;
GNOME_GThumb_Application app;
int i;
factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_GThumb_Application_Factory",
Bonobo_ACTIVATION_FLAG_EXISTING_ONLY,
NULL, NULL);
if (factory != NULL) {
use_factory = TRUE;
CORBA_exception_init (&env);
app = bonobo_activation_activate_from_id ("OAFIID:GNOME_GThumb_Application", 0, NULL, &env);
}
if (session_is_restored ()) {
load_session ();
load_session (use_factory, app, &env);
return;
}
if (ImportPhotos) {
gth_browser_activate_action_file_camera_import (NULL, NULL);
if (use_factory)
GNOME_GThumb_Application_import_photos (app, &env);
else
gth_browser_activate_action_file_camera_import (NULL, NULL);
} else if (! view_comline_catalog
&& (n_dir_urls == 0)
&& (n_file_urls == 0)) {
open_browser_window (NULL, TRUE);
open_browser_window (NULL, TRUE, use_factory, app, &env);
} else if (view_single_image) {
if (UseViewer)
open_viewer_window (file_urls[0]);
else
open_browser_window (file_urls[0], TRUE);
if (use_factory && eel_gconf_get_boolean (PREF_SINGLE_WINDOW, FALSE))
GNOME_GThumb_Application_load_image (app, file_urls[0], &env);
else {
if (UseViewer)
open_viewer_window (file_urls[0], use_factory, app, &env);
else
open_browser_window (file_urls[0], TRUE, use_factory, app, &env);
}
} else if (view_comline_catalog) {
char *catalog_uri;
char *catalog_path;
......@@ -595,7 +645,7 @@ prepare_app (void)
catalog_path = get_catalog_full_path (catalog_name);
catalog_uri = g_strconcat ("catalog://", catalog_path, NULL);
open_browser_window (catalog_uri, TRUE);
open_browser_window (catalog_uri, TRUE, use_factory, app, &env);
g_free (catalog_name);
g_free (catalog_path);
......@@ -604,7 +654,7 @@ prepare_app (void)
for (i = 0; i < n_dir_urls; i++) {
/* Go to the specified directory. */
open_browser_window (dir_urls[i], TRUE);
open_browser_window (dir_urls[i], TRUE, use_factory, app, &env);
}
/* Free urls. */
......@@ -620,6 +670,16 @@ prepare_app (void)
g_free (dir_urls[i]);
g_free (dir_urls);
}