[gnome-builder] util: use various gtk helpers from libdazzle



commit ac05ae1700b490c5a7628b5d298b89d843e7dc8a
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 6 14:09:18 2017 -0700

    util: use various gtk helpers from libdazzle
    
    These are in libdazzle now and are no longer necessary to have inside
    of libide/util. The more we move out, the better.

 libide/buffers/ide-buffer.c                     |    8 +-
 libide/editor/ide-editor-frame-actions.c        |    2 +-
 libide/editor/ide-editor-frame.c                |   20 +-
 libide/editor/ide-editor-spell-widget.c         |    3 +-
 libide/editor/ide-editor-tweak-widget.c         |    3 +-
 libide/editor/ide-editor-view-actions.c         |    7 +-
 libide/editor/ide-editor-workbench-addin.c      |    2 +-
 libide/runner/ide-run-button.c                  |    7 +-
 libide/sourceview/ide-source-view.c             |    2 +-
 libide/tree/ide-tree.c                          |    3 +-
 libide/util/ide-gtk.c                           |  314 -----------------------
 libide/util/ide-gtk.h                           |   19 --
 libide/workbench/ide-layout-grid.c              |    3 +-
 libide/workbench/ide-layout-stack.c             |    4 +-
 libide/workbench/ide-layout-tab-bar.c           |    5 +-
 libide/workbench/ide-omni-bar.c                 |    2 +-
 libide/workbench/ide-perspective-menu-button.c  |    7 +-
 libide/workbench/ide-workbench.c                |    2 +-
 plugins/command-bar/gb-vim.c                    |   28 +-
 plugins/devhelp/gbp-devhelp-editor-view-addin.c |    4 +-
 plugins/devhelp/gbp-devhelp-panel.c             |    2 +-
 plugins/flatpak/gbp-flatpak-clone-widget.c      |    2 +-
 plugins/git/ide-git-clone-widget.c              |    2 +-
 plugins/project-tree/gb-project-tree-addin.c    |    3 +-
 plugins/sysprof/gbp-sysprof-workbench-addin.c   |    2 +-
 plugins/terminal/gb-terminal-view.c             |    2 +-
 plugins/terminal/gb-terminal.c                  |    2 +-
 27 files changed, 69 insertions(+), 391 deletions(-)
---
diff --git a/libide/buffers/ide-buffer.c b/libide/buffers/ide-buffer.c
index a412634..2e78305 100644
--- a/libide/buffers/ide-buffer.c
+++ b/libide/buffers/ide-buffer.c
@@ -331,16 +331,16 @@ ide_buffer_clear_diagnostics (IdeBuffer *self)
   table = gtk_text_buffer_get_tag_table (buffer);
 
   if (NULL != (tag = gtk_text_tag_table_lookup (table, TAG_NOTE)))
-    ide_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
+    dzl_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
 
   if (NULL != (tag = gtk_text_tag_table_lookup (table, TAG_WARNING)))
-    ide_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
+    dzl_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
 
   if (NULL != (tag = gtk_text_tag_table_lookup (table, TAG_DEPRECATED)))
-    ide_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
+    dzl_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
 
   if (NULL != (tag = gtk_text_tag_table_lookup (table, TAG_ERROR)))
-    ide_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
+    dzl_gtk_text_buffer_remove_tag (buffer, tag, &begin, &end, TRUE);
 }
 
 static void
diff --git a/libide/editor/ide-editor-frame-actions.c b/libide/editor/ide-editor-frame-actions.c
index 8ac7ec3..ef386e4 100644
--- a/libide/editor/ide-editor-frame-actions.c
+++ b/libide/editor/ide-editor-frame-actions.c
@@ -351,7 +351,7 @@ ide_editor_frame_actions_replace (GSimpleAction *action,
           g_clear_error (&error);
         }
 
-      ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
     }
 
   g_free (unescaped_replace_text);
diff --git a/libide/editor/ide-editor-frame.c b/libide/editor/ide-editor-frame.c
index c5fd1fc..661cf42 100644
--- a/libide/editor/ide-editor-frame.c
+++ b/libide/editor/ide-editor-frame.c
@@ -586,7 +586,7 @@ search_revealer_on_child_revealed_changed (IdeEditorFrame *self,
       !gtk_revealer_get_child_revealed (search_revealer))
     return;
 
-  ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
+  dzl_gtk_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
 
   self->pending_replace_confirm--;
 
@@ -760,7 +760,7 @@ ide_editor_frame__drag_data_received (IdeEditorFrame    *self,
            */
           gtk_widget_grab_focus (GTK_WIDGET (self));
 
-          ide_widget_action (GTK_WIDGET (self), "workbench", "open-uri-list", variant);
+          dzl_gtk_widget_action (GTK_WIDGET (self), "workbench", "open-uri-list", variant);
         }
 
       gtk_drag_finish (context, TRUE, FALSE, timestamp);
