[gtk/source-static-name] Avoid copying static debug strings




commit 6ea8d8a8fde09eaa835b6029efdd1a956f857125
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 26 17:03:15 2021 -0400

    Avoid copying static debug strings
    
    The g_source_set_name calls were showing up as a
    major source of strdups in our profiles. Avoid that
    by using new GLib api when available.

 gdk/broadway/gdkdisplay-broadway.c          |  3 ++-
 gdk/gdk-private.h                           |  7 +++++++
 gdk/gdk.c                                   | 14 ++++++++++++++
 gdk/gdkframeclockidle.c                     |  8 ++++++--
 gdk/macos/gdkdisplaylinksource.c            |  2 +-
 gdk/macos/gdkmacosdrag.c                    |  3 ++-
 gdk/macos/gdkmacoseventsource.c             |  2 +-
 gdk/wayland/gdkdevice-wayland.c             |  6 ++++--
 gdk/win32/gdkdrag-win32.c                   |  4 +++-
 gdk/win32/gdkevents-win32.c                 |  2 +-
 gdk/x11/gdkapplaunchcontext-x11.c           |  5 +++--
 gdk/x11/gdkasync.c                          |  5 +++--
 gdk/x11/gdkdrag-x11.c                       |  2 +-
 gtk/a11y/gtkatspiroot.c                     |  3 ++-
 gtk/gtkbutton.c                             |  2 +-
 gtk/gtkemojichooser.c                       |  2 +-
 gtk/gtkentrycompletion.c                    |  4 ++--
 gtk/gtkexpander.c                           |  2 +-
 gtk/gtkfilechooserwidget.c                  |  4 ++--
 gtk/gtkfilesystemmodel.c                    |  3 ++-
 gtk/gtkfilterlistmodel.c                    |  2 +-
 gtk/gtkgestureclick.c                       |  2 +-
 gtk/gtkgesturelongpress.c                   |  2 +-
 gtk/gtkicontheme.c                          |  2 +-
 gtk/gtkiconview.c                           |  4 ++--
 gtk/gtkmain.c                               |  2 +-
 gtk/gtkmenusectionbox.c                     |  3 ++-
 gtk/gtkmodelbutton.c                        |  3 ++-
 gtk/gtknotebook.c                           |  8 ++++----
 gtk/gtkpopover.c                            |  2 +-
 gtk/gtkprintoperation-win32.c               |  4 ++--
 gtk/gtkprintoperation.c                     |  6 +++---
 gtk/gtkprintunixdialog.c                    |  2 +-
 gtk/gtkrange.c                              |  4 ++--
 gtk/gtkrecentmanager.c                      |  2 +-
 gtk/gtkscrolledwindow.c                     |  8 ++++----
 gtk/gtksearchenginemodel.c                  |  2 +-
 gtk/gtksearchentry.c                        |  2 +-
 gtk/gtkspinbutton.c                         |  4 ++--
 gtk/gtkstackswitcher.c                      |  2 +-
 gtk/gtktext.c                               |  4 ++--
 gtk/gtktextlinedisplaycache.c               |  3 ++-
 gtk/gtktextview.c                           | 12 ++++++------
 gtk/gtktooltip.c                            |  5 +++--
 gtk/gtktreeexpander.c                       |  3 ++-
 gtk/gtktreeview.c                           | 20 ++++++++++----------
 gtk/gtkwindow.c                             |  4 ++--
 modules/printbackends/gtkprintbackendcups.c | 17 +++++++++--------
 48 files changed, 129 insertions(+), 88 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index a8ebb1dc88..59809ca3e4 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -33,6 +33,7 @@
 #include "gdkinternals.h"
 #include "gdkdeviceprivate.h"
 #include <gdk/gdktextureprivate.h>
+#include "gdk-private.h"
 
 #include <glib.h>
 #include <glib/gprintf.h>
@@ -463,7 +464,7 @@ gdk_broadway_display_flush_in_idle (GdkDisplay *display)
   if (broadway_display->idle_flush_id == 0)
     {
       broadway_display->idle_flush_id = g_idle_add (flush_idle, g_object_ref (display));
-      g_source_set_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
+      gdk_source_set_static_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
     }
 }
 
diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h
index fb3c18cd6f..3701d51198 100644
--- a/gdk/gdk-private.h
+++ b/gdk/gdk-private.h
@@ -57,4 +57,11 @@ guint gdk_parse_debug_var (const char        *variable,
 # define g_memdup2(mem,size)    g_memdup((mem),(size))
 #endif
 
+void gdk_source_set_static_name_by_id (guint       tag,
+                                       const char *name);
+
+#if !GLIB_CHECK_VERSION(2, 69, 1)
+#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
+#endif
+
 #endif /* __GDK__PRIVATE_H__ */
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 64823434da..2b1664af63 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -414,3 +414,17 @@ gdk_find_base_dir (const char *text,
   return dir;
 }
 
+void
+gdk_source_set_static_name_by_id (guint           tag,
+                                  const char     *name)
+{
+  GSource *source;
+
+  g_return_if_fail (tag > 0);
+
+  source = g_main_context_find_source_by_id (NULL, tag);
+  if (source == NULL)
+    return;
+
+  g_source_set_static_name (source, name);
+}
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index 4870a110a6..7c0ff5e4e0 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -29,6 +29,7 @@
 #include "gdkinternals.h"
 #include "gdkframeclockprivate.h"
 #include "gdk.h"
+#include "gdk-private.h"
 #include "gdkprofilerprivate.h"
 
 #ifdef G_OS_WIN32
@@ -307,12 +308,15 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
 
       if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
         {
+          GSource *source;
+
           priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
                                                     min_interval,
                                                     gdk_frame_clock_flush_idle,
                                                     g_object_ref (clock_idle),
                                                     (GDestroyNotify) g_object_unref);
-          g_source_set_name_by_id (priv->flush_idle_id, "[gtk] gdk_frame_clock_flush_idle");
+          source = g_main_context_find_source_by_id (NULL, priv->flush_idle_id);
+          g_source_set_static_name (source, "[gtk] gdk_frame_clock_flush_idle");
         }
 
       if (!priv->in_paint_idle &&
@@ -324,7 +328,7 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
                                                     gdk_frame_clock_paint_idle,
                                                     g_object_ref (clock_idle),
                                                     (GDestroyNotify) g_object_unref);
