| 188 { |
188 { |
| 189 PidginDebugUi *ui = pidgin_debug_ui_new(); |
189 PidginDebugUi *ui = pidgin_debug_ui_new(); |
| 190 purple_debug_set_ui(PURPLE_DEBUG_UI(ui)); |
190 purple_debug_set_ui(PURPLE_DEBUG_UI(ui)); |
| 191 } |
191 } |
| 192 |
192 |
| |
193 static gboolean |
| |
194 pidgin_history_init(GError **error) { |
| |
195 PurpleHistoryManager *manager = NULL; |
| |
196 PurpleHistoryAdapter *adapter = NULL; |
| |
197 gchar *filename = NULL; |
| |
198 const gchar *id = NULL; |
| |
199 |
| |
200 manager = purple_history_manager_get_default(); |
| |
201 |
| |
202 /* Attempt to create the config_dir. We don't care about the result as the |
| |
203 * logging adapter will fail with a better error than us failing to create |
| |
204 * the directory. |
| |
205 */ |
| |
206 g_mkdir_with_parents(purple_config_dir(), 0700); |
| |
207 |
| |
208 filename = g_build_filename(purple_config_dir(), "history.db", NULL); |
| |
209 adapter = purple_sqlite_history_adapter_new(filename); |
| |
210 g_free(filename); |
| |
211 |
| |
212 id = purple_history_adapter_get_id(adapter); |
| |
213 if(!purple_history_manager_register(manager, adapter, error)) { |
| |
214 g_clear_object(&adapter); |
| |
215 |
| |
216 return FALSE; |
| |
217 } |
| |
218 |
| |
219 /* The manager adds a ref to the adapter on registration, so we can remove |
| |
220 * our reference. |
| |
221 */ |
| |
222 g_clear_object(&adapter); |
| |
223 |
| |
224 return purple_history_manager_set_active(manager, id, error); |
| |
225 } |
| |
226 |
| 193 static void |
227 static void |
| 194 pidgin_ui_init(void) |
228 pidgin_ui_init(void) |
| 195 { |
229 { |
| 196 PurpleProtocolManager *protocol_manager = NULL; |
230 PurpleProtocolManager *protocol_manager = NULL; |
| 197 GtkIconTheme *theme = NULL; |
231 GtkIconTheme *theme = NULL; |
| |
232 GError *error = NULL; |
| 198 gchar *path; |
233 gchar *path; |
| 199 |
234 |
| 200 theme = gtk_icon_theme_get_default(); |
235 theme = gtk_icon_theme_get_default(); |
| 201 |
236 |
| 202 path = g_build_filename(PURPLE_DATADIR, "pidgin", "icons", NULL); |
237 path = g_build_filename(PURPLE_DATADIR, "pidgin", "icons", NULL); |
| 213 /* Add the icon paths for all the protocols that libpurple found at start |
248 /* Add the icon paths for all the protocols that libpurple found at start |
| 214 * up. |
249 * up. |
| 215 */ |
250 */ |
| 216 purple_protocol_manager_foreach(protocol_manager, |
251 purple_protocol_manager_foreach(protocol_manager, |
| 217 purple_ui_protocol_foreach_theme_cb, NULL); |
252 purple_ui_protocol_foreach_theme_cb, NULL); |
| |
253 |
| |
254 if(!pidgin_history_init(&error)) { |
| |
255 g_critical("failed to initialize the history api: %s", |
| |
256 error != NULL ? error->message : "unknown"); |
| |
257 g_clear_error(&error); |
| |
258 } |
| 218 |
259 |
| 219 pidgin_stock_init(); |
260 pidgin_stock_init(); |
| 220 |
261 |
| 221 /* Set the UI operation structures. */ |
262 /* Set the UI operation structures. */ |
| 222 purple_accounts_set_ui_ops(pidgin_accounts_get_ui_ops()); |
263 purple_accounts_set_ui_ops(pidgin_accounts_get_ui_ops()); |