[Commits] [SCM] claws branch, master, updated. 3.18.0-346-g3b03982e3
mones at claws-mail.org
mones at claws-mail.org
Sat Mar 19 12:37:26 CET 2022
The branch, master has been updated
via 3b03982e3d9cc1412319956d9db707f32435631d (commit)
from 775c284962ec810aae581ae1100b9456250fd9dc (commit)
Summary of changes:
src/prefs_themes.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
- Log -----------------------------------------------------------------
commit 3b03982e3d9cc1412319956d9db707f32435631d
Author: Ricardo Mones <ricardo at mones.org>
Date: Sat Mar 19 12:37:14 2022 +0100
New action button: view all theme icons
Backport of gtk3 commit 58c44fcf5d964a2e6df530bfa8b4318bea53d113
diff --git a/src/prefs_themes.c b/src/prefs_themes.c
index 344855f8a..9b37fcd7f 100644
--- a/src/prefs_themes.c
+++ b/src/prefs_themes.c
@@ -32,6 +32,7 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "utils.h"
@@ -42,6 +43,7 @@
#include "gtk/gtkutils.h"
#include "gtk/prefswindow.h"
#include "gtk/filesel.h"
+#include "gtk/manage_window.h"
#include "stock_pixmap.h"
#include "mainwindow.h"
@@ -141,6 +143,9 @@ StockPixmap prefs_themes_icons[PREVIEW_ICONS] = {
static void prefs_themes_btn_remove_clicked_cb (GtkWidget *widget, gpointer data);
static void prefs_themes_btn_install_clicked_cb (GtkWidget *widget, gpointer data);
+static void prefs_themes_btn_viewall_clicked_cb (GtkWidget *widget, gpointer data);
+static void prefs_themes_viewall_close_btn_clicked (GtkWidget *widget, gpointer data);
+static gboolean prefs_themes_viewall_key_pressed (GtkWidget *keywidget, GdkEventKey *event, GtkWidget **widget);
static void prefs_themes_menu_item_activated_cb (GtkWidget *widget, gpointer data);
#ifdef HAVE_SVG
static gdouble prefs_themes_compute_ppi(GdkScreen *screen);
@@ -640,6 +645,99 @@ end_inst:
g_free(themename);
}
+static gboolean prefs_themes_viewall_key_pressed(GtkWidget *keywidget,
+ GdkEventKey *event,
+ GtkWidget **widget)
+{
+ if (event && event->keyval == GDK_KEY_Escape) {
+ prefs_themes_viewall_close_btn_clicked(NULL, widget);
+ }
+
+ return FALSE;
+}
+
+static void prefs_themes_viewall_close_btn_clicked(GtkWidget *widget,
+ gpointer data)
+{
+ GtkWidget **window = (GtkWidget **) data;
+
+ cm_return_if_fail(window != NULL);
+ cm_return_if_fail(*window != NULL);
+
+ gtk_widget_destroy(*window);
+ *window = NULL;
+}
+
+#define ICONS_PER_ROW 19
+
+static void prefs_themes_btn_viewall_clicked_cb(GtkWidget *widget,
+ gpointer data)
+{
+ static GtkWidget *viewall_win = NULL;
+
+ ThemesData *tdata = prefs_themes_data;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *icons[N_STOCK_PIXMAPS];
+ GdkPixbuf *pixbufs[N_STOCK_PIXMAPS];
+ GtkWidget *separator;
+ GtkWidget *confirm_area;
+ GtkWidget *close_btn;
+ gchar *save_prefs_path;
+ gint i;
+
+ viewall_win = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_themes_view_all");
+ gtk_container_set_border_width(GTK_CONTAINER(viewall_win), 5);
+ gtk_window_set_title(GTK_WINDOW(viewall_win), _("View all theme icons"));
+ gtk_window_set_position(GTK_WINDOW(viewall_win), GTK_WIN_POS_CENTER);
+
+ vbox = gtk_vbox_new(FALSE, 5);
+ gtk_widget_show(vbox);
+ gtk_container_add(GTK_CONTAINER(viewall_win), vbox);
+
+ save_prefs_path = prefs_common.pixmap_theme_path;
+ prefs_common.pixmap_theme_path = tdata->displayed;
+ hbox = gtk_hbox_new(FALSE, 5);
+ gtk_widget_show(hbox);
+ for (i = 0; i < N_STOCK_PIXMAPS; ++i) {
+ icons[i] = gtk_image_new();
+ gtk_widget_show (icons[i]);
+ stock_pixbuf_gdk(i, &(pixbufs[i]));
+ gtk_image_set_from_pixbuf(GTK_IMAGE(icons[i]), pixbufs[i]);
+ gtk_box_pack_start(GTK_BOX(hbox), icons[i], TRUE, TRUE, 5);
+ if ((i + 1) % ICONS_PER_ROW == 0) {
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5);
+ if (i + 1 < N_STOCK_PIXMAPS) {
+ hbox = gtk_hbox_new(FALSE, 5);
+ gtk_widget_show(hbox);
+ }
+ }
+ }
+ prefs_common.pixmap_theme_path = save_prefs_path;
+
+ separator = gtk_hseparator_new();
+ gtk_widget_show(separator);
+ gtk_box_pack_start(GTK_BOX(vbox), separator, FALSE, FALSE, 0);
+
+ gtkut_stock_button_set_create(&confirm_area,
+ &close_btn, GTK_STOCK_CLOSE, NULL, NULL, NULL, NULL);
+ gtk_box_pack_start(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 5);
+ gtk_widget_show(confirm_area);
+ gtk_widget_grab_default(close_btn);
+ gtk_widget_grab_focus(close_btn);
+
+ g_signal_connect(G_OBJECT(close_btn), "clicked",
+ G_CALLBACK(prefs_themes_viewall_close_btn_clicked),
+ &viewall_win);
+ g_signal_connect(G_OBJECT(viewall_win), "key_press_event",
+ G_CALLBACK(prefs_themes_viewall_key_pressed),
+ &viewall_win);
+
+ manage_window_set_transient(GTK_WINDOW(viewall_win));
+ gtk_window_set_modal(GTK_WINDOW(viewall_win), TRUE);
+ gtk_widget_show(viewall_win);
+}
+
static void prefs_themes_menu_item_activated_cb(GtkWidget *widget, gpointer data)
{
ThemesData *tdata = prefs_themes_data;
@@ -935,6 +1033,7 @@ static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpoin
GtkWidget *icon_5;
GtkWidget *icon_6;
GtkWidget *icon_7;
+ GtkWidget *btn_viewall;
GtkWidget *frame_buttons;
GtkWidget *hbuttonbox1;
GtkWidget *btn_remove;
@@ -1048,6 +1147,7 @@ static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpoin
PACK_FRAME(vbox1, frame_preview, _("Preview"));
hbox1 = gtk_hbox_new (FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5);
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (frame_preview), hbox1);
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5);
@@ -1101,6 +1201,10 @@ static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpoin
gtk_container_add (GTK_CONTAINER (hbuttonbox1), btn_remove);
gtk_widget_set_can_default (btn_remove, TRUE);
+ btn_viewall = gtk_button_new_with_label (_("View all"));
+ gtk_widget_show (btn_viewall);
+ gtk_box_pack_start (GTK_BOX (hbuttonbox1), btn_viewall, FALSE, FALSE, 5);
+
#ifdef HAVE_SVG
PACK_FRAME(vbox1, frame_scaling, _("SVG rendering"));
@@ -1166,6 +1270,9 @@ static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpoin
g_signal_connect(G_OBJECT(btn_install), "clicked",
G_CALLBACK(prefs_themes_btn_install_clicked_cb),
NULL);
+ g_signal_connect(G_OBJECT(btn_viewall), "clicked",
+ G_CALLBACK(prefs_themes_btn_viewall_clicked_cb),
+ NULL);
prefs_themes->window = GTK_WIDGET(window);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list