libgimpbase, libgimpwidgets, tools, app: Remove warnings

This patch fixes a few (mostly Windows-specific) warnings on build.
* Hides functions like gimp_get_foreign_window () and variables
like transient_set that aren't used in Windows.
* Changes hollow_g_shell_quote () to not return a const gchar *,
since the value it returns is actually not const.
* Cast update_interval to double to remove warning about mixing
enums and doubles in division.

(cherry picked from commit c8cf2219ce)
This commit is contained in:
Alx Sa 2025-09-07 18:41:13 +00:00 committed by Jehan
parent 6f9ad5adef
commit 2692ba9793
5 changed files with 20 additions and 6 deletions

View file

@ -1218,7 +1218,8 @@ gimp_dashboard_init (GimpDashboard *dashboard)
/* group meter */
if (group_info->has_meter)
{
GeglColor *color = gegl_color_new (NULL);
GeglColor *color = gegl_color_new (NULL);
gdouble interval = priv->update_interval;
meter = gimp_meter_new (priv->gimp, group_data->n_meter_values);
group_data->meter = GIMP_METER (meter);
@ -1226,7 +1227,7 @@ gimp_dashboard_init (GimpDashboard *dashboard)
g_dgettext (NULL, group_info->description),
NULL);
gimp_meter_set_history_resolution (GIMP_METER (meter),
priv->update_interval / 1000.0);
interval / 1000.0);
gimp_meter_set_history_duration (GIMP_METER (meter),
priv->history_duration / 1000.0);
gtk_box_pack_start (GTK_BOX (vbox2), meter, FALSE, FALSE, 0);
@ -4922,8 +4923,10 @@ gimp_dashboard_set_update_interval (GimpDashboard *dashboard,
if (group_data->meter)
{
gdouble interval = update_interval;
gimp_meter_set_history_resolution (group_data->meter,
update_interval / 1000.0);
interval / 1000.0);
}
}

View file

@ -922,6 +922,8 @@ gimp_window_set_hint (GtkWindow *window,
}
/* similar to what we have in libgimp/gimpui.c */
/* TODO: Restore when we use it on Windows */
#ifndef G_OS_WIN32
static GdkWindow *
gimp_get_foreign_window (gpointer window)
{
@ -938,6 +940,7 @@ gimp_get_foreign_window (gpointer window)
return NULL;
}
#endif
void
gimp_window_set_transient_for (GtkWindow *window,
@ -2592,7 +2595,9 @@ gimp_window_set_transient_cb (GtkWidget *window,
GdkEventAny *event G_GNUC_UNUSED,
GBytes *handle)
{
#ifndef G_OS_WIN32
gboolean transient_set = FALSE;
#endif
g_return_if_fail (handle != NULL);

View file

@ -77,11 +77,13 @@
* Utilities of general interest
**/
#ifndef G_OS_WIN32
static gboolean gimp_utils_generic_available (const gchar *program,
gint major,
gint minor);
static gboolean gimp_utils_gdb_available (gint major,
gint minor);
#endif
/**
* gimp_utf8_strtrim:
@ -1714,12 +1716,12 @@ gimp_bind_text_domain (const gchar *domain_name,
/* Private functions. */
#ifndef G_OS_WIN32
static gboolean
gimp_utils_generic_available (const gchar *program,
gint major,
gint minor)
{
#ifndef G_OS_WIN32
pid_t pid;
int out_fd[2];
@ -1824,15 +1826,17 @@ gimp_utils_generic_available (const gchar *program,
(installed_major > major ||
(installed_major == major && installed_minor >= minor)));
}
#endif
/* Fork failed, or Win32. */
return FALSE;
}
#endif
#ifndef G_OS_WIN32
static gboolean
gimp_utils_gdb_available (gint major,
gint minor)
{
return gimp_utils_generic_available ("gdb", major, minor);
}
#endif

View file

@ -544,6 +544,7 @@ gimp_widget_track_monitor (GtkWidget *widget,
track_monitor_hierarchy_changed (widget, NULL, track_data);
}
#ifndef G_OS_WIN32
static gint
monitor_number (GdkMonitor *monitor)
{
@ -557,6 +558,7 @@ monitor_number (GdkMonitor *monitor)
return 0;
}
#endif
/**
* gimp_monitor_get_color_profile:

View file

@ -117,7 +117,7 @@ win32_command (const gchar *command)
}
/* Windows shells break with auto-quote. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/6378 */
static const gchar *
static gchar *
hollow_g_shell_quote (const gchar *input)
{
return g_strdup (input);