diff options
Diffstat (limited to 'src/fe-gtk/servlistgui.c')
-rw-r--r-- | src/fe-gtk/servlistgui.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c index f43a225a..f7909f72 100644 --- a/src/fe-gtk/servlistgui.c +++ b/src/fe-gtk/servlistgui.c @@ -90,7 +90,7 @@ static GtkWidget *servlist_open_edit (GtkWidget *parent, ircnet *net); static const char *pages[]= { IRC_DEFAULT_CHARSET, - "IRC (Latin/Unicode Hybrid)", + "CP1252 (Windows-1252)", "ISO-8859-15 (Western Europe)", "ISO-8859-2 (Central Europe)", "ISO-8859-7 (Greek)", @@ -497,7 +497,7 @@ servlist_addnet_cb (GtkWidget *item, GtkTreeView *treeview) ircnet *net; net = servlist_net_add (_("New Network"), "", TRUE); - net->encoding = strdup (IRC_DEFAULT_CHARSET); + net->encoding = g_strdup (IRC_DEFAULT_CHARSET); servlist_server_add (net, "newserver/6667"); store = (GtkListStore *)gtk_tree_view_get_model (treeview); @@ -668,13 +668,12 @@ servlist_favor (GtkWidget *button, gpointer none) static void servlist_update_from_entry (char **str, GtkWidget *entry) { - if (*str) - free (*str); + g_free (*str); if (gtk_entry_get_text (GTK_ENTRY (entry))[0] == 0) *str = NULL; else - *str = strdup (gtk_entry_get_text (GTK_ENTRY (entry))); + *str = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry))); } static void @@ -960,10 +959,10 @@ servlist_savegui (void) if (!rfc_casecmp (nick1, nick2)) return 2; - strcpy (prefs.hex_irc_nick1, nick1); - strcpy (prefs.hex_irc_nick2, nick2); - strcpy (prefs.hex_irc_nick3, gtk_entry_get_text (GTK_ENTRY (entry_nick3))); - strcpy (prefs.hex_irc_user_name, gtk_entry_get_text (GTK_ENTRY (entry_guser))); + safe_strcpy (prefs.hex_irc_nick1, nick1, sizeof(prefs.hex_irc_nick1)); + safe_strcpy (prefs.hex_irc_nick2, nick2, sizeof(prefs.hex_irc_nick2)); + safe_strcpy (prefs.hex_irc_nick3, gtk_entry_get_text (GTK_ENTRY (entry_nick3)), sizeof(prefs.hex_irc_nick3)); + safe_strcpy (prefs.hex_irc_user_name, gtk_entry_get_text (GTK_ENTRY (entry_guser)), sizeof(prefs.hex_irc_user_name)); sp = strchr (prefs.hex_irc_user_name, ' '); if (sp) sp[0] = 0; /* spaces will break the login */ @@ -1203,9 +1202,9 @@ servlist_celledit_cb (GtkCellRendererText *cell, gchar *arg1, gchar *arg2, } netname = net->name; - net->name = strdup (arg2); + net->name = g_strdup (arg2); gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, net->name, -1); - free (netname); + g_free (netname); } gtk_tree_path_free (path); @@ -1311,7 +1310,7 @@ servlist_sanitize_hostname (char *host) { char *ret, *c, *e; - ret = strdup (host); + ret = g_strdup (host); c = strchr (ret, ':'); e = strrchr (ret, ':'); @@ -1371,7 +1370,7 @@ servlist_editserver_cb (GtkCellRendererText *cell, gchar *name, gchar *newval, g servname = serv->hostname; serv->hostname = servlist_sanitize_hostname (newval); gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, serv->hostname, -1); - free (servname); + g_free (servname); } } @@ -1409,7 +1408,7 @@ servlist_editcommand_cb (GtkCellRendererText *cell, gchar *name, gchar *newval, cmd = entry->command; entry->command = servlist_sanitize_command (newval); gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, entry->command, -1); - free (cmd); + g_free (cmd); } } @@ -1508,9 +1507,8 @@ servlist_combo_cb (GtkEntry *entry, gpointer userdata) if (!selected_net) return; - if (selected_net->encoding) - free (selected_net->encoding); - selected_net->encoding = strdup (gtk_entry_get_text (entry)); + g_free (selected_net->encoding); + selected_net->encoding = g_strdup (gtk_entry_get_text (entry)); } /* Fills up the network's authentication type so that it's guaranteed to be either NULL or a valid value. */ @@ -1594,7 +1592,6 @@ servlist_create_charsetcombo (void) int i; cb = gtk_combo_box_text_new_with_entry (); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "System default"); i = 0; while (pages[i]) { @@ -1602,7 +1599,7 @@ servlist_create_charsetcombo (void) i++; } - gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN(cb))), selected_net->encoding ? selected_net->encoding : "System default"); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN(cb))), selected_net->encoding ? selected_net->encoding : pages[0]); g_signal_connect (G_OBJECT (gtk_bin_get_child (GTK_BIN (cb))), "changed", G_CALLBACK (servlist_combo_cb), NULL); @@ -1660,7 +1657,7 @@ bold_label (char *text) char buf[128]; GtkWidget *label; - snprintf (buf, sizeof (buf), "<b>%s</b>", text); + g_snprintf (buf, sizeof (buf), "<b>%s</b>", text); label = gtk_label_new (buf); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); @@ -1702,7 +1699,7 @@ servlist_open_edit (GtkWidget *parent, ircnet *net) editwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (editwindow), 4); - snprintf (buf, sizeof (buf), _(DISPLAY_NAME": Edit %s"), net->name); + g_snprintf (buf, sizeof (buf), _(DISPLAY_NAME": Edit %s"), net->name); gtk_window_set_title (GTK_WINDOW (editwindow), buf); gtk_window_set_default_size (GTK_WINDOW (editwindow), netedit_win_width, netedit_win_height); gtk_window_set_transient_for (GTK_WINDOW (editwindow), GTK_WINDOW (parent)); |