app: GtkAction -> GAction madness part two

Change all action callbacks so they can be invoked by a GAction:

- add GimpActionCallback typedef:
  void (* cb) (GimpAction*, GVariant*, gpointer)
- change all action callbacks to the GimpActionCallback signature
- add "gimp-activate" and "gimp-change-state" signals to GimpAction,
  with the same signature as the resp. GAction signals
- remove all other custom action signals and only use the new
  GimpAction signals
- pass around appropriate GVariants containing booleans, int32,
  strings
- badly hack around to force a GimpProcedure pointer into a
  uint64 variant
- remove all G_CALLBACK() casts from all action callbacks,
  they all have the same signature now

(cherry picked from commit 3b6b3fc189)
This commit is contained in:
Michael Natterer
2019-07-04 01:11:48 +02:00
parent 0146ce354b
commit ff7ca87c09
146 changed files with 2452 additions and 1695 deletions

View File

@ -30,7 +30,6 @@
#include "widgets/gimperrorconsole.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimptextbuffer.h"
#include "widgets/gimptoggleaction.h"
#include "error-console-commands.h"
@ -48,6 +47,7 @@ static void error_console_save_response (GtkWidget *dialog,
void
error_console_clear_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
@ -60,6 +60,7 @@ error_console_clear_cmd_callback (GimpAction *action,
void
error_console_select_all_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
@ -72,13 +73,15 @@ error_console_select_all_cmd_callback (GimpAction *action,
void
error_console_save_cmd_callback (GimpAction *action,
gint value,
GVariant *value,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
gboolean selection = (gboolean) g_variant_get_int32 (value);
if (value && ! gtk_text_buffer_get_selection_bounds (console->text_buffer,
NULL, NULL))
if (selection &&
! gtk_text_buffer_get_selection_bounds (console->text_buffer,
NULL, NULL))
{
gimp_message_literal (console->gimp,
G_OBJECT (console), GIMP_MESSAGE_WARNING,
@ -105,7 +108,7 @@ error_console_save_cmd_callback (GimpAction *action,
GTK_RESPONSE_CANCEL,
-1);
console->save_selection = value;
console->save_selection = selection;
g_object_add_weak_pointer (G_OBJECT (dialog),
(gpointer) &console->file_dialog);
@ -134,36 +137,33 @@ error_console_save_cmd_callback (GimpAction *action,
void
error_console_highlight_error_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
gboolean active;
active = gimp_toggle_action_get_active (GIMP_TOGGLE_ACTION (action));
gboolean active = g_variant_get_boolean (value);
console->highlight[GIMP_MESSAGE_ERROR] = active;
}
void
error_console_highlight_warning_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
gboolean active;
active = gimp_toggle_action_get_active (GIMP_TOGGLE_ACTION (action));
gboolean active = g_variant_get_boolean (value);
console->highlight[GIMP_MESSAGE_WARNING] = active;
}
void
error_console_highlight_info_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
gboolean active;
active = gimp_toggle_action_get_active (GIMP_TOGGLE_ACTION (action));
gboolean active = g_variant_get_boolean (value);
console->highlight[GIMP_MESSAGE_INFO] = active;
}