Tue Sep 28 16:35:20 2004 Jonathan Blandford <jrb@redhat.com>

        * panel-applet/NMWirelessApplet.c: Fix deadlock.  Add a separator
        before 'select custom ESSID'.

        * panel-applet/menu-info.c: Start rewrite for better headers.  Not
        fully complete, but syncing in prep for merge.

        * panel-applet/icons/*png: New images


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@178 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 356e922b
Tue Sep 28 16:35:20 2004 Jonathan Blandford <jrb@redhat.com>
* panel-applet/NMWirelessApplet.c: Fix deadlock. Add a separator
before 'select custom ESSID'.
* panel-applet/menu-info.c: Start rewrite for better headers. Not
fully complete, but syncing in prep for merge.
* panel-applet/icons/*png: New images
2004-09-28 Dan Williams <dcbw@redhat.com>
* src/NetworkManager.c
......
......@@ -640,8 +640,7 @@ static void nmwa_menu_device_add_networks (GtkWidget *menu, NetworkDevice *dev,
net = (WirelessNetwork *) list->data;
menu_item = nm_menu_wireless_new (applet->image_size_group,
applet->encryption_size_group);
menu_item = nm_menu_wireless_new (applet->encryption_size_group);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
if (applet->active_device == dev && net->active)
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
......@@ -708,10 +707,10 @@ static void nmwa_menu_add_devices (GtkWidget *menu, NMWirelessApplet *applet)
g_return_if_fail (applet != NULL);
g_mutex_lock (applet->data_mutex);
if (! applet->devices)
{
nmwa_menu_add_text_item (menu, _("No network devices have been found"));
g_mutex_unlock (applet->data_mutex);
return;
}
......@@ -757,8 +756,11 @@ static void nmwa_menu_add_devices (GtkWidget *menu, NMWirelessApplet *applet)
}
if (n_wireless_interfaces > 0)
{
/* Add the 'Select a custom esssid entry */
nmwa_menu_add_separator_item (menu);
nmwa_menu_add_custom_essid_item (menu, applet);
}
g_mutex_unlock (applet->data_mutex);
}
......@@ -919,6 +921,7 @@ static void change_background_cb(PanelApplet *a, PanelAppletBackgroundType type,
{
GtkRcStyle *rc_style = gtk_rc_style_new ();
return;
switch (type)
{
case PANEL_PIXMAP_BACKGROUND:
......
......@@ -4,6 +4,18 @@ largeicondir=${datadir}/icons/hicolor/48x48/apps
largeicon_DATA=\
nm-device-wired.png \
nm-device-wireless.png \
nm-connecting00.png \
nm-connecting01.png \
nm-connecting02.png \
nm-connecting03.png \
nm-detect00.png \
nm-detect01.png \
nm-detect02.png \
nm-detect03.png \
nm-detect04.png \
nm-detect05.png \
nm-detect06.png \
nm-detect07.png \
$(NULL)
EXTRA_DIST=\
......
......@@ -25,30 +25,26 @@
* (C) Copyright 2004 Red Hat, Inc.
* Copyright (C) 1999, 2000 Eazel, Inc.
*/
#include <libintl.h>
#include "menu-info.h"
#include "gtkcellview.h"
#include "gtkcellrendererprogress.h"
#include "NMWirelessAppletDbus.h"
#include <config.h>
G_DEFINE_TYPE (NMMenuNetwork, nm_menu_network, GTK_TYPE_CHECK_MENU_ITEM);
G_DEFINE_TYPE (NMMenuNetwork, nm_menu_network, GTK_TYPE_MENU_ITEM);
static void nm_menu_network_update_image (NMMenuNetwork *menu_network);
static void
nm_menu_network_init (NMMenuNetwork *menu_network)
{
GtkWidget *hbox;
GtkWidget *eb;
gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (menu_network), TRUE);
hbox = gtk_hbox_new (FALSE, 2);
menu_network->image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (hbox), menu_network->image, FALSE, FALSE, 0);
eb = gtk_event_box_new ();
menu_network->label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (menu_network->label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), menu_network->label, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (menu_network), hbox);
gtk_widget_show_all (hbox);
gtk_container_add (GTK_CONTAINER (eb), menu_network->label);
gtk_container_add (GTK_CONTAINER (menu_network), eb);
gtk_widget_show_all (eb);
}
......@@ -57,32 +53,16 @@ nm_menu_network_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
GTK_WIDGET_CLASS (nm_menu_network_parent_class)->style_set (widget, previous_style);
nm_menu_network_update_image (NM_MENU_NETWORK (widget));
}
static void
nm_menu_network_draw_indicator (GtkCheckMenuItem *check_menu_item,
GdkRectangle *area)
{
/* Don't draw the indicator if we're a wireless device */
if (NM_MENU_NETWORK (check_menu_item)->type == DEVICE_TYPE_WIRELESS_ETHERNET)
return;
GTK_CHECK_MENU_ITEM_CLASS (nm_menu_network_parent_class)->draw_indicator (check_menu_item, area);
}
static void
nm_menu_network_class_init (NMMenuNetworkClass *menu_network)
{
GtkWidgetClass *widget_class;
GtkCheckMenuItemClass *check_menu_item_class;
widget_class = GTK_WIDGET_CLASS (menu_network);
check_menu_item_class = GTK_CHECK_MENU_ITEM_CLASS (menu_network);
widget_class->style_set = nm_menu_network_style_set;
check_menu_item_class->draw_indicator = nm_menu_network_draw_indicator;
}
GtkWidget *
......@@ -96,42 +76,6 @@ nm_menu_network_new (GtkSizeGroup *image_size_group)
return retval;
}
/* updates the image based on the icon type. It is called when themes
* change too as the icon size is theme dependent */
static void
nm_menu_network_update_image (NMMenuNetwork *menu_network)
{
GtkIconTheme *icon_theme;
GdkPixbuf *icon;
const gchar *icon_name = NULL;
gint size;
if (menu_network->type == DEVICE_TYPE_WIRED_ETHERNET)
{
icon_name = "nm-device-wired";
}
else if (menu_network->type == DEVICE_TYPE_WIRELESS_ETHERNET)
{
icon_name = "nm-device-wireless";
}
else
{
gtk_image_set_from_pixbuf (GTK_IMAGE (menu_network->image), NULL);
return;
}
gtk_icon_size_lookup_for_settings (gtk_settings_get_default (),
GTK_ICON_SIZE_MENU,
&size, NULL);
icon_theme = gtk_icon_theme_get_default ();
icon = gtk_icon_theme_load_icon (icon_theme,
icon_name,
size, 0, NULL);
gtk_image_set_from_pixbuf (GTK_IMAGE (menu_network->image), icon);
if (icon)
g_object_unref (icon);
}
void
nm_menu_network_update (NMMenuNetwork *menu_network,
......@@ -166,12 +110,6 @@ nm_menu_network_update (NMMenuNetwork *menu_network,
}
gtk_label_set_text (GTK_LABEL (menu_network->label), text);
g_free (text);
nm_menu_network_update_image (menu_network);
if (menu_network->type == DEVICE_TYPE_WIRELESS_ETHERNET)
gtk_widget_set_sensitive (GTK_WIDGET (menu_network), FALSE);
else
gtk_widget_set_sensitive (GTK_WIDGET (menu_network), TRUE);
}
/* NMMenuWireless items*/
......@@ -183,15 +121,12 @@ nm_menu_wireless_init (NMMenuWireless *menu_info)
GtkWidget *hbox;
gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (menu_info), TRUE);
hbox = gtk_hbox_new (FALSE, 2);
menu_info->spacer = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (menu_info->spacer), GTK_SHADOW_NONE);
hbox = gtk_hbox_new (FALSE, 6);
menu_info->label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (menu_info->label), 0.0, 0.5);
menu_info->security_image = gtk_image_new ();
gtk_container_add (GTK_CONTAINER (menu_info), hbox);
gtk_box_pack_start (GTK_BOX (hbox), menu_info->spacer, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), menu_info->label, TRUE, TRUE, 0);
menu_info->cell_view = gtk_cell_view_new ();
menu_info->progress_bar = g_object_new (GTK_TYPE_CELL_RENDERER_PROGRESS,
......@@ -201,10 +136,8 @@ nm_menu_wireless_init (NMMenuWireless *menu_info)
GTK_CELL_RENDERER (menu_info->progress_bar),
TRUE);
gtk_box_pack_start (GTK_BOX (hbox), menu_info->cell_view, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (hbox), menu_info->security_image, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), menu_info->security_image, FALSE, FALSE, 0);
/* We don't show all the widgets, but we do show a few */
gtk_widget_show (menu_info->spacer);
gtk_widget_show (menu_info->label);
gtk_widget_show (menu_info->cell_view);
gtk_widget_show (hbox);
......@@ -216,13 +149,10 @@ nm_menu_wireless_class_init (NMMenuWirelessClass *menu_info_class)
}
GtkWidget *
nm_menu_wireless_new (GtkSizeGroup *image_size_group,
GtkSizeGroup *encryption_size_group)
nm_menu_wireless_new (GtkSizeGroup *encryption_size_group)
{
GtkWidget *retval = g_object_new (nm_menu_wireless_get_type (), NULL);
gtk_size_group_add_widget (image_size_group,
NM_MENU_WIRELESS (retval)->spacer);
gtk_size_group_add_widget (encryption_size_group,
NM_MENU_WIRELESS (retval)->security_image);
......
......@@ -36,12 +36,12 @@
typedef struct
{
GtkCheckMenuItemClass parent_class;
GtkMenuItemClass parent_class;
} NMMenuNetworkClass;
typedef struct
{
GtkCheckMenuItem parent;
GtkMenuItem parent;
GtkWidget *image;
GtkWidget *label;
int type;
......@@ -56,9 +56,8 @@ typedef struct
typedef struct
{
GtkCheckMenuItem parent;
GtkWidget *spacer;
GtkWidget *cell_view;
GtkWidget *label;
GtkWidget *cell_view;
GtkWidget *security_image;
GObject *progress_bar;
} NMMenuWireless;
......@@ -73,8 +72,7 @@ void nm_menu_network_update (NMMenuNetwork *menu_network,
gboolean multiple_devices);
GType nm_menu_wireless_get_type (void);
GtkWidget *nm_menu_wireless_new (GtkSizeGroup *image_size_group,
GtkSizeGroup *encryption_size_group);
GtkWidget *nm_menu_wireless_new (GtkSizeGroup *encryption_size_group);
void nm_menu_wireless_update (NMMenuWireless *menu_info,
WirelessNetwork *network,
gboolean has_encrypted);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment