[gtk+/wip/baedert/box: 55/67] Remove GtkToggleAction



commit 24205dd12ee3e70172ebbdf7b981737d5aa9a37d
Author: Timm Bäder <mail baedert org>
Date:   Sun Oct 16 18:08:39 2016 +0200

    Remove GtkToggleAction

 gtk/deprecated/Makefile.inc      |    2 -
 gtk/deprecated/gtkactiongroup.c  |   13 +--
 gtk/deprecated/gtktoggleaction.c |  401 --------------------------------------
 gtk/deprecated/gtktoggleaction.h |   99 ----------
 gtk/gtk.h                        |    1 -
 gtk/gtkcheckmenuitem.c           |    1 -
 gtk/gtktogglebutton.c            |    1 -
 gtk/gtktoggletoolbutton.c        |   71 +-------
 tests/testactions.c              |   27 +---
 tests/testmerge.c                |   21 --
 testsuite/gtk/builder.c          |    1 -
 testsuite/gtk/notify.c           |    1 -
 12 files changed, 3 insertions(+), 636 deletions(-)
---
diff --git a/gtk/deprecated/Makefile.inc b/gtk/deprecated/Makefile.inc
index 706061a..3968788 100644
--- a/gtk/deprecated/Makefile.inc
+++ b/gtk/deprecated/Makefile.inc
@@ -5,7 +5,6 @@ deprecated_h_sources =                  \
        deprecated/gtkgradient.h        \
        deprecated/gtkrecentaction.h    \
        deprecated/gtksymboliccolor.h   \
-       deprecated/gtktoggleaction.h    \
        deprecated/gtkuimanager.h
 
 deprecated_private_h_sources =                 \
@@ -19,5 +18,4 @@ deprecated_c_sources =                        \
        deprecated/gtkgradient.c        \
        deprecated/gtkrecentaction.c    \
        deprecated/gtksymboliccolor.c   \
-       deprecated/gtktoggleaction.c    \
        deprecated/gtkuimanager.c
diff --git a/gtk/deprecated/gtkactiongroup.c b/gtk/deprecated/gtkactiongroup.c
index f1e8798..3de54f9 100644
--- a/gtk/deprecated/gtkactiongroup.c
+++ b/gtk/deprecated/gtkactiongroup.c
@@ -91,7 +91,6 @@
 #include "gtkactiongroup.h"
 #include "gtkbuildable.h"
 #include "gtkicontheme.h"
-#include "gtktoggleaction.h"
 #include "gtkaccelmap.h"
 #include "gtkmarshalers.h"
 #include "gtkbuilderprivate.h"
