gimp r26119 - in trunk: . app/gui
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26119 - in trunk: . app/gui
- Date: Fri, 11 Jul 2008 09:40:09 +0000 (UTC)
Author: neo
Date: Fri Jul 11 09:40:09 2008
New Revision: 26119
URL: http://svn.gnome.org/viewvc/gimp?rev=26119&view=rev
Log:
2008-07-11 Sven Neumann <sven gimp org>
* app/gui/Makefile.am
* app/gui/gui-unique.[ch]: new files providing functionality to
ensure a unique GUI instance of GIMP. Code split out of gui.c.
* app/gui/gui.c: changed accordingly.
Added:
trunk/app/gui/gui-unique.c
trunk/app/gui/gui-unique.h
Modified:
trunk/ChangeLog
trunk/app/gui/Makefile.am
trunk/app/gui/gui.c
Modified: trunk/app/gui/Makefile.am
==============================================================================
--- trunk/app/gui/Makefile.am (original)
+++ trunk/app/gui/Makefile.am Fri Jul 11 09:40:09 2008
@@ -22,6 +22,8 @@
gui.h \
gui-message.c \
gui-message.h \
+ gui-unique.c \
+ gui-unique.h \
gui-vtable.c \
gui-vtable.h \
gui-types.h \
Added: trunk/app/gui/gui-unique.c
==============================================================================
--- (empty file)
+++ trunk/app/gui/gui-unique.c Fri Jul 11 09:40:09 2008
@@ -0,0 +1,118 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#if HAVE_DBUS_GLIB
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#endif
+
+#include "core/core-types.h"
+
+#include "core/gimp.h"
+
+#include "widgets/gimpdbusservice.h"
+
+#include "gui-unique.h"
+
+
+#if HAVE_DBUS_GLIB
+static void gui_dbus_service_init (Gimp *gimp);
+static void gui_dbus_service_exit (void);
+
+static DBusGConnection *dbus_connection = NULL;
+#endif
+
+#ifdef G_OS_WIN32
+static void gui_unique_win32_init (Gimp *gimp);
+#endif
+
+
+void
+gui_unique_init (Gimp *gimp)
+{
+#ifdef G_OS_WIN32
+ gui_unique_win32_init (gimp);
+#elif HAVE_DBUS_GLIB
+ gui_dbus_service_init (gimp);
+#endif
+}
+
+void
+gui_unique_exit (void)
+{
+#if HAVE_DBUS_GLIB
+ gui_dbus_service_exit ();
+#endif
+}
+
+
+#if HAVE_DBUS_GLIB
+
+static void
+gui_dbus_service_init (Gimp *gimp)
+{
+ GError *error = NULL;
+
+ g_return_if_fail (dbus_connection == NULL);
+
+ dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+
+ if (dbus_connection)
+ {
+ GObject *service = gimp_dbus_service_new (gimp);
+
+ dbus_bus_request_name (dbus_g_connection_get_connection (dbus_connection),
+ GIMP_DBUS_SERVICE_NAME, 0, NULL);
+
+ dbus_g_connection_register_g_object (dbus_connection,
+ GIMP_DBUS_SERVICE_PATH, service);
+ }
+ else
+ {
+ g_printerr ("%s\n", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+gui_dbus_service_exit (void)
+{
+ if (dbus_connection)
+ {
+ dbus_g_connection_unref (dbus_connection);
+ dbus_connection = NULL;
+ }
+}
+
+#endif /* HAVE_DBUS_GLIB */
+
+
+#ifdef G_OS_WIN32
+
+static void
+gui_unique_win32_init (Gimp *gimp)
+{
+
+}
+
+#endif /* G_OS_WIN32 */
Added: trunk/app/gui/gui-unique.h
==============================================================================
--- (empty file)
+++ trunk/app/gui/gui-unique.h Fri Jul 11 09:40:09 2008
@@ -0,0 +1,27 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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 __GUI_UNIQUE_H__
+#define __GUI_UNIQUE_H__
+
+
+void gui_unique_init (Gimp *gimp);
+void gui_unique_exit (void);
+
+
+#endif /* __GUI_UNIQUE_H__ */
Modified: trunk/app/gui/gui.c
==============================================================================
--- trunk/app/gui/gui.c (original)
+++ trunk/app/gui/gui.c Fri Jul 11 09:40:09 2008
@@ -22,12 +22,6 @@
#include <gtk/gtk.h>
-#if HAVE_DBUS_GLIB
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#endif
-
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimpwidgets/gimpwidgets-private.h"
@@ -57,7 +51,6 @@
#include "widgets/gimpclipboard.h"
#include "widgets/gimpcolorselectorpalette.h"
#include "widgets/gimpcontrollers.h"
-#include "widgets/gimpdbusservice.h"
#include "widgets/gimpdevices.h"
#include "widgets/gimpdevicestatus.h"
#include "widgets/gimpdialogfactory.h"
@@ -80,6 +73,7 @@
#include "color-history.h"
#include "gui.h"
+#include "gui-unique.h"
#include "gui-vtable.h"
#include "session.h"
#include "splash.h"
@@ -136,18 +130,11 @@
Gimp *gimp);
static void gui_display_remove (GimpContainer *displays);
-static void gui_dbus_service_init (Gimp *gimp);
-static void gui_dbus_service_exit (void);
-
/* private variables */
-static Gimp *the_gui_gimp = NULL;
-static GimpUIManager *image_ui_manager = NULL;
-
-#if HAVE_DBUS_GLIB
-static DBusGConnection *dbus_connection = NULL;
-#endif
+static Gimp *the_gui_gimp = NULL;
+static GimpUIManager *image_ui_manager = NULL;
/* public functions */
@@ -525,7 +512,7 @@
display = GIMP_DISPLAY (gimp_create_display (gimp,
NULL, GIMP_UNIT_PIXEL, 1.0));
- gui_dbus_service_init (gimp);
+ gui_unique_init (gimp);
if (gui_config->restore_session)
session_restore (gimp);
@@ -559,9 +546,7 @@
gimp->message_handler = GIMP_CONSOLE;
-#if HAVE_DBUS_GLIB
- gui_dbus_service_exit ();
-#endif
+ gui_unique_exit ();
if (gui_config->save_session_info)
session_save (gimp, FALSE);
@@ -761,43 +746,3 @@
if (gimp_container_is_empty (displays))
windows_show_toolbox ();
}
-
-static void
-gui_dbus_service_init (Gimp *gimp)
-{
-#if HAVE_DBUS_GLIB
- GError *error = NULL;
-
- g_return_if_fail (dbus_connection == NULL);
-
- dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-
- if (dbus_connection)
- {
- GObject *service = gimp_dbus_service_new (gimp);
-
- dbus_bus_request_name (dbus_g_connection_get_connection (dbus_connection),
- GIMP_DBUS_SERVICE_NAME, 0, NULL);
-
- dbus_g_connection_register_g_object (dbus_connection,
- GIMP_DBUS_SERVICE_PATH, service);
- }
- else
- {
- g_printerr ("%s\n", error->message);
- g_error_free (error);
- }
-#endif
-}
-
-static void
-gui_dbus_service_exit (void)
-{
-#if HAVE_DBUS_GLIB
- if (dbus_connection)
- {
- dbus_g_connection_unref (dbus_connection);
- dbus_connection = NULL;
- }
-#endif
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]