diff options
author | Gordon Norman Squash <gordsqsh@protonmail.com> | 2024-09-10 01:28:29 -0400 |
---|---|---|
committer | Gordon Norman Squash <gordsqsh@protonmail.com> | 2024-09-10 01:30:42 -0400 |
commit | 472d7c466d33bd1fe4cd293b354e52bf16384520 (patch) | |
tree | 08398a71fd7838967649c73f005f98bfe7b843d2 /patches/no-emojis.c | |
download | gtk3-classic-module-472d7c466d33bd1fe4cd293b354e52bf16384520.tar.gz gtk3-classic-module-472d7c466d33bd1fe4cd293b354e52bf16384520.tar.bz2 gtk3-classic-module-472d7c466d33bd1fe4cd293b354e52bf16384520.zip |
Initial commit
This is where I have started tracking development with Git. I declare this
as version 0.89.
Diffstat (limited to 'patches/no-emojis.c')
-rw-r--r-- | patches/no-emojis.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/patches/no-emojis.c b/patches/no-emojis.c new file mode 100644 index 0000000..dc7dd89 --- /dev/null +++ b/patches/no-emojis.c @@ -0,0 +1,61 @@ +/* No Emojis: + * (from gtk3-classic patch 'other__hide-insert-emoji.patch') + * + * Hides the 'Insert Emoji' menu item found at the bottom of the context menus + * for GtkEntry and GtkTextView widgets. + * + * Set the environment variable GTKM_INSERT_EMOJI=1 to restore the menu items. + */ + + +#include <gtk/gtk.h> +#include <glib.h> + +#include <stdlib.h> +#include <string.h> + +#include <gtk3-classic.h> + + +#undef G_LOG_DOMAIN +#define G_LOG_DOMAIN "Gtk3-Classic::No-Emojis" + + +INTERCEPTED_CLASS_METHOD (gtk_menu_item, show, + (GtkWidget * widget), + void) + + +void no_emojis_init () +{ + GtkMenuItemClass * gtk_menu_item_class = + g_type_class_ref (GTK_TYPE_MENU_ITEM); + + INTERCEPT_CLASS_METHOD ( + gtk_menu_item, GTK_WIDGET_CLASS, show) + + g_type_class_unref (gtk_menu_item_class); +} + + +static void +new_gtk_menu_item_show +(GtkWidget * widget) + +{ + const char * gtkm_insert_emoji; + const char * label; + + + CALL_ORIGINAL_CLASS_METHOD (gtk_menu_item, show, + (widget)); + + + gtkm_insert_emoji = getenv ("GTKM_INSERT_EMOJI"); + if (gtkm_insert_emoji != NULL && strcmp (gtkm_insert_emoji, "1") == 0) + return; + + label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); + if (label != NULL && strcmp (label, _("Insert _Emoji")) == 0) + gtk_widget_hide (widget); +} |