moved some common code back to main.c

svn path=/trunk/; revision=26118
This commit is contained in:
Sven Neumann
2008-07-11 09:16:23 +00:00
parent 30cc37c5fe
commit 0cf63ba421
4 changed files with 22 additions and 30 deletions

View File

@ -41,6 +41,10 @@
#include <io.h> /* get_osfhandle */ #include <io.h> /* get_osfhandle */
#endif #endif
#ifndef GIMP_CONSOLE_COMPILATION
#include <gdk/gdk.h>
#endif
#include "libgimpbase/gimpbase.h" #include "libgimpbase/gimpbase.h"
#include "core/core-types.h" #include "core/core-types.h"
@ -370,11 +374,18 @@ main (int argc,
if (no_interface) if (no_interface)
new_instance = TRUE; new_instance = TRUE;
if (! new_instance) #ifndef GIMP_CONSOLE_COMPILATION
if (! new_instance && gimp_unique_open (filenames, as_new))
{ {
if (gimp_unique_open (filenames, as_new, be_verbose)) if (be_verbose)
g_print ("%s\n",
_("Another GIMP instance is already running."));
gdk_notify_startup_complete ();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#endif
abort_message = sanity_check (); abort_message = sanity_check ();
if (abort_message) if (abort_message)

View File

@ -28,40 +28,31 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifndef GIMP_CONSOLE_COMPILATION
#include <gdk/gdk.h>
#endif
#include "core/core-types.h" #include "core/core-types.h"
#include "file/file-utils.h" #include "file/file-utils.h"
#include "unique.h" #include "unique.h"
#include "gimp-intl.h"
#if HAVE_DBUS_GLIB #if HAVE_DBUS_GLIB
static gboolean gimp_unique_dbus_open (const gchar **filenames, static gboolean gimp_unique_dbus_open (const gchar **filenames,
gboolean as_new, gboolean as_new);
gboolean be_verbose);
#endif #endif
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
static gboolean gimp_unique_win32_open (const gchar **filenames, static gboolean gimp_unique_win32_open (const gchar **filenames,
gboolean as_new, gboolean as_new);
gboolean be_verbose);
#endif #endif
gboolean gboolean
gimp_unique_open (const gchar **filenames, gimp_unique_open (const gchar **filenames,
gboolean as_new, gboolean as_new)
gboolean be_verbose)
{ {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
return gimp_unique_win32_open (filenames, as_new, be_verbose); return gimp_unique_win32_open (filenames, as_new);
#elif HAVE_DBUS_GLIB #elif HAVE_DBUS_GLIB
return gimp_unique_dbus_open (filenames, as_new, be_verbose); return gimp_unique_dbus_open (filenames, as_new);
#else #else
return FALSE; return FALSE;
#endif #endif
@ -72,8 +63,7 @@ gimp_unique_open (const gchar **filenames,
static gboolean static gboolean
gimp_unique_dbus_open (const gchar **filenames, gimp_unique_dbus_open (const gchar **filenames,
gboolean as_new, gboolean as_new)
gboolean be_verbose)
{ {
#ifndef GIMP_CONSOLE_COMPILATION #ifndef GIMP_CONSOLE_COMPILATION
@ -160,12 +150,6 @@ gimp_unique_dbus_open (const gchar **filenames,
if (success) if (success)
{ {
if (be_verbose)
g_print ("%s\n",
_("Another GIMP instance is already running."));
gdk_notify_startup_complete ();
return TRUE; return TRUE;
} }
else if (! (error->domain == DBUS_GERROR && else if (! (error->domain == DBUS_GERROR &&
@ -188,8 +172,7 @@ gimp_unique_dbus_open (const gchar **filenames,
static gboolean static gboolean
gimp_unique_win32_open (const gchar **filenames, gimp_unique_win32_open (const gchar **filenames,
gboolean as_new, gboolean as_new)
gboolean be_verbose)
{ {
#ifndef GIMP_CONSOLE_COMPILATION #ifndef GIMP_CONSOLE_COMPILATION

View File

@ -21,8 +21,7 @@
gboolean gimp_unique_open (const gchar **filenames, gboolean gimp_unique_open (const gchar **filenames,
gboolean as_new, gboolean as_new);
gboolean be_verbose);
#endif /* __UNIQUE_H__ */ #endif /* __UNIQUE_H__ */

View File

@ -8,7 +8,6 @@ app/app.c
app/batch.c app/batch.c
app/main.c app/main.c
app/sanity.c app/sanity.c
app/unique.c
app/version.c app/version.c
app/actions/actions.c app/actions/actions.c