Fri, 05 Mar 2021 03:31:29 -0600
Create a PidginAvatar widget.
This does everything the existing code does, but trying to integrate right now
is kind of difficult. The plan is to use this in a new PidginInfoPane I have
started, but that change got very large so I just packed it into the end of
the existing info pane.
The only things that are not implement right now, are making menu items
insensitive and that's because we need to figure out a better want to handle
custom avatars for users.
Testing Done:
Ran locally.
Reviewed at https://reviews.imfreedom.org/r/528/
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, write to the Free Software |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | */ |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #include "pidginprotocolchooser.h" |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | #include "pidginprotocolstore.h" |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | /****************************************************************************** |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | * Structs |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | *****************************************************************************/ |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | struct _PidginProtocolChooser { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | GtkComboBox parent; |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
40787
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
35 | GtkTreeModel *model; |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | }; |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | /****************************************************************************** |
|
40787
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
39 | * Callbacks |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
40 | *****************************************************************************/ |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
41 | static void |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
42 | pidgin_protocol_chooser_model_changed_cb(GObject *obj, GParamSpec *pspec, |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
43 | gpointer data) |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
44 | { |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
45 | GtkComboBox *combo = GTK_COMBO_BOX(obj); |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
46 | GtkTreeModel *model = gtk_combo_box_get_model(combo); |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
47 | GtkTreeIter iter; |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
48 | |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
49 | /* When the model for the combobox changes, select the first item. */ |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
50 | if(gtk_tree_model_get_iter_first(model, &iter)) { |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
51 | gtk_combo_box_set_active_iter(combo, &iter); |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
52 | } |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
53 | } |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
54 | |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
55 | /****************************************************************************** |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | * GObject Implementation |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | *****************************************************************************/ |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | G_DEFINE_TYPE(PidginProtocolChooser, pidgin_protocol_chooser, |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | GTK_TYPE_COMBO_BOX) |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | static void |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | pidgin_protocol_chooser_class_init(PidginProtocolChooserClass *klass) |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | gtk_widget_class_set_template_from_resource(widget_class, |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | "/im/pidgin/Pidgin/Protocols/chooser.ui"); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | gtk_widget_class_bind_template_child(widget_class, PidginProtocolChooser, |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | model); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | static void |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | pidgin_protocol_chooser_init(PidginProtocolChooser *chooser) { |
|
40787
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
75 | g_signal_connect_object(G_OBJECT(chooser), "notify::model", |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
76 | G_CALLBACK(pidgin_protocol_chooser_model_changed_cb), |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
77 | chooser, G_CONNECT_AFTER); |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
78 | |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | gtk_widget_init_template(GTK_WIDGET(chooser)); |
|
40787
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
80 | |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
81 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(chooser->model), |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
82 | PIDGIN_PROTOCOL_STORE_COLUMN_NAME, |
|
8a5a20a49e9b
Fix some issues with the protocol chooser and clean up its usage in GtkAccount
Gary Kramlich <grim@reaperworld.com>
parents:
40741
diff
changeset
|
83 | GTK_SORT_ASCENDING); |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | /****************************************************************************** |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | * Public API |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | *****************************************************************************/ |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | GtkWidget * |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | pidgin_protocol_chooser_new(void) { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | return GTK_WIDGET(g_object_new(PIDGIN_TYPE_PROTOCOL_CHOOSER, NULL)); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | |
|
40299
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
94 | PurpleProtocol * |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
95 | pidgin_protocol_chooser_get_selected(PidginProtocolChooser *chooser) { |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
96 | GtkTreeIter iter; |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
97 | PurpleProtocol *protocol = NULL; |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
98 | |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
99 | g_return_val_if_fail(PIDGIN_IS_PROTOCOL_CHOOSER(chooser), NULL); |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
100 | |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
101 | if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(chooser), &iter)) { |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
102 | gtk_tree_model_get(GTK_TREE_MODEL(chooser->model), &iter, |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
103 | PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL, &protocol, |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
104 | -1); |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
105 | } |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
106 | |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
107 | return protocol; |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
108 | } |
|
e2f8638bac5a
Clean up set_account_protocol_cb and change some accessors for PidginProtocolChooser
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
109 | |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | gchar * |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
111 | pidgin_protocol_chooser_get_selected_id(PidginProtocolChooser *chooser) { |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | GtkTreeIter iter; |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
113 | gchar *id = NULL; |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | g_return_val_if_fail(PIDGIN_IS_PROTOCOL_CHOOSER(chooser), NULL); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(chooser), &iter)) { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | gtk_tree_model_get(GTK_TREE_MODEL(chooser->model), &iter, |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
119 | PIDGIN_PROTOCOL_STORE_COLUMN_ID, &id, |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | -1); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
123 | return id; |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | void |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
127 | pidgin_protocol_chooser_set_selected_id(PidginProtocolChooser *chooser, |
|
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
128 | const gchar *id) |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | GtkTreeIter iter; |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
131 | gchar *iter_id = NULL; |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | g_return_if_fail(PIDGIN_IS_PROTOCOL_CHOOSER(chooser)); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(chooser->model), &iter)) { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | do { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | gtk_tree_model_get(GTK_TREE_MODEL(chooser->model), &iter, |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
138 | PIDGIN_PROTOCOL_STORE_COLUMN_ID, &iter_id, |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | -1); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
141 | if(purple_strequal(iter_id, id)) { |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | gtk_combo_box_set_active_iter(GTK_COMBO_BOX(chooser), &iter); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
144 | g_free(iter_id); |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | return; |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40299
diff
changeset
|
149 | g_free(iter_id); |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(chooser->model), |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | &iter)); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | } |