pidgin/pidgin

eb0f386cea6b
Parents e9573eaa68f9
Children 892459990bb7
Moved all of the inline css in pidgin to resource files

Testing Done:
compile and some basic testing with the debug window. The invalid regex doesn't seem to be working but thats unrelated to this change.

Reviewed at https://reviews.imfreedom.org/r/149/
--- a/pidgin/gtkaccount.c Mon Oct 12 20:57:09 2020 -0500
+++ b/pidgin/gtkaccount.c Mon Oct 12 21:03:57 2020 -0500
@@ -432,14 +432,10 @@
GList *l, *l2;
char *username = NULL;
GtkCssProvider *entry_css;
- const gchar entry_style[] =
- "entry.copyable-insensitive {"
- "color: @insensitive_fg_color;"
- "background-color: @insensitive_bg_color;"
- "}";
+ const gchar *res = "/im/pidgin/Pidgin/Accounts/entry.css";
entry_css = gtk_css_provider_new();
- gtk_css_provider_load_from_data(entry_css, entry_style, -1, NULL);
+ gtk_css_provider_load_from_resource(entry_css, res);
if (dialog->protocol_menu != NULL)
{
--- a/pidgin/gtkconv.c Mon Oct 12 20:57:09 2020 -0500
+++ b/pidgin/gtkconv.c Mon Oct 12 21:03:57 2020 -0500
@@ -7846,45 +7846,14 @@
static void
set_default_tab_colors(GtkWidget *widget)
{
- GString *str;
- GtkCssProvider *provider;
- GError *error = NULL;
- int iter;
-
- struct {
- const char *labelname;
- const char *color;
- } styles[] = {
- {"tab-label-typing", "#4e9a06"},
- {"tab-label-typed", "#c4a000"},
- {"tab-label-attention", "#006aff"},
- {"tab-label-unreadchat", "#cc0000"},
- {"tab-label-event", "#888a85"},
- {NULL, NULL}
- };
-
- str = g_string_new(NULL);
-
- for (iter = 0; styles[iter].labelname; iter++) {
- g_string_append_printf(str,
- "#%s {\n"
- " color: %s;\n"
- "}\n",
- styles[iter].labelname,
- styles[iter].color);
- }
-
- provider = gtk_css_provider_new();
-
- gtk_css_provider_load_from_data(provider, str->str, str->len, &error);
+ GtkCssProvider *provider = gtk_css_provider_new();
+ const gchar *res = "/im/pidgin/Pidgin/Conversations/tab-label.css";
+
+ gtk_css_provider_load_from_resource(provider, res);
gtk_style_context_add_provider(gtk_widget_get_style_context(widget),
GTK_STYLE_PROVIDER(provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- if (error)
- g_error_free(error);
- g_string_free(str, TRUE);
}
void
--- a/pidgin/gtkprefs.c Mon Oct 12 20:57:09 2020 -0500
+++ b/pidgin/gtkprefs.c Mon Oct 12 21:03:57 2020 -0500
@@ -1796,19 +1796,7 @@
{
GtkStyleContext *context;
GtkCssProvider *ip_css;
- const gchar ip_style[] =
- ".bad-ip {"
- "color: @error_fg_color;"
- "text-shadow: 0 1px @error_text_shadow;"
- "background-image: none;"
- "background-color: @error_bg_color;"
- "}"
- ".good-ip {"
- "color: @question_fg_color;"
- "text-shadow: 0 1px @question_text_shadow;"
- "background-image: none;"
- "background-color: @success_color;"
- "}";
+ const gchar *res = "/im/pidgin/Pidgin/Prefs/ip.css";
gtk_entry_set_text(GTK_ENTRY(win->network.stun_server),
purple_prefs_get_string("/purple/network/stun_server"));
@@ -1821,7 +1809,8 @@
purple_network_get_public_ip());
ip_css = gtk_css_provider_new();
- gtk_css_provider_load_from_data(ip_css, ip_style, -1, NULL);
+ gtk_css_provider_load_from_resource(ip_css, res);
+
context = gtk_widget_get_style_context(win->network.public_ip);
gtk_style_context_add_provider(context,
GTK_STYLE_PROVIDER(ip_css),
--- a/pidgin/pidgindebug.c Mon Oct 12 20:57:09 2020 -0500
+++ b/pidgin/pidgindebug.c Mon Oct 12 21:03:57 2020 -0500
@@ -585,19 +585,7 @@
GtkTextIter end;
GtkStyleContext *context;
GtkCssProvider *filter_css;
- const gchar filter_style[] =
- ".bad-filter {"
- "color: @error_fg_color;"
- "text-shadow: 0 1px @error_text_shadow;"
- "background-image: none;"
- "background-color: @error_bg_color;"
- "}"
- ".good-filter {"
- "color: @question_fg_color;"
- "text-shadow: 0 1px @question_text_shadow;"
- "background-image: none;"
- "background-color: @success_color;"
- "}";
+ const gchar *res = "/im/pidgin/Pidgin/Debug/filter.css";
gtk_widget_init_template(GTK_WIDGET(win));
@@ -636,7 +624,8 @@
/* regex entry */
filter_css = gtk_css_provider_new();
- gtk_css_provider_load_from_data(filter_css, filter_style, -1, NULL);
+ gtk_css_provider_load_from_resource(filter_css, res);
+
context = gtk_widget_get_style_context(win->expression);
gtk_style_context_add_provider(context,
GTK_STYLE_PROVIDER(filter_css),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/Accounts/entry.css Mon Oct 12 21:03:57 2020 -0500
@@ -0,0 +1,4 @@
+entry.copyable-insensitive {
+ color: @insensitive_fg_color;
+ background-color: @insensitive_bg_color;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/Conversations/tab-label.css Mon Oct 12 21:03:57 2020 -0500
@@ -0,0 +1,19 @@
+#tab-label-typing {
+ color: #4e9a06;
+}
+
+#tab-label-typed {
+ color: #c4a000;
+}
+
+#tab-label-attention {
+ color: #006aff;
+}
+
+#tab-label-unreadchat {
+ color: #cc0000;
+}
+
+#tab-label-event {
+ color: #888a85;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/Debug/filter.css Mon Oct 12 21:03:57 2020 -0500
@@ -0,0 +1,13 @@
+.bad-filter {
+ color: @error_fg_color;
+ text-shadow: 0 1px @error_text_shadow;
+ background-image: none;
+ background-color: @error_bg_color;
+}
+
+.good-filter {
+ color: @question_fg_color;
+ text-shadow: 0 1px @question_text_shadow;
+ background-image: none;
+ background-color: @success_color;
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/Prefs/ip.css Mon Oct 12 21:03:57 2020 -0500
@@ -0,0 +1,13 @@
+.bad-ip {
+ color: @error_fg_color;
+ text-shadow: 0 1px @error_text_shadow;
+ background-image: none;
+ background-color: @error_bg_color;
+}
+
+.good-ip {
+ color: @question_fg_color;
+ text-shadow: 0 1px @question_text_shadow;
+ background-image: none;
+ background-color: @success_color;
+}
--- a/pidgin/resources/pidgin.gresource.xml Mon Oct 12 20:57:09 2020 -0500
+++ b/pidgin/resources/pidgin.gresource.xml Mon Oct 12 21:03:57 2020 -0500
@@ -5,16 +5,20 @@
<file compressed="true">About/about.ui</file>
<file compressed="true">About/about.md</file>
<file compressed="true">About/credits.json</file>
+ <file compressed="true">Accounts/actionsmenu.ui</file>
<file compressed="true">Accounts/chooser.ui</file>
- <file compressed="true">Accounts/actionsmenu.ui</file>
+ <file compressed="true">Accounts/entry.css</file>
<file compressed="true">Accounts/menu.ui</file>
<file compressed="true">BuddyList/menu.ui</file>
<file compressed="true">Conversations/invite_dialog.ui</file>
+ <file compressed="true">Conversations/tab-label.css</file>
<file compressed="true">Debug/debug.ui</file>
+ <file compressed="true">Debug/filter.css</file>
<file compressed="true">Debug/plugininfo.ui</file>
<file compressed="true">Log/log-viewer.ui</file>
<file compressed="true">Plugins/dialog.ui</file>
<file compressed="true">Plugins/menu.ui</file>
+ <file compressed="true">Prefs/ip.css</file>
<file compressed="true">Prefs/prefs.ui</file>
<file compressed="true">Prefs/vv.ui</file>
<file compressed="true">Privacy/dialog.ui</file>