gimp r27629 - in trunk: . libgimpmodule modules



Author: neo
Date: Wed Nov 12 11:19:31 2008
New Revision: 27629
URL: http://svn.gnome.org/viewvc/gimp?rev=27629&view=rev

Log:
2008-11-12  Sven Neumann  <sven gimp org>

	* libgimpmodule/gimpmodule.[ch]: added GIMP_MODULE_ERROR domain.

	* modules/gimpinputdevicestore-hal.c
	* modules/gimpinputdevicestore-dx.c
	* modules/controller-dx-dinput.c: use GIMP_MODULE_ERROR as error
	domain instead of 0.



Modified:
   trunk/ChangeLog
   trunk/libgimpmodule/gimpmodule.c
   trunk/libgimpmodule/gimpmodule.h
   trunk/modules/controller-dx-dinput.c
   trunk/modules/gimpinputdevicestore-dx.c
   trunk/modules/gimpinputdevicestore-hal.c

Modified: trunk/libgimpmodule/gimpmodule.c
==============================================================================
--- trunk/libgimpmodule/gimpmodule.c	(original)
+++ trunk/libgimpmodule/gimpmodule.c	Wed Nov 12 11:19:31 2008
@@ -402,6 +402,21 @@
   return g_type_module_register_enum (module, name, const_static_values);
 }
 
+/**
+ * gimp_module_error_quark:
+ *
+ * This function is never called directly. Use GIMP_MODULE_ERROR() instead.
+ *
+ * Return value: the #GQuark that defines the GIMP module error domain.
+ *
+ * Since: GIMP 2.8
+ **/
+GQuark
+gimp_module_error_quark (void)
+{
+  return g_quark_from_static_string ("gimp-module-error-quark");
+}
+
 
 /*  private functions  */
 

Modified: trunk/libgimpmodule/gimpmodule.h
==============================================================================
--- trunk/libgimpmodule/gimpmodule.h	(original)
+++ trunk/libgimpmodule/gimpmodule.h	Wed Nov 12 11:19:31 2008
@@ -57,6 +57,16 @@
 } GimpModuleState;
 
 
+#define GIMP_MODULE_ERROR (gimp_module_error_quark ())
+
+GQuark  gimp_module_error_quark (void) G_GNUC_CONST;
+
+typedef enum
+{
+  GIMP_MODULE_FAILED             /* generic error condition */
+} GimpModuleError;
+
+
 struct _GimpModuleInfo
 {
   guint32  abi_version;

Modified: trunk/modules/controller-dx-dinput.c
==============================================================================
--- trunk/modules/controller-dx-dinput.c	(original)
+++ trunk/modules/controller-dx-dinput.c	Wed Nov 12 11:19:31 2008
@@ -550,7 +550,7 @@
                                                           DIDFT_RELAXIS|
                                                           DIDFT_TGLBUTTON))))
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "IDirectInputDevice8::EnumObjects failed: %s",
                    g_win32_error_message (hresult));
       return FALSE;
@@ -590,7 +590,7 @@
       g_free (controller->event_names);
       g_free (controller->event_blurbs);
 
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "IDirectInputDevice8::EnumObjects failed: %s",
                    g_win32_error_message (hresult));
       return FALSE;
@@ -916,7 +916,7 @@
 
   if ((controller->event = CreateEvent (NULL, TRUE, FALSE, NULL)) == NULL)
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "CreateEvent failed: %s",
                    g_win32_error_message (GetLastError ()));
       return FALSE;
@@ -936,7 +936,7 @@
                                                           DIPROP_AXISMODE,
                                                           &dword.diph))))
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "IDirectInputDevice8::GetParameters failed: %s",
                    g_win32_error_message (hresult));
       goto fail0;
@@ -1007,7 +1007,7 @@
   if (FAILED ((hresult = IDirectInputDevice8_SetDataFormat (controller->didevice8,
                                                             controller->format))))
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "IDirectInputDevice8::SetDataFormat failed: %s",
                    g_win32_error_message (hresult));
       goto fail1;
