annotate plugins/gaimrc.c @ 11927:0d9c6d2ad64b

[gaim-migrate @ 14218] Better error handling for Howl when your mDNS daemon is not running committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 31 Oct 2005 06:06:14 +0000
parents f8cd06753755
children 8dc2e512038f
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"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
25 #include "version.h"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
26
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
27 static guint pref_callback;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
28
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
29 static const char *color_prefs[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
30 "/plugins/gtk/gaimrc/color/GtkWidget::cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
31 "/plugins/gtk/gaimrc/color/GtkWidget::secondary-cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
32 "/plugins/gtk/gaimrc/color/GtkIMHtml::hyperlink-color"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
33 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
34 static const char *color_prefs_set[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
35 "/plugins/gtk/gaimrc/set/color/GtkWidget::cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
36 "/plugins/gtk/gaimrc/set/color/GtkWidget::secondary-cursor-color",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
37 "/plugins/gtk/gaimrc/set/color/GtkIMHtml::hyperlink-color"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
38 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
39 static const char *color_names[] = {
10585
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
40 N_("Cursor Color"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
41 N_("Secondary Cursor Color"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
42 N_("Hyperlink Color")
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
43 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
44 static GtkWidget *color_widgets[G_N_ELEMENTS(color_prefs)];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
45
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
46 static const char *widget_size_prefs[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
47 "/plugins/gtk/gaimrc/size/GtkTreeView::expander_size"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
48 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
49 static const char *widget_size_prefs_set[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
50 "/plugins/gtk/gaimrc/set/size/GtkTreeView::expander_size"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
51 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
52 static const char *widget_size_names[] = {
10585
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
53 N_("GtkTreeView Expander Size")
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 GtkWidget *widget_size_widgets[G_N_ELEMENTS(widget_size_prefs)];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
56
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
57 static const char *font_prefs[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
58 "/plugins/gtk/gaimrc/font/*gaim_gtkconv_entry",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
59 "/plugins/gtk/gaimrc/font/*gaim_gtkconv_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
60 "/plugins/gtk/gaimrc/font/*gaim_gtklog_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
61 "/plugins/gtk/gaimrc/font/*gaim_gtkrequest_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
62 "/plugins/gtk/gaimrc/font/*gaim_gtknotify_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
63 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
64 static const char *font_prefs_set[] = {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
65 "/plugins/gtk/gaimrc/set/font/*gaim_gtkconv_entry",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
66 "/plugins/gtk/gaimrc/set/font/*gaim_gtkconv_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
67 "/plugins/gtk/gaimrc/set/font/*gaim_gtklog_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
68 "/plugins/gtk/gaimrc/set/font/*gaim_gtkrequest_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
69 "/plugins/gtk/gaimrc/set/font/*gaim_gtknotify_imhtml",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
70 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
71 static const char *font_names[] = {
10585
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
72 N_("Conversation Entry"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
73 N_("Conversation History"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
74 N_("Log Viewer"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
75 N_("Request Dialog"),
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
76 N_("Notify Dialog")
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
77 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
78 static GtkWidget *font_widgets[G_N_ELEMENTS(font_prefs)];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
79
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
80 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
81 gaimrc_make_changes()
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
82 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
83 int i;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
84 GString *style_string = g_string_new("");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
85 char *prefbase = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
86
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
87 if (gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-font-name")) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
88 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
89 g_string_append_printf(style_string, "gtk-font-name = \"%s\"\n", pref);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
90 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
91
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
92 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
93 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
94 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
95 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
96
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
97 g_string_append(style_string, "style \"gaimrc_style\" {\n");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
98
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
99 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
100 if (gaim_prefs_get_bool(color_prefs_set[i])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
101 prefbase = g_path_get_basename(color_prefs[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
102 g_string_append_printf(style_string,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
103 "%s = \"%s\"\n", prefbase,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
104 gaim_prefs_get_string(color_prefs[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
105 g_free(prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
106 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
107 }
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 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
110 if (gaim_prefs_get_bool(widget_size_prefs_set[i])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
111 prefbase = g_path_get_basename(widget_size_prefs[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
112 g_string_append_printf(style_string,
11862
f8cd06753755 [gaim-migrate @ 14153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10814
diff changeset
113 "%s = %d\n", prefbase,
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
114 gaim_prefs_get_int(widget_size_prefs[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
115 g_free(prefbase);
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 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
118
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
119 g_string_append(style_string, "}");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
120 g_string_append(style_string, "widget_class \"*\" style \"gaimrc_style\"\n");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
121
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
122 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
123 if (gaim_prefs_get_bool(font_prefs_set[i])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
124 prefbase = g_path_get_basename(font_prefs[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
125 g_string_append_printf(style_string,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
126 "style \"%s_style\"\n"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
127 "{font_name = \"%s\"}\n"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
128 "widget \"%s\""
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
129 "style \"%s_style\"\n", prefbase,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
130 gaim_prefs_get_string(font_prefs[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
131 prefbase, prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
132 g_free(prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
133 }
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 gtk_rc_parse_string(style_string->str);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
137
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
138 g_string_free(style_string, TRUE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
139 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
140
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
141 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
142 gaimrc_pref_changed_cb(const char *name, GaimPrefType type, gpointer value,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
143 gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
144 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
145 GString *style_string = g_string_new("");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
146 char *prefbase = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
147
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
148 prefbase = g_path_get_basename(name);
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 if (strncmp(name, "/plugins/gtk/gaimrc/color", 25) == 0) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
151 g_string_printf(style_string,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
152 "style \"gaimrc_style\" { %s = \"%s\" }"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
153 "widget_class \"*\" style \"gaimrc_style\"",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
154 prefbase, (char *)value);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
155 } else if (strncmp(name, "/plugins/gtk/gaimrc/size", 24) == 0) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
156 g_string_printf(style_string,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
157 "style \"gaimrc_style\" { %s = \"%d\" }"
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
158 "widget_class \"*\" style \"gaimrc_style\"",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
159 prefbase, GPOINTER_TO_INT(value));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
160 } else if (strncmp(name, "/plugins/gtk/gaimrc/font", 24) == 0) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
161 g_string_printf(style_string, "style \"%s_style\""
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
162 "{ font_name = \"%s\" } widget \"%s\""
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
163 "style \"%s_style\"",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
164 prefbase, (char *)value, prefbase, prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
165 } else if (strncmp(name, "/plugins/gtk/gaimrc/set", 23) == 0) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
166 if (value)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
167 gaimrc_make_changes();
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
168 g_string_free(style_string, TRUE);
11862
f8cd06753755 [gaim-migrate @ 14153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10814
diff changeset
169 g_free(prefbase);
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
170
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
171 return;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
172 } else {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
173 g_string_printf(style_string, "%s = \"%s\"",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
174 prefbase, (char *)value);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
175 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
176 gtk_rc_parse_string(style_string->str);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
177
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
178 g_string_free(style_string, TRUE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
179 g_free(prefbase);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
180 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
181
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
182 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
183 gaimrc_color_response(GtkDialog *color_dialog, gint response, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
184 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
185 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
186
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
187 if (response == GTK_RESPONSE_OK) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
188 GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
189 GdkColor color;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
190 char colorstr[8];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
191
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
192 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
193
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
194 g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
195 color.red/256, color.green/256, color.blue/256);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
196
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
197 gaim_prefs_set_string(color_prefs[subscript], colorstr);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
198 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
199 gtk_widget_destroy(GTK_WIDGET(color_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
200 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
201
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
202 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
203 gaimrc_set_color(GtkWidget *widget, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
204 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
205 GtkWidget *color_dialog = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
206 GdkColor color;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
207 char title[128];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
208 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
209
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
210 g_snprintf(title, sizeof(title), _("Select Color for %s"),
10586
eb2e5f06452a [gaim-migrate @ 11990]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10585
diff changeset
211 _(color_names[GPOINTER_TO_INT(data)]));
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
212 color_dialog = gtk_color_selection_dialog_new(_("Select Color"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
213 g_signal_connect(G_OBJECT(color_dialog), "response",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
214 G_CALLBACK(gaimrc_color_response), data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
215
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
216 if (gdk_color_parse(gaim_prefs_get_string(color_prefs[subscript]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
217 &color)) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
218 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
219 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
220
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
221 gtk_window_present(GTK_WINDOW(color_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
222 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
223
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
224 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
225 gaimrc_font_response(GtkDialog *font_dialog, gint response, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
226 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
227 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
228
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
229 if (response == GTK_RESPONSE_OK) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
230 char *fontname = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
231
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
232 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
233
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
234 gaim_prefs_set_string(font_prefs[subscript], fontname);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
235 g_free(fontname);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
236 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
237 gtk_widget_destroy(GTK_WIDGET(font_dialog));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
238 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
239
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
240 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
241 gaimrc_set_font(GtkWidget *widget, gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
242 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
243 GtkWidget *font_dialog = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
244 char title[128];
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
245 int subscript = GPOINTER_TO_INT(data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
246
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
247 g_snprintf(title, sizeof(title), _("Select Font for %s"),
10586
eb2e5f06452a [gaim-migrate @ 11990]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10585
diff changeset
248 _(font_names[subscript]));
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
249 font_dialog = gtk_font_selection_dialog_new(title);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
250 g_signal_connect(G_OBJECT(font_dialog), "response",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
251 G_CALLBACK(gaimrc_font_response), data);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
252
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
253 /* 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
254 * actual pref
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
255 if (gaim_prefs_get_bool(font_prefs[subscript])) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
256 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
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
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
260 gtk_window_present(GTK_WINDOW(font_dialog));
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
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
263 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
264 gaimrc_font_response_special(GtkDialog *font_dialog, gint response,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
265 gpointer data)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
266 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
267 if (response == GTK_RESPONSE_OK) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
268 char *fontname = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
269
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
270 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
271
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
272 gaim_prefs_set_string("/plugins/gtk/gaimrc/gtk-font-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
273 fontname);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
274 g_free(fontname);
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(font_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_font_special(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 *font_dialog = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
283 const char *font = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
284
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
285 font_dialog = gtk_font_selection_dialog_new(_("Select Interface Font"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
286 g_signal_connect(G_OBJECT(font_dialog), "response",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
287 G_CALLBACK(gaimrc_font_response_special), NULL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
288
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
289 font = gaim_prefs_get_string("/plugins/gtk/gaimrc/gtk-font-name");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
290 /* 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
291 * actual pref
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
292 printf("font - %s.\n", font);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
293 if (font != NULL && font != "") {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
294 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
295 }
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(font_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 gboolean
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
302 gaimrc_plugin_load(GaimPlugin *plugin)
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 gaimrc_make_changes();
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
305
10587
c7458b544b15 [gaim-migrate @ 11991]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10586
diff changeset
306 pref_callback = gaim_prefs_connect_callback(plugin, "/plugins/gtk/gaimrc",
c7458b544b15 [gaim-migrate @ 11991]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10586
diff changeset
307 gaimrc_pref_changed_cb, NULL);
10584
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 return TRUE;
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
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
312 static gboolean
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
313 gaimrc_plugin_unload(GaimPlugin *plugin)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
314 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
315 gaim_prefs_disconnect_callback(pref_callback);
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 return TRUE;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
318 }
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 static GtkWidget *
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
321 gaimrc_get_config_frame(GaimPlugin *plugin)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
322 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
323 GtkWidget *ret = NULL, *frame = NULL, *hbox = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
324 /*
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
325 GtkWidget *check = NULL, *widget = NULL, *label = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
326 */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
327 GtkWidget *check = NULL, *widget = NULL;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
328 GtkSizeGroup *sg = NULL;
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 char sample[7] = "Sample";
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
331 */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
332 int i;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
333
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
334 ret = gtk_vbox_new(FALSE, 18);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
335 gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
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 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
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 frame = gaim_gtk_make_frame(ret, "General");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
340 /* interface font */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
341 hbox = gtk_hbox_new(FALSE, 18);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
342 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
343
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10587
diff changeset
344 check = gaim_gtk_prefs_checkbox(_("GTK+ Interface Font"),
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
345 "/plugins/gtk/gaimrc/set/gtk-font-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
346 hbox);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
347 gtk_size_group_add_widget(sg, check);
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 widget = gaim_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
350 GAIM_BUTTON_HORIZONTAL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
351 gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
352 gtk_widget_set_sensitive(widget,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
353 gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-font-name"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
354 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
355 G_CALLBACK(gaim_gtk_toggle_sensitive), widget);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
356 g_signal_connect(G_OBJECT(widget), "clicked",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
357 G_CALLBACK(gaimrc_set_font_special), NULL);
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 /* key theme name */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
360 hbox = gtk_hbox_new(FALSE, 18);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
361 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
362
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10587
diff changeset
363 check = gaim_gtk_prefs_checkbox(_("GTK+ Text Shortcut Theme"),
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
364 "/plugins/gtk/gaimrc/set/gtk-key-theme-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
365 hbox);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
366 gtk_size_group_add_widget(sg, check);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
367
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
368 widget = gaim_gtk_prefs_labeled_entry(hbox, "",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
369 "/plugins/gtk/gaimrc/gtk-key-theme-name",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
370 NULL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
371 gtk_widget_set_sensitive(widget,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
372 gaim_prefs_get_bool("/plugins/gtk/gaimrc/set/gtk-key-theme-name"));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
373 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
374 G_CALLBACK(gaim_gtk_toggle_sensitive), widget);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
375
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
376 frame = gaim_gtk_make_frame(ret, "Interface colors");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
377 /* imhtml stuff */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
378 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
379 hbox = gtk_hbox_new(FALSE, 18);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
380 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
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 check = gaim_gtk_prefs_checkbox(_(color_names[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
383 color_prefs_set[i], hbox);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
384 gtk_size_group_add_widget(sg, check);
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 color_widgets[i] = gaim_pixbuf_button_from_stock("", GTK_STOCK_SELECT_COLOR, GAIM_BUTTON_HORIZONTAL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
387 gtk_size_group_add_widget(sg, color_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
388 gtk_box_pack_start(GTK_BOX(hbox), color_widgets[i], FALSE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
389 FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
390 gtk_widget_set_sensitive(color_widgets[i],
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
391 gaim_prefs_get_bool(color_prefs_set[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
392 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
393 G_CALLBACK(gaim_gtk_toggle_sensitive),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
394 color_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
395 g_signal_connect(G_OBJECT(color_widgets[i]), "clicked",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
396 G_CALLBACK(gaimrc_set_color),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
397 GINT_TO_POINTER(i));
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
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
400 frame = gaim_gtk_make_frame(ret, "Widget Sizes");
10585
a6b8a23b4d5f [gaim-migrate @ 11989]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10584
diff changeset
401 /* widget size stuff */
10584
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
402 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
403 hbox = gtk_hbox_new(FALSE, 18);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
404 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
405
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
406 check = gaim_gtk_prefs_checkbox(_(widget_size_names[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
407 widget_size_prefs_set[i], hbox);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
408 gtk_size_group_add_widget(sg, check);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
409
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
410 widget_size_widgets[i] = gaim_gtk_prefs_labeled_spin_button(hbox, "", widget_size_prefs[i], 0, 50, sg);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
411 gtk_widget_set_sensitive(widget_size_widgets[i],
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
412 gaim_prefs_get_bool(widget_size_prefs_set[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
413 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
414 G_CALLBACK(gaim_gtk_toggle_sensitive),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
415 widget_size_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
416 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
417
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
418 frame = gaim_gtk_make_frame(ret, "Fonts");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
419 /* imhtml font stuff */
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
420 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
421 hbox = gtk_hbox_new(FALSE, 18);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
422 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
423
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
424 check = gaim_gtk_prefs_checkbox(_(font_names[i]),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
425 font_prefs_set[i], hbox);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
426 gtk_size_group_add_widget(sg, check);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
427
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
428 font_widgets[i] = gaim_pixbuf_button_from_stock("", GTK_STOCK_SELECT_FONT, GAIM_BUTTON_HORIZONTAL);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
429 gtk_size_group_add_widget(sg, font_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
430 gtk_box_pack_start(GTK_BOX(hbox), font_widgets[i], FALSE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
431 FALSE, 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
432 gtk_widget_set_sensitive(font_widgets[i],
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
433 gaim_prefs_get_bool(font_prefs_set[i]));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
434 g_signal_connect(G_OBJECT(check), "toggled",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
435 G_CALLBACK(gaim_gtk_toggle_sensitive),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
436 font_widgets[i]);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
437 g_signal_connect(G_OBJECT(font_widgets[i]), "clicked",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
438 G_CALLBACK(gaimrc_set_font), GINT_TO_POINTER(i));
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
439 }
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 gtk_widget_show_all(ret);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
442 return ret;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
443 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
444
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
445 static GaimGtkPluginUiInfo gaimrc_ui_info =
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
446 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
447 gaimrc_get_config_frame
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
448 };
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 static GaimPluginInfo gaimrc_info =
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
451 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
452 GAIM_PLUGIN_MAGIC,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
453 GAIM_MAJOR_VERSION,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
454 GAIM_MINOR_VERSION,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
455 GAIM_PLUGIN_STANDARD,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
456 GAIM_GTK_PLUGIN_TYPE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
457 0,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
458 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
459 GAIM_PRIORITY_DEFAULT,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
460 "gaimrc",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
461 N_("Gaim GTK+ Theme Control"),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
462 VERSION,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
463 N_("Provides access to commonly used gtkrc settings."),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
464 N_("Provides access to commonly used gtkrc settings."),
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
465 "Etan Reisner <deryni@eden.rutgers.edu>",
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
466 GAIM_WEBSITE,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
467 gaimrc_plugin_load,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
468 gaimrc_plugin_unload,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
469 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
470 &gaimrc_ui_info,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
471 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
472 NULL,
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
473 NULL
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
474 };
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
475
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
476 static void
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
477 gaimrc_init(GaimPlugin *plugin)
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
478 {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
479 int i;
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
480
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
481 gaim_prefs_add_none("/plugins");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
482 gaim_prefs_add_none("/plugins/gtk");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
483 gaim_prefs_add_none("/plugins/gtk/gaimrc");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
484 gaim_prefs_add_none("/plugins/gtk/gaimrc/set");
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 gaim_prefs_add_string("/plugins/gtk/gaimrc/gtk-font-name", "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
487 gaim_prefs_add_bool("/plugins/gtk/gaimrc/set/gtk-font-name", FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
488
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
489 gaim_prefs_add_string("/plugins/gtk/gaimrc/gtk-key-theme-name", "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
490 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
491
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
492 gaim_prefs_add_none("/plugins/gtk/gaimrc/color");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
493 gaim_prefs_add_none("/plugins/gtk/gaimrc/set/color");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
494 for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
495 gaim_prefs_add_string(color_prefs[i], "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
496 gaim_prefs_add_bool(color_prefs_set[i], FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
497 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
498
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
499 gaim_prefs_add_none("/plugins/gtk/gaimrc/size");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
500 gaim_prefs_add_none("/plugins/gtk/gaimrc/set/size");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
501 for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
502 gaim_prefs_add_int(widget_size_prefs[i], 0);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
503 gaim_prefs_add_bool(widget_size_prefs_set[i], FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
504 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
505
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
506 gaim_prefs_add_none("/plugins/gtk/gaimrc/font");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
507 gaim_prefs_add_none("/plugins/gtk/gaimrc/set/font");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
508 for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
509 gaim_prefs_add_string(font_prefs[i], "");
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
510 gaim_prefs_add_bool(font_prefs_set[i], FALSE);
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
511 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
512 }
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
513
7de819b5ed68 [gaim-migrate @ 11988]
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff changeset
514 GAIM_INIT_PLUGIN(gaimrc, gaimrc_init, gaimrc_info)