@@ -1283,7 +1282,7 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup             *action_gro
 
   for (i = 0; i < n_entries; i++)
     {
-      GtkToggleAction *action;
+      GtkAction *action;
       const gchar *label;
       const gchar *tooltip;
 
@@ -1293,18 +1292,11 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup             *action_gro
       label = gtk_action_group_translate_string (action_group, entries[i].label);
       tooltip = gtk_action_group_translate_string (action_group, entries[i].tooltip);
 
-      action = gtk_toggle_action_new (entries[i].name,
-                                     label,
-                                     tooltip,
-                                     NULL);
-
       if (entries[i].stock_id) 
        {
           g_object_set (action, "icon-name", entries[i].stock_id, NULL);
        }
 
-      gtk_toggle_action_set_active (action, entries[i].is_active);
-
       if (entries[i].callback)
        {
          GClosure *closure;
@@ -1417,9 +1409,6 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup            *action_group
       if (i == 0) 
        first_action = action;
 
-      if (value == entries[i].value)
-       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-
       gtk_action_group_add_action_with_accel (action_group, 
                                              GTK_ACTION (action),
                                              entries[i].accelerator);
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 5dc0da6..262c27a 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -250,7 +250,6 @@
 #include <gtk/deprecated/gtkgradient.h>
 #include <gtk/deprecated/gtkrecentaction.h>
 #include <gtk/deprecated/gtksymboliccolor.h>
-#include <gtk/deprecated/gtktoggleaction.h>
 #include <gtk/deprecated/gtkuimanager.h>
 #endif /* GTK_DISABLE_DEPRECATED */
 
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index b86a01b..c45084e 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -27,7 +27,6 @@
 #include "gtkcheckmenuitemprivate.h"
 #include "gtkmenuitemprivate.h"
 #include "gtkaccellabel.h"
-#include "deprecated/gtktoggleaction.h"
 #include "gtkmarshalers.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index d588e5b..e2e5c7e 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -31,7 +31,6 @@
 #include "gtklabel.h"
 #include "gtkmain.h"
 #include "gtkmarshalers.h"
-#include "deprecated/gtktoggleaction.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 #include "a11y/gtktogglebuttonaccessible.h"
diff --git a/gtk/gtktoggletoolbutton.c b/gtk/gtktoggletoolbutton.c
index 531ebe7..76a3880 100644
--- a/gtk/gtktoggletoolbutton.c
+++ b/gtk/gtktoggletoolbutton.c
@@ -24,8 +24,6 @@
 #include "gtktogglebutton.h"
 #include "gtkintl.h"
 #include "gtkradiotoolbutton.h"
-#include "deprecated/gtktoggleaction.h"
-#include "deprecated/gtkactivatable.h"
 #include "gtkprivate.h"
 
 
@@ -82,22 +80,10 @@ static void menu_item_activated (GtkWidget           *widget,
                                 GtkToggleToolButton *button);
 
 
-static void gtk_toggle_tool_button_activatable_interface_init (GtkActivatableIface  *iface);
-static void gtk_toggle_tool_button_update                     (GtkActivatable       *activatable,
-                                                              GtkAction            *action,
-                                                              const gchar          *property_name);
-static void gtk_toggle_tool_button_sync_action_properties     (GtkActivatable       *activatable,
-                                                              GtkAction            *action);
-
-static GtkActivatableIface *parent_activatable_iface;
 static guint                toggle_signals[LAST_SIGNAL] = { 0 };
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
 G_DEFINE_TYPE_WITH_CODE (GtkToggleToolButton, gtk_toggle_tool_button, GTK_TYPE_TOOL_BUTTON,
-                         G_ADD_PRIVATE (GtkToggleToolButton)
-                        G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
-                                               gtk_toggle_tool_button_activatable_interface_init))
-G_GNUC_END_IGNORE_DEPRECATIONS;
+                         G_ADD_PRIVATE (GtkToggleToolButton));
 
 static void
 gtk_toggle_tool_button_class_init (GtkToggleToolButtonClass *klass)
@@ -322,61 +308,6 @@ button_toggled (GtkWidget           *widget,
     }
 }
 
