+2003-04-09 Dani Carbonell <bocata@panete.net>
+
+ * gtetrinet.schemas.in: added a new schema for the Enable Channel List
+ option.
+
+ * src/client.c (client_readmsg): clarified the error message.
+
+ * src/config.c: added support for the new option.
+ (partyline_enable_channel_list_changed): handler for the gconf key.
+ (config_loadconfig): added code to get the configuration of the new
+ option.
+
+ * src/config.h: added the prototype for the new handler.
+
+ * src/dialogs.c: added the UI for the new option.
+ (prefdialog_channeltoggle): new handler.
+ (prefdialog_new): added code for the new option. Also, modified the
+ policy of the keys scrolled window, so you can now horizontally scroll
+ it.
+
+ * src/gtetrinet.c (main): added a GConf notification for the new option.
+
+ * src/partyline.c: Added a convenience function for the Enable Channel
+ List option changed handler. Also, added code to parse the channel list
+ of one more server.
+ (partyline_page_new): slightly modified so we can now easily hide the
+ channel list.
+ (partyline_add_channel): added code to support a new server.
+ (partyline_show_channel_list): new convenience function, it will show
+ or hide the channel list as requested by the user.
+
+ * src/partyline.h: two new declarations, the convenience function and
+ the variable that is used to cache the GConf setting.
+
+ * src/tetrinet.c (tetrinet_inmessage): added code to support one more
+ server.
+
2003-04-04 Jordi Mallach <jordi@sindominio.net>
* Makefile.am: fix the install path for desktop files.
<short>Enable/disable timestamps.</short>
<long>Enables/disables timestamps in the partyline.</long>
</locale>
- </schema>
+ </schema>
+
+
+ <schema>
+ <key>/schemas/apps/gtetrinet/partyline/enable_channel_list</key>
+ <applyto>/apps/gtetrinet/partyline/enable_channel_list</applyto>
+ <owner>gtetrinet</owner>
+ <type>bool</type>
+ <default>1</default>
+
+ <locale name="C">
+ <short>Enable/disable channel list.</short>
+ <long>Enables/disables the channel list. Disable it if you experience problems when connecting or while playing
+ in your favorite tetrinet server.</long>
+ </locale>
+ </schema>
</schemalist>
</gconfschemafile>
switch (g_io_channel_read_chars (io_channel, &buf[i], 1, &bytes, &error))
{
case G_IO_STATUS_EOF :
- g_warning ("End of file.");
+ g_warning ("End of file (server closed connection).");
return -1;
break;
/* Get the timestamp option. */
timestampsenable = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps", NULL);
+ /* Get the channel list option */
+ list_enabled = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/partyline/enable_channel_list", NULL);
+
config_loadtheme (currenttheme->str);
}
if (!timestampsenable)
gconf_client_set_bool (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps", FALSE, NULL);
}
+
+void
+partyline_enable_channel_list_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client; /* Suppress compile warnings */
+ cnxn_id = cnxn_id; /* Suppress compile warnings */
+
+ partyline_show_channel_list (gconf_value_get_bool (gconf_entry_get_value (entry)));
+}
+
void
partyline_enable_timestamps_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry);
+ guint cnxn_id,
+ GConfEntry *entry);
+
+void
+partyline_enable_channel_list_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
#define GTETRINET_THEMES GTETRINET_DATA"/themes"
#define DEFAULTTHEME GTETRINET_THEMES"/default/"
GTK_TOGGLE_BUTTON (widget)->active, NULL);
}
+void prefdialog_channeltoggle (GtkWidget *widget)
+{
+ gconf_client_set_bool (gconf_client, "/apps/gtetrinet/partyline/enable_channel_list",
+ GTK_TOGGLE_BUTTON (widget)->active, NULL);
+}
+
void prefdialog_miditoggle (GtkWidget *widget)
{
if (GTK_TOGGLE_BUTTON(widget)->active) {
{
GtkWidget *label, *table, *frame, *button, *button1, *widget, *table1, *divider, *notebook;
GtkWidget *themelist_scroll, *key_scroll;
+ GtkWidget *channel_list_check;
GtkListStore *theme_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
GtkListStore *keys_store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
/* partyline */
timestampcheck = gtk_check_button_new_with_label (_("Enable Timestamps"));
gtk_widget_show(timestampcheck);
+ channel_list_check = gtk_check_button_new_with_label (_("Enable Channel List"));
+ gtk_widget_show (channel_list_check);
- frame = gtk_hbox_new (FALSE, 0);
+ frame = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX(frame), timestampcheck, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(frame), channel_list_check, FALSE, FALSE, 0);
gtk_widget_show (frame);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(timestampcheck),
timestampsenable);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (channel_list_check),
+ list_enabled);
g_signal_connect (G_OBJECT(timestampcheck), "toggled",
G_CALLBACK(prefdialog_timestampstoggle), NULL);
+ g_signal_connect (G_OBJECT (channel_list_check), "toggled",
+ G_CALLBACK (prefdialog_channeltoggle), NULL);
table = gtk_table_new (3, 1, FALSE);
gtk_container_set_border_width (GTK_CONTAINER(table), GNOME_PAD);
keyclist = GTK_WIDGET (gtk_tree_view_new_with_model (GTK_TREE_MODEL(keys_store)));
key_scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (key_scroll),
- GTK_POLICY_NEVER,
+ GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER(key_scroll), keyclist);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (keyclist), -1, _("Action"), renderer,
gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps",
(GConfClientNotifyFunc) partyline_enable_timestamps_changed,
NULL, NULL, NULL);
+
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_channel_list",
+ (GConfClientNotifyFunc) partyline_enable_channel_list_changed,
+ NULL, NULL, NULL);
/* load settings */
config_loadconfig ();
gtk_widget_show (notebook);
g_object_set (G_OBJECT (notebook), "can-focus", FALSE, NULL);
+
+ partyline_show_channel_list (list_enabled);
gtk_widget_show (app);
// gtk_widget_set_size_request (partywidget, 480, 360);
#include "commands.h"
int timestampsenable;
+gboolean list_enabled;
/* widgets that we have to do stuff with */
static GtkWidget *playerlist, *textbox, *entrybox,
*namelabel, *teamlabel, *infolabel, *textboxscroll,
*playerlist_scroll, *playerlist_vpaned, *channel_box,
- *playerlist_channel_scroll, *label;
+ *playerlist_channel_scroll, *label, *channel_list;
/* some more widgets for layout */
static GtkWidget *table, *leftbox, *rightbox;
leftbox = gtk_vbox_new (FALSE, 4);
/* chat thingy */
/* channel list */
- box1 = gtk_vbox_new (FALSE, 0);
+ channel_list = gtk_vbox_new (FALSE, 0);
channel_box = GTK_WIDGET (gtk_tree_view_new_with_model (GTK_TREE_MODEL (playerlist_channels)));
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (channel_box), -1, _("Name"), renderer,
"text", 1, NULL);
gtk_container_add (GTK_CONTAINER(playerlist_channel_scroll), channel_box);
gtk_widget_set_size_request (playerlist_channel_scroll, -1, 100);
label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), "<b>Channel List</b>");
- gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box1), playerlist_channel_scroll, TRUE, TRUE, 0);
+ gtk_label_set_markup (GTK_LABEL (label), _("<b>Channel List</b>"));
+ gtk_box_pack_start (GTK_BOX (channel_list), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (channel_list), playerlist_channel_scroll, TRUE, TRUE, 0);
/* textbox with scrollbars */
box2 = gtk_vbox_new (FALSE, 0);
/* vpaned widget */
playerlist_vpaned = gtk_vpaned_new ();
- gtk_paned_add1 (GTK_PANED (playerlist_vpaned), box1);
+ gtk_paned_add1 (GTK_PANED (playerlist_vpaned), channel_list);
gtk_paned_add2 (GTK_PANED (playerlist_vpaned), box2);
gtk_box_pack_start (GTK_BOX(leftbox), playerlist_vpaned, TRUE, TRUE, 0);
while ((g_scanner_get_next_token (scan) != G_TOKEN_IDENTIFIER) && !g_scanner_eof (scan));
players = g_strdup (scan->value.v_identifier);
- if (strncmp (players, "FULL", 4))
+ if (players != NULL)
{
- while ((g_scanner_get_next_token (scan) != G_TOKEN_INT) && !g_scanner_eof (scan));
- actual = scan->value.v_int;
-
- while ((g_scanner_get_next_token (scan) != G_TOKEN_INT) && !g_scanner_eof (scan));
- max = scan->value.v_int;
-
- g_snprintf (final, 1024, "%d/%d %s", actual, max, players);
+ if (strncmp (players, "FULL", 4))
+ {
+ while ((g_scanner_get_next_token (scan) != G_TOKEN_INT) && !g_scanner_eof (scan));
+ actual = scan->value.v_int;
+
+ while ((g_scanner_get_next_token (scan) != G_TOKEN_INT) && !g_scanner_eof (scan));
+ max = scan->value.v_int;
+
+ g_snprintf (final, 1024, "%d/%d %s", actual, max, players);
+ }
+ else
+ g_snprintf (final, 1024, "%s", players);
}
else
- g_snprintf (final, 1024, "6/6 %s", players);
+ g_snprintf (final, 1024, "UNK");
g_scanner_get_next_token (scan); /* dump the ')' */
gchar cad[1024];
/* if there is another update in progress, just go away silently */
- if (list_issued == 0)
+ if (list_enabled && (list_issued == 0))
{
list_issued++;
gtk_list_store_clear (work_model);
g_free (final);
}
+
+void partyline_show_channel_list (gboolean show)
+{
+ /*
+ * If this function is called with TRUE, it will show the channel list, otherwise
+ * it'll hide it.
+ */
+ list_enabled = show;
+ if (list_enabled)
+ gtk_widget_show (channel_list);
+ else
+ gtk_widget_hide (channel_list);
+}
#include <gtk/gtk.h>
extern int timestampsenable;
+extern gboolean list_enabled;
extern GtkWidget *partyline_page_new (void);
extern void partyline_connectstatus (int status);
extern void partyline_clear_list_channel (void);
extern void partyline_joining_channel (const gchar *channel);
extern void stop_list (void);
+extern void partyline_show_channel_list (gboolean);
else
{
gchar *line = nocolor (token);
+ gchar *aux;
if (list_issued > 0)
{
stop_list();
break;
}
+
+ if (!strncmp ("Use", line, 3))
+ break;
//if (line != NULL) g_free (line);
}
{
partyline_joining_channel (&line[16]);
}
+
+ aux = g_strconcat ("You tell ", playernames[playernum], ": --- MARK ---", NULL);
+ if (!strcmp (aux, line))
+ {
+ list_issued--;
+ if (list_issued <= 0)
+ stop_list ();
+ break;
+ }
if (tetrix) {
g_snprintf (buf, sizeof(buf), "*** %s", token);
if (list_issued <= 0)
stop_list();
}
+ else
+ plinemsg (playernames[pnum], token);
//g_free (line);
}
else