+2003-02-22 ChipX86 <chipx86@chipx86.com>
+
+ * src/config.c: Add config for timestamping partyline text.
+ * src/config.h: Add config for timestamping partyline text.
+ * src/dialogs.c: Add config for timestamping partyline text.
+ * src/gtetrinet.c: Add config for timestamping partyline text.
+ * src/partyline.c: Add timestamps if config is set.
+ * src/partyline.h: Add config for timestamping partyline text.
+
+2003-02-22 James Antill <james@and.org>
+
+ * src/config.c (config_loadtheme): If current theme has no name,
+ revert to default.
+
+ * src/fields.c (fields_init): If the current theme fails to load,
+ change the preference.
+
2003-02-20 Jordi Mallach <jordi@sindominio.net>
* src/tetrinet.c (tetrinet_sendfield): Patch from Ian Zink with big
#include "misc.h"
#include "tetris.h"
#include "fields.h"
+#include "partyline.h"
char blocksfile[1024];
int bsize;
0,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- _("Warning: theme does not have a name"));
+ _("Warning: theme does not have a name,"
+ "reverting to default."));
gtk_dialog_run (GTK_DIALOG (mb));
gtk_widget_destroy (mb);
+ gnome_config_pop_prefix ();
+ g_string_assign(currenttheme, DEFAULTTHEME);
+ config_loadtheme (currenttheme->str);
}
}
else
keys[K_GAMEMSG] = defaultkeys[K_GAMEMSG];
+ /* Get the timestamp option. */
+ timestampsenable = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps", NULL);
+
config_loadtheme (currenttheme->str);
}
keys[K_DISCARD] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
}
+void
+partyline_enable_timestamps_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client; /* Suppress compile warnings */
+ cnxn_id = cnxn_id; /* Suppress compile warnings */
+
+ timestampsenable = gconf_value_get_bool (gconf_entry_get_value (entry));
+ if (!timestampsenable)
+ gconf_client_set_bool (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps", FALSE, NULL);
+}
guint cnxn_id,
GConfEntry *entry);
+void
+partyline_enable_timestamps_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
#define GTETRINET_THEMES GTETRINET_DATA"/themes"
#define DEFAULTTHEME GTETRINET_THEMES"/default/"
#include "misc.h"
#include "sound.h"
#include "string.h"
+#include "partyline.h"
extern GConfClient *gconf_client;
extern GtkWidget *app;
/* the preferences dialog */
/**************************/
GtkWidget *themelist, *keyclist;
+GtkWidget *timestampcheck;
GtkWidget *midientry, *miditable, *midicheck, *soundcheck;
GtkWidget *namelabel, *authlabel, *desclabel;
NULL);
}
+void prefdialog_timestampstoggle (GtkWidget *widget)
+{
+ gconf_client_set_bool (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps",
+ GTK_TOGGLE_BUTTON (widget)->active, NULL);
+}
+
void prefdialog_themelistselect (int n)
{
char author[1024], desc[1024];
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
+ /* partyline */
+ timestampcheck = gtk_check_button_new_with_label (_("Enable Timestamps"));
+ gtk_widget_show(timestampcheck);
+
+ frame = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(frame), timestampcheck, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(timestampcheck),
+ timestampsenable);
+
+ g_signal_connect (G_OBJECT(timestampcheck), "toggled",
+ G_CALLBACK(prefdialog_timestampstoggle), NULL);
+
+ table = gtk_table_new (3, 1, FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER(table), GNOME_PAD);
+ gtk_table_set_row_spacings (GTK_TABLE(table), GNOME_PAD_SMALL);
+ gtk_table_set_col_spacings (GTK_TABLE(table), GNOME_PAD_SMALL);
+ gtk_table_attach (GTK_TABLE(table), frame, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_widget_show (table);
+
+ label = gtk_label_new (_("Partyline"));
+ gtk_widget_show (label);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
+
/* keyboard */
keyclist = GTK_WIDGET (gtk_tree_view_new_with_model (GTK_TREE_MODEL(keys_store)));
key_scroll = gtk_scrolled_window_new (NULL, NULL);
"Falling back to default"));
gtk_dialog_run (GTK_DIALOG (mb));
gtk_widget_destroy (mb);
+ g_string_assign(currenttheme, DEFAULTTHEME);
config_loadtheme (DEFAULTTHEME);
err = NULL;
if (!(pb = gdk_pixbuf_new_from_file(blocksfile, &err))) {
gconf_client_add_dir (gconf_client, "/apps/gtetrinet/keys",
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ gconf_client_add_dir (gconf_client, "/apps/gtetrinet/partyline",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
/* Request notification of change for these gconf keys */
gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/midi_player",
(GConfClientNotifyFunc) sound_midi_player_changed,
(GConfClientNotifyFunc) keys_message_changed,
NULL, NULL, NULL);
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps",
+ (GConfClientNotifyFunc) partyline_enable_timestamps_changed,
+ NULL, NULL, NULL);
+
/* load settings */
config_loadconfig ();
#include "misc.h"
#include "commands.h"
+int timestampsenable;
+
/* widgets that we have to do stuff with */
static GtkWidget *playerlist, *textbox, *entrybox,
*namelabel, *teamlabel, *infolabel, *textboxscroll,
void partyline_text (char *text)
{
- textbox_addtext (GTK_TEXT_VIEW(textbox), text);
+ if (timestampsenable) {
+ time_t now;
+ char buf[1024];
+ char timestamp[9];
+
+ now = time(NULL);
+
+ strftime(timestamp, sizeof(timestamp), "%H:%M:%S", localtime(&now));
+ g_snprintf (buf, sizeof(buf), "%c[%s]%c %s",
+ TETRI_TB_C_GREY, timestamp, TETRI_TB_RESET, text);
+
+ textbox_addtext (GTK_TEXT_VIEW(textbox), buf);
+ }
+ else
+ textbox_addtext (GTK_TEXT_VIEW(textbox), text);
+
adjust_bottom_text_view(GTK_TEXT_VIEW(textbox));
}
#include <gtk/gtk.h>
+
+extern int timestampsenable;
+
extern GtkWidget *partyline_page_new (void);
extern void partyline_connectstatus (int status);
extern void partyline_namelabel (char *nick, char *team);