From 449440e7bc1edfe6eaefe42e9afb4046b88368ce Mon Sep 17 00:00:00 2001 From: raveit65 Date: Fri, 19 Jul 2019 16:28:31 +0200 Subject: egg-editable-toolbar: suppress GtkAction warnings --- cut-n-paste/toolbar-editor/egg-editable-toolbar.c | 68 ++++++++++++++++------- 1 file changed, 49 insertions(+), 19 deletions(-) (limited to 'cut-n-paste/toolbar-editor/egg-editable-toolbar.c') diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c index 9bc9405..5097c2a 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c @@ -161,11 +161,13 @@ find_action (EggEditableToolbar *etoolbar, for (; l != NULL; l = l->next) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; GtkAction *tmp; tmp = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name); if (tmp) - action = tmp; + action = tmp; + G_GNUC_END_IGNORE_DEPRECATIONS; } return action; @@ -196,22 +198,27 @@ drag_begin_cb (GtkWidget *widget, EggEditableToolbar *etoolbar) { GtkAction *action; + const gchar *action_name; gint flags; gtk_widget_hide (widget); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget)); if (action == NULL) return; + action_name = gtk_action_get_name (action); + G_GNUC_END_IGNORE_DEPRECATIONS; + flags = egg_toolbars_model_get_name_flags (etoolbar->priv->model, - gtk_action_get_name (action)); + action_name); if (!(flags & EGG_TB_MODEL_NAME_INFINITE)) { flags &= ~EGG_TB_MODEL_NAME_USED; egg_toolbars_model_set_name_flags (etoolbar->priv->model, - gtk_action_get_name (action), - flags); + action_name, + flags); } } @@ -221,25 +228,30 @@ drag_end_cb (GtkWidget *widget, EggEditableToolbar *etoolbar) { GtkAction *action; + const gchar *action_name; gint flags; if (gtk_widget_get_parent (widget) != NULL) { gtk_widget_show (widget); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget)); if (action == NULL) return; + action_name = gtk_action_get_name (action); + G_GNUC_END_IGNORE_DEPRECATIONS; + flags = egg_toolbars_model_get_name_flags (etoolbar->priv->model, - gtk_action_get_name (action)); + action_name); if (!(flags & EGG_TB_MODEL_NAME_INFINITE)) { - flags |= EGG_TB_MODEL_NAME_USED; - egg_toolbars_model_set_name_flags (etoolbar->priv->model, - gtk_action_get_name (action), - flags); - } + flags |= EGG_TB_MODEL_NAME_USED; + egg_toolbars_model_set_name_flags (etoolbar->priv->model, + action_name, + flags); + } } } @@ -504,7 +516,9 @@ configure_item_tooltip (GtkToolItem *item) { GtkAction *action; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (item)); + G_GNUC_END_IGNORE_DEPRECATIONS; if (action != NULL) { @@ -583,6 +597,7 @@ create_item_from_action (EggEditableToolbar *etoolbar, GtkAction *action = find_action (etoolbar, name); if (action == NULL) return NULL; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; item = GTK_TOOL_ITEM (gtk_action_create_tool_item (action)); /* Normally done on-demand by the GtkUIManager, but no @@ -590,6 +605,7 @@ create_item_from_action (EggEditableToolbar *etoolbar, */ gtk_action_set_accel_group (action, gtk_ui_manager_get_accel_group(etoolbar->priv->manager)); + G_GNUC_END_IGNORE_DEPRECATIONS; g_signal_connect_object (action, "notify::sensitive", G_CALLBACK (action_sensitive_cb), item, 0); @@ -803,7 +819,9 @@ toggled_visibility_cb (GtkToggleAction *action, gboolean visible; gint i; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; visible = gtk_toggle_action_get_active (action); + G_GNUC_END_IGNORE_DEPRECATIONS; for (i = 0; i < priv->visibility_actions->len; i++) if (g_ptr_array_index (priv->visibility_actions, i) == action) break; @@ -934,24 +952,30 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) if (i >= priv->visibility_actions->len) { - action = gtk_toggle_action_new (action_name, action_label, NULL, NULL); - g_ptr_array_add (priv->visibility_actions, action); - g_signal_connect_object (action, "toggled", - G_CALLBACK (toggled_visibility_cb), - etoolbar, 0); - gtk_action_group_add_action (priv->actions, GTK_ACTION (action)); - } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + action = gtk_toggle_action_new (action_name, action_label, NULL, NULL); + G_GNUC_END_IGNORE_DEPRECATIONS; + g_ptr_array_add (priv->visibility_actions, action); + g_signal_connect_object (action, "toggled", + G_CALLBACK (toggled_visibility_cb), + etoolbar, 0); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + gtk_action_group_add_action (priv->actions, GTK_ACTION (action)); + G_GNUC_END_IGNORE_DEPRECATIONS; + } else { action = g_ptr_array_index (priv->visibility_actions, i); g_object_set (action, "label", action_label, NULL); } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_action_set_visible (GTK_ACTION (action), (egg_toolbars_model_get_flags (priv->model, i) - & EGG_TB_MODEL_NOT_REMOVABLE) == 0); + & EGG_TB_MODEL_NOT_REMOVABLE) == 0); gtk_action_set_sensitive (GTK_ACTION (action), showing); gtk_toggle_action_set_active (action, gtk_widget_get_visible - (get_dock_nth (etoolbar, i))); + (get_dock_nth (etoolbar, i))); + G_GNUC_END_IGNORE_DEPRECATIONS; for (list = priv->visibility_paths; list != NULL; list = g_list_next (list)) { @@ -969,7 +993,9 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) { action = g_ptr_array_index (priv->visibility_actions, i); g_ptr_array_remove_index_fast (priv->visibility_actions, i); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_action_group_remove_action (priv->actions, GTK_ACTION (action)); + G_GNUC_END_IGNORE_DEPRECATIONS; i++; } } @@ -1403,10 +1429,12 @@ egg_editable_toolbar_set_ui_manager (EggEditableToolbar *etoolbar, etoolbar->priv->manager = g_object_ref (manager); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; etoolbar->priv->actions = gtk_action_group_new ("ToolbarActions"); gtk_action_group_set_translation_domain (etoolbar->priv->actions, GETTEXT_PACKAGE); gtk_action_group_add_actions (etoolbar->priv->actions, actions, G_N_ELEMENTS (actions), etoolbar); + G_GNUC_END_IGNORE_DEPRECATIONS; gtk_ui_manager_insert_action_group (manager, etoolbar->priv->actions, -1); g_object_unref (etoolbar->priv->actions); @@ -1440,9 +1468,11 @@ egg_editable_toolbar_set_selected (EggEditableToolbar *etoolbar, editable = FALSE; } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_action_set_visible (find_action (etoolbar, "RemoveToolbar"), (toolbar != NULL) && (etoolbar->priv->edit_mode > 0)); gtk_action_set_visible (find_action (etoolbar, "RemoveToolItem"), (toolitem != NULL) && editable); gtk_action_set_visible (find_action (etoolbar, "MoveToolItem"), (toolitem != NULL) && editable); + G_GNUC_END_IGNORE_DEPRECATIONS; } static void -- cgit v1.2.1