@@ -782,7 +782,7 @@ ide_editor_frame__search_key_press_event (IdeEditorFrame *self,
   switch (event->keyval)
     {
     case GDK_KEY_Escape:
-      ide_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "exit-search", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "exit-search", NULL);
       return GDK_EVENT_STOP;
 
     case GDK_KEY_KP_Enter:
@@ -791,16 +791,16 @@ ide_editor_frame__search_key_press_event (IdeEditorFrame *self,
       g_free (self->previous_search_string);
       g_object_get (self->search_entry, "text", &self->previous_search_string, NULL);
 
-      ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
       gtk_widget_grab_focus (GTK_WIDGET (self->source_view));
       return GDK_EVENT_STOP;
 
     case GDK_KEY_Down:
-      ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
       return GDK_EVENT_STOP;
 
     case GDK_KEY_Up:
-      ide_widget_action (GTK_WIDGET (self), "frame", "previous-search-result", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "frame", "previous-search-result", NULL);
       return GDK_EVENT_STOP;
 
     default:
@@ -825,20 +825,20 @@ ide_editor_frame__replace_key_press_event (IdeEditorFrame *self,
   switch (event->keyval)
     {
     case GDK_KEY_Escape:
-      ide_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "exit-search", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "exit-search", NULL);
       return GDK_EVENT_STOP;
 
     case GDK_KEY_KP_Enter:
     case GDK_KEY_Return:
-      ide_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "replace", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "replace", NULL);
       return GDK_EVENT_STOP;
 
     case GDK_KEY_Down:
-      ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
       return GDK_EVENT_STOP;
 
     case GDK_KEY_Up:
-      ide_widget_action (GTK_WIDGET (self), "frame", "previous-search-result", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "frame", "previous-search-result", NULL);
       return GDK_EVENT_STOP;
 
     default:
diff --git a/libide/editor/ide-editor-spell-widget.c b/libide/editor/ide-editor-spell-widget.c
index 9a85e19..1ba0371 100644
--- a/libide/editor/ide-editor-spell-widget.c
+++ b/libide/editor/ide-editor-spell-widget.c
@@ -18,6 +18,7 @@
 
 #define G_LOG_DOMAIN "ide-spell-check-widget"
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 #include <gspell/gspell.h>
 
@@ -525,7 +526,7 @@ ide_editor_spell_widget__key_press_event_cb (IdeEditorSpellWidget *self,
   switch (event->keyval)
     {
     case GDK_KEY_Escape:
-      ide_widget_action (GTK_WIDGET (self->view),
+      dzl_gtk_widget_action (GTK_WIDGET (self->view),
                          "frame", "show-spellcheck",
                          g_variant_new_int32 (0));
       return GDK_EVENT_STOP;
diff --git a/libide/editor/ide-editor-tweak-widget.c b/libide/editor/ide-editor-tweak-widget.c
index 2dc2ef3..e632152 100644
--- a/libide/editor/ide-editor-tweak-widget.c
+++ b/libide/editor/ide-editor-tweak-widget.c
@@ -18,6 +18,7 @@
 
 #define G_LOG_DOMAIN "editor-tweak"
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 #include <gtksourceview/gtksource.h>
 
@@ -111,7 +112,7 @@ ide_editor_tweak_widget_row_activated (IdeEditorTweakWidget *self,
     {
       lang_id = gtk_source_language_get_id (lang);
       param = g_variant_new_string (lang_id);
-      ide_widget_action (GTK_WIDGET (self), "view", "language", param);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "view", "language", param);
     }
 }
 
diff --git a/libide/editor/ide-editor-view-actions.c b/libide/editor/ide-editor-view-actions.c
index 403f308..7f23a3b 100644
--- a/libide/editor/ide-editor-view-actions.c
+++ b/libide/editor/ide-editor-view-actions.c
@@ -18,6 +18,7 @@
 
 #define G_LOG_DOMAIN "ide-editor-view"
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 #include <string.h>
 
@@ -200,7 +201,7 @@ save_file_cb (GObject      *object,
     }
 
   if (self->progress_bar)
-    ide_widget_hide_with_fade (GTK_WIDGET (self->progress_bar));
+    dzl_gtk_widget_hide_with_fade (GTK_WIDGET (self->progress_bar));
 }
 
 static void
@@ -498,7 +499,7 @@ ide_editor_view_actions_close (GSimpleAction *action,
     }
   else
     {
-      ide_widget_action (GTK_WIDGET (self), "view-stack", "close", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "view-stack", "close", NULL);
     }
 }
 
@@ -568,7 +569,7 @@ ide_editor_view_actions_reload_buffer_cb (GObject      *object,
                                FALSE);
     }
 
-  ide_widget_hide_with_fade (GTK_WIDGET (self->progress_bar));
+  dzl_gtk_widget_hide_with_fade (GTK_WIDGET (self->progress_bar));
 }
 
 static void
diff --git a/libide/editor/ide-editor-workbench-addin.c b/libide/editor/ide-editor-workbench-addin.c
index b65af0b..0f9e53a 100644
--- a/libide/editor/ide-editor-workbench-addin.c
+++ b/libide/editor/ide-editor-workbench-addin.c
@@ -97,7 +97,7 @@ ide_editor_workbench_addin_load (IdeWorkbenchAddin *addin,
                                                                    "icon-name", "document-new-symbolic",
                                                                    NULL),
                                             NULL);
