Commit a04f0bd2 authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Clear history in finger user and whois domain again.

2004-06-09  William Jon McCann  <mccann@jhu.edu>

	* src/callbacks.c (on_clear_history_activate): Clear history in
	finger user and whois domain again.

	* src/nettool.c (netinfo_toggle_state): Make notebook tab bold
	when a tool is running.  This allows the user to see that a tool
	is running when another tool page is loaded.

	* src/callbacks.c (on_whois_activate): Use netinfo_validate_domain.

	* src/nettool.[ch] (netinfo_validate_domain): New function to
	validate domain.
	(netinfo_error_message): New HIGish error dialog.
	(netinfo_validate_host): use netinfo_error_message function.
parent 10604944
2004-06-09 William Jon McCann <mccann@jhu.edu>
* src/callbacks.c (on_clear_history_activate): Clear history in
finger user and whois domain again.
* src/nettool.c (netinfo_toggle_state): Make notebook tab bold
when a tool is running. This allows the user to see that a tool
is running when another tool page is loaded.
* src/callbacks.c (on_whois_activate): Use netinfo_validate_domain.
* src/nettool.[ch] (netinfo_validate_domain): New function to
validate domain.
(netinfo_error_message): New HIGish error dialog.
(netinfo_validate_host): use netinfo_error_message function.
2004-06-09 Carlos Garca Campos <carlosgc@gnome.org> 2004-06-09 Carlos Garca Campos <carlosgc@gnome.org>
* src/callbacks.c (on_finger_activate): s/strcmp/g_strcasecmp/ * src/callbacks.c (on_finger_activate): s/strcmp/g_strcasecmp/
......
...@@ -232,7 +232,7 @@ on_whois_activate (GtkWidget * widget, gpointer data) ...@@ -232,7 +232,7 @@ on_whois_activate (GtkWidget * widget, gpointer data)
if (whois->running) { if (whois->running) {
whois_stop (whois); whois_stop (whois);
} else { } else {
if (netinfo_validate_host (whois)) { if (netinfo_validate_domain (whois)) {
entry_host = GTK_ENTRY ( entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (whois->host))); gtk_bin_get_child (GTK_BIN (whois->host)));
text = g_strdup (gtk_entry_get_text (entry_host)); text = g_strdup (gtk_entry_get_text (entry_host));
......
...@@ -165,43 +165,91 @@ netinfo_get_ip_version (Netinfo * netinfo) ...@@ -165,43 +165,91 @@ netinfo_get_ip_version (Netinfo * netinfo)
return -1; return -1;
} }
void
netinfo_error_message (Netinfo * netinfo,
const gchar * primary,
const gchar * secondary)
{
GtkWidget *dialog;
gchar *message;
g_return_if_fail (primary != NULL);
if (secondary)
message = g_strdup_printf ("<b><big>%s</big></b>\n\n%s",
primary, secondary);
else
message = g_strdup_printf ("<b><big>%s</big></b>",
primary);
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (netinfo->main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
message);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
gboolean gboolean
netinfo_validate_host (Netinfo * netinfo) netinfo_validate_host (Netinfo * netinfo)
{ {
struct hostent *hostname; struct hostent *hostname;
const gchar *host; const gchar *host;
GtkWidget *dialog; gchar *primary = NULL;
gchar *message = NULL; gchar *secondary = NULL;
host = netinfo_get_host (netinfo); host = netinfo_get_host (netinfo);
if (! strcmp (host, "")) { if (! strcmp (host, "")) {
message = g_strdup (_("Network address not specified")); primary = g_strdup (_("A network address was not specified"));
secondary = g_strdup (_("Please enter a valid network address and try again."));
} }
else { else {
hostname = gethostbyname2 (host, PF_INET6); hostname = gethostbyname2 (host, PF_INET6);
if (hostname == NULL) { if (hostname == NULL) {
hostname = gethostbyname2 (host, AF_INET); hostname = gethostbyname2 (host, AF_INET);
if (hostname == NULL) { if (hostname == NULL) {
message = g_strdup_printf primary = g_strdup_printf (_("The address '%s' cannot be found"),
(_("The host '%s' cannot be found"), host);
host); secondary = g_strdup (_("Please enter a valid network address and try again."));
} }
} }
} }
if (message != NULL) { if (primary) {
dialog = gtk_message_dialog_new netinfo_error_message (netinfo, primary, secondary);
(GTK_WINDOW (netinfo->main_window), g_free (primary);
GTK_DIALOG_DESTROY_WITH_PARENT, if (secondary)
GTK_MESSAGE_ERROR, g_free (secondary);
GTK_BUTTONS_CLOSE, return FALSE;
"<span weight=\"bold\" size=\"larger\">%s</span>", }
message);
gtk_label_set_use_markup return TRUE;
(GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), TRUE); }
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog); gboolean
g_free (message); netinfo_validate_domain (Netinfo * netinfo)
{
gchar *domain;
gchar *primary = NULL;
gchar *secondary = NULL;
domain = g_strdup (netinfo_get_host (netinfo));
g_strstrip (domain);
if (! strcmp (domain, "")) {
primary = g_strdup (_("A domain address was not specified"));
secondary = g_strdup (_("Please enter a valid domain address and try again."));
}
g_free (domain);
if (primary) {
netinfo_error_message (netinfo, primary, secondary);
g_free (primary);
if (secondary)
g_free (secondary);
return FALSE; return FALSE;
} }
...@@ -358,7 +406,8 @@ netinfo_toggle_state (Netinfo * netinfo, gboolean state, ...@@ -358,7 +406,8 @@ netinfo_toggle_state (Netinfo * netinfo, gboolean state,
gpointer user_data) gpointer user_data)
{ {
GdkCursor *cursor; GdkCursor *cursor;
PangoFontDescription *font_desc;
g_assert (netinfo != NULL); g_assert (netinfo != NULL);
g_return_if_fail (netinfo != NULL); g_return_if_fail (netinfo != NULL);
...@@ -367,11 +416,19 @@ netinfo_toggle_state (Netinfo * netinfo, gboolean state, ...@@ -367,11 +416,19 @@ netinfo_toggle_state (Netinfo * netinfo, gboolean state,
state); state);
} }
font_desc = pango_font_description_new ();
if (state) { if (state) {
pango_font_description_set_weight (font_desc,
PANGO_WEIGHT_NORMAL);
netinfo_progress_indicator_stop (netinfo); netinfo_progress_indicator_stop (netinfo);
gdk_window_set_cursor ((netinfo->output)->window, NULL); gdk_window_set_cursor ((netinfo->output)->window, NULL);
netinfo->child_pid = 0; netinfo->child_pid = 0;
} else { } else {
pango_font_description_set_weight (font_desc,
PANGO_WEIGHT_BOLD);
netinfo_progress_indicator_start (netinfo); netinfo_progress_indicator_start (netinfo);
cursor = gdk_cursor_new (GDK_WATCH); cursor = gdk_cursor_new (GDK_WATCH);
if (!GTK_WIDGET_REALIZED (netinfo->output)) if (!GTK_WIDGET_REALIZED (netinfo->output))
...@@ -379,7 +436,10 @@ netinfo_toggle_state (Netinfo * netinfo, gboolean state, ...@@ -379,7 +436,10 @@ netinfo_toggle_state (Netinfo * netinfo, gboolean state,
gdk_window_set_cursor ((netinfo->output)->window, cursor); gdk_window_set_cursor ((netinfo->output)->window, cursor);
gdk_cursor_destroy (cursor); gdk_cursor_destroy (cursor);
} }
gtk_widget_modify_font (netinfo->page_label, font_desc);
pango_font_description_free (font_desc);
netinfo->running = !state; netinfo->running = !state;
netinfo_toggle_button (netinfo); netinfo_toggle_button (netinfo);
......
...@@ -132,7 +132,11 @@ void netinfo_set_host (Netinfo * netinfo, const gchar *host); ...@@ -132,7 +132,11 @@ void netinfo_set_host (Netinfo * netinfo, const gchar *host);
gboolean netinfo_is_ipv6_enable (void); gboolean netinfo_is_ipv6_enable (void);
void netinfo_set_user (Netinfo * netinfo, const gchar *user); void netinfo_set_user (Netinfo * netinfo, const gchar *user);
gint netinfo_get_ip_version (Netinfo * netinfo); gint netinfo_get_ip_version (Netinfo * netinfo);
void netinfo_error_message (Netinfo * netinfo,
const gchar * primary,
const gchar * secondary);
gboolean netinfo_validate_host (Netinfo * netinfo); gboolean netinfo_validate_host (Netinfo * netinfo);
gboolean netinfo_validate_domain (Netinfo * netinfo);
void netinfo_toggle_button (Netinfo * netinfo); void netinfo_toggle_button (Netinfo * netinfo);
void netinfo_toggle_state (Netinfo * netinfo, gboolean state, void netinfo_toggle_state (Netinfo * netinfo, gboolean state,
gpointer user_data); gpointer user_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment