Re: [gnome-network]patch for integrating the gnome system tools with gnome-netinfo
- From: Carlos Garnacho <garnacho tuxerver net>
- To: Rodrigo Moya <rodrigo gnome-db org>
- Cc: mccann jhu edu, gnome-network-list gnome org
- Subject: Re: [gnome-network]patch for integrating the gnome system tools with gnome-netinfo
- Date: Fri, 20 Feb 2004 11:00:35 +0100
El dom, 15-02-2004 a las 12:43, +0100, Rodrigo Moya escribió:
> On Tue, 2004-01-27 at 01:10 +0100, Carlos Garnacho wrote:
>
> > Hi William,
> >
> > sorry, it's a long time since this patch, I forgot it :/
> >
> and sorry, this was totally forgotten :-( Could you please resend the
> patch for the gnome-netinfo CVS module?
sure :)
>
> cheers
>
> _______________________________________________
> gnome-network-list mailing list
> gnome-network-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-network-list
? gnome-netinfo.patch
? src/gnome-netinfo.gladep
Index: src/callbacks.c
===================================================================
RCS file: /cvs/gnome/gnome-netinfo/src/callbacks.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 callbacks.c
--- src/callbacks.c 23 Jan 2004 15:48:43 -0000 1.1.1.1
+++ src/callbacks.c 20 Feb 2004 09:55:20 -0000
@@ -38,6 +38,7 @@
#include "lookup.h"
#include "finger.h"
#include "whois.h"
+#include "utils.h"
/* Ping callbacks */
void
@@ -100,6 +101,32 @@
}
#endif
+void
+on_configure_button_clicked (GtkButton *button, gpointer data)
+{
+ gchar *tool_path;
+ GString *command_line;
+ GtkEntry *nic_entry;
+ Netinfo *info;
+
+ g_return_if_fail (data != NULL);
+ info = (Netinfo *) data;
+
+ nic_entry = GTK_ENTRY (info->nic);
+ tool_path = util_find_program_in_path (GST_NETWORK_TOOL, NULL);
+
+ if (tool_path) {
+ command_line = g_string_new (tool_path);
+ g_string_append (command_line, " --configure ");
+ g_string_append (command_line, gtk_entry_get_text (nic_entry));
+
+ g_spawn_command_line_async (command_line->str, NULL);
+
+ g_string_free (command_line, TRUE);
+ g_free (tool_path);
+ }
+}
+
/* Scan callbacks */
void
on_scan_activate (GtkWidget * widget, gpointer data)
Index: src/callbacks.h
===================================================================
RCS file: /cvs/gnome/gnome-netinfo/src/callbacks.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 callbacks.h
--- src/callbacks.h 23 Jan 2004 15:48:43 -0000 1.1.1.1
+++ src/callbacks.h 20 Feb 2004 09:55:21 -0000
@@ -18,6 +18,8 @@
void on_whois_activate (GtkWidget * editable, gpointer data);
+void on_configure_button_clicked (GtkButton * widget, gpointer data);
+
/* General stuff */
void gn_quit_app (GtkWidget * widget, gpointer data);
Index: src/gnome-netinfo.glade
===================================================================
RCS file: /cvs/gnome/gnome-netinfo/src/gnome-netinfo.glade,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gnome-netinfo.glade
--- src/gnome-netinfo.glade 23 Jan 2004 15:48:44 -0000 1.1.1.1
+++ src/gnome-netinfo.glade 20 Feb 2004 09:55:30 -0000
@@ -14,6 +14,11 @@
<property name="default_height">490</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="delete_event" handler="gn_quit_app" last_modification_time="Sun, 26 Oct 2003 10:04:54 GMT"/>
<child>
@@ -239,6 +244,21 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkButton" id="info_configure_button">
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Configure</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">False</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -1335,6 +1355,7 @@
<property name="label" translatable="yes">Send only</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -1400,6 +1421,7 @@
<property name="label" translatable="yes">Send unlimited requests (pings)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -1431,6 +1453,7 @@
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment5">
@@ -1439,6 +1462,10 @@
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox12">
@@ -2183,6 +2210,7 @@
<property name="label" translatable="yes">Display routing table information</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -2201,6 +2229,7 @@
<property name="label" translatable="yes">Display active network services</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -2220,6 +2249,7 @@
<property name="label" translatable="yes">Display multicast information</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -2265,6 +2295,7 @@
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment8">
@@ -2273,6 +2304,10 @@
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox16">
@@ -2519,6 +2554,7 @@
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment7">
@@ -2527,6 +2563,10 @@
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox15">
@@ -2773,6 +2813,7 @@
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment9">
@@ -2781,6 +2822,10 @@
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox18">
@@ -3175,6 +3220,7 @@
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment10">
@@ -3183,6 +3229,10 @@
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox27">
@@ -3477,6 +3527,7 @@
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment11">
@@ -3485,6 +3536,10 @@
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox30">
@@ -3564,6 +3619,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
+ <property name="overwrite">False</property>
+ <property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
@@ -3738,6 +3795,7 @@
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment12">
@@ -3746,6 +3804,10 @@
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox32">
@@ -3825,6 +3887,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
+ <property name="overwrite">False</property>
+ <property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
Index: src/info.c
===================================================================
RCS file: /cvs/gnome/gnome-netinfo/src/info.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 info.c
--- src/info.c 23 Jan 2004 15:48:44 -0000 1.1.1.1
+++ src/info.c 20 Feb 2004 09:55:31 -0000
@@ -184,7 +184,10 @@
struct sockaddr_in *sinptr;
gint flags;
mii_data_result data;
-
+
+ if (!info->network_tool_path)
+ gtk_widget_hide (GTK_WIDGET (info->button));
+
sockfd = socket (AF_INET, SOCK_DGRAM, 0);
ifc.ifc_len = sizeof (buf);
@@ -284,12 +287,18 @@
gtk_label_set_text (GTK_LABEL (info->hw_address), _("Loopback"));
gtk_label_set_text (GTK_LABEL (info->broadcast), " ");
gtk_label_set_text (GTK_LABEL (info->link_speed), " ");
+
+ if (info->network_tool_path)
+ gtk_widget_hide (GTK_WIDGET (info->button));
} else {
if (data.has_data) {
gtk_label_set_text (GTK_LABEL (info->link_speed), data.media);
} else {
gtk_label_set_text (GTK_LABEL (info->link_speed), NOT_AVAILABLE);
}
+
+ if (info->network_tool_path)
+ gtk_widget_show (GTK_WIDGET (info->button));
}
/* Supports multicast */
Index: src/info.h
===================================================================
RCS file: /cvs/gnome/gnome-netinfo/src/info.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 info.h
--- src/info.h 23 Jan 2004 15:48:45 -0000 1.1.1.1
+++ src/info.h 20 Feb 2004 09:55:31 -0000
@@ -27,6 +27,8 @@
#define NOT_AVAILABLE _("not available")
#define DELAY_STATS 1000 /* 1 second */
+#define GST_NETWORK_TOOL "network-admin"
+
/* Solaris store the MTU in ifr_metric, and doesn't have
ifr_mtu define */
#if !defined(ifr_mtu)
Index: src/main.c
===================================================================
RCS file: /cvs/gnome/gnome-netinfo/src/main.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 main.c
--- src/main.c 23 Jan 2004 15:48:45 -0000 1.1.1.1
+++ src/main.c 20 Feb 2004 09:55:31 -0000
@@ -34,6 +34,7 @@
#include "lookup.h"
#include "finger.h"
#include "whois.h"
+#include "utils.h"
Netinfo *load_ping_widgets_from_xml (GladeXML * xml);
Netinfo *load_traceroute_widgets_from_xml (GladeXML * xml);
@@ -206,6 +207,9 @@
gtk_widget_show_all (window);
+ /* update the configure button status after gtk_widget_show_all () */
+ info_get_nic_information (gtk_entry_get_text (GTK_ENTRY (info->nic)), info);
+
gtk_main ();
g_free (pinger);
@@ -400,6 +404,9 @@
info->rx = glade_xml_get_widget (xml, "info_rx");
info->rx_errors = glade_xml_get_widget (xml, "info_rx_errors");
info->collisions = glade_xml_get_widget (xml, "info_collisions");
+ info->button = glade_xml_get_widget (xml, "info_configure_button");
+
+ info->network_tool_path = util_find_program_in_path (GST_NETWORK_TOOL, NULL);
vbox_info = glade_xml_get_widget (xml, "vbox_info");
@@ -408,6 +415,10 @@
*/
info->nic = glade_xml_get_widget (xml, "info_nic");
combo = glade_xml_get_widget (xml, "info_combo");
+
+ g_signal_connect (G_OBJECT (info->button), "clicked",
+ G_CALLBACK (on_configure_button_clicked),
+ info);
g_signal_connect (G_OBJECT (info->nic), "changed",
G_CALLBACK (info_nic_changed),
Index: src/netinfo.h
===================================================================
RCS file: /cvs/gnome/gnome-netinfo/src/netinfo.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 netinfo.h
--- src/netinfo.h 23 Jan 2004 15:48:45 -0000 1.1.1.1
+++ src/netinfo.h 20 Feb 2004 09:55:31 -0000
@@ -71,6 +71,7 @@
GtkWidget *broadcast;
GtkWidget *netmask;
GtkWidget *dst_address;
+ gchar *network_tool_path;
/*GtkWidget *multicast;*/
GtkWidget *link_speed;
GtkWidget *state;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]