| Yattm - unified GTK instant-messaging client | ![]() |
| [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003] |
#include <glib.h>Include dependency graph for prefs.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | _ptr_list |
Defines | |
| #define | MAX_PREF_NAME_LEN 255 |
| #define | MAX_PREF_LEN 1024 |
Typedefs | |
| typedef _ptr_list | ptr_list |
Functions | |
| void | write_prefs () |
| void | eb_read_prefs () |
| void | build_prefs () |
| void | rebuild_import_menu () |
| void | rebuild_profile_menu () |
| void * | GetPref (char *key) |
| void * | SetPref (char *key, void *data) |
| int | iGetLocalPref (char *key) |
| void | iSetLocalPref (char *key, int data) |
| float | fGetLocalPref (char *key) |
| void | fSetLocalPref (char *key, float data) |
| char * | cGetLocalPref (char *key) |
| void | cSetLocalPref (char *key, char *data) |
| void | rebuild_set_status_menu () |
| void | save_account_info (char *service, GList *pairs) |
| void | reload_service_accounts (int service_id) |
|
|
Definition at line 29 of file prefs.h. Referenced by eb_input_accept(), eb_input_to_value_pair(), eb_update_from_value_pair(), fSetLocalPref(), and iSetLocalPref(). |
|
|
Definition at line 28 of file prefs.h. Referenced by cGetLocalPref(), cSetLocalPref(), eb_input_to_value_pair(), eb_update_from_value_pair(), and iSetLocalPref(). |
|
|
|
|
|
Definition at line 91 of file prefs.c. References _, build_chat_prefs(), build_encoding_prefs(), build_general_prefs(), build_layout_prefs(), build_logs_prefs(), build_modules_prefs(), build_proxy_prefs(), build_sound_prefs(), cancel_callback(), destroy(), eb_icon(), is_prefs_open, ok_callback(), and SetPref(). Referenced by build_prefs_callback().
00092 {
00093 if(!is_prefs_open)
00094 {
00095 GtkWidget *hbox;
00096 GtkWidget *label;
00097 GtkWidget *button;
00098 GtkWidget *hbox2;
00099 GtkWidget *prefs_vbox;
00100 GtkWidget *iconwid;
00101 GdkPixmap *icon;
00102 GdkBitmap *mask;
00103 GtkWidget *prefs_window;
00104
00105 prefs_vbox = gtk_vbox_new(FALSE, 5);
00106 prefs_window = gtk_window_new(GTK_WINDOW_DIALOG);
00107 gtk_window_set_position(GTK_WINDOW(prefs_window), GTK_WIN_POS_MOUSE);
00108 /* set current parent to prefs so error dialogs know who real
00109 * parent is */
00110 current_parent_widget = prefs_window;
00111 gtk_widget_realize(prefs_window);
00112 gtk_window_set_title(GTK_WINDOW(prefs_window), _("Yattm Preferences"));
00113 eb_icon(prefs_window->window);
00114 gtk_signal_connect(GTK_OBJECT(prefs_window), "destroy",
00115 GTK_SIGNAL_FUNC(destroy), NULL);
00116
00117 /*
00118 ************************************************************
00119 Below the different tabs are defined for the preferences
00120 window. In which the user can make yattm work more
00121 the way he/she wants it too.
00122 ************************************************************
00123 */
00124
00125 {
00126 GtkWidget *prefs_note = gtk_notebook_new();
00127 SetPref("widget::prefs_note", prefs_note);
00128 build_general_prefs(prefs_note);
00129 build_logs_prefs(prefs_note);
00130 build_sound_prefs(prefs_note);
00131 build_layout_prefs(prefs_note);
00132 build_chat_prefs(prefs_note);
00133 // build_connections_prefs(prefs_note);
00134 gtk_box_pack_start(GTK_BOX(prefs_vbox), prefs_note, FALSE, FALSE, 0);
00135 build_proxy_prefs(prefs_note);
00136 #ifdef HAVE_ICONV_H
00137 build_encoding_prefs(prefs_note);
00138 #endif
00139 build_modules_prefs(prefs_note);
00140 }
00141
00142 /*Okay Button*/
00143 hbox = gtk_hbox_new(FALSE, 5);
00144 hbox2 = gtk_hbox_new(TRUE, 5);
00145 gtk_widget_set_usize(hbox2, 200,25);
00146
00147 icon = gdk_pixmap_create_from_xpm_d(prefs_window->window, &mask, NULL, ok_xpm);
00148 iconwid = gtk_pixmap_new(icon, mask);
00149 label = gtk_label_new(_("Ok"));
00150
00151 gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, FALSE, 2);
00152 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
00153
00154 gtk_widget_show(iconwid);
00155 gtk_widget_show(label);
00156
00157 button = gtk_button_new();
00158
00159 gtk_signal_connect(GTK_OBJECT(button), "clicked",
00160 ok_callback, prefs_window);
00161
00162 gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
00163 GTK_SIGNAL_FUNC (gtk_widget_destroy),
00164 GTK_OBJECT (prefs_window));
00165 gtk_widget_show(hbox);
00166
00167 gtk_container_add (GTK_CONTAINER (button), hbox);
00168
00169 gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 5);
00170 gtk_widget_show(button);
00171
00172 /*Cancel Button*/
00173 hbox = gtk_hbox_new(FALSE, 5);
00174 icon = gdk_pixmap_create_from_xpm_d(prefs_window->window, &mask, NULL, cancel_xpm);
00175 iconwid = gtk_pixmap_new(icon, mask);
00176 label = gtk_label_new(_("Cancel"));
00177
00178 gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, FALSE, 2);
00179 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
00180
00181 gtk_widget_show(iconwid);
00182 gtk_widget_show(label);
00183
00184 button = gtk_button_new();
00185
00186 gtk_signal_connect(GTK_OBJECT(button), "clicked",
00187 cancel_callback, prefs_window);
00188
00189 gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
00190 GTK_SIGNAL_FUNC (gtk_widget_destroy),
00191 GTK_OBJECT (prefs_window));
00192 gtk_widget_show(hbox);
00193
00194 gtk_container_add (GTK_CONTAINER (button), hbox);
00195
00196 gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 5);
00197 gtk_widget_show(button);
00198
00199 /*End Buttons*/
00200 hbox = gtk_hbox_new(FALSE, 5);
00201
00202 gtk_box_pack_end(GTK_BOX(hbox), hbox2, FALSE, FALSE, 5);
00203 gtk_widget_show(hbox2);
00204
00205 gtk_box_pack_start(GTK_BOX(prefs_vbox), hbox, FALSE, FALSE, 5);
00206 gtk_widget_show(hbox);
00207 gtk_widget_show(prefs_vbox);
00208 gtk_container_add(GTK_CONTAINER(prefs_window), prefs_vbox);
00209
00210 gtk_widget_show(prefs_window);
00211 is_prefs_open = 1;
00212 }
00213 }
|
|
|
||||||||||||
|
|
Definition at line 2233 of file prefs.c. References accel_next_tab, accel_prev_tab, BuddyArriveDefault, BuddyLeaveDefault, cGetLocalPref(), cSetLocalPref(), DBG_CORE, do_applet_show_on_startup, do_away_sound, do_convo_timestamp, do_enter_send, do_escape_close, do_ignore_back, do_ignore_font, do_ignore_fore, do_ignore_unknown, do_logging, do_login_on_startup, do_multi_line, do_no_sound_for_ignore, do_no_sound_when_away, do_noautoresize, do_online_sound, do_play_first, do_play_receive, do_play_send, do_plugin_debug, do_raise_window, do_restore_last_conv, do_send_idle_time, do_send_typing_notify, do_smiley, do_strip_html, do_tabbed_chat, do_tabbed_chat_orient, do_timestamp, do_typing_notify, do_yattm_debug, do_yattm_debug_html, eb_debug, font_size, font_size_def, get_service_id(), get_service_name(), iGetLocalPref(), iSetLocalPref(), length_contact_window_def, MODULE_DIR, PLUGIN_PREF, ReceiveDefault, SendDefault, SERVICE_PREF, SetPref(), use_alternate_browser, value_pair_add(), value_pair_free(), and width_contact_window_def. Referenced by main().
02234 {
02235 gchar buff[1024];
02236 int pref_type=0;
02237 FILE * fp;
02238 gchar *param=buff;
02239 gchar *val=buff;
02240
02241 /* Set some default values */
02242 iSetLocalPref("length_contact_window", length_contact_window_def);
02243 iSetLocalPref("width_contact_window", width_contact_window_def);
02244 cSetLocalPref("modules_path", MODULE_DIR);
02245 cSetLocalPref("BuddyArriveFilename", BuddyArriveDefault);
02246 cSetLocalPref("BuddyAwayFilename", BuddyLeaveDefault);
02247 cSetLocalPref("BuddyLeaveFilename", BuddyLeaveDefault);
02248 cSetLocalPref("FirstMsgFilename", ReceiveDefault);
02249 cSetLocalPref("ReceiveFilename", ReceiveDefault);
02250 cSetLocalPref("SendFilename", SendDefault);
02251 iSetLocalPref("FontSize", font_size_def);
02252
02253 g_snprintf(buff, 1024, "%sprefs",config_dir);
02254 fp = fopen(buff, "r");
02255 if(!fp)
02256 {
02257 /* This would cause things to crash if there is no file, as services
02258 * are not loaded yet. It will be called when actual changes are made
02259 * to preferences, until then, it doesn't need to be written.
02260 */
02261 printf("can't open %s\n",buff);
02262 // write_prefs();
02263 return;
02264 }
02265 while(!feof(fp))
02266 {
02267 fgets(buff, 1024, fp);
02268 param=buff;
02269 if(feof(fp))
02270 break;
02271 g_strstrip(param);
02272 pref_type=0;
02273 if(!strcasecmp(buff, "plugins"))
02274 pref_type=PLUGIN_PREF;
02275 else if(!strcasecmp(buff, "connections"))
02276 pref_type=SERVICE_PREF;
02277 if(pref_type!=0)
02278 {
02279 for(;;)
02280 {
02281 int id=-1;
02282 char *plugin_name=NULL;
02283 GList * session_prefs = NULL;
02284 GList *osession_prefs = NULL;
02285 fgets(buff, 1024, fp);
02286 param=buff;
02287 g_strstrip(param);
02288 if(!strcasecmp(param, "end"))
02289 {
02290 break;
02291 }
02292 switch(pref_type) {
02293 case PLUGIN_PREF:
02294 plugin_name=strdup(param);
02295 break;
02296 case SERVICE_PREF:
02297 id = get_service_id(param);
02298 break;
02299 default:
02300 break;
02301 }
02302
02303 for(;;)
02304 {
02305 fgets(buff, 1024, fp);
02306 param=buff;
02307 g_strstrip(param);
02308 if(!strcasecmp(param, "end"))
02309 {
02310 switch(pref_type) {
02311 case PLUGIN_PREF:
02312 osession_prefs = SetPref(plugin_name, session_prefs);
02313 if(osession_prefs)
02314 {
02315 eb_debug(DBG_CORE, "Freeing osession_prefs\n");
02316 value_pair_free(osession_prefs);
02317 }
02318 free(plugin_name);
02319 break;
02320 case SERVICE_PREF:
02321 osession_prefs = SetPref(get_service_name(id), session_prefs);
02322 if(osession_prefs)
02323 {
02324 eb_debug(DBG_CORE, "Freeing osession_prefs\n");
02325 value_pair_free(osession_prefs);
02326 }
02327 break;
02328 default:
02329 eb_debug(DBG_CORE, "Error! We're not supposed to ever get here!\n");
02330 break;
02331 }
02332 break;
02333 }
02334 else
02335 {
02336 val=param;
02337
02338 while(*val != 0 && *val !='=')
02339 val++;
02340 if(*val=='=')
02341 {
02342 *val='\0';
02343 val++;
02344 }
02345
02346 /*
02347 * if quoted strip off the quotes
02348 */
02349
02350 if(*val == '"')
02351 {
02352 val++;
02353 val[strlen(val)-1] = '\0';
02354 }
02355 eb_debug(DBG_CORE,"Adding %s:%s to session_prefs\n", param, val);
02356 session_prefs = value_pair_add(session_prefs,
02357 param, val);
02358 }
02359 }
02360 }
02361 continue;
02362 } /* if(pref_type !=0) */
02363 val=param;
02364
02365 while(*val != 0 && *val !='=')
02366 val++;
02367 if(*val=='=')
02368 {
02369 *val='\0';
02370 val++;
02371 }
02372 cSetLocalPref(param, val);
02373 }
02374 do_logging =iGetLocalPref("do_logging");
02375 do_strip_html =iGetLocalPref("do_strip_html");
02376 do_play_send =iGetLocalPref("do_play_send");
02377 do_play_first =iGetLocalPref("do_play_first");
02378 do_play_receive =iGetLocalPref("do_play_receive");
02379 do_ignore_unknown =iGetLocalPref("do_ignore_unknown");
02380 do_send_idle_time =iGetLocalPref("do_send_idle_time");
02381 do_raise_window =iGetLocalPref("do_raise_window");
02382 do_timestamp =iGetLocalPref("do_timestamp");
02383 do_online_sound =iGetLocalPref("do_online_sound");
02384 do_multi_line =iGetLocalPref("do_multi_line");
02385 do_ignore_fore =iGetLocalPref("do_ignore_fore");
02386 do_ignore_back =iGetLocalPref("do_ignore_back");
02387 do_ignore_font =iGetLocalPref("do_ignore_font");
02388 do_convo_timestamp =iGetLocalPref("do_convo_timestamp");
02389 do_typing_notify =iGetLocalPref("do_typing_notify");
02390 do_send_typing_notify =iGetLocalPref("do_send_typing_notify");
02391 do_smiley =iGetLocalPref("do_smiley");
02392 do_escape_close =iGetLocalPref("do_escape_close");
02393 do_enter_send =iGetLocalPref("do_enter_send");
02394 #ifdef HAVE_ICONV_H
02395 use_recoding =iGetLocalPref("use_recoding");
02396 #endif
02397 do_restore_last_conv =iGetLocalPref("do_restore_last_conv");
02398 /*
02399 use_typical_sound_method=iGetLocalPref("use_typical_sound_method");
02400 use_sounddevice=cGetLocalPref("use_sounddevice");
02401 */
02402 do_away_sound =iGetLocalPref("do_away_sound");
02403 do_no_sound_when_away =iGetLocalPref("do_no_sound_when_away");
02404 do_no_sound_for_ignore=iGetLocalPref("do_no_sound_for_ignore");
02405 do_tabbed_chat =iGetLocalPref("do_tabbed_chat");
02406 do_tabbed_chat_orient =iGetLocalPref("do_tabbed_chat_orient");
02407 #ifdef HAVE_ISPELL
02408 do_spell_checking =iGetLocalPref("do_spell_checking");
02409 #endif
02410 do_noautoresize =iGetLocalPref("do_noautoresize");
02411 use_alternate_browser =iGetLocalPref("use_alternate_browser");
02412 do_applet_show_on_startup=iGetLocalPref("do_applet_show_on_startup");
02413 do_login_on_startup =iGetLocalPref("do_login_on_startup");
02414 do_yattm_debug =iGetLocalPref("do_yattm_debug");
02415 do_yattm_debug_html=iGetLocalPref("do_yattm_debug_html");
02416 do_plugin_debug =iGetLocalPref("do_plugin_debug");
02417 font_size =iGetLocalPref("FontSize");
02418 gtk_accelerator_parse(cGetLocalPref("accel_next_tab"), &(accel_next_tab.keyval), &(accel_next_tab.modifiers));
02419 gtk_accelerator_parse(cGetLocalPref("accel_prev_tab"), &(accel_prev_tab.keyval), &(accel_prev_tab.modifiers));
02420 proxy_set_proxy(iGetLocalPref("proxy_type"), cGetLocalPref("proxy_host"), iGetLocalPref("proxy_port"));
02421 proxy_set_auth(iGetLocalPref("do_proxy_auth"), cGetLocalPref("proxy_user"), cGetLocalPref("proxy_password"));
02422 fclose(fp);
02423 }
|
|
|
Definition at line 1742 of file prefs.c. References cGetLocalPref(). Referenced by playsoundfile(), and write_sound_prefs().
01742 {
01743 float value=0;
01744
01745 value=atof(cGetLocalPref(key));
01746 return(value);
01747 }
|
|
||||||||||||
|
Referenced by cancel_sound_prefs(), and soundvolume_changed(). |
|
|
|
Referenced by build_chat_prefs(), build_general_prefs(), build_layout_prefs(), build_sound_tab(), eb_read_prefs(), update_contact_window_length(), and write_general_prefs(). |
|
||||||||||||
|
Referenced by eb_read_prefs(), eb_save_size(), write_chat_prefs(), and write_layout_prefs(). |
|
|
Definition at line 1255 of file prefs.c. References DBG_CORE, eb_debug, eb_import_window(), and GetPref(). Referenced by reload_modules().
01256 {
01257 GtkWidget *import_submenuitem;
01258
01259 import_submenuitem = GetPref("widget::import_submenuitem");
01260 if(!import_submenuitem) {
01261 eb_debug(DBG_CORE, "Not rebuilding import menu, it's never been built.\n");
01262 return;
01263 }
01264 gtk_menu_item_remove_submenu(GTK_MENU_ITEM(import_submenuitem));
01265 eb_import_window(import_submenuitem);
01266 gtk_widget_draw(GTK_WIDGET(import_submenuitem), NULL);
01267 }
|
|
|
Definition at line 1268 of file prefs.c. References DBG_CORE, eb_debug, eb_profile_window(), and GetPref(). Referenced by reload_modules().
01269 {
01270 GtkWidget *profile_submenuitem;
01271
01272 profile_submenuitem = GetPref("widget::profile_submenuitem");
01273 if(!profile_submenuitem) {
01274 eb_debug(DBG_CORE, "Not rebuilding profile menu, it's never been built.\n");
01275 return;
01276 }
01277 gtk_menu_item_remove_submenu(GTK_MENU_ITEM(profile_submenuitem));
01278 eb_profile_window(profile_submenuitem);
01279 gtk_widget_draw(GTK_WIDGET(profile_submenuitem), NULL);
01280 }
|
|
|
Definition at line 1245 of file prefs.c. References eb_set_status_window(), and GetPref(). Referenced by ok_callback(), reload_modules(), reload_plugin_callback(), and unload_plugin_callback().
01246 {
01247 GtkWidget *set_status_submenuitem;
01248
01249 set_status_submenuitem = GetPref("widget::set_status_submenuitem");
01250 gtk_menu_item_remove_submenu(GTK_MENU_ITEM(set_status_submenuitem));
01251 eb_set_status_window(set_status_submenuitem);
01252 gtk_widget_draw(GTK_WIDGET(set_status_submenuitem), NULL);
01253 }
|
|
|
Definition at line 1187 of file prefs.c. References _, local_account::connected, DBG_CORE, do_error_dialog(), eb_debug, get_service_id(), get_service_name(), GetPref(), local_account::handle, local_account::protocol_local_account_data, and local_account::service_id. Referenced by add_service().
01188 {
01189 GList * node = accounts;
01190 GList * account_pairs;
01191 eb_local_account *oela=NULL, *nela=NULL;
01192 char buff[256], buff2[1024];
01193
01194 while(node)
01195 {
01196 oela=node->data;
01197 if(oela->service_id != service_id || oela->connected) {
01198 node = node->next;
01199 continue;
01200 }
01201 eb_debug(DBG_CORE, "Account: handle:%s service: %s\n", oela->handle, get_service_name(oela->service_id));
01202 g_snprintf(buff, 256, "%s:%s", get_service_name(oela->service_id), oela->handle);
01203 account_pairs = GetPref(buff);
01204 nela = eb_services[oela->service_id].sc->read_local_account_config(account_pairs);
01205 if(!nela) {
01206 g_snprintf(buff2, 256, _("Unable to create account for %s, check config file\n"), buff);
01207 do_error_dialog(buff2, _("Invalid account"));
01208 oela->service_id=get_service_id("NO SERVICE");
01209 }
01210 else {
01211 nela->service_id = oela->service_id;
01212 node->data=nela;
01213 //FIXME: This should probably be left to the service to clean up, though at this point, it may not exist
01214 g_free(oela->handle);
01215 g_free(oela->protocol_local_account_data);
01216 g_free(oela);
01217 }
01218 node = node->next;
01219 }
01220 }
|
|
||||||||||||
|
Definition at line 1178 of file prefs.c. References SetPref(), and value_pair_get_value(). Referenced by ok_callback(), and yyparse().
01179 {
01180 char buff[256];
01181 char *val = value_pair_get_value(pairs, "SCREEN_NAME");
01182 g_snprintf(buff, 256, "%s:%s", service, val);
01183 g_free(val);
01184 SetPref(buff, pairs);
01185 }
|
|
||||||||||||
|
Referenced by build_modules_prefs(), build_prefs(), cSetLocalPref(), eb_read_prefs(), eb_status_window(), init_menu(), save_account_info(), SetPluginInfo(), and write_module_prefs(). |
|
|
Definition at line 2205 of file prefs.c. References write_chat_prefs(), write_general_prefs(), write_layout_prefs(), write_logs_prefs(), write_module_prefs(), write_proxy_prefs(), and write_sound_prefs(). Referenced by eb_save_size(), and ok_callback().
02206 {
02207 gchar buff[1024], file[1024];
02208 FILE * fp;
02209 // todo: write to temp file and rename at end to prevent damaged files
02210 g_snprintf(buff, 1024, "%sprefs.tmp",config_dir);
02211 g_snprintf(file, 1024, "%sprefs",config_dir);
02212 fp = fopen(buff, "w");
02213 write_general_prefs(fp);
02214 write_logs_prefs(fp);
02215 write_sound_prefs(fp);
02216 write_chat_prefs(fp);
02217 write_layout_prefs(fp);
02218 #ifdef HAVE_ICONV_H
02219 write_encoding_prefs(fp);
02220 #endif
02221 write_proxy_prefs(fp);
02222 write_module_prefs(fp);
02223 // write_connections_prefs(fp);
02224 fprintf(fp, "end\n");
02225 fclose(fp);
02226 rename(buff,file);
02227 }
|