annotate plugins/gaimrc.c @ 13851:41753203a94d

[gaim-migrate @ 16310] The colors should now look 'better' in terminals that don't apparently allow changing colors. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 22 Jun 2006 22:38:03 +0000
parents d845dc5712bb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
1 /**
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
2 * @file gaimrc.c Gaim gtk resource control plugin.
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
3 *
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
4 * Copyright (C) 2005 Etan Reisner <deryni@eden.rutgers.edu>
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
5 *
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
9 * (at your option) any later version.
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
10 *
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
14 * GNU General Public License for more details.
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
15 *
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
19 */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
20
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
21 #include "internal.h"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
22 #include "gtkplugin.h"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
23 #include "gtkprefs.h"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
24 #include "gtkutils.h"
12044
6e6f5e4b40c0 [gaim-migrate @ 14339]
Richard Laager <rlaager@wiktel.com>
parents: 12042
diff changeset
25 #include "util.h"
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
26 #include "version.h"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
27
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
28 static guint pref_callback;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
29
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
30 static const char *color_prefs[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
31 "/plugins/gtk/gaimrc/color/GtkWidget::cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
32 "/plugins/gtk/gaimrc/color/GtkWidget::secondary-cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
33 "/plugins/gtk/gaimrc/color/GtkIMHtml::hyperlink-color"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
34 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
35 static const char *color_prefs_set[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
36 "/plugins/gtk/gaimrc/set/color/GtkWidget::cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
37 "/plugins/gtk/gaimrc/set/color/GtkWidget::secondary-cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
38 "/plugins/gtk/gaimrc/set/color/GtkIMHtml::hyperlink-color"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
39 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
40 static const char *color_names[] = {
10585
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
41 N_("Cursor Color"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
42 N_("Secondary Cursor Color"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
43 N_("Hyperlink Color")
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
44 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
45 static GtkWidget *color_widgets[G_N_ELEMENTS(color_prefs)];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
46
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
47 static const char *widget_size_prefs[] = {
12201
6f0254e3c4a0 [gaim-migrate @ 14503]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12048
diff changeset
48 "/plugins/gtk/gaimrc/size/GtkTreeView::expander_size",
6f0254e3c4a0 [gaim-migrate @ 14503]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12048
diff changeset
49 "/plugins/gtk/gaimrc/size/GtkTreeView::horizontal_separator"
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
50 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
51 static const char *widget_size_prefs_set[] = {
12201
6f0254e3c4a0 [gaim-migrate @ 14503]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12048
diff changeset
52 "/plugins/gtk/gaimrc/set/size/GtkTreeView::expander_size",
6f0254e3c4a0 [gaim-migrate @ 14503]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12048
diff changeset
53 "/plugins/gtk/gaimrc/set/size/GtkTreeView::horizontal_separator"
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
54 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
55 static const char *widget_size_names[] = {
12201
6f0254e3c4a0 [gaim-migrate @ 14503]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12048
diff changeset
56 N_("GtkTreeView Expander Size"),
6f0254e3c4a0 [gaim-migrate @ 14503]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12048
diff changeset
57 N_("GtkTreeView Horizontal Separation")
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
58 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
59 static GtkWidget *widget_size_widgets[G_N_ELEMENTS(widget_size_prefs)];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
60
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
61 static const char *font_prefs[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
62 "/plugins/gtk/gaimrc/font/*gaim_gtkconv_entry",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
63 "/plugins/gtk/gaimrc/font/*gaim_gtkconv_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
64 "/plugins/gtk/gaimrc/font/*gaim_gtklog_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
65 "/plugins/gtk/gaimrc/font/*gaim_gtkrequest_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
66 "/plugins/gtk/gaimrc/font/*gaim_gtknotify_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
67 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
68 static const char *font_prefs_set[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
69 "/plugins/gtk/gaimrc/set/font/*gaim_gtkconv_entry",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
70 "/plugins/gtk/gaimrc/set/font/*gaim_gtkconv_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
71 "/plugins/gtk/gaimrc/set/font/*gaim_gtklog_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
72 "/plugins/gtk/gaimrc/set/font/*gaim_gtkrequest_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
73 "/plugins/gtk/gaimrc/set/font/*gaim_gtknotify_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
74 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
75 static const char *font_names[] = {
10585
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
76 N_("Conversation Entry"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
77 N_("Conversation History"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
78 N_("Log Viewer"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
79 N_("Request Dialog"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
80 N_("Notify Dialog")
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
81 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
82 static GtkWidget *font_widgets[G_N_ELEMENTS(font_prefs)];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
83
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
84 static const char *widget_bool_prefs[] = {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
85 "/plugins/gtk/gaimrc/bool/GtkTreeView::indent_expanders",
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
86 };
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
87 static const char *widget_bool_prefs_set[] = {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
88 "/plugins/gtk/gaimrc/set/bool/GtkTreeView::indent_expanders",
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
89 };
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
90 static const char *widget_bool_names[] = {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
91 N_("GtkTreeView Indent Expanders"),
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
92 };
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
93 static GtkWidget *widget_bool_widgets[G_N_ELEMENTS(widget_bool_prefs)];
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
94
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
95 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
96 gaimrc_make_changes()
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
97 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
98 int i;
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
99 char *prefbase = NULL;
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
100 #if GTK_CHECK_VERSION(2,4,0)
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
101 GtkSettings *setting = NULL;
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
102 #endif
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
103 GString *style_string = g_string_new("");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
104
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
105 if (gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-font-name")) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
106 const char *pref = gaim_prefs_get_string("/plugins/gtk/gaimrc/gtk-font-name");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
107 g_string_append_printf(style_string, "gtk-font-name = \"%s\"\n", pref);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
108 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
109
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
110 if (gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-key-theme-name")) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
111 const char *pref = gaim_prefs_get_string("/plugins/gtk/gaimrc/gtk-key-theme-name");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
112 g_string_append_printf(style_string, "gtk-key-theme-name = \"%s\"\n", pref);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
113 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
114
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
115 g_string_append(style_string, "style \"gaimrc_style\" {\n");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
116
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
117 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
118 if (gaim_prefs_get_bool(color_prefs_set[i])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
119 prefbase = g_path_get_basename(color_prefs[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
120 g_string_append_printf(style_string,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
121 "%s = \"%s\"\n", prefbase,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
122 gaim_prefs_get_string(color_prefs[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
123 g_free(prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
124 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
125 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
126
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
127 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
128 if (gaim_prefs_get_bool(widget_size_prefs_set[i])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
129 prefbase = g_path_get_basename(widget_size_prefs[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
130 g_string_append_printf(style_string,
11862
f8cd06753755 [gaim-migrate @ 14153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10814
diff changeset
131 "%s = %d\n", prefbase,
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
132 gaim_prefs_get_int(widget_size_prefs[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
133 g_free(prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
134 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
135 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
136
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
137 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
138 if (gaim_prefs_get_bool(widget_bool_prefs_set[i])) {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
139 prefbase = g_path_get_basename(widget_bool_prefs[i]);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
140 g_string_append_printf(style_string,
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
141 "%s = %d\n", prefbase,
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
142 gaim_prefs_get_bool(widget_bool_prefs[i]));
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
143 g_free(prefbase);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
144 }
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
145 }
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
146
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
147 g_string_append(style_string, "}");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
148 g_string_append(style_string, "widget_class \"*\" style \"gaimrc_style\"\n");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
149
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
150 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
151 if (gaim_prefs_get_bool(font_prefs_set[i])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
152 prefbase = g_path_get_basename(font_prefs[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
153 g_string_append_printf(style_string,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
154 "style \"%s_style\"\n"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
155 "{font_name = \"%s\"}\n"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
156 "widget \"%s\""
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
157 "style \"%s_style\"\n", prefbase,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
158 gaim_prefs_get_string(font_prefs[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
159 prefbase, prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
160 g_free(prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
161 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
162 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
163
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
164 gtk_rc_parse_string(style_string->str);
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
165 g_string_free(style_string, TRUE);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
166
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
167 #if GTK_CHECK_VERSION(2,4,0)
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
168 setting = gtk_settings_get_default();
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
169 gtk_rc_reset_styles(setting);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
170 #endif
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
171 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
172
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
173 static void
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
174 gaimrc_write(GtkWidget *widget, gpointer data)
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
175 {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
176 int i;
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
177 GString *style_string = g_string_new("");
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
178 char *prefbase = NULL;
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
179
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
180 if (gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-font-name")) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
181 const char *pref = gaim_prefs_get_string("/plugins/gtk/gaimrc/gtk-font-name");
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
182 g_string_append_printf(style_string, "gtk-font-name = \"%s\"\n", pref);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
183 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
184
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
185 if (gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-key-theme-name")) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
186 const char *pref = gaim_prefs_get_string("/plugins/gtk/gaimrc/gtk-key-theme-name");
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
187 g_string_append_printf(style_string, "gtk-key-theme-name = \"%s\"\n", pref);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
188 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
189
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
190 g_string_append(style_string, "style \"gaimrc_style\" {\n");
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
191
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
192 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
193 if (gaim_prefs_get_bool(color_prefs_set[i])) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
194 prefbase = g_path_get_basename(color_prefs[i]);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
195 g_string_append_printf(style_string,
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
196 "%s = \"%s\"\n", prefbase,
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
197 gaim_prefs_get_string(color_prefs[i]));
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
198 g_free(prefbase);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
199 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
200 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
201
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
202 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
203 if (gaim_prefs_get_bool(widget_size_prefs_set[i])) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
204 prefbase = g_path_get_basename(widget_size_prefs[i]);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
205 g_string_append_printf(style_string,
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
206 "%s = %d\n", prefbase,
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
207 gaim_prefs_get_int(widget_size_prefs[i]));
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
208 g_free(prefbase);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
209 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
210 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
211
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
212 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
213 if (gaim_prefs_get_bool(widget_bool_prefs_set[i])) {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
214 prefbase = g_path_get_basename(widget_bool_prefs[i]);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
215 g_string_append_printf(style_string,
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
216 "%s = %d\n", prefbase,
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
217 gaim_prefs_get_bool(widget_bool_prefs[i]));
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
218 g_free(prefbase);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
219 }
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
220 }
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
221
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
222 g_string_append(style_string, "}");
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
223 g_string_append(style_string, "widget_class \"*\" style \"gaimrc_style\"\n");
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
224
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
225 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
226 if (gaim_prefs_get_bool(font_prefs_set[i])) {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
227 prefbase = g_path_get_basename(font_prefs[i]);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
228 g_string_append_printf(style_string,
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
229 "style \"%s_style\"\n"
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
230 "{font_name = \"%s\"}\n"
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
231 "widget \"%s\""
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
232 "style \"%s_style\"\n", prefbase,
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
233 gaim_prefs_get_string(font_prefs[i]),
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
234 prefbase, prefbase);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
235 g_free(prefbase);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
236 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
237 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
238
12202
17be9401e167 [gaim-migrate @ 14504]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12201
diff changeset
239 gaim_util_write_data_to_file("gtkrc-2.0", style_string->str, -1);
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
240
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
241 g_string_free(style_string, TRUE);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
242 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
243
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
244 static void
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
245 gaimrc_reread(GtkWidget *widget, gpointer data)
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
246 {
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
247 gtk_rc_reparse_all();
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
248 /* I don't know if this is necessary but if not it shouldn't hurt. */
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
249 gaimrc_make_changes();
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
250 }
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
251
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
252 static void
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
253 gaimrc_pref_changed_cb(const char *name, GaimPrefType type,
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
254 gconstpointer value, gpointer data)
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
255 {
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
256 gaimrc_make_changes();
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
257 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
258
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
259 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
260 gaimrc_color_response(GtkDialog *color_dialog, gint response, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
261 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
262 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
263
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
264 if (response == GTK_RESPONSE_OK) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
265 GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
266 GdkColor color;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
267 char colorstr[8];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
268
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
269 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
270
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
271 g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
272 color.red/256, color.green/256, color.blue/256);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
273
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
274 gaim_prefs_set_string(color_prefs[subscript], colorstr);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
275 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
276 gtk_widget_destroy(GTK_WIDGET(color_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
277 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
278
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
279 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
280 gaimrc_set_color(GtkWidget *widget, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
281 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
282 GtkWidget *color_dialog = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
283 GdkColor color;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
284 char title[128];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
285 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
286
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
287 g_snprintf(title, sizeof(title), _("Select Color for %s"),
10586
eb2e5f06452a [gaim-migrate @ 11990]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10585
diff changeset
288 _(color_names[GPOINTER_TO_INT(data)]));
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
289 color_dialog = gtk_color_selection_dialog_new(_("Select Color"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
290 g_signal_connect(G_OBJECT(color_dialog), "response",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
291 G_CALLBACK(gaimrc_color_response), data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
292
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
293 if (gdk_color_parse(gaim_prefs_get_string(color_prefs[subscript]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
294 &color)) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
295 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
296 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
297
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
298 gtk_window_present(GTK_WINDOW(color_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
299 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
300
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
301 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
302 gaimrc_font_response(GtkDialog *font_dialog, gint response, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
303 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
304 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
305
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
306 if (response == GTK_RESPONSE_OK) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
307 char *fontname = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
308
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
309 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
310
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
311 gaim_prefs_set_string(font_prefs[subscript], fontname);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
312 g_free(fontname);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
313 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
314 gtk_widget_destroy(GTK_WIDGET(font_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
315 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
316
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
317 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
318 gaimrc_set_font(GtkWidget *widget, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
319 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
320 GtkWidget *font_dialog = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
321 char title[128];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
322 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
323
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
324 g_snprintf(title, sizeof(title), _("Select Font for %s"),
10586
eb2e5f06452a [gaim-migrate @ 11990]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10585
diff changeset
325 _(font_names[subscript]));
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
326 font_dialog = gtk_font_selection_dialog_new(title);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
327 g_signal_connect(G_OBJECT(font_dialog), "response",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
328 G_CALLBACK(gaimrc_font_response), data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
329
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
330 /* TODO Figure out a way to test for the presence of a value in the
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
331 * actual pref
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
332 if (gaim_prefs_get_bool(font_prefs[subscript])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
333 gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), gaim_prefs_get_string(font_prefs[subscript]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
334 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
335 */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
336
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
337 gtk_window_present(GTK_WINDOW(font_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
338 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
339
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
340 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
341 gaimrc_font_response_special(GtkDialog *font_dialog, gint response,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
342 gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
343 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
344 if (response == GTK_RESPONSE_OK) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
345 char *fontname = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
346
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
347 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
348
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
349 gaim_prefs_set_string("/plugins/gtk/gaimrc/gtk-font-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
350 fontname);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
351 g_free(fontname);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
352 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
353 gtk_widget_destroy(GTK_WIDGET(font_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
354 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
355
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
356 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
357 gaimrc_set_font_special(GtkWidget *widget, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
358 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
359 GtkWidget *font_dialog = NULL;
13661
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
360 #if 0
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
361 const char *font = NULL;
13661
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
362 #endif
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
363
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
364 font_dialog = gtk_font_selection_dialog_new(_("Select Interface Font"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
365 g_signal_connect(G_OBJECT(font_dialog), "response",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
366 G_CALLBACK(gaimrc_font_response_special), NULL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
367
13661
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
368 #if 0
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
369 /*
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
370 * TODO Figure out a way to test for the presence of a value in the
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
371 * actual pref
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
372 */
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
373 font = gaim_prefs_get_string("/plugins/gtk/gaimrc/gtk-font-name");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
374 printf("font - %s.\n", font);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
375 if (font != NULL && font != "") {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
376 gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), gaim_prefs_get_string("/plugins/gtk/gaimrc/gtk-font-name"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
377 }
13661
d845dc5712bb [gaim-migrate @ 16063]
Mark Doliner <mark@kingant.net>
parents: 13089
diff changeset
378 #endif
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
379
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
380 gtk_window_present(GTK_WINDOW(font_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
381 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
382
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
383 static gboolean
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
384 gaimrc_plugin_load(GaimPlugin *plugin)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
385 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
386 gaimrc_make_changes();
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
387
10587
c7458b544b15 [gaim-migrate @ 11991]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10586
diff changeset
388 pref_callback = gaim_prefs_connect_callback(plugin, "/plugins/gtk/gaimrc",
c7458b544b15 [gaim-migrate @ 11991]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10586
diff changeset
389 gaimrc_pref_changed_cb, NULL);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
390
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
391 return TRUE;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
392 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
393
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
394 static gboolean
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
395 gaimrc_plugin_unload(GaimPlugin *plugin)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
396 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
397 gaim_prefs_disconnect_callback(pref_callback);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
398
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
399 return TRUE;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
400 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
401
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
402 static GtkWidget *
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
403 gaimrc_get_config_frame(GaimPlugin *plugin)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
404 {
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
405 /* Note: Intentionally not using the size group argument to the
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
406 * gaim_gtk_prefs_labeled_* functions they only add the text label to
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
407 * the size group not the whole thing, which isn't what I want. */
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
408 int i;
12042
01ce8025a1d9 [gaim-migrate @ 14337]
Richard Laager <rlaager@wiktel.com>
parents: 11941
diff changeset
409 char *tmp;
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
410 GtkWidget *check = NULL, *widget = NULL;
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
411 GtkSizeGroup *labelsg = NULL, *widgetsg = NULL;
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
412 GtkWidget *ret = NULL, *frame = NULL, *hbox = NULL, *vbox = NULL;
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
413
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
414 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
415 gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
416
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
417 labelsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
418 widgetsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
419
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 12973
diff changeset
420 frame = gaim_gtk_make_frame(ret, _("General"));
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
421 /* interface font */
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
422 hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
423 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
424
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10587
diff changeset
425 check = gaim_gtk_prefs_checkbox(_("GTK+ Interface Font"),
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
426 "/plugins/gtk/gaimrc/set/gtk-font-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
427 hbox);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
428 gtk_size_group_add_widget(labelsg, check);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
429
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
430 widget = gaim_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
431 GAIM_BUTTON_HORIZONTAL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
432 gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
433 gtk_size_group_add_widget(widgetsg, widget);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
434 gtk_widget_set_sensitive(widget,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
435 gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-font-name"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
436 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
437 G_CALLBACK(gaim_gtk_toggle_sensitive), widget);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
438 g_signal_connect(G_OBJECT(widget), "clicked",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
439 G_CALLBACK(gaimrc_set_font_special), NULL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
440
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
441 /* key theme name */
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
442 hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
443 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
444
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10587
diff changeset
445 check = gaim_gtk_prefs_checkbox(_("GTK+ Text Shortcut Theme"),
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
446 "/plugins/gtk/gaimrc/set/gtk-key-theme-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
447 hbox);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
448 gtk_size_group_add_widget(labelsg, check);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
449
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
450 widget = gaim_gtk_prefs_labeled_entry(hbox, "",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
451 "/plugins/gtk/gaimrc/gtk-key-theme-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
452 NULL);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
453 /*
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
454 gtk_size_group_add_widget(widgetsg, widget);
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
455 */
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
456 gtk_widget_set_sensitive(widget,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
457 gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-key-theme-name"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
458 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
459 G_CALLBACK(gaim_gtk_toggle_sensitive), widget);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
460
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
461 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
462 hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
463 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
464
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
465 check = gaim_gtk_prefs_checkbox(_(widget_bool_names[i]),
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
466 widget_bool_prefs_set[i], hbox);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
467 gtk_size_group_add_widget(labelsg, check);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
468
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
469 widget_bool_widgets[i] = gaim_gtk_prefs_checkbox("", widget_bool_prefs[i], hbox);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
470 /*
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
471 gtk_size_group_add_widget(widgetsb, widget_bool_widgets[i]);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
472 */
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
473 gtk_widget_set_sensitive(widget_bool_widgets[i],
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
474 gaim_prefs_get_bool(widget_bool_prefs_set[i]));
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
475 g_signal_connect(G_OBJECT(check), "toggled",
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
476 G_CALLBACK(gaim_gtk_toggle_sensitive),
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
477 widget_bool_widgets[i]);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
478 }
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
479
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 12973
diff changeset
480 frame = gaim_gtk_make_frame(ret, _("Interface colors"));
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
481 /* imhtml stuff */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
482 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
483 hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
484 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
485
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
486 check = gaim_gtk_prefs_checkbox(_(color_names[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
487 color_prefs_set[i], hbox);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
488 gtk_size_group_add_widget(labelsg, check);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
489
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
490 color_widgets[i] = gaim_pixbuf_button_from_stock("", GTK_STOCK_SELECT_COLOR, GAIM_BUTTON_HORIZONTAL);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
491 gtk_size_group_add_widget(widgetsg, color_widgets[i]);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
492 gtk_box_pack_start(GTK_BOX(hbox), color_widgets[i], FALSE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
493 FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
494 gtk_widget_set_sensitive(color_widgets[i],
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
495 gaim_prefs_get_bool(color_prefs_set[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
496 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
497 G_CALLBACK(gaim_gtk_toggle_sensitive),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
498 color_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
499 g_signal_connect(G_OBJECT(color_widgets[i]), "clicked",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
500 G_CALLBACK(gaimrc_set_color),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
501 GINT_TO_POINTER(i));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
502 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
503
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 12973
diff changeset
504 frame = gaim_gtk_make_frame(ret, _("Widget Sizes"));
10585
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
505 /* widget size stuff */
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
506 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
507 hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
508 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
509
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
510 check = gaim_gtk_prefs_checkbox(_(widget_size_names[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
511 widget_size_prefs_set[i], hbox);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
512 gtk_size_group_add_widget(labelsg, check);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
513
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
514 widget_size_widgets[i] = gaim_gtk_prefs_labeled_spin_button(hbox, "", widget_size_prefs[i], 0, 50, NULL);
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
515 /*
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
516 gtk_size_group_add_widget(widgetsg, widget_size_widgets[i]);
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
517 */
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
518 gtk_widget_set_sensitive(widget_size_widgets[i],
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
519 gaim_prefs_get_bool(widget_size_prefs_set[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
520 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
521 G_CALLBACK(gaim_gtk_toggle_sensitive),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
522 widget_size_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
523 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
524
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 12973
diff changeset
525 frame = gaim_gtk_make_frame(ret, _("Fonts"));
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
526 /* imhtml font stuff */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
527 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
528 hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
529 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
530
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
531 check = gaim_gtk_prefs_checkbox(_(font_names[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
532 font_prefs_set[i], hbox);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
533 gtk_size_group_add_widget(labelsg, check);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
534
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
535 font_widgets[i] = gaim_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT, GAIM_BUTTON_HORIZONTAL);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
536 gtk_size_group_add_widget(widgetsg, font_widgets[i]);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
537 gtk_box_pack_start(GTK_BOX(hbox), font_widgets[i], FALSE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
538 FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
539 gtk_widget_set_sensitive(font_widgets[i],
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
540 gaim_prefs_get_bool(font_prefs_set[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
541 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
542 G_CALLBACK(gaim_gtk_toggle_sensitive),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
543 font_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
544 g_signal_connect(G_OBJECT(font_widgets[i]), "clicked",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
545 G_CALLBACK(gaimrc_set_font), GINT_TO_POINTER(i));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
546 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
547
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
548 frame = gaim_gtk_make_frame(ret, _("Tools"));
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
549
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
550 vbox = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
551 gtk_box_pack_start(GTK_BOX(frame), vbox, FALSE, FALSE, 0);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
552
12567
1ddbfe726e43 [gaim-migrate @ 14886]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12564
diff changeset
553 tmp = g_strdup_printf(_("Write settings to %s%sgtkrc-2.0"), gaim_user_dir(), G_DIR_SEPARATOR_S);
12042
01ce8025a1d9 [gaim-migrate @ 14337]
Richard Laager <rlaager@wiktel.com>
parents: 11941
diff changeset
554 check = gtk_button_new_with_label(tmp);
01ce8025a1d9 [gaim-migrate @ 14337]
Richard Laager <rlaager@wiktel.com>
parents: 11941
diff changeset
555 g_free(tmp);
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
556 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
557 gtk_size_group_add_widget(labelsg, check);
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
558 g_signal_connect(G_OBJECT(check), "clicked", G_CALLBACK(gaimrc_write),
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
559 NULL);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
560
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
561 check = gtk_button_new_with_label(_("Re-read gtkrc files"));
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
562 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
12546
ed43c2a7c961 [gaim-migrate @ 14864]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12202
diff changeset
563 gtk_size_group_add_widget(labelsg, check);
11940
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
564 g_signal_connect(G_OBJECT(check), "clicked", G_CALLBACK(gaimrc_reread),
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
565 NULL);
8dc2e512038f [gaim-migrate @ 14231]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11862
diff changeset
566
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
567 gtk_widget_show_all(ret);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
568 return ret;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
569 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
570
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
571 static GaimGtkPluginUiInfo gaimrc_ui_info =
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
572 {
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12567
diff changeset
573 gaimrc_get_config_frame,
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12567
diff changeset
574 0 /* page_num (Reserved) */
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
575 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
576
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
577 static GaimPluginInfo gaimrc_info =
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
578 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
579 GAIM_PLUGIN_MAGIC,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
580 GAIM_MAJOR_VERSION,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
581 GAIM_MINOR_VERSION,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
582 GAIM_PLUGIN_STANDARD,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
583 GAIM_GTK_PLUGIN_TYPE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
584 0,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
585 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
586 GAIM_PRIORITY_DEFAULT,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
587 "gaimrc",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
588 N_("Gaim GTK+ Theme Control"),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
589 VERSION,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
590 N_("Provides access to commonly used gtkrc settings."),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
591 N_("Provides access to commonly used gtkrc settings."),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
592 "Etan Reisner <deryni@eden.rutgers.edu>",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
593 GAIM_WEBSITE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
594 gaimrc_plugin_load,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
595 gaimrc_plugin_unload,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
596 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
597 &gaimrc_ui_info,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
598 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
599 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
600 NULL
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
601 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
602
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
603 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
604 gaimrc_init(GaimPlugin *plugin)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
605 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
606 int i;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
607
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
608 gaim_prefs_add_none("/plugins");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
609 gaim_prefs_add_none("/plugins/gtk");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
610 gaim_prefs_add_none("/plugins/gtk/gaimrc");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
611 gaim_prefs_add_none("/plugins/gtk/gaimrc/set");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
612
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
613 gaim_prefs_add_string("/plugins/gtk/gaimrc/gtk-font-name", "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
614 gaim_prefs_add_bool("/plugins/gtk/gaimrc/set/gtk-font-name", FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
615
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
616 gaim_prefs_add_string("/plugins/gtk/gaimrc/gtk-key-theme-name", "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
617 gaim_prefs_add_bool("/plugins/gtk/gaimrc/set/gtk-key-theme-name", FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
618
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
619 gaim_prefs_add_none("/plugins/gtk/gaimrc/color");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
620 gaim_prefs_add_none("/plugins/gtk/gaimrc/set/color");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
621 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
622 gaim_prefs_add_string(color_prefs[i], "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
623 gaim_prefs_add_bool(color_prefs_set[i], FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
624 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
625
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
626 gaim_prefs_add_none("/plugins/gtk/gaimrc/size");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
627 gaim_prefs_add_none("/plugins/gtk/gaimrc/set/size");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
628 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
629 gaim_prefs_add_int(widget_size_prefs[i], 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
630 gaim_prefs_add_bool(widget_size_prefs_set[i], FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
631 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
632
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
633 gaim_prefs_add_none("/plugins/gtk/gaimrc/font");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
634 gaim_prefs_add_none("/plugins/gtk/gaimrc/set/font");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
635 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
636 gaim_prefs_add_string(font_prefs[i], "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
637 gaim_prefs_add_bool(font_prefs_set[i], FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
638 }
12973
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
639
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
640 gaim_prefs_add_none("/plugins/gtk/gaimrc/bool");
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
641 gaim_prefs_add_none("/plugins/gtk/gaimrc/set/bool");
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
642 for (i = 0; i < G_N_ELEMENTS(widget_bool_prefs); i++) {
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
643 gaim_prefs_add_bool(widget_bool_prefs[i], TRUE);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
644 gaim_prefs_add_bool(widget_bool_prefs_set[i], FALSE);
e25a2315d9e3 [gaim-migrate @ 15326]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12816
diff changeset
645 }
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
646 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
647
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
648 GAIM_INIT_PLUGIN(gaimrc, gaimrc_init, gaimrc_info)