Sat, 03 Nov 2007 16:32:28 +0000
Fix iterating over accounts_signed_on_elsewhere while doing things that will
cause it to change.
| 10584 | 1 | /** |
| 15884 | 2 | * @file purplerc.c Purple gtk resource control plugin. |
| 10584 | 3 | * |
| 4 | * Copyright (C) 2005 Etan Reisner <deryni@eden.rutgers.edu> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18242
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 10584 | 19 | */ |
| 20 | ||
| 21 | #include "internal.h" | |
| 22 | #include "gtkplugin.h" | |
| 23 | #include "gtkprefs.h" | |
| 24 | #include "gtkutils.h" | |
|
12044
e49179a1496a
[gaim-migrate @ 14339]
Richard Laager <rlaager@pidgin.im>
parents:
12042
diff
changeset
|
25 | #include "util.h" |
| 10584 | 26 | #include "version.h" |
| 27 | ||
| 28 | static guint pref_callback; | |
| 29 | ||
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
30 | static const gchar *color_prefs[] = { |
| 15884 | 31 | "/plugins/gtk/purplerc/color/GtkWidget::cursor-color", |
| 32 | "/plugins/gtk/purplerc/color/GtkWidget::secondary-cursor-color", | |
| 33 | "/plugins/gtk/purplerc/color/GtkIMHtml::hyperlink-color" | |
| 10584 | 34 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
35 | static const gchar *color_prefs_set[] = { |
| 15884 | 36 | "/plugins/gtk/purplerc/set/color/GtkWidget::cursor-color", |
| 37 | "/plugins/gtk/purplerc/set/color/GtkWidget::secondary-cursor-color", | |
| 38 | "/plugins/gtk/purplerc/set/color/GtkIMHtml::hyperlink-color" | |
| 10584 | 39 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
40 | static const gchar *color_names[] = { |
|
10585
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
41 | N_("Cursor Color"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
42 | N_("Secondary Cursor Color"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
43 | N_("Hyperlink Color") |
| 10584 | 44 | }; |
| 45 | static GtkWidget *color_widgets[G_N_ELEMENTS(color_prefs)]; | |
| 46 | ||
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
47 | static const gchar *widget_size_prefs[] = { |
| 15884 | 48 | "/plugins/gtk/purplerc/size/GtkTreeView::horizontal_separator" |
| 10584 | 49 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
50 | static const gchar *widget_size_prefs_set[] = { |
| 15884 | 51 | "/plugins/gtk/purplerc/set/size/GtkTreeView::horizontal_separator" |
| 10584 | 52 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
53 | static const gchar *widget_size_names[] = { |
| 12201 | 54 | N_("GtkTreeView Horizontal Separation") |
| 10584 | 55 | }; |
| 56 | static GtkWidget *widget_size_widgets[G_N_ELEMENTS(widget_size_prefs)]; | |
| 57 | ||
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
58 | static const gchar *font_prefs[] = { |
| 15884 | 59 | "/plugins/gtk/purplerc/font/*pidgin_conv_entry", |
|
17096
b38e5c5c934e
Fix incorrect widget names in pidginrc plugin. Also, fix spacing - I'm not sure if this actually matters. Fixes #874.
Daniel Atallah <datallah@pidgin.im>
parents:
16749
diff
changeset
|
60 | "/plugins/gtk/purplerc/font/*pidgin_request_imhtml", |
|
b38e5c5c934e
Fix incorrect widget names in pidginrc plugin. Also, fix spacing - I'm not sure if this actually matters. Fixes #874.
Daniel Atallah <datallah@pidgin.im>
parents:
16749
diff
changeset
|
61 | "/plugins/gtk/purplerc/font/*pidgin_notify_imhtml", |
| 10584 | 62 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
63 | static const gchar *font_prefs_set[] = { |
| 15884 | 64 | "/plugins/gtk/purplerc/set/font/*pidgin_conv_entry", |
|
17096
b38e5c5c934e
Fix incorrect widget names in pidginrc plugin. Also, fix spacing - I'm not sure if this actually matters. Fixes #874.
Daniel Atallah <datallah@pidgin.im>
parents:
16749
diff
changeset
|
65 | "/plugins/gtk/purplerc/set/font/*pidgin_request_imhtml", |
|
b38e5c5c934e
Fix incorrect widget names in pidginrc plugin. Also, fix spacing - I'm not sure if this actually matters. Fixes #874.
Daniel Atallah <datallah@pidgin.im>
parents:
16749
diff
changeset
|
66 | "/plugins/gtk/purplerc/set/font/*pidgin_notify_imhtml", |
| 10584 | 67 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
68 | static const gchar *font_names[] = { |
|
10585
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
69 | N_("Conversation Entry"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
70 | N_("Request Dialog"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
71 | N_("Notify Dialog") |
| 10584 | 72 | }; |
| 73 | static GtkWidget *font_widgets[G_N_ELEMENTS(font_prefs)]; | |
| 74 | ||
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
75 | /* |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
76 | static const gchar *widget_bool_prefs[] = { |
| 12973 | 77 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
78 | static const gchar *widget_bool_prefs_set[] = { |
| 12973 | 79 | }; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
80 | static const gchar *widget_bool_names[] = { |
| 12973 | 81 | }; |
| 82 | static GtkWidget *widget_bool_widgets[G_N_ELEMENTS(widget_bool_prefs)]; | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
83 | */ |
| 12973 | 84 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
85 | static GString * |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
86 | make_gtkrc_string() |
| 10584 | 87 | { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
88 | gint i; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
89 | gchar *prefbase = NULL; |
| 10584 | 90 | GString *style_string = g_string_new(""); |
| 91 | ||
| 15884 | 92 | if (purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-font-name")) { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
93 | const gchar *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-font-name"); |
| 14391 | 94 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
95 | if (pref != NULL && strcmp(pref, "")) { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
96 | g_string_append_printf(style_string, |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
97 | "gtk-font-name = \"%s\"\n", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
98 | pref); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
99 | } |
| 10584 | 100 | } |
| 101 | ||
| 15884 | 102 | if (purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name")) { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
103 | const gchar *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-key-theme-name"); |
| 14391 | 104 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
105 | if (pref != NULL && strcmp(pref, "")) { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
106 | g_string_append_printf(style_string, |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
107 | "gtk-key-theme-name = \"%s\"\n", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
108 | pref); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
109 | } |
| 10584 | 110 | } |
| 111 | ||
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
112 | g_string_append(style_string, "style \"purplerc_style\"\n{"); |
| 10584 | 113 | |
| 114 | for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) { | |
| 15884 | 115 | if (purple_prefs_get_bool(color_prefs_set[i])) { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
116 | const gchar *pref; |
| 14391 | 117 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
118 | pref = purple_prefs_get_string(color_prefs[i]); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
119 | if (pref != NULL && strcmp(pref, "")) { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
120 | prefbase = g_path_get_basename(color_prefs[i]); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
121 | g_string_append_printf(style_string, |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
122 | "\n\t%s = \"%s\"", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
123 | prefbase, pref); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
124 | g_free(prefbase); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
125 | } |
| 10584 | 126 | } |
| 127 | } | |
| 128 | ||
| 129 | for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) { | |
| 15884 | 130 | if (purple_prefs_get_bool(widget_size_prefs_set[i])) { |
| 10584 | 131 | prefbase = g_path_get_basename(widget_size_prefs[i]); |
| 132 | g_string_append_printf(style_string, | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
133 | "\n\t%s = %d", prefbase, |
| 15884 | 134 | purple_prefs_get_int(widget_size_prefs[i])); |
| 10584 | 135 | g_free(prefbase); |
| 136 | } | |
| 137 | } | |
| 138 | ||
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
139 | /* |
| 12973 | 140 | for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) { |
| 15884 | 141 | if (purple_prefs_get_bool(widget_bool_prefs_set[i])) { |
| 12973 | 142 | prefbase = g_path_get_basename(widget_bool_prefs[i]); |
| 143 | g_string_append_printf(style_string, | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
144 | "\t%s = %d\n", prefbase, |
| 15884 | 145 | purple_prefs_get_bool(widget_bool_prefs[i])); |
| 12973 | 146 | g_free(prefbase); |
| 147 | } | |
| 148 | } | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
149 | */ |
| 12973 | 150 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
151 | g_string_append(style_string, "\n}\nwidget_class \"*\" style \"purplerc_style\"\n"); |
| 10584 | 152 | |
| 153 | for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) { | |
| 15884 | 154 | if (purple_prefs_get_bool(font_prefs_set[i])) { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
155 | const gchar *pref; |
| 14391 | 156 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
157 | pref = purple_prefs_get_string(font_prefs[i]); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
158 | if (pref != NULL && strcmp(pref, "")) { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
159 | prefbase = g_path_get_basename(font_prefs[i]); |
| 14391 | 160 | g_string_append_printf(style_string, |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
161 | "style \"%s_style\"\n{\n" |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
162 | "\tfont_name = \"%s\"\n}" |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
163 | "\nwidget \"%s\" " |
| 14391 | 164 | "style \"%s_style\"\n", |
| 165 | prefbase, pref, | |
| 166 | prefbase, prefbase); | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
167 | g_free(prefbase); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
168 | } |
| 10584 | 169 | } |
| 170 | } | |
| 171 | ||
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
172 | return style_string; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
173 | } |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
174 | |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
175 | static void |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
176 | purplerc_make_changes() |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
177 | { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
178 | GString *str = make_gtkrc_string(); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
179 | #if GTK_CHECK_VERSION(2,4,0) |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
180 | GtkSettings *setting = NULL; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
181 | #endif |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
182 | |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
183 | gtk_rc_parse_string(str->str); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
184 | g_string_free(str, TRUE); |
| 10584 | 185 | |
| 12973 | 186 | #if GTK_CHECK_VERSION(2,4,0) |
| 187 | setting = gtk_settings_get_default(); | |
| 188 | gtk_rc_reset_styles(setting); | |
| 189 | #endif | |
| 10584 | 190 | } |
| 191 | ||
| 192 | static void | |
| 15884 | 193 | purplerc_write(GtkWidget *widget, gpointer data) |
| 11940 | 194 | { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
195 | GString *str = make_gtkrc_string(); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
196 | str = g_string_prepend(str, "# This file automatically written by the Pidgin GTK+ Theme Control plugin.\n# Any changes to this file will be overwritten by the plugin when told to\n# write the settings again.\n# The FAQ (http://developer.pidgin.im/wiki/FAQ) contains some further examples\n# of possible pidgin gtkrc settings.\n"); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
197 | purple_util_write_data_to_file("gtkrc-2.0", str->str, -1); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
198 | g_string_free(str, TRUE); |
| 11940 | 199 | } |
| 200 | ||
| 201 | static void | |
| 15884 | 202 | purplerc_reread(GtkWidget *widget, gpointer data) |
| 11940 | 203 | { |
| 204 | gtk_rc_reparse_all(); | |
| 12973 | 205 | /* I don't know if this is necessary but if not it shouldn't hurt. */ |
| 15884 | 206 | purplerc_make_changes(); |
| 11940 | 207 | } |
| 208 | ||
| 209 | static void | |
| 15884 | 210 | purplerc_pref_changed_cb(const char *name, PurplePrefType type, |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
211 | gconstpointer value, gpointer data) |
| 10584 | 212 | { |
| 15884 | 213 | purplerc_make_changes(); |
| 10584 | 214 | } |
| 215 | ||
| 216 | static void | |
| 15884 | 217 | purplerc_color_response(GtkDialog *color_dialog, gint response, gpointer data) |
| 10584 | 218 | { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
219 | gint subscript = GPOINTER_TO_INT(data); |
| 10584 | 220 | |
| 221 | if (response == GTK_RESPONSE_OK) { | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
222 | GdkColor color; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
223 | gchar colorstr[8]; |
| 10584 | 224 | GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel; |
| 225 | ||
| 226 | gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color); | |
| 227 | ||
| 228 | g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X", | |
| 229 | color.red/256, color.green/256, color.blue/256); | |
| 230 | ||
| 15884 | 231 | purple_prefs_set_string(color_prefs[subscript], colorstr); |
| 10584 | 232 | } |
| 233 | gtk_widget_destroy(GTK_WIDGET(color_dialog)); | |
| 234 | } | |
| 235 | ||
| 236 | static void | |
| 15884 | 237 | purplerc_set_color(GtkWidget *widget, gpointer data) |
| 10584 | 238 | { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
239 | GdkColor color; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
240 | gchar title[128]; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
241 | const gchar *pref = NULL; |
| 10584 | 242 | GtkWidget *color_dialog = NULL; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
243 | gint subscript = GPOINTER_TO_INT(data); |
| 10584 | 244 | |
| 245 | g_snprintf(title, sizeof(title), _("Select Color for %s"), | |
|
10586
fd1399d550fc
[gaim-migrate @ 11990]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10585
diff
changeset
|
246 | _(color_names[GPOINTER_TO_INT(data)])); |
| 10584 | 247 | color_dialog = gtk_color_selection_dialog_new(_("Select Color")); |
| 248 | g_signal_connect(G_OBJECT(color_dialog), "response", | |
| 15884 | 249 | G_CALLBACK(purplerc_color_response), data); |
| 10584 | 250 | |
| 15884 | 251 | pref = purple_prefs_get_string(color_prefs[subscript]); |
| 14391 | 252 | |
| 253 | if (pref != NULL && strcmp(pref, "")) { | |
| 254 | if (gdk_color_parse(pref, &color)) { | |
| 255 | gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color); | |
| 256 | } | |
| 10584 | 257 | } |
| 258 | ||
| 259 | gtk_window_present(GTK_WINDOW(color_dialog)); | |
| 260 | } | |
| 261 | ||
| 262 | static void | |
| 15884 | 263 | purplerc_font_response(GtkDialog *font_dialog, gint response, gpointer data) |
| 10584 | 264 | { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
265 | const gchar *prefpath; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
266 | gint subscript = GPOINTER_TO_INT(data); |
| 10584 | 267 | |
| 268 | if (response == GTK_RESPONSE_OK) { | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
269 | gchar *fontname = NULL; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
270 | |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
271 | if (subscript == -1) { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
272 | prefpath = "/plugins/gtk/purplerc/gtk-font-name"; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
273 | } else { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
274 | prefpath = font_prefs[subscript]; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
275 | } |
| 10584 | 276 | |
| 277 | fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog)); | |
| 278 | ||
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
279 | purple_prefs_set_string(prefpath, fontname); |
| 10584 | 280 | g_free(fontname); |
| 281 | } | |
| 282 | gtk_widget_destroy(GTK_WIDGET(font_dialog)); | |
| 283 | } | |
| 284 | ||
| 285 | static void | |
| 15884 | 286 | purplerc_set_font(GtkWidget *widget, gpointer data) |
| 10584 | 287 | { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
288 | gchar title[128]; |
| 10584 | 289 | GtkWidget *font_dialog = NULL; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
290 | gint subscript = GPOINTER_TO_INT(data); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
291 | const gchar *pref = NULL, *prefpath = NULL; |
| 10584 | 292 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
293 | if (subscript == -1) { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
294 | g_snprintf(title, sizeof(title), _("Select Interface Font")); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
295 | prefpath = "/plugins/gtk/purplerc/gtk-font-name"; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
296 | } else { |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
297 | g_snprintf(title, sizeof(title), _("Select Font for %s"), |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
298 | _(font_names[subscript])); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
299 | prefpath = font_prefs[subscript]; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
300 | } |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
301 | |
| 10584 | 302 | font_dialog = gtk_font_selection_dialog_new(title); |
| 303 | g_signal_connect(G_OBJECT(font_dialog), "response", | |
| 15884 | 304 | G_CALLBACK(purplerc_font_response), data); |
| 10584 | 305 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
306 | pref = purple_prefs_get_string(prefpath); |
| 14391 | 307 | |
| 308 | if (pref != NULL && strcmp(pref, "")) { | |
| 309 | gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), pref); | |
| 10584 | 310 | } |
| 311 | ||
| 312 | gtk_window_present(GTK_WINDOW(font_dialog)); | |
| 313 | } | |
| 314 | ||
| 315 | static gboolean | |
| 15884 | 316 | purplerc_plugin_load(PurplePlugin *plugin) |
| 10584 | 317 | { |
| 15884 | 318 | purplerc_make_changes(); |
| 10584 | 319 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
320 | pref_callback = purple_prefs_connect_callback(plugin, |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
321 | "/plugins/gtk/purplerc", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
322 | purplerc_pref_changed_cb, |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
323 | NULL); |
| 10584 | 324 | |
| 325 | return TRUE; | |
| 326 | } | |
| 327 | ||
| 328 | static gboolean | |
| 15884 | 329 | purplerc_plugin_unload(PurplePlugin *plugin) |
| 10584 | 330 | { |
| 15884 | 331 | purple_prefs_disconnect_callback(pref_callback); |
| 10584 | 332 | |
| 333 | return TRUE; | |
| 334 | } | |
| 335 | ||
| 336 | static GtkWidget * | |
| 15884 | 337 | purplerc_get_config_frame(PurplePlugin *plugin) |
| 10584 | 338 | { |
| 12546 | 339 | /* Note: Intentionally not using the size group argument to the |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
340 | * pidgin_prefs_labeled_* functions they only add the text label to |
| 12546 | 341 | * the size group not the whole thing, which isn't what I want. */ |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
342 | gint i; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
343 | gchar *tmp; |
| 12546 | 344 | GtkWidget *check = NULL, *widget = NULL; |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
345 | GtkWidget *ret = NULL, *hbox = NULL, *frame = NULL; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
346 | GtkSizeGroup *labelsg = NULL, *widgetsg = NULL, *buttonsg = NULL; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
347 | #ifndef _WIN32 |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
348 | const gchar *homepath = "$HOME"; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
349 | #else |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
350 | const gchar *homepath = "\%APPDATA\%"; |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
351 | #endif |
| 10584 | 352 | |
| 15882 | 353 | ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 354 | gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); | |
| 10584 | 355 | |
| 12546 | 356 | labelsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 357 | widgetsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
358 | buttonsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 10584 | 359 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
360 | frame = pidgin_make_frame(ret, _("General")); |
| 10584 | 361 | /* interface font */ |
| 15882 | 362 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 363 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 364 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
365 | check = pidgin_prefs_checkbox(_("GTK+ Interface Font"), |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
366 | "/plugins/gtk/purplerc/set/gtk-font-name", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
367 | hbox); |
| 12546 | 368 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 369 | |
| 15568 | 370 | widget = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT, |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
371 | PIDGIN_BUTTON_HORIZONTAL); |
| 10584 | 372 | gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); |
| 12546 | 373 | gtk_size_group_add_widget(widgetsg, widget); |
| 10584 | 374 | gtk_widget_set_sensitive(widget, |
| 15884 | 375 | purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-font-name")); |
| 10584 | 376 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
377 | G_CALLBACK(pidgin_toggle_sensitive), widget); |
| 10584 | 378 | g_signal_connect(G_OBJECT(widget), "clicked", |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
379 | G_CALLBACK(purplerc_set_font), GINT_TO_POINTER(-1)); |
| 10584 | 380 | |
| 381 | /* key theme name */ | |
| 15882 | 382 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 383 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 384 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
385 | check = pidgin_prefs_checkbox(_("GTK+ Text Shortcut Theme"), |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
386 | "/plugins/gtk/purplerc/set/gtk-key-theme-name", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
387 | hbox); |
| 12546 | 388 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 389 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
390 | widget = pidgin_prefs_labeled_entry(hbox, "", |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
391 | "/plugins/gtk/purplerc/gtk-key-theme-name", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
392 | NULL); |
| 12546 | 393 | /* |
| 394 | gtk_size_group_add_widget(widgetsg, widget); | |
| 395 | */ | |
| 10584 | 396 | gtk_widget_set_sensitive(widget, |
| 15884 | 397 | purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name")); |
| 10584 | 398 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
399 | G_CALLBACK(pidgin_toggle_sensitive), widget); |
| 10584 | 400 | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
401 | /* |
| 12973 | 402 | for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) { |
| 15882 | 403 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 12973 | 404 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 405 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
406 | check = pidgin_prefs_checkbox(_(widget_bool_names[i]), |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
407 | widget_bool_prefs_set[i], hbox); |
| 12973 | 408 | gtk_size_group_add_widget(labelsg, check); |
| 409 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
410 | widget_bool_widgets[i] = pidgin_prefs_checkbox("", widget_bool_prefs[i], hbox); |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
411 | * |
| 12973 | 412 | gtk_size_group_add_widget(widgetsb, widget_bool_widgets[i]); |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
413 | * |
| 12973 | 414 | gtk_widget_set_sensitive(widget_bool_widgets[i], |
| 15884 | 415 | purple_prefs_get_bool(widget_bool_prefs_set[i])); |
| 12973 | 416 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
417 | G_CALLBACK(pidgin_toggle_sensitive), |
| 12973 | 418 | widget_bool_widgets[i]); |
| 419 | } | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
420 | */ |
| 12973 | 421 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
422 | frame = pidgin_make_frame(ret, _("Interface colors")); |
| 10584 | 423 | /* imhtml stuff */ |
| 424 | for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) { | |
| 15882 | 425 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 426 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 427 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
428 | check = pidgin_prefs_checkbox(_(color_names[i]), |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
429 | color_prefs_set[i], hbox); |
| 12546 | 430 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 431 | |
| 15568 | 432 | color_widgets[i] = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_COLOR, PIDGIN_BUTTON_HORIZONTAL); |
| 12546 | 433 | gtk_size_group_add_widget(widgetsg, color_widgets[i]); |
| 10584 | 434 | gtk_box_pack_start(GTK_BOX(hbox), color_widgets[i], FALSE, |
| 435 | FALSE, 0); | |
| 436 | gtk_widget_set_sensitive(color_widgets[i], | |
| 15884 | 437 | purple_prefs_get_bool(color_prefs_set[i])); |
| 10584 | 438 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
439 | G_CALLBACK(pidgin_toggle_sensitive), |
| 10584 | 440 | color_widgets[i]); |
| 441 | g_signal_connect(G_OBJECT(color_widgets[i]), "clicked", | |
| 15884 | 442 | G_CALLBACK(purplerc_set_color), |
| 10584 | 443 | GINT_TO_POINTER(i)); |
| 444 | } | |
| 445 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
446 | frame = pidgin_make_frame(ret, _("Widget Sizes")); |
|
10585
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
447 | /* widget size stuff */ |
| 10584 | 448 | for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) { |
| 15882 | 449 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 450 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 451 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
452 | check = pidgin_prefs_checkbox(_(widget_size_names[i]), |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
453 | widget_size_prefs_set[i], hbox); |
| 12546 | 454 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 455 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
456 | widget_size_widgets[i] = pidgin_prefs_labeled_spin_button(hbox, "", widget_size_prefs[i], 0, 50, NULL); |
| 12546 | 457 | /* |
| 458 | gtk_size_group_add_widget(widgetsg, widget_size_widgets[i]); | |
| 459 | */ | |
| 10584 | 460 | gtk_widget_set_sensitive(widget_size_widgets[i], |
| 15884 | 461 | purple_prefs_get_bool(widget_size_prefs_set[i])); |
| 10584 | 462 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
463 | G_CALLBACK(pidgin_toggle_sensitive), |
| 10584 | 464 | widget_size_widgets[i]); |
| 465 | } | |
| 466 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
467 | frame = pidgin_make_frame(ret, _("Fonts")); |
| 10584 | 468 | /* imhtml font stuff */ |
| 469 | for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) { | |
| 15882 | 470 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 471 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 472 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
473 | check = pidgin_prefs_checkbox(_(font_names[i]), |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
474 | font_prefs_set[i], hbox); |
| 12546 | 475 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 476 | |
| 15568 | 477 | font_widgets[i] = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT, PIDGIN_BUTTON_HORIZONTAL); |
| 12546 | 478 | gtk_size_group_add_widget(widgetsg, font_widgets[i]); |
| 10584 | 479 | gtk_box_pack_start(GTK_BOX(hbox), font_widgets[i], FALSE, |
| 480 | FALSE, 0); | |
| 481 | gtk_widget_set_sensitive(font_widgets[i], | |
| 15884 | 482 | purple_prefs_get_bool(font_prefs_set[i])); |
| 10584 | 483 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
484 | G_CALLBACK(pidgin_toggle_sensitive), |
| 10584 | 485 | font_widgets[i]); |
| 486 | g_signal_connect(G_OBJECT(font_widgets[i]), "clicked", | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
487 | G_CALLBACK(purplerc_set_font), |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
488 | GINT_TO_POINTER(i)); |
| 10584 | 489 | } |
| 490 | ||
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
491 | frame = pidgin_make_frame(ret, _("Gtkrc File Tools")); |
| 11940 | 492 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
493 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
494 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 11940 | 495 | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
496 | tmp = g_strdup_printf(_("Write settings to %s%sgtkrc-2.0"), |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
497 | homepath, G_DIR_SEPARATOR_S); |
|
12042
b90399880391
[gaim-migrate @ 14337]
Richard Laager <rlaager@pidgin.im>
parents:
11941
diff
changeset
|
498 | check = gtk_button_new_with_label(tmp); |
|
b90399880391
[gaim-migrate @ 14337]
Richard Laager <rlaager@pidgin.im>
parents:
11941
diff
changeset
|
499 | g_free(tmp); |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
500 | gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
501 | gtk_size_group_add_widget(buttonsg, check); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
502 | g_signal_connect(G_OBJECT(check), "clicked", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
503 | G_CALLBACK(purplerc_write), NULL); |
| 11940 | 504 | |
| 505 | check = gtk_button_new_with_label(_("Re-read gtkrc files")); | |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
506 | gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
507 | gtk_size_group_add_widget(buttonsg, check); |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
508 | g_signal_connect(G_OBJECT(check), "clicked", |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
509 | G_CALLBACK(purplerc_reread), NULL); |
| 11940 | 510 | |
| 10584 | 511 | gtk_widget_show_all(ret); |
| 512 | return ret; | |
| 513 | } | |
| 514 | ||
| 15884 | 515 | static PidginPluginUiInfo purplerc_ui_info = |
| 10584 | 516 | { |
| 15884 | 517 | purplerc_get_config_frame, |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
518 | 0, /* page_num (Reserved) */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
519 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
520 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
521 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
522 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
523 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
524 | NULL |
| 10584 | 525 | }; |
| 526 | ||
| 15884 | 527 | static PurplePluginInfo purplerc_info = |
| 10584 | 528 | { |
| 15884 | 529 | PURPLE_PLUGIN_MAGIC, |
| 530 | PURPLE_MAJOR_VERSION, | |
| 531 | PURPLE_MINOR_VERSION, | |
| 532 | PURPLE_PLUGIN_STANDARD, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
533 | PIDGIN_PLUGIN_TYPE, |
| 10584 | 534 | 0, |
| 535 | NULL, | |
| 15884 | 536 | PURPLE_PRIORITY_DEFAULT, |
| 537 | "purplerc", | |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
538 | N_("Pidgin GTK+ Theme Control"), |
| 10584 | 539 | VERSION, |
| 540 | N_("Provides access to commonly used gtkrc settings."), | |
| 541 | N_("Provides access to commonly used gtkrc settings."), | |
| 542 | "Etan Reisner <deryni@eden.rutgers.edu>", | |
| 15884 | 543 | PURPLE_WEBSITE, |
| 544 | purplerc_plugin_load, | |
| 545 | purplerc_plugin_unload, | |
| 10584 | 546 | NULL, |
| 15884 | 547 | &purplerc_ui_info, |
| 10584 | 548 | NULL, |
| 549 | NULL, | |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
550 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
551 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
552 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
553 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
554 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
555 | NULL, |
| 10584 | 556 | NULL |
| 557 | }; | |
| 558 | ||
| 559 | static void | |
| 15884 | 560 | purplerc_init(PurplePlugin *plugin) |
| 10584 | 561 | { |
|
18242
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
562 | gint i; |
| 10584 | 563 | |
| 15884 | 564 | purple_prefs_add_none("/plugins"); |
| 565 | purple_prefs_add_none("/plugins/gtk"); | |
| 566 | purple_prefs_add_none("/plugins/gtk/purplerc"); | |
| 567 | purple_prefs_add_none("/plugins/gtk/purplerc/set"); | |
| 10584 | 568 | |
| 15884 | 569 | purple_prefs_add_string("/plugins/gtk/purplerc/gtk-font-name", ""); |
| 570 | purple_prefs_add_bool("/plugins/gtk/purplerc/set/gtk-font-name", FALSE); | |
| 10584 | 571 | |
| 15884 | 572 | purple_prefs_add_string("/plugins/gtk/purplerc/gtk-key-theme-name", ""); |
| 573 | purple_prefs_add_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name", FALSE); | |
| 10584 | 574 | |
| 15884 | 575 | purple_prefs_add_none("/plugins/gtk/purplerc/color"); |
| 576 | purple_prefs_add_none("/plugins/gtk/purplerc/set/color"); | |
| 10584 | 577 | for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) { |
| 15884 | 578 | purple_prefs_add_string(color_prefs[i], ""); |
| 579 | purple_prefs_add_bool(color_prefs_set[i], FALSE); | |
| 10584 | 580 | } |
| 581 | ||
| 15884 | 582 | purple_prefs_add_none("/plugins/gtk/purplerc/size"); |
| 583 | purple_prefs_add_none("/plugins/gtk/purplerc/set/size"); | |
| 10584 | 584 | for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) { |
| 15884 | 585 | purple_prefs_add_int(widget_size_prefs[i], 0); |
| 586 | purple_prefs_add_bool(widget_size_prefs_set[i], FALSE); | |
| 10584 | 587 | } |
| 588 | ||
| 15884 | 589 | purple_prefs_add_none("/plugins/gtk/purplerc/font"); |
| 590 | purple_prefs_add_none("/plugins/gtk/purplerc/set/font"); | |
| 10584 | 591 | for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) { |
| 15884 | 592 | purple_prefs_add_string(font_prefs[i], ""); |
| 593 | purple_prefs_add_bool(font_prefs_set[i], FALSE); | |
| 10584 | 594 | } |
| 12973 | 595 | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
596 | /* |
| 15884 | 597 | purple_prefs_add_none("/plugins/gtk/purplerc/bool"); |
| 598 | purple_prefs_add_none("/plugins/gtk/purplerc/set/bool"); | |
| 12973 | 599 | for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) { |
| 15884 | 600 | purple_prefs_add_bool(widget_bool_prefs[i], TRUE); |
| 601 | purple_prefs_add_bool(widget_bool_prefs_set[i], FALSE); | |
| 12973 | 602 | } |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
603 | */ |
| 10584 | 604 | } |
| 605 | ||
| 15884 | 606 | PURPLE_INIT_PLUGIN(purplerc, purplerc_init, purplerc_info) |