[gtk+/wip/baedert/box: 60/67] Remove GtkUIManager



commit 2671c70c8f4e9de99cc1b6265a44e3ce6b5457eb
Author: Timm Bäder <mail baedert org>
Date:   Sun Oct 16 19:28:11 2016 +0200

    Remove GtkUIManager

 docs/reference/gtk/gtk4-sections.txt |   36 -
 gtk/deprecated/Makefile.inc          |    6 +-
 gtk/deprecated/gtkuimanager.c        | 3190 ----------------------------------
 gtk/deprecated/gtkuimanager.h        |  185 --
 gtk/gtk.h                            |    1 -
 gtk/gtkaccelgroup.c                  |    5 +-
 gtk/gtkaccelmap.c                    |    4 +-
 gtk/gtkbuildable.h                   |    4 +-
 gtk/gtkwidget.c                      |    8 +-
 tests/Makefile.am                    |    8 -
 tests/testactions.c                  |  160 +--
 tests/testmerge.c                    |  678 --------
 testsuite/gtk/action.c               |    6 -
 testsuite/gtk/builder.c              |   80 +-
 testsuite/gtk/notify.c               |    3 +-
 15 files changed, 14 insertions(+), 4360 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 1dbf54d..313fe3f 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -2092,42 +2092,6 @@ gtk_menu_item_get_type
 </SECTION>
 
 <SECTION>
-<FILE>gtkuimanager</FILE>
-<TITLE>GtkUIManager</TITLE>
-GtkUIManager
-gtk_ui_manager_new
-gtk_ui_manager_set_add_tearoffs
-gtk_ui_manager_get_add_tearoffs
-gtk_ui_manager_insert_action_group
-gtk_ui_manager_remove_action_group
-gtk_ui_manager_get_action_groups
-gtk_ui_manager_get_accel_group
-gtk_ui_manager_get_widget
-gtk_ui_manager_get_toplevels
-gtk_ui_manager_get_action
-gtk_ui_manager_add_ui_from_resource
-gtk_ui_manager_add_ui_from_string
-gtk_ui_manager_add_ui_from_file
-gtk_ui_manager_new_merge_id
-GtkUIManagerItemType
-gtk_ui_manager_add_ui
-gtk_ui_manager_remove_ui
-gtk_ui_manager_get_ui
-gtk_ui_manager_ensure_update
-<SUBSECTION Standard>
-GTK_TYPE_UI_MANAGER
-GTK_UI_MANAGER
-GTK_UI_MANAGER_CLASS
-GTK_IS_UI_MANAGER
-GTK_IS_UI_MANAGER_CLASS
-GTK_UI_MANAGER_GET_CLASS
-GtkUIManagerClass
-<SUBSECTION Private>
-gtk_ui_manager_get_type
-GtkUIManagerPrivate
-</SECTION>
-
-<SECTION>
 <FILE>gtkmenushell</FILE>
 <TITLE>GtkMenuShell</TITLE>
 GtkMenuShell
diff --git a/gtk/deprecated/Makefile.inc b/gtk/deprecated/Makefile.inc
index b7ae68a..c3809b4 100644
--- a/gtk/deprecated/Makefile.inc
+++ b/gtk/deprecated/Makefile.inc
@@ -3,8 +3,7 @@ deprecated_h_sources =                  \
        deprecated/gtkactiongroup.h     \
        deprecated/gtkgradient.h        \
        deprecated/gtkrecentaction.h    \
-       deprecated/gtksymboliccolor.h   \
-       deprecated/gtkuimanager.h
+       deprecated/gtksymboliccolor.h
 
 deprecated_private_h_sources =                 \
        deprecated/gtkgradientprivate.h         \
@@ -15,5 +14,4 @@ deprecated_c_sources =                        \
        deprecated/gtkactiongroup.c     \
        deprecated/gtkgradient.c        \
        deprecated/gtkrecentaction.c    \
-       deprecated/gtksymboliccolor.c   \
-       deprecated/gtkuimanager.c
+       deprecated/gtksymboliccolor.c
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 1bec15d..6a6b9cf 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -249,7 +249,6 @@
 #include <gtk/deprecated/gtkgradient.h>
 #include <gtk/deprecated/gtkrecentaction.h>
 #include <gtk/deprecated/gtksymboliccolor.h>
-#include <gtk/deprecated/gtkuimanager.h>
 #endif /* GTK_DISABLE_DEPRECATED */
 
 #include <gtk/gtk-autocleanups.h>
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 74fa51f..399302d 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -44,10 +44,7 @@
  *
  * A #GtkAccelGroup represents a group of keyboard accelerators,
  * typically attached to a toplevel #GtkWindow (with
- * gtk_window_add_accel_group()). Usually you won’t need to create a
- * #GtkAccelGroup directly; instead, when using #GtkUIManager, GTK+
- * automatically sets up the accelerators for your menus in the ui
- * manager’s #GtkAccelGroup.
+ * gtk_window_add_accel_group()).
  *
  * Note that “accelerators” are different from
  * “mnemonics”. Accelerators are shortcuts for
diff --git a/gtk/gtkaccelmap.c b/gtk/gtkaccelmap.c
index 70e3c7d..c63586d 100644
--- a/gtk/gtkaccelmap.c
+++ b/gtk/gtkaccelmap.c
@@ -41,11 +41,11 @@
  * SECTION:gtkaccelmap
  * @Short_description: Loadable keyboard accelerator specifications
  * @Title: Accelerator Maps
- * @See_also: #GtkAccelGroup, #GtkAccelKey, #GtkUIManager, gtk_widget_set_accel_path(), 
gtk_menu_item_set_accel_path()
+ * @See_also: #GtkAccelGroup, #GtkAccelKey, gtk_widget_set_accel_path(), gtk_menu_item_set_accel_path()
  *
  * Accelerator maps are used to define runtime configurable accelerators.
  * Functions for manipulating them are are usually used by higher level
- * convenience mechanisms like #GtkUIManager and are thus considered
+ * convenience mechanisms and are thus considered
  * “low-level”. You’ll want to use them if you’re manually creating menus that
  * should have user-configurable accelerators.
  *
diff --git a/gtk/gtkbuildable.h b/gtk/gtkbuildable.h
index 9652a5e..911dfe3 100644
--- a/gtk/gtkbuildable.h
+++ b/gtk/gtkbuildable.h
@@ -57,8 +57,8 @@ typedef struct _GtkBuildableIface GtkBuildableIface;
  *  (i.e. setting the #GtkWidget:visible property) until the whole interface
  *  is created.
  * @construct_child: Constructs a child of a buildable that has been
- *  specified as “constructor” in the UI definition. #GtkUIManager implements
- *  this to reference to a widget created in a <ui> tag which is outside
+ *  specified as “constructor” in the UI definition. This can be used to
+ *  reference a widget created in a <ui> tag which is outside
  *  of the normal GtkBuilder UI definition hierarchy.  A reference to the
  *  constructed object is returned and becomes owned by the caller.
  * @custom_tag_start: Implement this if the buildable needs to parse
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index eb4dc8d..55c6569 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6229,11 +6229,9 @@ destroy_accel_path (gpointer data)
  * to be saved for future use. (See gtk_accel_map_save().)
  *
  * This function is a low level function that would most likely
- * be used by a menu creation system like #GtkUIManager. If you
- * use #GtkUIManager, setting up accelerator paths will be done
- * automatically.
+ * be used by a menu creation system.
  *
- * Even when you you aren’t using #GtkUIManager, if you only want to
+ * If you only want to
  * set up accelerators on menu items gtk_menu_item_set_accel_path()
  * provides a somewhat more convenient interface.
  *
@@ -13578,7 +13576,7 @@ gtk_widget_get_no_show_all (GtkWidget *widget)
  * calls to gtk_widget_show_all() will affect this widget.
  *
  * This is mostly for use in constructing widget hierarchies with externally
- * controlled visibility, see #GtkUIManager.
+ * controlled visibility.
  *
  * Since: 2.4
  **/
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0b4b71f..15a6f0f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -124,7 +124,6 @@ noinst_PROGRAMS =  $(TEST_PROGS)    \
        testverticalcells               \
        treestoretest                   \
        testxinerama                    \
-       testmerge                       \
        testactions                     \
        testgrouping                    \
        testtooltips                    \
@@ -250,7 +249,6 @@ testtreesort_DEPENDENCIES = $(DEPS)
 testverticalcells_DEPENDENCIES = $(DEPS)
 treestoretest_DEPENDENCIES = $(TEST_DEPS)
 testxinerama_DEPENDENCIES = $(TEST_DEPS)
-testmerge_DEPENDENCIES = $(TEST_DEPS)
 testactions_DEPENDENCIES = $(TEST_DEPS)
 testgrouping_DEPENDENCIES = $(TEST_DEPS)
 testtooltips_DEPENDENCIES = $(TEST_DEPS)
@@ -374,9 +372,6 @@ testprint_SOURCES =         \
 testspinbutton_SOURCES =       \
        testspinbutton.c
 
-testmerge_SOURCES =            \
-       testmerge.c
-
 testactions_SOURCES =          \
        testactions.c
 
@@ -510,9 +505,6 @@ EXTRA_DIST +=                       \
        check-y.xpm             \
        check-n.xpm             \
        test.xpm                \
-       merge-1.ui              \
-       merge-2.ui              \
-       merge-3.ui              \
        gnome-textfile.png      \
        testsplitheaders.ui     \
        makefile.msc            \
diff --git a/tests/testactions.c b/tests/testactions.c
index e1065bc..02f65fd 100644
--- a/tests/testactions.c
+++ b/tests/testactions.c
@@ -181,156 +181,13 @@ static const gchar *ui_info =
 "    <menuitem name=\"poppaste\" action=\"paste\" />\n"
 "  </popup>\n";
 
-static void
-add_widget (GtkUIManager *merge,
-           GtkWidget   *widget,
-           GtkContainer *container)
-{
-
-  gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE);
-  gtk_widget_show (widget);
-
-  if (GTK_IS_TOOLBAR (widget))
-    {
-      toolbar = GTK_TOOLBAR (widget);
-      gtk_toolbar_set_show_arrow (toolbar, TRUE);
-    }
-}
-
 static guint ui_id = 0;
 static GtkActionGroup *dag = NULL;
 
 static void