-          g_source_set_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
+          gdk_source_set_static_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
         }
     }
 }
diff --git a/gdk/macos/gdkdisplaylinksource.c b/gdk/macos/gdkdisplaylinksource.c
index d8c5707ff3..9587875dde 100644
--- a/gdk/macos/gdkdisplaylinksource.c
+++ b/gdk/macos/gdkdisplaylinksource.c
@@ -197,7 +197,7 @@ gdk_display_link_source_new (void)
                                   gdk_display_link_source_frame_cb,
                                   source);
 
-  g_source_set_name (source, "[gdk] quartz frame clock");
+  g_source_set_static_name (source, "[gdk] quartz frame clock");
 
   return source;
 }
diff --git a/gdk/macos/gdkmacosdrag.c b/gdk/macos/gdkmacosdrag.c
index 0eb246bd0b..24e57a5965 100644
--- a/gdk/macos/gdkmacosdrag.c
+++ b/gdk/macos/gdkmacosdrag.c
@@ -21,6 +21,7 @@
 
 #include "gdkdeviceprivate.h"
 #include "gdkintl.h"
+#include "gdk-private.h"
 
 #include "gdkmacosdevice-private.h"
 #include "gdkmacoscursor-private.h"
@@ -161,7 +162,7 @@ gdk_macos_drag_drop_done (GdkDrag  *drag,
                            gdk_macos_zoomback_timeout,
                            zb,
                            (GDestroyNotify) gdk_macos_zoomback_destroy);
-  g_source_set_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
+  gdk_source_set_static_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
   g_object_unref (drag);
 }
 
diff --git a/gdk/macos/gdkmacoseventsource.c b/gdk/macos/gdkmacoseventsource.c
index 02c981fe14..8bf1574024 100644
--- a/gdk/macos/gdkmacoseventsource.c
+++ b/gdk/macos/gdkmacoseventsource.c
@@ -1063,7 +1063,7 @@ _gdk_macos_event_source_new (GdkMacosDisplay *display)
   event_poll_fd.fd = -1;
 
   source = g_source_new (&event_funcs, sizeof (GdkMacosEventSource));
-  g_source_set_name (source, "GDK Quartz event source");
+  g_source_set_static_name (source, "GDK Quartz event source");
   g_source_add_poll (source, &event_poll_fd);
   g_source_set_priority (source, GDK_PRIORITY_EVENTS);
   g_source_set_can_recurse (source, TRUE);
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 1ee83984da..2371fc0e84 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -460,6 +460,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
           pointer->cursor_timeout_id == 0)
         {
           guint id;
+          GSource *source;
 
           gdk_wayland_pointer_stop_cursor_animation (pointer);
 
@@ -467,7 +468,8 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
           id = g_timeout_add (next_image_delay,
                               (GSourceFunc) gdk_wayland_device_update_surface_cursor,
                               device);
-          g_source_set_name_by_id (id, "[gtk] gdk_wayland_device_update_surface_cursor");
+          source = g_main_context_find_source_by_id (NULL, id);
+          g_source_set_static_name (source, "[gtk] gdk_wayland_device_update_surface_cursor");
           pointer->cursor_timeout_id = id;
         }
       else
@@ -2218,7 +2220,7 @@ deliver_key_event (GdkWaylandSeat *seat,
   timeout = (seat->repeat_deadline - now) / 1000L;
 
   seat->repeat_timer = g_timeout_add (timeout, keyboard_repeat, seat);
-  g_source_set_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
+  gdk_source_set_static_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
 }
 
 static void
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index 1b92e85efa..36770735a6 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -27,6 +27,8 @@
 #include "config.h"
 #include <string.h>
 
+#include "gdk-private.h"
+
 #include <io.h>
 #include <fcntl.h>
 #include <math.h>
@@ -2196,7 +2198,7 @@ gdk_win32_drag_drop_done (GdkDrag  *drag,
   id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
                            gdk_drag_anim_timeout, anim,
                            (GDestroyNotify) gdk_drag_anim_destroy);
-  g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
+  gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
 }
 
 static gboolean
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 808354c4ae..8c6ad242a3 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -502,7 +502,7 @@ _gdk_events_init (GdkDisplay *display)
 #endif
 
   source = g_source_new (&event_funcs, sizeof (GdkWin32EventSource));
-  g_source_set_name (source, "GDK Win32 event source");
+  g_source_set_static_name (source, "GDK Win32 event source");
   g_source_set_priority (source, GDK_PRIORITY_EVENTS);
 
   event_source = (GdkWin32EventSource *)source;
diff --git a/gdk/x11/gdkapplaunchcontext-x11.c b/gdk/x11/gdkapplaunchcontext-x11.c
index b2cd99019b..c21c478ec5 100644
--- a/gdk/x11/gdkapplaunchcontext-x11.c
+++ b/gdk/x11/gdkapplaunchcontext-x11.c
@@ -25,6 +25,7 @@
 #include "gdkintl.h"
 #include "gdkprivate-x11.h"
 #include "gdkdisplay-x11.h"
+#include "gdk-private.h"
 
 #include <glib.h>
 #ifdef HAVE_DESKTOPAPPINFO
@@ -219,7 +220,7 @@ startup_timeout (void *data)
     std->timeout_id = 0;
   else {
     std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
-    g_source_set_name_by_id (std->timeout_id, "[gtk] startup_timeout");
+    gdk_source_set_static_name_by_id (std->timeout_id, "[gtk] startup_timeout");
   }
 
   /* always remove this one, but we may have reinstalled another one. */
@@ -256,7 +257,7 @@ add_startup_timeout (GdkX11Screen *screen,
   if (data->timeout_id == 0) {
     data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
                                               startup_timeout, data);
-    g_source_set_name_by_id (data->timeout_id, "[gtk] startup_timeout");
+    gdk_source_set_static_name_by_id (data->timeout_id, "[gtk] startup_timeout");
   }
 }
 
diff --git a/gdk/x11/gdkasync.c b/gdk/x11/gdkasync.c
index 04433821de..6f28074a95 100644
--- a/gdk/x11/gdkasync.c
+++ b/gdk/x11/gdkasync.c
@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
 #include "gdkasync.h"
 #include "gdkprivate-x11.h"
 #include "gdkdisplay-x11.h"
+#include "gdk-private.h"
 
 #include <X11/Xlibint.h>
 
@@ -171,7 +172,7 @@ send_event_handler (Display *dpy,
         {
           guint id;
           id = g_idle_add (callback_idle, state);
-          g_source_set_name_by_id (id, "[gtk] callback_idle");
+          gdk_source_set_static_name_by_id (id, "[gtk] callback_idle");
         }
 
       DeqAsyncHandler(state->dpy, &state->async);
@@ -707,7 +708,7 @@ roundtrip_handler (Display *dpy,
         {
           guint id;
           id = g_idle_add (roundtrip_callback_idle, state);
-          g_source_set_name_by_id (id, "[gtk] roundtrip_callback_idle");
+          gdk_source_set_static_name_by_id (id, "[gtk] roundtrip_callback_idle");
         }
 
       DeqAsyncHandler(state->dpy, &state->async);
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index f4b752306e..1bd75b37cb 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -1864,7 +1864,7 @@ gdk_x11_drag_drop_done (GdkDrag  *drag,
   id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
                            gdk_drag_anim_timeout, anim,
                            (GDestroyNotify) gdk_drag_anim_destroy);
-  g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
+  gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
   g_object_unref (drag);
 }
 
diff --git a/gtk/a11y/gtkatspiroot.c b/gtk/a11y/gtkatspiroot.c
index 5962361433..c25ddd5717 100644
--- a/gtk/a11y/gtkatspiroot.c
+++ b/gtk/a11y/gtkatspiroot.c
@@ -30,6 +30,7 @@
 
 #include "gtkdebug.h"
 #include "gtkwindow.h"
+#include "gtkprivate.h"
 
 #include "a11y/atspi/atspi-accessible.h"
 #include "a11y/atspi/atspi-application.h"
@@ -612,7 +613,7 @@ gtk_at_spi_root_queue_register (GtkAtSpiRoot    *self,
     return;
 
   self->register_id = g_idle_add (root_register, self);
-  g_source_set_name_by_id (self->register_id, "[gtk] ATSPI root registration");
+  gdk_source_set_static_name_by_id (self->register_id, "[gtk] ATSPI root registration");
 }
 
 void
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 2638539d7f..49f0681767 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -791,7 +791,7 @@ gtk_real_button_activate (GtkButton *button)
   if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
     {
       priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
-      g_source_set_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
+      gdk_source_set_static_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
 
       gtk_widget_add_css_class (GTK_WIDGET (button), "keyboard-activating");
       priv->button_down = TRUE;
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 86d6572c8f..810072c146 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -1016,7 +1016,7 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
   populate_recent_section (chooser);
 
   chooser->populate_idle = g_idle_add (populate_emoji_chooser, chooser);
-  g_source_set_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
+  gdk_source_set_static_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
 }
 
 static void
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index ff3c41dee8..408047adf0 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -1982,7 +1982,7 @@ gtk_entry_completion_changed (GtkWidget *widget,
     g_timeout_add (COMPLETION_TIMEOUT,
                    gtk_entry_completion_timeout,
                    completion);
-  g_source_set_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
+  gdk_source_set_static_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
 }
 
 static gboolean
@@ -2048,7 +2048,7 @@ completion_inserted_text_callback (GtkEntryBuffer     *buffer,
                             g_cclosure_new_object (G_CALLBACK (check_completion_callback),
                                                    G_OBJECT (completion)));
       g_source_attach (completion->check_completion_idle, NULL);
-      g_source_set_name (completion->check_completion_idle, "[gtk] check_completion_callback");
+      g_source_set_static_name (completion->check_completion_idle, "[gtk] check_completion_callback");
     }
 }
 
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index e3c5203abe..00b9a52e38 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -244,7 +244,7 @@ gtk_expander_drag_enter (GtkDropControllerMotion *motion,
   if (!expander->expanded && !expander->expand_timer)
     {
       expander->expand_timer = g_timeout_add (TIMEOUT_EXPAND, (GSourceFunc) expand_timeout, expander);
-      g_source_set_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
+      gdk_source_set_static_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
     }
 }
 
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index f2fe1f9257..47252e4947 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -2234,7 +2234,7 @@ location_entry_changed_cb (GtkEditable          *editable,
       impl->location_changed_id = g_timeout_add (LOCATION_CHANGED_TIMEOUT,
                                                 location_changed_timeout_cb,
                                                 impl);
-      g_source_set_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
+      gdk_source_set_static_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
     }
 }
 
@@ -3822,7 +3822,7 @@ load_setup_timer (GtkFileChooserWidget *impl)
   g_assert (impl->load_state != LOAD_PRELOAD);
 
   impl->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
-  g_source_set_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
+  gdk_source_set_static_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
   impl->load_state = LOAD_PRELOAD;
 }
 
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index dc1be31795..d27cd6c8f5 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -30,6 +30,7 @@
 #include "gtktreednd.h"
 #include "gtktreemodel.h"
 #include "gtkfilter.h"