-static void
-gtk_toggle_tool_button_activatable_interface_init (GtkActivatableIface *iface)
-{
-  parent_activatable_iface = g_type_interface_peek_parent (iface);
-  iface->update = gtk_toggle_tool_button_update;
-  iface->sync_action_properties = gtk_toggle_tool_button_sync_action_properties;
-}
-
-static void
-gtk_toggle_tool_button_update (GtkActivatable *activatable,
-                              GtkAction      *action,
-                              const gchar    *property_name)
-{
-  GtkToggleToolButton *button;
-
-  parent_activatable_iface->update (activatable, action, property_name);
-
-  button = GTK_TOGGLE_TOOL_BUTTON (activatable);
-
-  if (strcmp (property_name, "active") == 0)
-    {
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-      gtk_action_block_activate (action);
-      gtk_toggle_tool_button_set_active (button, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
-      gtk_action_unblock_activate (action);
-      G_GNUC_END_IGNORE_DEPRECATIONS;
-    }
-}
-
-static void
-gtk_toggle_tool_button_sync_action_properties (GtkActivatable *activatable,
-                                              GtkAction      *action)
-{
-  GtkToggleToolButton *button;
-  gboolean is_toggle_action;
-
-  parent_activatable_iface->sync_action_properties (activatable, action);
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  is_toggle_action = GTK_IS_TOGGLE_ACTION (action);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
-  if (!is_toggle_action)
-    return;
-
-  button = GTK_TOGGLE_TOOL_BUTTON (activatable);
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  gtk_action_block_activate (action);
-  gtk_toggle_tool_button_set_active (button, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
-  gtk_action_unblock_activate (action);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-}
-
-
 /**
  * gtk_toggle_tool_button_new:
  * 
diff --git a/tests/testactions.c b/tests/testactions.c
index 2e15bc4..e1065bc 100644
--- a/tests/testactions.c
+++ b/tests/testactions.c
@@ -32,17 +32,6 @@ activate_action (GtkAction *action)
 }
 
 static void
-toggle_action (GtkAction *action)
-{
-  const gchar *name = gtk_action_get_name (action);
-  const gchar *typename = G_OBJECT_TYPE_NAME (action);
-
-  g_message ("Action %s (type=%s) activated (active=%d)", name, typename,
-            gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
-}
-
-
-static void
 recent_action (GtkAction *action)
 {
   const gchar *name = gtk_action_get_name (action);
@@ -58,9 +47,8 @@ recent_action (GtkAction *action)
 static void
 toggle_cnp_actions (GtkAction *action)
 {
-  gboolean sensitive;
+  gboolean sensitive = FALSE;
 
-  sensitive = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
   action = gtk_action_group_get_action (action_group, "cut");
   g_object_set (action, "sensitive", sensitive, NULL);
   action = gtk_action_group_get_action (action_group, "copy");
@@ -122,16 +110,6 @@ static GtkActionEntry entries[] = {
 };
 static guint n_entries = G_N_ELEMENTS (entries);
 
-static GtkToggleActionEntry toggle_entries[] = {
-  { "bold", NULL, "_Bold", "<control>B",
-    "Change to bold face", 
-    G_CALLBACK (toggle_action), FALSE },
-  { "toggle-cnp", NULL, "Enable Cut/Copy/Paste", NULL,
-    "Change the sensitivity of the cut, copy and paste actions",
-    G_CALLBACK (toggle_cnp_actions), TRUE },
-};
-static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
-
 enum {
   JUSTIFY_LEFT,
   JUSTIFY_CENTER,
@@ -378,9 +356,6 @@ main (int argc, char **argv)
   gtk_action_group_add_actions (action_group, 
                                entries, n_entries, 
                                NULL);
-  gtk_action_group_add_toggle_actions (action_group, 
-                                      toggle_entries, n_toggle_entries, 
-                                      NULL);
   gtk_action_group_add_action_with_accel (action_group, action, NULL);
 
   create_window (action_group);
diff --git a/tests/testmerge.c b/tests/testmerge.c
index b4f7993..6221e08 100644
--- a/tests/testmerge.c
+++ b/tests/testmerge.c
@@ -142,17 +142,6 @@ activate_action (GtkAction *action)
   g_message ("Action %s (type=%s) activated", name, typename);
 }
 
-static void
-toggle_action (GtkAction *action)
-{
-  const gchar *name = gtk_action_get_name (action);
-  const gchar *typename = G_OBJECT_TYPE_NAME (action);
-
-  g_message ("ToggleAction %s (type=%s) toggled (active=%d)", name, typename,
-            gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
-}
-
-
 static GtkActionEntry entries[] = {
   { "FileMenuAction", NULL, "_File" },
   { "EditMenuAction", NULL, "_Edit" },
@@ -173,12 +162,6 @@ static GtkActionEntry entries[] = {
 };
 static guint n_entries = G_N_ELEMENTS (entries);
 
-static GtkToggleActionEntry toggle_entries[] = {
-  { "BoldAction",  NULL,  "_Bold",  "<control>b", "Make it bold", G_CALLBACK (toggle_action),
-    TRUE },
-};
-static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
-
 enum {
   JUSTIFY_LEFT,
   JUSTIFY_CENTER,
@@ -560,10 +543,6 @@ main (int argc, char **argv)
   g_object_set (action, "hide_if_empty", FALSE, NULL);
   action = gtk_action_group_get_action (action_group, "EmptyMenu2Action");
   g_object_set (action, "hide_if_empty", TRUE, NULL);
-  gtk_action_group_add_toggle_actions (action_group, 
-                                      toggle_entries, n_toggle_entries, 
-                                      NULL);
-
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_default_size (GTK_WINDOW (window), -1, 400);
   g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c
index 0557092..12db440 100644
--- a/testsuite/gtk/builder.c
+++ b/testsuite/gtk/builder.c
@@ -735,7 +735,6 @@ test_types (void)
     "  <object class=\"GtkSpinButton\" id=\"spinbutton\"/>"
     "  <object class=\"GtkStatusbar\" id=\"statusbar\"/>"
     "  <object class=\"GtkTextView\" id=\"textview\"/>"
-    "  <object class=\"GtkToggleAction\" id=\"toggleaction\"/>"
     "  <object class=\"GtkToggleButton\" id=\"togglebutton\"/>"
     "  <object class=\"GtkToolbar\" id=\"toolbar\"/>"
     "  <object class=\"GtkTreeStore\" id=\"treestore\"/>"
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index c56db0a..30131f3 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -363,7 +363,6 @@ 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), "GtkToggleAction") ||
       g_str_equal (g_type_name (type), "GtkUIManager"))
     return;
 


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