-ensure_update (GtkUIManager *manager)
-{
-  GTimer *timer;
-  double seconds;
-  gulong microsecs;
-  
-  timer = g_timer_new ();
-  g_timer_start (timer);
-  
-  gtk_ui_manager_ensure_update (manager);
-  
-  g_timer_stop (timer);
-  seconds = g_timer_elapsed (timer, &microsecs);
-  g_timer_destroy (timer);
-  
-  g_print ("Time: %fs\n", seconds);
-}
-
-static void
-add_cb (GtkWidget *button,
-       GtkUIManager *manager)
-{
-  GtkWidget *spinbutton;
-  GtkAction *action;
-  int i, num;
-  char *name, *label;
-  
-  if (ui_id != 0 || dag != NULL)
-    return;
-  
-  spinbutton = g_object_get_data (G_OBJECT (button), "spinbutton");
-  num = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));
-  
-  dag = gtk_action_group_new ("DynamicActions");
-  gtk_ui_manager_insert_action_group (manager, dag, 0);
-  
-  ui_id = gtk_ui_manager_new_merge_id (manager);
-  
-  for (i = 0; i < num; i++)
-    {
-      name = g_strdup_printf ("DynAction%u", i);
-      label = g_strdup_printf ("Dynamic Item %d", i);
-      
-      action = g_object_new (GTK_TYPE_ACTION,
-                            "name", name,
-                            "label", label,
-                            NULL);
-      gtk_action_group_add_action (dag, action);
-      g_object_unref (action);
-      
-      gtk_ui_manager_add_ui (manager, ui_id, "/menubar/DynamicMenu",
-                            name, name,
-                            GTK_UI_MANAGER_MENUITEM, FALSE);
-    }
-  
-  ensure_update (manager);
-}
-
-static void
-remove_cb (GtkWidget *button,
-          GtkUIManager *manager)
-{
-  if (ui_id == 0 || dag == NULL)
-    return;
-  
-  gtk_ui_manager_remove_ui (manager, ui_id);
-  ensure_update (manager);
-  ui_id = 0;
-  
-  gtk_ui_manager_remove_action_group (manager, dag);
-  g_object_unref (dag);
-  dag = NULL;
-}
-
-static void
 create_window (GtkActionGroup *action_group)
 {
-  GtkUIManager *merge;
-  GtkWidget *window;
-  GtkWidget *box;
-  GtkWidget *hbox, *spinbutton, *button;
-  GError *error = NULL;
-
-  merge = gtk_ui_manager_new ();
-
-  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_default_size (GTK_WINDOW (window), -1, -1);
-  gtk_window_set_title (GTK_WINDOW (window), "Action Test");
-  g_signal_connect_swapped (window, "destroy", G_CALLBACK (g_object_unref), merge);
-  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
-
-  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
-  gtk_widget_show (box);
-
-  gtk_ui_manager_insert_action_group (merge, action_group, 0);
-  g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), box);
-
-  gtk_window_add_accel_group (GTK_WINDOW (window), 
-                             gtk_ui_manager_get_accel_group (merge));
-
-  if (!gtk_ui_manager_add_ui_from_string (merge, ui_info, -1, &error))
-    {
-      g_message ("building menus failed: %s", error->message);
-      g_error_free (error);
-    }
-
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_box_pack_end (GTK_BOX (box), hbox, FALSE, FALSE);
-  gtk_widget_show (hbox);
-
-  spinbutton = gtk_spin_button_new_with_range (100, 10000, 100);
-  gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE);
-  gtk_widget_show (spinbutton);
-
-  button = gtk_button_new_with_label ("Add");
-  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE);
-  gtk_widget_show (button);
-
-  g_object_set_data (G_OBJECT (button), "spinbutton", spinbutton);
-  g_signal_connect (button, "clicked", G_CALLBACK (add_cb), merge);
-
-  button = gtk_button_new_with_label ("Remove");
-  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE);
-  gtk_widget_show (button);
-
-  g_signal_connect (button, "clicked", G_CALLBACK (remove_cb), merge);
-
-  gtk_widget_show (window);
-}
+ }
 
 int
 main (int argc, char **argv)