-  ide_widget_add_style_class (self->new_document_button, "image-button");
+  dzl_gtk_widget_add_style_class (self->new_document_button, "image-button");
 
   ide_workbench_header_bar_insert_left (header,
                                         self->new_document_button,
diff --git a/libide/runner/ide-run-button.c b/libide/runner/ide-run-button.c
index f71a7fa..84dea0b 100644
--- a/libide/runner/ide-run-button.c
+++ b/libide/runner/ide-run-button.c
@@ -18,6 +18,7 @@
 
 #define G_LOG_DOMAIN "ide-run-button"
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 
 #include "ide-context.h"
@@ -97,8 +98,8 @@ create_row (const IdeRunHandlerInfo *info,
                             "visible", TRUE,
                             "xalign", 0.0f,
                             NULL);
-      ide_widget_add_style_class (GTK_WIDGET (label), "dim-label");
-      ide_widget_add_style_class (GTK_WIDGET (label), "accel");
+      dzl_gtk_widget_add_style_class (GTK_WIDGET (label), "dim-label");
+      dzl_gtk_widget_add_style_class (GTK_WIDGET (label), "accel");
       gtk_container_add_with_properties (GTK_CONTAINER (box), GTK_WIDGET (label),
                                          "pack-type", GTK_PACK_END,
                                          NULL);
@@ -208,7 +209,7 @@ ide_run_button_row_activated (IdeRunButton  *self,
       gtk_popover_popdown (self->popover);
 
       /* Now run the action */
-      ide_widget_action (GTK_WIDGET (self), "run-manager", "run-with-handler", g_variant_new_string (id));
+      dzl_gtk_widget_action (GTK_WIDGET (self), "run-manager", "run-with-handler", g_variant_new_string 
(id));
     }
 }
 
diff --git a/libide/sourceview/ide-source-view.c b/libide/sourceview/ide-source-view.c
index 1c72fc3..79e23ca 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -6818,7 +6818,7 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
     g_signal_new_class_handler ("action",
                                 G_TYPE_FROM_CLASS (klass),
                                 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                                G_CALLBACK (ide_widget_action_with_string),
+                                G_CALLBACK (dzl_gtk_widget_action_with_string),
                                 NULL, NULL, NULL,
                                 G_TYPE_NONE,
                                 3,
diff --git a/libide/tree/ide-tree.c b/libide/tree/ide-tree.c
index db9d8bf..3ee488c 100644
--- a/libide/tree/ide-tree.c
+++ b/libide/tree/ide-tree.c
@@ -18,6 +18,7 @@
 
 #define G_LOG_DOMAIN "ide-tree"
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 
 #include "ide-debug.h"
@@ -717,7 +718,7 @@ ide_tree_real_action (IdeTree     *self,
         }
     }
 
-  ide_widget_action (GTK_WIDGET (self), prefix, action_name, variant);
+  dzl_gtk_widget_action (GTK_WIDGET (self), prefix, action_name, variant);
 }
 
 static gboolean
diff --git a/libide/util/ide-gtk.c b/libide/util/ide-gtk.c
index c7d282f..fd4572b 100644
--- a/libide/util/ide-gtk.c
+++ b/libide/util/ide-gtk.c
@@ -18,110 +18,8 @@
 
 #define G_LOG_DOMAIN "ide-gtk"
 
-#include <dazzle.h>
-
-#include "ide-debug.h"
-
 #include "util/ide-gtk.h"
 
