17411N/A <property name="resizable">False</property>
17411N/A <property name="window_position">center</property>
17411N/A <property name="default_width">300</property>
17411N/A- <property name="type_hint">dialog</property>
17411N/A+ <property name="type_hint">normal</property>
17411N/A <property name="has_separator">False</property>
17411N/A <object class="GtkVBox" id="dialog-vbox2">
17411N/A <object class="GtkHBox" id="hbox6">
17411N/A <property name="visible">True</property>
17411N/A- <object class="GtkAlignment" id="alignment7">
17411N/A+ <object class="GtkLabel" id="label43">
17411N/A <property name="visible">True</property>
17411N/A- <property name="left_padding">10</property>
17411N/A+ <property name="label" translatable="yes"> </property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">0</property>
17411N/A+ <object class="GtkHBox" id="connection_hbox">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="spacing">12</property>
17411N/A <object class="GtkTable" id="connection_table">
17411N/A <property name="visible">True</property>
17411N/A- <property name="n_rows">2</property>
17411N/A+ <property name="n_rows">3</property>
17411N/A <property name="n_columns">2</property>
17411N/A <property name="column_spacing">12</property>
17411N/A <property name="row_spacing">6</property>
17411N/A+ <object class="GtkComboBoxEntry" id="name_combo_box_entry">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <object class="GtkCheckButton" id="track_active_interface">
17411N/A+ <property name="label" translatable="yes">_Track system active interface</property>
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="can_focus">True</property>
17411N/A+ <property name="receives_default">False</property>
17411N/A+ <property name="use_underline">True</property>
17411N/A+ <property name="draw_indicator">True</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <property name="top_attach">2</property>
17411N/A+ <property name="bottom_attach">3</property>
17411N/A <object class="GtkLabel" id="label5">
17411N/A <property name="visible">True</property>
17411N/A <property name="xalign">0</property>
17411N/A- <object class="GtkComboBoxEntry" id="name_combo_box_entry">
17411N/A- <property name="visible">True</property>
17411N/A- <property name="left_attach">1</property>
17411N/A- <property name="right_attach">2</property>
17411N/A- <property name="x_options">GTK_FILL</property>
17411N/A- <property name="y_options">GTK_FILL</property>
17411N/A+ <property name="position">0</property>
17411N/A- <property name="position">0</property>
17411N/A- <object class="GtkHBox" id="connection_hbox">
17411N/A- <property name="visible">True</property>
17411N/A- <object class="GtkAlignment" id="alignment8">
17411N/A+ <object class="GtkHBox" id="hbox8">
17411N/A <property name="visible">True</property>
17411N/A- <property name="left_padding">10</property>
17411N/A+ <object class="GtkLabel" id="label44">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="label" translatable="yes"> </property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">0</property>
17411N/A <object class="GtkTable" id="table2">
17411N/A <property name="visible">True</property>
17411N/A <property name="visible">True</property>
17411N/A <property name="xalign">0</property>
17411N/A <property name="label" translatable="yes">Sent:</property>
17411N/A+ <property name="width_chars">2</property>
17411N/A <property name="top_attach">1</property>
17411N/A+ <property name="position">1</property>
17411N/A <object class="GtkLabel" id="label48">
17411N/A <property name="visible">True</property>
17411N/A <property name="xalign">0</property>
17411N/A- <property name="label" translatable="yes">Signal Strength</property>
17411N/A+ <property name="label" translatable="yes"><b>Wireless</b></property>
17411N/A+ <property name="use_markup">True</property>
17411N/A <attribute name="weight" value="bold"/>
17411N/A- <object class="GtkAlignment" id="alignment3">
17411N/A+ <object class="GtkTable" id="table1">
17411N/A <property name="visible">True</property>
17411N/A- <property name="left_padding">10</property>
17411N/A+ <property name="n_rows">6</property>
17411N/A+ <property name="n_columns">2</property>
17411N/A+ <property name="column_spacing">12</property>
17411N/A+ <property name="row_spacing">6</property>
17411N/A+ <object class="GtkLabel" id="essid_value_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="selectable">True</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <object class="GtkLabel" id="bssid_value_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="selectable">True</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <property name="top_attach">1</property>
17411N/A+ <property name="bottom_attach">2</property>
17411N/A+ <object class="GtkLabel" id="bssid_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="label" translatable="yes">Access Point (BSSID):</property>
17411N/A+ <property name="justify">right</property>
17411N/A+ <property name="top_attach">1</property>
17411N/A+ <property name="bottom_attach">2</property>
17411N/A+ <property name="x_options">GTK_FILL</property>
17411N/A+ <object class="GtkLabel" id="essid_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="label" translatable="yes">Network Name (ESSID):</property>
17411N/A+ <property name="justify">right</property>
17411N/A+ <property name="x_options">GTK_FILL</property>
17411N/A+ <object class="GtkLabel" id="label6">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="label" translatable="yes">Signal Strength:</property>
17411N/A+ <property name="ellipsize">middle</property>
17411N/A+ <property name="top_attach">5</property>
17411N/A+ <property name="bottom_attach">6</property>
17411N/A+ <property name="x_options">GTK_FILL</property>
17411N/A+ <property name="y_options">GTK_FILL</property>
17411N/A+ <object class="GtkLabel" id="auth_mode_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="yalign">0.49000000953674316</property>
17411N/A+ <property name="label" translatable="yes">Authentication Mode:</property>
17411N/A+ <property name="top_attach">4</property>
17411N/A+ <property name="bottom_attach">5</property>
17411N/A+ <object class="GtkLabel" id="security_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="label" translatable="yes">Security:</property>
17411N/A+ <property name="top_attach">3</property>
17411N/A+ <property name="bottom_attach">4</property>
17411N/A+ <property name="x_options">GTK_FILL</property>
17411N/A <object class="GtkHBox" id="hbox15">
17411N/A <property name="visible">True</property>
17411N/A <object class="GtkProgressBar" id="signal_strength_bar">
17411N/A <property name="visible">True</property>
17411N/A- <property name="pulse_step">0.10000000149</property>
17411N/A <property name="position">0</property>
17411N/A <object class="GtkLabel" id="signal_strength_label">
17411N/A <property name="visible">True</property>
17411N/A- <property name="label">0%</property>
17411N/A+ <property name="label" translatable="yes">0%</property>
17411N/A <property name="expand">False</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <property name="top_attach">5</property>
17411N/A+ <property name="bottom_attach">6</property>
17411N/A+ <object class="GtkLabel" id="auth_mode_value_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="selectable">True</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <property name="top_attach">4</property>
17411N/A+ <property name="bottom_attach">5</property>
17411N/A+ <object class="GtkLabel" id="security_value_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="selectable">True</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <property name="top_attach">3</property>
17411N/A+ <property name="bottom_attach">4</property>
17411N/A+ <object class="GtkLabel" id="bss_mode_value_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="selectable">True</property>
17411N/A+ <property name="left_attach">1</property>
17411N/A+ <property name="right_attach">2</property>
17411N/A+ <property name="top_attach">2</property>
17411N/A+ <property name="bottom_attach">3</property>
17411N/A+ <object class="GtkLabel" id="bss_mode_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="label" translatable="yes">Operational Mode (BSS):</property>
17411N/A+ <property name="justify">right</property>
17411N/A+ <property name="top_attach">2</property>
17411N/A+ <property name="bottom_attach">3</property>
17411N/A+ <property name="x_options">GTK_FILL</property>
17411N/A- <property name="expand">False</property>
17411N/A <property name="position">1</property>
17411N/A- <object class="GtkAlignment" id="alignment4">
17411N/A+ <object class="GtkHBox" id="hbox11">
17411N/A <property name="visible">True</property>
17411N/A- <property name="left_padding">10</property>
17411N/A+ <object class="GtkLabel" id="label45">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="label" translatable="yes"> </property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">0</property>
17411N/A <object class="GtkTable" id="inet4_table">
17411N/A <property name="visible">True</property>
17411N/A+ <property name="position">1</property>
17411N/A- <object class="GtkAlignment" id="alignment6">
17411N/A+ <object class="GtkHBox" id="hbox12">
17411N/A <property name="visible">True</property>
17411N/A- <property name="left_padding">10</property>
17411N/A+ <object class="GtkLabel" id="label46">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="label" translatable="yes"> </property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">0</property>
17411N/A <object class="GtkTable" id="table5">
17411N/A <property name="visible">True</property>
17411N/A+ <property name="position">1</property>
17411N/A- <object class="GtkAlignment" id="alignment5">
17411N/A+ <object class="GtkHBox" id="hbox13">
17411N/A <property name="visible">True</property>
17411N/A- <property name="left_padding">10</property>
17411N/A+ <object class="GtkLabel" id="label47">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="label" translatable="yes"> </property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">0</property>
17411N/A <object class="GtkTable" id="table6">
17411N/A <property name="visible">True</property>
17411N/A+ <property name="position">1</property>
17411N/A <property name="tab_fill">False</property>
17411N/A+ <object class="GtkVBox" id="vbox3">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="border_width">12</property>
17411N/A+ <property name="spacing">18</property>
17411N/A+ <object class="GtkVBox" id="vbox5">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="spacing">6</property>
17411N/A+ <object class="GtkLabel" id="label59">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xalign">0</property>
17411N/A+ <property name="label" translatable="yes">You may need to restart ths connection if you want to connect to a different network, or if you are experiencing connection problems.</property>
17411N/A+ <property name="wrap">True</property>
17411N/A+ <property name="position">0</property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="position">0</property>
17411N/A+ <object class="GtkHBox" id="restart_hbox">
17411N/A+ <property name="visible">True</property>
17411N/A+ <object class="GtkLabel" id="label65">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="position">0</property>
17411N/A+ <object class="GtkVBox" id="vbox6">
17411N/A+ <property name="visible">True</property>
17411N/A+ <object class="GtkButton" id="restart_button">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="can_focus">True</property>
17411N/A+ <property name="receives_default">False</property>
17411N/A+ <object class="GtkAlignment" id="alignment3">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="xscale">0</property>
17411N/A+ <property name="yscale">0</property>
17411N/A+ <object class="GtkHBox" id="hbox1">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="spacing">2</property>
17411N/A+ <object class="GtkImage" id="restart_button_image">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="stock">gtk-refresh</property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">0</property>
17411N/A+ <object class="GtkLabel" id="restart_button_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="label" translatable="yes">_Restart</property>
17411N/A+ <property name="use_underline">True</property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">1</property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">0</property>
17411N/A+ <object class="GtkLabel" id="label70">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="position">1</property>
17411N/A+ <property name="expand">False</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">1</property>
17411N/A+ <property name="fill">False</property>
17411N/A+ <property name="position">1</property>
17411N/A+ <object class="GtkLabel" id="label69">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="position">2</property>
17411N/A+ <property name="position">2</property>
17411N/A+ <object class="GtkLabel" id="restart_tab_label">
17411N/A+ <property name="visible">True</property>
17411N/A+ <property name="label" translatable="yes">Restart</property>
17411N/A+ <property name="position">2</property>
17411N/A+ <property name="tab_fill">False</property>
17411N/A <property name="position">1</property>
17411N/A /* vim: set sw=2 ts=2 sts=2 et: */
17411N/A- * Copyright (C) 2003 Sun Microsystems, Inc.
17411N/A+ * Copyright (C) 2003-2009 Sun Microsystems, Inc.
17411N/A * Copyright (C) 2004 Red Hat Inc.
17411N/A * This program is free software; you can redistribute it
and/or 17411N/A #define NETWORK_CONFIG_TOOL_KEY NETWORK_CONFIG_TOOL_DIR "/config_tool"
17411N/A+static const gchar * IFRESTART_TAB_LABLE_NAME = "restart_tab_label";
17411N/A+static const gchar * IFRESTART_TAB_BUTTON_NAME = "restart_button";
17411N/A+static const gchar * IFRESTART_TAB_BUTTON_LABEL_NAME = "restart_button_label";
17411N/A+static const gchar * IFRESTART_TAB_BUTTON_IMAGE_NAME = "restart_button_image";
17411N/A+static const gchar * IFRESTART_TAB_HBOX_NAME = "restart_hbox";
17411N/A+static const gchar * IFRESTART_TAB_BUTTON_LABEL_RESTART = "_Restart";
17411N/A+static const gchar * IFRESTART_TAB_BUTTON_LABEL_STOP = "_Stop";
17411N/A+static const gchar * IFRESTART_WINDOW_TITLE_FORMAT = "%s: %s";
17411N/A+static const gchar * IFRESTART_WINDOW_TITLE = "Restartin Connection";
17411N/A+static const gchar * IFRESTART_PROGRESS_FORMAT = "<b>%s</b>: <i>%s</i>";
17411N/A+static const gchar * IFRESTART_PROGRESS = "Progress";
17411N/A+static const gchar * IFRESTART_PROGRESS_BEGIN = "Click Restart to begin";
17411N/A+static const gchar * IFRESTART_PROGRESS_RESTARTING = "Restarting...";
17411N/A+static const gchar * IFRESTART_PROGRESS_COMPLETE = "Complete";
17411N/A+static const gchar * IFRESTART_PROGRESS_FAILED = "Failed, click here for details";
17411N/A+static const gchar * IFRESTART_WARNING = "Warning";
17411N/A+static const gchar * IFRESTART_WARNING_NOLO = "Cannot restart this connection";
17411N/A static const char *network_config_tools[] = {
17411N/A "network-admin --configure %i",
18350N/A@@ -64,6 +85,11 @@ typedef struct
17411N/A GtkWidget *signal_strength_frame;
17411N/A GtkWidget *signal_strength_bar;
17411N/A GtkWidget *signal_strength_label;
17411N/A+ GtkWidget *bss_mode_value_label;
17411N/A+ GtkWidget *security_value_label;
17411N/A+ GtkWidget *auth_mode_value_label;
18350N/A@@ -81,6 +107,13 @@ typedef struct
17411N/A+ GtkWidget *track_active_interface_cbox;
17411N/A+ GtkWidget *restart_button_image;
17411N/A+ GtkWidget *restart_button_label;
17411N/A+ GtkWidget *restart_progress_expander;
18350N/A@@ -184,6 +217,11 @@ netstatus_dialog_update_signal_strength
17411N/A gtk_widget_show (data->signal_strength_frame);
18350N/A@@ -195,6 +233,18 @@ netstatus_dialog_update_signal_strength
17411N/A str = g_strdup_printf ("%d%%\n", signal_strength);
17411N/A gtk_label_set_text (GTK_LABEL (data->signal_strength_label), str);
17411N/A+ essid = netstatus_iface_get_essid (data->iface);
17411N/A+ bssid = netstatus_iface_get_bssid (data->iface);
17411N/A+ bss_mode = netstatus_iface_get_bss_mode (data->iface);
17411N/A+ security = netstatus_iface_get_security (data->iface);
17411N/A+ auth_mode = netstatus_iface_get_auth_mode (data->iface);
17411N/A+ gtk_label_set_text (GTK_LABEL (data->essid_value_label), essid?essid:"" );
17411N/A+ gtk_label_set_text (GTK_LABEL (data->bssid_value_label), bssid?bssid:"" );
17411N/A+ gtk_label_set_text (GTK_LABEL (data->bss_mode_value_label), bss_mode?bss_mode:"" );
17411N/A+ gtk_label_set_text (GTK_LABEL (data->auth_mode_value_label), auth_mode?auth_mode:"" );
17411N/A+ gtk_label_set_text (GTK_LABEL (data->security_value_label), security?security:"" );
18350N/A@@ -313,6 +363,105 @@ netstatus_dialog_update_device_support (
17411N/A+netstatus_dialog_set_track_active_interface(NetstatusDialogData *data,
17411N/A+ gboolean track_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->track_active_interface_cbox));
17411N/A+ netstatus_iface_set_track_active_interface (data->iface, track_active );
17411N/A+netstatus_dialog_update_track_active_interface (NetstatusDialogData *data)
17411N/A+ gboolean track_active = FALSE;
17411N/A+ if ( data->track_active_interface_cbox == NULL )
17411N/A+ track_active = netstatus_iface_get_track_active_interface( data->iface );
17411N/A+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->track_active_interface_cbox), track_active );
17411N/A+ gtk_widget_set_sensitive(GTK_WIDGET(data->name), !track_active );
17411N/A+netstatus_dialog_ask_question(NetstatusDialogData *data, const char* message, const char* question )
17411N/A+ dialog = gtk_message_dialog_new (GTK_WINDOW (data->dialog),
17411N/A+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
17411N/A+ gtk_message_dialog_format_secondary_text( dialog, question );
17411N/A+ result = gtk_dialog_run (GTK_DIALOG (dialog));
17411N/A+netstatus_dialog_update_restart_button (NetstatusDialogData *data)
17411N/A+ if (data->restart_button == NULL)
17411N/A+ /* Disable restart button for nothing and loopback interface */
17411N/A+ ifname = netstatus_iface_get_name (data->iface);
17411N/A+ if ((ifname != NULL) && (strcmp (ifname, "lo")))
17411N/A+ gtk_widget_set_sensitive (data->restart_button, TRUE);
17411N/A+ /* Set "Press button to restart" progress message */
17411N/A+ string = g_strdup_printf (IFRESTART_PROGRESS_FORMAT,
17411N/A+ _(IFRESTART_PROGRESS), _(IFRESTART_PROGRESS_BEGIN));
17411N/A+ gtk_widget_set_sensitive (data->restart_button, FALSE);
17411N/A+ /* Set "Cannot restart this connection" progress message */
17411N/A+ string = g_strdup_printf (IFRESTART_PROGRESS_FORMAT,
17411N/A+ _(IFRESTART_WARNING), _(IFRESTART_WARNING_NOLO));
17411N/A+ GTK_EXPANDER (data->restart_progress_expander), string);
17411N/A+ /* Clean up the output of the last restart */
17411N/A+ widget = gtk_bin_get_child (GTK_BIN (data->restart_progress_expander));
17411N/A+ gtk_label_set_text (GTK_LABEL (widget), "");
17411N/A netstatus_dialog_iface_state_changed (NetstatusIface *iface,
18350N/A@@ -339,12 +488,21 @@ netstatus_dialog_iface_signal_strength_c
17411N/A+netstatus_dialog_iface_track_active_interface_changed(NetstatusIface *iface,
17411N/A+ netstatus_dialog_update_track_active_interface( data );
17411N/A netstatus_dialog_iface_name_changed (NetstatusIface *iface,
17411N/A netstatus_dialog_update_name (data);
17411N/A netstatus_dialog_update_signal_strength (data);
17411N/A+ netstatus_dialog_update_restart_button (data);
18350N/A@@ -364,6 +522,136 @@ netstatus_dialog_set_iface_name (Netstat
17411N/A+netstatus_dialog_restart_state_changed (
17411N/A+ NetstatusIface *iface, NetstatusDialogData *data)
17411N/A+ g_return_if_fail (data != NULL);
17411N/A+ g_return_if_fail (data->iface != NULL);
17411N/A+ if (netstatus_iface_restart_inprogress (data->iface))
17411N/A+ /* The restart is in progress */
17411N/A+ /* Save the current network interface name */
17411N/A+ ifname = netstatus_iface_get_name (data->iface);
17411N/A+ g_return_if_fail (ifname != NULL);
17411N/A+ /* Disable network interface change */
17411N/A+ gtk_widget_set_sensitive (data->name, FALSE);
17411N/A+ /* Set the restart button to Stop */
17411N/A+ gtk_image_set_from_stock (GTK_IMAGE (data->restart_button_image),
17411N/A+ GTK_STOCK_STOP, GTK_ICON_SIZE_BUTTON);
17411N/A+ gtk_label_set_text_with_mnemonic (GTK_LABEL (data->restart_button_label),
17411N/A+ _(IFRESTART_TAB_BUTTON_LABEL_STOP));
17411N/A+ string = g_strdup_printf (IFRESTART_WINDOW_TITLE_FORMAT,
17411N/A+ _(IFRESTART_WINDOW_TITLE), ifname);
17411N/A+ gtk_window_set_title (GTK_WINDOW (data->dialog), string);
17411N/A+ /* Set the progress message */
17411N/A+ string = g_strdup_printf (IFRESTART_PROGRESS_FORMAT,
17411N/A+ _(IFRESTART_PROGRESS), _(IFRESTART_PROGRESS_RESTARTING));
17411N/A+ GTK_EXPANDER (data->restart_progress_expander), string);
17411N/A+ /* Clean up the output of the script */
17411N/A+ widget = gtk_bin_get_child (GTK_BIN (data->restart_progress_expander));
17411N/A+ gtk_label_set_text (GTK_LABEL (widget), "");
17411N/A+ /* The restart is completed */
17411N/A+ /* Set the restart button to Restart */
17411N/A+ gtk_image_set_from_stock (GTK_IMAGE (data->restart_button_image),
17411N/A+ GTK_STOCK_REFRESH, GTK_ICON_SIZE_BUTTON);
17411N/A+ gtk_label_set_text_with_mnemonic (GTK_LABEL (data->restart_button_label),
17411N/A+ _(IFRESTART_TAB_BUTTON_LABEL_RESTART));
17411N/A+ /* Enable network interface change */
17411N/A+ gtk_widget_set_sensitive (data->name, TRUE);
17411N/A+ /* Restore dialog window title */
17411N/A+ netstatus_dialog_update_name (data);
17411N/A+ /* Set the progress message */
17411N/A+ state = netstatus_iface_restart_get_status (data->iface);
17411N/A+ /* Restart has been completed successfully */
17411N/A+ string = g_strdup_printf (IFRESTART_PROGRESS_FORMAT,
17411N/A+ _(IFRESTART_PROGRESS), _(IFRESTART_PROGRESS_COMPLETE));
17411N/A+ string = g_strdup_printf (IFRESTART_PROGRESS_FORMAT,
17411N/A+ _(IFRESTART_PROGRESS), _(IFRESTART_PROGRESS_FAILED));
17411N/A+ /* No restart has been completed or started yet */
17411N/A+ string = g_strdup_printf (IFRESTART_PROGRESS_FORMAT,
17411N/A+ _(IFRESTART_PROGRESS), _(IFRESTART_PROGRESS_BEGIN));
17411N/A+ GTK_EXPANDER (data->restart_progress_expander), string);
17411N/A+ /* Set the output of the script */
17411N/A+ widget = gtk_bin_get_child (GTK_BIN (data->restart_progress_expander));
17411N/A+ string = netstatus_iface_restart_get_output (data->iface);
17411N/A+ case 9: /* canceled by "Stop" button */
17411N/A+ case 3072: /* canceled by root password dialog */
17411N/A+ string = _("Connection restart has been stopped.");
17411N/A+ case 19: /* there is no ifrestart script */
17411N/A+ string = _("Cannot find ifrestart script.");
17411N/A+ gtk_label_set_text (GTK_LABEL (widget), string);
17411N/A+netstatus_dialog_restart (GtkWidget *button, NetstatusDialogData *data)
17411N/A+ g_return_if_fail (data != NULL);
17411N/A+ if (netstatus_iface_restart_inprogress (data->iface))
17411N/A+ /* Interrupt the network interface restart */
17411N/A+ netstatus_iface_restart_interrupt (data->iface);
17411N/A+ /* Spawn the network interface restart */
17411N/A+ netstatus_iface_restart (data->iface);
17411N/A netstatus_dialog_response (GtkWidget *dialog,
18350N/A@@ -441,7 +729,11 @@ netstatus_dialog_destroy (GtkWidget *dia
17411N/A+ g_signal_handlers_disconnect_matched (
17411N/A+ data->iface, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (gpointer) data);
18350N/A@@ -603,6 +895,26 @@ netstatus_dialog_setup_configure_button
17411N/A+netstatus_dialog_setup_track_active_interface (NetstatusDialogData *data,
17411N/A+ cbox = GTK_WIDGET (gtk_builder_get_object (builder, "track_active_interface"));
17411N/A+ data->track_active_interface_cbox = cbox;
17411N/A+ netstatus_dialog_update_track_active_interface(data);
17411N/A+ g_signal_connect_swapped(GTK_TOGGLE_BUTTON (data->track_active_interface_cbox), "toggled",
17411N/A+ G_CALLBACK (netstatus_dialog_set_track_active_interface),
17411N/A netstatus_dialog_setup_connection (NetstatusDialogData *data,
18350N/A@@ -652,6 +964,11 @@ netstatus_dialog_setup_signal_strength_d
17411N/A data->signal_strength_frame = GTK_WIDGET (gtk_builder_get_object (builder, "signal_strength_frame"));
17411N/A data->signal_strength_bar = GTK_WIDGET (gtk_builder_get_object (builder, "signal_strength_bar"));
17411N/A data->signal_strength_label = GTK_WIDGET (gtk_builder_get_object (builder, "signal_strength_label"));
17411N/A+ data->essid_value_label = GTK_WIDGET (gtk_builder_get_object (builder, "essid_value_label"));
17411N/A+ data->bssid_value_label = GTK_WIDGET (gtk_builder_get_object (builder, "bssid_value_label"));
17411N/A+ data->bss_mode_value_label = GTK_WIDGET (gtk_builder_get_object (builder, "bss_mode_value_label"));
17411N/A+ data->auth_mode_value_label = GTK_WIDGET (gtk_builder_get_object (builder, "auth_mode_value_label"));
17411N/A+ data->security_value_label = GTK_WIDGET (gtk_builder_get_object (builder, "security_value_label"));
17411N/A netstatus_dialog_update_signal_strength (data);
18350N/A@@ -720,6 +1037,88 @@ netstatus_dialog_iface_list_monitor (Net
17411N/A+netstatus_dialog_setup_restart_tab (NetstatusDialogData *data, GtkBuilder *builder)
17411N/A+ g_return_if_fail (data != NULL);
17411N/A+ g_return_if_fail (builder != NULL);
17411N/A+ /* Network interface restart tab */
17411N/A+ if (netstatus_iface_restart_available (data->iface))
17411N/A+ data->restart_button = GTK_WIDGET (
17411N/A+ gtk_builder_get_object (builder, IFRESTART_TAB_BUTTON_NAME));
17411N/A+ if (data->restart_button != NULL)
17411N/A+ data->restart_button_image = GTK_WIDGET (
17411N/A+ gtk_builder_get_object (builder, IFRESTART_TAB_BUTTON_IMAGE_NAME));
17411N/A+ data->restart_button_label = GTK_WIDGET (
17411N/A+ gtk_builder_get_object (builder, IFRESTART_TAB_BUTTON_LABEL_NAME));
17411N/A+ g_signal_connect (G_OBJECT (data->restart_button), "clicked",
17411N/A+ G_CALLBACK (netstatus_dialog_restart), (gpointer) data);
17411N/A+ gtk_builder_get_object (builder, IFRESTART_TAB_HBOX_NAME));
17411N/A+ gtk_box_set_spacing (GTK_BOX (widget), 2);
17411N/A+ data->restart_progress_expander = gtk_expander_new ("");
17411N/A+ GTK_EXPANDER (data->restart_progress_expander), TRUE);
17411N/A+ gtk_box_pack_start (GTK_BOX (widget),
17411N/A+ data->restart_progress_expander, FALSE, FALSE, 0);
17411N/A+ gtk_box_reorder_child (GTK_BOX (widget),
17411N/A+ data->restart_progress_expander, 0);
17411N/A+ gtk_label_set_selectable (GTK_LABEL (widget), TRUE);
17411N/A+ GTK_CONTAINER (data->restart_progress_expander), widget);
17411N/A+ gtk_widget_show_all (data->restart_progress_expander);
17411N/A+ netstatus_dialog_restart_state_changed (data->iface, data);
17411N/A+ netstatus_dialog_update_restart_button (data);
17411N/A+ data->iface, NETSTATUS_IFACE_SIGNAL_RESTART_STATE,
17411N/A+ G_CALLBACK (netstatus_dialog_restart_state_changed), data);
17411N/A+ GTK_WIDGET (gtk_builder_get_object (builder, "notebook1")));
17411N/A+ for (idx = 0; idx < gtk_notebook_get_n_pages (notebook); idx++)
17411N/A+ widget = gtk_notebook_get_nth_page (notebook, idx);
17411N/A+ widget = gtk_notebook_get_tab_label (notebook, widget);
17411N/A+ name = gtk_widget_get_name (widget);
17411N/A+ if (!strcmp (name, IFRESTART_TAB_LABLE_NAME))
17411N/A+ gtk_notebook_remove_page (notebook, idx);
17411N/A netstatus_dialog_new (NetstatusIface *iface)
18350N/A@@ -743,7 +1142,7 @@ netstatus_dialog_new (NetstatusIface *if
17411N/A data->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "network_status_dialog"));
17411N/A g_object_set_data (G_OBJECT (data->dialog), "netstatus-dialog-data", data);
17411N/A- gtk_window_set_icon_name(GTK_WINDOW (data->dialog), "gnome-netstatus-tx");
17411N/A+ gtk_window_set_icon_name(GTK_WINDOW (data->dialog), "network-transmit");
17411N/A data->iface = g_object_ref (iface);
17411N/A netstatus_connect_signal_while_alive (data->iface,
18350N/A@@ -771,11 +1170,23 @@ netstatus_dialog_new (NetstatusIface *if
17411N/A netstatus_connect_signal_while_alive (data->iface,
17411N/A+ G_CALLBACK (netstatus_dialog_iface_signal_strength_changed),
17411N/A+ netstatus_connect_signal_while_alive (data->iface,
17411N/A G_CALLBACK (netstatus_dialog_iface_signal_strength_changed),
17411N/A+ netstatus_connect_signal_while_alive (data->iface,
17411N/A+ "notify::track-active-inteface",
17411N/A+ G_CALLBACK (netstatus_dialog_iface_track_active_interface_changed),
17411N/A g_signal_connect (data->dialog, "response",
17411N/A G_CALLBACK (netstatus_dialog_response), NULL);
18350N/A@@ -783,11 +1194,13 @@ netstatus_dialog_new (NetstatusIface *if
17411N/A G_CALLBACK (netstatus_dialog_destroy), NULL);
17411N/A netstatus_dialog_setup_connection (data, builder);
17411N/A+ netstatus_dialog_setup_track_active_interface (data, builder);
17411N/A netstatus_dialog_setup_activity (data, builder);
17411N/A netstatus_dialog_setup_signal_strength_details (data, builder);
17411N/A netstatus_dialog_setup_inet4_support (data, builder);
17411N/A netstatus_dialog_setup_device_support (data, builder);
17411N/A netstatus_dialog_setup_configure_button (data, builder);
17411N/A+ netstatus_dialog_setup_restart_tab (data, builder);
17411N/A data->iface_list_monitor = g_timeout_add (2 * 1000,
17411N/A (GSourceFunc) netstatus_dialog_iface_list_monitor,
17411N/A- * Copyright (C) 2003 Sun Microsystems, Inc.
17411N/A+ * Copyright (C) 2003-2009 Sun Microsystems, Inc.
17411N/A * Copyright (C) 2004 Red Hat Inc.
17411N/A * This program is free software; you can redistribute it
and/or 17411N/A #define NETSTATUS_IFACE_POLLS_IN_ERROR 10 /* no. of polls in error before increasing delay */
17411N/A #define NETSTATUS_IFACE_ERROR_POLL_DELAY 5000 /* delay to use when in error state */
17411N/A+#define NWAM_AUTOMATIC_SELECTION_STRING ("Automatic Selection")
17411N/A+#define NETSTATUS_IFACE_RESTART_SCRIPT_TESTFLAGS (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK | G_FILE_TEST_IS_EXECUTABLE)
17411N/A+ gboolean track_active_interface;
17411N/A static void netstatus_iface_instance_init (NetstatusIface *iface,
18350N/A@@ -97,10 +136,12 @@ static void netstatus_iface_get_prop
17411N/A static gboolean netstatus_iface_monitor_timeout (NetstatusIface *iface);
17411N/A static void netstatus_iface_init_monitor (NetstatusIface *iface);
17411N/A+static gboolean netstatus_iface_restart_collect_output (NetstatusIface *iface);
17411N/A static GObjectClass *parent_class;
17411N/A+static guint netstatus_iface_signals[LAST_SIGNAL] = { 0 };
17411N/A netstatus_iface_get_type (void)
18350N/A@@ -128,14 +169,24 @@ netstatus_iface_get_type (void)
17411N/A netstatus_iface_instance_init (NetstatusIface *iface,
17411N/A iface->priv = g_new0 (NetstatusIfacePrivate, 1);
17411N/A iface->priv->state = NETSTATUS_STATE_DISCONNECTED;
17411N/A+ iface->priv->restart_status = -1; /* never restarted */
17411N/A+ iface->priv->restart_output = NULL;
17411N/A+ iface->priv->restart_outioc = NULL;
17411N/A+ iface->priv->restart_errioc = NULL;
17411N/A+ iface->priv->track_active_interface = FALSE;
17411N/A+ iface->priv->active_interface = NULL;
18350N/A@@ -183,6 +234,86 @@ netstatus_iface_class_init (NetstatusIfa
17411N/A g_object_class_install_property (gobject_class,
17411N/A+ g_param_spec_boolean ("track_active_interface",
17411N/A+ _("Whether to track the system's active interface"),
17411N/A+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A+ g_param_spec_string ("bss_mode",
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A+ g_param_spec_boolean ("connected",
17411N/A+ _("Whether the interface is connected"),
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A+ g_param_spec_string ("security",
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A+ g_param_spec_string ("auth_mode",
17411N/A+ g_object_class_install_property (gobject_class,
17411N/A g_param_spec_int ("signal-strength",
18350N/A@@ -199,6 +330,16 @@ netstatus_iface_class_init (NetstatusIfa
17411N/A _("The current error condition"),
17411N/A G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
17411N/A+ netstatus_iface_signals[RESTART_STATE] = g_signal_new (
17411N/A+ NETSTATUS_IFACE_SIGNAL_RESTART_STATE,
17411N/A+ G_TYPE_FROM_CLASS (gobject_class),
17411N/A+ G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
17411N/A+ G_STRUCT_OFFSET (NetstatusIfaceClass, restart_complete),
17411N/A+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
18350N/A@@ -221,6 +362,29 @@ netstatus_iface_finalize (GObject *objec
17411N/A+ g_free (iface->priv->bss_mode);
17411N/A+ g_free (iface->priv->security);
17411N/A+ g_free (iface->priv->auth_mode);
17411N/A+ iface->priv->auth_mode = NULL;
17411N/A+ netstatus_iface_restart_collect_output (iface);
17411N/A+ if (iface->priv->restart_output != NULL)
17411N/A+ g_free (iface->priv->restart_output);
17411N/A+ iface->priv->restart_output = NULL;
18350N/A@@ -240,6 +404,9 @@ netstatus_iface_set_property (GObject
17411N/A netstatus_iface_set_name (iface, g_value_get_string (value));
17411N/A+ case PROP_TRACK_ACTIVE_INTERFACE:
17411N/A+ netstatus_iface_set_track_active_interface(iface, g_value_get_boolean (value));
17411N/A netstatus_iface_set_error (iface, g_value_get_boxed (value));
18350N/A@@ -271,9 +438,33 @@ netstatus_iface_get_property (GObject
17411N/A g_value_set_boolean (value, iface->priv->is_wireless);
17411N/A+ case PROP_TRACK_ACTIVE_INTERFACE:
17411N/A+ g_value_set_boolean (value, iface->priv->track_active_interface);
17411N/A+ g_value_set_string (value, iface->priv->essid);
17411N/A g_value_set_int (value, iface->priv->signal_strength);
17411N/A+ g_value_set_string (value, iface->priv->bssid);
17411N/A+ g_value_set_string (value, iface->priv->bss_mode);
17411N/A+ g_value_set_string (value, iface->priv->mode);
17411N/A+ g_value_set_boolean (value, iface->priv->connected);
17411N/A+ g_value_set_string (value, iface->priv->security);
17411N/A+ g_value_set_string (value, iface->priv->auth_mode);
17411N/A g_value_set_boxed (value, iface->priv->error);
18350N/A@@ -349,6 +540,14 @@ netstatus_iface_get_is_wireless (Netstat
17411N/A return iface->priv->is_wireless;
17411N/A+netstatus_iface_get_is_connected (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), FALSE);
17411N/A+ return iface->priv->connected;
17411N/A netstatus_iface_get_signal_strength (NetstatusIface *iface)
18350N/A@@ -357,6 +556,116 @@ netstatus_iface_get_signal_strength (Net
17411N/A return iface->priv->signal_strength;
17411N/A+netstatus_iface_get_essid (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), 0);
17411N/A+netstatus_iface_get_bssid (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), 0);
17411N/A+netstatus_iface_get_bss_mode (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), bss_mode );
17411N/A+ if ( iface->priv->bss_mode == NULL ) {
17411N/A+ if ( strcmp( iface->priv->bss_mode, "bss") == 0 ) {
17411N/A+ bss_mode = _("Infrastructure");
17411N/A+ if ( strcmp( iface->priv->bss_mode, "ibss") == 0 ) {
17411N/A+ bss_mode = _("Computer-to-Computer (Ad Hoc)");
17411N/A+ else if ( strcmp( iface->priv->bss_mode, "any") == 0 ) {
17411N/A+netstatus_iface_get_mode (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), 0);
17411N/A+netstatus_iface_get_security (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), 0);
17411N/A+ if ( iface->priv->security == NULL ) {
17411N/A+ if ( strcmp( iface->priv->security, "none") == 0 ) {
17411N/A+ if ( strcmp( iface->priv->security, "wep") == 0 ) {
17411N/A+ if ( strcmp( iface->priv->security, "wpa") == 0 ) {
17411N/A+ security = iface->priv->security;
17411N/A+netstatus_iface_get_auth_mode (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), 0);
17411N/A+ if ( iface->priv->auth_mode == NULL ) {
17411N/A+ if ( strcmp( iface->priv->auth_mode, "open") == 0 ) {
17411N/A+ if ( strcmp( iface->priv->auth_mode, "shared") == 0 ) {
17411N/A+ auth_mode = iface->priv->auth_mode;
17411N/A netstatus_iface_set_error (NetstatusIface *iface,
18350N/A@@ -553,14 +862,57 @@ netstatus_iface_poll_state (NetstatusIfa
17411N/A netstatus_iface_poll_wireless_details (NetstatusIface *iface,
17411N/A+ wifi_info_t* wi = netstatus_sysdeps_read_iface_wireless_details (iface->priv->name);
17411N/A+ *signal_strength = wi->signal_strength;
17411N/A+ *essid = g_strdup( wi->essid );
17411N/A+ *bssid = g_strdup( wi->bssid );
17411N/A+ *bss_mode = g_strdup( wi->bss_mode );
17411N/A+ *security = g_strdup( wi->security );
17411N/A+ *auth_mode = g_strdup( wi->auth_mode );
17411N/A error_message = netstatus_sysdeps_read_iface_wireless_details (iface->priv->name,
18350N/A@@ -574,6 +926,7 @@ netstatus_iface_poll_wireless_details (N
17411N/A netstatus_iface_clear_error (iface, NETSTATUS_ERROR_WIRELESS_DETAILS);
18350N/A@@ -611,12 +964,21 @@ netstatus_iface_increase_poll_delay_in_e
17411N/A netstatus_iface_monitor_timeout (NetstatusIface *iface)
17411N/A state = netstatus_iface_poll_state (iface);
18350N/A@@ -627,19 +989,115 @@ netstatus_iface_monitor_timeout (Netstat
17411N/A g_object_notify (G_OBJECT (iface), "state");
17411N/A- is_wireless = netstatus_iface_poll_wireless_details (iface, &signal_strength);
18350N/A+ /* Look for another interface it tracking active i/f */
18350N/A+ netstatus_iface_find_active_interface (iface);
17411N/A+ is_wireless = netstatus_iface_poll_wireless_details (iface, &signal_strength, &connected, &essid,
17411N/A+ &bssid, &bss_mode, &mode, &security, &auth_mode );
17411N/A if (iface->priv->is_wireless != is_wireless)
17411N/A iface->priv->is_wireless = is_wireless;
17411N/A g_object_notify (G_OBJECT (iface), "wireless");
17411N/A- if (iface->priv->signal_strength != signal_strength)
17411N/A- iface->priv->signal_strength = signal_strength;
17411N/A- g_object_notify (G_OBJECT (iface), "signal-strength");
17411N/A+ if (iface->priv->connected != connected)
17411N/A+ iface->priv->connected = connected;
17411N/A+ g_object_notify (G_OBJECT (iface), "connected");
17411N/A+ if (iface->priv->signal_strength != signal_strength)
17411N/A+ iface->priv->signal_strength = signal_strength;
17411N/A+ g_object_notify (G_OBJECT (iface), "signal-strength");
17411N/A+ if (iface->priv->essid == NULL ||
17411N/A+ ( essid != NULL && strcmp(iface->priv->essid, essid ) != 0 ) )
17411N/A+ if ( iface->priv->essid != NULL )
17411N/A+ g_object_notify (G_OBJECT (iface), "essid");
17411N/A+ if (iface->priv->bssid == NULL ||
17411N/A+ ( bssid != NULL && strcmp(iface->priv->bssid, bssid ) != 0 ) )
17411N/A+ if ( iface->priv->bssid != NULL )
17411N/A+ g_object_notify (G_OBJECT (iface), "bssid");
17411N/A+ if (iface->priv->bss_mode == NULL ||
17411N/A+ ( bss_mode != NULL && strcmp(iface->priv->bss_mode, bss_mode ) != 0 ) )
17411N/A+ if ( iface->priv->bss_mode != NULL )
17411N/A+ g_free(iface->priv->bss_mode);
17411N/A+ iface->priv->bss_mode = bss_mode;
17411N/A+ g_object_notify (G_OBJECT (iface), "bss_mode");
17411N/A+ if (iface->priv->mode == NULL ||
17411N/A+ ( mode != NULL && strcmp(iface->priv->mode, mode ) != 0 ) )
17411N/A+ if ( iface->priv->mode != NULL )
17411N/A+ g_object_notify (G_OBJECT (iface), "mode");
17411N/A+ if (iface->priv->security == NULL ||
17411N/A+ ( security != NULL && strcmp(iface->priv->security, security ) != 0 ) )
17411N/A+ if ( iface->priv->security != NULL )
17411N/A+ g_free(iface->priv->security);
17411N/A+ iface->priv->security = security;
17411N/A+ g_object_notify (G_OBJECT (iface), "security");
17411N/A+ if (iface->priv->auth_mode == NULL ||
17411N/A+ ( auth_mode != NULL && strcmp(iface->priv->auth_mode, auth_mode ) != 0 ) )
17411N/A+ if ( iface->priv->auth_mode != NULL )
17411N/A+ g_free(iface->priv->auth_mode);
17411N/A+ iface->priv->auth_mode = auth_mode;
17411N/A+ g_object_notify (G_OBJECT (iface), "auth_mode");
17411N/A netstatus_iface_increase_poll_delay_in_error (iface);
18350N/A@@ -653,12 +1111,20 @@ netstatus_iface_init_monitor (NetstatusI
17411N/A iface->priv->signal_strength = 0;
17411N/A iface->priv->is_wireless = FALSE;
17411N/A+ iface->priv->connected = FALSE;
17411N/A+ iface->priv->auth_mode = NULL;
17411N/A g_object_freeze_notify (G_OBJECT (iface));
17411N/A g_object_notify (G_OBJECT (iface), "state");
17411N/A g_object_notify (G_OBJECT (iface), "wireless");
17411N/A g_object_notify (G_OBJECT (iface), "signal-strength");
17411N/A+ g_object_notify (G_OBJECT (iface), "essid");
17411N/A g_object_thaw_notify (G_OBJECT (iface));
18350N/A@@ -1024,7 +1490,7 @@ netstatus_iface_get_hw_details (Netstatu
18350N/A+#if defined(SIOCGIFHWADDR) && !defined(sun)
18350N/A static struct HwType *hw_type = NULL;
18350N/A@@ -1192,6 +1658,7 @@ netstatus_list_interface_names (GError *
18350N/A@@ -1214,11 +1681,13 @@ netstatus_list_interface_names (GError *
17411N/A for (p = if_conf->ifc_buf; p < if_conf->ifc_buf + if_conf->ifc_len;)
17411N/A struct ifreq *if_req = (struct ifreq *) p;
17411N/A p += sizeof (if_req->ifr_name) + NETSTATUS_SA_LEN (&if_req->ifr_addr);
18350N/A@@ -1233,16 +1702,21 @@ netstatus_list_interface_names (GError *
17411N/A loopback = (if_req->ifr_flags & IFF_LOOPBACK);
17411N/A+ p2p = (if_req->ifr_flags & IFF_POINTOPOINT);
17411N/A- interfaces = netstatus_list_insert_unique (interfaces,
17411N/A+ loopbacks = netstatus_list_insert_unique (loopbacks,
17411N/A+ point_to_points = netstatus_list_insert_unique (point_to_points,
17411N/A- loopbacks = netstatus_list_insert_unique (loopbacks,
17411N/A+ interfaces = netstatus_list_insert_unique (interfaces,
17411N/A+ interfaces = g_list_concat (interfaces, point_to_points );
17411N/A interfaces = g_list_concat (interfaces, loopbacks);
18350N/A@@ -1256,3 +1730,323 @@ netstatus_list_interface_names (GError *
17411N/A+ * Returns TRUE if the ifrestart script is installed.
17411N/A+netstatus_iface_restart_available (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail ((iface != NULL), FALSE);
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), FALSE);
17411N/A+ NETSTATUS_IFACE_RESTART_SCRIPT, NETSTATUS_IFACE_RESTART_SCRIPT_TESTFLAGS);
17411N/A+ * Returns TRUE if the restart in progress.
17411N/A+netstatus_iface_restart_inprogress (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail ((iface != NULL), FALSE);
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), FALSE);
17411N/A+ g_return_val_if_fail ((iface->priv != NULL), 0);
17411N/A+ return (iface->priv->restart_status == -2);
17411N/A+ * Sets the interface restart status and emmits the signal.
17411N/A+netstatus_iface_restart_set_status (
17411N/A+ NetstatusIface *iface, gint status)
17411N/A+ g_return_if_fail (iface != NULL);
17411N/A+ g_return_if_fail (NETSTATUS_IS_IFACE (iface));
17411N/A+ g_return_if_fail (iface->priv != NULL);
17411N/A+ /* Restart process exit status */
17411N/A+ iface->priv->restart_status = status;
17411N/A+ /* Emit restart complete signal */
17411N/A+ netstatus_iface_signals[RESTART_STATE], 0);
17411N/A+ * Collect output and release IOChannels.
17411N/A+ * This method returns TRUE if the error output was empty.
17411N/A+netstatus_iface_restart_collect_output (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail ((iface != NULL), FALSE);
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), FALSE);
17411N/A+ g_return_val_if_fail ((iface->priv != NULL), FALSE);
17411N/A+ if (iface->priv->restart_outioc != NULL)
17411N/A+ g_io_channel_read_to_end (iface->priv->restart_outioc,
17411N/A+ g_io_channel_shutdown (iface->priv->restart_outioc, FALSE, &error);
17411N/A+ g_io_channel_unref (iface->priv->restart_outioc);
17411N/A+ iface->priv->restart_outioc = NULL;
17411N/A+ if (iface->priv->restart_errioc != NULL)
17411N/A+ g_io_channel_read_to_end (iface->priv->restart_errioc,
17411N/A+ g_io_channel_shutdown (iface->priv->restart_errioc, FALSE, &error);
17411N/A+ g_io_channel_unref (iface->priv->restart_errioc);
17411N/A+ iface->priv->restart_errioc = NULL;
17411N/A+ /* Release the last interface restart output */
17411N/A+ if (iface->priv->restart_output != NULL)
17411N/A+ g_free (iface->priv->restart_output);
17411N/A+ iface->priv->restart_output == NULL;
17411N/A+ iface->priv->restart_output = g_strdup (errstr);
17411N/A+ iface->priv->restart_output = g_strdup (outstr);
17411N/A+ * Interface restart completition routine.
17411N/A+netstatus_iface_restart_complete (
17411N/A+ GPid pid, gint status, NetstatusIface *iface)
17411N/A+ g_return_if_fail (iface != NULL);
17411N/A+ g_return_if_fail (NETSTATUS_IS_IFACE (iface));
17411N/A+ g_return_if_fail (iface->priv != NULL);
17411N/A+ iface->priv->restart_cwsource = 0;
17411N/A+ /* Release the output and error IOChannels */
17411N/A+ if (netstatus_iface_restart_collect_output (iface))
17411N/A+ netstatus_iface_restart_set_status (iface, status);
17411N/A+ netstatus_iface_restart_set_status (iface, (status == 0)? 9999: status);
17411N/A+ * Initiates the restart for current interface and returns pid of
17411N/A+ * the restart process. Returns 0 if the restart fails.
17411N/A+netstatus_iface_restart (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail ((iface != NULL), 0);
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), 0);
17411N/A+ g_return_val_if_fail ((iface->priv != NULL), 0);
17411N/A+ g_return_val_if_fail ((netstatus_iface_restart_inprogress (iface) == FALSE), 0);
17411N/A+ g_return_val_if_fail ((netstatus_iface_get_name (iface) != NULL), 0);
17411N/A+ /* Release the last interface restart output */
17411N/A+ iface->priv->restart_outioc = NULL;
17411N/A+ iface->priv->restart_errioc = NULL;
17411N/A+ if (iface->priv->restart_output != NULL)
17411N/A+ g_free (iface->priv->restart_output);
17411N/A+ iface->priv->restart_output = NULL;
17411N/A+ netstatus_iface_restart_set_status (iface, -2); /* is restarting */
17411N/A+ argv[0] = g_strdup (NETSTATUS_IFACE_RESTART_SCRIPT);
17411N/A+ argv[1] = g_strdup (netstatus_iface_get_name (iface));
17411N/A+ result = g_spawn_async_with_pipes (
17411N/A+ NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
17411N/A+ /* Clean up on unsuccessful spawn */
17411N/A+ netstatus_iface_restart_complete (0, G_SPAWN_ERROR_FAILED, iface);
17411N/A+ iface->priv->restart_outioc = g_io_channel_unix_new (out_fd);
17411N/A+ iface->priv->restart_errioc = g_io_channel_unix_new (err_fd);
17411N/A+ /* Set up the completition routine */
17411N/A+ iface->priv->restart_cwsource = g_child_watch_add (iface->priv->restart_pid,
17411N/A+ (GChildWatchFunc)netstatus_iface_restart_complete, iface);
17411N/A+ return iface->priv->restart_pid;
17411N/A+ * Returns the process exit status of the last interface restart.
17411N/A+netstatus_iface_restart_get_status (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail ((iface != NULL), -1);
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), -1);
17411N/A+ g_return_val_if_fail ((iface->priv != NULL), -1);
17411N/A+ return iface->priv->restart_status;
17411N/A+ * Returns an output of the last interface restart.
17411N/A+netstatus_iface_restart_get_output (NetstatusIface *iface)
17411N/A+ g_return_val_if_fail ((iface != NULL), "");
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), "");
17411N/A+ g_return_val_if_fail ((iface->priv != NULL), "");
17411N/A+ return (iface->priv->restart_output)? iface->priv->restart_output: "";
17411N/A+netstatus_iface_restart_interrupt (NetstatusIface *iface)
17411N/A+ g_return_if_fail (iface != NULL);
17411N/A+ g_return_if_fail (NETSTATUS_IS_IFACE (iface));
17411N/A+ g_return_if_fail (iface->priv != NULL);
17411N/A+ g_return_if_fail (netstatus_iface_restart_inprogress (iface) == TRUE);
17411N/A+ kill (iface->priv->restart_pid, SIGKILL);
17411N/A+netstatus_iface_get_track_active_interface (NetstatusIface *iface)
17411N/A+ gboolean track_active = FALSE;
17411N/A+ g_return_val_if_fail (iface != NULL, track_active );
17411N/A+ g_return_val_if_fail (NETSTATUS_IS_IFACE (iface), track_active );
17411N/A+ g_return_val_if_fail (iface->priv != NULL, track_active );
17411N/A+ track_active = iface->priv->track_active_interface;
17411N/A+netstatus_iface_set_track_active_interface (NetstatusIface *iface, gboolean track_active )
17411N/A+ g_return_if_fail (iface != NULL);
17411N/A+ g_return_if_fail (NETSTATUS_IS_IFACE (iface));
17411N/A+ g_return_if_fail (iface->priv != NULL);
17411N/A+ if ( iface->priv->track_active_interface != track_active ) {
17411N/A+ iface->priv->track_active_interface = track_active;
17411N/A+ if ( iface->priv->active_interface != NULL && strlen(iface->priv->active_interface)> 0 ) {
17411N/A+ netstatus_iface_set_name( iface, iface->priv->active_interface );
17411N/A+ netstatus_iface_find_active_interface(iface);
17411N/A+ g_object_notify (G_OBJECT (iface), "track_active_interface");
17411N/A+netstatus_iface_find_active_interface (NetstatusIface *iface )
17411N/A+ g_return_if_fail (iface != NULL);
17411N/A+ g_return_if_fail (NETSTATUS_IS_IFACE (iface));
17411N/A+ g_return_if_fail (iface->priv != NULL);
17411N/A+ if (!iface->priv->track_active_interface)
17411N/A+ iface_names = netstatus_list_interface_names (&error);
17411N/A+ gulong in_packets, out_packets;
17411N/A+ * Find first non error interface.
17411N/A+ for (l = iface_names; l; l = l->next) {
17411N/A+ if ( l->data && strncmp(l->data, "lo", 2) &&
17411N/A+ (error_message = netstatus_sysdeps_read_iface_statistics (l->data,
17411N/A+ &in_packets, &out_packets, &in_bytes, &out_bytes)) == NULL ) {
17411N/A+ gchar *old_name = iface->priv->name;
17411N/A+ /* Temporarily set the name, but don't use set_name function
17411N/A+ * since it would signal a notification which we don't want here.
17411N/A+ NetstatusState state = netstatus_iface_poll_state (iface);
17411N/A+ if ( state != NETSTATUS_STATE_DISCONNECTED &&
17411N/A+ state != NETSTATUS_STATE_ERROR ) {
17411N/A+ /* Success !! make this the iface_name */
17411N/A+ } else if (error_message != NULL ) {
17411N/A+ for (l = iface_names; l; l = l->next) {
17411N/A+ /* Only free non used names */
17411N/A+ if (iface_name == NULL || strcmp(l->data, iface_name)) {
17411N/A+ netstatus_iface_set_name( iface, iface_name );
17411N/A- * Copyright (C) 2003 Sun Microsystems, Inc.
17411N/A+ * Copyright (C) 2003-2009 Sun Microsystems, Inc.
17411N/A * Copyright (C) 2004 Red Hat Inc.
17411N/A * This program is free software; you can redistribute it
and/or 17411N/A #define NETSTATUS_IS_IFACE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NETSTATUS_TYPE_IFACE))
17411N/A #define NETSTATUS_IFACE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NETSTATUS_TYPE_IFACE, NetstatusIfaceClass))
17411N/A+#define NETSTATUS_IFACE_SIGNAL_RESTART_STATE "restart_state"
17411N/A typedef struct _NetstatusIface NetstatusIface;
17411N/A typedef struct _NetstatusIfaceClass NetstatusIfaceClass;
17411N/A typedef struct _NetstatusIfacePrivate NetstatusIfacePrivate;
18350N/A@@ -53,6 +55,8 @@ struct _NetstatusIface
17411N/A+ void (*restart_complete) (GObject *iface);
17411N/A GList * netstatus_list_interface_names (GError **error);
18350N/A@@ -69,6 +73,13 @@ void netstatus_iface_g
17411N/A gboolean netstatus_iface_get_is_wireless (NetstatusIface *iface);
17411N/A int netstatus_iface_get_signal_strength (NetstatusIface *iface);
17411N/A+gboolean netstatus_iface_get_is_connected (NetstatusIface *iface);
17411N/A+G_CONST_RETURN char * netstatus_iface_get_essid (NetstatusIface *iface);
17411N/A+G_CONST_RETURN char * netstatus_iface_get_bssid (NetstatusIface *iface);
17411N/A+G_CONST_RETURN char * netstatus_iface_get_bss_mode (NetstatusIface *iface);
17411N/A+G_CONST_RETURN char * netstatus_iface_get_mode (NetstatusIface *iface);
17411N/A+G_CONST_RETURN char * netstatus_iface_get_security (NetstatusIface *iface);
17411N/A+G_CONST_RETURN char * netstatus_iface_get_auth_mode (NetstatusIface *iface);
17411N/A void netstatus_iface_set_error (NetstatusIface *iface,
18350N/A@@ -86,6 +97,17 @@ gboolean netstatus_iface_g
17411N/A gboolean netstatus_iface_get_is_loopback (NetstatusIface *iface);
17411N/A+gboolean netstatus_iface_restart_available (NetstatusIface *iface);
17411N/A+gboolean netstatus_iface_restart_inprogress (NetstatusIface *iface);
17411N/A+GPid netstatus_iface_restart (NetstatusIface *iface);
17411N/A+gint netstatus_iface_restart_get_status (NetstatusIface *iface);
17411N/A+G_CONST_RETURN gchar * netstatus_iface_restart_get_output (NetstatusIface *iface);
17411N/A+void netstatus_iface_restart_interrupt (NetstatusIface *iface);
17411N/A+gboolean netstatus_iface_get_track_active_interface (NetstatusIface *iface);
17411N/A+void netstatus_iface_set_track_active_interface (NetstatusIface *iface, gboolean track_active );
17411N/A+void netstatus_iface_find_active_interface (NetstatusIface *iface );
17411N/A #endif /* __NETSTATUS_IFACE_H__ */
17411N/A+ <owner>netstatus-applet</owner>
17411N/A+ <short>Track active Network Interface</short>
17411N/A+ <long>Have Network Monitor keep track of the active Network Interface</long>
17411N/A <!-- Yes, this key is purposely global to all instances of the applet -->
17411N/A+ guint track_active_interface_id;
17411N/A static void netstatus_applet_instance_init (NetstatusApplet *applet,
17411N/A static void netstatus_applet_display_status_dialog (NetstatusApplet *applet);
17411N/A static void netstatus_applet_iface_name_changed (NetstatusApplet *applet);
17411N/A+static void netstatus_applet_iface_track_active_changed(NetstatusApplet *applet);
17411N/A static GObjectClass *parent_class;
17411N/A G_CALLBACK (netstatus_applet_iface_name_changed),
17411N/A+ g_signal_connect_swapped (applet->priv->iface, "notify::track-active-interface",
17411N/A+ G_CALLBACK (netstatus_applet_iface_track_active_changed),
17411N/A g_signal_connect_swapped (applet->priv->icon, "invoked",
17411N/A G_CALLBACK (netstatus_applet_display_status_dialog),
17411N/A gconf_client_notify_remove (applet->priv->client, applet->priv->notify_id);
17411N/A+ if (applet->priv->track_active_interface_id)
17411N/A+ gconf_client_notify_remove (applet->priv->client, applet->priv->track_active_interface_id);
17411N/A+ applet->priv->track_active_interface_id = 0;
17411N/A g_object_unref (applet->priv->client);
17411N/A+netstatus_applet_iface_track_active_changed(NetstatusApplet *applet)
17411N/A+ track_active = netstatus_iface_get_track_active_interface (applet->priv->iface);
17411N/A+ panel_applet_gconf_set_bool(PANEL_APPLET (applet),
17411N/A netstatus_applet_iface_name_changed (NetstatusApplet *applet)
17411N/A if (entry->value && entry->value->type == GCONF_VALUE_STRING)
17411N/A- iface_name = gconf_value_get_string (entry->value);
17411N/A- netstatus_iface_set_name (applet->priv->iface, iface_name);
17411N/A+ track_active = netstatus_iface_get_track_active_interface(applet->priv->iface);
17411N/A+ iface_name = gconf_value_get_string (entry->value);
17411N/A+ netstatus_iface_set_name (applet->priv->iface, iface_name);
17411N/A+netstatus_applet_iface_track_active_interface_changed (GConfClient *client,
17411N/A+ if (entry->value && entry->value->type == GCONF_VALUE_BOOL)
17411N/A+ track_active = gconf_value_get_bool(entry->value);
17411N/A+ netstatus_iface_set_track_active_interface (applet->priv->iface, track_active);
17411N/A netstatus_applet_create (NetstatusApplet *applet,
17411N/A+ gboolean track_active = FALSE;
17411N/A panel_applet_add_preferences (PANEL_APPLET (applet),
17411N/A- iface_name = panel_applet_gconf_get_string (PANEL_APPLET (applet),
17411N/A- if (!iface_name || !iface_name [0])
17411N/A- iface_names = netstatus_list_interface_names (&error);
17411N/A- /* FIXME: instead of picking the first one we should
17411N/A- * figure out what interfaces aren't currently
17411N/A- iface_name = iface_names->data;
17411N/A- for (l = iface_names->next; l; l = l->next)
17411N/A- g_object_set (G_OBJECT (applet->priv->iface),
17411N/A- netstatus_iface_set_name (applet->priv->iface, iface_name);
17411N/A+ track_active = panel_applet_gconf_get_bool (PANEL_APPLET (applet),
17411N/A+ netstatus_iface_set_track_active_interface (applet->priv->iface, track_active );
17411N/A+ iface_name = panel_applet_gconf_get_string (PANEL_APPLET (applet),
17411N/A+ if (!iface_name || !iface_name [0])
17411N/A+ iface_names = netstatus_list_interface_names (&error);
17411N/A+ /* FIXME: instead of picking the first one we should
17411N/A+ * figure out what interfaces aren't currently
17411N/A+ iface_name = iface_names->data;
17411N/A+ for (l = iface_names->next; l; l = l->next)
17411N/A+ g_object_set (G_OBJECT (applet->priv->iface),
17411N/A+ netstatus_iface_set_name (applet->priv->iface, iface_name);
17411N/A key = panel_applet_gconf_get_full_key (PANEL_APPLET (applet), "interface");
17411N/A+ key = panel_applet_gconf_get_full_key (PANEL_APPLET (applet), "track_active_interface");
17411N/A+ applet->priv->track_active_interface_id =
17411N/A+ gconf_client_notify_add (applet->priv->client,
17411N/A+ (GConfClientNotifyFunc) netstatus_applet_iface_track_active_interface_changed,
17411N/A install-data-hook: update-icon-cache
17411N/A echo "*** $(gtk_update_icon_cache)"; \
17411N/A GdkPixbuf *icons [NETSTATUS_STATE_LAST];
17411N/A GdkPixbuf *scaled_icons [NETSTATUS_STATE_LAST];
17411N/A+ GdkPixbuf *wireless_icons [NETSTATUS_STATE_LAST];
17411N/A+ GdkPixbuf *scaled_wireless_icons [NETSTATUS_STATE_LAST];
17411N/A GdkPixbuf *signal_icons [NETSTATUS_SIGNAL_LAST];
17411N/A GdkPixbuf *rotated_signal_icons [NETSTATUS_SIGNAL_LAST];
17411N/A GdkPixbuf *scaled_signal_icons [NETSTATUS_SIGNAL_LAST];
17411N/A+ GdkPixbuf *rendered_wireless_pixbufs[NETSTATUS_STATE_LAST][NETSTATUS_SIGNAL_LAST];
17411N/A for (i = 0; i < NETSTATUS_STATE_LAST; i++)
17411N/A- g_object_unref (icon->priv->scaled_icons [i]);
17411N/A- icon->priv->scaled_icons [i] = NULL;
17411N/A+ if ( icon->priv->scaled_icons [i] != NULL ) {
17411N/A+ g_object_unref (icon->priv->scaled_icons [i]);
17411N/A+ icon->priv->scaled_icons [i] = NULL;
17411N/A g_object_unref (icon->priv->icons [i]);
17411N/A+ g_object_unref (icon->priv->wireless_icons [i]);
17411N/A+ icon->priv->wireless_icons [i] = NULL;
17411N/A+ if ( icon->priv->scaled_wireless_icons [i] != NULL ) {
17411N/A+ g_object_unref(icon->priv->scaled_wireless_icons [i]);
17411N/A+ icon->priv->scaled_wireless_icons [i] = NULL;
17411N/A for (i = 0; i < NETSTATUS_SIGNAL_LAST; i++)
17411N/A- g_object_unref (icon->priv->scaled_signal_icons [i]);
17411N/A- icon->priv->scaled_signal_icons [i] = NULL;
17411N/A- g_object_unref (icon->priv->signal_icons [i]);
17411N/A- icon->priv->signal_icons [i] = NULL;
17411N/A+ if ( icon->priv->scaled_signal_icons [i] != NULL ) {
17411N/A+ g_object_unref (icon->priv->scaled_signal_icons [i]);
17411N/A+ icon->priv->scaled_signal_icons [i] = NULL;
17411N/A+ if ( icon->priv->signal_icons [i] != NULL ) {
17411N/A+ g_object_unref (icon->priv->signal_icons [i]);
17411N/A+ icon->priv->signal_icons [i] = NULL;
17411N/A+ for (i = 0; i < NETSTATUS_STATE_LAST; i++) {
17411N/A+ for (int j = 0; j < NETSTATUS_SIGNAL_LAST; j++) {
17411N/A+ if ( icon->priv->rendered_wireless_pixbufs[i][j] != NULL ) {
17411N/A+ g_object_unref(icon->priv->rendered_wireless_pixbufs[i][j]);
17411N/A+ icon->priv->rendered_wireless_pixbufs[i][j] = NULL;
17411N/A- netstatus_icon_init_pixbufs (icon);
17411N/A screen = gtk_widget_get_screen (GTK_WIDGET (icon));
17411N/A icon->priv->icon_theme = gtk_icon_theme_get_for_screen (screen);
17411N/A+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
17411N/A+ NETSTATUS_DATA_DIR G_DIR_SEPARATOR_S "icons");
17411N/A g_signal_connect_object (icon->priv->icon_theme, "changed",
17411N/A G_CALLBACK (netstatus_icon_theme_changed),
17411N/A netstatus_icon_init_pixbuf (icon,
17411N/A &icon->priv->icons [NETSTATUS_STATE_DISCONNECTED],
17411N/A icon->priv->scaled_icons [NETSTATUS_STATE_DISCONNECTED] = NULL;
17411N/A netstatus_icon_init_pixbuf (icon,
17411N/A &icon->priv->icons [NETSTATUS_STATE_IDLE],
17411N/A icon->priv->scaled_icons [NETSTATUS_STATE_IDLE] = NULL;
17411N/A netstatus_icon_init_pixbuf (icon,
17411N/A &icon->priv->icons [NETSTATUS_STATE_TX],
17411N/A icon->priv->scaled_icons [NETSTATUS_STATE_TX] = NULL;
17411N/A netstatus_icon_init_pixbuf (icon,
17411N/A &icon->priv->icons [NETSTATUS_STATE_RX],
17411N/A icon->priv->scaled_icons [NETSTATUS_STATE_RX] = NULL;
17411N/A netstatus_icon_init_pixbuf (icon,
17411N/A &icon->priv->icons [NETSTATUS_STATE_TX_RX],
17411N/A icon->priv->scaled_icons [NETSTATUS_STATE_TX_RX] = NULL;
17411N/A netstatus_icon_init_pixbuf (icon,
17411N/A &icon->priv->icons [NETSTATUS_STATE_ERROR],
17411N/A icon->priv->scaled_icons [NETSTATUS_STATE_ERROR] = NULL;
17411N/A netstatus_icon_init_pixbuf (icon,
17411N/A icon->priv->rotated_signal_icons [NETSTATUS_SIGNAL_75_100] = NULL;
17411N/A icon->priv->scaled_signal_icons [NETSTATUS_SIGNAL_75_100] = NULL;
17411N/A+ /* Load rx, tx, error, disconnect icons for wireless */
17411N/A+ netstatus_icon_init_pixbuf (icon,
17411N/A+ &icon->priv->wireless_icons [NETSTATUS_STATE_TX],
17411N/A+ "gnome-netstatus-wireless-transmit");
17411N/A+ icon->priv->scaled_wireless_icons [NETSTATUS_STATE_TX] = NULL;
17411N/A+ netstatus_icon_init_pixbuf (icon,
17411N/A+ &icon->priv->wireless_icons [NETSTATUS_STATE_RX],
17411N/A+ "gnome-netstatus-wireless-receive");
17411N/A+ icon->priv->scaled_wireless_icons [NETSTATUS_STATE_RX] = NULL;
17411N/A+ netstatus_icon_init_pixbuf (icon,
17411N/A+ &icon->priv->wireless_icons [NETSTATUS_STATE_TX_RX],
17411N/A+ "gnome-netstatus-wireless-transmit-receive");
17411N/A+ icon->priv->scaled_wireless_icons [NETSTATUS_STATE_TX_RX] = NULL;
17411N/A+ netstatus_icon_init_pixbuf (icon,
17411N/A+ &icon->priv->wireless_icons [NETSTATUS_STATE_DISCONNECTED],
17411N/A+ "gnome-netstatus-wireless-offline");
17411N/A+ icon->priv->scaled_wireless_icons [NETSTATUS_STATE_DISCONNECTED] = NULL;
17411N/A+ netstatus_icon_init_pixbuf (icon,
17411N/A+ &icon->priv->wireless_icons [NETSTATUS_STATE_IDLE],
17411N/A+ "gnome-netstatus-wireless-idle");
17411N/A+ icon->priv->scaled_wireless_icons [NETSTATUS_STATE_IDLE] = NULL;
17411N/A+ netstatus_icon_init_pixbuf (icon,
17411N/A+ &icon->priv->wireless_icons [NETSTATUS_STATE_ERROR],
17411N/A+ "gnome-netstatus-wireless-error");
17411N/A+ icon->priv->scaled_wireless_icons [NETSTATUS_STATE_ERROR] = NULL;
17411N/A netstatus_icon_rotate_signal_icons (icon, icon->priv->orientation);
17411N/A if (gtk_image_get_pixbuf (GTK_IMAGE (icon->priv->image)) != pixbuf)
17411N/A gtk_image_set_from_pixbuf (GTK_IMAGE (icon->priv->image), pixbuf);
17411N/A- pixbuf = icon->priv->scaled_signal_icons [icon->priv->signal_strength];
17411N/A- pixbuf = icon->priv->rotated_signal_icons [icon->priv->signal_strength];
17411N/A- if (gtk_image_get_pixbuf (GTK_IMAGE (icon->priv->signal_image)) != pixbuf)
17411N/A- gtk_image_set_from_pixbuf (GTK_IMAGE (icon->priv->signal_image), pixbuf);
17411N/A+ if (netstatus_iface_get_is_wireless (icon->priv->iface)) {
17411N/A+ /* Merge Signal + Status Pixmaps for wireless icon */
17411N/A+ GdkPixbuf *wireless_state_pixbuf;
17411N/A+ if ( icon->priv->rendered_wireless_pixbufs[icon->priv->state][icon->priv->signal_strength] == NULL ) {
17411N/A+ state_pixbuf = icon->priv->scaled_wireless_icons [icon->priv->state];
17411N/A+ state_pixbuf = icon->priv->wireless_icons [icon->priv->state];
17411N/A+ signal_pixbuf = icon->priv->scaled_signal_icons [icon->priv->signal_strength];
17411N/A+ signal_pixbuf = icon->priv->rotated_signal_icons [icon->priv->signal_strength];
17411N/A+ rendered_pixbuf = gdk_pixbuf_copy(signal_pixbuf);
17411N/A+ back_width = gdk_pixbuf_get_width (rendered_pixbuf);
17411N/A+ back_height = gdk_pixbuf_get_height (rendered_pixbuf);
17411N/A+ gdk_pixbuf_composite (state_pixbuf,
17411N/A+ icon->priv->rendered_wireless_pixbufs[icon->priv->state][icon->priv->signal_strength] = rendered_pixbuf;
17411N/A+ /* TODO - Do we handle rotation?
17411N/A+ pixbuf = icon->priv->scaled_signal_icons [icon->priv->signal_strength];
17411N/A+ pixbuf = icon->priv->rotated_signal_icons [icon->priv->signal_strength];
17411N/A+ pixbuf = icon->priv->rendered_wireless_pixbufs[icon->priv->state][icon->priv->signal_strength];
17411N/A+ if (gtk_image_get_pixbuf (GTK_IMAGE (icon->priv->signal_image)) != pixbuf)
17411N/A+ gtk_image_set_from_pixbuf (GTK_IMAGE (icon->priv->signal_image), pixbuf);
17411N/A-netstatus_icon_name_changed (NetstatusIface *iface,
17411N/A- iface_name = netstatus_iface_get_name (icon->priv->iface);
17411N/A- state_string = netstatus_get_state_string (icon->priv->state);
17411N/A- freeme = g_strdup_printf (_("Network Connection: %s\n%s"), iface_name, state_string);
17411N/A- tip = _("Network Connection");
17411N/A- gtk_widget_set_tooltip_text (GTK_WIDGET (icon), tip);
17411N/A+netstatus_icon_query_tooltip( NetstatusIcon *icon,
17411N/A+ const char *iface_name = NULL;
17411N/A+ GString *tooltip_markup = g_string_new("<tt>");
17411N/A+ if ( !icon->priv->tooltips_enabled )
17411N/A+ if (icon->priv->iface != NULL ) {
17411N/A+ if ( netstatus_iface_get_is_wireless (icon->priv->iface)) {
17411N/A+ iface_essid = netstatus_iface_get_essid (icon->priv->iface);
17411N/A+ iface_bss_mode = netstatus_iface_get_bss_mode (icon->priv->iface);
17411N/A+ signal_strength = netstatus_iface_get_signal_strength (icon->priv->iface);
17411N/A+ g_string_append_printf(tooltip_markup, _("<b>%-20s</b>: %s"),
17411N/A+ _("Wireless Network"), iface_essid );
17411N/A+ g_string_append(tooltip_markup, "\n");
17411N/A+ g_string_append_printf(tooltip_markup, _("<b>%-20s</b>: %d%%"),
17411N/A+ _("Signal Strength"), signal_strength );
17411N/A+ g_string_append(tooltip_markup, "\n");
17411N/A+ if ( iface_bss_mode != NULL ) {
17411N/A+ g_string_append_printf(tooltip_markup, _("<b>%-20s</b>: %s"),
17411N/A+ _("Operational Mode"), iface_bss_mode );
17411N/A+ g_string_append(tooltip_markup, "\n");
17411N/A+ iface_name = netstatus_iface_get_name (icon->priv->iface);
17411N/A+ netstatus_iface_get_inet4_details (icon->priv->iface, &ipaddr, NULL, NULL, NULL );
17411N/A+ g_string_append_printf(tooltip_markup, _("<b>%-20s</b>: %s"),
17411N/A+ _("IP Address (v4)"), ipaddr );
17411N/A+ g_string_append(tooltip_markup, "\n");
17411N/A+ g_string_append_printf(tooltip_markup, _("<b>%-20s</b>: %s"), _("Network Connection"), iface_name );
17411N/A+ g_string_append_printf(tooltip_markup, _("Network Connection") );
17411N/A+ g_string_append(tooltip_markup, "</tt>");
17411N/A+ cstr = g_string_free(tooltip_markup, FALSE);
17411N/A+ gtk_tooltip_set_markup( tooltip, cstr );
17411N/A netstatus_icon_update_image (icon);
17411N/A- netstatus_icon_name_changed (icon->priv->iface, NULL, icon);
17411N/A- if (netstatus_iface_get_is_wireless (iface) && icon->priv->show_signal)
17411N/A+ netstatus_icon_update_image (icon);
17411N/A+ if (netstatus_iface_get_is_wireless (iface) && icon->priv->show_signal) {
17411N/A+ gtk_widget_hide (icon->priv->image);
17411N/A gtk_widget_show (icon->priv->signal_image);
17411N/A+ gtk_widget_show (icon->priv->image);
17411N/A gtk_widget_hide (icon->priv->signal_image);
17411N/A gtk_widget_destroy (icon->priv->error_dialog);
17411N/A icon->priv->error_dialog = NULL;
17411N/A+ if ( icon->priv->query_tooltip_id ) {
17411N/A+ g_signal_handler_disconnect (icon,
17411N/A+ icon->priv->query_tooltip_id);
17411N/A+ icon->priv->query_tooltip_id = 0;
17411N/A if (icon->priv->state_changed_id)
17411N/A g_assert (icon->priv->iface != NULL);
17411N/A- g_assert (icon->priv->name_changed_id != 0);
17411N/A g_signal_handler_disconnect (icon->priv->iface,
17411N/A g_signal_handler_disconnect (icon->priv->iface,
17411N/A- g_signal_handler_disconnect (icon->priv->iface,
17411N/A icon->priv->wireless_changed_id);
17411N/A g_signal_handler_disconnect (icon->priv->iface,
17411N/A icon->priv->signal_changed_id);
17411N/A icon->priv->state_changed_id = 0;
17411N/A- icon->priv->name_changed_id = 0;
17411N/A icon->priv->wireless_changed_id = 0;
17411N/A icon->priv->signal_changed_id = 0;
17411N/A+ for (i = 0; i < NETSTATUS_STATE_LAST; i++)
17411N/A+ if (icon->priv->scaled_wireless_icons [i])
17411N/A+ g_object_unref (icon->priv->scaled_wireless_icons [i]);
17411N/A+ icon->priv->scaled_wireless_icons [i] = scale_pixbuf (icon->priv->wireless_icons [i],
17411N/A for (i = 0; i < NETSTATUS_SIGNAL_LAST; i++)
17411N/A if (icon->priv->scaled_signal_icons [i])
17411N/A icon->priv->scaled_signal_icons [i] = scale_pixbuf (icon->priv->rotated_signal_icons [i],
17411N/A+ /* Invalidate rendered icons */
17411N/A+ for (i = 0; i < NETSTATUS_STATE_LAST; i++) {
17411N/A+ for (int j = 0; j < NETSTATUS_SIGNAL_LAST; j++) {
17411N/A+ if ( icon->priv->rendered_wireless_pixbufs[i][j] != NULL ) {
17411N/A+ g_object_unref(icon->priv->rendered_wireless_pixbufs[i][j]);
17411N/A+ icon->priv->rendered_wireless_pixbufs[i][j] = NULL;
17411N/A netstatus_icon_update_image (icon);
17411N/A icon->priv->image = gtk_image_new ();
17411N/A gtk_container_add (GTK_CONTAINER (icon), icon->priv->image);
17411N/A- gtk_widget_show (icon->priv->image);
17411N/A+ gtk_widget_hide (icon->priv->image);
17411N/A icon->priv->signal_image = gtk_image_new ();
17411N/A gtk_container_add (GTK_CONTAINER (icon), icon->priv->signal_image);
17411N/A gtk_widget_hide (icon->priv->signal_image);
17411N/A+ icon->priv->query_tooltip_id = g_signal_connect(icon, "query-tooltip",
17411N/A+ G_CALLBACK (netstatus_icon_query_tooltip), NULL);
17411N/A gtk_widget_add_events (GTK_WIDGET (icon),
17411N/A GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
17411N/A if (icon->priv->state_changed_id)
17411N/A g_assert (icon->priv->iface != NULL);
17411N/A- g_assert (icon->priv->name_changed_id != 0);
17411N/A g_signal_handler_disconnect (icon->priv->iface,
17411N/A g_signal_handler_disconnect (icon->priv->iface,
17411N/A- g_signal_handler_disconnect (icon->priv->iface,
17411N/A icon->priv->wireless_changed_id);
17411N/A g_signal_handler_disconnect (icon->priv->iface,
17411N/A icon->priv->signal_changed_id);
17411N/A icon->priv->state_changed_id = g_signal_connect (icon->priv->iface, "notify::state",
17411N/A G_CALLBACK (netstatus_icon_state_changed), icon);
17411N/A- icon->priv->name_changed_id = g_signal_connect (icon->priv->iface, "notify::name",
17411N/A- G_CALLBACK (netstatus_icon_name_changed), icon);
17411N/A icon->priv->wireless_changed_id = g_signal_connect (icon->priv->iface, "notify::wireless",
17411N/A G_CALLBACK (netstatus_icon_is_wireless_changed), icon);
17411N/A icon->priv->signal_changed_id = g_signal_connect (icon->priv->iface, "notify::signal-strength",
17411N/A G_CALLBACK (netstatus_icon_signal_changed), icon);
17411N/A netstatus_icon_state_changed (icon->priv->iface, NULL, icon);
17411N/A- netstatus_icon_name_changed (icon->priv->iface, NULL, icon);
17411N/A netstatus_icon_is_wireless_changed (icon->priv->iface, NULL, icon);
17411N/A netstatus_icon_signal_changed (icon->priv->iface, NULL, icon);
17411N/A+wifi_info_t* netstatus_wifi_info_new( char *essid,
17411N/A+void netstatus_wifi_info_free( wifi_info_t * wi );
17411N/A+wifi_info_t *netstatus_sysdeps_read_iface_wireless_details (const char *iface);
17411N/A char *netstatus_sysdeps_read_iface_wireless_details (const char *iface,
17411N/A+ * Simple test program, that takes a wireles device as an argument, and then
17411N/A+ * tries to gather various configuration information from it.
17411N/A+#define DEV_PATH_PREFIX "/dev/"
17411N/A+get_value( int fd, wldp_t *buf, int prop_id )
17411N/A+ (void) memset(gbuf, 0, MAX_BUF_LEN);
17411N/A+ gbuf->wldp_length = sizeof( wldp_t );
17411N/A+ if ( (rc = ioctl( fd, I_STR, &stri )) != 0 ) {
17411N/A+ fprintf(stderr, "get_value( %d ): rc = %d\n", prop_id, rc);
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_LINKSTATUS )) != 0 ) {
17411N/A+ fprintf(stderr, "is_connected: rc = %d\n", rc);
17411N/A+ return((*(wl_linkstatus_t *)((gbuf)->wldp_buf) == WL_CONNECTED));
17411N/A+ return( (get_value(fd, gbuf, WL_BSS_TYPE ) < 0 )?FALSE:TRUE );
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_RSSI )) != 0 ) {
17411N/A+ fprintf(stderr, "get_signal_strength: rc = %d\n", rc);
17411N/A+ return( *(wl_rssi_t *)(gbuf->wldp_buf) ); // Get Signal Value
17411N/A+ str = calloc(256,sizeof(char));
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_ESSID )) != 0 ) {
17411N/A+ fprintf(stderr, "get_essid: rc = %d\n", rc);
17411N/A+ (void) strlcpy(str, ((wl_essid_t*)(gbuf->wldp_buf))->wl_essid_essid, 256);
17411N/A+extern char *_link_ntoa(const unsigned char *, char *, int, int);
17411N/A+ str = calloc(256,sizeof(char));
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_BSSID )) != 0 ) {
17411N/A+ fprintf(stderr, "get_bssid: rc = %d\n", rc);
17411N/A+ _link_ntoa((const unsigned char*)gbuf->wldp_buf, str, 6, IFT_OTHER);
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_BSS_TYPE )) != 0 ) {
17411N/A+ fprintf(stderr, "get_bss_mode: rc = %d\n", rc);
17411N/A+ bsstype = *(wl_bss_type_t *)(gbuf->wldp_buf);
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_ENCRYPTION )) != 0 ) {
17411N/A+ fprintf(stderr, "get_encryption: rc = %d\n", rc);
17411N/A+ encryption = *(wl_encryption_t *)(gbuf->wldp_buf);
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_AUTH_MODE )) != 0 ) {
17411N/A+ fprintf(stderr, "get_authmode: rc = %d\n", rc);
17411N/A+ authmode = *(wl_authmode_t *)(gbuf->wldp_buf);
17411N/A+ if ( (rc = get_value( fd, gbuf, WL_PHY_CONFIG )) != 0 ) {
17411N/A+ fprintf(stderr, "get_mode: rc = %d\n", rc);
17411N/A+ phy_conf = (wl_phy_conf_t *)(gbuf->wldp_buf);
17411N/A+ const char *encryption = NULL;
17411N/A+ const char *dev_no_path = NULL;
17411N/A+ if ( (dev_no_path = strchr(dev, '/')) == NULL ) {
17411N/A+ int buflen = strlen(DEV_PATH_PREFIX) + strlen(dev) + 2;
17411N/A+ (void)snprintf(devpath, buflen, "%s%s", DEV_PATH_PREFIX, dev );
17411N/A+ dev_no_path = dev; /* Pass back what was used as arg */
17411N/A+ if ( (fd = open( devpath, O_RDONLY )) < 0 ) {
17411N/A+ fprintf(stderr,"Unable to open dev %s\n", dev);
17411N/A+ /* Output something so caller doesn't block waiting for response */
17411N/A+ printf("%s;%d;%d;%s;%d;%s;%s;%s;%s\n",
17411N/A+ isconnected = is_connected(fd);
17411N/A+ if ( iswifi && isconnected ) {
17411N/A+ auth_mode = get_auth_mode(fd);
17411N/A+ encryption = get_encryption(fd);
17411N/A+ signal = get_signal_strength(fd);
17411N/A+ printf("%s;%d;%d;%s;%d;%s;%s;%s;%s;%s\n",
17411N/A+ char stdin_buffer[MAXPATHLEN];
17411N/A+ if ((gbuf = malloc(MAX_BUF_LEN)) == NULL) {
17411N/A+ while ( fgets( stdin_buffer, MAXPATHLEN, stdin ) != NULL ) {
17411N/A+ char *eol = strrchr( stdin_buffer, '\n' );
18350N/A@@ -49,6 +49,11 @@ PKG_CHECK_MODULES(NETSTATUS,
17411N/A+dnl *** checks for socket, nsl and scf libraries ***
17411N/A+AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
17411N/A+AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
17411N/A+AC_CHECK_FUNC(smf_get_state,,[AC_CHECK_LIB(scf,smf_get_state)])
17411N/A # "UNIX Network Programming, Volume 1" by W. Richard Stevens
17411N/A AC_CACHE_CHECK(if sockaddr has sa_len member,
17411N/A-SUBDIRS = src icons help po packaging
17411N/A+SUBDIRS = src icons help po packaging rbac
17411N/A+ -DNETSTATUS_DATA_DIR=\""$(pkgdatadir)\"" \
17411N/A -DNETSTATUS_BUILDERDIR=\""$(builderdir)\"" \
17411N/A -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
17411N/A-libexec_PROGRAMS = gnome-netstatus-applet
17411N/A+libexec_PROGRAMS = gnome-netstatus-applet gnome-netstatus-wifi-info
17411N/A+gnome_netstatus_wifi_info_SOURCES = \
17411N/A gnome_netstatus_applet_LDADD = $(NETSTATUS_LIBS) $(KSTAT_LIBS)
17411N/A+rbacdir = $(sysconfdir)/security
17411N/A+# The contents of this file are subject to the terms of the
17411N/A+# Common Development and Distribution License (the "License").
17411N/A+# You may not use this file except in compliance with the License.
17411N/A+# See the License for the specific language governing permissions
17411N/A+# and limitations under the License.
17411N/A+# When distributing Covered Code, include this CDDL HEADER in each
17411N/A+# If applicable, add the following below this CDDL HEADER, with the
17411N/A+# fields enclosed by brackets "[]" replaced with your own identifying
17411N/A+# information: Portions Copyright [yyyy] [name of copyright owner]
17411N/A+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
17411N/A+# Use is subject to license terms.
17411N/A+#ident "@(#)exec_attr 1.2 06/09/15 SMI"
17411N/A+# execution attributes for profiles. see exec_attr(4)
17411N/A+Network Wifi Info:solaris:cmd:::
/usr/lib/gnome-netstatus-wifi-info:privs=net_rawaccess,file_dac_read;limitprivs=net_rawaccess,file_dac_read,!proc_session,!proc_fork,!proc_exec,!proc_info,!file_link_any
17411N/A+# The contents of this file are subject to the terms of the
17411N/A+# Common Development and Distribution License (the "License").
17411N/A+# You may not use this file except in compliance with the License.
17411N/A+# See the License for the specific language governing permissions
17411N/A+# and limitations under the License.
17411N/A+# When distributing Covered Code, include this CDDL HEADER in each
17411N/A+# If applicable, add the following below this CDDL HEADER, with the
17411N/A+# fields enclosed by brackets "[]" replaced with your own identifying
17411N/A+# information: Portions Copyright [yyyy] [name of copyright owner]
17411N/A+# Copyright (c) 2007 by Sun Microsystems, Inc. All rights reserved.
17411N/A+Network Wifi Info:::Obtain Wireless Information:
17411N/A+Network Management:::Manage the host and network configuration:profiles=Network Wifi Info;help=
RtNetMngmnt.html 17411N/A+static child_info_t child_info = { FALSE, 0, -1, -1, -1, NULL, NULL, NULL };
17411N/A+child_watch_func( GPid pid, gint status, gpointer data)
17411N/A+ child_info_t* info = (child_info_t*)data;
17411N/A+ g_return_if_fail( info != NULL );
17411N/A+ memset( info, 0, sizeof( child_info_t ) );
17411N/A-netstatus_sysdeps_read_iface_wireless_details (const char *iface,
17411N/A+read_wireless_info( const char *iface ) {
17411N/A+netstatus_wifi_info_new( char *essid,
17411N/A- g_return_val_if_fail (iface != NULL, NULL);
17411N/A- g_return_val_if_fail (is_wireless != NULL, NULL);
17411N/A- g_return_val_if_fail (signal_strength != NULL, NULL);
17411N/A+ wifi_info_t* wi = g_new0( wifi_info_t, 1 );
17411N/A+ wi->essid = g_strdup(essid?essid:"");
17411N/A+ wi->bssid = g_strdup(bssid?bssid:"");
17411N/A+ wi->bss_mode = g_strdup(bss_mode?bss_mode:"");
17411N/A+ wi->signal_strength = signal_strength;
17411N/A+ wi->mode = g_strdup(mode?mode:"");
17411N/A+ wi->security = g_strdup(security?security:"");
17411N/A+ wi->auth_mode = g_strdup(auth_mode?auth_mode:"");
17411N/A+netstatus_wifi_info_free( wifi_info_t * wi )
17411N/A+ g_return_if_fail( wi != NULL );
17411N/A+netstatus_sysdeps_read_iface_wireless_details (const char *iface)
17411N/A+ g_return_val_if_fail (iface != NULL, NULL);
17411N/A+ if ( (str = read_wireless_info( iface )) == NULL ) {
17411N/A+ /* Not wireless, return NULL */
17411N/A+ gchar** fields = g_strsplit_set( g_strchomp(str), ";", 10 );
17411N/A+ is_wireless = (fields[1] != NULL && fields[1][0] == '1')?TRUE:FALSE;
17411N/A+ gboolean connected = (fields[2] != NULL && fields[2][0] == '1')?TRUE:FALSE;
17411N/A+ int signal_strength = (fields[4] != NULL)?atoi(fields[4]):0;
17411N/A+ /* Using the Linux code above, log() will provide a smoother
17411N/A+ * transition between signal strengths than simple division */
17411N/A+ /* *signal_strength = ((*signal_strength * 100) / 15 ); */
17411N/A+ signal_strength = (int) rint ((log (signal_strength) / log (15)) * 100.0);
17411N/A+ signal_strength = CLAMP( signal_strength, 0, 100);
17411N/A+ wi = netstatus_wifi_info_new( essid,
17411N/A #else /* defined(__FreeBSD__) */