+#include "gtkprivate.h"
 
 /*** Structure: how GtkFileSystemModel works
  *
@@ -1095,7 +1096,7 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da
                                                        thaw_func,
                                                        model,
                                                        NULL);
-          g_source_set_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
+          gdk_source_set_static_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
         }
 
       for (walk = files; walk; walk = walk->next)
diff --git a/gtk/gtkfilterlistmodel.c b/gtk/gtkfilterlistmodel.c
index 06498b31bd..1c03dfb617 100644
--- a/gtk/gtkfilterlistmodel.c
+++ b/gtk/gtkfilterlistmodel.c
@@ -267,7 +267,7 @@ gtk_filter_list_model_start_filtering (GtkFilterListModel *self,
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PENDING]);
   g_assert (self->pending_cb == 0);
   self->pending_cb = g_idle_add (gtk_filter_list_model_run_filter_cb, self);
-  g_source_set_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
+  gdk_source_set_static_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
 }
 
 static void
diff --git a/gtk/gtkgestureclick.c b/gtk/gtkgestureclick.c
index 67f1cd071b..30629eec33 100644
--- a/gtk/gtkgestureclick.c
+++ b/gtk/gtkgestureclick.c
@@ -146,7 +146,7 @@ _gtk_gesture_click_update_timeout (GtkGestureClick *gesture)
   g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL);
 
   priv->double_click_timeout_id = g_timeout_add (double_click_time, _double_click_timeout_cb, gesture);
-  g_source_set_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
+  gdk_source_set_static_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
 }
 
 static gboolean
diff --git a/gtk/gtkgesturelongpress.c b/gtk/gtkgesturelongpress.c
index 93feb98f0a..ffd36ca3eb 100644
--- a/gtk/gtkgesturelongpress.c
+++ b/gtk/gtkgesturelongpress.c
@@ -150,7 +150,7 @@ gtk_gesture_long_press_begin (GtkGesture       *gesture,
   gtk_gesture_get_point (gesture, sequence,
                          &priv->initial_x, &priv->initial_y);
   priv->timeout_id = g_timeout_add (delay, _gtk_gesture_long_press_timeout, gesture);
-  g_source_set_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
+  gdk_source_set_static_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
 }
 
 static void
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 785466f1d2..52a57bd69f 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -1342,7 +1342,7 @@ queue_theme_changed (GtkIconTheme *self)
                                                   theme_changed_idle__mainthread_unlocked,
                                                   gtk_icon_theme_ref_ref (self->ref),
                                                   (GDestroyNotify)gtk_icon_theme_ref_unref);
-      g_source_set_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
+      gdk_source_set_static_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
     }
 }
 
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 57a7732993..e382d77431 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1831,7 +1831,7 @@ gtk_icon_view_motion (GtkEventController *controller,
 
          if (icon_view->priv->scroll_timeout_id == 0) {
            icon_view->priv->scroll_timeout_id = g_timeout_add (30, rubberband_scroll_timeout, icon_view);
-           g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] rubberband_scroll_timeout");
+           gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] 
rubberband_scroll_timeout");
          }
        }
       else
@@ -6065,7 +6065,7 @@ gtk_icon_view_drag_motion (GtkDropTargetAsync *dest,
       if (icon_view->priv->scroll_timeout_id == 0)
        {
          icon_view->priv->scroll_timeout_id = g_timeout_add (50, drag_scroll_timeout, icon_view);
-         g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
+         gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
        }
 
       if (target == GTK_TYPE_TREE_ROW_DATA)
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 9a7b36eb05..e498822212 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -868,7 +868,7 @@ gtk_main_sync (void)
 
   store.store_loop = g_main_loop_new (NULL, TRUE);
   store.timeout_id = g_timeout_add_seconds (10, (GSourceFunc) sync_timed_out_cb, &store);
-  g_source_set_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
+  gdk_source_set_static_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
 
   if (g_main_loop_is_running (store.store_loop))
     g_main_loop_run (store.store_loop);
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
index 5033c13016..89f01d3d6a 100644
--- a/gtk/gtkmenusectionbox.c
+++ b/gtk/gtkmenusectionbox.c
@@ -34,6 +34,7 @@
 #include "gtkbuiltiniconprivate.h"
 #include "gtkgizmoprivate.h"
 #include "gtkbinlayout.h"
+#include "gtkprivate.h"
 
 typedef GtkBoxClass GtkMenuSectionBoxClass;
 
@@ -175,7 +176,7 @@ gtk_menu_section_box_schedule_separator_sync (GtkMenuSectionBox *box)
       box->separator_sync_idle = g_idle_add_full (G_PRIORITY_HIGH_IDLE, /* before resize... */
                                                   gtk_menu_section_box_handle_sync_separators,
                                                   box, NULL);
-      g_source_set_name_by_id (box->separator_sync_idle, "[gtk] menu section box handle sync separators");
+      gdk_source_set_static_name_by_id (box->separator_sync_idle, "[gtk] menu section box handle sync 
separators");
     }
 }
 
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index b3bfd0b05c..bde7e31c1b 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -46,6 +46,7 @@
 #include "gtkshortcutcontroller.h"
 #include "gtkshortcut.h"
 #include "gtkaccessibleprivate.h"
+#include "gtkprivate.h"
 
 /*< private >
  * GtkModelButton:
@@ -1363,7 +1364,7 @@ start_open (GtkModelButton *button)
     return;
 
   button->open_timeout = g_timeout_add (OPEN_TIMEOUT, open_submenu, button);
-  g_source_set_name_by_id (button->open_timeout, "[gtk] open_submenu");
+  gdk_source_set_static_name_by_id (button->open_timeout, "[gtk] open_submenu");
 }
 
 static void
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 76115f09c6..1ad109f4fe 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -3052,7 +3052,7 @@ gtk_notebook_motion (GtkEventController *controller,
               notebook->dnd_timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                                scroll_notebook_timer,
                                                notebook);
-              g_source_set_name_by_id (notebook->dnd_timer, "[gtk] scroll_notebook_timer");
+              gdk_source_set_static_name_by_id (notebook->dnd_timer, "[gtk] scroll_notebook_timer");
             }
         }
       else
@@ -4018,7 +4018,7 @@ gtk_notebook_tab_drop_enter (GtkEventController *controller,
   notebook->switch_page = page;
 
   notebook->switch_page_timer = g_timeout_add (TIMEOUT_EXPAND, gtk_notebook_switch_page_timeout, notebook);
-  g_source_set_name_by_id (notebook->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
+  gdk_source_set_static_name_by_id (notebook->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
 }
 
 static void
@@ -4189,7 +4189,7 @@ gtk_notebook_timer (GtkNotebook *notebook)
           notebook->timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                        (GSourceFunc) gtk_notebook_timer,
                                        notebook);
-          g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
+          gdk_source_set_static_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
         }
       else
         retval = TRUE;
@@ -4206,7 +4206,7 @@ gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
       notebook->timer = g_timeout_add (TIMEOUT_INITIAL,
                                    (GSourceFunc) gtk_notebook_timer,
                                    notebook);
-      g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
+      gdk_source_set_static_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
       notebook->need_timer = TRUE;
     }
 }
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index df3cda3bb6..4a6bd4074e 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -715,7 +715,7 @@ gtk_popover_schedule_mnemonics_visible (GtkPopover *popover)
 
   priv->mnemonics_display_timeout_id =
     g_timeout_add (MNEMONICS_DELAY, schedule_mnemonics_visible_cb, popover);
-  g_source_set_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] 
popover_schedule_mnemonics_visible_cb");
+  gdk_source_set_static_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] 
popover_schedule_mnemonics_visible_cb");
 }
 
 static void
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index 8fb2ac6c07..43d63bb815 100644
--- a/gtk/gtkprintoperation-win32.c
+++ b/gtk/gtkprintoperation-win32.c
@@ -539,7 +539,7 @@ win32_poll_status_timeout (GtkPrintOperation *op)
     op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
                                          (GSourceFunc)win32_poll_status_timeout,
                                          op);
-    g_source_set_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
+    gdk_source_set_static_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
   }
   g_object_unref (op);
   return FALSE;
@@ -583,7 +583,7 @@ win32_end_run (GtkPrintOperation *op,
       op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
                                            (GSourceFunc)win32_poll_status_timeout,
                                            op);
-      g_source_set_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
+      gdk_source_set_static_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
     }
   else
     /* Dunno what happened, pretend its finished */
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index 817b65701f..7957d42485 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -631,7 +631,7 @@ preview_ready (GtkPrintOperationPreview *preview,
                         preview_print_idle,
                         pop,
                         preview_print_idle_done);
