[Goodies-commits] r2139 - in xfce4-cellmodem-plugin/trunk: . panel-plugin po
Alvaro Lopes
alvieboy at xfce.org
Mon Oct 30 20:59:14 CET 2006
Author: alvieboy
Date: 2006-10-30 19:58:55 +0000 (Mon, 30 Oct 2006)
New Revision: 2139
Added:
xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.c
xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.h
xfce4-cellmodem-plugin/trunk/po/pt.po
Removed:
xfce4-cellmodem-plugin/trunk/po/Makefile.am
Modified:
xfce4-cellmodem-plugin/trunk/configure.ac
xfce4-cellmodem-plugin/trunk/panel-plugin/Makefile.am
xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.c
xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.h
xfce4-cellmodem-plugin/trunk/panel-plugin/leds.c
xfce4-cellmodem-plugin/trunk/panel-plugin/leds.h
xfce4-cellmodem-plugin/trunk/panel-plugin/med_leds.xpm
xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.c
xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.h
xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.c
xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.h
xfce4-cellmodem-plugin/trunk/po/POTFILES.in
Log:
Sync with Autodetect and HSDPA
Modified: xfce4-cellmodem-plugin/trunk/configure.ac
===================================================================
--- xfce4-cellmodem-plugin/trunk/configure.ac 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/configure.ac 2006-10-30 19:58:55 UTC (rev 2139)
@@ -18,21 +18,36 @@
AC_CHECK_FUNCS([vasprintf])
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.20])
-XDT_I18N([])
+XDT_I18N([pt])
-enable_debug=no
+AC_ARG_ENABLE([debug],
+[ --enable-debug Enable syslog debugging],
+[enable_debug="yes"],
+[enable_debug="no"]
+)
-AC_ARG_ENABLE(debug,
-[ --enable-debug Enable syslog debugging],,
-[ enable_debug=yes ])
-
if test "$enable_debug" = "yes" ; then
echo "Enabling syslog debugging"
AC_DEFINE(DEBUG_ENABLED,[1],[Enable debugging through syslog])
+else
+ echo "> Not using debug $enable_debug"
fi
+AC_CHECK_HEADER([pci/pci.h],
+AC_CHECK_LIB(pci,pci_alloc,
+AC_DEFINE(HAVE_PCIUTILS,[1],[Use pci utils to discover devices])
+LIBS="$LIBS -lpci"
+)
+)
+
+PKG_CHECK_MODULES(libusb,[libusb >= 0.1.12],
+AC_DEFINE(HAVE_USBUTILS,[1],[Use usb utils to discover devices])
+LIBS="$LIBS $libusb_LIBS"
+,
+)
+
AC_OUTPUT([
Makefile
panel-plugin/Makefile
-po/Makefile
+po/Makefile.in
])
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/Makefile.am
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/Makefile.am 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/Makefile.am 2006-10-30 19:58:55 UTC (rev 2139)
@@ -6,7 +6,7 @@
@LIBXFCE4PANEL_CFLAGS@
xfce4_cellmodem_plugin_LDFLAGS = \
- @LIBXFCE4PANEL_LIBS@
+ @LIBXFCE4PANEL_LIBS@
xfce4_cellmodem_plugin_SOURCES = \
cellmodem.c modem_driver.c \
@@ -14,7 +14,8 @@
modem_driver_generic.c \
preferences.c \
pin_helper.c \
- leds.c
+ leds.c \
+ autodetect.c
noinst_HEADERS = \
cellmodem.h \
@@ -25,7 +26,8 @@
modem_driver_fake.h \
modem_driver.h \
preferences.h \
- big_leds.xpm
+ big_leds.xpm \
+ autodetect.h
desktop_in_in_files = cellmodem.desktop.in.in
Added: xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.c
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.c (rev 0)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.c 2006-10-30 19:58:55 UTC (rev 2139)
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2006 Alvaro Lopes <alvieboy at alvie.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "autodetect.h"
+#include <stdio.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#define PCI_VENDOR_OPTION_NV 0x1931
+#define PCI_DEVICE_QUALCOMM_MSM6275 0x000c
+
+#define USB_VENDOR_OPTION 0x0af0
+#define USB_DEVICE_OPTION_UMTS_CARD 0x5000
+#define USB_DEVICE_OPTION_FUSION_CARD 0x6300
+
+#define NOZOMI_DEVICE "/dev/noz2"
+
+
+struct device_info *device_info_new()
+{
+ struct device_info *info;
+
+ info = g_new0( struct device_info, 1 );
+
+ return info;
+}
+
+void device_info_free( struct device_info *i )
+{
+ if ( i->device != NULL )
+ g_free ( i->device );
+ if ( i->device_description != NULL )
+ g_free ( i->device_description );
+ if ( i->error_reason != NULL )
+ g_free ( i->error_reason );
+ g_free( i );
+
+}
+
+gboolean nozomi_detect( struct known_device *dev )
+{
+ struct stat st;
+ int fd;
+
+ if ( ! dev->info )
+ dev->info = device_info_new();
+
+ if ( dev->info->error_reason )
+ g_free(dev->info->error_reason);
+
+ dev->info->error_reason = NULL;
+
+ if ( stat( NOZOMI_DEVICE, &st ) < 0 )
+ {
+ /* Does not exist?? */
+ dev->info->error_reason = g_strdup( g_strerror(errno) );
+ return FALSE;
+ }
+
+ /* just try to open the device */
+
+ dev->info->device = g_strdup( NOZOMI_DEVICE );
+
+ return TRUE;
+}
+
+gboolean serial_detect( struct known_device *dev )
+{
+}
+
+
+static struct known_device devs[] =
+{
+ {
+ "Option N.V. Qualcomm MSM6275 UMTS chip",
+ "Generic Driver",
+ DEVICE_TYPE_PCI,
+ PCI_VENDOR_OPTION_NV,
+ PCI_DEVICE_QUALCOMM_MSM6275,
+ &nozomi_detect
+ },
+
+ {
+ "Option UMTS device",
+ "Generic Driver",
+ DEVICE_TYPE_USB,
+ USB_VENDOR_OPTION,
+ USB_DEVICE_OPTION_UMTS_CARD,
+ &serial_detect
+ },
+
+ { NULL, NULL, DEVICE_TYPE_NONE, 0, 0, NULL }
+};
+
+void free_single_device( struct known_device *d, void *data )
+{
+ if (d==NULL)
+ return;
+ if ( d->info == NULL )
+ return;
+ device_info_free( d->info );
+
+ d->info = NULL;
+
+}
+
+void free_detected_devices( GList *l )
+{
+ GList *item;
+ struct known_device *d;
+
+ g_list_foreach( l, (GFunc) free_single_device, NULL );
+
+ //l = g_list_remove_all( l, 0 );
+
+ g_list_free( l );
+}
+
+
+
+static GList *detect_pci_devices(GList *l)
+{
+#ifdef HAVE_PCIUTILS
+ struct pci_access *pcia;
+ struct pci_dev *pdev;
+ struct known_device *d;
+
+ pcia = pci_alloc();
+
+ if ( NULL == pcia )
+ return NULL;
+
+ pci_init( pcia );
+
+ pci_scan_bus( pcia );
+
+ if ( pcia->devices == NULL ) {
+ return NULL;
+ }
+
+ for ( pdev = pcia->devices; pdev; pdev=pdev->next ) {
+
+ for ( d = devs; d->description; d++ ) {
+
+ if ( d->type == DEVICE_TYPE_PCI &&
+ pdev->vendor_id == d->vendor &&
+ pdev->device_id == d->product )
+ {
+ printf("Found PCI device '%s'\n", d->description);
+ l = g_list_append( l, d );
+ d->detect_device( d );
+ }
+ }
+ }
+
+pci_exit_cleanup:
+ pci_cleanup( pcia );
+#endif
+ return l;
+}
+
+static GList *detect_usb_devices(GList *l)
+{
+#ifdef HAVE_USBUTILS
+ struct usb_bus *bus;
+ struct usb_device *dev;
+ struct known_device *d;
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+
+ bus = usb_get_busses();
+
+ while ( bus ) {
+ dev = bus->devices;
+ while (dev) {
+ fprintf(stderr,"%s\n", dev->filename );
+ for ( d = devs; d->description; d++ ) {
+
+ if ( d->type == DEVICE_TYPE_USB &&
+ dev->descriptor.idVendor == d->vendor &&
+ dev->descriptor.idProduct == d->product )
+ {
+ printf("Found USB device '%s'\n", d->description);
+ l = g_list_append( l, d );
+
+ /* Fill in the real name of the device */
+
+ d->detect_device( d );
+ }
+ }
+ dev=dev->next;
+ }
+ bus = bus->next;
+ }
+
+#endif
+ return l;
+}
+
+GList *detect_devices()
+{
+ GList *l = NULL;
+ //g_list_alloc();
+ l = detect_pci_devices( l );
+ l = detect_usb_devices( l );
+ return l;
+}
Added: xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.h
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.h (rev 0)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/autodetect.h 2006-10-30 19:58:55 UTC (rev 2139)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2006 Alvaro Lopes <alvieboy at alvie.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __AUTODETECT_H__
+#define __AUTODETECT_H__
+
+#include "config.h"
+#include <glib.h>
+#include <dlfcn.h>
+
+#ifdef HAVE_PCIUTILS
+#include <pci/pci.h>
+#endif
+
+#ifdef HAVE_USBUTILS
+#include <usb.h>
+#endif
+
+enum device_type_t
+{
+ DEVICE_TYPE_NONE,
+ DEVICE_TYPE_USB,
+ DEVICE_TYPE_PCI
+};
+
+struct device_info
+{
+ gchar *device;
+ gchar *device_description;
+ gchar *error_reason;
+};
+
+struct known_device
+{
+ const gchar *description;
+ const gchar *driver;
+ /*
+ We can fill device_description for USB devices,
+ reading the ID directly from the card. Otherwise is
+ NULL, so use the description field instead
+ */
+ enum device_type_t type;
+ int vendor;
+ int product;
+ gboolean (*detect_device)( struct known_device *dev );
+
+ /* This can be changed - depends on driver */
+
+ struct device_info *info;
+};
+
+/*
+ Prototypes
+ */
+
+GList *detect_devices();
+void free_detected_devices( GList *l );
+
+#endif
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.c
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.c 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.c 2006-10-30 19:58:55 UTC (rev 2139)
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
#include "cellmodem.h"
#include "modem_driver.h"
#include "preferences.h"
@@ -37,6 +38,7 @@
static void cellmodem_t_get_pin_status( cellmodem_t *monitor );
static void cellmodem_t_send_pin( cellmodem_t *monitor, const gchar *pin );
static void cellmodem_t_set_tooltip_info( cellmodem_t *monitor );
+static void cellmodem_t_get_ohcip_status( cellmodem_t *monitor );
static gboolean cellmodem_button_event(GtkEventBox *box, GdkEventButton *button, cellmodem_t *monitor);
static gboolean cellmodem_t_open_modem(cellmodem_t *monitor);
static void cellmodem_t_switch_status( cellmodem_t *monitor, modem_status_t status );
@@ -124,6 +126,7 @@
case MODEM_WAIT_CSQ_RESPONSE:
case MODEM_WAIT_CPIN_RESPONSE:
case MODEM_WAIT_COPS_RESPONSE:
+ case MODEM_WAIT_PINE_RESPONSE:
case MODEM_CLOSED:
cellmodem_t_set_ok( monitor );
break;
@@ -155,6 +158,10 @@
led_t_set_color( monitor->network_led, LED_YELLOW );
led_t_set_flashing( monitor->network_led, TRUE );
break;
+ case REGISTRATION_HSDPA:
+ led_t_set_color( monitor->network_led, LED_BLUE );
+ led_t_set_flashing( monitor->network_led, FALSE );
+ break;
default:
led_t_set_color( monitor->network_led, LED_GREEN );
led_t_set_flashing( monitor->network_led, FALSE );
@@ -761,8 +768,10 @@
cellmodem_t_switch_network_status( monitor, REGISTRATION_GPRS );
break;
case 2:
- cellmodem_t_switch_network_status( monitor, REGISTRATION_UMTS );
- break;
+ //cellmodem_t_switch_network_status( monitor, REGISTRATION_UMTS );
+ /* Check for HSDPA/UMTS */
+ cellmodem_t_get_ohcip_status( monitor );
+ return;
default:
cellmodem_t_switch_network_status( monitor, REGISTRATION_UNKNOWN );
}
@@ -803,7 +812,7 @@
}
/* +CPIN: SIM PIN */
- /* +CPIN: OK */
+ /* +CPIN: READY */
if ( strncmp(response->str,"+CPIN: ", 7 )==0 ) {
gchar *start = response->str + 7;
@@ -834,8 +843,57 @@
reschedule_open( monitor );
}
+/**
+ * @brief [cellmodem_t pseudo-member] Callback for OHCIP status request
+ *
+ * @param success TRUE. We ignore OHCIP errors, not all modem support it
+ * @param response GString with modem response
+ * @param pvt Pointer to cellmodem object
+ *
+ * pvt will be deferenced to cellmodem object upon calling. No typechecking is done.
+ *
+ * @return Nothing
+ */
static void
+cellmodem_t_ohcip_callback(gboolean success, GString *response, void *pvt)
+{
+ cellmodem_t *monitor = (cellmodem_t*)pvt;
+ gboolean failure = FALSE;
+
+ if ( !success || response==NULL || response->str==NULL ) {
+ /* Error - ignore */
+ cellmodem_t_switch_network_status( monitor, REGISTRATION_UMTS );
+ goto ohcip_out;
+ }
+
+ /* +CPIN: SIM PIN */
+ /* +CPIN: READY */
+
+ if ( strncmp(response->str,"_OHCIP: ", 8 )==0 ) {
+ gchar *start = response->str + 8;
+ DEBUG("OHCIP: '%s'", start);
+ if ( strncmp( start, "1", 1) == 0) {
+
+ cellmodem_t_switch_network_status( monitor, REGISTRATION_HSDPA );
+ } else {
+ cellmodem_t_switch_network_status( monitor, REGISTRATION_UMTS );
+ }
+
+ /* Errors found ?? . */
+ } else {
+ cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid OHCIP reply from modem") );
+
+ reschedule_open( monitor );
+ }
+ if ( failure )
+ cellmodem_t_switch_to_error_and_restart( monitor, _("Unsupportted OHCIP reply from modem") );
+ohcip_out:
+ cellmodem_t_get_quality( monitor );
+}
+
+
+static void
cellmodem_t_setpin_callback(gboolean success, GString *response, void *pvt)
{
cellmodem_t *monitor = (cellmodem_t*)pvt;
@@ -852,6 +910,8 @@
/* Just try to reopen. */
+ cellmodem_t_switch_status( monitor, MODEM_CLOSED );
+
reschedule_open( monitor /*, FALSE*/ );
}
@@ -988,8 +1048,26 @@
}
+/**
+ * @brief [cellmodem_t member] Request HSDPA Call-In-Progress status from modem
+ *
+ * @param monitor The cellmodem object
+ *
+ * This is asynchronous. Pseudo-method "cellmodem_t_ohcip_callback" will
+ * be called when modem replies.
+ *
+ * @return Nothing
+ */
static void
+cellmodem_t_get_ohcip_status( cellmodem_t *monitor )
+{
+ cellmodem_t_send_at_command(monitor, &cellmodem_t_ohcip_callback, "_OHCIP?" );
+ cellmodem_t_switch_status( monitor, MODEM_WAIT_OHCIP_RESPONSE );
+}
+
+
+static void
cellmodem_t_send_pin( cellmodem_t *monitor, const gchar *pin )
{
GString *g = g_string_new("+CPIN=");
@@ -1000,9 +1078,7 @@
cellmodem_t_send_at_command(monitor, &cellmodem_t_setpin_callback, g->str );
g_string_free( g, TRUE );
- cellmodem_t_switch_status( monitor, MODEM_WAIT_REGISTRATION );
-
- cellmodem_t_is_registered( monitor );
+ cellmodem_t_switch_status( monitor, MODEM_WAIT_PINE_RESPONSE );
} else {
cellmodem_t_switch_to_error_and_restart( monitor, _("Cannot open modem") );
}
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.h
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.h 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/cellmodem.h 2006-10-30 19:58:55 UTC (rev 2139)
@@ -19,9 +19,7 @@
#ifndef __CELLMODEM_H__
#define __CELLMODEM_H__
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include "cellmodem.h"
#include "modem_driver.h"
@@ -37,7 +35,6 @@
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/libxfcegui4.h>
#include <libxfce4panel/xfce-panel-plugin.h>
-
#include "leds.h"
#ifdef DEBUG_ENABLED
@@ -88,6 +85,8 @@
MODEM_WAIT_COPS_RESPONSE,
MODEM_WAIT_CSQ_RESPONSE,
MODEM_WAIT_REGISTRATION,
+ MODEM_WAIT_PINE_RESPONSE,
+ MODEM_WAIT_OHCIP_RESPONSE,
MODEM_CLOSED
} modem_status_t;
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/leds.c
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/leds.c 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/leds.c 2006-10-30 19:58:55 UTC (rev 2139)
@@ -17,7 +17,15 @@
*/
#include "leds.h"
+
+#ifdef BIG_LEGS
#include "big_leds.xpm"
+#define LED_XPM big_leds_xpm
+#else
+#include "med_leds.xpm"
+#define LED_XPM med_leds_xpm
+#endif
+
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "cellmodem.h"
@@ -27,18 +35,28 @@
static GSList *flashing_leds;
static gint flash_timer;
+#ifdef BIG_LEGS
+
static int led_h_size = 8;
static int led_v_size = 8;
-#define NUMBER_OF_LEDS 4
+#else
+static int led_h_size = 6;
+static int led_v_size = 6;
+
+#endif
+
+
+#define NUMBER_OF_LEDS 5
+
GdkPixbuf *pixleds[NUMBER_OF_LEDS];
static gboolean initialize_leds()
{
int i;
- whole_leds = gdk_pixbuf_new_from_xpm_data( (const char**)big_leds_xpm );
+ whole_leds = gdk_pixbuf_new_from_xpm_data( (const char**)LED_XPM );
if (whole_leds == NULL)
return FALSE;
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/leds.h
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/leds.h 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/leds.h 2006-10-30 19:58:55 UTC (rev 2139)
@@ -26,7 +26,8 @@
LED_OFF = 2,
LED_GREEN = 1,
LED_RED = 0,
- LED_YELLOW = 3
+ LED_YELLOW = 3,
+ LED_BLUE = 4,
} led_color_t;
typedef struct
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/med_leds.xpm
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/med_leds.xpm 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/med_leds.xpm 2006-10-30 19:58:55 UTC (rev 2139)
@@ -1,6 +1,6 @@
/* XPM */
static char * med_leds_xpm[] = {
-"36 6 128 2",
+"36 6 120 2",
" c None",
". c #FF4242",
"+ c #FF2B2B",
@@ -17,121 +17,113 @@
", c #E9C949",
"' c #E7C334",
") c #E3BC1E",
-"! c #8C53E1",
-"~ c #7E3FDD",
-"{ c #6F29DA",
-"] c #7029DA",
-"^ c #EB49DE",
-"/ c #E834DA",
-"( c #E71CD6",
-"_ c #E71DD6",
-": c #FF5151",
-"< c #FF8989",
-"[ c #FF8888",
-"} c #FF2626",
-"| c #FF0101",
-"1 c #74DC71",
-"2 c #A0E69E",
-"3 c #9FE79E",
-"4 c #52D34F",
-"5 c #35CB31",
-"6 c #965F36",
-"7 c #AB7144",
-"8 c #AC7042",
-"9 c #83532E",
-"0 c #724727",
-"a c #ECCF5E",
-"b c #F0DB84",
-"c c #F0DA83",
-"d c #E6C334",
-"e c #E2BA1A",
-"f c #E3BB1D",
-"g c #9967E4",
-"h c #B28CEB",
-"i c #B18AEA",
-"j c #7E3FDE",
-"k c #6D25D9",
-"l c #6F28DA",
-"m c #ED5FE2",
-"n c #F186E9",
-"o c #F184E8",
-"p c #E934DA",
-"q c #E618D5",
-"r c #E71BD6",
-"s c #FF4343",
-"t c #FFA1A1",
-"u c #FF3131",
-"v c #69D966",
-"w c #B3EBB2",
-"x c #5AD558",
-"y c #905B33",
-"z c #B47849",
-"A c #B67847",
-"B c #885630",
-"C c #724827",
-"D c #734727",
-"E c #EBCE59",
-"F c #F5E7B0",
-"G c #F5E7AF",
-"H c #E9C846",
-"I c #9662E4",
-"J c #CDB4F1",
-"K c #8A50E0",
-"L c #EC59E0",
-"M c #F6B1F0",
-"N c #F6B0F0",
-"O c #EA47DD",
-"P c #FF1212",
-"Q c #FF3E3E",
-"R c #FF3F3F",
-"S c #FF0B0B",
-"T c #FF0000",
-"U c #42CF3F",
-"V c #64D862",
-"W c #65D862",
-"X c #3CCD39",
-"Y c #34CB30",
-"Z c #7A4D2A",
-"` c #8D5A32",
-" . c #8E5A32",
-".. c #774A29",
-"+. c #E6C130",
-"@. c #ECD060",
-"#. c #ECD061",
-"$. c #E5BF28",
-"%. c #E2BA19",
-"&. c #7B3ADD",
-"*. c #9B6AE5",
-"=. c #7633DC",
-"-. c #6C24D9",
-";. c #6C25D9",
-">. c #E82FD9",
-",. c #ED61E2",
-"'. c #ED62E2",
-"). c #E728D8",
-"!. c #E617D5",
-"~. c #FF0505",
-"{. c #FF0303",
-"]. c #38CC34",
-"^. c #734828",
-"/. c #E3BD22",
-"(. c #E4BD21",
-"_. c #E3BB1B",
-":. c #722CDA",
-"<. c #722DDA",
-"[. c #6D26D9",
-"}. c #E61BD6",
-"|. c #E720D6",
-"1. c #E720D7",
-"2. c #E619D5",
-"3. c #E2BB1C",
-"4. c #E2BA1B",
-"5. c #6E27D9",
-"6. c #6E26D9",
-"7. c #E61AD5",
-" . + @ # $ % & * = - ; > , ' ) ) ! ~ { ] ^ / ( _ ",
-": < [ } | # 1 2 3 4 5 * 6 7 8 9 0 > a b c d e f g h i j k l m n o p q r ",
-"s t t u | | v w w x 5 5 y z A B C D E F G H e e I J J K k k L M N O q q ",
-"P Q R S T | U V W X Y 5 Z ` ...0 0 +. at .#.$.%.e &.*.*.=.-.;.>.,.'.).!.q ",
-"~.# # T T {.].* * Y Y * > ^.^.0 0 ^.f /.(.%.%._.l :.<.-.-.[.}.|.1.!.!.2.",
-" # | | # * 5 5 * > D 0 ^. 3.%.%.4. 5.-.-.6. 7.!.!.7. "};
+"! c #51FFC0",
+"~ c #45FFBB",
+"{ c #39FFB7",
+"] c #EB49DE",
+"^ c #E834DA",
+"/ c #E71CD6",
+"( c #E71DD6",
+"_ c #FF5151",
+": c #FF8989",
+"< c #FF8888",
+"[ c #FF2626",
+"} c #FF0101",
+"| c #74DC71",
+"1 c #A0E69E",
+"2 c #9FE79E",
+"3 c #52D34F",
+"4 c #35CB31",
+"5 c #965F36",
+"6 c #AB7144",
+"7 c #AC7042",
+"8 c #83532E",
+"9 c #724727",
+"0 c #ECCF5E",
+"a c #F0DB84",
+"b c #F0DA83",
+"c c #E6C334",
+"d c #E2BA1A",
+"e c #E3BB1D",
+"f c #5DFFC4",
+"g c #71FFCB",
+"h c #6FFFCA",
+"i c #35FFB5",
+"j c #37FFB6",
+"k c #ED5FE2",
+"l c #F186E9",
+"m c #F184E8",
+"n c #E934DA",
+"o c #E618D5",
+"p c #E71BD6",
+"q c #FF4343",
+"r c #FFA1A1",
+"s c #FF3131",
+"t c #69D966",
+"u c #B3EBB2",
+"v c #5AD558",
+"w c #905B33",
+"x c #B47849",
+"y c #B67847",
+"z c #885630",
+"A c #724827",
+"B c #734727",
+"C c #EBCE59",
+"D c #F5E7B0",
+"E c #F5E7AF",
+"F c #E9C846",
+"G c #59FFC2",
+"H c #87FFD3",
+"I c #4FFFBF",
+"J c #EC59E0",
+"K c #F6B1F0",
+"L c #F6B0F0",
+"M c #EA47DD",
+"N c #FF1212",
+"O c #FF3E3E",
+"P c #FF3F3F",
+"Q c #FF0B0B",
+"R c #FF0000",
+"S c #42CF3F",
+"T c #64D862",
+"U c #65D862",
+"V c #3CCD39",
+"W c #34CB30",
+"X c #7A4D2A",
+"Y c #8D5A32",
+"Z c #8E5A32",
+"` c #774A29",
+" . c #E6C130",
+".. c #ECD060",
+"+. c #ECD061",
+"@. c #E5BF28",
+"#. c #E2BA19",
+"$. c #43FFBA",
+"%. c #5FFFC5",
+"&. c #3FFFB9",
+"*. c #E82FD9",
+"=. c #ED61E2",
+"-. c #ED62E2",
+";. c #E728D8",
+">. c #E617D5",
+",. c #FF0505",
+"'. c #FF0303",
+"). c #38CC34",
+"!. c #734828",
+"~. c #E3BD22",
+"{. c #E4BD21",
+"]. c #E3BB1B",
+"^. c #3BFFB8",
+"/. c #E61BD6",
+"(. c #E720D6",
+"_. c #E720D7",
+":. c #E619D5",
+"<. c #E2BB1C",
+"[. c #E2BA1B",
+"}. c #E61AD5",
+" . + @ # $ % & * = - ; > , ' ) ) ! ~ { { ] ^ / ( ",
+"_ : < [ } # | 1 2 3 4 * 5 6 7 8 9 > 0 a b c d e f g h ~ i j k l m n o p ",
+"q r r s } } t u u v 4 4 w x y z A B C D E F d d G H H I i i J K L M o o ",
+"N O P Q R } S T U V W 4 X Y Z ` 9 9 ...+. at .#.d $.%.%.&.i i *.=.-.;.>.o ",
+",.# # R R '.).* * W W * > !.!.9 9 !.e ~.{.#.#.].j ^.^.i i j /.(._.>.>.:.",
+" # } } # * 4 4 * > B 9 !. <.#.#.[. j i i j }.>.>.}. "};
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.c
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.c 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.c 2006-10-30 19:58:55 UTC (rev 2139)
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
#include "modem_driver.h"
#include <string.h>
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.h
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.h 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/modem_driver.h 2006-10-30 19:58:55 UTC (rev 2139)
@@ -19,9 +19,7 @@
#ifndef __MODEMDRIVER_H__
#define __MODEMDRIVER_H__
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#define HAVE_FAKE_MODEM 1
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.c
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.c 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.c 2006-10-30 19:58:55 UTC (rev 2139)
@@ -18,6 +18,7 @@
#include "preferences.h"
#include "modem_driver.h"
+#include "autodetect.h"
static void
cellmodem_t_dialog_response( GtkWidget *dlg, int response, cellmodem_t *monitor )
@@ -155,6 +156,100 @@
gtk_spin_button_get_value_as_int( button );
}
+static void
+autodetect_dialog_callback( GtkDialog *dlg, int response, cellmodem_dialog_t *dialog )
+{
+
+ if ( response == GTK_RESPONSE_OK ) {
+ // Fill in device
+
+ guint a = gtk_combo_box_get_active( GTK_COMBO_BOX(dialog->device_combo) );
+
+ struct known_device *d = g_list_nth_data( dialog->devices, a );
+
+ if (d && d->info && d->info->device)
+ gtk_entry_set_text( GTK_ENTRY(dialog->device_entry), d->info->device );
+
+ /* Set the driver */
+
+ int di = find_driver_index_by_name( d->driver );
+
+ if (di>=0) {
+ gtk_combo_box_set_active( GTK_COMBO_BOX( dialog->driver_entry ), di );
+ }
+
+ }
+
+ free_detected_devices( dialog->devices );
+ dialog->devices = NULL;
+
+ gtk_widget_destroy( GTK_WIDGET( dialog->autodetect_dialog ) );
+}
+
+
+static void
+append_device_info( struct known_device *dev, GtkWidget *w )
+{
+
+ if (dev == NULL)
+ return;
+
+ gtk_combo_box_append_text(GTK_COMBO_BOX(w), dev->description );
+
+}
+
+static void
+cb_autodetect_modem(GtkButton *button, cellmodem_dialog_t *dialog)
+{
+ GtkWidget *label;
+
+ dialog->device_combo = NULL;
+
+ DEBUG("Getting devices");
+
+ dialog->devices = detect_devices();
+
+ dialog->autodetect_dialog = gtk_dialog_new();
+
+ gtk_dialog_add_button( GTK_DIALOG( dialog->autodetect_dialog), _("Close"), GTK_RESPONSE_CLOSE);
+
+ DEBUG("Parsing devices");
+
+ if ( g_list_length( dialog->devices ) == 0 ) {
+ label = gtk_label_new(_("No known device found.") );
+ } else {
+ label = gtk_label_new(_("The following devices were found:") );
+ dialog->device_combo = gtk_combo_box_new_text();
+
+ g_list_foreach( dialog->devices, (GFunc)&append_device_info, dialog->device_combo );
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX( dialog->device_combo ),0);
+
+ gtk_dialog_add_button( GTK_DIALOG( dialog->autodetect_dialog), _("Use this device"), GTK_RESPONSE_OK);
+
+ gtk_widget_show( dialog->device_combo );
+ }
+
+
+ gtk_widget_show( label );
+
+
+
+ gtk_box_pack_start( GTK_BOX( GTK_DIALOG(dialog->autodetect_dialog)->vbox ), label, FALSE, FALSE, 0);
+
+ if (dialog->device_combo)
+ gtk_box_pack_start( GTK_BOX( GTK_DIALOG(dialog->autodetect_dialog)->vbox ), dialog->device_combo, FALSE, FALSE, 0);
+
+ gtk_window_set_modal( GTK_WINDOW( dialog->autodetect_dialog ), TRUE );
+
+ gtk_window_set_default_size( GTK_WINDOW( dialog->autodetect_dialog ), 300, 100 );
+
+ g_signal_connect (dialog->autodetect_dialog, "response", G_CALLBACK (autodetect_dialog_callback), dialog);
+
+
+ gtk_widget_show( dialog->autodetect_dialog );
+}
+
void
cellmodem_create_options(XfcePanelPlugin *plugin, cellmodem_t *monitor)
{
@@ -251,7 +346,16 @@
g_signal_connect(dialog->device_entry, "changed", G_CALLBACK(cb_device_entry_changed), dialog);
+ MAKEHBOX( hbox );
+ GtkWidget *autodetect_button = gtk_button_new_with_label("Autodetect modem...");
+ gtk_widget_show(autodetect_button);
+ gtk_box_pack_start(GTK_BOX(hbox), autodetect_button, FALSE, FALSE, 0);
+ g_signal_connect(autodetect_button, "clicked", G_CALLBACK(cb_autodetect_modem), dialog);
+
+
+
+
MAKEHBOX( hbox );
MAKELABEL( label, _("Maximum quality:") );
gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
Modified: xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.h
===================================================================
--- xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.h 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/panel-plugin/preferences.h 2006-10-30 19:58:55 UTC (rev 2139)
@@ -28,8 +28,11 @@
GtkWidget *low_entry;
GtkWidget *critical_entry;
GtkWidget *maxqual_entry;
+ GtkWidget *autodetect_dialog;
+ GtkWidget *device_combo;
/* GtkWidget *ask_pin_entry;*/
cellmodem_t *monitor;
+ GList *devices;
} cellmodem_dialog_t;
void
Deleted: xfce4-cellmodem-plugin/trunk/po/Makefile.am
Modified: xfce4-cellmodem-plugin/trunk/po/POTFILES.in
===================================================================
--- xfce4-cellmodem-plugin/trunk/po/POTFILES.in 2006-10-30 19:10:19 UTC (rev 2138)
+++ xfce4-cellmodem-plugin/trunk/po/POTFILES.in 2006-10-30 19:58:55 UTC (rev 2139)
@@ -0,0 +1,8 @@
+panel-plugin/cellmodem.c
+panel-plugin/leds.c
+panel-plugin/modem_driver.c
+panel-plugin/modem_driver_fake.c
+panel-plugin/modem_driver_generic.c
+panel-plugin/pin_helper.c
+panel-plugin/preferences.c
+panel-plugin/autodetect.c
Added: xfce4-cellmodem-plugin/trunk/po/pt.po
===================================================================
--- xfce4-cellmodem-plugin/trunk/po/pt.po (rev 0)
+++ xfce4-cellmodem-plugin/trunk/po/pt.po 2006-10-30 19:58:55 UTC (rev 2139)
@@ -0,0 +1,214 @@
+# Tradução portuguesa para o xfce4-cellmodem-plugin
+# Copyright (C) 2006 Álvaro Lopes
+# This file is distributed under the same license as the xfce4-cellmodem-plugin package.
+# Álvaro Lopes <alvieboy at alvie.com>, 2006
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: xfce4-cellmodem-plugin 0.0.4\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2006-10-30 19:14+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Álvaro Lopes <alvieboy at alvie.com>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../panel-plugin/cellmodem.c:455
+msgid "Initializing plugin"
+msgstr "Inicializando o plugin"
+
+#: ../panel-plugin/cellmodem.c:478
+#, c-format
+msgid ""
+"Error detected:\n"
+"%s"
+msgstr ""
+"Erro detectado:\n"
+"%s"
+
+#: ../panel-plugin/cellmodem.c:484
+msgid "Not registered"
+msgstr "Não registrado na rede"
+
+#: ../panel-plugin/cellmodem.c:487
+msgid "Modem needs PIN"
+msgstr "Modem necessita de PIN"
+
+#: ../panel-plugin/cellmodem.c:490
+msgid "Registering"
+msgstr "A registrar na rede"
+
+#: ../panel-plugin/cellmodem.c:493
+#, c-format
+msgid ""
+"Registered [GPRS] to %s\n"
+"Quality: %d (%d%%)"
+msgstr ""
+"Registrado [GPRS] na rede %s\n"
+"Qualidade: %d (%d%%)"
+
+#: ../panel-plugin/cellmodem.c:496
+#, c-format
+msgid ""
+"Registered [UMTS] to %s\n"
+"Quality: %d (%d%%)"
+msgstr ""
+"Registrado [UMTS] na rede %s\n"
+"Qualidade: %d (%d%%)"
+
+#: ../panel-plugin/cellmodem.c:499
+#, c-format
+msgid ""
+"Registered [HSDPA] to %s\n"
+"Quality: %d (%d%%)"
+msgstr ""
+"Registrado [HSDPA] na rede %s\n"
+"Qualidade: %d (%d%%)"
+
+#: ../panel-plugin/cellmodem.c:502
+#, c-format
+msgid ""
+"Registered to %s\n"
+"Quality: %d (%d%%)"
+msgstr ""
+"Registrado na rede %s\n"
+"Qualidade: %d (%d%%)"
+
+#. Error
+#: ../panel-plugin/cellmodem.c:660
+msgid "Error in modem reply to CREG"
+msgstr "Erro na resposta CREG do modem"
+
+#: ../panel-plugin/cellmodem.c:669
+msgid "Invalid reply to +CREG"
+msgstr "Resposta inválida a +CREG"
+
+#: ../panel-plugin/cellmodem.c:694
+msgid "Invalid CREG reply from modem"
+msgstr "Resposta CREG inválida"
+
+#: ../panel-plugin/cellmodem.c:732
+msgid "Error in modem reply to COPS"
+msgstr "Erro na resposta COPS do modem"
+
+#: ../panel-plugin/cellmodem.c:775
+msgid "Invalid COPS reply from modem"
+msgstr "Resposta COPS inválida"
+
+#: ../panel-plugin/cellmodem.c:803
+msgid "Error in modem reply to CPIN"
+msgstr "Erro na resposta CPIN do modem"
+
+#: ../panel-plugin/cellmodem.c:829
+msgid "Invalid CPIN reply from modem"
+msgstr "Resposta CPIN inválida"
+
+#: ../panel-plugin/cellmodem.c:834
+msgid "Unsupportted CPIN reply from modem"
+msgstr "Resposta CPIN não suportada"
+
+#. Error
+#: ../panel-plugin/cellmodem.c:847
+msgid "Cannot send PIN to modem"
+msgstr "Não foi possível introduzir o PIN no modem"
+
+#: ../panel-plugin/cellmodem.c:883
+msgid "Error in modem reply to CSQ"
+msgstr "Erro na resposta CSQ do modem"
+
+#: ../panel-plugin/cellmodem.c:903
+msgid "Invalid CSQ reply from modem"
+msgstr "Resposta CSQ inválida"
+
+#: ../panel-plugin/cellmodem.c:1009 ../panel-plugin/cellmodem.c:1323
+msgid "Cannot open modem"
+msgstr "Não foi possível abrir o modem"
+
+#: ../panel-plugin/cellmodem.c:1153
+msgid "Error reading from modem"
+msgstr "Erro ao ler do modem"
+
+#: ../panel-plugin/cellmodem.c:1230
+msgid "Error writing to modem"
+msgstr "Erro ao escrever para o modem"
+
+#: ../panel-plugin/cellmodem.c:1246
+msgid "Modem did not reply to command"
+msgstr "O modem não respondeu ao comando"
+
+#: ../panel-plugin/cellmodem.c:1264
+msgid "No driver defined"
+msgstr "Não existe um controlador definido"
+
+#: ../panel-plugin/cellmodem.c:1269
+msgid "No modem instance"
+msgstr "Não existe instância do modem"
+
+#: ../panel-plugin/cellmodem.c:1434
+msgid "Modem initializing"
+msgstr "Modem a inicializar"
+
+#: ../panel-plugin/cellmodem.c:1469
+msgid "Invalid driver specified"
+msgstr "Controlador inválido especificado"
+
+#. Error.
+#: ../panel-plugin/pin_helper.c:31
+msgid "Invalid PIN entered. PIN has 4 digits"
+msgstr "Introduziu um PIN inválido. O PIN tem 4 dígitos"
+
+#: ../panel-plugin/pin_helper.c:65
+msgid "Enter PIN"
+msgstr "Introduza o PIN"
+
+#: ../panel-plugin/pin_helper.c:77
+msgid "Please enter PIN:"
+msgstr "Por favor introduza o PIN:"
+
+#: ../panel-plugin/preferences.c:214
+msgid "Close"
+msgstr "Fechar"
+
+#: ../panel-plugin/preferences.c:219
+msgid "No known device found."
+msgstr "Não foi encontrado nenhum dispositivo conhecido"
+
+#: ../panel-plugin/preferences.c:221
+msgid "The following devices were found:"
+msgstr "Os seguintes dispositivos foram encontrados:"
+
+#: ../panel-plugin/preferences.c:228
+msgid "Use this device"
+msgstr "Usar este dispositivo"
+
+#: ../panel-plugin/preferences.c:272
+msgid "Configure Cell Modem Monitor"
+msgstr "Configurar o Monitor de Modem Celular"
+
+#. The header - this was most copied from other sources
+#: ../panel-plugin/preferences.c:285
+msgid "Cellular Modem Monitor"
+msgstr "Monitor de Modem Celular"
+
+#: ../panel-plugin/preferences.c:316
+msgid "Modem driver:"
+msgstr "Controlador do modem:"
+
+#: ../panel-plugin/preferences.c:338
+msgid "Modem device:"
+msgstr "Dispositivo do Modem:"
+
+#: ../panel-plugin/preferences.c:360
+msgid "Maximum quality:"
+msgstr "Qualidade máxima:"
+
+#: ../panel-plugin/preferences.c:371
+msgid "Low quality percentage:"
+msgstr "Percentagem para baixa qualidade:"
+
+#: ../panel-plugin/preferences.c:381
+msgid "Critical quality percentage:"
+msgstr "Percentagem para qualidade crítica:"
More information about the Goodies-commits
mailing list