Eliminate warning: ‘gimp_unique_dbus_open’ defined but not used [-Wunused-function]

This commit is contained in:
lillolollo 2023-06-25 18:01:45 +00:00 committed by Jehan
parent 23a87ce4e3
commit 691ec70c0e

View file

@ -32,15 +32,16 @@
#include "unique.h"
#ifndef G_OS_WIN32
static gboolean gimp_unique_dbus_open (const gchar **filenames,
gboolean as_new);
#ifdef G_OS_WIN32
static gboolean gimp_unique_dbus_batch_run (const gchar *batch_interpreter,
const gchar **batch_commands);
#else
static gboolean gimp_unique_win32_open (const gchar **filenames,
gboolean as_new);
#endif
static gboolean gimp_unique_dbus_batch_run (const gchar *batch_interpreter,
const gchar **batch_commands);
gboolean
gimp_unique_open (const gchar **filenames,
@ -81,6 +82,73 @@ gimp_unique_batch_run (const gchar *batch_interpreter,
#endif
}
#ifdef G_OS_WIN32
static gboolean
gimp_unique_win32_open (const gchar **filenames,
gboolean as_new)
{
#ifndef GIMP_CONSOLE_COMPILATION
/* for the proxy window names */
#include "gui/gui-unique.h"
HWND window_handle = FindWindowW (GIMP_UNIQUE_WIN32_WINDOW_CLASS,
GIMP_UNIQUE_WIN32_WINDOW_NAME);
if (window_handle)
{
COPYDATASTRUCT copydata = { 0, };
if (filenames)
{
gchar *cwd = g_get_current_dir ();
gint i;
for (i = 0; filenames[i]; i++)
{
GFile *file;
file = g_file_new_for_commandline_arg_and_cwd (filenames[i], cwd);
if (file)
{
gchar *uri = g_file_get_uri (file);
copydata.lpData = uri;
copydata.cbData = strlen (uri) + 1; /* size in bytes */
copydata.dwData = (long) as_new;
SendMessage (window_handle,
WM_COPYDATA, (WPARAM) window_handle, (LPARAM) &copydata);
g_free (uri);
g_object_unref (file);
}
else
{
g_printerr ("conversion to uri failed for '%s'\n",
filenames[i]);
}
}
g_free (cwd);
}
else
{
SendMessage (window_handle,
WM_COPYDATA, (WPARAM) window_handle, (LPARAM) &copydata);
}
return TRUE;
}
#endif
return FALSE;
}
#else
static gboolean
gimp_unique_dbus_open (const gchar **filenames,
gboolean as_new)
@ -177,72 +245,6 @@ gimp_unique_dbus_open (const gchar **filenames,
return FALSE;
}
#ifdef G_OS_WIN32
static gboolean
gimp_unique_win32_open (const gchar **filenames,
gboolean as_new)
{
#ifndef GIMP_CONSOLE_COMPILATION
/* for the proxy window names */
#include "gui/gui-unique.h"
HWND window_handle = FindWindowW (GIMP_UNIQUE_WIN32_WINDOW_CLASS,
GIMP_UNIQUE_WIN32_WINDOW_NAME);
if (window_handle)
{
COPYDATASTRUCT copydata = { 0, };
if (filenames)
{
gchar *cwd = g_get_current_dir ();
gint i;
for (i = 0; filenames[i]; i++)
{
GFile *file;
file = g_file_new_for_commandline_arg_and_cwd (filenames[i], cwd);
if (file)
{
gchar *uri = g_file_get_uri (file);
copydata.lpData = uri;
copydata.cbData = strlen (uri) + 1; /* size in bytes */
copydata.dwData = (long) as_new;
SendMessage (window_handle,
WM_COPYDATA, (WPARAM) window_handle, (LPARAM) &copydata);
g_free (uri);
g_object_unref (file);
}
else
{
g_printerr ("conversion to uri failed for '%s'\n",
filenames[i]);
}
}
g_free (cwd);
}
else
{
SendMessage (window_handle,
WM_COPYDATA, (WPARAM) window_handle, (LPARAM) &copydata);
}
return TRUE;
}
#endif
return FALSE;
}
#endif /* G_OS_WIN32 */
static gboolean
gimp_unique_dbus_batch_run (const gchar *batch_interpreter,
@ -302,3 +304,4 @@ gimp_unique_dbus_batch_run (const gchar *batch_interpreter,
return FALSE;
}
#endif /* G_OS_WIN32 */