annotate plugins/contact_priority.c @ 10347:4d2ecbb139a0

[gaim-migrate @ 11561] This now works on < GTK 2.4 committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sun, 12 Dec 2004 18:20:17 +0000
parents a9fb4493ae22
children 969f35b31a49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7421
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1 /*
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
2 * Contact priority settings plugin.
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
3 *
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2003 Etan Reisner, <deryni9@users.sourceforge.net>.
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
5 *
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
8 * published by the Free Software Foundation; either version 2 of the
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
9 * License, or (at your option) any later version.
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
10 *
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
15 *
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
19 */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
20
9821
a09ffb82aef1 [gaim-migrate @ 10692]
Mark Doliner <mark@kingant.net>
parents: 8749
diff changeset
21 #include "internal.h"
a09ffb82aef1 [gaim-migrate @ 10692]
Mark Doliner <mark@kingant.net>
parents: 8749
diff changeset
22 #include "gtkgaim.h"
7421
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
23 #include "gtkplugin.h"
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
24 #include "gtkutils.h"
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
25 #include "prefs.h"
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9821
diff changeset
26 #include "version.h"
7421
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
27
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
28 #define CONTACT_PRIORITY_PLUGIN_ID "gtk-contact-priority"
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
29
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
30 static void
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
31 select_account(GtkWidget *widget, GaimAccount *account, gpointer data)
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
32 {
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
33 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data),
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
34 (gdouble)gaim_account_get_int(account, "score", 0));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
35 }
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
36
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
37 static void
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
38 account_update(GtkWidget *widget, GtkOptionMenu *optmenu)
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
39 {
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
40 GaimAccount *account = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
41
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
42 account = g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(optmenu)))), "account");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
43 gaim_account_set_int(account, "score", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
44 }
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
45
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
46 static void
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
47 pref_update(GtkWidget *widget, gpointer data)
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
48 {
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
49 gchar pref[256];
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
50
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
51 g_snprintf(pref, sizeof(pref), "/core/contact/%s", (gchar *)data);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
52
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
53 if (gaim_prefs_get_type(pref) == GAIM_PREF_INT)
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
54 gaim_prefs_set_int(pref, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
55 if (gaim_prefs_get_type(pref) == GAIM_PREF_BOOLEAN)
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
56 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
57 }
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
58
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
59 static GtkWidget *
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
60 get_config_frame(GaimPlugin *plugin)
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
61 {
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62 GtkWidget *ret = NULL, *hbox = NULL, *frame = NULL, *vbox = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
63 GtkWidget *label = NULL, *spin = NULL, *check = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
64 GtkWidget *optmenu = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
65 GtkObject *adj = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66 GtkSizeGroup *sg = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
67 GaimAccount *account = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
68 /*
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69 GList *accounts = NULL;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
70 */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
71 int offline = gaim_prefs_get_int("/core/contact/offline_score");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
72 int away = gaim_prefs_get_int("/core/contact/away_score");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
73 int idle = gaim_prefs_get_int("/core/contact/idle_score");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 /*
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
75 int score;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76 */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
77 gboolean last_match = gaim_prefs_get_bool("/core/contact/last_match");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81 ret = gtk_vbox_new(FALSE, 18);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
82 gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
84 frame = gaim_gtk_make_frame(ret, _("Point values to use when..."));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
85
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 vbox = gtk_vbox_new(FALSE, 5);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
87 gtk_container_add(GTK_CONTAINER(frame), vbox);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
88
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
89 /* Offline */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
90 hbox = gtk_hbox_new(FALSE, 5);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
91 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
92
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
93 label = gtk_label_new_with_mnemonic(_("Buddy is offline:"));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
94 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
95 gtk_size_group_add_widget(sg, label);
7439
3a51b301a805 [gaim-migrate @ 8044]
Luke Schierer <lschiere@pidgin.im>
parents: 7421
diff changeset
96 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
7421
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
97
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
98 adj = gtk_adjustment_new(offline, -20, 20, 1, 1, 1);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
99 spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
100 g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), "offline_score");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
101 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
102
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
103 /* Away */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104 hbox = gtk_hbox_new(FALSE, 5);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
105 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
106
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
107 label = gtk_label_new_with_mnemonic(_("Buddy is away:"));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
109 gtk_size_group_add_widget(sg, label);
7439
3a51b301a805 [gaim-migrate @ 8044]
Luke Schierer <lschiere@pidgin.im>
parents: 7421
diff changeset
110 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
7421
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
111
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
112 adj = gtk_adjustment_new(away, -20, 20, 1, 1, 1);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
113 spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
114 g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), "away_score");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117 /* Idle */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118 hbox = gtk_hbox_new(FALSE, 5);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
119 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
120
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
121 label = gtk_label_new_with_mnemonic(_("Buddy is idle:"));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
122 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
123 gtk_size_group_add_widget(sg, label);
7439
3a51b301a805 [gaim-migrate @ 8044]
Luke Schierer <lschiere@pidgin.im>
parents: 7421
diff changeset
124 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
7421
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
125
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
126 adj = gtk_adjustment_new(idle, -20, 20, 1, 1, 1);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
127 spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
128 g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), "idle_score");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
129 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
130
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
131 /* Last match */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
132 hbox = gtk_hbox_new(FALSE, 5);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
133 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
134
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
135 check = gtk_check_button_new_with_label(_("Use last matching buddy"));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
136 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), last_match);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
137 g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(pref_update), "last_match");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
138 gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
139
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
140 /* Explanation */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
141 label = gtk_label_new(_("The buddy with the lowest score is the buddy who will have priority in the contact.\nThe default values (offline = 4,away = 2, and idle = 1)\nwill use what used to be the built-in order active->idle->away->away+idle->offline."));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
142 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
143
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
144 frame = gaim_gtk_make_frame(ret, _("Point values to use for Account..."));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
145
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
146 vbox = gtk_vbox_new(FALSE, 5);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
147 gtk_container_add(GTK_CONTAINER(frame), vbox);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
148
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
149 /* Account */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
150 hbox = gtk_hbox_new(FALSE, 5);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
151 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
152
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
153 /* make this here so I can use it in the option menu callback, we'll
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
154 * actually set it up later */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
155 adj = gtk_adjustment_new(0, -20, 20, 1, 1, 1);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
156 spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
157
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
158 optmenu = gaim_gtk_account_option_menu_new(NULL, TRUE,
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
159 G_CALLBACK(select_account),
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
160 NULL, spin);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
161 gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
162
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
163 /* this is where we set up the spin button we made above */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
164 account = g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu))))),
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
165 "account");
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
166 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
167 (gdouble)gaim_account_get_int(account, "score", 0));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
168 gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(spin), GTK_ADJUSTMENT(adj));
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
169 g_signal_connect(G_OBJECT(spin), "value-changed",
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
170 G_CALLBACK(account_update), optmenu);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
171 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
172
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
173 gtk_widget_show_all(ret);
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
174
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
175 return ret;
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
176 }
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
177
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
178 static GaimGtkPluginUiInfo ui_info =
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
179 {
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
180 get_config_frame
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
181 };
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
182
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
183 static GaimPluginInfo info =
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
184 {
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9821
diff changeset
185 GAIM_PLUGIN_MAGIC,
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9821
diff changeset
186 GAIM_MAJOR_VERSION,
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9821
diff changeset
187 GAIM_MINOR_VERSION,
7421
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
188 GAIM_PLUGIN_STANDARD, /**< type */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
189 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
190 0, /**< flags */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
191 NULL, /**< dependencies */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
192 GAIM_PRIORITY_DEFAULT, /**< priority */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
193
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
194 CONTACT_PRIORITY_PLUGIN_ID, /**< id */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
195 N_("Contact Priority"), /**< name */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
196 VERSION, /**< version */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
197 /**< summary */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
198 N_("Allows for controlling the values associated with different buddy states."),
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
199 /**< description */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
200 N_("Allows for changing the point values of idle/away/offline states for buddies in contact priority computations."),
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
201 "Etan Reisner <deryni@eden.rutgers.edu>", /**< author */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
202 GAIM_WEBSITE, /**< homepage */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
203
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
204 NULL, /**< load */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
205 NULL, /**< unload */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
206 NULL, /**< destroy */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
207 &ui_info, /**< ui_info */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
208 NULL /**< extra_info */
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
209 };
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
210
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
211 static void
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
212 init_plugin(GaimPlugin *plugin)
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
213 {
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
214 }
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
215
1a52d75489ad [gaim-migrate @ 8023]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
216 GAIM_INIT_PLUGIN(contactpriority, init_plugin, info)