-gboolean
-ide_widget_action (GtkWidget   *widget,
-                   const gchar *prefix,
-                   const gchar *action_name,
-                   GVariant    *parameter)
-{
-  GtkWidget *toplevel;
-  GApplication *app;
-  GActionGroup *group = NULL;
-
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-  g_return_val_if_fail (prefix, FALSE);
-  g_return_val_if_fail (action_name, FALSE);
-
-  app = g_application_get_default ();
-  toplevel = gtk_widget_get_toplevel (widget);
-
-  while ((group == NULL) && (widget != NULL))
-    {
-      group = gtk_widget_get_action_group (widget, prefix);
-
-      if G_UNLIKELY (GTK_IS_POPOVER (widget))
-        {
-          GtkWidget *relative_to;
-
-          relative_to = gtk_popover_get_relative_to (GTK_POPOVER (widget));
-
-          if (relative_to != NULL)
-            widget = relative_to;
-          else
-            widget = gtk_widget_get_parent (widget);
-        }
-      else
-        {
-          widget = gtk_widget_get_parent (widget);
-        }
-    }
-
-  if (!group && g_str_equal (prefix, "win") && G_IS_ACTION_GROUP (toplevel))
-    group = G_ACTION_GROUP (toplevel);
-
-  if (!group && g_str_equal (prefix, "app") && G_IS_ACTION_GROUP (app))
-    group = G_ACTION_GROUP (app);
-
-  if (group && g_action_group_has_action (group, action_name))
-    {
-      g_action_group_activate_action (group, action_name, parameter);
-      return TRUE;
-    }
-
-  if (parameter && g_variant_is_floating (parameter))
-    {
-      parameter = g_variant_ref_sink (parameter);
-      g_variant_unref (parameter);
-    }
-
-  g_warning ("Failed to locate action %s.%s", prefix, action_name);
-
-  return FALSE;
-}
-
-gboolean
-ide_widget_action_with_string (GtkWidget   *widget,
-                               const gchar *group,
-                               const gchar *name,
-                               const gchar *param)
-{
-  GVariant *variant = NULL;
-  gboolean ret;
-
-  IDE_ENTRY;
-
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-  g_return_val_if_fail (group != NULL, FALSE);
-  g_return_val_if_fail (name != NULL, FALSE);
-
-  if (param == NULL)
-    param = "";
-
-  if (*param != 0)
-    {
-      g_autoptr(GError) error = NULL;
-
-      variant = g_variant_parse (NULL, param, NULL, NULL, &error);
-
-      if (variant == NULL)
-        {
-          g_warning ("can't parse keybinding parameters \"%s\": %s",
-                     param, error->message);
-          IDE_RETURN (FALSE);
-        }
-    }
-
-  ret = ide_widget_action (widget, group, name, variant);
-
-  IDE_RETURN (ret);
-}
-
 static void
 ide_widget_notify_context (GtkWidget  *toplevel,
                            GParamSpec *pspec,
@@ -194,82 +92,6 @@ ide_widget_set_context_handler (gpointer                widget,
     ide_widget_hierarchy_changed (widget, NULL, NULL);
 }
 
-static void
-show_callback (gpointer data)
-{
-  g_object_set_data (data, "FADE_ANIMATION", NULL);
-  g_object_unref (data);
-}
-
-static void
-hide_callback (gpointer data)
-{
-  GtkWidget *widget = data;
-
-  g_object_set_data (data, "FADE_ANIMATION", NULL);
-  gtk_widget_hide (widget);
-  gtk_widget_set_opacity (widget, 1.0);
-  g_object_unref (widget);
-}
-
-void
-ide_widget_hide_with_fade (GtkWidget *widget)
-{
-  GdkFrameClock *frame_clock;
-  DzlAnimation *anim;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  if (gtk_widget_get_visible (widget))
-    {
-      anim = g_object_get_data (G_OBJECT (widget), "FADE_ANIMATION");
-      if (anim != NULL)
-        dzl_animation_stop (anim);
-
-      frame_clock = gtk_widget_get_frame_clock (widget);
-      anim = dzl_object_animate_full (widget,
-                                      DZL_ANIMATION_LINEAR,
-                                      1000,
-                                      frame_clock,
-                                      hide_callback,
-                                      g_object_ref (widget),
-                                      "opacity", 0.0,
-                                      NULL);
-      g_object_set_data_full (G_OBJECT (widget), "FADE_ANIMATION",
-                              g_object_ref (anim), g_object_unref);
-    }
-}
-
-void
-ide_widget_show_with_fade (GtkWidget *widget)
-{
-  GdkFrameClock *frame_clock;
-  DzlAnimation *anim;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  if (!gtk_widget_get_visible (widget))
-    {
-      anim = g_object_get_data (G_OBJECT (widget), "FADE_ANIMATION");
-      if (anim != NULL)
-        dzl_animation_stop (anim);
-
-      frame_clock = gtk_widget_get_frame_clock (widget);
-      gtk_widget_set_opacity (widget, 0.0);
-      gtk_widget_show (widget);
-      anim = dzl_object_animate_full (widget,
-                                      DZL_ANIMATION_LINEAR,
-                                      500,
-                                      frame_clock,
-                                      show_callback,
-                                      g_object_ref (widget),
-                                      "opacity", 1.0,
-                                      NULL);
-      g_object_set_data_full (G_OBJECT (widget), "FADE_ANIMATION",
-                              g_object_ref (anim), g_object_unref);
-    }
-}
-
 /**
  * ide_widget_get_workbench:
  *
@@ -297,142 +119,6 @@ ide_widget_get_workbench (GtkWidget *widget)
   return NULL;
 }
 
-static void
-ide_widget_find_child_typed_cb (GtkWidget *widget,
-                                gpointer   user_data)
-{
-  struct {
-    gpointer ret;
-    GType type;
-  } *state = user_data;
-
-  if (state->ret != NULL)
-    return;
-
-  if (g_type_is_a (G_OBJECT_TYPE (widget), state->type))
-    {
-      state->ret = widget;
-    }
-  else if (GTK_IS_CONTAINER (widget))
-    {
-      gtk_container_foreach (GTK_CONTAINER (widget),
-                             ide_widget_find_child_typed_cb,
-                             state);
-    }
-}
-
-gpointer
-ide_widget_find_child_typed (GtkWidget *widget,
-                             GType      child_type)
-{
-  struct {
-    gpointer ret;
-    GType type;
-  } state;
-
-  g_return_val_if_fail (GTK_IS_CONTAINER (widget), NULL);
-  g_return_val_if_fail (g_type_is_a (child_type, GTK_TYPE_WIDGET), NULL);
-
-  state.ret = NULL;
-  state.type = child_type;
-
-  gtk_container_foreach (GTK_CONTAINER (widget),
-                         ide_widget_find_child_typed_cb,
-                         &state);
-
-  return state.ret;
-}
-
-/**
- * ide_gtk_text_buffer_remove_tag:
- *
- * Like gtk_text_buffer_remove_tag() but allows specifying that the tags
- * should be removed one at a time to avoid over-damaging the views
- * displaying @buffer.
- */
-void
-ide_gtk_text_buffer_remove_tag (GtkTextBuffer     *buffer,
-                                GtkTextTag        *tag,
-                                const GtkTextIter *start,
-                                const GtkTextIter *end,
-                                gboolean           minimal_damage)
-{
-  GtkTextIter tag_begin;
-  GtkTextIter tag_end;
-
-  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
-  g_return_if_fail (GTK_IS_TEXT_TAG (tag));
-  g_return_if_fail (start != NULL);
-  g_return_if_fail (end != NULL);
-
-  if (!minimal_damage)
-    {
-      gtk_text_buffer_remove_tag (buffer, tag, start, end);
-      return;
-    }
-
-  tag_begin = *start;
-
-  if (!gtk_text_iter_starts_tag (&tag_begin, tag))
-    {
-      if (!gtk_text_iter_forward_to_tag_toggle (&tag_begin, tag))
-        return;
-    }
-
-  while (gtk_text_iter_starts_tag (&tag_begin, tag) &&
-         gtk_text_iter_compare (&tag_begin, end) < 0)
-    {
-      gint count = 1;
-
-      tag_end = tag_begin;
-
-      /*
-       * We might have found the start of another tag embedded
-       * inside this tag. So keep scanning forward until we have
-       * reached the right number of end tags.
-       */
-
-      while (gtk_text_iter_forward_to_tag_toggle (&tag_end, tag))
-        {
-          if (gtk_text_iter_starts_tag (&tag_end, tag))
-            count++;
-          else if (gtk_text_iter_ends_tag (&tag_end, tag))
-            count--;
-
-          if (count == 0)
-            break;
-        }
-
-      if (gtk_text_iter_ends_tag (&tag_end, tag))
-        gtk_text_buffer_remove_tag (buffer, tag, &tag_begin, &tag_end);
-
-      tag_begin = tag_end;
-
-      /*
-       * Move to the next start tag. It's possible to have an overlapped
-       * end tag, which would be non-ideal, but possible.
-       */
-      if (!gtk_text_iter_starts_tag (&tag_begin, tag))
-        {
-          while (gtk_text_iter_forward_to_tag_toggle (&tag_begin, tag))
-            {
-              if (gtk_text_iter_starts_tag (&tag_begin, tag))
-                break;
-            }
-        }
-    }
-}
-
-void
-ide_widget_add_style_class (GtkWidget   *widget,
-                            const gchar *class_name)
-{
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (class_name != NULL);
-
-  gtk_style_context_add_class (gtk_widget_get_style_context (widget), class_name);
-}
-
 /**
  * ide_widget_get_context: (skip)
  *
diff --git a/libide/util/ide-gtk.h b/libide/util/ide-gtk.h
index 869020f..c06e330 100644
--- a/libide/util/ide-gtk.h
+++ b/libide/util/ide-gtk.h
@@ -30,29 +30,10 @@ G_BEGIN_DECLS
 typedef void (*IdeWidgetContextHandler) (GtkWidget  *widget,
                                          IdeContext *context);
 
-gboolean      ide_widget_action              (GtkWidget               *widget,
-                                              const gchar             *group,
-                                              const gchar             *name,
-                                              GVariant                *param);
-gboolean      ide_widget_action_with_string  (GtkWidget               *widget,
-                                              const gchar             *group,
-                                              const gchar             *name,
-                                              const gchar             *param);
 void          ide_widget_set_context_handler (gpointer                 widget,
                                               IdeWidgetContextHandler  handler);
 IdeContext   *ide_widget_get_context         (GtkWidget               *widget);
-void          ide_widget_hide_with_fade      (GtkWidget               *widget);
-void          ide_widget_show_with_fade      (GtkWidget               *widget);
-void          ide_widget_add_style_class     (GtkWidget               *widget,
-                                              const gchar             *class_name);
 IdeWorkbench *ide_widget_get_workbench       (GtkWidget               *widget);
-gpointer      ide_widget_find_child_typed    (GtkWidget               *widget,
-                                              GType                    type);
-void          ide_gtk_text_buffer_remove_tag (GtkTextBuffer           *buffer,
-                                              GtkTextTag              *tag,
-                                              const GtkTextIter       *start,
-                                              const GtkTextIter       *end,
-                                              gboolean                 minimal_damage);
 
 G_END_DECLS
 
diff --git a/libide/workbench/ide-layout-grid.c b/libide/workbench/ide-layout-grid.c
index 23cdad3..0200b48 100644
--- a/libide/workbench/ide-layout-grid.c
+++ b/libide/workbench/ide-layout-grid.c
@@ -18,6 +18,7 @@
 
 #define G_LOG_DOMAIN "ide-layout-grid"
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 
 #include "util/ide-gtk.h"
@@ -261,7 +262,7 @@ ide_layout_grid_stack_empty (IdeLayoutGrid  *self,
 
   if (g_list_length (stacks) == 1)
     {
-      ide_widget_action (GTK_WIDGET (self), "win", "global-search", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (self), "win", "global-search", NULL);
       g_signal_emit (self, signals [EMPTY], 0);
       goto cleanup;
     }
diff --git a/libide/workbench/ide-layout-stack.c b/libide/workbench/ide-layout-stack.c
index 1b4ba28..4efba41 100644
--- a/libide/workbench/ide-layout-stack.c
+++ b/libide/workbench/ide-layout-stack.c
@@ -380,9 +380,9 @@ ide_layout_stack_swipe (IdeLayoutStack  *self,
   if (ABS (velocity_x) > ABS (velocity_y))
     {
       if (velocity_x < 0)
-        ide_widget_action (GTK_WIDGET (self), "view-stack", "previous-view", NULL);
+        dzl_gtk_widget_action (GTK_WIDGET (self), "view-stack", "previous-view", NULL);
       else if (velocity_x > 0)
-        ide_widget_action (GTK_WIDGET (self), "view-stack", "next-view", NULL);
+        dzl_gtk_widget_action (GTK_WIDGET (self), "view-stack", "next-view", NULL);
     }
 }
 
diff --git a/libide/workbench/ide-layout-tab-bar.c b/libide/workbench/ide-layout-tab-bar.c
index 68c71b6..943f515 100644
--- a/libide/workbench/ide-layout-tab-bar.c
+++ b/libide/workbench/ide-layout-tab-bar.c
@@ -18,7 +18,8 @@
 
 #define G_LOG_DOMAIN "ide-layout-tab-bar"
 
-#include "util/ide-gtk.h"
+#include <dazzle.h>
+
 #include "workbench/ide-layout-stack.h"
 #include "workbench/ide-layout-tab-bar.h"
 #include "workbench/ide-layout-tab-bar-private.h"
@@ -54,7 +55,7 @@ ide_layout_tab_bar_close_clicked (IdeLayoutTabBar *self,
   g_assert (IDE_IS_LAYOUT_VIEW (view));
 
   gtk_stack_set_visible_child (self->stack, view);
-  ide_widget_action (view, "view-stack", "close", NULL);
+  dzl_gtk_widget_action (view, "view-stack", "close", NULL);
 }
 
 static GtkWidget *
diff --git a/libide/workbench/ide-omni-bar.c b/libide/workbench/ide-omni-bar.c
index 8c6e579..f301898 100644
--- a/libide/workbench/ide-omni-bar.c
+++ b/libide/workbench/ide-omni-bar.c
@@ -205,7 +205,7 @@ on_configure_row (IdeOmniBar    *self,
    *       in the "activate" signal (using something like action-name).
    */
 
-  ide_widget_action (GTK_WIDGET (self),
+  dzl_gtk_widget_action (GTK_WIDGET (self),
                      "buildui",
                      "configure",
                      g_variant_new_string (id));
diff --git a/libide/workbench/ide-perspective-menu-button.c b/libide/workbench/ide-perspective-menu-button.c
index 7b8d86a..0c3bbb5 100644
--- a/libide/workbench/ide-perspective-menu-button.c
+++ b/libide/workbench/ide-perspective-menu-button.c
@@ -18,9 +18,10 @@
 
 #define G_LOG_DOMAIN "ide-perspective-menu-button"
 
+#include <dazzle.h>
+
 #include "ide-macros.h"
 
-#include "util/ide-gtk.h"
 #include "workbench/ide-perspective.h"
 #include "workbench/ide-perspective-menu-button.h"
 #include "workbench/ide-workbench.h"
@@ -117,8 +118,8 @@ ide_perspective_menu_button_create_row (IdePerspectiveMenuButton *self,
                             "visible", TRUE,
                             "xalign", 0.0f,
                             NULL);
-      ide_widget_add_style_class (GTK_WIDGET (label), "dim-label");
-      ide_widget_add_style_class (GTK_WIDGET (label), "accel");
+      dzl_gtk_widget_add_style_class (GTK_WIDGET (label), "dim-label");
+      dzl_gtk_widget_add_style_class (GTK_WIDGET (label), "accel");
       gtk_container_add_with_properties (GTK_CONTAINER (box), GTK_WIDGET (label),
                                          "pack-type", GTK_PACK_END,
                                          NULL);
diff --git a/libide/workbench/ide-workbench.c b/libide/workbench/ide-workbench.c
index bbfb37f..fe803ff 100644
--- a/libide/workbench/ide-workbench.c
+++ b/libide/workbench/ide-workbench.c
@@ -372,7 +372,7 @@ ide_workbench_class_init (IdeWorkbenchClass *klass)
     g_signal_new_class_handler ("action",
                                 G_TYPE_FROM_CLASS (klass),
                                 G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
-                                G_CALLBACK (ide_widget_action_with_string),
+                                G_CALLBACK (dzl_gtk_widget_action_with_string),
                                 NULL, NULL, NULL,
                                 G_TYPE_NONE,
                                 3,
diff --git a/plugins/command-bar/gb-vim.c b/plugins/command-bar/gb-vim.c
index f992db3..78e9ca8 100644
--- a/plugins/command-bar/gb-vim.c
+++ b/plugins/command-bar/gb-vim.c
@@ -452,7 +452,7 @@ gb_vim_command_edit (GtkWidget      *active_widget,
 
   if (ide_str_empty0 (options))
     {
-      ide_widget_action (GTK_WIDGET (active_widget), "win", "open-with-dialog", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (active_widget), "win", "open-with-dialog", NULL);
       return TRUE;
     }
 
@@ -491,7 +491,7 @@ gb_vim_command_tabe (GtkWidget      *active_widget,
   if (!ide_str_empty0 (options))
     return gb_vim_command_edit (active_widget, command, options, error);
 
-  ide_widget_action (GTK_WIDGET (active_widget), "perspective", "new-file", NULL);
+  dzl_gtk_widget_action (GTK_WIDGET (active_widget), "perspective", "new-file", NULL);
 
   return TRUE;
 }
@@ -508,10 +508,10 @@ gb_vim_command_quit (GtkWidget      *active_widget,
     {
       GtkSourceView *source_view = GTK_SOURCE_VIEW (IDE_EDITOR_VIEW (active_widget)->frame1->source_view);
 
-      ide_widget_action (GTK_WIDGET (source_view), "view", "save", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (source_view), "view", "save", NULL);
     }
 
-  ide_widget_action (GTK_WIDGET (active_widget), "view", "close", NULL);
+  dzl_gtk_widget_action (GTK_WIDGET (active_widget), "view", "close", NULL);
 
   return TRUE;
 }
@@ -525,7 +525,7 @@ gb_vim_command_split (GtkWidget      *active_widget,
   g_assert (GTK_IS_WIDGET (active_widget));
 
   if (IDE_IS_LAYOUT_VIEW (active_widget))
-    ide_widget_action (GTK_WIDGET (active_widget), "view-stack", "split-down", NULL);
+    dzl_gtk_widget_action (GTK_WIDGET (active_widget), "view-stack", "split-down", NULL);
   else
     return gb_vim_set_no_view_error (error);
 
@@ -546,7 +546,7 @@ gb_vim_command_vsplit_cb (GObject      *object,
   file_path = split_callback_data->file_path;
   variant = g_variant_new_string (file_path);
 
-  ide_widget_action (GTK_WIDGET (active_widget), "view-stack", "split-left", variant);
+  dzl_gtk_widget_action (GTK_WIDGET (active_widget), "view-stack", "split-left", variant);
 
   g_object_unref (split_callback_data->active_widget);
   g_free (split_callback_data->file_path);
@@ -576,7 +576,7 @@ gb_vim_command_vsplit (GtkWidget      *active_widget,
   if (ide_str_empty0 (options))
     {
       variant = g_variant_new_string ("");
-      ide_widget_action (GTK_WIDGET (active_widget), "view-stack", "split-left", variant);
+      dzl_gtk_widget_action (GTK_WIDGET (active_widget), "view-stack", "split-left", variant);
     }
   else
     {
@@ -627,7 +627,7 @@ gb_vim_command_write (GtkWidget      *active_widget,
     {
       GtkSourceView  *source_view = GTK_SOURCE_VIEW (IDE_EDITOR_VIEW (active_widget)->frame1->source_view);
 
-      ide_widget_action (GTK_WIDGET (source_view), "view", "save", NULL);
+      dzl_gtk_widget_action (GTK_WIDGET (source_view), "view", "save", NULL);
 
       return TRUE;
     }
@@ -682,7 +682,7 @@ gb_vim_command_make (GtkWidget      *active_widget,
   g_assert (GTK_IS_WIDGET (active_widget));
 
   /* TODO: check for an open project */
-  ide_widget_action (GTK_WIDGET (active_widget), "workbench", "build", NULL);
+  dzl_gtk_widget_action (GTK_WIDGET (active_widget), "workbench", "build", NULL);
 
   return TRUE;
 }
@@ -761,7 +761,7 @@ gb_vim_command_bnext (GtkWidget      *active_widget,
   n_buffers = ide_buffer_manager_get_n_buffers (bufmgr);
 
   if (n_buffers > 0)
-    ide_widget_action (GTK_WIDGET (active_widget), "view-stack", "next-view", NULL);
+    dzl_gtk_widget_action (GTK_WIDGET (active_widget), "view-stack", "next-view", NULL);
 
   return TRUE;
 }
@@ -785,7 +785,7 @@ gb_vim_command_bprevious (GtkWidget      *active_widget,
   n_buffers = ide_buffer_manager_get_n_buffers (bufmgr);
 
   if (n_buffers > 0)
-    ide_widget_action (GTK_WIDGET (active_widget), "view-stack", "previous-view", NULL);
+    dzl_gtk_widget_action (GTK_WIDGET (active_widget), "view-stack", "previous-view", NULL);
 
   return TRUE;
 }
@@ -838,7 +838,7 @@ gb_vim_command_buffers (GtkWidget      *active_widget,
 {
   g_assert (GTK_IS_WIDGET (active_widget));
 
-  ide_widget_action (GTK_WIDGET (active_widget), "view-stack", "show-list", NULL);
+  dzl_gtk_widget_action (GTK_WIDGET (active_widget), "view-stack", "show-list", NULL);
 
   return TRUE;
 }
@@ -909,7 +909,7 @@ gb_vim_command_help (GtkWidget      *active_widget,
   g_assert (GTK_IS_WIDGET (active_widget));
 
   param = g_variant_new_string (options);
-  ide_widget_action (GTK_WIDGET (active_widget), "workbench", "search-docs", param);
+  dzl_gtk_widget_action (GTK_WIDGET (active_widget), "workbench", "search-docs", param);
 
   return TRUE;
 }
@@ -1124,7 +1124,7 @@ gb_vim_command_search (GtkWidget      *active_widget,
       g_variant_builder_add (&builder, "s", replace_text);
       variant = g_variant_builder_end (&builder);
 
-      ide_widget_action (GTK_WIDGET (IDE_EDITOR_VIEW (active_widget)->frame1),
+      dzl_gtk_widget_action (GTK_WIDGET (IDE_EDITOR_VIEW (active_widget)->frame1),
                          "frame",
                          "replace-confirm",
                          variant);
diff --git a/plugins/devhelp/gbp-devhelp-editor-view-addin.c b/plugins/devhelp/gbp-devhelp-editor-view-addin.c
index 24b4639..c3d4b79 100644
--- a/plugins/devhelp/gbp-devhelp-editor-view-addin.c
+++ b/plugins/devhelp/gbp-devhelp-editor-view-addin.c
@@ -16,6 +16,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define G_LOG_DOMAIN "gbp-devhelp-editor-view-addin"
+
 #include "gbp-devhelp-editor-view-addin.h"
 #include "gbp-devhelp-panel.h"
 
@@ -46,7 +48,7 @@ request_documentation_cb (GbpDevhelpEditorViewAddin *self,
     return;
 
   pane = dzl_dock_bin_get_right_edge (DZL_DOCK_BIN (layout));
-  panel = ide_widget_find_child_typed (pane, GBP_TYPE_DEVHELP_PANEL);
+  panel = dzl_gtk_widget_find_child_typed (pane, GBP_TYPE_DEVHELP_PANEL);
   gbp_devhelp_panel_focus_search (GBP_DEVHELP_PANEL (panel), word);
 }
 
diff --git a/plugins/devhelp/gbp-devhelp-panel.c b/plugins/devhelp/gbp-devhelp-panel.c
index a24a313..c115516 100644
--- a/plugins/devhelp/gbp-devhelp-panel.c
+++ b/plugins/devhelp/gbp-devhelp-panel.c
@@ -120,7 +120,7 @@ gbp_devhelp_panel_constructed (GObject *object)
 
   self->sidebar = DH_SIDEBAR (dh_sidebar_new (self->books));
 
-  entry = ide_widget_find_child_typed (GTK_WIDGET (self->sidebar), GTK_TYPE_ENTRY);
+  entry = dzl_gtk_widget_find_child_typed (GTK_WIDGET (self->sidebar), GTK_TYPE_ENTRY);
   if (entry != NULL)
     {
       g_object_set (entry, "margin", 0, NULL);
diff --git a/plugins/flatpak/gbp-flatpak-clone-widget.c b/plugins/flatpak/gbp-flatpak-clone-widget.c
index 005f373..9dc0886 100644
--- a/plugins/flatpak/gbp-flatpak-clone-widget.c
+++ b/plugins/flatpak/gbp-flatpak-clone-widget.c
@@ -273,7 +273,7 @@ gbp_flatpak_clone_widget_worker_completed (GTask      *task,
                            DZL_ANIMATION_EASE_IN_OUT_QUAD,
                            ANIMATION_DURATION_MSEC,
                            NULL,
-                           (GDestroyNotify)ide_widget_hide_with_fade,
+                           (GDestroyNotify)dzl_gtk_widget_hide_with_fade,
                            self->clone_progress,
                            "fraction", 1.0,
                            NULL);
diff --git a/plugins/git/ide-git-clone-widget.c b/plugins/git/ide-git-clone-widget.c
index 7d10815..571f3fa 100644
--- a/plugins/git/ide-git-clone-widget.c
+++ b/plugins/git/ide-git-clone-widget.c
@@ -309,7 +309,7 @@ finish_animation_in_idle (gpointer data)
                            DZL_ANIMATION_EASE_IN_OUT_QUAD,
                            ANIMATION_DURATION_MSEC,
                            NULL,
-                           (GDestroyNotify)ide_widget_hide_with_fade,
+                           (GDestroyNotify) dzl_gtk_widget_hide_with_fade,
                            self->clone_progress,
                            "fraction", 1.0,
                            NULL);
diff --git a/plugins/project-tree/gb-project-tree-addin.c b/plugins/project-tree/gb-project-tree-addin.c
index 125f749..c2b90aa 100644
--- a/plugins/project-tree/gb-project-tree-addin.c
+++ b/plugins/project-tree/gb-project-tree-addin.c
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 #include <ide.h>
 
@@ -81,7 +82,7 @@ gb_project_tree_addin_load (IdeWorkbenchAddin *addin,
   content = ide_editor_perspective_get_center_widget (IDE_EDITOR_PERSPECTIVE (editor));
   g_assert (content != NULL);
 
-  grid = ide_widget_find_child_typed (content, IDE_TYPE_LAYOUT_GRID);
+  grid = dzl_gtk_widget_find_child_typed (content, IDE_TYPE_LAYOUT_GRID);
   g_assert (grid != NULL);
 
   g_signal_connect_object (grid,
diff --git a/plugins/sysprof/gbp-sysprof-workbench-addin.c b/plugins/sysprof/gbp-sysprof-workbench-addin.c
index df39de9..0786faa 100644
--- a/plugins/sysprof/gbp-sysprof-workbench-addin.c
+++ b/plugins/sysprof/gbp-sysprof-workbench-addin.c
@@ -509,7 +509,7 @@ gbp_sysprof_workbench_addin_load (IdeWorkbenchAddin *addin,
   self->zoom_controls = g_object_new (GTK_TYPE_BOX,
                                       "orientation", GTK_ORIENTATION_HORIZONTAL,
                                       NULL);
-  ide_widget_add_style_class (GTK_WIDGET (self->zoom_controls), "linked");
+  dzl_gtk_widget_add_style_class (GTK_WIDGET (self->zoom_controls), "linked");
   gtk_container_add (GTK_CONTAINER (self->zoom_controls),
                      g_object_new (GTK_TYPE_BUTTON,
                                    "action-name", "profiler-zoom.zoom-out",
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index f834006..d52950a 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -162,7 +162,7 @@ gb_terminal_view_wait_cb (GObject      *object,
   if (self == NULL)
     IDE_GOTO (failure);
 
-  if (!ide_widget_action (GTK_WIDGET (self), "view-stack", "close", NULL))
+  if (!dzl_gtk_widget_action (GTK_WIDGET (self), "view-stack", "close", NULL))
     {
       if (!gtk_widget_in_destruction (GTK_WIDGET (terminal)))
         gb_terminal_respawn (self, terminal);
diff --git a/plugins/terminal/gb-terminal.c b/plugins/terminal/gb-terminal.c
index 0e00fb0..636cc0b 100644
--- a/plugins/terminal/gb-terminal.c
+++ b/plugins/terminal/gb-terminal.c
@@ -264,7 +264,7 @@ gb_terminal_real_search_reveal (GbTerminal *self)
 
   if (parent_overlay != NULL)
     {
-      GtkRevealer *revealer = ide_widget_find_child_typed (parent_overlay, GTK_TYPE_REVEALER);
+      GtkRevealer *revealer = dzl_gtk_widget_find_child_typed (parent_overlay, GTK_TYPE_REVEALER);
 
       if (revealer != NULL && !gtk_revealer_get_child_revealed (revealer))
         gtk_revealer_set_reveal_child (revealer, TRUE);



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