Re: [gnome-network]patch for integrating the gnome system tools with gnome-netinfo
- From: Carlos Garnacho <garnacho tuxerver net>
- To: mccann jhu edu
- Cc: gnome-network-list gnome org
- Subject: Re: [gnome-network]patch for integrating the gnome system tools with gnome-netinfo
- Date: Tue, 27 Jan 2004 01:10:30 +0100
Hi William,
sorry, it's a long time since this patch, I forgot it :/
El lun, 15-12-2003 a las 17:58, William Jon McCann escribió:
> Hi,
>
> This is a good idea.
>
> I think it would be a bit better to:
>
> - make the network tool configurable via gconf [1]
for this I should add the gconf dependency for a single key, is it ok?
what do the rest of the people think about this?
>
> - add redhat-config-network to the default list of configuration tools
> to search for (as a convenience to many users)
some time ago, when I added support for Fedora in the gst, I managed to
remember this point and tried to launch the RH tool to configure a
single interface (ie, the interface that's in the combo) and discovered
that there is no way to do this :/, I think that it could be a little
ugly if gnome-netinfo runs the whole tool when there's a button beside a
combo with an interface.
>
> - hide the configure button for the loopback device since it cannot be
> configured
>
agreed and done, the patch is waiting for the gconf suggestions
> - remove unused variable iface from on_configure_button_clicked()
>
> You can take a look at gnome-netstatus for examples of the first two items.
I think this can be seen in the clock applet, the netstatus applet only
runs gst ATM, so the problem with the redhat network tool is still
there...
>
> Thanks,
> Jon
>
> [1] This brings up an interesting problem. Mark's netstatus applet does
> the same thing. Very possibly there are other places that also do this
> too. Is there a GNOME-wide place to store such things once, rather than
> per application? I think there should be. Otherwise, configuring this
> would be a real pain for sysadmins.
>
>
> Carlos Garnacho wrote:
> > Hi all,
> >
> > I've attached a patch that adds a button for throwing the interface
> > configuring dialog of the GST from the gnome-netinfo tool, it also hides
> > the button when the program cannot be found in the path
> >
> > is it ok to commit? :)
> >
> > regards
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > ? gnome-netinfo.diff
> > Index: ChangeLog
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-network/gnome-netinfo/ChangeLog,v
> > retrieving revision 1.102
> > diff -u -r1.102 ChangeLog
> > --- ChangeLog 5 Dec 2003 02:27:22 -0000 1.102
> > +++ ChangeLog 15 Dec 2003 15:51:21 -0000
> > @@ -1,3 +1,13 @@
> > +2003-12-15 Carlos Garnacho Parro <garnacho tuxerver net>
> > +
> > + * callbacks.[ch]: (on_configure_button_clicked): added
> > + * info.[ch]: (info_get_nic_information): made it to set unsensitive
> > + the configure button when the selecting the loopback interface
> > + * main.c: added configure button, made it to hide it when the tool
> > + doesn't exist in the path
> > + * gnome-netinfo.glade: added a button for throwing the GST network
> > + tool
> > +
> > 2003-12-01 Bastien Nocera <hadess hadess net>
> >
> > * main.c: (load_whois_widgets_from_xml): we don't have a "user"
> > Index: callbacks.c
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-network/gnome-netinfo/callbacks.c,v
> > retrieving revision 1.29
> > diff -u -r1.29 callbacks.c
> > --- callbacks.c 20 Nov 2003 22:11:05 -0000 1.29
> > +++ callbacks.c 15 Dec 2003 15:51:22 -0000
> > @@ -37,6 +37,7 @@
> > #include "lookup.h"
> > #include "finger.h"
> > #include "whois.h"
> > +#include "utils.h"
> >
> > /* Ping callbacks */
> > void
> > @@ -99,6 +100,33 @@
> > }
> > #endif
> >
> > +void
> > +on_configure_button_clicked (GtkButton *button, gpointer data)
> > +{
> > + gchar *tool_path;
> > + GString *command_line;
> > + GtkEntry *nic_entry;
> > + Netinfo *info;
> > + gchar *iface;
> > +
> > + g_return_if_fail (data != NULL);
> > + info = (Netinfo *) data;
> > +
> > + nic_entry = GTK_ENTRY (info->nic);
> > + tool_path = util_find_program_in_path (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: callbacks.h
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-network/gnome-netinfo/callbacks.h,v
> > retrieving revision 1.12
> > diff -u -r1.12 callbacks.h
> > --- callbacks.h 20 Nov 2003 22:11:05 -0000 1.12
> > +++ callbacks.h 15 Dec 2003 15:51:22 -0000
> > @@ -16,6 +16,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: gnome-netinfo.glade
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-network/gnome-netinfo/gnome-netinfo.glade,v
> > retrieving revision 1.30
> > diff -u -r1.30 gnome-netinfo.glade
> > --- gnome-netinfo.glade 24 Nov 2003 16:51:03 -0000 1.30
> > +++ gnome-netinfo.glade 15 Dec 2003 15:51:33 -0000
> > @@ -239,6 +239,75 @@
> > <property name="fill">False</property>
> > </packing>
> > </child>
> > +
> > + <child>
> > + <widget class="GtkButton" id="info_configure_button">
> > + <property name="visible">True</property>
> > + <property name="can_focus">True</property>
> > + <property name="relief">GTK_RELIEF_NORMAL</property>
> > +
> > + <child>
> > + <widget class="GtkAlignment" id="alignment13">
> > + <property name="visible">True</property>
> > + <property name="xalign">0.5</property>
> > + <property name="yalign">0.5</property>
> > + <property name="xscale">0</property>
> > + <property name="yscale">0</property>
> > +
> > + <child>
> > + <widget class="GtkHBox" id="hbox33">
> > + <property name="visible">True</property>
> > + <property name="homogeneous">False</property>
> > + <property name="spacing">2</property>
> > +
> > + <child>
> > + <widget class="GtkImage" id="image13">
> > + <property name="visible">True</property>
> > + <property name="stock">gtk-execute</property>
> > + <property name="icon_size">4</property>
> > + <property name="xalign">0.5</property>
> > + <property name="yalign">0.5</property>
> > + <property name="xpad">0</property>
> > + <property name="ypad">0</property>
> > + </widget>
> > + <packing>
> > + <property name="padding">0</property>
> > + <property name="expand">False</property>
> > + <property name="fill">False</property>
> > + </packing>
> > + </child>
> > +
> > + <child>
> > + <widget class="GtkLabel" id="label86">
> > + <property name="visible">True</property>
> > + <property name="label" translatable="yes">_Configure</property>
> > + <property name="use_underline">True</property>
> > + <property name="use_markup">False</property>
> > + <property name="justify">GTK_JUSTIFY_LEFT</property>
> > + <property name="wrap">False</property>
> > + <property name="selectable">False</property>
> > + <property name="xalign">0.5</property>
> > + <property name="yalign">0.5</property>
> > + <property name="xpad">0</property>
> > + <property name="ypad">0</property>
> > + </widget>
> > + <packing>
> > + <property name="padding">0</property>
> > + <property name="expand">False</property>
> > + <property name="fill">False</property>
> > + </packing>
> > + </child>
> > + </widget>
> > + </child>
> > + </widget>
> > + </child>
> > + </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>
> > Index: info.c
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-network/gnome-netinfo/info.c,v
> > retrieving revision 1.19
> > diff -u -r1.19 info.c
> > --- info.c 20 Nov 2003 21:12:42 -0000 1.19
> > +++ info.c 15 Dec 2003 15:51:34 -0000
> > @@ -259,12 +259,16 @@
> > 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), " ");
> > +
> > + gtk_widget_set_sensitive (GTK_WIDGET (info->button), FALSE);
> > } 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);
> > }
> > +
> > + gtk_widget_set_sensitive (GTK_WIDGET (info->button), TRUE);
> > }
> >
> > /* Supports multicast */
> > Index: info.h
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-network/gnome-netinfo/info.h,v
> > retrieving revision 1.8
> > diff -u -r1.8 info.h
> > --- info.h 24 Jul 2003 17:21:11 -0000 1.8
> > +++ info.h 15 Dec 2003 15:51:34 -0000
> > @@ -27,6 +27,8 @@
> > #define NOT_AVAILABLE _("not available")
> > #define DELAY_STATS 1000 /* 1 second */
> >
> > +#define NETWORK_TOOL "network-admin"
> > +
> > /* Solaris store the MTU in ifr_metric, and doesn't have
> > ifr_mtu define */
> > #if !defined(ifr_mtu)
> > Index: main.c
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-network/gnome-netinfo/main.c,v
> > retrieving revision 1.41
> > diff -u -r1.41 main.c
> > --- main.c 5 Dec 2003 02:27:22 -0000 1.41
> > +++ main.c 15 Dec 2003 15:51:36 -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);
> > @@ -60,6 +61,7 @@
> > Netinfo *finger;
> > Netinfo *whois;
> > gchar *icon_path;
> > + gchar *tool_path;
> >
> > #ifdef ENABLE_NLS
> > bindtextdomain (GETTEXT_PACKAGE, GNOME_NETINFO_LOCALEDIR);
> > @@ -110,6 +112,13 @@
> >
> > gtk_widget_show_all (window);
> >
> > + tool_path = util_find_program_in_path (NETWORK_TOOL, NULL);
> > +
> > + if (!tool_path)
> > + gtk_widget_hide (GTK_WIDGET (info->button));
> > +
> > + g_free (tool_path);
> > +
> > gtk_main ();
> >
> > g_free (pinger);
> > @@ -290,9 +299,12 @@
> > 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");
> >
> > vbox_info = glade_xml_get_widget (xml, "vbox_info");
> >
> > + info->button_callback = G_CALLBACK (on_configure_button_clicked);
> > +
> > /*
> > #ifdef IFCONFIG_PROGRAM
> > */
> > @@ -302,7 +314,11 @@
> > g_signal_connect (G_OBJECT (info->nic), "changed",
> > G_CALLBACK (info_nic_changed),
> > info);
> > + g_signal_connect (G_OBJECT (info->button), "clicked",
> > + info->button_callback,
> > + info);
> > info_load_iface (info, combo);
> > +
> > /*
> > #else
> > gtk_widget_set_sensitive (vbox_info, FALSE);
>
> _______________________________________________
> gnome-network-list mailing list
> gnome-network-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-network-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]