1 diff -urN gnome-applets-2.18.0/configure.in gnome-applets-2.18.0.new/configure.in
2 --- gnome-applets-2.18.0/configure.in 2007-03-12 13:57:09.000000000 +0100
3 +++ gnome-applets-2.18.0.new/configure.in 2007-06-10 12:30:15.000000000 +0200
5 GNOME_PYTHON_REQUIRED=2.10
6 GNOME_ICON_THEME_REQUIRED=2.15.91
8 +LIBOOBS_REQUIRED=0.5.0
9 dnl ***************************************************************************
13 dnl *** modemlights applet check ***
14 dnl ***************************************************************************
20 -AC_PATH_PROG(SU_TOOL, su)
21 -AC_CHECK_LIB(util, forkpty, HAVE_LIBUTIL=true, HAVE_LIBUTIL=false)
22 -AM_PATH_SYSTEM_TOOLS_BACKENDS($SYSTEM_TOOLS_BACKENDS_REQUIRED, P_MODEMLIGHTS=modemlights)
24 -if test "x$HAVE_LIBUTIL" = "xtrue" -a "x$P_MODEMLIGHTS" = "xmodemlights" -a "x$HAVE_GNOME_SETTINGS_DAEMON" = "xyes"; then
25 - MODEMLIGHTS_LIBS=" -lutil"
26 - AC_SUBST(MODEMLIGHTS_LIBS)
27 - AC_DEFINE_UNQUOTED(STB_SCRIPTS_DIR, "$STB_SCRIPTS_DIR", [System tools backends])
28 - AC_DEFINE_UNQUOTED(SU_PATH, "${SU_TOOL}", [su executable path])
32 +PKG_CHECK_MODULES(MODEMLIGHTS, liboobs-1 >= $LIBOOBS_REQUIRED,
33 + HAVE_LIBOOBS=yes, HAVE_LIBOOBS=no)
34 +if test "x$HAVE_LIBOOBS" = "xyes" -a "x$HAVE_GNOME_SETTINGS_DAEMON" = "xyes"; then
35 BUILD_MODEM_LIGHTS=yes
37 AC_MSG_WARN([*** modemlights applet will not be built ***])
41 +AC_SUBST(MODEMLIGHTS_LIBS)
42 +AC_SUBST(MODEMLIGHTS_CFLAGS)
43 AM_CONDITIONAL(APPLET_MODEMLIGHTS, test "x$BUILD_MODEM_LIGHTS" = "xyes")
45 dnl ***************************************************************************
46 diff -urN gnome-applets-2.18.0/modemlights/Makefile.am gnome-applets-2.18.0.new/modemlights/Makefile.am
47 --- gnome-applets-2.18.0/modemlights/Makefile.am 2006-12-31 03:16:08.000000000 +0100
48 +++ gnome-applets-2.18.0.new/modemlights/Makefile.am 2007-06-10 12:31:26.000000000 +0200
51 INCLUDES = -I. -I$(srcdir) \
52 $(GNOME_APPLETS_CFLAGS) \
53 + $(MODEMLIGHTS_CFLAGS) \
56 libexec_PROGRAMS = modem_applet
57 diff -urN gnome-applets-2.18.0/modemlights/modem-applet.c gnome-applets-2.18.0.new/modemlights/modem-applet.c
58 --- gnome-applets-2.18.0/modemlights/modem-applet.c 2006-12-31 03:16:08.000000000 +0100
59 +++ gnome-applets-2.18.0.new/modemlights/modem-applet.c 2007-06-10 13:32:32.000000000 +0200
63 #include <panel-applet.h>
68 -#include <sys/poll.h>
69 -#include <sys/types.h>
70 -#include <sys/wait.h>
71 -#include <libxml/tree.h>
72 +#include <oobs/oobs.h>
73 #include <glade/glade.h>
76 -#include <sys/ioctl.h>
81 #include "modem-applet.h"
83 #define MODEM_APPLET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_MODEM_APPLET, ModemAppletPrivate))
84 #define NETWORK_TOOL "network-admin"
85 -#define END_OF_REQUEST "<!-- GST: end of request -->\n"
86 -#define BUF_SIZE 1024
88 -typedef void (*DirectiveCallback) (ModemApplet*, xmlDoc*);
89 -typedef struct _BackendDirective BackendDirective;
90 typedef struct _ModemAppletPrivate ModemAppletPrivate;
92 struct _ModemAppletPrivate
95 GtkTooltips *tooltips;
98 - GtkWidget *auth_dialog;
99 - GtkWidget *auth_dialog_label;
100 - GtkWidget *auth_dialog_entry;
103 GtkWidget *report_window;
104 GtkWidget *report_window_image;
105 GtkWidget *report_window_progress;
107 - guint directives_id;
113 - /* for communicating with the backend */
119 - FILE *write_stream;
120 - GSList *directives;
121 - gboolean directive_running;
123 - /* interface data */
124 - gboolean configured; /* is configured? */
125 - gboolean enabled; /* is enabled? */
126 - gboolean is_isdn; /* is an isdn device? */
127 - gchar *dev; /* device name */
128 - gchar *lock_file; /* lock file */
132 + /* configuration */
133 + OobsSession *session;
134 + OobsObject *config;
138 -struct _BackendDirective
140 - DirectiveCallback callback;
142 - gboolean show_report;
147 static void modem_applet_class_init (ModemAppletClass *class);
149 gboolean backend_alive,
150 gboolean already_waiting);
152 -static gpointer parent_class;
154 static const BonoboUIVerb menu_verbs[] = {
155 BONOBO_UI_UNSAFE_VERB ("Activate", on_modem_applet_activate),
156 BONOBO_UI_UNSAFE_VERB ("Deactivate", on_modem_applet_deactivate),
162 -modem_applet_get_type (void)
164 - static GType type = 0;
168 - static const GTypeInfo info =
170 - sizeof (ModemAppletClass),
171 - NULL, /* base_init */
172 - NULL, /* base_finalize */
173 - (GClassInitFunc) modem_applet_class_init,
174 - NULL, /* class_finalize */
175 - NULL, /* class_data */
176 - sizeof (ModemApplet),
177 - 0, /* n_preallocs */
178 - (GInstanceInitFunc) modem_applet_init,
181 - type = g_type_register_static (PANEL_TYPE_APPLET, "ModemApplet",
187 +G_DEFINE_TYPE (ModemApplet, modem_applet, PANEL_TYPE_APPLET);
190 modem_applet_class_init (ModemAppletClass *class)
193 object_class = G_OBJECT_CLASS (class);
194 applet_class = PANEL_APPLET_CLASS (class);
195 - parent_class = g_type_class_peek_parent (class);
198 object_class->finalize = modem_applet_finalize;
199 applet_class->change_size = modem_applet_change_size;
200 applet_class->change_background = modem_applet_change_background;
202 g_type_class_add_private (object_class, sizeof (ModemAppletPrivate));
206 +get_modem_iface (OobsIfacesConfig *config)
212 + /* First try the modem ifaces */
213 + list = oobs_ifaces_config_get_ifaces (config, OOBS_IFACE_TYPE_MODEM);
214 + valid = oobs_list_get_iter_first (list, &iter);
217 + return (OobsIface *) oobs_list_get (list, &iter);
219 + /* no modem? try the isdn ifaces */
220 + list = oobs_ifaces_config_get_ifaces (config, OOBS_IFACE_TYPE_ISDN);
221 + valid = oobs_list_get_iter_first (list, &iter);
224 + return (OobsIface *) oobs_list_get (list, &iter);
230 +get_lock_file (OobsIface *iface)
237 + if (OOBS_IS_IFACE_MODEM (iface))
239 + const gchar *serial_port, *str;
241 + serial_port = oobs_iface_modem_get_serial_port (OOBS_IFACE_MODEM (iface));
245 + str = strchr (serial_port, '/');
246 + lock_file = g_strdup_printf ("/var/lock/LCK..%s", str + 1);
249 + else if (OOBS_IS_IFACE_ISDN (iface))
250 + lock_file = g_strdup ("/var/lock/LCK..capi_0");
257 modem_applet_init (ModemApplet *applet)
260 priv->image = gtk_image_new ();
261 priv->tooltips = gtk_tooltips_new ();
263 - priv->auth_dialog = glade_xml_get_widget (priv->xml, "auth_dialog");
264 - priv->auth_dialog_label = glade_xml_get_widget (priv->xml, "auth_dialog_label");
265 - priv->auth_dialog_entry = glade_xml_get_widget (priv->xml, "auth_dialog_entry");
266 + priv->session = oobs_session_get ();
267 + priv->config = oobs_ifaces_config_get (priv->session);
268 + priv->iface = get_modem_iface (OOBS_IFACES_CONFIG (priv->config));
269 + priv->lock_file = get_lock_file (priv->iface);
271 priv->report_window = glade_xml_get_widget (priv->xml, "report_window");
272 priv->report_window_image = glade_xml_get_widget (priv->xml, "report_window_image");
274 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->report_window_image), pixbuf);
275 gdk_pixbuf_unref (pixbuf);
277 - priv->configured = FALSE;
278 - priv->enabled = FALSE;
280 - priv->lock_file = NULL;
282 - priv->has_root = FALSE;
284 - priv->directives = NULL;
285 - priv->directives_id = g_timeout_add (250, (GSourceFunc) dispatch_directives, applet);
286 - priv->directive_running = FALSE;
287 priv->tooltip_id = g_timeout_add (1000, (GSourceFunc) update_tooltip, applet);
289 - launch_backend (applet, FALSE);
290 gtk_container_add (GTK_CONTAINER (applet), priv->image);
293 @@ -246,18 +213,25 @@
297 - shutdown_backend (MODEM_APPLET (object), TRUE, TRUE);
299 - gtk_widget_destroy (priv->auth_dialog);
300 - gtk_widget_destroy (priv->report_window);
301 + g_object_unref (priv->xml);
302 g_object_unref (priv->icon);
303 + gtk_widget_destroy (priv->image);
305 + if (priv->pulse_id)
307 + g_source_remove (priv->pulse_id);
308 + priv->pulse_id = 0;
311 - g_free (priv->dev);
312 - g_free (priv->lock_file);
313 + if (priv->tooltip_id)
315 + g_source_remove (priv->tooltip_id);
316 + priv->tooltip_id = 0;
320 - if (G_OBJECT_CLASS (parent_class)->finalize)
321 - (* G_OBJECT_CLASS (parent_class)->finalize) (object);
322 + if (G_OBJECT_CLASS (modem_applet_parent_class)->finalize)
323 + (* G_OBJECT_CLASS (modem_applet_parent_class)->finalize) (object);
327 @@ -312,401 +286,26 @@
332 -pulse_progressbar (GtkWidget *progressbar)
334 - gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progressbar));
338 -/* XML manipulation functions */
340 -get_root_node (xmlDoc *doc)
342 - return xmlDocGetRootElement (doc);
346 -find_first_element (xmlNodePtr node, const gchar *name)
350 - g_return_val_if_fail (node != NULL, NULL);
351 - g_return_val_if_fail (name != NULL, NULL);
353 - for (n = node->children; n; n = n->next)
354 - if (n->name && (strcmp (name, (char *) n->name) == 0))
361 -find_next_element (xmlNodePtr node, const gchar *name)
365 - g_return_val_if_fail (node != NULL, NULL);
366 - g_return_val_if_fail (name != NULL, NULL);
368 - for (n = node->next; n; n = n->next)
369 - if (n->name && (strcmp (name, (char *) n->name) == 0))
376 -element_get_attribute (xmlNodePtr node, const gchar *attribute)
380 - g_return_val_if_fail (node != NULL, NULL);
381 - a = node->properties;
385 - if (a->name && (strcmp ((char *) a->name, attribute) == 0))
386 - return xmlNodeGetContent (a->children);
395 -element_get_child_content (xmlNodePtr node, const gchar *tag)
397 - xmlNodePtr child, n;
399 - child = find_first_element (node, tag);
403 - for (n = child->children; n; n = n->next)
404 - if (n->type == XML_TEXT_NODE)
405 - return xmlNodeGetContent (n);
411 -find_dialup_interface_node (xmlNodePtr root)
416 - node = find_first_element (root, "interface");
420 - type = (char *) element_get_attribute (node, "type");
422 - if (type && (strcmp (type, "modem") == 0 || strcmp (type, "isdn") == 0))
429 - node = find_next_element (node, "interface");
435 -/* backend communication functions */
437 -compose_directive_string (GSList *directive)
440 - gchar *arg, *s, *str;
444 - dir = g_string_new ("");
450 - for (s = arg; *s; s++)
452 - /* escape needed chars */
453 - if ((*s == '\\') ||
454 - ((*s == ':') && (* (s + 1) == ':')))
455 - g_string_append_c (dir, '\\');
457 - g_string_append_c (dir, *s);
460 - g_string_append (dir, "::");
464 - g_string_append_c (dir, '\n');
467 - g_string_free (dir, FALSE);
473 -poll_backend (ModemAppletPrivate *priv)
477 - fd.fd = priv->read_fd;
478 - fd.events = POLLIN || POLLPRI;
480 - while (poll (&fd, 1, 100) <= 0)
482 - while (gtk_events_pending ())
483 - gtk_main_iteration ();
488 -read_xml (ModemApplet *applet, gboolean show_report)
490 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
491 - gchar buffer[BUF_SIZE], *s;
493 - xmlDoc *doc = NULL;
494 - gboolean backend_alive;
496 - str = g_string_new ("");
497 - backend_alive = (waitpid (priv->pid, NULL, WNOHANG) == 0);
499 - /* if show_report, create pulse timeout and show window */
502 - priv->progress_id = gtk_timeout_add (200, (GSourceFunc) pulse_progressbar, priv->report_window_progress);
503 - gtk_window_set_screen (GTK_WINDOW (priv->report_window), gtk_widget_get_screen (GTK_WIDGET (applet)));
504 - gtk_widget_show (priv->report_window);
507 - while (backend_alive && !g_strrstr (str->str, END_OF_REQUEST))
509 - poll_backend (priv);
510 - fgets (buffer, BUF_SIZE, priv->read_stream);
511 - g_string_append (str, buffer);
513 - while (gtk_events_pending ())
514 - gtk_main_iteration ();
516 - backend_alive = (waitpid (priv->pid, NULL, WNOHANG) == 0);
519 - /* if show_report, hide window and so */
522 - g_source_remove (priv->progress_id);
523 - priv->progress_id = 0;
524 - gtk_widget_hide (priv->report_window);
529 - while (*s && (*s != '<'))
532 - if (strcmp (s, END_OF_REQUEST) != 0)
533 - doc = xmlParseDoc ((xmlChar *) s);
535 - g_string_free (str, TRUE);
541 -queue_directive (ModemApplet *applet,
542 - DirectiveCallback callback,
543 - gboolean show_report,
547 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
548 - BackendDirective *directive;
549 - GSList *list = NULL;
553 - list = g_slist_prepend (list, g_strdup (dir));
554 - va_start (ap, dir);
556 - while ((arg = va_arg (ap, gchar *)) != NULL)
557 - list = g_slist_prepend (list, g_strdup (arg));
560 - list = g_slist_reverse (list);
562 - directive = g_new0 (BackendDirective, 1);
563 - directive->callback = callback;
564 - directive->directive = list;
565 - directive->show_report = show_report;
567 - priv->directives = g_slist_append (priv->directives, directive);
571 -dispatch_directives (ModemApplet *applet)
573 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
574 - BackendDirective *directive;
579 - if (priv->directive_running)
582 - priv->directive_running = TRUE;
583 - elem = priv->directives;
587 - directive = elem->data;
589 - dir = compose_directive_string (directive->directive);
590 - fputs (dir, priv->write_stream);
593 - doc = read_xml (applet, directive->show_report);
595 - if (directive->callback)
596 - directive->callback (applet, doc);
601 - g_slist_foreach (directive->directive, (GFunc) g_free, NULL);
602 - g_slist_free (directive->directive);
607 - g_slist_foreach (priv->directives, (GFunc) g_free, NULL);
608 - g_slist_free (priv->directives);
609 - priv->directives = NULL;
610 - priv->directive_running = FALSE;
616 -shutdown_backend (ModemApplet *applet, gboolean backend_alive, gboolean already_waiting)
618 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
622 - g_source_remove (priv->info_id);
626 - if (priv->timeout_id)
628 - g_source_remove (priv->timeout_id);
629 - priv->timeout_id = 0;
632 - if (priv->tooltip_id)
634 - g_source_remove (priv->tooltip_id);
635 - priv->tooltip_id = 0;
639 - kill (priv->pid, 9);
641 - if (!already_waiting)
643 - /* don't leave zombies */
644 - while (waitpid (priv->pid, NULL, WNOHANG) <= 0)
648 - while (gtk_events_pending ())
649 - gtk_main_iteration ();
653 - /* close remaining streams and fds */
654 - fclose (priv->read_stream);
655 - fclose (priv->write_stream);
656 - close (priv->read_fd);
657 - close (priv->write_fd);
660 -/* functions for extracting the interface information from the XML */
662 update_popup_buttons (ModemApplet *applet)
664 BonoboUIComponent *component;
665 ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
668 component = panel_applet_get_popup_component (PANEL_APPLET (applet));
669 + enabled = (priv->iface && oobs_iface_get_active (priv->iface));
671 bonobo_ui_component_set_prop (component,
672 "/commands/Activate",
673 - "sensitive", (priv->configured && !priv->enabled) ? "1" : "0",
674 + "sensitive", (enabled) ? "1" : "0",
676 bonobo_ui_component_set_prop (component,
677 "/commands/Deactivate",
678 - "sensitive", (priv->configured && priv->enabled) ? "1" : "0",
679 + "sensitive", (enabled) ? "1" : "0",
684 -get_interface_data (ModemApplet *applet, xmlNodePtr iface)
686 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
687 - xmlNodePtr configuration;
688 - gchar *text, *device;
690 - g_return_if_fail (iface != NULL);
692 - text = (char *) element_get_child_content (iface, "enabled");
693 - priv->enabled = (*text == '1');
696 - g_free (priv->dev);
697 - priv->dev = (char *) element_get_child_content (iface, "dev");
699 - g_free (priv->lock_file);
700 - configuration = find_first_element (iface, "configuration");
704 - priv->configured = TRUE;
705 - text = (char *) element_get_child_content (configuration, "serial_port");
710 - device = strrchr (text, '/');
711 - priv->lock_file = g_strdup_printf ("/var/lock/LCK..%s", device + 1);
714 - priv->is_isdn = FALSE;
719 - priv->lock_file = g_strdup ("/var/lock/LCK..capi_0");
720 - priv->is_isdn = TRUE;
725 - priv->lock_file = NULL;
726 - priv->configured = FALSE;
731 get_connection_time (const gchar *lock_file)
733 @@ -725,30 +324,30 @@
738 + if (!priv->lock_file)
739 + text = g_strdup (_("Could not get connection time"));
742 - if (!priv->lock_file)
743 - text = g_strdup (_("Connection active, but could not get connection time"));
744 + t = get_connection_time (priv->lock_file);
747 + text = g_strdup (_("Not connected"));
750 - t = get_connection_time (priv->lock_file);
752 - if (t < (60 * 60 * 24))
754 - t1 = t / 3600; /* hours */
755 - t2 = (t - (t1 * 3600)) / 60; /* minutes */
759 - t1 = t / (3600 * 24); /* days */
760 - t2 = (t - (t1 * 3600 * 24)) / 3600; /* hours */
763 + if (t < (60 * 60 * 24))
765 + t1 = t / 3600; /* hours */
766 + t2 = (t - (t1 * 3600)) / 60; /* minutes */
770 + t1 = t / (3600 * 24); /* days */
771 + t2 = (t - (t1 * 3600 * 24)) / 3600; /* hours */
774 text = g_strdup_printf (_("Time connected: %.1d:%.2d"), t1, t2);
778 - text = g_strdup (_("Not connected"));
780 gtk_tooltips_set_tip(priv->tooltips, GTK_WIDGET (applet), text, NULL);
782 @@ -756,165 +355,8 @@
787 -rerun_backend_callback (ModemApplet *applet, xmlDoc *doc)
789 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
790 - gchar *text, *password;
794 - shutdown_backend (applet, FALSE, FALSE);
795 - launch_backend (applet, TRUE);
797 - enable = !priv->enabled;
800 - _("To connect to your Internet service provider, you need administrator privileges") :
801 - _("To disconnect from your Internet service provider, you need administrator privileges");
803 - gtk_label_set_text (GTK_LABEL (priv->auth_dialog_label), text);
804 - gtk_window_set_screen (GTK_WINDOW (priv->auth_dialog),
805 - gtk_widget_get_screen (GTK_WIDGET (applet)));
807 - gtk_widget_grab_focus (priv->auth_dialog_entry);
808 - response = gtk_dialog_run (GTK_DIALOG (priv->auth_dialog));
809 - gtk_widget_hide (priv->auth_dialog);
810 - password = (gchar *) gtk_entry_get_text (GTK_ENTRY (priv->auth_dialog_entry));
812 - if (response == GTK_RESPONSE_OK)
815 - password = (gchar *) gtk_entry_get_text (GTK_ENTRY (priv->auth_dialog_entry));
816 - fputs (password, priv->write_stream);
817 - fputs ("\n", priv->write_stream);
819 - while (fflush (priv->write_stream) != 0);
821 - queue_directive (applet, NULL, enable,
822 - "enable_iface", priv->dev, (enable) ? "1" : "0", NULL);
826 - shutdown_backend (applet, TRUE, FALSE);
827 - launch_backend (applet, FALSE);
830 - /* stab the root password */
831 - memset (password, ' ', sizeof (password));
832 - gtk_entry_set_text (GTK_ENTRY (priv->auth_dialog_entry), "");
836 -update_info_callback (ModemApplet *applet, xmlDoc *doc)
843 - iface = find_dialup_interface_node (get_root_node (doc));
847 - get_interface_data (applet, iface);
848 - update_popup_buttons (applet);
852 -update_info (ModemApplet *applet)
854 - queue_directive (applet, update_info_callback,
855 - FALSE, "get", NULL);
860 -check_backend (ModemApplet *applet)
862 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
863 - gint status, pid = -1;
866 - pid = waitpid (priv->pid, &status, WNOHANG);
870 - if (errno == ECHILD || ((WIFEXITED (status)) && (WEXITSTATUS (status)) && (WEXITSTATUS(status) < 255)))
872 - dialog = gtk_message_dialog_new (NULL,
874 - GTK_MESSAGE_WARNING,
876 - _("The entered password is invalid"));
877 - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
878 - _("Check that you have typed it correctly and that "
879 - "you haven't activated the \"caps lock\" key"));
880 - gtk_dialog_run (GTK_DIALOG (dialog));
881 - gtk_widget_destroy (dialog);
884 - priv->timeout_id = 0;
885 - shutdown_backend (applet, FALSE, TRUE);
886 - launch_backend (applet, FALSE);
895 -launch_backend (ModemApplet *applet, gboolean root_auth)
897 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
898 - gchar *non_auth_args[] = { STB_SCRIPTS_DIR "/network-conf", NULL };
899 - gchar *auth_args[] = { SU_PATH, "-c", STB_SCRIPTS_DIR "/network-conf", NULL };
904 - priv->pid = forkpty (&priv->write_fd, NULL, NULL, NULL);
905 - args = (root_auth) ? auth_args : non_auth_args;
908 - g_warning ("Could not spawn GST backend");
911 - if (priv->pid == 0)
913 - /* child process */
914 - unsetenv("LC_ALL");
915 - unsetenv("LC_MESSAGES");
917 - unsetenv("LANGUAGE");
923 - execv (args[0], args);
930 - priv->read_fd = p[0];
931 - priv->timeout_id = g_timeout_add (1000, (GSourceFunc) check_backend, applet);
932 - priv->info_id = g_timeout_add (2500, (GSourceFunc) update_info, applet);
933 - priv->read_stream = fdopen (priv->read_fd, "r");
934 - priv->write_stream = fdopen (priv->write_fd, "w");
935 - priv->has_root = root_auth;
937 - setvbuf (priv->read_stream, NULL, _IONBF, 0);
938 - fcntl (priv->read_fd, F_SETFL, 0);
944 -launch_config_tool (GdkScreen *screen, gboolean is_isdn)
945 +launch_config_tool (GdkScreen *screen, OobsIface *iface)
947 gchar *argv[4], *application;
952 argv[0] = application;
953 - argv[1] = "--configure-type";
954 - argv[2] = (is_isdn) ? "isdn" : "modem";
955 + argv[1] = "--configure";
956 + argv[2] = (gchar*) oobs_iface_get_device_name (iface);
959 ret = gdk_spawn_on_screen (screen, NULL, argv, NULL, 0,
960 @@ -935,52 +377,48 @@
965 -toggle_interface_non_root (ModemApplet *applet, gboolean enable)
967 +pulse_progressbar (GtkProgressBar *progressbar)
969 - queue_directive (applet, rerun_backend_callback,
970 - FALSE, "end", NULL);
971 + gtk_progress_bar_pulse (progressbar);
976 -toggle_interface_root (ModemApplet *applet, gboolean enable)
977 +show_report_window (ModemApplet *applet)
979 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
982 + ModemAppletPrivate *priv;
985 - _("Do you want to connect?") :
986 - _("Do you want to disconnect?");
988 - dialog = gtk_message_dialog_new (NULL,
990 - GTK_MESSAGE_QUESTION,
993 - gtk_dialog_add_buttons (GTK_DIALOG (dialog),
994 - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
995 - (enable) ? _("C_onnect") : _("_Disconnect"),
996 - GTK_RESPONSE_OK, NULL);
997 - gtk_window_set_screen (GTK_WINDOW (dialog),
998 - gtk_widget_get_screen (GTK_WIDGET (applet)));
1000 - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
1001 - queue_directive (applet, NULL, enable,
1002 - "enable_iface", priv->dev, (enable) ? "1" : "0", NULL);
1003 + priv = MODEM_APPLET_GET_PRIVATE (applet);
1004 + gtk_widget_show (priv->report_window);
1005 + priv->pulse_id = g_timeout_add (300, (GSourceFunc) pulse_progressbar, priv->report_window_progress);
1009 +hide_report_window (ModemApplet *applet)
1011 + ModemAppletPrivate *priv;
1013 - gtk_widget_destroy (dialog);
1014 + priv = MODEM_APPLET_GET_PRIVATE (applet);
1015 + gtk_widget_hide (priv->report_window);
1017 + if (priv->pulse_id != 0)
1019 + g_source_remove (priv->pulse_id);
1020 + priv->pulse_id = 0;
1025 -toggle_interface (ModemApplet *applet, gboolean enable)
1026 +on_config_committed (OobsObject *object,
1027 + OobsResult result,
1030 - ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
1031 + ModemApplet *applet = MODEM_APPLET (data);
1033 - if (priv->has_root)
1034 - toggle_interface_root (applet, enable);
1036 - toggle_interface_non_root (applet, enable);
1037 + hide_report_window (applet);
1038 + gtk_widget_set_sensitive (GTK_WIDGET (applet), FALSE);
1039 + update_popup_buttons (applet);
1043 @@ -988,7 +426,14 @@
1044 ModemApplet *applet,
1047 - toggle_interface (applet, TRUE);
1048 + ModemAppletPrivate *priv;
1050 + gtk_widget_set_sensitive (GTK_WIDGET (applet), FALSE);
1051 + show_report_window (applet);
1053 + priv = MODEM_APPLET_GET_PRIVATE (applet);
1054 + oobs_iface_set_active (priv->iface, TRUE);
1055 + oobs_object_commit_async (priv->config, on_config_committed, applet);
1059 @@ -996,7 +441,12 @@
1060 ModemApplet *applet,
1063 - toggle_interface (applet, FALSE);
1064 + ModemAppletPrivate *priv;
1066 + priv = MODEM_APPLET_GET_PRIVATE (applet);
1067 + oobs_iface_set_active (priv->iface, FALSE);
1068 + gtk_widget_set_sensitive (GTK_WIDGET (applet), FALSE);
1069 + oobs_object_commit_async (priv->config, on_config_committed, applet);
1073 @@ -1010,7 +460,7 @@
1075 screen = gtk_widget_get_screen (GTK_WIDGET (applet));
1077 - if (!launch_config_tool (screen, priv->is_isdn))
1078 + if (!launch_config_tool (screen, priv->iface))
1080 dialog = gtk_message_dialog_new (NULL,
1081 GTK_DIALOG_DESTROY_WITH_PARENT,
1082 diff -urN gnome-applets-2.18.0/modemlights/modemlights.glade gnome-applets-2.18.0.new/modemlights/modemlights.glade
1083 --- gnome-applets-2.18.0/modemlights/modemlights.glade 2006-12-31 03:16:08.000000000 +0100
1084 +++ gnome-applets-2.18.0.new/modemlights/modemlights.glade 2007-06-10 13:08:15.000000000 +0200
1086 <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
1089 -<requires lib="gnome"/>
1091 -<widget class="GtkDialog" id="auth_dialog">
1092 - <property name="title" translatable="yes">Enter password</property>
1093 - <property name="type">GTK_WINDOW_TOPLEVEL</property>
1094 - <property name="window_position">GTK_WIN_POS_CENTER</property>
1095 - <property name="modal">True</property>
1096 - <property name="resizable">False</property>
1097 - <property name="destroy_with_parent">False</property>
1098 - <property name="decorated">True</property>
1099 - <property name="skip_taskbar_hint">False</property>
1100 - <property name="skip_pager_hint">False</property>
1101 - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
1102 - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
1103 - <property name="has_separator">False</property>
1105 - <child internal-child="vbox">
1106 - <widget class="GtkVBox" id="dialog-vbox1">
1107 - <property name="visible">True</property>
1108 - <property name="homogeneous">False</property>
1109 - <property name="spacing">0</property>
1111 - <child internal-child="action_area">
1112 - <widget class="GtkHButtonBox" id="dialog-action_area1">
1113 - <property name="visible">True</property>
1114 - <property name="layout_style">GTK_BUTTONBOX_END</property>
1117 - <widget class="GtkButton" id="cancelbutton1">
1118 - <property name="visible">True</property>
1119 - <property name="can_default">True</property>
1120 - <property name="can_focus">True</property>
1121 - <property name="label">gtk-cancel</property>
1122 - <property name="use_stock">True</property>
1123 - <property name="relief">GTK_RELIEF_NORMAL</property>
1124 - <property name="focus_on_click">True</property>
1125 - <property name="response_id">-6</property>
1130 - <widget class="GtkButton" id="okbutton1">
1131 - <property name="visible">True</property>
1132 - <property name="can_default">True</property>
1133 - <property name="has_default">True</property>
1134 - <property name="can_focus">True</property>
1135 - <property name="label">gtk-ok</property>
1136 - <property name="use_stock">True</property>
1137 - <property name="relief">GTK_RELIEF_NORMAL</property>
1138 - <property name="focus_on_click">True</property>
1139 - <property name="response_id">-5</property>
1144 - <property name="padding">0</property>
1145 - <property name="expand">False</property>
1146 - <property name="fill">True</property>
1147 - <property name="pack_type">GTK_PACK_END</property>
1152 - <widget class="GtkHBox" id="hbox1">
1153 - <property name="border_width">7</property>
1154 - <property name="visible">True</property>
1155 - <property name="homogeneous">False</property>
1156 - <property name="spacing">12</property>
1159 - <widget class="GtkImage" id="image1">
1160 - <property name="visible">True</property>
1161 - <property name="stock">gnome-stock-authentication</property>
1162 - <property name="icon_size">6</property>
1163 - <property name="xalign">0</property>
1164 - <property name="yalign">0</property>
1165 - <property name="xpad">0</property>
1166 - <property name="ypad">0</property>
1169 - <property name="padding">0</property>
1170 - <property name="expand">False</property>
1171 - <property name="fill">False</property>
1176 - <widget class="GtkVBox" id="vbox1">
1177 - <property name="visible">True</property>
1178 - <property name="homogeneous">False</property>
1179 - <property name="spacing">6</property>
1182 - <widget class="GtkLabel" id="label1">
1183 - <property name="visible">True</property>
1184 - <property name="label" translatable="yes"><span weight="bold" size="larger">Root password required</span></property>
1185 - <property name="use_underline">False</property>
1186 - <property name="use_markup">True</property>
1187 - <property name="justify">GTK_JUSTIFY_LEFT</property>
1188 - <property name="wrap">False</property>
1189 - <property name="selectable">False</property>
1190 - <property name="xalign">0</property>
1191 - <property name="yalign">0.5</property>
1192 - <property name="xpad">0</property>
1193 - <property name="ypad">0</property>
1194 - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1195 - <property name="width_chars">-1</property>
1196 - <property name="single_line_mode">False</property>
1197 - <property name="angle">0</property>
1200 - <property name="padding">0</property>
1201 - <property name="expand">False</property>
1202 - <property name="fill">False</property>
1207 - <widget class="GtkLabel" id="auth_dialog_label">
1208 - <property name="visible">True</property>
1209 - <property name="can_focus">True</property>
1210 - <property name="label" translatable="yes"></property>
1211 - <property name="use_underline">False</property>
1212 - <property name="use_markup">False</property>
1213 - <property name="justify">GTK_JUSTIFY_LEFT</property>
1214 - <property name="wrap">True</property>
1215 - <property name="selectable">True</property>
1216 - <property name="xalign">0</property>
1217 - <property name="yalign">0.5</property>
1218 - <property name="xpad">0</property>
1219 - <property name="ypad">0</property>
1220 - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1221 - <property name="width_chars">-1</property>
1222 - <property name="single_line_mode">False</property>
1223 - <property name="angle">0</property>
1226 - <property name="padding">0</property>
1227 - <property name="expand">False</property>
1228 - <property name="fill">False</property>
1233 - <widget class="GtkHBox" id="hbox2">
1234 - <property name="visible">True</property>
1235 - <property name="homogeneous">False</property>
1236 - <property name="spacing">12</property>
1239 - <widget class="GtkLabel" id="label3">
1240 - <property name="visible">True</property>
1241 - <property name="label" translatable="yes">Password:</property>
1242 - <property name="use_underline">False</property>
1243 - <property name="use_markup">False</property>
1244 - <property name="justify">GTK_JUSTIFY_LEFT</property>
1245 - <property name="wrap">False</property>
1246 - <property name="selectable">False</property>
1247 - <property name="xalign">0.5</property>
1248 - <property name="yalign">0.5</property>
1249 - <property name="xpad">0</property>
1250 - <property name="ypad">0</property>
1251 - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1252 - <property name="width_chars">-1</property>
1253 - <property name="single_line_mode">False</property>
1254 - <property name="angle">0</property>
1257 - <property name="padding">0</property>
1258 - <property name="expand">False</property>
1259 - <property name="fill">False</property>
1264 - <widget class="GtkEntry" id="auth_dialog_entry">
1265 - <property name="visible">True</property>
1266 - <property name="can_focus">True</property>
1267 - <property name="editable">True</property>
1268 - <property name="visibility">False</property>
1269 - <property name="max_length">0</property>
1270 - <property name="text" translatable="yes"></property>
1271 - <property name="has_frame">True</property>
1272 - <property name="invisible_char">*</property>
1273 - <property name="activates_default">True</property>
1276 - <property name="padding">0</property>
1277 - <property name="expand">True</property>
1278 - <property name="fill">True</property>
1283 - <property name="padding">0</property>
1284 - <property name="expand">False</property>
1285 - <property name="fill">False</property>
1290 - <property name="padding">0</property>
1291 - <property name="expand">True</property>
1292 - <property name="fill">True</property>
1297 - <property name="padding">0</property>
1298 - <property name="expand">False</property>
1299 - <property name="fill">False</property>
1306 <widget class="GtkWindow" id="report_window">
1307 <property name="title" translatable="yes"></property>
1309 <property name="skip_pager_hint">False</property>
1310 <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
1311 <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
1312 + <property name="focus_on_map">True</property>
1313 + <property name="urgency_hint">False</property>
1316 <widget class="GtkHBox" id="hbox3">