-  g_source_set_name_by_id (id, "[gtk] preview_print_idle");
+  gdk_source_set_static_name_by_id (id, "[gtk] preview_print_idle");
 }
 
 
@@ -2895,7 +2895,7 @@ print_pages (GtkPrintOperation       *op,
        g_timeout_add (SHOW_PROGRESS_TIME,
                        (GSourceFunc) show_progress_timeout,
                        data);
-      g_source_set_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout");
+      gdk_source_set_static_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout");
 
       data->progress = progress;
     }
@@ -2964,7 +2964,7 @@ print_pages (GtkPrintOperation       *op,
                                                print_pages_idle,
                                                data,
                                                print_pages_idle_done);
-  g_source_set_name_by_id (priv->print_pages_idle_id, "[gtk] print_pages_idle");
+  gdk_source_set_static_name_by_id (priv->print_pages_idle_id, "[gtk] print_pages_idle");
   
   /* Recursive main loop to make sure we don't exit  on sync operations  */
   if (priv->is_sync)
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index c0f8825a3f..6c1ff5c260 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -1803,7 +1803,7 @@ schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
     return;
 
   dialog->mark_conflicts_id = g_idle_add (mark_conflicts_callback, dialog);
-  g_source_set_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback");
+  gdk_source_set_static_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback");
 }
 
 static void
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 82d008f7a0..c3c270e6c3 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2758,7 +2758,7 @@ initial_timeout (gpointer data)
   GtkRangePrivate *priv = gtk_range_get_instance_private (range);
 
   priv->timer->timeout_id = g_timeout_add (TIMEOUT_REPEAT, second_timeout, range);
-  g_source_set_name_by_id (priv->timer->timeout_id, "[gtk] second_timeout");
+  gdk_source_set_static_name_by_id (priv->timer->timeout_id, "[gtk] second_timeout");
   return G_SOURCE_REMOVE;
 }
 
@@ -2774,7 +2774,7 @@ gtk_range_add_step_timer (GtkRange      *range,
   priv->timer = g_new (GtkRangeStepTimer, 1);
 
   priv->timer->timeout_id = g_timeout_add (TIMEOUT_INITIAL, initial_timeout, range);
-  g_source_set_name_by_id (priv->timer->timeout_id, "[gtk] initial_timeout");
+  gdk_source_set_static_name_by_id (priv->timer->timeout_id, "[gtk] initial_timeout");
   priv->timer->step = step;
 
   gtk_range_scroll (range, priv->timer->step);
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 55343f7c6f..2b84c03634 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -1388,7 +1388,7 @@ gtk_recent_manager_changed (GtkRecentManager *manager)
   if (manager->priv->changed_timeout == 0)
     {
       manager->priv->changed_timeout = g_timeout_add (250, emit_manager_changed, manager);
-      g_source_set_name_by_id (manager->priv->changed_timeout, "[gtk] emit_manager_changed");
+      gdk_source_set_static_name_by_id (manager->priv->changed_timeout, "[gtk] emit_manager_changed");
     }
   else
     {
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 2df696234c..372afe4a95 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1216,7 +1216,7 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
   else if (indicator_close && !on_other_scrollbar)
     {
       indicator->over_timeout_id = g_timeout_add (30, enable_over_timeout_cb, indicator);
-      g_source_set_name_by_id (indicator->over_timeout_id, "[gtk] enable_over_timeout_cb");
+      gdk_source_set_static_name_by_id (indicator->over_timeout_id, "[gtk] enable_over_timeout_cb");
     }
   else
     indicator_set_over (indicator, FALSE);
@@ -1412,8 +1412,8 @@ scrolled_window_scroll (GtkScrolledWindow        *scrolled_window,
     {
       priv->scroll_events_overshoot_id =
         g_timeout_add (50, start_scroll_deceleration_cb, scrolled_window);
-      g_source_set_name_by_id (priv->scroll_events_overshoot_id,
-                               "[gtk] start_scroll_deceleration_cb");
+      gdk_source_set_static_name_by_id (priv->scroll_events_overshoot_id,
+                                      "[gtk] start_scroll_deceleration_cb");
     }
 }
 
@@ -3638,7 +3638,7 @@ indicator_set_fade (Indicator *indicator,
   if (visible && indicator->conceil_timer == 0)
     {
       indicator->conceil_timer = g_timeout_add (INDICATOR_FADE_OUT_TIME, maybe_hide_indicator, indicator);
-      g_source_set_name_by_id (indicator->conceil_timer, "[gtk] maybe_hide_indicator");
+      gdk_source_set_static_name_by_id (indicator->conceil_timer, "[gtk] maybe_hide_indicator");
     }
   if (!visible && indicator->conceil_timer != 0)
     {
diff --git a/gtk/gtksearchenginemodel.c b/gtk/gtksearchenginemodel.c
index 0d8f69ae7a..af85e56c51 100644
--- a/gtk/gtksearchenginemodel.c
+++ b/gtk/gtksearchenginemodel.c
@@ -126,7 +126,7 @@ gtk_search_engine_model_start (GtkSearchEngine *engine)
     return;
 
   model->idle = g_idle_add (do_search, engine);
-  g_source_set_name_by_id (model->idle, "[gtk] gtk_search_engine_model_start");
+  gdk_source_set_static_name_by_id (model->idle, "[gtk] gtk_search_engine_model_start");
 }
 
 static void
diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c
index dd7ca5b170..6a9d3c8969 100644
--- a/gtk/gtksearchentry.c
+++ b/gtk/gtksearchentry.c
@@ -519,7 +519,7 @@ reset_timeout (GtkSearchEntry *entry)
   entry->delayed_changed_id = g_timeout_add (DELAYED_TIMEOUT_ID,
                                             gtk_search_entry_changed_timeout_cb,
                                             entry);
-  g_source_set_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
+  gdk_source_set_static_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
 }
 
 static void
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 4e70bc56d7..fb5ffbf310 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -906,7 +906,7 @@ start_spinning (GtkSpinButton *spin,
       spin->timer = g_timeout_add (TIMEOUT_INITIAL,
                                    (GSourceFunc) gtk_spin_button_timer,
                                    (gpointer) spin);
-      g_source_set_name_by_id (spin->timer, "[gtk] gtk_spin_button_timer");
+      gdk_source_set_static_name_by_id (spin->timer, "[gtk] gtk_spin_button_timer");
     }
   gtk_spin_button_real_spin (spin, click_child == spin->up_button ? step : -step);
 }
@@ -1318,7 +1318,7 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
           spin_button->timer = g_timeout_add (TIMEOUT_REPEAT,
                                        (GSourceFunc) gtk_spin_button_timer,
                                        spin_button);
-          g_source_set_name_by_id (spin_button->timer, "[gtk] gtk_spin_button_timer");
+          gdk_source_set_static_name_by_id (spin_button->timer, "[gtk] gtk_spin_button_timer");
         }
       else
         {
diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c
index ffbfff98c2..dfb584cece 100644
--- a/gtk/gtkstackswitcher.c
+++ b/gtk/gtkstackswitcher.c
@@ -245,7 +245,7 @@ gtk_stack_switcher_drag_enter (GtkDropControllerMotion *motion,
       guint switch_timer = g_timeout_add (TIMEOUT_EXPAND,
                                           gtk_stack_switcher_switch_timeout,
                                           button);
-      g_source_set_name_by_id (switch_timer, "[gtk] gtk_stack_switcher_switch_timeout");
+      gdk_source_set_static_name_by_id (switch_timer, "[gtk] gtk_stack_switcher_switch_timeout");
       g_object_set_data_full (G_OBJECT (button), "-gtk-switch-timer", GUINT_TO_POINTER (switch_timer), 
clear_timer);
     }
 }
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 8e051fe413..62f7c90e4c 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -3636,7 +3636,7 @@ buffer_inserted_text (GtkEntryBuffer *buffer,
           password_hint->source_id = g_timeout_add (password_hint_timeout,
                                                     (GSourceFunc)gtk_text_remove_password_hint,
                                                     self);
-          g_source_set_name_by_id (password_hint->source_id, "[gtk] gtk_text_remove_password_hint");
+          gdk_source_set_static_name_by_id (password_hint->source_id, "[gtk] gtk_text_remove_password_hint");
         }
     }
 }
@@ -6285,7 +6285,7 @@ gtk_text_selection_bubble_popup_set (GtkText *self)
 
   priv->selection_bubble_timeout_id =
     g_timeout_add (50, gtk_text_selection_bubble_popup_show, self);
-  g_source_set_name_by_id (priv->selection_bubble_timeout_id, "[gtk] gtk_text_selection_bubble_popup_cb");
+  gdk_source_set_static_name_by_id (priv->selection_bubble_timeout_id, "[gtk] 
gtk_text_selection_bubble_popup_cb");
 }
 
 static void
diff --git a/gtk/gtktextlinedisplaycache.c b/gtk/gtktextlinedisplaycache.c
index 7f2a22c713..414d533cc2 100644
--- a/gtk/gtktextlinedisplaycache.c
+++ b/gtk/gtktextlinedisplaycache.c
@@ -23,6 +23,7 @@
 #include "gtktextbufferprivate.h"
 #include "gtktextiterprivate.h"
 #include "gtktextlinedisplaycacheprivate.h"
+#include "gtkprivate.h"
 
 #define DEFAULT_MRU_SIZE         250
 #define BLOW_CACHE_TIMEOUT_SEC   20
@@ -141,7 +142,7 @@ gtk_text_line_display_cache_delay_eviction (GtkTextLineDisplayCache *cache)
                                    gtk_text_line_display_cache_blow_cb,
                                    cache);
       cache->evict_source = g_main_context_find_source_by_id (NULL, tag);
-      g_source_set_name (cache->evict_source, "[gtk+] gtk_text_line_display_cache_blow_cb");
+      g_source_set_static_name (cache->evict_source, "[gtk+] gtk_text_line_display_cache_blow_cb");
     }
 }
 
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 4796a34b1e..71c48ab844 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -763,7 +763,7 @@ gtk_text_view_drop_scroll_motion (GtkDropControllerMotion *motion,
   if (!priv->scroll_timeout)
   {
     priv->scroll_timeout = g_timeout_add (100, gtk_text_view_drop_motion_scroll_timeout, self);
-    g_source_set_name_by_id (priv->scroll_timeout, "[gtk] gtk_text_view_drop_motion_scroll_timeout");
+    gdk_source_set_static_name_by_id (priv->scroll_timeout, "[gtk] 
gtk_text_view_drop_motion_scroll_timeout");
   }
 }
 
@@ -2944,7 +2944,7 @@ queue_update_im_spot_location (GtkTextView *text_view)
                                             do_update_im_spot_location,
                                             text_view,
                                             NULL);
-      g_source_set_name_by_id (priv->im_spot_idle, "[gtk] do_update_im_spot_location");
+      gdk_source_set_static_name_by_id (priv->im_spot_idle, "[gtk] do_update_im_spot_location");
     }
 }
 
@@ -4821,7 +4821,7 @@ gtk_text_view_invalidate (GtkTextView *text_view)
   if (!priv->first_validate_idle)
     {
       priv->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, 
text_view, NULL);
-      g_source_set_name_by_id (priv->first_validate_idle, "[gtk] first_validate_callback");
+      gdk_source_set_static_name_by_id (priv->first_validate_idle, "[gtk] first_validate_callback");
       DV (g_print (G_STRLOC": adding first validate idle %d\n",
                    priv->first_validate_idle));
     }
@@ -4829,7 +4829,7 @@ gtk_text_view_invalidate (GtkTextView *text_view)
   if (!priv->incremental_validate_idle)
     {
       priv->incremental_validate_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, 
incremental_validate_callback, text_view, NULL);
-      g_source_set_name_by_id (priv->incremental_validate_idle, "[gtk] incremental_validate_callback");
+      gdk_source_set_static_name_by_id (priv->incremental_validate_idle, "[gtk] 
incremental_validate_callback");
       DV (g_print (G_STRLOC": adding incremental validate idle %d\n",
                    priv->incremental_validate_idle));
     }
@@ -7458,7 +7458,7 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
     g_source_remove (text_view->priv->scroll_timeout);
 
   text_view->priv->scroll_timeout = g_timeout_add (50, selection_scan_timeout, text_view);
-  g_source_set_name_by_id (text_view->priv->scroll_timeout, "[gtk] selection_scan_timeout");
+  gdk_source_set_static_name_by_id (text_view->priv->scroll_timeout, "[gtk] selection_scan_timeout");
 
   gtk_text_view_selection_bubble_popup_unset (text_view);
 
@@ -9099,7 +9099,7 @@ gtk_text_view_selection_bubble_popup_set (GtkTextView *text_view)
     g_source_remove (priv->selection_bubble_timeout_id);
 
   priv->selection_bubble_timeout_id = g_timeout_add (50, gtk_text_view_selection_bubble_popup_show, 
text_view);
-  g_source_set_name_by_id (priv->selection_bubble_timeout_id, "[gtk] 
gtk_text_view_selection_bubble_popup_cb");
+  gdk_source_set_static_name_by_id (priv->selection_bubble_timeout_id, "[gtk] 
gtk_text_view_selection_bubble_popup_cb");
 }
 
 /* Child GdkSurfaces */
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 9836eb0331..9f0fa15cca 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -34,6 +34,7 @@
 #include "gtkwindowprivate.h"
 #include "gtkwidgetprivate.h"
 #include "gtknative.h"
+#include "gtkprivate.h"
 
 /**
  * GtkTooltip:
@@ -789,7 +790,7 @@ gtk_tooltip_hide_tooltip (GtkTooltip *tooltip)
                             tooltip_browse_mode_expired,
                             g_object_ref (tooltip),
                             g_object_unref);
-      g_source_set_name_by_id (tooltip->browse_mode_timeout_id, "[gtk] tooltip_browse_mode_expired");
+      gdk_source_set_static_name_by_id (tooltip->browse_mode_timeout_id, "[gtk] 
tooltip_browse_mode_expired");
     }
 
   if (tooltip->window)
@@ -841,7 +842,7 @@ gtk_tooltip_start_delay (GdkDisplay *display)
                                             tooltip_popup_timeout,
                                             g_object_ref (display),
                                             g_object_unref);
-  g_source_set_name_by_id (tooltip->timeout_id, "[gtk] tooltip_popup_timeout");
+  gdk_source_set_static_name_by_id (tooltip->timeout_id, "[gtk] tooltip_popup_timeout");
 }
 
 void
diff --git a/gtk/gtktreeexpander.c b/gtk/gtktreeexpander.c
index 85f2369182..59fccd7ccd 100644
--- a/gtk/gtktreeexpander.c
+++ b/gtk/gtktreeexpander.c
@@ -29,6 +29,7 @@
 #include "gtkgestureclick.h"
 #include "gtkintl.h"
 #include "gtktreelistmodel.h"
+#include "gtkprivate.h"
 
 /**
  * GtkTreeExpander:
@@ -648,7 +649,7 @@ gtk_tree_expander_drag_enter (GtkDropControllerMotion *motion,
       !self->expand_timer)
     {
       self->expand_timer = g_timeout_add (TIMEOUT_EXPAND, (GSourceFunc) gtk_tree_expander_expand_timeout, 
self);
-      g_source_set_name_by_id (self->expand_timer, "[gtk] gtk_tree_expander_expand_timeout");
+      gdk_source_set_static_name_by_id (self->expand_timer, "[gtk] gtk_tree_expander_expand_timeout");
     }
 }
 
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 7653974d18..1007d08a25 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -3467,7 +3467,7 @@ do_prelight (GtkTreeView   *tree_view,
     {
       priv->auto_expand_timeout = 
         g_timeout_add (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
-      g_source_set_name_by_id (priv->auto_expand_timeout, "[gtk] auto_expand_timeout");
+      gdk_source_set_static_name_by_id (priv->auto_expand_timeout, "[gtk] auto_expand_timeout");
     }
 }
 
@@ -6413,7 +6413,7 @@ install_presize_handler (GtkTreeView *tree_view)
     {
       priv->validate_rows_timer =
        g_idle_add_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows, tree_view, NULL);
-      g_source_set_name_by_id (priv->validate_rows_timer, "[gtk] validate_rows");
+      gdk_source_set_static_name_by_id (priv->validate_rows_timer, "[gtk] validate_rows");
     }
 }
 
@@ -6446,7 +6446,7 @@ install_scroll_sync_handler (GtkTreeView *tree_view)
     {
       priv->scroll_sync_timer =
        g_idle_add_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, 
NULL);
-      g_source_set_name_by_id (priv->scroll_sync_timer, "[gtk] scroll_sync_handler");
+      gdk_source_set_static_name_by_id (priv->scroll_sync_timer, "[gtk] scroll_sync_handler");
     }
 }
 
@@ -6752,7 +6752,7 @@ add_scroll_timeout (GtkTreeView *tree_view)
   if (priv->scroll_timeout == 0)
     {
       priv->scroll_timeout = g_timeout_add (150, scroll_row_timeout, tree_view);
-      g_source_set_name_by_id (priv->scroll_timeout, "[gtk] scroll_row_timeout");
+      gdk_source_set_static_name_by_id (priv->scroll_timeout, "[gtk] scroll_row_timeout");
     }
 }
 
@@ -7240,7 +7240,7 @@ gtk_tree_view_drag_motion (GtkDropTargetAsync *dest,
         {
           priv->open_dest_timeout =
             g_timeout_add (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
-          g_source_set_name_by_id (priv->open_dest_timeout, "[gtk] open_row_timeout");
+          gdk_source_set_static_name_by_id (priv->open_dest_timeout, "[gtk] open_row_timeout");
         }
       else
         {
@@ -10130,7 +10130,7 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
     g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                    (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                    tree_view);
-  g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
+  gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
 
   /* search first matching iter */
   gtk_tree_view_search_init (priv->search_entry, tree_view);
@@ -13616,7 +13616,7 @@ gtk_tree_view_search_preedit_changed (GtkText      *text,
        g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                        (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
-      g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
+      gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
     }
 
 }
@@ -13690,7 +13690,7 @@ gtk_tree_view_search_scroll_event (GtkWidget   *widget,
        g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                       (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
-      g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
+      gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
     }
 
   return GDK_EVENT_STOP;
@@ -13766,7 +13766,7 @@ gtk_tree_view_search_key_pressed (GtkEventControllerKey *key,
        g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                       (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
-      g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
+      gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
     }
 
   if (!retval)
@@ -14024,7 +14024,7 @@ gtk_tree_view_search_init (GtkWidget   *entry,
        g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                       (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
-      g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
+      gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] 
gtk_tree_view_search_entry_flush_timeout");
     }
 
   if (*text == '\0')
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index df3d3d7e87..700b8dc88a 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -2391,7 +2391,7 @@ _gtk_window_notify_keys_changed (GtkWindow *window)
   if (!priv->keys_changed_handler)
     {
       priv->keys_changed_handler = g_idle_add (handle_keys_changed, window);
-      g_source_set_name_by_id (priv->keys_changed_handler, "[gtk] handle_keys_changed");
+      gdk_source_set_static_name_by_id (priv->keys_changed_handler, "[gtk] handle_keys_changed");
     }
 }
 
@@ -5964,7 +5964,7 @@ _gtk_window_schedule_mnemonics_visible (GtkWindow *window)
 
   priv->mnemonics_display_timeout_id =
     g_timeout_add (MNEMONICS_DELAY, schedule_mnemonics_visible_cb, window);
-  g_source_set_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] schedule_mnemonics_visible_cb");
+  gdk_source_set_static_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] 
schedule_mnemonics_visible_cb");
 }
 
 /**
diff --git a/modules/printbackends/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c
index 10a6d80dc4..ca6e4a975c 100644
--- a/modules/printbackends/gtkprintbackendcups.c
+++ b/modules/printbackends/gtkprintbackendcups.c
@@ -56,6 +56,7 @@
 #include "gtkcupssecretsutils.h"
 
 #include <gtkprintutils.h>
+#include "gtkprivate.h"
 
 #ifdef HAVE_COLORD
 #include <colord.h>
@@ -1690,7 +1691,7 @@ cups_request_execute (GtkPrintBackendCups              *print_backend,
 
   dispatch = (GtkPrintCupsDispatchWatch *) g_source_new (&_cups_dispatch_watch_funcs,
                                                          sizeof (GtkPrintCupsDispatchWatch));
-  g_source_set_name (&dispatch->source, "GTK CUPS backend");
+  g_source_set_static_name (&dispatch->source, "GTK CUPS backend");
 
   GTK_NOTE (PRINTING,
             g_print ("CUPS Backend: %s <source %p> - Executing cups request on server '%s' and resource 
'%s'\n", G_STRFUNC, dispatch, request->server, request->resource));
@@ -1804,7 +1805,7 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend,
         timeout = 1000;
 
       id = g_timeout_add (timeout, cups_job_info_poll_timeout, data);
-      g_source_set_name_by_id (id, "[gtk] cups_job_info_poll_timeout");
+      gdk_source_set_static_name_by_id (id, "[gtk] cups_job_info_poll_timeout");
     }
   else
     cups_job_poll_data_free (data);
@@ -3925,7 +3926,7 @@ cups_request_printer_list (GtkPrintBackendCups *cups_backend)
       if (cups_backend->list_printers_poll > 0)
         g_source_remove (cups_backend->list_printers_poll);
       cups_backend->list_printers_poll = g_timeout_add (200, (GSourceFunc) cups_request_printer_list, 
cups_backend);
-      g_source_set_name_by_id (cups_backend->list_printers_poll, "[gtk] cups_request_printer_list");
+      gdk_source_set_static_name_by_id (cups_backend->list_printers_poll, "[gtk] cups_request_printer_list");
     }
   else if (cups_backend->list_printers_attempts != -1)
     cups_backend->list_printers_attempts++;
@@ -3974,7 +3975,7 @@ cups_get_printer_list (GtkPrintBackend *backend)
       if (cups_request_printer_list (cups_backend))
         {
           cups_backend->list_printers_poll = g_timeout_add (50, (GSourceFunc) cups_request_printer_list, 
backend);
-          g_source_set_name_by_id (cups_backend->list_printers_poll, "[gtk] cups_request_printer_list");
+          gdk_source_set_static_name_by_id (cups_backend->list_printers_poll, "[gtk] 
cups_request_printer_list");
         }
 
       avahi_request_printer_list (cups_backend);
@@ -4066,7 +4067,7 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend,
           if (cups_request_ppd (printer))
             {
               cups_printer->get_remote_ppd_poll = g_timeout_add (50, (GSourceFunc) cups_request_ppd, 
printer);
-              g_source_set_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk] cups_request_ppd");
+              gdk_source_set_static_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk] cups_request_ppd");
             }
         }
       else
@@ -4120,7 +4121,7 @@ cups_request_ppd (GtkPrinter *printer)
               if (cups_printer->get_remote_ppd_poll > 0)
                 g_source_remove (cups_printer->get_remote_ppd_poll);
               cups_printer->get_remote_ppd_poll = g_timeout_add (200, (GSourceFunc) cups_request_ppd, 
printer);
-              g_source_set_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk] cups_request_ppd");
+              gdk_source_set_static_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk] cups_request_ppd");
             }
           else if (cups_printer->get_remote_ppd_attempts != -1)
             cups_printer->get_remote_ppd_attempts++;
@@ -4399,7 +4400,7 @@ cups_get_default_printer (GtkPrintBackendCups *backend)
       if (cups_request_default_printer (cups_backend))
         {
           cups_backend->default_printer_poll = g_timeout_add (200, (GSourceFunc) 
cups_request_default_printer, backend);
-          g_source_set_name_by_id (cups_backend->default_printer_poll, "[gtk] cups_request_default_printer");
+          gdk_source_set_static_name_by_id (cups_backend->default_printer_poll, "[gtk] 
cups_request_default_printer");
         }
     }
 }
@@ -4540,7 +4541,7 @@ cups_printer_request_details (GtkPrinter *printer)
               if (cups_request_ppd (printer))
                 {
                   cups_printer->get_remote_ppd_poll = g_timeout_add (50, (GSourceFunc) cups_request_ppd, 
printer);
-                  g_source_set_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk] cups_request_ppd");
+                  gdk_source_set_static_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk] 
cups_request_ppd");
                 }
             }
         }


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