Sun, 17 Jun 2007 23:42:32 +0000
Some general cleanup of the pidginrc plugin that I did while working on my
first attempt at adding status theme stuff.
This is just the cleanup, not the status theme support.
| 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 | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 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", |
| 60 | "/plugins/gtk/purplerc/font/*pidgin_conv_imhtml", | |
|
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
|
61 | "/plugins/gtk/purplerc/font/*pidgin_log_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
|
62 | "/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
|
63 | "/plugins/gtk/purplerc/font/*pidgin_notify_imhtml", |
| 10584 | 64 | }; |
|
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
|
65 | static const gchar *font_prefs_set[] = { |
| 15884 | 66 | "/plugins/gtk/purplerc/set/font/*pidgin_conv_entry", |
| 67 | "/plugins/gtk/purplerc/set/font/*pidgin_conv_imhtml", | |
|
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
|
68 | "/plugins/gtk/purplerc/set/font/*pidgin_log_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
|
69 | "/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
|
70 | "/plugins/gtk/purplerc/set/font/*pidgin_notify_imhtml", |
| 10584 | 71 | }; |
|
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
|
72 | static const gchar *font_names[] = { |
|
10585
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
73 | N_("Conversation Entry"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
74 | N_("Conversation History"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
75 | N_("Log Viewer"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
76 | N_("Request Dialog"), |
|
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
77 | N_("Notify Dialog") |
| 10584 | 78 | }; |
| 79 | static GtkWidget *font_widgets[G_N_ELEMENTS(font_prefs)]; | |
| 80 | ||
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
81 | /* |
|
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
|
82 | static const gchar *widget_bool_prefs[] = { |
| 12973 | 83 | }; |
|
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
|
84 | static const gchar *widget_bool_prefs_set[] = { |
| 12973 | 85 | }; |
|
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
|
86 | static const gchar *widget_bool_names[] = { |
| 12973 | 87 | }; |
| 88 | 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
|
89 | */ |
| 12973 | 90 | |
|
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
|
91 | 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
|
92 | make_gtkrc_string() |
| 10584 | 93 | { |
|
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
|
94 | 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
|
95 | gchar *prefbase = NULL; |
| 10584 | 96 | GString *style_string = g_string_new(""); |
| 97 | ||
| 15884 | 98 | 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
|
99 | const gchar *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-font-name"); |
| 14391 | 100 | |
|
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
|
101 | 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
|
102 | 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
|
103 | "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
|
104 | 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
|
105 | } |
| 10584 | 106 | } |
| 107 | ||
| 15884 | 108 | 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
|
109 | const gchar *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-key-theme-name"); |
| 14391 | 110 | |
|
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
|
111 | 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
|
112 | 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
|
113 | "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
|
114 | 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
|
115 | } |
| 10584 | 116 | } |
| 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 | g_string_append(style_string, "style \"purplerc_style\"\n{"); |
| 10584 | 119 | |
| 120 | for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) { | |
| 15884 | 121 | 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
|
122 | const gchar *pref; |
| 14391 | 123 | |
|
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
|
124 | 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
|
125 | 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
|
126 | 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
|
127 | 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
|
128 | "\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
|
129 | 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
|
130 | 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
|
131 | } |
| 10584 | 132 | } |
| 133 | } | |
| 134 | ||
| 135 | for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) { | |
| 15884 | 136 | if (purple_prefs_get_bool(widget_size_prefs_set[i])) { |
| 10584 | 137 | prefbase = g_path_get_basename(widget_size_prefs[i]); |
| 138 | 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
|
139 | "\n\t%s = %d", prefbase, |
| 15884 | 140 | purple_prefs_get_int(widget_size_prefs[i])); |
| 10584 | 141 | g_free(prefbase); |
| 142 | } | |
| 143 | } | |
| 144 | ||
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
145 | /* |
| 12973 | 146 | for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) { |
| 15884 | 147 | if (purple_prefs_get_bool(widget_bool_prefs_set[i])) { |
| 12973 | 148 | prefbase = g_path_get_basename(widget_bool_prefs[i]); |
| 149 | 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
|
150 | "\t%s = %d\n", prefbase, |
| 15884 | 151 | purple_prefs_get_bool(widget_bool_prefs[i])); |
| 12973 | 152 | g_free(prefbase); |
| 153 | } | |
| 154 | } | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
155 | */ |
| 12973 | 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 | g_string_append(style_string, "\n}\nwidget_class \"*\" style \"purplerc_style\"\n"); |
| 10584 | 158 | |
| 159 | for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) { | |
| 15884 | 160 | 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
|
161 | const gchar *pref; |
| 14391 | 162 | |
|
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
|
163 | 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
|
164 | 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
|
165 | prefbase = g_path_get_basename(font_prefs[i]); |
| 14391 | 166 | 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
|
167 | "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
|
168 | "\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
|
169 | "\nwidget \"%s\" " |
| 14391 | 170 | "style \"%s_style\"\n", |
| 171 | prefbase, pref, | |
| 172 | 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
|
173 | 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
|
174 | } |
| 10584 | 175 | } |
| 176 | } | |
| 177 | ||
|
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
|
178 | 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
|
179 | } |
|
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 | |
|
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 | 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
|
182 | 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
|
183 | { |
|
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 | 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
|
185 | #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
|
186 | 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
|
187 | #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
|
188 | |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
189 | 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
|
190 | g_string_free(str, TRUE); |
| 10584 | 191 | |
| 12973 | 192 | #if GTK_CHECK_VERSION(2,4,0) |
| 193 | setting = gtk_settings_get_default(); | |
| 194 | gtk_rc_reset_styles(setting); | |
| 195 | #endif | |
| 10584 | 196 | } |
| 197 | ||
| 198 | static void | |
| 15884 | 199 | purplerc_write(GtkWidget *widget, gpointer data) |
| 11940 | 200 | { |
|
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
|
201 | 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
|
202 | 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
|
203 | 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
|
204 | g_string_free(str, TRUE); |
| 11940 | 205 | } |
| 206 | ||
| 207 | static void | |
| 15884 | 208 | purplerc_reread(GtkWidget *widget, gpointer data) |
| 11940 | 209 | { |
| 210 | gtk_rc_reparse_all(); | |
| 12973 | 211 | /* I don't know if this is necessary but if not it shouldn't hurt. */ |
| 15884 | 212 | purplerc_make_changes(); |
| 11940 | 213 | } |
| 214 | ||
| 215 | static void | |
| 15884 | 216 | 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
|
217 | gconstpointer value, gpointer data) |
| 10584 | 218 | { |
| 15884 | 219 | purplerc_make_changes(); |
| 10584 | 220 | } |
| 221 | ||
| 222 | static void | |
| 15884 | 223 | purplerc_color_response(GtkDialog *color_dialog, gint response, gpointer data) |
| 10584 | 224 | { |
|
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
|
225 | gint subscript = GPOINTER_TO_INT(data); |
| 10584 | 226 | |
| 227 | 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
|
228 | 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
|
229 | gchar colorstr[8]; |
| 10584 | 230 | GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel; |
| 231 | ||
| 232 | gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color); | |
| 233 | ||
| 234 | g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X", | |
| 235 | color.red/256, color.green/256, color.blue/256); | |
| 236 | ||
| 15884 | 237 | purple_prefs_set_string(color_prefs[subscript], colorstr); |
| 10584 | 238 | } |
| 239 | gtk_widget_destroy(GTK_WIDGET(color_dialog)); | |
| 240 | } | |
| 241 | ||
| 242 | static void | |
| 15884 | 243 | purplerc_set_color(GtkWidget *widget, gpointer data) |
| 10584 | 244 | { |
|
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
|
245 | 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
|
246 | 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
|
247 | const gchar *pref = NULL; |
| 10584 | 248 | 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
|
249 | gint subscript = GPOINTER_TO_INT(data); |
| 10584 | 250 | |
| 251 | g_snprintf(title, sizeof(title), _("Select Color for %s"), | |
|
10586
fd1399d550fc
[gaim-migrate @ 11990]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10585
diff
changeset
|
252 | _(color_names[GPOINTER_TO_INT(data)])); |
| 10584 | 253 | color_dialog = gtk_color_selection_dialog_new(_("Select Color")); |
| 254 | g_signal_connect(G_OBJECT(color_dialog), "response", | |
| 15884 | 255 | G_CALLBACK(purplerc_color_response), data); |
| 10584 | 256 | |
| 15884 | 257 | pref = purple_prefs_get_string(color_prefs[subscript]); |
| 14391 | 258 | |
| 259 | if (pref != NULL && strcmp(pref, "")) { | |
| 260 | if (gdk_color_parse(pref, &color)) { | |
| 261 | gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color); | |
| 262 | } | |
| 10584 | 263 | } |
| 264 | ||
| 265 | gtk_window_present(GTK_WINDOW(color_dialog)); | |
| 266 | } | |
| 267 | ||
| 268 | static void | |
| 15884 | 269 | purplerc_font_response(GtkDialog *font_dialog, gint response, gpointer data) |
| 10584 | 270 | { |
|
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
|
271 | 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
|
272 | gint subscript = GPOINTER_TO_INT(data); |
| 10584 | 273 | |
| 274 | 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
|
275 | 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
|
276 | |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
277 | 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
|
278 | 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
|
279 | } 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
|
280 | 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
|
281 | } |
| 10584 | 282 | |
| 283 | fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog)); | |
| 284 | ||
|
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
|
285 | purple_prefs_set_string(prefpath, fontname); |
| 10584 | 286 | g_free(fontname); |
| 287 | } | |
| 288 | gtk_widget_destroy(GTK_WIDGET(font_dialog)); | |
| 289 | } | |
| 290 | ||
| 291 | static void | |
| 15884 | 292 | purplerc_set_font(GtkWidget *widget, gpointer data) |
| 10584 | 293 | { |
|
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
|
294 | gchar title[128]; |
| 10584 | 295 | 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
|
296 | 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
|
297 | const gchar *pref = NULL, *prefpath = NULL; |
| 10584 | 298 | |
|
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
|
299 | 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
|
300 | 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
|
301 | 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
|
302 | } 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
|
303 | 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
|
304 | _(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
|
305 | 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
|
306 | } |
|
899ccffe6c26
Some general cleanup of the pidginrc plugin that I did while working on my
Etan Reisner <deryni@pidgin.im>
parents:
17247
diff
changeset
|
307 | |
| 10584 | 308 | font_dialog = gtk_font_selection_dialog_new(title); |
| 309 | g_signal_connect(G_OBJECT(font_dialog), "response", | |
| 15884 | 310 | G_CALLBACK(purplerc_font_response), data); |
| 10584 | 311 | |
|
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
|
312 | pref = purple_prefs_get_string(prefpath); |
| 14391 | 313 | |
| 314 | if (pref != NULL && strcmp(pref, "")) { | |
| 315 | gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), pref); | |
| 10584 | 316 | } |
| 317 | ||
| 318 | gtk_window_present(GTK_WINDOW(font_dialog)); | |
| 319 | } | |
| 320 | ||
| 321 | static gboolean | |
| 15884 | 322 | purplerc_plugin_load(PurplePlugin *plugin) |
| 10584 | 323 | { |
| 15884 | 324 | purplerc_make_changes(); |
| 10584 | 325 | |
|
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
|
326 | 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
|
327 | "/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
|
328 | 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
|
329 | NULL); |
| 10584 | 330 | |
| 331 | return TRUE; | |
| 332 | } | |
| 333 | ||
| 334 | static gboolean | |
| 15884 | 335 | purplerc_plugin_unload(PurplePlugin *plugin) |
| 10584 | 336 | { |
| 15884 | 337 | purple_prefs_disconnect_callback(pref_callback); |
| 10584 | 338 | |
| 339 | return TRUE; | |
| 340 | } | |
| 341 | ||
| 342 | static GtkWidget * | |
| 15884 | 343 | purplerc_get_config_frame(PurplePlugin *plugin) |
| 10584 | 344 | { |
| 12546 | 345 | /* 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
|
346 | * pidgin_prefs_labeled_* functions they only add the text label to |
| 12546 | 347 | * 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
|
348 | 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
|
349 | gchar *tmp; |
| 12546 | 350 | 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
|
351 | 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
|
352 | 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
|
353 | #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
|
354 | 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
|
355 | #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
|
356 | 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
|
357 | #endif |
| 10584 | 358 | |
| 15882 | 359 | ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 360 | gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); | |
| 10584 | 361 | |
| 12546 | 362 | labelsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 363 | 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
|
364 | buttonsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 10584 | 365 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
366 | frame = pidgin_make_frame(ret, _("General")); |
| 10584 | 367 | /* interface font */ |
| 15882 | 368 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 369 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 370 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
371 | 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
|
372 | "/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
|
373 | hbox); |
| 12546 | 374 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 375 | |
| 15568 | 376 | 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
|
377 | PIDGIN_BUTTON_HORIZONTAL); |
| 10584 | 378 | gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); |
| 12546 | 379 | gtk_size_group_add_widget(widgetsg, widget); |
| 10584 | 380 | gtk_widget_set_sensitive(widget, |
| 15884 | 381 | purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-font-name")); |
| 10584 | 382 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
383 | G_CALLBACK(pidgin_toggle_sensitive), widget); |
| 10584 | 384 | 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
|
385 | G_CALLBACK(purplerc_set_font), GINT_TO_POINTER(-1)); |
| 10584 | 386 | |
| 387 | /* key theme name */ | |
| 15882 | 388 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 389 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 390 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
391 | 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
|
392 | "/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
|
393 | hbox); |
| 12546 | 394 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 395 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
396 | 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
|
397 | "/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
|
398 | NULL); |
| 12546 | 399 | /* |
| 400 | gtk_size_group_add_widget(widgetsg, widget); | |
| 401 | */ | |
| 10584 | 402 | gtk_widget_set_sensitive(widget, |
| 15884 | 403 | purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name")); |
| 10584 | 404 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
405 | G_CALLBACK(pidgin_toggle_sensitive), widget); |
| 10584 | 406 | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
407 | /* |
| 12973 | 408 | for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) { |
| 15882 | 409 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 12973 | 410 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 411 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
412 | 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
|
413 | widget_bool_prefs_set[i], hbox); |
| 12973 | 414 | gtk_size_group_add_widget(labelsg, check); |
| 415 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
416 | 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
|
417 | * |
| 12973 | 418 | 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
|
419 | * |
| 12973 | 420 | gtk_widget_set_sensitive(widget_bool_widgets[i], |
| 15884 | 421 | purple_prefs_get_bool(widget_bool_prefs_set[i])); |
| 12973 | 422 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
423 | G_CALLBACK(pidgin_toggle_sensitive), |
| 12973 | 424 | widget_bool_widgets[i]); |
| 425 | } | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
426 | */ |
| 12973 | 427 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
428 | frame = pidgin_make_frame(ret, _("Interface colors")); |
| 10584 | 429 | /* imhtml stuff */ |
| 430 | for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) { | |
| 15882 | 431 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 432 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 433 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
434 | 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
|
435 | color_prefs_set[i], hbox); |
| 12546 | 436 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 437 | |
| 15568 | 438 | color_widgets[i] = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_COLOR, PIDGIN_BUTTON_HORIZONTAL); |
| 12546 | 439 | gtk_size_group_add_widget(widgetsg, color_widgets[i]); |
| 10584 | 440 | gtk_box_pack_start(GTK_BOX(hbox), color_widgets[i], FALSE, |
| 441 | FALSE, 0); | |
| 442 | gtk_widget_set_sensitive(color_widgets[i], | |
| 15884 | 443 | purple_prefs_get_bool(color_prefs_set[i])); |
| 10584 | 444 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
445 | G_CALLBACK(pidgin_toggle_sensitive), |
| 10584 | 446 | color_widgets[i]); |
| 447 | g_signal_connect(G_OBJECT(color_widgets[i]), "clicked", | |
| 15884 | 448 | G_CALLBACK(purplerc_set_color), |
| 10584 | 449 | GINT_TO_POINTER(i)); |
| 450 | } | |
| 451 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
452 | frame = pidgin_make_frame(ret, _("Widget Sizes")); |
|
10585
42d99375d8d0
[gaim-migrate @ 11989]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10584
diff
changeset
|
453 | /* widget size stuff */ |
| 10584 | 454 | for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) { |
| 15882 | 455 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 456 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 457 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
458 | 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
|
459 | widget_size_prefs_set[i], hbox); |
| 12546 | 460 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 461 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
462 | widget_size_widgets[i] = pidgin_prefs_labeled_spin_button(hbox, "", widget_size_prefs[i], 0, 50, NULL); |
| 12546 | 463 | /* |
| 464 | gtk_size_group_add_widget(widgetsg, widget_size_widgets[i]); | |
| 465 | */ | |
| 10584 | 466 | gtk_widget_set_sensitive(widget_size_widgets[i], |
| 15884 | 467 | purple_prefs_get_bool(widget_size_prefs_set[i])); |
| 10584 | 468 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
469 | G_CALLBACK(pidgin_toggle_sensitive), |
| 10584 | 470 | widget_size_widgets[i]); |
| 471 | } | |
| 472 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
473 | frame = pidgin_make_frame(ret, _("Fonts")); |
| 10584 | 474 | /* imhtml font stuff */ |
| 475 | for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) { | |
| 15882 | 476 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 10584 | 477 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 478 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
479 | 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
|
480 | font_prefs_set[i], hbox); |
| 12546 | 481 | gtk_size_group_add_widget(labelsg, check); |
| 10584 | 482 | |
| 15568 | 483 | font_widgets[i] = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT, PIDGIN_BUTTON_HORIZONTAL); |
| 12546 | 484 | gtk_size_group_add_widget(widgetsg, font_widgets[i]); |
| 10584 | 485 | gtk_box_pack_start(GTK_BOX(hbox), font_widgets[i], FALSE, |
| 486 | FALSE, 0); | |
| 487 | gtk_widget_set_sensitive(font_widgets[i], | |
| 15884 | 488 | purple_prefs_get_bool(font_prefs_set[i])); |
| 10584 | 489 | g_signal_connect(G_OBJECT(check), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
490 | G_CALLBACK(pidgin_toggle_sensitive), |
| 10584 | 491 | font_widgets[i]); |
| 492 | 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
|
493 | 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
|
494 | GINT_TO_POINTER(i)); |
| 10584 | 495 | } |
| 496 | ||
|
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
|
497 | frame = pidgin_make_frame(ret, _("Gtkrc File Tools")); |
| 11940 | 498 | |
|
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
|
499 | 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
|
500 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 11940 | 501 | |
|
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
|
502 | 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
|
503 | homepath, G_DIR_SEPARATOR_S); |
|
12042
b90399880391
[gaim-migrate @ 14337]
Richard Laager <rlaager@pidgin.im>
parents:
11941
diff
changeset
|
504 | check = gtk_button_new_with_label(tmp); |
|
b90399880391
[gaim-migrate @ 14337]
Richard Laager <rlaager@pidgin.im>
parents:
11941
diff
changeset
|
505 | 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
|
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_write), NULL); |
| 11940 | 510 | |
| 511 | 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
|
512 | 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
|
513 | 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
|
514 | 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
|
515 | G_CALLBACK(purplerc_reread), NULL); |
| 11940 | 516 | |
| 10584 | 517 | gtk_widget_show_all(ret); |
| 518 | return ret; | |
| 519 | } | |
| 520 | ||
| 15884 | 521 | static PidginPluginUiInfo purplerc_ui_info = |
| 10584 | 522 | { |
| 15884 | 523 | 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
|
524 | 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
|
525 | |
|
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
|
526 | /* 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
|
527 | 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
|
528 | 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
|
529 | 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
|
530 | NULL |
| 10584 | 531 | }; |
| 532 | ||
| 15884 | 533 | static PurplePluginInfo purplerc_info = |
| 10584 | 534 | { |
| 15884 | 535 | PURPLE_PLUGIN_MAGIC, |
| 536 | PURPLE_MAJOR_VERSION, | |
| 537 | PURPLE_MINOR_VERSION, | |
| 538 | PURPLE_PLUGIN_STANDARD, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15442
diff
changeset
|
539 | PIDGIN_PLUGIN_TYPE, |
| 10584 | 540 | 0, |
| 541 | NULL, | |
| 15884 | 542 | PURPLE_PRIORITY_DEFAULT, |
| 543 | "purplerc", | |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
544 | N_("Pidgin GTK+ Theme Control"), |
| 10584 | 545 | VERSION, |
| 546 | N_("Provides access to commonly used gtkrc settings."), | |
| 547 | N_("Provides access to commonly used gtkrc settings."), | |
| 548 | "Etan Reisner <deryni@eden.rutgers.edu>", | |
| 15884 | 549 | PURPLE_WEBSITE, |
| 550 | purplerc_plugin_load, | |
| 551 | purplerc_plugin_unload, | |
| 10584 | 552 | NULL, |
| 15884 | 553 | &purplerc_ui_info, |
| 10584 | 554 | NULL, |
| 555 | 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
|
556 | 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
|
557 | |
|
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
|
558 | /* 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
|
559 | 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
|
560 | 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
|
561 | NULL, |
| 10584 | 562 | NULL |
| 563 | }; | |
| 564 | ||
| 565 | static void | |
| 15884 | 566 | purplerc_init(PurplePlugin *plugin) |
| 10584 | 567 | { |
|
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
|
568 | gint i; |
| 10584 | 569 | |
| 15884 | 570 | purple_prefs_add_none("/plugins"); |
| 571 | purple_prefs_add_none("/plugins/gtk"); | |
| 572 | purple_prefs_add_none("/plugins/gtk/purplerc"); | |
| 573 | purple_prefs_add_none("/plugins/gtk/purplerc/set"); | |
| 10584 | 574 | |
| 15884 | 575 | purple_prefs_add_string("/plugins/gtk/purplerc/gtk-font-name", ""); |
| 576 | purple_prefs_add_bool("/plugins/gtk/purplerc/set/gtk-font-name", FALSE); | |
| 10584 | 577 | |
| 15884 | 578 | purple_prefs_add_string("/plugins/gtk/purplerc/gtk-key-theme-name", ""); |
| 579 | purple_prefs_add_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name", FALSE); | |
| 10584 | 580 | |
| 15884 | 581 | purple_prefs_add_none("/plugins/gtk/purplerc/color"); |
| 582 | purple_prefs_add_none("/plugins/gtk/purplerc/set/color"); | |
| 10584 | 583 | for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) { |
| 15884 | 584 | purple_prefs_add_string(color_prefs[i], ""); |
| 585 | purple_prefs_add_bool(color_prefs_set[i], FALSE); | |
| 10584 | 586 | } |
| 587 | ||
| 15884 | 588 | purple_prefs_add_none("/plugins/gtk/purplerc/size"); |
| 589 | purple_prefs_add_none("/plugins/gtk/purplerc/set/size"); | |
| 10584 | 590 | for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) { |
| 15884 | 591 | purple_prefs_add_int(widget_size_prefs[i], 0); |
| 592 | purple_prefs_add_bool(widget_size_prefs_set[i], FALSE); | |
| 10584 | 593 | } |
| 594 | ||
| 15884 | 595 | purple_prefs_add_none("/plugins/gtk/purplerc/font"); |
| 596 | purple_prefs_add_none("/plugins/gtk/purplerc/set/font"); | |
| 10584 | 597 | for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) { |
| 15884 | 598 | purple_prefs_add_string(font_prefs[i], ""); |
| 599 | purple_prefs_add_bool(font_prefs_set[i], FALSE); | |
| 10584 | 600 | } |
| 12973 | 601 | |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
602 | /* |
| 15884 | 603 | purple_prefs_add_none("/plugins/gtk/purplerc/bool"); |
| 604 | purple_prefs_add_none("/plugins/gtk/purplerc/set/bool"); | |
| 12973 | 605 | for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) { |
| 15884 | 606 | purple_prefs_add_bool(widget_bool_prefs[i], TRUE); |
| 607 | purple_prefs_add_bool(widget_bool_prefs_set[i], FALSE); | |
| 12973 | 608 | } |
|
17209
bfccb73d3ea1
Remove the "GtkTreeView Indent Expanders" boolean preference, because the
Etan Reisner <deryni@pidgin.im>
parents:
17096
diff
changeset
|
609 | */ |
| 10584 | 610 | } |
| 611 | ||
| 15884 | 612 | PURPLE_INIT_PLUGIN(purplerc, purplerc_init, purplerc_info) |