Changeset 2361 for trunk/jons-gtk-gui
- Timestamp:
- 11/24/00 16:54:04 (8 years ago)
- Location:
- trunk/jons-gtk-gui/src
- Files:
-
- 3 modified
-
convo.cpp (modified) (2 diffs)
-
licq_gtk.h (modified) (2 diffs)
-
option_window.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jons-gtk-gui/src/convo.cpp
r2321 r2361 25 25 26 26 #include <string.h> 27 #include <time.h> 27 28 #include <gtk/gtk.h> 28 29 #include <gdk/gdkkeysyms.h> … … 410 411 g_strdup_printf(": %s\n", message); 411 412 413 char szTime[26]; 414 if (show_convo_timestamp) 415 { 416 time_t message_time = u_event->Time(); 417 struct tm *_tm = localtime(&message_time); 418 strftime(szTime, 26, timestamp_format, _tm); 419 } 420 412 421 gtk_text_freeze(GTK_TEXT(c->text)); 413 422 gtk_text_insert(GTK_TEXT(c->text), 0, red, 0, 414 423 c->user->GetAlias(), -1); 424 425 if (show_convo_timestamp) 426 { 427 char *temp_stamp = g_strdup_printf(" (%s)", szTime); 428 gtk_text_insert(GTK_TEXT(c->text), 0, red, 0, 429 temp_stamp, -1); 430 g_free(temp_stamp); 431 } 432 415 433 gtk_text_insert(GTK_TEXT(c->text), 0, 0, 0, for_user_m, -1); 416 434 gtk_text_thaw(GTK_TEXT(c->text)); -
trunk/jons-gtk-gui/src/licq_gtk.h
r2358 r2361 299 299 GtkWidget *show_ignored; 300 300 GtkWidget *show_offline; 301 GtkWidget *show_timestamp; 302 GtkWidget *txtTimestampFormat; 301 303 GtkWidget *enter_sends; 302 304 GtkWidget *flash_events; … … 494 496 extern bool show_offline_users; 495 497 extern bool show_ignored_users; 498 extern bool show_convo_timestamp; 499 extern char timestamp_format[50]; 496 500 extern bool enter_sends; 497 501 extern bool flash_events; -
trunk/jons-gtk-gui/src/option_window.cpp
r2332 r2361 28 28 bool show_offline_users; 29 29 bool show_ignored_users; 30 bool show_convo_timestamp; 30 31 bool enter_sends; 31 32 bool flash_events; 32 33 /* The "Options" selection under the menu in the main window */ 33 char timestamp_format[50]; 34 35 // The "Options" selection under the menu in the main window 34 36 void menu_options_create() 35 37 { … … 39 41 GtkWidget *label; 40 42 GtkWidget *close; 43 GtkWidget *hbox; 41 44 struct options_window *ow = g_new0(struct options_window, 1); 42 45 43 / * Make the window */46 // Make the window 44 47 ow->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 45 48 gtk_widget_show(ow->window); 46 49 gtk_window_set_title(GTK_WINDOW(ow->window), "Licq - Options"); 47 50 48 / * The vertical box, the main window will contain this */51 // The vertical box, the main window will contain this 49 52 v_box = gtk_vbox_new(FALSE, 5); 50 53 gtk_container_add(GTK_CONTAINER(ow->window), v_box); 51 54 52 / * The notebook that will contain all the options */55 // The notebook that will contain all the options 53 56 notebook = gtk_notebook_new(); 54 57 55 / * The table that will be used in all the notebook pages */58 // The table that will be used in all the notebook pages 56 59 table = gtk_table_new(5, 2, FALSE); 57 60 58 61 /*********************** FIRST TAB *********************/ 59 62 60 / * Show ignored users in the contact list? */63 // Show ignored users in the contact list? 61 64 ow->show_ignored = gtk_check_button_new_with_label("Show ignored users"); 62 65 gtk_table_attach(GTK_TABLE(table), ow->show_ignored, 0, 1, 0, 1, … … 64 67 GTK_FILL, 3, 3); 65 68 66 / * Show offline users in the contact list? */69 // Show offline users in the contact list? 67 70 ow->show_offline = gtk_check_button_new_with_label("Show offline users"); 68 71 gtk_table_attach(GTK_TABLE(table), ow->show_offline, 1, 2, 0, 1, … … 70 73 GTK_FILL, 3, 3); 71 74 72 / * Enter key pressed in the convo window send it? */75 // Enter key pressed in the convo window send it? 73 76 ow->enter_sends = gtk_check_button_new_with_label("Enter sends messages"); 74 77 gtk_table_attach(GTK_TABLE(table), ow->enter_sends, 0, 1, 1, 2, … … 81 84 GtkAttachOptions(GTK_FILL | GTK_EXPAND), GTK_FILL, 3, 3); 82 85 83 /* Set the check buttons */ 84 //set_options(ow); 85 86 /* Put the table in the notebook */ 86 // Timestamp 87 ow->show_timestamp = gtk_check_button_new_with_label("Show timestamp in messages"); 88 gtk_table_attach(GTK_TABLE(table), ow->show_timestamp, 0, 1, 2, 3, 89 GtkAttachOptions(GTK_FILL | GTK_EXPAND), 90 GTK_FILL, 3, 3); 91 92 // Timestamp format 93 hbox = gtk_hbox_new(false, 5); 94 label = gtk_label_new("Timestamp Format:"); 95 ow->txtTimestampFormat = gtk_entry_new_with_max_length(50); 96 gtk_widget_set_usize(ow->txtTimestampFormat, 80, 20); 97 gtk_box_pack_start(GTK_BOX(hbox), label, false, 0, 0); 98 gtk_box_pack_start(GTK_BOX(hbox), ow->txtTimestampFormat, false, 0, 0); 99 gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 2, 3, 100 GtkAttachOptions(GTK_FILL | GTK_EXPAND), 101 GTK_FILL, 3,3 ); 102 103 104 // Put the table in the notebook 87 105 label = gtk_label_new("General"); 88 106 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label); … … 90 108 /**************** Second tab: Contact List Colors ****************/ 91 109 92 / * Recreate the table */110 // Recreate the table 93 111 table = gtk_table_new(5, 2, FALSE); 94 112 95 / * The table for the color selection in the "Contact List Colors" frame */113 // The table for the color selection in the "Contact List Colors" frame 96 114 GtkWidget *clr_table = gtk_table_new(3, 3, FALSE); 97 115 98 / * Colors frame and attach it to the table and also a table for inside **99 * the frame */116 // Colors frame and attach it to the table and also a table for inside 117 // the frame 100 118 GtkWidget *color_frame = gtk_frame_new("Contact List Colors"); 101 119 gtk_table_attach(GTK_TABLE(table), color_frame, 0, 1, 0, 1, … … 103 121 gtk_container_add(GTK_CONTAINER(color_frame), clr_table); 104 122 105 / * Online color label */123 // Online color label 106 124 label = gtk_label_new("Online Color"); 107 125 gtk_table_attach(GTK_TABLE(clr_table), label, 0, 1, 0, 1, 108 126 GTK_FILL, GTK_FILL, 3, 3); 109 127 110 / * Online color browse button */128 // Online color browse button 111 129 int *chg_on_color = new int; 112 130 *chg_on_color = 1; … … 119 137 GTK_FILL, GTK_FILL, 3, 3); 120 138 121 / * Offline color label */139 // Offline color labe 122 140 label = gtk_label_new("Offline Color"); 123 141 gtk_table_attach(GTK_TABLE(clr_table), label, 0, 1, 1, 2, 124 142 GTK_FILL, GTK_FILL, 3, 3); 125 143 126 / * Offline color browse button */144 // Offline color browse button 127 145 int *chg_off_color = new int; 128 146 *chg_off_color = 2; … … 322 340 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ow->flash_events), 323 341 flash_events); 342 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ow->show_timestamp), 343 show_convo_timestamp); 344 gtk_entry_set_text(GTK_ENTRY(ow->txtTimestampFormat), 345 timestamp_format); 324 346 325 347 // Clist of servers … … 348 370 show_ignored_users = gtk_toggle_button_get_active( 349 371 GTK_TOGGLE_BUTTON(ow->show_ignored)); 372 show_convo_timestamp = gtk_toggle_button_get_active( 373 GTK_TOGGLE_BUTTON(ow->show_timestamp)); 350 374 enter_sends = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ow->enter_sends)); 351 375 flash_events = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( 352 376 ow->flash_events)); 353 377 gchar *temp = gtk_editable_get_chars(GTK_EDITABLE(ow->txtTimestampFormat), 0, -1); 378 strcpy(timestamp_format, temp); 379 g_free(temp); 380 381 // Save the daemon options 382 icq_daemon->setDefaultRemotePort( 383 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ow->spnDefPort))); 384 385 icq_daemon->SetTCPPorts( 386 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ow->spnPortLow)), 387 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ow->spnPortHigh))); 388 389 icq_daemon->SetTCPEnabled( 390 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ow->chkTCPEnabled))); 391 354 392 gtk_widget_destroy(ow->window); 355 356 // Save the daemon options357 icq_daemon->setDefaultRemotePort(gtk_spin_button_get_value_as_int(358 GTK_SPIN_BUTTON(ow->spnDefPort)));359 icq_daemon->SetTCPPorts(gtk_spin_button_get_value_as_int(360 GTK_SPIN_BUTTON(ow->spnPortLow)),361 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ow->spnPortHigh)));362 icq_daemon->SetTCPEnabled(!gtk_toggle_button_get_active(363 GTK_TOGGLE_BUTTON(ow->chkTCPEnabled)));364 393 365 394 icq_daemon->SaveConf(); … … 389 418 licqConf.WriteBool("EnterSends", enter_sends); 390 419 licqConf.WriteBool("FlashEvents", flash_events); 420 licqConf.WriteBool("ShowTimestamp", show_convo_timestamp); 421 licqConf.WriteStr("TimestampFormat", timestamp_format); 391 422 392 423 licqConf.FlushFile(); … … 434 465 licqConf.ReadBool("EnterSends", enter_sends, true); 435 466 licqConf.ReadBool("FlashEvents", flash_events, true); 467 licqConf.ReadBool("ShowTimestamp", show_convo_timestamp, true); 468 licqConf.ReadStr("TimestampFormat", timestamp_format, "%H:%M:%S"); 436 469 } 437 470
