added GIMP_MODULE_ERROR domain.

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.


svn path=/trunk/; revision=27629
This commit is contained in:
Sven Neumann 2008-11-12 11:19:31 +00:00 committed by Sven Neumann
parent b37c8bcf0a
commit 7fa22ebf17
6 changed files with 61 additions and 15 deletions

View File

@ -1,3 +1,12 @@
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.
2008-11-12 Sven Neumann <sven@gimp.org>
* app/core/Makefile.am

View File

@ -402,6 +402,21 @@ gimp_module_register_enum (GTypeModule *module,
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 */

View File

@ -57,6 +57,16 @@ typedef enum
} 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;

View File

@ -550,7 +550,7 @@ dx_dinput_get_device_info (ControllerDXDInput *controller,
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 @@ dx_dinput_get_device_info (ControllerDXDInput *controller,
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 @@ dx_dinput_setup_events (ControllerDXDInput *controller,
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 @@ dx_dinput_setup_events (ControllerDXDInput *controller,
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 @@ dx_dinput_setup_events (ControllerDXDInput *controller,
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 @@ dx_dinput_setup_events (ControllerDXDInput *controller,
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 @@ dx_dinput_setup_events (ControllerDXDInput *controller,
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 @@ dx_dinput_setup_events (ControllerDXDInput *controller,
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;

View File

@ -40,6 +40,8 @@
#include <gdk/gdkwin32.h>
#include "libgimpmodule/gimpmodule.h"
#include "gimpinputdevicestore.h"
@ -210,19 +212,22 @@ gimp_input_device_store_init (GimpInputDeviceStore *store)
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 @@ gimp_input_device_store_init (GimpInputDeviceStore *store)
(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 @@ gimp_input_device_store_init (GimpInputDeviceStore *store)
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;
}
}

View File

@ -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 @@ gimp_input_device_store_init (GimpInputDeviceStore *store)
}
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);