annotate pidgin/plugins/pidginrc.c @ 16661:219c267639f4

README.dbus is gone
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 29 Apr 2007 18:21:20 +0000
parents 765cfc73182f
children 3d41d0d7fb9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15905
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /**
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * @file purplerc.c Purple gtk resource control plugin.
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 *
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * Copyright (C) 2005 Etan Reisner <deryni@eden.rutgers.edu>
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 *
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 * (at your option) any later version.
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 *
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 * GNU General Public License for more details.
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 *
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 #include "internal.h"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 #include "gtkplugin.h"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 #include "gtkprefs.h"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 #include "gtkutils.h"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 #include "util.h"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 #include "version.h"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 static guint pref_callback;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 static const char *color_prefs[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 "/plugins/gtk/purplerc/color/GtkWidget::cursor-color",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 "/plugins/gtk/purplerc/color/GtkWidget::secondary-cursor-color",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 "/plugins/gtk/purplerc/color/GtkIMHtml::hyperlink-color"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 static const char *color_prefs_set[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 "/plugins/gtk/purplerc/set/color/GtkWidget::cursor-color",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 "/plugins/gtk/purplerc/set/color/GtkWidget::secondary-cursor-color",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 "/plugins/gtk/purplerc/set/color/GtkIMHtml::hyperlink-color"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 static const char *color_names[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41 N_("Cursor Color"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 N_("Secondary Cursor Color"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 N_("Hyperlink Color")
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 static GtkWidget *color_widgets[G_N_ELEMENTS(color_prefs)];
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47 static const char *widget_size_prefs[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48 "/plugins/gtk/purplerc/size/GtkTreeView::expander_size",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 "/plugins/gtk/purplerc/size/GtkTreeView::horizontal_separator"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
51 static const char *widget_size_prefs_set[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
52 "/plugins/gtk/purplerc/set/size/GtkTreeView::expander_size",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 "/plugins/gtk/purplerc/set/size/GtkTreeView::horizontal_separator"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55 static const char *widget_size_names[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 N_("GtkTreeView Expander Size"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57 N_("GtkTreeView Horizontal Separation")
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59 static GtkWidget *widget_size_widgets[G_N_ELEMENTS(widget_size_prefs)];
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
60
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
61 static const char *font_prefs[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62 "/plugins/gtk/purplerc/font/*pidgin_conv_entry",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
63 "/plugins/gtk/purplerc/font/*pidgin_conv_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
64 "/plugins/gtk/purplerc/font/*pidginlog_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 "/plugins/gtk/purplerc/font/*pidginrequest_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
66 "/plugins/gtk/purplerc/font/*pidginnotify_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68 static const char *font_prefs_set[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69 "/plugins/gtk/purplerc/set/font/*pidgin_conv_entry",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70 "/plugins/gtk/purplerc/set/font/*pidgin_conv_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71 "/plugins/gtk/purplerc/set/font/*pidginlog_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72 "/plugins/gtk/purplerc/set/font/*pidginrequest_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
73 "/plugins/gtk/purplerc/set/font/*pidginnotify_imhtml",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 static const char *font_names[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 N_("Conversation Entry"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77 N_("Conversation History"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78 N_("Log Viewer"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 N_("Request Dialog"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 N_("Notify Dialog")
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82 static GtkWidget *font_widgets[G_N_ELEMENTS(font_prefs)];
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
83
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
84 static const char *widget_bool_prefs[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
85 "/plugins/gtk/purplerc/bool/GtkTreeView::indent_expanders",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 static const char *widget_bool_prefs_set[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 "/plugins/gtk/purplerc/set/bool/GtkTreeView::indent_expanders",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90 static const char *widget_bool_names[] = {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
91 N_("GtkTreeView Indent Expanders"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 static GtkWidget *widget_bool_widgets[G_N_ELEMENTS(widget_bool_prefs)];
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
95 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
96 purplerc_make_changes()
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98 int i;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 char *prefbase = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 #if GTK_CHECK_VERSION(2,4,0)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 GtkSettings *setting = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102 #endif
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
103 GString *style_string = g_string_new("");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 if (purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-font-name")) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106 const char *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-font-name");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109 g_string_append_printf(style_string, "gtk-font-name = \"%s\"\n", pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
112 if (purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name")) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
113 const char *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-key-theme-name");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116 g_string_append_printf(style_string, "gtk-key-theme-name = \"%s\"\n", pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
118
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119 g_string_append(style_string, "style \"purplerc_style\" {\n");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
122 if (purple_prefs_get_bool(color_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
123 const char *pref;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
124
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
125 prefbase = g_path_get_basename(color_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126 pref = purple_prefs_get_string(color_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
127
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
128 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130 "%s = \"%s\"\n",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131 prefbase, pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
132 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
133 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
135
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
137 if (purple_prefs_get_bool(widget_size_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
138 prefbase = g_path_get_basename(widget_size_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
139 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 "%s = %d\n", prefbase,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141 purple_prefs_get_int(widget_size_prefs[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
142 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
145
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
146 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
147 if (purple_prefs_get_bool(widget_bool_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
148 prefbase = g_path_get_basename(widget_bool_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
149 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
150 "%s = %d\n", prefbase,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 purple_prefs_get_bool(widget_bool_prefs[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 g_string_append(style_string, "}");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 g_string_append(style_string, "widget_class \"*\" style \"purplerc_style\"\n");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160 if (purple_prefs_get_bool(font_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161 const char *pref;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
163 prefbase = g_path_get_basename(font_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 pref = purple_prefs_get_string(font_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
166 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 "style \"%s_style\"\n"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 "{font_name = \"%s\"}\n"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170 "widget \"%s\""
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 "style \"%s_style\"\n",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 prefbase, pref,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173 prefbase, prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 gtk_rc_parse_string(style_string->str);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179 g_string_free(style_string, TRUE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181 #if GTK_CHECK_VERSION(2,4,0)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
182 setting = gtk_settings_get_default();
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
183 gtk_rc_reset_styles(setting);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
184 #endif
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
185 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188 purplerc_write(GtkWidget *widget, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190 int i;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 GString *style_string = g_string_new("");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
192 char *prefbase = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
194 if (purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-font-name")) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
195 const char *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-font-name");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
199 "gtk-font-name = \"%s\"\n",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
200 pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
203 if (purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name")) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204 const char *pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-key-theme-name");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 "gtk-key-theme-name = \"%s\"\n",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212 g_string_append(style_string, "style \"purplerc_style\" {\n");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215 if (purple_prefs_get_bool(color_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 const char *pref;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
218 prefbase = g_path_get_basename(color_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
219 pref = purple_prefs_get_string(color_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
220
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
223 "%s = \"%s\"\n",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
224 prefbase, pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
225 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
226 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
228
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
230 if (purple_prefs_get_bool(widget_size_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
231 prefbase = g_path_get_basename(widget_size_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233 "%s = %d\n", prefbase,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 purple_prefs_get_int(widget_size_prefs[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
239 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
240 if (purple_prefs_get_bool(widget_bool_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
241 prefbase = g_path_get_basename(widget_bool_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
242 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243 "%s = %d\n", prefbase,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244 purple_prefs_get_bool(widget_bool_prefs[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
245 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
246 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
247 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
248
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
249 g_string_append(style_string, "}");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
250 g_string_append(style_string, "widget_class \"*\" style \"purplerc_style\"\n");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
251
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
252 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
253 if (purple_prefs_get_bool(font_prefs_set[i])) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
254 const char *pref;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256 prefbase = g_path_get_basename(font_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
257 pref = purple_prefs_get_string(font_prefs[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
258
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259 if (pref != NULL && strcmp(pref, ""))
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
260 g_string_append_printf(style_string,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
261 "style \"%s_style\"\n"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
262 "{font_name = \"%s\"}\n"
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
263 "widget \"%s\""
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
264 "style \"%s_style\"\n",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
265 prefbase, pref,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
266 prefbase, prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
267 g_free(prefbase);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
268 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
269 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
270
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
271 purple_util_write_data_to_file("gtkrc-2.0", style_string->str, -1);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
272
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
273 g_string_free(style_string, TRUE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
274 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
275
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
276 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
277 purplerc_reread(GtkWidget *widget, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
278 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
279 gtk_rc_reparse_all();
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
280 /* I don't know if this is necessary but if not it shouldn't hurt. */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
281 purplerc_make_changes();
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
282 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
283
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
284 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
285 purplerc_pref_changed_cb(const char *name, PurplePrefType type,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
286 gconstpointer value, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
287 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
288 purplerc_make_changes();
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
289 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
290
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
291 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
292 purplerc_color_response(GtkDialog *color_dialog, gint response, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
293 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
294 int subscript = GPOINTER_TO_INT(data);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
295
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
296 if (response == GTK_RESPONSE_OK) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
297 GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
298 GdkColor color;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
299 char colorstr[8];
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
300
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
301 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
302
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
303 g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
304 color.red/256, color.green/256, color.blue/256);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
305
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
306 purple_prefs_set_string(color_prefs[subscript], colorstr);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
307 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
308 gtk_widget_destroy(GTK_WIDGET(color_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
309 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
310
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
311 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
312 purplerc_set_color(GtkWidget *widget, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
313 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
314 GtkWidget *color_dialog = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
315 GdkColor color;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
316 char title[128];
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
317 const char *pref = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
318 int subscript = GPOINTER_TO_INT(data);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
319
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
320 g_snprintf(title, sizeof(title), _("Select Color for %s"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
321 _(color_names[GPOINTER_TO_INT(data)]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
322 color_dialog = gtk_color_selection_dialog_new(_("Select Color"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
323 g_signal_connect(G_OBJECT(color_dialog), "response",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
324 G_CALLBACK(purplerc_color_response), data);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
325
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
326 pref = purple_prefs_get_string(color_prefs[subscript]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
327
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
328 if (pref != NULL && strcmp(pref, "")) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
329 if (gdk_color_parse(pref, &color)) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
330 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
331 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
332 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
333
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
334 gtk_window_present(GTK_WINDOW(color_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
335 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
336
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
337 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
338 purplerc_font_response(GtkDialog *font_dialog, gint response, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
339 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
340 int subscript = GPOINTER_TO_INT(data);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
341
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
342 if (response == GTK_RESPONSE_OK) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
343 char *fontname = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
344
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
345 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
346
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
347 purple_prefs_set_string(font_prefs[subscript], fontname);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
348 g_free(fontname);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
349 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
350 gtk_widget_destroy(GTK_WIDGET(font_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
351 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
352
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
353 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
354 purplerc_set_font(GtkWidget *widget, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
355 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
356 GtkWidget *font_dialog = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
357 char title[128];
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
358 const char *pref = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
359 int subscript = GPOINTER_TO_INT(data);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
360
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
361 g_snprintf(title, sizeof(title), _("Select Font for %s"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
362 _(font_names[subscript]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
363 font_dialog = gtk_font_selection_dialog_new(title);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
364 g_signal_connect(G_OBJECT(font_dialog), "response",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
365 G_CALLBACK(purplerc_font_response), data);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
366
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
367 pref = purple_prefs_get_string(font_prefs[subscript]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
368
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
369 if (pref != NULL && strcmp(pref, "")) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
370 gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
371 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
372
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
373 gtk_window_present(GTK_WINDOW(font_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
374 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
375
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
376 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
377 purplerc_font_response_special(GtkDialog *font_dialog, gint response,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
378 gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
379 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
380 if (response == GTK_RESPONSE_OK) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
381 char *fontname = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
382
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
383 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
384
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
385 purple_prefs_set_string("/plugins/gtk/purplerc/gtk-font-name",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
386 fontname);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
387 g_free(fontname);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
388 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
389 gtk_widget_destroy(GTK_WIDGET(font_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
390 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
391
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
392 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
393 purplerc_set_font_special(GtkWidget *widget, gpointer data)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
394 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
395 GtkWidget *font_dialog = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
396 const char *pref = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
397
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
398 font_dialog = gtk_font_selection_dialog_new(_("Select Interface Font"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
399 g_signal_connect(G_OBJECT(font_dialog), "response",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
400 G_CALLBACK(purplerc_font_response_special), NULL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
401
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
402 pref = purple_prefs_get_string("/plugins/gtk/purplerc/gtk-font-name");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
403
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
404 if (pref != NULL && strcmp(pref, "")) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
405 gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), pref);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
406 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
407
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
408 gtk_window_present(GTK_WINDOW(font_dialog));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
409 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
410
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
411 static gboolean
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
412 purplerc_plugin_load(PurplePlugin *plugin)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
413 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
414 purplerc_make_changes();
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
415
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
416 pref_callback = purple_prefs_connect_callback(plugin, "/plugins/gtk/purplerc",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
417 purplerc_pref_changed_cb, NULL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
418
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
419 return TRUE;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
420 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
421
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
422 static gboolean
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
423 purplerc_plugin_unload(PurplePlugin *plugin)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
424 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
425 purple_prefs_disconnect_callback(pref_callback);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
426
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
427 return TRUE;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
428 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
429
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
430 static GtkWidget *
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
431 purplerc_get_config_frame(PurplePlugin *plugin)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
432 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
433 /* Note: Intentionally not using the size group argument to the
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
434 * pidgin_prefs_labeled_* functions they only add the text label to
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
435 * the size group not the whole thing, which isn't what I want. */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
436 int i;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
437 char *tmp;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
438 GtkWidget *check = NULL, *widget = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
439 GtkSizeGroup *labelsg = NULL, *widgetsg = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
440 GtkWidget *ret = NULL, *frame = NULL, *hbox = NULL, *vbox = NULL;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
441
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
442 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
443 gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
444
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
445 labelsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
446 widgetsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
447
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
448 frame = pidgin_make_frame(ret, _("General"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
449 /* interface font */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
450 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
451 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
452
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
453 check = pidgin_prefs_checkbox(_("GTK+ Interface Font"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
454 "/plugins/gtk/purplerc/set/gtk-font-name",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
455 hbox);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
456 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
457
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
458 widget = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
459 PIDGIN_BUTTON_HORIZONTAL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
460 gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
461 gtk_size_group_add_widget(widgetsg, widget);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
462 gtk_widget_set_sensitive(widget,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
463 purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-font-name"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
464 g_signal_connect(G_OBJECT(check), "toggled",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
465 G_CALLBACK(pidgin_toggle_sensitive), widget);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
466 g_signal_connect(G_OBJECT(widget), "clicked",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
467 G_CALLBACK(purplerc_set_font_special), NULL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
468
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
469 /* key theme name */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
470 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
471 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
472
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
473 check = pidgin_prefs_checkbox(_("GTK+ Text Shortcut Theme"),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
474 "/plugins/gtk/purplerc/set/gtk-key-theme-name",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
475 hbox);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
476 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
477
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
478 widget = pidgin_prefs_labeled_entry(hbox, "",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
479 "/plugins/gtk/purplerc/gtk-key-theme-name",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
480 NULL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
481 /*
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
482 gtk_size_group_add_widget(widgetsg, widget);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
483 */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
484 gtk_widget_set_sensitive(widget,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
485 purple_prefs_get_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
486 g_signal_connect(G_OBJECT(check), "toggled",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
487 G_CALLBACK(pidgin_toggle_sensitive), widget);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
488
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
489 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
490 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
491 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
492
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
493 check = pidgin_prefs_checkbox(_(widget_bool_names[i]),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
494 widget_bool_prefs_set[i], hbox);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
495 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
496
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
497 widget_bool_widgets[i] = pidgin_prefs_checkbox("", widget_bool_prefs[i], hbox);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
498 /*
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
499 gtk_size_group_add_widget(widgetsb, widget_bool_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
500 */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
501 gtk_widget_set_sensitive(widget_bool_widgets[i],
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
502 purple_prefs_get_bool(widget_bool_prefs_set[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
503 g_signal_connect(G_OBJECT(check), "toggled",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
504 G_CALLBACK(pidgin_toggle_sensitive),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
505 widget_bool_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
506 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
507
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
508 frame = pidgin_make_frame(ret, _("Interface colors"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
509 /* imhtml stuff */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
510 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
511 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
512 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
513
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
514 check = pidgin_prefs_checkbox(_(color_names[i]),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
515 color_prefs_set[i], hbox);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
516 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
517
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
518 color_widgets[i] = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_COLOR, PIDGIN_BUTTON_HORIZONTAL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
519 gtk_size_group_add_widget(widgetsg, color_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
520 gtk_box_pack_start(GTK_BOX(hbox), color_widgets[i], FALSE,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
521 FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
522 gtk_widget_set_sensitive(color_widgets[i],
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
523 purple_prefs_get_bool(color_prefs_set[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
524 g_signal_connect(G_OBJECT(check), "toggled",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
525 G_CALLBACK(pidgin_toggle_sensitive),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
526 color_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
527 g_signal_connect(G_OBJECT(color_widgets[i]), "clicked",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
528 G_CALLBACK(purplerc_set_color),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
529 GINT_TO_POINTER(i));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
530 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
531
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
532 frame = pidgin_make_frame(ret, _("Widget Sizes"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
533 /* widget size stuff */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
534 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
535 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
536 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
537
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
538 check = pidgin_prefs_checkbox(_(widget_size_names[i]),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
539 widget_size_prefs_set[i], hbox);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
540 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
541
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
542 widget_size_widgets[i] = pidgin_prefs_labeled_spin_button(hbox, "", widget_size_prefs[i], 0, 50, NULL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
543 /*
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
544 gtk_size_group_add_widget(widgetsg, widget_size_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
545 */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
546 gtk_widget_set_sensitive(widget_size_widgets[i],
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
547 purple_prefs_get_bool(widget_size_prefs_set[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
548 g_signal_connect(G_OBJECT(check), "toggled",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
549 G_CALLBACK(pidgin_toggle_sensitive),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
550 widget_size_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
551 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
552
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
553 frame = pidgin_make_frame(ret, _("Fonts"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
554 /* imhtml font stuff */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
555 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
556 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
557 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
558
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
559 check = pidgin_prefs_checkbox(_(font_names[i]),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
560 font_prefs_set[i], hbox);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
561 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
562
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
563 font_widgets[i] = pidgin_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT, PIDGIN_BUTTON_HORIZONTAL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
564 gtk_size_group_add_widget(widgetsg, font_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
565 gtk_box_pack_start(GTK_BOX(hbox), font_widgets[i], FALSE,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
566 FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
567 gtk_widget_set_sensitive(font_widgets[i],
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
568 purple_prefs_get_bool(font_prefs_set[i]));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
569 g_signal_connect(G_OBJECT(check), "toggled",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
570 G_CALLBACK(pidgin_toggle_sensitive),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
571 font_widgets[i]);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
572 g_signal_connect(G_OBJECT(font_widgets[i]), "clicked",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
573 G_CALLBACK(purplerc_set_font), GINT_TO_POINTER(i));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
574 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
575
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
576 frame = pidgin_make_frame(ret, _("Tools"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
577
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
578 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
579 gtk_box_pack_start(GTK_BOX(frame), vbox, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
580
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
581 tmp = g_strdup_printf(_("Write settings to %s%sgtkrc-2.0"), purple_user_dir(), G_DIR_SEPARATOR_S);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
582 check = gtk_button_new_with_label(tmp);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
583 g_free(tmp);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
584 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
585 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
586 g_signal_connect(G_OBJECT(check), "clicked", G_CALLBACK(purplerc_write),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
587 NULL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
588
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
589 check = gtk_button_new_with_label(_("Re-read gtkrc files"));
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
590 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
591 gtk_size_group_add_widget(labelsg, check);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
592 g_signal_connect(G_OBJECT(check), "clicked", G_CALLBACK(purplerc_reread),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
593 NULL);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
594
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
595 gtk_widget_show_all(ret);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
596 return ret;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
597 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
598
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
599 static PidginPluginUiInfo purplerc_ui_info =
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
600 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
601 purplerc_get_config_frame,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
602 0 /* page_num (Reserved) */
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
603 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
604
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
605 static PurplePluginInfo purplerc_info =
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
606 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
607 PURPLE_PLUGIN_MAGIC,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
608 PURPLE_MAJOR_VERSION,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
609 PURPLE_MINOR_VERSION,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
610 PURPLE_PLUGIN_STANDARD,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
611 PIDGIN_PLUGIN_TYPE,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
612 0,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
613 NULL,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
614 PURPLE_PRIORITY_DEFAULT,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
615 "purplerc",
16012
765cfc73182f more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents: 15905
diff changeset
616 N_("Pidgin GTK+ Theme Control"),
15905
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
617 VERSION,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
618 N_("Provides access to commonly used gtkrc settings."),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
619 N_("Provides access to commonly used gtkrc settings."),
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
620 "Etan Reisner <deryni@eden.rutgers.edu>",
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
621 PURPLE_WEBSITE,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
622 purplerc_plugin_load,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
623 purplerc_plugin_unload,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
624 NULL,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
625 &purplerc_ui_info,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
626 NULL,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
627 NULL,
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
628 NULL
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
629 };
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
630
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
631 static void
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
632 purplerc_init(PurplePlugin *plugin)
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
633 {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
634 int i;
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
635
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
636 purple_prefs_add_none("/plugins");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
637 purple_prefs_add_none("/plugins/gtk");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
638 purple_prefs_add_none("/plugins/gtk/purplerc");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
639 purple_prefs_add_none("/plugins/gtk/purplerc/set");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
640
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
641 purple_prefs_add_string("/plugins/gtk/purplerc/gtk-font-name", "");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
642 purple_prefs_add_bool("/plugins/gtk/purplerc/set/gtk-font-name", FALSE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
643
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
644 purple_prefs_add_string("/plugins/gtk/purplerc/gtk-key-theme-name", "");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
645 purple_prefs_add_bool("/plugins/gtk/purplerc/set/gtk-key-theme-name", FALSE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
646
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
647 purple_prefs_add_none("/plugins/gtk/purplerc/color");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
648 purple_prefs_add_none("/plugins/gtk/purplerc/set/color");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
649 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
650 purple_prefs_add_string(color_prefs[i], "");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
651 purple_prefs_add_bool(color_prefs_set[i], FALSE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
652 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
653
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
654 purple_prefs_add_none("/plugins/gtk/purplerc/size");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
655 purple_prefs_add_none("/plugins/gtk/purplerc/set/size");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
656 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
657 purple_prefs_add_int(widget_size_prefs[i], 0);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
658 purple_prefs_add_bool(widget_size_prefs_set[i], FALSE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
659 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
660
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
661 purple_prefs_add_none("/plugins/gtk/purplerc/font");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
662 purple_prefs_add_none("/plugins/gtk/purplerc/set/font");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
663 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
664 purple_prefs_add_string(font_prefs[i], "");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
665 purple_prefs_add_bool(font_prefs_set[i], FALSE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
666 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
667
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
668 purple_prefs_add_none("/plugins/gtk/purplerc/bool");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
669 purple_prefs_add_none("/plugins/gtk/purplerc/set/bool");
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
670 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
671 purple_prefs_add_bool(widget_bool_prefs[i], TRUE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
672 purple_prefs_add_bool(widget_bool_prefs_set[i], FALSE);
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
673 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
674 }
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
675
6f04fe174f40 Change some stuff from gaim to pidgin
Mark Doliner <mark@kingant.net>
parents:
diff changeset
676 PURPLE_INIT_PLUGIN(purplerc, purplerc_init, purplerc_info)