@@ -1016,7 +1016,7 @@
   if (FAILED ((hresult = IDirectInputDevice8_SetEventNotification (controller->didevice8,
                                                                    controller->event))))
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "IDirectInputDevice8::SetEventNotification failed: %s",
                    g_win32_error_message (hresult));
       goto fail2;
@@ -1024,7 +1024,7 @@
 
   if (FAILED ((hresult = IDirectInputDevice8_Acquire (controller->didevice8))))
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "IDirectInputDevice8::Acquire failed: %s",
                    g_win32_error_message (hresult));
       goto fail2;
@@ -1034,7 +1034,7 @@
                                                              controller->format->dwDataSize,
                                                              controller->prevdata))))
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
                    "IDirectInputDevice8::GetDeviceState failed: %s",
                    g_win32_error_message (hresult));
       goto fail2;

Modified: trunk/modules/gimpinputdevicestore-dx.c
==============================================================================
--- trunk/modules/gimpinputdevicestore-dx.c	(original)
+++ trunk/modules/gimpinputdevicestore-dx.c	Wed Nov 12 11:19:31 2008
@@ -40,6 +40,8 @@
 
 #include <gdk/gdkwin32.h>
 
+#include "libgimpmodule/gimpmodule.h"
+
 #include "gimpinputdevicestore.h"
 
 
@@ -210,19 +212,22 @@
 
   if ((store->window = create_aux_window (store)) == NULL)
     {
-      g_set_error (&store->error, 0, 0, "Could not create aux window");
+      g_set_error_literal (&store->error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
+			   "Could not create aux window");
       return;
     }
 
   if ((dinput8 = LoadLibrary ("dinput8.dll")) == NULL)
     {
-      g_set_error (&store->error, 0, 0, "Could not load dinput8.dll");
+      g_set_error_literal (&store->error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
+			   "Could not load dinput8.dll");
       return;
     }
 
   if ((p_DirectInput8Create = (t_DirectInput8Create) GetProcAddress (dinput8, "DirectInput8Create")) == NULL)
     {
-      g_set_error (&store->error, 0, 0, "Could not find DirectInput8Create in dinput8.dll");
+      g_set_error_literal (&store->error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
+			   "Could not find DirectInput8Create in dinput8.dll");
       return;
     }
 
@@ -232,7 +237,9 @@
                                                   (LPVOID *) &store->directinput8,
                                                   NULL))))
     {
-      g_set_error (&store->error, 0, 0, "DirectInput8Create failed: %s", g_win32_error_message (hresult));
+      g_set_error (&store->error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
+		   "DirectInput8Create failed: %s",
+		   g_win32_error_message (hresult));
       return;
     }
 
@@ -242,7 +249,9 @@
                                                     store,
                                                     DIEDFL_ATTACHEDONLY))))
     {
-      g_set_error (&store->error, 0, 0, "IDirectInput8::EnumDevices failed: %s", g_win32_error_message (hresult));
+      g_set_error (&store->error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
+		   "IDirectInput8::EnumDevices failed: %s",
+		   g_win32_error_message (hresult));
       return;
     }
 }

Modified: trunk/modules/gimpinputdevicestore-hal.c
==============================================================================
--- trunk/modules/gimpinputdevicestore-hal.c	(original)
+++ trunk/modules/gimpinputdevicestore-hal.c	Wed Nov 12 11:19:31 2008
@@ -28,6 +28,8 @@
 
 #include "gimpinputdevicestore.h"
 
+#include "libgimpmodule/gimpmodule.h"
+
 
 #ifdef HAVE_LIBHAL
 
@@ -35,7 +37,6 @@
 #include <dbus/dbus-glib-lowlevel.h>
 #include <hal/libhal.h>
 
-
 enum
 {
   COLUMN_UDI,
@@ -189,7 +190,9 @@
         }
       else
         {
-          g_set_error (&store->error, 0, 0, "Unable to connect to hald");
+          g_set_error_literal (&store->error,
+			       GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
+			       "Unable to connect to hald");
         }
 
       libhal_ctx_free (store->context);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]