/*
* dhcpcd-gtk
- * Copyright 2009 Roy Marples <roy@marples.name>
+ * Copyright 2009-2010 Roy Marples <roy@marples.name>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#ifndef DHCPCD_GTK_H
#define DHCPCD_GTK_H
-#include <arpa/inet.h>
-
#include <stdbool.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <libintl.h>
-#include "libdhcpcd.h"
+#include "dhcpcd.h"
+#include "queue.h"
#define PACKAGE "dhcpcd-gtk"
-#define VERSION "0.4.0"
-
-/* Work out if we have a private address or not
- * 10/8
- * 172.16/12
- * 192.168/16
- */
-#ifndef IN_PRIVATE
-# define IN_PRIVATE(addr) (((addr & IN_CLASSA_NET) == 0x0a000000) || \
- ((addr & 0xfff00000) == 0xac100000) || \
- ((addr & IN_CLASSB_NET) == 0xc0a80000))
-#endif
-#ifndef IN_LINKLOCAL
-# define IN_LINKLOCAL(addr) ((addr & IN_CLASSB_NET) == 0xa9fe0000)
-#endif
#define UNCONST(a) ((void *)(unsigned long)(const void *)(a))
# define _unused
#endif
+typedef struct wi_menu {
+ TAILQ_ENTRY(wi_menu) next;
+ DHCPCD_WI_SCAN *scan;
+ GtkWidget *menu;
+ GtkWidget *ssid;
+ GtkWidget *icon;
+ GtkWidget *bar;
+} WI_MENU;
+typedef TAILQ_HEAD(wi_menu_head, wi_menu) WI_MENUS;
+
typedef struct wi_scan {
- DHCPCD_CONNECTION *connection;
+ TAILQ_ENTRY(wi_scan) next;
DHCPCD_IF *interface;
DHCPCD_WI_SCAN *scans;
- struct wi_scan *next;
+
+ GtkWidget *ifmenu;
+ WI_MENUS menus;
} WI_SCAN;
-extern WI_SCAN *wi_scans;
+typedef TAILQ_HEAD(wi_scan_head, wi_scan) WI_SCANS;
+extern WI_SCANS wi_scans;
WI_SCAN * wi_scan_find(DHCPCD_WI_SCAN *);
void menu_init(GtkStatusIcon *, DHCPCD_CONNECTION *);
+void menu_update_scans(WI_SCAN *, DHCPCD_WI_SCAN *);
void notify_close(void);
-void dhcpcd_prefs_show(DHCPCD_CONNECTION *con);
-void dhcpcd_prefs_abort(void);
+void prefs_show(DHCPCD_CONNECTION *con);
+void prefs_abort(void);
+void menu_abort(void);
+void wpa_abort(void);
+
+bool wpa_configure(DHCPCD_WPA *, DHCPCD_WI_SCAN *);
+
+#if GTK_MAJOR_VERSION == 2
+GtkWidget *gtk_box_new(GtkOrientation, gint);
+#endif
-bool wpa_configure(DHCPCD_CONNECTION *, DHCPCD_IF *, DHCPCD_WI_SCAN *);
#endif