Wed Oct 13 19:31:53 2004 Jonathan Blandford <jrb@redhat.com>
* panel-applet/NMWirelessApplet.c: Add an essid dialog. It doesn't work yet, but it looks okay. * panel-applet/icons/*png: Resize to 22x22 and install in the right place. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@224 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
@@ -1,3 +1,11 @@
|
||||
Wed Oct 13 19:31:53 2004 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* panel-applet/NMWirelessApplet.c: Add an essid dialog. It
|
||||
doesn't work yet, but it looks okay.
|
||||
|
||||
* panel-applet/icons/*png: Resize to 22x22 and install in the
|
||||
right place.
|
||||
|
||||
2004-10-13 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* panel-applet/NMWirelessApplet.c
|
||||
|
@@ -54,36 +54,12 @@ libexec_PROGRAMS = NetworkManagerNotification
|
||||
NetworkManagerNotification_SOURCES = main.c
|
||||
NetworkManagerNotification_LDADD = ./libnm_notification_applet.la
|
||||
|
||||
uidir = $(datadir)/gnome-2.0/ui
|
||||
ui_DATA = NMWirelessApplet.xml
|
||||
|
||||
gladedir = $(datadir)/NMWirelessApplet
|
||||
glade_DATA = wireless-applet.glade
|
||||
|
||||
pixmapdir = $(datadir)/pixmaps/NMWirelessApplet
|
||||
pixmap_DATA = \
|
||||
no-networkmanager.png \
|
||||
no-link-0.png \
|
||||
wired.png \
|
||||
wireless.png \
|
||||
broken-0.png \
|
||||
signal-1-40.png \
|
||||
signal-41-60.png \
|
||||
signal-61-80.png \
|
||||
signal-81-100.png \
|
||||
wireless-applet.png \
|
||||
connect-0.png \
|
||||
connect-1.png \
|
||||
connect-2.png \
|
||||
connect-3.png \
|
||||
keyring.png \
|
||||
$(NULL)
|
||||
gladedir = $(datadir)/NetworkManagerNotification
|
||||
glade_DATA = essid.glade
|
||||
|
||||
CLEANFILES = $(server_DATA) *.bak *.gladep
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(pixmap_DATA) \
|
||||
$(ui_DATA) \
|
||||
$(glade_DATA) \
|
||||
$(NULL)
|
||||
|
||||
|
@@ -51,8 +51,6 @@
|
||||
#define CFG_UPDATE_INTERVAL 1
|
||||
#define NM_GCONF_WIRELESS_NETWORKS_PATH "/system/networking/wireless/networks"
|
||||
|
||||
static char *glade_file;
|
||||
|
||||
static GtkWidget * nmwa_populate_menu (NMWirelessApplet *applet);
|
||||
static void nmwa_dispose_menu_items (NMWirelessApplet *applet);
|
||||
static gboolean do_not_eat_button_press (GtkWidget *widget, GdkEventButton *event);
|
||||
@@ -61,18 +59,8 @@ static void setup_stock (void);
|
||||
static void nmwa_icons_init (NMWirelessApplet *applet);
|
||||
static gboolean nmwa_fill (NMWirelessApplet *applet);
|
||||
|
||||
|
||||
#ifndef BUILD_NOTIFICATION_ICON
|
||||
static const BonoboUIVerb nmwa_context_menu_verbs [] =
|
||||
{
|
||||
BONOBO_UI_UNSAFE_VERB ("NMWirelessAbout", nmwa_about_cb),
|
||||
BONOBO_UI_VERB_END
|
||||
};
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE(NMWirelessApplet, nmwa, EGG_TYPE_TRAY_ICON)
|
||||
|
||||
|
||||
static void
|
||||
nmwa_init (NMWirelessApplet *applet)
|
||||
{
|
||||
@@ -482,9 +470,9 @@ static void nmwa_menu_item_activate (GtkMenuItem *item, gpointer user_data)
|
||||
*/
|
||||
static void nmwa_toplevel_menu_activate (GtkWidget *menu, NMWirelessApplet *applet)
|
||||
{
|
||||
nmwa_dispose_menu_items (applet);
|
||||
nmwa_populate_menu (applet);
|
||||
gtk_widget_show (applet->menu);
|
||||
nmwa_dispose_menu_items (applet);
|
||||
nmwa_populate_menu (applet);
|
||||
gtk_widget_show (applet->menu);
|
||||
}
|
||||
|
||||
|
||||
@@ -555,17 +543,153 @@ static void nmwa_menu_add_device_item (GtkWidget *menu, NetworkDevice *device, g
|
||||
gtk_widget_show (menu_item);
|
||||
}
|
||||
|
||||
static void
|
||||
update_button_cb (GtkWidget *entry,
|
||||
GtkWidget *button)
|
||||
{
|
||||
const char *text;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
if (text[0] == '\000')
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
else
|
||||
gtk_widget_set_sensitive (button, TRUE);
|
||||
}
|
||||
|
||||
static GtkTreeModel *
|
||||
create_wireless_adaptor_model (NMWirelessApplet *applet)
|
||||
{
|
||||
GtkListStore *retval;
|
||||
GSList *element;
|
||||
|
||||
retval = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
|
||||
for (element = applet->devices; element; element = element->next)
|
||||
{
|
||||
NetworkDevice *network = (NetworkDevice *)(element->data);
|
||||
|
||||
g_assert (network);
|
||||
if (network->type == DEVICE_TYPE_WIRELESS_ETHERNET)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
const char *network_name;
|
||||
|
||||
network_name = network->hal_name ? network->hal_name : network->nm_name;
|
||||
|
||||
gtk_list_store_append (retval, &iter);
|
||||
gtk_list_store_set (retval, &iter,
|
||||
0, network_name,
|
||||
1, network,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
return GTK_TREE_MODEL (retval);
|
||||
}
|
||||
|
||||
static void
|
||||
custom_essid_item_selected (GtkWidget *menu_item, NMWirelessApplet *applet)
|
||||
{
|
||||
gchar *glade_file;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *button;
|
||||
GladeXML *xml;
|
||||
char *essid;
|
||||
gint response;
|
||||
gint n_wireless_interfaces = 0;
|
||||
GSList *element;
|
||||
|
||||
glade_file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
|
||||
"NetworkManagerNotification/essid.glade",
|
||||
FALSE, NULL);
|
||||
|
||||
if (!glade_file ||
|
||||
!g_file_test (glade_file, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
show_warning_dialog (TRUE, _("The NetworkManager Applet could not find some required resources (the glade file was not found)."));
|
||||
return;
|
||||
}
|
||||
|
||||
xml = glade_xml_new (glade_file, NULL, NULL);
|
||||
g_free (glade_file);
|
||||
|
||||
if (xml == NULL)
|
||||
{
|
||||
/* Reuse the above string to make the translators less angry. */
|
||||
show_warning_dialog (TRUE, _("The NetworkManager Applet could not find some required resources (the glade file was not found)."));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set up the dialog */
|
||||
dialog = glade_xml_get_widget (xml, "custom_essid_dialog");
|
||||
entry = glade_xml_get_widget (xml, "essid_entry");
|
||||
button = glade_xml_get_widget (xml, "ok_button");
|
||||
|
||||
gtk_widget_grab_focus (entry);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "");
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
g_signal_connect (entry, "changed", update_button_cb, button);
|
||||
|
||||
/* Do we have multiple Network cards? */
|
||||
g_mutex_lock (applet->data_mutex);
|
||||
for (element = applet->devices; element; element = element->next)
|
||||
{
|
||||
NetworkDevice *dev = (NetworkDevice *)(element->data);
|
||||
|
||||
g_assert (dev);
|
||||
if (dev->type == DEVICE_TYPE_WIRELESS_ETHERNET)
|
||||
n_wireless_interfaces++;
|
||||
}
|
||||
if (n_wireless_interfaces < 1)
|
||||
{
|
||||
g_mutex_unlock (applet->data_mutex);
|
||||
/* Run away!!! */
|
||||
return;
|
||||
}
|
||||
else if (n_wireless_interfaces == 1)
|
||||
{
|
||||
gtk_widget_hide (glade_xml_get_widget (xml, "wireless_adaptor_label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (xml, "wireless_adaptor_combo"));
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkWidget *combo;
|
||||
GtkTreeModel *model;
|
||||
|
||||
combo = glade_xml_get_widget (xml, "wireless_adaptor_combo");
|
||||
model = create_wireless_adaptor_model (applet);
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), model);
|
||||
|
||||
/* Select the first one randomly */
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
||||
}
|
||||
g_mutex_unlock (applet->data_mutex);
|
||||
|
||||
/* Run the dialog */
|
||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
essid = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
/* FIXME: actually set the essid... */
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
g_object_unref (xml);
|
||||
}
|
||||
|
||||
static void nmwa_menu_add_custom_essid_item (GtkWidget *menu, NMWirelessApplet *applet)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *label;
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *label;
|
||||
|
||||
menu_item = gtk_menu_item_new ();
|
||||
label = gtk_label_new (_("Other Wireless Networks..."));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_container_add (GTK_CONTAINER (menu_item), label);
|
||||
gtk_widget_show_all (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
||||
menu_item = gtk_menu_item_new ();
|
||||
label = gtk_label_new (_("Other Wireless Networks..."));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_container_add (GTK_CONTAINER (menu_item), label);
|
||||
gtk_widget_show_all (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
||||
g_signal_connect (menu_item, "activate", custom_essid_item_selected, applet);
|
||||
}
|
||||
|
||||
|
||||
@@ -863,14 +987,6 @@ static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet)
|
||||
if (!applet->gconf_client)
|
||||
return (NULL);
|
||||
|
||||
applet->ui_resources = glade_xml_new(glade_file, NULL, NULL);
|
||||
if (!applet->ui_resources)
|
||||
{
|
||||
show_warning_dialog (TRUE, _("The NetworkManager Applet could not find some required resources (the glade file was not found)."));
|
||||
g_object_unref (G_OBJECT (applet->gconf_client));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
applet->applet_state = APPLET_STATE_NO_NM;
|
||||
applet->devices = NULL;
|
||||
applet->active_device = NULL;
|
||||
@@ -879,14 +995,12 @@ static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet)
|
||||
if (!(applet->data_mutex = g_mutex_new ()))
|
||||
{
|
||||
g_object_unref (G_OBJECT (applet->gconf_client));
|
||||
/* FIXME: free glade file */
|
||||
return (NULL);
|
||||
}
|
||||
if (!(applet->dbus_thread = g_thread_create (nmwa_dbus_worker, applet, FALSE, &error)))
|
||||
{
|
||||
g_mutex_free (applet->data_mutex);
|
||||
g_object_unref (G_OBJECT (applet->gconf_client));
|
||||
/* FIXME: free glade file */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -895,11 +1009,6 @@ static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet)
|
||||
|
||||
g_signal_connect (applet,"destroy", G_CALLBACK (nmwa_destroy),NULL);
|
||||
|
||||
#ifndef BUILD_NOTIFICATION_ICON
|
||||
panel_applet_setup_menu_from_file (PANEL_APPLET (applet), NULL, "NMWirelessApplet.xml", NULL,
|
||||
nmwa_context_menu_verbs, applet);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Start redraw timeout */
|
||||
@@ -913,14 +1022,6 @@ static gboolean nmwa_fill (NMWirelessApplet *applet)
|
||||
gnome_window_icon_set_default_from_file (ICONDIR"/NMWirelessApplet/wireless-applet.png");
|
||||
|
||||
glade_gnome_init ();
|
||||
glade_file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
|
||||
"NMWirelessApplet/wireless-applet.glade", FALSE, NULL);
|
||||
if (!glade_file)
|
||||
{
|
||||
show_warning_dialog (TRUE, _("The NetworkManager Applet could not find some required resources (the glade file was not found)."));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
gtk_widget_show (nmwa_get_instance (applet));
|
||||
return (TRUE);
|
||||
}
|
||||
|
@@ -794,7 +794,7 @@ static void network_device_free_wireless_network_list (NetworkDevice *dev)
|
||||
{
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
g_slist_foreach (dev->networks, wireless_network_unref, NULL);
|
||||
g_slist_foreach (dev->networks, (GFunc) wireless_network_unref, NULL);
|
||||
g_slist_free (dev->networks);
|
||||
dev->networks = NULL;
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ static void nmwa_dbus_update_devices (NMWirelessApplet *applet)
|
||||
|
||||
/* Clear out existing device list */
|
||||
g_mutex_lock (applet->data_mutex);
|
||||
g_slist_foreach (applet->devices, network_device_unref, NULL);
|
||||
g_slist_foreach (applet->devices, (GFunc) network_device_unref, NULL);
|
||||
g_slist_free (applet->devices);
|
||||
if (applet->active_device)
|
||||
network_device_unref (applet->active_device);
|
||||
|
Before Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 679 B |
Before Width: | Height: | Size: 678 B |
@@ -5,7 +5,7 @@ largeicon_DATA=\
|
||||
nm-device-wireless.png
|
||||
|
||||
|
||||
smallicondir=${datadir}/icons/hicolor/24x24/apps
|
||||
smallicondir=${datadir}/icons/hicolor/22x22/apps
|
||||
smallicon_DATA=\
|
||||
nm-device-wired.png \
|
||||
nm-connecting00.png \
|
||||
|
Before Width: | Height: | Size: 929 B After Width: | Height: | Size: 895 B |
Before Width: | Height: | Size: 972 B After Width: | Height: | Size: 956 B |
Before Width: | Height: | Size: 1019 B After Width: | Height: | Size: 976 B |
Before Width: | Height: | Size: 971 B After Width: | Height: | Size: 959 B |
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 598 B After Width: | Height: | Size: 557 B |
Before Width: | Height: | Size: 711 B After Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 629 B After Width: | Height: | Size: 575 B |
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 735 B |
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 538 B |
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 490 B |
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 409 B |
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 496 B |
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 492 B |
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 470 B |
Before Width: | Height: | Size: 3.1 KiB |
@@ -26,6 +26,7 @@
|
||||
* Copyright (C) 1999, 2000 Eazel, Inc.
|
||||
*/
|
||||
#include <libintl.h>
|
||||
#include <string.h>
|
||||
#include "menu-info.h"
|
||||
#include "gtkcellview.h"
|
||||
#include "gtkcellrendererprogress.h"
|
||||
|
Before Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 653 B |
Before Width: | Height: | Size: 678 B |
Before Width: | Height: | Size: 701 B |
Before Width: | Height: | Size: 701 B |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
@@ -4,7 +4,6 @@ info-daemon/networks.glade
|
||||
info-daemon/passphrase.glade
|
||||
info-daemon/NetworkManagerInfoPassphraseDialog.c
|
||||
panel-applet/NMWirelessApplet.c
|
||||
panel-applet/NMWirelessApplet.xml
|
||||
panel-applet/wireless-applet.glade
|
||||
examples/python/systray/eggtrayicon.c
|
||||
panel-applet/essid.glade
|
||||
panel-applet/menu-info.c
|
||||
examples/python/systray/eggtrayicon.c
|
||||
|