Commit cdd5364e authored by Carlos García Campos's avatar Carlos García Campos Committed by Carlos Garcia Campos

checks if there is no network devices enabled s/GtkCombo/GtkComboBox and

2004-06-08  Carlos García Campos <carlosgc@gnome.org>
	* src/info.c (load_iface): checks if there is no network devices
	enabled
	* src/gnome-nettool.glade: s/GtkCombo/GtkComboBox and added a treeview
	to show the IP information when there are IPv6 ips.
	* src/info.c (set_nic, load_iface, ip6_masklen,
	ip6_construct_address, get_nic_information, get_interfaces),
	src/info.h, src/main.c (list_ip_addr_add_columns,
	load_info_widgets_from_xml), src/nettol.h: IPv6 support.
	When there are IPv6 addresses, a treeview is shown with
	the information about all of the ip addresses, but if there aren't IPv6
	addresses, the IPv4 information is shown in text labels.
	* src/info.c (load_iface, nic_update_stats, nic_changed), src/info.h,
	src/main.c (load_info_widgets_from_xml): Ported to GTK+ 2.4, uses
	GtkComboBox instead of GtkCombo
	* pixmaps, pixmaps/Makefile.am, configure.in: added a pixmap directory and
	moved gnome-nettol.png from src to pixmaps. Added all of the pixmaps
	needed to the new pixmap directory.
	* configure.in: checks the libraries version because now
	nettool depends on gtk+ >= 2.4
	* src/*.c, : ported to Gtk+ 2.4, uses GtkComboBox and GtkEntryCompletion
	instead of GnomeEntry (deprecated)
	* src/gnome-nettool.glade: some gui changes that make it a bit more
	HIG-Compliant
	* src/callbacks.c (on_about_activate), src/main.c (main): uses
	PIXMAPS_DIR instead of GNOME_ICONDIR and gnome-nettool.png instead of
	gnome-netinfo.png
	* src/gn-combo-history.[ch]: files added. It is an object to manage
	the history of new combo boxes
	* src/main.c (load_*_widgets_from_xml), src/callbacks
	(on_*_activate): added support for history in
	new combo boxes
	* src/callbacks.c, src/info.c, src/ping.c, src/traceroute.c,
	src/lookup.c, src/util-mii.c: added #include <glib/gprintf.h> to avoid
	compile warnings about g_sprintf ()
parent 4609126f
2004-06-08 Carlos Garca Campos <carlosgc@gnome.org>
* src/info.c (load_iface): checks if there is no network devices
enabled
* src/gnome-nettool.glade: s/GtkCombo/GtkComboBox and added a treeview
to show the IP information when there are IPv6 ips.
* src/info.c (set_nic, load_iface, ip6_masklen,
ip6_construct_address, get_nic_information, get_interfaces),
src/info.h, src/main.c (list_ip_addr_add_columns,
load_info_widgets_from_xml), src/nettol.h: IPv6 support.
When there are IPv6 addresses, a treeview is shown with
the information about all of the ip addresses, but if there aren't IPv6
addresses, the IPv4 information is shown in text labels.
* src/info.c (load_iface, nic_update_stats, nic_changed), src/info.h,
src/main.c (load_info_widgets_from_xml): Ported to GTK+ 2.4, uses
GtkComboBox instead of GtkCombo
* pixmaps, pixmaps/Makefile.am, configure.in: added a pixmap directory and
moved gnome-nettol.png from src to pixmaps. Added all of the pixmaps
needed to the new pixmap directory.
* configure.in: checks the libraries version because now
nettool depends on gtk+ >= 2.4
* src/*.c, : ported to Gtk+ 2.4, uses GtkComboBox and GtkEntryCompletion
instead of GnomeEntry (deprecated)
* src/gnome-nettool.glade: some gui changes that make it a bit more
HIG-Compliant
* src/callbacks.c (on_about_activate), src/main.c (main): uses
PIXMAPS_DIR instead of GNOME_ICONDIR and gnome-nettool.png instead of
gnome-netinfo.png
* src/gn-combo-history.[ch]: files added. It is an object to manage
the history of new combo boxes
* src/main.c (load_*_widgets_from_xml), src/callbacks
(on_*_activate): added support for history in
new combo boxes
* src/callbacks.c, src/info.c, src/ping.c, src/traceroute.c,
src/lookup.c, src/util-mii.c: added #include <glib/gprintf.h> to avoid
compile warnings about g_sprintf ()
2004-06-06 William Jon McCann <mccann@jhu.edu>
* src/netstat.c (netstat_protocol_tree_insert)
......
SUBDIRS = src po
SUBDIRS = pixmaps src po
EXTRA_DIST = \
intltool-extract.in \
......
......@@ -20,7 +20,22 @@ AM_PROG_LIBTOOL
GNOME_COMPILE_WARNINGS(yes)
CFLAGS="$CFLAGS $WARN_CFLAGS"
PKG_CHECK_MODULES(NETTOOL, libgnomeui-2.0 libgnome-2.0 gtk+-2.0 glib-2.0 libglade-2.0 gconf-2.0)
dnl ******************************************
dnl ** pkg-config dependacy checks **
dnl ******************************************
LIBGNOMEUI_REQUIRED=2.0.0
LIBGNOME_REQUIRED=2.0.0
GTK_REQUIRED=2.4.0
LIBGLADE_REQUIRED=2.0.0
GCONF_REQUIRED=1.1.11
PKG_CHECK_MODULES(NETTOOL,
libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED
libgnome-2.0 >= $LIBGNOME_REQUIRED
gtk+-2.0 >= $GTK_REQUIRED
libglade-2.0 >= $LIBGLADE_REQUIRED
gconf-2.0 >= $GCONF_REQUIRED)
AC_SUBST(NETTOOL_CFLAGS)
AC_SUBST(NETTOOL_LIBS)
......@@ -53,11 +68,21 @@ AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${ac_default_prefix}/share/pixmaps", [Pixmap directory])
AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${ac_default_prefix}/share/pixmaps", [Gnome pixmap directory])
else
AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [Pixmap directory])
AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [Gnome pixmap directory])
fi
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps", [pixmaps directory])
pixmapsdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps"
else
AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps", [pixmaps directory])
pixmapsdir="${prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps"
fi
AC_SUBST(pixmapsdir)
dnl
dnl Debugging flags
dnl
......@@ -77,4 +102,5 @@ fi
AC_OUTPUT([
Makefile
po/Makefile.in
pixmaps/Makefile
src/Makefile])
/* XPM */
static char * 16_ethernet_xpm[] = {
"16 16 111 2",
" c None",
". c #030303",
"+ c #D6DDD0",
"@ c #A5B393",
"# c #95B882",
"$ c #B8CAB0",
"% c #A9BEA2",
"& c #809A75",
"* c #93AB88",
"= c #ACBEA4",
"- c #3C5234",
"; c #3F5A32",
"> c #738B57",
", c #4B673F",
"' c #546B47",
") c #3B542F",
"! c #FFFFFF",
"~ c #717171",
"{ c #DADBDA",
"] c #B9B691",
"^ c #55643F",
"/ c #A0A591",
"( c #606950",
"_ c #A0A593",
": c #2C3A21",
"< c #A9AAA9",
"[ c #B1B1B1",
"} c #A4A4A4",
"| c #A9A9A9",
"1 c #6D6B59",
"2 c #3E4832",
"3 c #8F9391",
"4 c #4F4436",
"5 c #8F9393",
"6 c #1E2416",
"7 c #B0BFA7",
"8 c #8A866E",
"9 c #000000",
"0 c #848069",
"a c #B9B086",
"b c #474736",
"c c #343E25",
"d c #6A706E",
"e c #443B33",
"f c #606769",
"g c #1D2416",
"h c #FAFAFA",
"i c #BEBEBE",
"j c #475236",
"k c #383E2B",
"l c #313726",
"m c #313425",
"n c #363A28",
"o c #1F2317",
"p c #3A4225",
"q c #3C502C",
"r c #334425",
"s c #364525",
"t c #27341C",
"u c #4D6538",
"v c #556437",
"w c #48552F",
"x c #4A552F",
"y c #4D5932",
"z c #3F4D29",
"A c #4D6433",
"B c #658042",
"C c #658248",
"D c #8F976F",
"E c #57604B",
"F c #848257",
"G c #939165",
"H c #B1B091",
"I c #9E9E77",
"J c #6B6942",
"K c #45592F",
"L c #4D6B36",
"M c #658442",
"N c #62824B",
"O c #80887A",
"P c #545454",
"Q c #343A21",
"R c #2B311C",
"S c #474D2B",
"T c #2C321D",
"U c #2D311C",
"V c #556736",
"W c #778F4A",
"X c #648241",
"Y c #648047",
"Z c #485441",
"` c #262925",
" . c #547E47",
".. c #A0A95E",
"+. c #D1CC84",
"@. c #8B9752",
"#. c #BBBB75",
"$. c #989E55",
"%. c #CAC77F",
"&. c #91A054",
"*. c #CFCB83",
"=. c #27361C",
"-. c #10140D",
";. c #0B0D09",
">. c #B8B078",
",. c #DDD58F",
"'. c #A5A161",
"). c #D4CD84",
"!. c #ADA772",
"~. c #D7D088",
"{. c #DAD38B",
" . ",
" . ",
" . ",
" . . . . . . . . . . . . . ",
". + @ @ @ @ @ @ @ @ @ @ @ . ",
". # $ % & * = - ; > , ' ) . ",
". # ! ~ ! ~ { ] ^ / ( _ : . ",
". ! < [ } | ~ 1 2 3 4 5 6 . . . ",
". 7 8 9 0 9 a b c d e f g . h i ",
". # j k l m n o p q r s t . 9 . ",
". # u v w x y z A B C D E . ",
". # F G H I J K L M N O P . ",
". # Q R S T U V W X Y Z ` . ",
". ...+.@.#.$.%.&.*.=.-.;.. ",
" . >.,.'.).!.~.'.{.. . ",
" . . . . . . . . . . . "};
/* XPM */
static char * 16_loopback_xpm[] = {
"16 16 8 1",
" c None",
". c #1E261B",
"+ c #83A67F",
"@ c #1C241A",
"# c #222B1F",
"$ c #303C2C",
"% c #000000",
"& c #181F16",
" ",
" ",
" ",
" . ",
" +@#@$ ",
" +$ .%% ",
" # %+ ",
" @ ",
" @ ",
" +% . ",
" %%$ $+ ",
" $&$$+ ",
" $ ",
" ",
" ",
" "};
/* XPM */
static char * 16_plip_xpm[] = {
"16 16 27 1",
" c None",
". c #000000",
"+ c #F0F0F0",
"@ c #FFFFFF",
"# c #EEEEEE",
"$ c #EBEBEB",
"% c #E4E4E4",
"& c #C5C5C5",
"* c #C9C9C9",
"= c #D2D2D2",
"- c #BABABA",
"; c #A1A1A1",
"> c #F7F7F7",
", c #EDEDED",
"' c #B8B8B8",
") c #8C8C8C",
"! c #989898",
"~ c #ADADAD",
"{ c #7B7B7B",
"] c #BDBDBD",
"^ c #D0D0D0",
"/ c #CECECE",
"( c #DBDBDB",
"_ c #DFDFDF",
": c #464646",
"< c #DDDDDD",
"[ c #7E7E7E",
" ",
" ........... ",
" .+@#$%%%%&. ",
" . .*@=*----;. .",
" ............. ",
" .>,,,,,,,,,'. ",
" .,)!!!!!!!~{. ",
" .,;-------*{. ",
" .,]^^^^^^/({. ",
" ._{{{{{{{{{:. ",
" ...{{{{{... ",
" .<-[. ",
" ..-.. ",
" .-. ",
" .-. ",
" .-. "};
/* XPM */
static char * 16_ppp_xpm[] = {
"16 16 87 1",
" c None",
". c #000000",
"+ c #FC6666",
"@ c #FB4646",
"# c #F95F5F",
"$ c #F35353",
"% c #EC4141",
"& c #FB1515",
"* c #FE9898",
"= c #F31D1D",
"- c #F63F3F",
"; c #FA3535",
"> c #F23737",
", c #E82F2F",
"' c #FE8686",
") c #FEE0E0",
"! c #FCC1C1",
"~ c #F5B8B8",
"{ c #FB7373",
"] c #F41010",
"^ c #FC7373",
"/ c #E72B2B",
"( c #9F908F",
"_ c #FFFCFC",
": c #969494",
"< c #C9C7C7",
"[ c #FED4D4",
"} c #EC0909",
"| c #F83737",
"1 c #FD9E9E",
"2 c #FB5353",
"3 c #7B0202",
"4 c #FEF5F4",
"5 c #9E9D9D",
"6 c #FEFEFE",
"7 c #959393",
"8 c #FEDBDB",
"9 c #DF0303",
"0 c #FDBABA",
"a c #FC4646",
"b c #C30404",
"c c #AB8787",
"d c #C9C1C1",
"e c #FEFAF9",
"f c #B5A7A6",
"g c #B2B2B2",
"h c #FD9B98",
"i c #C50000",
"j c #FB9B9B",
"k c #FB7070",
"l c #F71818",
"m c #CB1111",
"n c #FDADAD",
"o c #FED4D3",
"p c #BDB7B7",
"q c #C55151",
"r c #F93737",
"s c #A40000",
"t c #B80000",
"u c #C70303",
"v c #A10101",
"w c #EBEAEA",
"x c #D16060",
"y c #FB8A8A",
"z c #FDAAAA",
"A c #E74646",
"B c #BA9191",
"C c #EE0B0B",
"D c #A70000",
"E c #7B0000",
"F c #530000",
"G c #460000",
"H c #F6F6F6",
"I c #B14742",
"J c #F97373",
"K c #F76C6C",
"L c #FDA4A4",
"M c #D30303",
"N c #590000",
"O c #7F0404",
"P c #F8F8F8",
"Q c #F96966",
"R c #AD0202",
"S c #EFEFEF",
"T c #D4D4D4",
"U c #E0E0E0",
"V c #ECECEC",
" ",
" ",
" ..... ",
" .+@#$%.. ",
" .&*=-;>,. ",
" .')!~{]^/. ",
" .(_:<[}|123. ",
" .45678980ab. ",
" .cdefghijklm. ",
" .nopqerstuv.w. ",
" .xyzABCDEFG..H.",
" .IJKLMNGO. .P.",
" ..QJRG..S.. .",
" .... .TUV.",
" ... ",
" "};
pixmaps_DATA = 16_ethernet.xpm \
16_loopback.xpm \
16_plip.xpm \
16_ppp.xpm \
gnome-nettool.png \
irda-16.png \
network.png \
wavelan-16.png
EXTRA_DIST = $(pixmaps_DATA)
......@@ -14,6 +14,7 @@ bin_PROGRAMS = gnome-nettool
gnome_nettool_SOURCES = \
callbacks.c callbacks.h \
nettool.c nettool.h \
gn-combo-history.c gn-combo-history.h \
ping.c ping.h \
traceroute.c traceroute.h \
netstat.c netstat.h \
......@@ -29,10 +30,7 @@ gnome_nettool_SOURCES = \
gnome_nettool_LDADD = @NETTOOL_LIBS@
pixmapdir = $(datadir)/pixmaps
pixmap_DATA = gnome-nettool.png
EXTRA_DIST = \
$(pixmap_DATA) \
gnome-nettool.desktop.in \
$(dialog_DATA)
......
......@@ -23,6 +23,7 @@
#endif
#include <gnome.h>
#include <glib/gprintf.h>
#include <sys/wait.h>
#include <unistd.h>
......@@ -38,19 +39,32 @@
#include "lookup.h"
#include "finger.h"
#include "whois.h"
#include "gn-combo-history.h"
/* Ping callbacks */
void
on_ping_activate (GtkWidget * widget, gpointer data)
{
Netinfo *pinger = data;
GtkEntry *entry_host;
gchar *text;
g_return_if_fail (pinger != NULL);
if (pinger->running) {
ping_stop (pinger);
} else {
ping_do (pinger);
if (netinfo_validate_host (pinger)) {
entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (pinger->host)));
text = g_strdup (gtk_entry_get_text (entry_host));
gn_combo_history_add (pinger->history, text);
g_free (text);
ping_do (pinger);
}
}
}
......@@ -59,13 +73,41 @@ void
on_traceroute_activate (GtkWidget * widget, gpointer data)
{
Netinfo *tracer = data;
GtkEntry *entry_host;
gchar *text;
g_return_if_fail (tracer != NULL);
/* entry_host = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (tracer->host)));
completion = gtk_entry_get_completion (entry_host);
model = gtk_entry_completion_get_model (completion);
text = g_strdup (gtk_entry_get_text (entry_host));
if (! nettool_item_is_in_model (model, text)) {
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, text,
-1);
}
g_free (text);*/
if (tracer->running) {
traceroute_stop (tracer);
} else {
traceroute_do (tracer);
if (netinfo_validate_host (tracer)) {
entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (tracer->host)));
text = g_strdup (gtk_entry_get_text (entry_host));
gn_combo_history_add (tracer->history, text);
g_free (text);
traceroute_do (tracer);
}
}
}
......@@ -85,19 +127,21 @@ on_netstat_activate (GtkWidget * widget, gpointer data)
/* Info callbacks */
#ifdef IFCONFIG_PROGRAM
void
/*void
on_info_nic_changed (GtkEntry * entry, gpointer info)
{
const gchar *nic;
gchar *nic;
g_return_if_fail (info != NULL);
nic = gtk_entry_get_text (entry);
nic = g_strdup (gtk_entry_get_text (entry));
if (strlen (nic) > 0) {
info_do (nic, (Netinfo *) & info);
}
}
g_free (nic);
}*/
#endif
/* Scan callbacks */
......@@ -105,13 +149,41 @@ void
on_scan_activate (GtkWidget * widget, gpointer data)
{
Netinfo *scan = data;
GtkEntry *entry_host;
gchar *text;
g_return_if_fail (scan != NULL);
/*entry_host = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (scan->host)));
completion = gtk_entry_get_completion (entry_host);
model = gtk_entry_completion_get_model (completion);
text = g_strdup (gtk_entry_get_text (entry_host));
if (! nettool_item_is_in_model (model, text)) {
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, text,
-1);
}
g_free (text);*/
if (scan->running) {
scan_stop (scan);
} else {
scan_do (scan);
if (netinfo_validate_host (scan)) {
entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (scan->host)));
text = g_strdup (gtk_entry_get_text (entry_host));
gn_combo_history_add (scan->history, text);
g_free (text);
scan_do (scan);
}
}
}
......@@ -120,13 +192,41 @@ void
on_lookup_activate (GtkWidget * widget, gpointer data)
{
Netinfo *lookup = data;
GtkEntry *entry_host;
gchar *text;
g_return_if_fail (lookup != NULL);
/* entry_host = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (lookup->host)));
completion = gtk_entry_get_completion (entry_host);
model = gtk_entry_completion_get_model (completion);
text = g_strdup (gtk_entry_get_text (entry_host));
if (! nettool_item_is_in_model (model, text)) {
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, text,
-1);
}
g_free (text);*/
if (lookup->running) {
lookup_stop (lookup);
} else {
lookup_do (lookup);
if (netinfo_validate_host (lookup)) {
entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (lookup->host)));
text = g_strdup (gtk_entry_get_text (entry_host));
gn_combo_history_add (lookup->history, text);
g_free (text);
lookup_do (lookup);
}
}
}
......@@ -135,13 +235,65 @@ void
on_finger_activate (GtkWidget * widget, gpointer data)
{
Netinfo *finger = data;
GtkEntry *entry_host;
gchar *text;
g_return_if_fail (finger != NULL);
/*entry_host = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (finger->user)));
completion = gtk_entry_get_completion (entry_host);
model = gtk_entry_completion_get_model (completion);
text = g_strdup (gtk_entry_get_text (entry_host));
if (! nettool_item_is_in_model (model, text)) {
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, text,
-1);
}
g_free (text);
entry_host = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (finger->host)));
completion = gtk_entry_get_completion (entry_host);
model = gtk_entry_completion_get_model (completion);
text = g_strdup (gtk_entry_get_text (entry_host));
if (! nettool_item_is_in_model (model, text)) {
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, text,
-1);
}
g_free (text);*/
if (finger->running) {
finger_stop (finger);
} else {
finger_do (finger);
if (netinfo_validate_host (finger)) {
entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (finger->host)));
text = g_strdup (gtk_entry_get_text (entry_host));
gn_combo_history_add (finger->history, text);
g_free (text);
entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (finger->user)));
text = g_strdup (gtk_entry_get_text (entry_host));
gn_combo_history_add (finger->history_user, text);
g_free (text);
finger_do (finger);
}
}
}
......@@ -150,13 +302,41 @@ void
on_whois_activate (GtkWidget * widget, gpointer data)
{
Netinfo *whois = data;
GtkEntry *entry_host;
gchar *text;
g_return_if_fail (whois != NULL);
/* entry_host = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (whois->host)));
completion = gtk_entry_get_completion (entry_host);
model = gtk_entry_completion_get_model (completion);
text = g_strdup (gtk_entry_get_text (entry_host));
if (! nettool_item_is_in_model (model, text)) {
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, text,
-1);
}
g_free (text);*/
if (whois->running) {
whois_stop (whois);
} else {
whois_do (whois);
if (netinfo_validate_host (whois)) {
entry_host = GTK_ENTRY (
gtk_bin_get_child (GTK_BIN (whois->host)));
text = g_strdup (gtk_entry_get_text (entry_host));
gn_combo_history_add (whois->history, text);
g_free (text);
whois_do (whois);
}
}
}
......@@ -178,7 +358,7 @@ gn_quit_app (GtkWidget * widget, gpointer data)
}
void
on_about_activate (GtkWidget * parent, gpointer data)
on_about_activate (GtkWidget *menu_item, gpointer data)
{
static GtkWidget *about_box = NULL;
GdkPixbuf *pixbuf = NULL;
......@@ -190,7 +370,10 @@ on_about_activate (GtkWidget * parent, gpointer data)
};
const gchar *documentors[] = { NULL };
const gchar *translator_credits = _("translator_credits");
const gchar copyright[1024];
gchar copyright[1024];
GtkWindow *parent;