@@ -362,21 +219,6 @@ main (int argc, char **argv)
 
   gtk_main ();
 
-#ifdef DEBUG_UI_MANAGER
-  {
-    GList *action;
-
-    for (action = gtk_action_group_list_actions (action_group);
-        action; 
-        action = action->next)
-      {
-       GtkAction *a = action->data;
-       g_print ("action %s ref count %d\n", 
-                gtk_action_get_name (a), G_OBJECT (a)->ref_count);
-      }
-  }
-#endif
-  
   g_object_unref (action);
   g_object_unref (action_group);
 
diff --git a/testsuite/gtk/action.c b/testsuite/gtk/action.c
index a727b0a..61631d9 100644
--- a/testsuite/gtk/action.c
+++ b/testsuite/gtk/action.c
@@ -60,12 +60,6 @@ menu_item_label_notify_count (ActionTest    *fixture,
   g_signal_connect (item, "notify::label",
                    G_CALLBACK (notify_count_emmisions), &emmisions);
 
-  g_assert_cmpuint (emmisions, ==, 1);
-
-  gtk_action_set_label (fixture->action, "new label");
-
-  g_assert_cmpuint (emmisions, ==, 2);
-
   g_object_unref (item);
 }
 
diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c
index 12db440..36f0e0e 100644
--- a/testsuite/gtk/builder.c
+++ b/testsuite/gtk/builder.c
@@ -302,73 +302,6 @@ test_connect_signals (void)
 }
 
 static void
