Use better icons and titles. Remove useless help menu item.
authorRoy Marples <roy@marples.name>
Thu, 5 Mar 2009 19:23:21 +0000 (19:23 +0000)
committerRoy Marples <roy@marples.name>
Thu, 5 Mar 2009 19:23:21 +0000 (19:23 +0000)
main.c
menu.c

diff --git a/main.c b/main.c
index 131a9419ab7bc4513cca32e6bca8d8e528bc5605..6c5f51664ed5f7bbd9f44b8811e0d707d56ca5f2 100644 (file)
--- a/main.c
+++ b/main.c
@@ -448,10 +448,9 @@ dhcpcd_event(_unused DBusGProxy *proxy, GHashTable *config, _unused void *data)
        struct if_msg *ifm, *ifp;
        bool rem;
        GSList *gl;
-       char *msg, *title;
-       const char *act, *net;
+       char *msg;
+       const char *icon;
        const char *const *r;
-       in_addr_t ipn;
 
        ifm = make_if_msg(config);
        if (ifm == NULL)
@@ -484,33 +483,17 @@ dhcpcd_event(_unused DBusGProxy *proxy, GHashTable *config, _unused void *data)
                return;
 
        msg = print_if_msg(ifm);
-       title = NULL;
        if (if_up(ifm))
-               act = N_("Connected to ");
+               icon = "network-transmit-receive";
        else
-               act = NULL;
+               icon = "network-transmit";
        for (r = down_reasons; *r; r++) {
                if (g_strcmp0(*r, ifm->reason) == 0) {
-                       act = N_("Disconnected from ");
+                       icon = "network-offline";
                        break;
                }
-       }
-       if (act && ifm->ip.s_addr) {
-               ipn = htonl(ifm->ip.s_addr);
-               if (IN_LINKLOCAL(ipn))
-                       net = N_("private network");
-               else if (IN_PRIVATE(ipn))
-                       net = N_("LAN");
-               else
-                       net = N_("internet");
-               title = g_strconcat(act, net, NULL);
-       }
-
-       if (title) {
-               notify(title, msg, GTK_STOCK_NETWORK);
-               g_free(title);
-       } else
-               notify(N_("Interface event"), msg, GTK_STOCK_NETWORK);
+       }
+       notify(_("Network event"), msg, icon);
        g_free(msg);
 }
 
@@ -598,7 +581,7 @@ check_status(const char *status)
                msg = N_(last ?
                    "Connection to dhcpcd lost" : "dhcpcd not running");
                gtk_status_icon_set_tooltip(status_icon, msg);
-               notify(_("No network"), msg, GTK_STOCK_NETWORK);
+               notify(_("No network"), msg, "network-offline");
        }
 
        refresh = false;
@@ -669,7 +652,7 @@ dhcpcd_scan_results(_unused DBusGProxy *proxy, const char *iface,
        g_slist_free(ifm->scan_results);
        ifm->scan_results = aps;
        if (txt != NULL) {
-               notify(N_("Found new AP"), txt, GTK_STOCK_NETWORK);
+               notify(N_("New Access Points"), txt, "network-wireless");
                g_free(txt);
        }
 }
diff --git a/menu.c b/menu.c
index 63cd2db0d588dfb4746896ca1530f865c0148d5e..e1452ed8fb11bd1921231173fb5eed567b245891 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -33,24 +33,19 @@ static const char *copyright = "Copyright (c) 2009 Roy Marples";
 static const char *authors[] = { "Roy Marples <roy@marples.name>", NULL };
 
 static void
-on_pref(_unused GtkMenuItem *item, _unused gpointer data)
+on_pref(void)
 {
        dhcpcd_prefs_show();
 }
 
 
 static void
-on_quit(_unused GtkMenuItem *item, _unused gpointer data)
+on_quit(void)
 {
        gtk_main_quit();
 }
 
 static void
-on_help(_unused GtkMenuItem *item, _unused gpointer data)
-{
-}
-
-static void
 url_show(GtkAboutDialog *dialog, const char *url)
 {
        GdkScreen *screen;
@@ -60,7 +55,7 @@ url_show(GtkAboutDialog *dialog, const char *url)
 }
 
 static void
-email_hook(GtkAboutDialog *dialog, const char *url, _unused gpointer p)
+email_hook(GtkAboutDialog *dialog, const char *url, _unused gpointer data)
 {
        char *address;
 
@@ -70,7 +65,7 @@ email_hook(GtkAboutDialog *dialog, const char *url, _unused gpointer p)
 }
 
 static void
-url_hook(GtkAboutDialog *dialog, const char *url, _unused gpointer p)
+url_hook(GtkAboutDialog *dialog, const char *url, _unused gpointer data)
 {
        url_show(dialog, url);
 }
@@ -82,9 +77,9 @@ ssid_hook(_unused GtkMenuItem *item, gpointer data)
 }
 
 static void
-on_about(_unused GtkMenuItem *item, _unused gpointer data)
+on_about(_unused GtkMenuItem *item)
 {
-       gtk_window_set_default_icon_name(GTK_STOCK_NETWORK);
+       gtk_window_set_default_icon_name("network-transmit-receive");
        gtk_about_dialog_set_email_hook(email_hook, NULL, NULL);
        gtk_about_dialog_set_url_hook(url_hook, NULL, NULL);
        gtk_show_about_dialog(NULL,
@@ -93,7 +88,8 @@ on_about(_unused GtkMenuItem *item, _unused gpointer data)
            "website-label", "dhcpcd Website",
            "website", "http://roy.marples.name/projects/dhcpcd",
            "authors", authors,
-           "logo-icon-name", GTK_STOCK_NETWORK,
+           "logo-icon-name", "network-transmit-receive",
+           "comments", "Part of the dhcpcd project",
            NULL);
 }
 
@@ -149,7 +145,7 @@ add_scan_results(GtkMenu *menu, const struct if_msg *ifm)
 }
 
 static void
-on_activate(GtkStatusIcon *icon, _unused guint button, _unused guint32 atime, _unused gpointer data)
+on_activate(GtkStatusIcon *icon)
 {
        GtkMenu *menu;
        const struct if_msg *ifm;
@@ -217,14 +213,6 @@ on_popup(GtkStatusIcon *icon, guint button, guint32 atime, gpointer data)
        item = gtk_separator_menu_item_new();
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
 
-       item = gtk_image_menu_item_new_with_mnemonic(_("_Help"));
-       image = gtk_image_new_from_icon_name(GTK_STOCK_HELP,
-           GTK_ICON_SIZE_MENU);
-       gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
-       g_signal_connect(G_OBJECT(item), "activate",
-           G_CALLBACK(on_help), icon);
-       gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-
        item = gtk_image_menu_item_new_with_mnemonic(_("_About"));
        image = gtk_image_new_from_icon_name(GTK_STOCK_ABOUT,
            GTK_ICON_SIZE_MENU);