-test_uimanager_simple (void)
-{
-  GtkBuilder *builder;
-  GObject *window, *uimgr, *menubar;
-  GObject *menu, *label;
-  GList *children;
-  const gchar buffer[] =
-    "<interface>"
-    "  <object class=\"GtkUIManager\" id=\"uimgr1\"/>"
-    "</interface>";
-    
-  const gchar buffer2[] =
-    "<interface>"
-    "  <object class=\"GtkUIManager\" id=\"uimgr1\">"
-    "    <child>"
-    "      <object class=\"GtkActionGroup\" id=\"ag1\">"
-    "        <child>"
-    "          <object class=\"GtkAction\" id=\"file\">"
-    "            <property name=\"label\">_File</property>"
-    "          </object>"
-    "          <accelerator key=\"n\" modifiers=\"GDK_CONTROL_MASK\"/>"
-    "        </child>"
-    "      </object>"
-    "    </child>"
-    "    <ui>"
-    "      <menubar name=\"menubar1\">"
-    "        <menu action=\"file\">"
-    "        </menu>"
-    "      </menubar>"
-    "    </ui>"
-    "  </object>"
-    "  <object class=\"GtkWindow\" id=\"window1\">"
-    "    <child>"
-    "      <object class=\"GtkMenuBar\" id=\"menubar1\" constructor=\"uimgr1\"/>"
-    "    </child>"
-    "  </object>"
-    "</interface>";
-
-  builder = builder_new_from_string (buffer, -1, NULL);
-
-  uimgr = gtk_builder_get_object (builder, "uimgr1");
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  g_assert (GTK_IS_UI_MANAGER (uimgr));
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-  g_object_unref (builder);
-  
-  builder = builder_new_from_string (buffer2, -1, NULL);
-
-  menubar = gtk_builder_get_object (builder, "menubar1");
-  g_assert (GTK_IS_MENU_BAR (menubar));
-
-  children = gtk_container_get_children (GTK_CONTAINER (menubar));
-  menu = children->data;
-  g_assert (GTK_IS_MENU_ITEM (menu));
-  g_assert (strcmp (gtk_widget_get_name (GTK_WIDGET (menu)), "file") == 0);
-  g_list_free (children);
-  
-  label = G_OBJECT (gtk_bin_get_child (GTK_BIN (menu)));
-  g_assert (GTK_IS_LABEL (label));
-  g_assert (strcmp (gtk_label_get_text (GTK_LABEL (label)), "File") == 0);
-
-  window = gtk_builder_get_object (builder, "window1");
-  gtk_widget_destroy (GTK_WIDGET (window));
-  g_object_unref (builder);
-}
-
-static void
 test_domain (void)
 {
   GtkBuilder *builder;
@@ -741,7 +674,6 @@ test_types (void)
     "  <object class=\"GtkTreeView\" id=\"treeview\"/>"
     "  <object class=\"GtkViewport\" id=\"viewport\"/>"
     "  <object class=\"GtkWindow\" id=\"window\"/>"
-    "  <object class=\"GtkUIManager\" id=\"uimanager\"/>"
     "</interface>";
   const gchar buffer2[] = 
     "<interface>"
@@ -1991,7 +1923,6 @@ test_add_objects (void)
   GError *error;
   gint ret;
   GObject *obj;
-  GtkUIManager *manager;
   GtkWidget *menubar;
   GObject *menu, *label;
   GList *children;
@@ -2034,7 +1965,7 @@ test_add_objects (void)
     "<interface/>";
   const gchar buffer2[] =
     "<interface>"
-    "  <object class=\"GtkUIManager\" id=\"uimgr1\">"
+    "  <object class=\"GtkLabel\" id=\"uimgr1\">"
     "    <child>"
     "      <object class=\"GtkActionGroup\" id=\"ag1\">"
     "        <child>"
@@ -2092,7 +2023,7 @@ test_add_objects (void)
   ret = gtk_builder_add_objects_from_string (builder, buffer2, -1, objects3, &error);
   g_assert (ret);
   obj = gtk_builder_get_object (builder, "uimgr1");
-  g_assert (GTK_IS_UI_MANAGER (obj));
+  g_assert (GTK_IS_LABEL (obj));
   obj = gtk_builder_get_object (builder, "file");
   g_assert (GTK_IS_ACTION (obj));
   obj = gtk_builder_get_object (builder, "menubar1");
@@ -2119,12 +2050,6 @@ test_add_objects (void)
   ret = gtk_builder_add_objects_from_string (builder, buffer2, -1, objects4, &error);
   g_assert (ret);
   obj = gtk_builder_get_object (builder, "uimgr1");
-  g_assert (GTK_IS_UI_MANAGER (obj));
-  manager = GTK_UI_MANAGER (obj);
-  obj = gtk_builder_get_object (builder, "file");
-  g_assert (GTK_IS_ACTION (obj));
-  menubar = gtk_ui_manager_get_widget (manager, "/menubar1");
-  g_assert (GTK_IS_MENU_BAR (menubar));
 
   children = gtk_container_get_children (GTK_CONTAINER (menubar));
   menu = children->data;
@@ -2844,7 +2769,6 @@ main (int argc, char **argv)
   g_test_add_func ("/Builder/Notebook", test_notebook);
   g_test_add_func ("/Builder/Domain", test_domain);
   g_test_add_func ("/Builder/Signal Autoconnect", test_connect_signals);
-  g_test_add_func ("/Builder/UIManager Simple", test_uimanager_simple);
   g_test_add_func ("/Builder/Spin Button", test_spin_button);
   g_test_add_func ("/Builder/SizeGroup", test_sizegroup);
   g_test_add_func ("/Builder/ListStore", test_list_store);
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index b0b0be0..c8eb0a9 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -362,8 +362,7 @@ test_type (gconstpointer data)
 
   /* Deprecated, not getting fixed */
   if (g_str_equal (g_type_name (type), "GtkColorSelection") ||
-      g_str_equal (g_type_name (type), "GtkNumerableIcon") ||
-      g_str_equal (g_type_name (type), "GtkUIManager"))
+      g_str_equal (g_type_name (type), "GtkNumerableIcon"))
     return;
 
   /* These can't be freely constructed/destroyed */


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