Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 151147 Details for
Bug 197163
>=gnome-base/gnome-applets-2.20 - modem monitor applet cannot be configured
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
09_modemlights_use_new_gst.patch
09_modemlights_use_new_gst.patch (text/plain), 36.25 KB, created by
Pacho Ramos
on 2008-04-27 15:36:53 UTC
(
hide
)
Description:
09_modemlights_use_new_gst.patch
Filename:
MIME Type:
Creator:
Pacho Ramos
Created:
2008-04-27 15:36:53 UTC
Size:
36.25 KB
patch
obsolete
>diff -Nur -x '*.orig' -x '*~' gnome-applets-2.21.1/configure.in gnome-applets-2.21.1.new/configure.in >--- gnome-applets-2.21.1/configure.in 2007-11-18 17:38:50.000000000 +0100 >+++ gnome-applets-2.21.1.new/configure.in 2007-11-18 17:39:03.000000000 +0100 >@@ -24,6 +24,7 @@ > LIBGAIL_REQUIRED=1.1.0 > LIBXKLAVIER_REQUIRED=2.91 > LIBWNCK_REQUIRED=2.9.3 >+LIBOOBS_REQUIRED=0.2.0 > SYSTEM_TOOLS_BACKENDS_REQUIRED=1.1.3 > LIBGNOME_DESKTOP_REQUIRED=2.11.1 > LIBNOTIFY_REQUIRED=0.3.2 >@@ -509,25 +510,21 @@ > dnl *** modemlights applet check *** > dnl *************************************************************************** > >-SU_TOOL= >-P_MODEMLIGHTS= >-HAVE_LIBUTIL= >- >-AC_PATH_PROG(SU_TOOL, su) >-AC_CHECK_LIB(util, forkpty, HAVE_LIBUTIL=true, HAVE_LIBUTIL=false) >-AM_PATH_SYSTEM_TOOLS_BACKENDS($SYSTEM_TOOLS_BACKENDS_REQUIRED, P_MODEMLIGHTS=modemlights) >- >-if test "x$HAVE_LIBUTIL" = "xtrue" -a "x$P_MODEMLIGHTS" = "xmodemlights" -a "x$HAVE_GNOME_SETTINGS_DAEMON" = "xyes"; then >- MODEMLIGHTS_LIBS=" -lutil" >- AC_SUBST(MODEMLIGHTS_LIBS) >- AC_DEFINE_UNQUOTED(STB_SCRIPTS_DIR, "$STB_SCRIPTS_DIR", [System tools backends]) >- AC_DEFINE_UNQUOTED(SU_PATH, "${SU_TOOL}", [su executable path]) >+MODEMLIGHTS_LIBS= >+MODEMLIGHTS_CFLAGS= >+ >+PKG_CHECK_MODULES(MODEMLIGHTS, liboobs-1 >= $LIBOOBS_REQUIRED, >+ HAVE_LIBOOBS=yes, HAVE_LIBOOBS=no) >+ >+if test "x$HAVE_LIBOOBS" = "xyes" -a "x$HAVE_GNOME_SETTINGS_DAEMON" = "xyes"; then > BUILD_MODEM_LIGHTS=yes > else > AC_MSG_WARN([*** modemlights applet will not be built ***]) > BUILD_MODEM_LIGHTS=no > fi > >+AC_SUBST(MODEMLIGHTS_LIBS) >+AC_SUBST(MODEMLIGHTS_CFLAGS) > AM_CONDITIONAL(APPLET_MODEMLIGHTS, test "x$BUILD_MODEM_LIGHTS" = "xyes") > > dnl *************************************************************************** >diff -Nur -x '*.orig' -x '*~' gnome-applets-2.21.1/modemlights/Makefile.am gnome-applets-2.21.1.new/modemlights/Makefile.am >--- gnome-applets-2.21.1/modemlights/Makefile.am 2007-07-28 04:03:06.000000000 +0200 >+++ gnome-applets-2.21.1.new/modemlights/Makefile.am 2007-11-18 17:39:03.000000000 +0100 >@@ -1,7 +1,8 @@ > #SUBDIRS = docs > >-INCLUDES = -I. -I$(srcdir) \ >- $(GNOME_APPLETS_CFLAGS) \ >+INCLUDES = -I. -I$(srcdir) \ >+ $(GNOME_APPLETS_CFLAGS) \ >+ $(MODEMLIGHTS_CFLAGS) \ > $(LIBGLADE_CFLAGS) > > libexec_PROGRAMS = modem_applet >diff -Nur -x '*.orig' -x '*~' gnome-applets-2.21.1/modemlights/modem-applet.c gnome-applets-2.21.1.new/modemlights/modem-applet.c >--- gnome-applets-2.21.1/modemlights/modem-applet.c 2007-10-13 11:41:35.000000000 +0200 >+++ gnome-applets-2.21.1.new/modemlights/modem-applet.c 2007-11-18 17:39:03.000000000 +0100 >@@ -1,5 +1,5 @@ >-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */ >-/* Copyright (C) 2004 Carlos Garnacho >+/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */ >+/* Copyright (C) 2004-2006 Carlos Garnacho > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as >@@ -23,31 +23,13 @@ > #endif > > #include <panel-applet.h> >-#include <fcntl.h> >-#ifdef HAVE_PTY_H >-#include <pty.h> >-#endif >-#include <sys/poll.h> >-#include <sys/types.h> >-#include <sys/wait.h> >-#include <libxml/tree.h> >+#include <oobs/oobs.h> > #include <glade/glade.h> >- >-#ifdef __FreeBSD__ >-#include <sys/ioctl.h> >-#include <termios.h> >-#include <libutil.h> >-#endif >- > #include "modem-applet.h" > > #define MODEM_APPLET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_MODEM_APPLET, ModemAppletPrivate)) > #define NETWORK_TOOL "network-admin" >-#define END_OF_REQUEST "<!-- GST: end of request -->\n" >-#define BUF_SIZE 1024 > >-typedef void (*DirectiveCallback) (ModemApplet*, xmlDoc*); >-typedef struct _BackendDirective BackendDirective; > typedef struct _ModemAppletPrivate ModemAppletPrivate; > > struct _ModemAppletPrivate >@@ -58,47 +40,18 @@ > GdkPixbuf *icon; > GtkWidget *image; > >- /* auth dialog */ >- GtkWidget *auth_dialog; >- GtkWidget *auth_dialog_label; >- GtkWidget *auth_dialog_entry; >- > /* report window */ > GtkWidget *report_window; > GtkWidget *report_window_image; > GtkWidget *report_window_progress; > >- guint directives_id; >- guint progress_id; >- guint tooltip_id; >- guint info_id; >- guint timeout_id; >- >- /* for communicating with the backend */ >- gint config_id; >- gint pid; >- int read_fd; >- int write_fd; >- FILE *read_stream; >- FILE *write_stream; >- GSList *directives; >- gboolean directive_running; >- >- /* interface data */ >- gboolean configured; /* is configured? */ >- gboolean enabled; /* is enabled? */ >- gboolean is_isdn; /* is an isdn device? */ >- gchar *dev; /* device name */ >- gchar *lock_file; /* lock file */ >+ /* configuration */ >+ OobsObject *config; >+ OobsIface *iface; >+ gchar *lock_file; > >- gboolean has_root; >-}; >- >-struct _BackendDirective >-{ >- DirectiveCallback callback; >- GSList *directive; >- gboolean show_report; >+ guint pulse_id; >+ guint tooltip_id; > }; > > static void modem_applet_class_init (ModemAppletClass *class); >@@ -138,8 +92,6 @@ > gboolean backend_alive, > gboolean already_waiting); > >-static gpointer parent_class; >- > static const BonoboUIVerb menu_verbs[] = { > BONOBO_UI_UNSAFE_VERB ("Activate", on_modem_applet_activate), > BONOBO_UI_UNSAFE_VERB ("Deactivate", on_modem_applet_deactivate), >@@ -159,7 +111,6 @@ > > object_class = G_OBJECT_CLASS (class); > applet_class = PANEL_APPLET_CLASS (class); >- parent_class = g_type_class_peek_parent (class); > > object_class->finalize = modem_applet_finalize; > applet_class->change_size = modem_applet_change_size; >@@ -168,6 +119,43 @@ > g_type_class_add_private (object_class, sizeof (ModemAppletPrivate)); > } > >+static OobsIface* >+get_modem_iface (OobsIfacesConfig *config) >+{ >+ OobsList *list; >+ OobsListIter iter; >+ gboolean valid; >+ >+ /* Try the PPP interfaces, which covers both modems and ISDN */ >+ list = oobs_ifaces_config_get_ifaces (config, OOBS_IFACE_TYPE_PPP); >+ valid = oobs_list_get_iter_first (list, &iter); >+ >+ if (valid) >+ return (OobsIface *) oobs_list_get (list, &iter); >+ >+ return NULL; >+} >+ >+static gchar* >+get_lock_file (OobsIface *iface) >+{ >+ gchar *lock_file; >+ const gchar *serial_port, *str; >+ >+ if (!iface) >+ return NULL; >+ >+ serial_port = oobs_iface_ppp_get_serial_port (OOBS_IFACE_PPP (iface)); >+ >+ if (serial_port) >+ { >+ str = strchr (serial_port, '/'); >+ lock_file = g_strdup_printf ("/var/lock/LCK..%s", str + 1); >+ } >+ >+ return lock_file; >+} >+ > static void > modem_applet_init (ModemApplet *applet) > { >@@ -183,9 +184,9 @@ > priv->icon_theme = gtk_icon_theme_get_default (); > priv->image = gtk_image_new (); > >- priv->auth_dialog = glade_xml_get_widget (priv->xml, "auth_dialog"); >- priv->auth_dialog_label = glade_xml_get_widget (priv->xml, "auth_dialog_label"); >- priv->auth_dialog_entry = glade_xml_get_widget (priv->xml, "auth_dialog_entry"); >+ priv->config = oobs_ifaces_config_get (); >+ priv->iface = get_modem_iface (OOBS_IFACES_CONFIG (priv->config)); >+ priv->lock_file = get_lock_file (priv->iface); > > priv->report_window = glade_xml_get_widget (priv->xml, "report_window"); > priv->report_window_image = glade_xml_get_widget (priv->xml, "report_window_image"); >@@ -197,20 +199,8 @@ > pixbuf = gtk_icon_theme_load_icon (priv->icon_theme, "gnome-modem-monitor-applet", 48, 0, NULL); > gtk_image_set_from_pixbuf (GTK_IMAGE (priv->report_window_image), pixbuf); > gdk_pixbuf_unref (pixbuf); >- >- priv->configured = FALSE; >- priv->enabled = FALSE; >- priv->dev = NULL; >- priv->lock_file = NULL; >- >- priv->has_root = FALSE; >- >- priv->directives = NULL; >- priv->directives_id = g_timeout_add (250, (GSourceFunc) dispatch_directives, applet); >- priv->directive_running = FALSE; >+ > priv->tooltip_id = g_timeout_add (1000, (GSourceFunc) update_tooltip, applet); >- >- launch_backend (applet, FALSE); > gtk_container_add (GTK_CONTAINER (applet), priv->image); > } > >@@ -221,18 +211,25 @@ > > if (priv) > { >- shutdown_backend (MODEM_APPLET (object), TRUE, TRUE); >- >- gtk_widget_destroy (priv->auth_dialog); >- gtk_widget_destroy (priv->report_window); >+ g_object_unref (priv->xml); > g_object_unref (priv->icon); >+ gtk_widget_destroy (priv->image); > >- g_free (priv->dev); >- g_free (priv->lock_file); >+ if (priv->pulse_id) >+ { >+ g_source_remove (priv->pulse_id); >+ priv->pulse_id = 0; >+ } >+ >+ if (priv->tooltip_id) >+ { >+ g_source_remove (priv->tooltip_id); >+ priv->tooltip_id = 0; >+ } > } > >- if (G_OBJECT_CLASS (parent_class)->finalize) >- (* G_OBJECT_CLASS (parent_class)->finalize) (object); >+ if (G_OBJECT_CLASS (modem_applet_parent_class)->finalize) >+ (* G_OBJECT_CLASS (modem_applet_parent_class)->finalize) (object); > } > > static void >@@ -287,401 +284,26 @@ > } > } > >-static gboolean >-pulse_progressbar (GtkWidget *progressbar) >-{ >- gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progressbar)); >- return TRUE; >-} >- >-/* XML manipulation functions */ >-static xmlNodePtr >-get_root_node (xmlDoc *doc) >-{ >- return xmlDocGetRootElement (doc); >-} >- >-static xmlNodePtr >-find_first_element (xmlNodePtr node, const gchar *name) >-{ >- xmlNodePtr n; >- >- g_return_val_if_fail (node != NULL, NULL); >- g_return_val_if_fail (name != NULL, NULL); >- >- for (n = node->children; n; n = n->next) >- if (n->name && (strcmp (name, (char *) n->name) == 0)) >- break; >- >- return n; >-} >- >-static xmlNodePtr >-find_next_element (xmlNodePtr node, const gchar *name) >-{ >- xmlNodePtr n; >- >- g_return_val_if_fail (node != NULL, NULL); >- g_return_val_if_fail (name != NULL, NULL); >- >- for (n = node->next; n; n = n->next) >- if (n->name && (strcmp (name, (char *) n->name) == 0)) >- break; >- >- return n; >-} >- >-static guchar * >-element_get_attribute (xmlNodePtr node, const gchar *attribute) >-{ >- xmlAttrPtr a; >- >- g_return_val_if_fail (node != NULL, NULL); >- a = node->properties; >- >- while (a) >- { >- if (a->name && (strcmp ((char *) a->name, attribute) == 0)) >- return xmlNodeGetContent (a->children); >- >- a = a->next; >- } >- >- return NULL; >-} >- >-static guchar * >-element_get_child_content (xmlNodePtr node, const gchar *tag) >-{ >- xmlNodePtr child, n; >- >- child = find_first_element (node, tag); >- if (!child) >- return NULL; >- >- for (n = child->children; n; n = n->next) >- if (n->type == XML_TEXT_NODE) >- return xmlNodeGetContent (n); >- >- return NULL; >-} >- >-static xmlNodePtr >-find_dialup_interface_node (xmlNodePtr root) >-{ >- xmlNodePtr node; >- gchar *type; >- >- node = find_first_element (root, "interface"); >- >- while (node) >- { >- type = (char *) element_get_attribute (node, "type"); >- >- if (type && (strcmp (type, "modem") == 0 || strcmp (type, "isdn") == 0)) >- { >- g_free (type); >- return node; >- } >- >- g_free (type); >- node = find_next_element (node, "interface"); >- } >- >- return NULL; >-} >- >-/* backend communication functions */ >-static gchar * >-compose_directive_string (GSList *directive) >-{ >- GString *dir; >- gchar *arg, *s, *str; >- GSList *elem; >- >- elem = directive; >- dir = g_string_new (""); >- >- while (elem) >- { >- arg = elem->data; >- >- for (s = arg; *s; s++) >- { >- /* escape needed chars */ >- if ((*s == '\\') || >- ((*s == ':') && (* (s + 1) == ':'))) >- g_string_append_c (dir, '\\'); >- >- g_string_append_c (dir, *s); >- } >- >- g_string_append (dir, "::"); >- elem = elem->next; >- } >- >- g_string_append_c (dir, '\n'); >- >- str = dir->str; >- g_string_free (dir, FALSE); >- >- return str; >-} >- >-static void >-poll_backend (ModemAppletPrivate *priv) >-{ >- struct pollfd fd; >- >- fd.fd = priv->read_fd; >- fd.events = POLLIN || POLLPRI; >- >- while (poll (&fd, 1, 100) <= 0) >- { >- while (gtk_events_pending ()) >- gtk_main_iteration (); >- } >-} >- >-static xmlDoc* >-read_xml (ModemApplet *applet, gboolean show_report) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- gchar buffer[BUF_SIZE], *s; >- GString *str; >- xmlDoc *doc = NULL; >- gboolean backend_alive; >- >- str = g_string_new (""); >- backend_alive = (waitpid (priv->pid, NULL, WNOHANG) == 0); >- >- /* if show_report, create pulse timeout and show window */ >- if (show_report) >- { >- priv->progress_id = gtk_timeout_add (200, (GSourceFunc) pulse_progressbar, priv->report_window_progress); >- gtk_window_set_screen (GTK_WINDOW (priv->report_window), gtk_widget_get_screen (GTK_WIDGET (applet))); >- gtk_widget_show (priv->report_window); >- } >- >- while (backend_alive && !g_strrstr (str->str, END_OF_REQUEST)) >- { >- poll_backend (priv); >- fgets (buffer, BUF_SIZE, priv->read_stream); >- g_string_append (str, buffer); >- >- while (gtk_events_pending ()) >- gtk_main_iteration (); >- >- backend_alive = (waitpid (priv->pid, NULL, WNOHANG) == 0); >- } >- >- /* if show_report, hide window and so */ >- if (show_report) >- { >- g_source_remove (priv->progress_id); >- priv->progress_id = 0; >- gtk_widget_hide (priv->report_window); >- } >- >- s = str->str; >- >- while (*s && (*s != '<')) >- s++; >- >- if (strcmp (s, END_OF_REQUEST) != 0) >- doc = xmlParseDoc ((xmlChar *) s); >- >- g_string_free (str, TRUE); >- >- return doc; >-} >- >-static void >-queue_directive (ModemApplet *applet, >- DirectiveCallback callback, >- gboolean show_report, >- const gchar *dir, >- ...) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- BackendDirective *directive; >- GSList *list = NULL; >- va_list ap; >- gchar *arg; >- >- list = g_slist_prepend (list, g_strdup (dir)); >- va_start (ap, dir); >- >- while ((arg = va_arg (ap, gchar *)) != NULL) >- list = g_slist_prepend (list, g_strdup (arg)); >- >- va_end (ap); >- list = g_slist_reverse (list); >- >- directive = g_new0 (BackendDirective, 1); >- directive->callback = callback; >- directive->directive = list; >- directive->show_report = show_report; >- >- priv->directives = g_slist_append (priv->directives, directive); >-} >- >-static gboolean >-dispatch_directives (ModemApplet *applet) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- BackendDirective *directive; >- xmlDoc *doc; >- gchar *dir; >- GSList *elem; >- >- if (priv->directive_running) >- return TRUE; >- >- priv->directive_running = TRUE; >- elem = priv->directives; >- >- while (elem) >- { >- directive = elem->data; >- >- dir = compose_directive_string (directive->directive); >- fputs (dir, priv->write_stream); >- g_free (dir); >- >- doc = read_xml (applet, directive->show_report); >- >- if (directive->callback) >- directive->callback (applet, doc); >- >- if (doc) >- xmlFreeDoc (doc); >- >- g_slist_foreach (directive->directive, (GFunc) g_free, NULL); >- g_slist_free (directive->directive); >- >- elem = elem->next; >- } >- >- g_slist_foreach (priv->directives, (GFunc) g_free, NULL); >- g_slist_free (priv->directives); >- priv->directives = NULL; >- priv->directive_running = FALSE; >- >- return TRUE; >-} >- >-static void >-shutdown_backend (ModemApplet *applet, gboolean backend_alive, gboolean already_waiting) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- >- if (priv->info_id) >- { >- g_source_remove (priv->info_id); >- priv->info_id = 0; >- } >- >- if (priv->timeout_id) >- { >- g_source_remove (priv->timeout_id); >- priv->timeout_id = 0; >- } >- >- if (priv->tooltip_id) >- { >- g_source_remove (priv->tooltip_id); >- priv->tooltip_id = 0; >- } >- >- if (backend_alive) >- kill (priv->pid, 9); >- >- if (!already_waiting) >- { >- /* don't leave zombies */ >- while (waitpid (priv->pid, NULL, WNOHANG) <= 0) >- { >- usleep (2000); >- >- while (gtk_events_pending ()) >- gtk_main_iteration (); >- } >- } >- >- /* close remaining streams and fds */ >- fclose (priv->read_stream); >- fclose (priv->write_stream); >- close (priv->read_fd); >- close (priv->write_fd); >-} >- >-/* functions for extracting the interface information from the XML */ > static void > update_popup_buttons (ModemApplet *applet) > { > BonoboUIComponent *component; > ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >+ gboolean enabled; > > component = panel_applet_get_popup_component (PANEL_APPLET (applet)); >+ enabled = (priv->iface && oobs_iface_get_active (priv->iface)); > > bonobo_ui_component_set_prop (component, > "/commands/Activate", >- "sensitive", (priv->configured && !priv->enabled) ? "1" : "0", >+ "sensitive", (enabled) ? "1" : "0", > NULL); > bonobo_ui_component_set_prop (component, > "/commands/Deactivate", >- "sensitive", (priv->configured && priv->enabled) ? "1" : "0", >+ "sensitive", (enabled) ? "1" : "0", > NULL); > } > >-static void >-get_interface_data (ModemApplet *applet, xmlNodePtr iface) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- xmlNodePtr configuration; >- gchar *text, *device; >- >- g_return_if_fail (iface != NULL); >- >- text = (char *) element_get_child_content (iface, "enabled"); >- priv->enabled = (*text == '1'); >- g_free (text); >- >- g_free (priv->dev); >- priv->dev = (char *) element_get_child_content (iface, "dev"); >- >- g_free (priv->lock_file); >- configuration = find_first_element (iface, "configuration"); >- >- if (configuration) >- { >- priv->configured = TRUE; >- text = (char *) element_get_child_content (configuration, "serial_port"); >- >- if (text) >- { >- /* Modem device */ >- device = strrchr (text, '/'); >- priv->lock_file = g_strdup_printf ("/var/lock/LCK..%s", device + 1); >- g_free (text); >- >- priv->is_isdn = FALSE; >- } >- else >- { >- /* isdn device */ >- priv->lock_file = g_strdup ("/var/lock/LCK..capi_0"); >- priv->is_isdn = TRUE; >- } >- } >- else >- { >- priv->lock_file = NULL; >- priv->configured = FALSE; >- } >-} >- > static gint > get_connection_time (const gchar *lock_file) > { >@@ -700,30 +322,30 @@ > gchar *text; > gint t, t1, t2; > >- if (priv->enabled) >+ if (!priv->lock_file) >+ text = g_strdup (_("Could not get connection time")); >+ else > { >- if (!priv->lock_file) >- text = g_strdup (_("Connection active, but could not get connection time")); >- else >- { >- t = get_connection_time (priv->lock_file); >+ t = get_connection_time (priv->lock_file); > >- if (t < (60 * 60 * 24)) >- { >- t1 = t / 3600; /* hours */ >- t2 = (t - (t1 * 3600)) / 60; /* minutes */ >- } >- else >- { >- t1 = t / (3600 * 24); /* days */ >- t2 = (t - (t1 * 3600 * 24)) / 3600; /* hours */ >- } >+ if (t == 0) >+ text = g_strdup (_("Not connected")); >+ else >+ { >+ if (t < (60 * 60 * 24)) >+ { >+ t1 = t / 3600; /* hours */ >+ t2 = (t - (t1 * 3600)) / 60; /* minutes */ >+ } >+ else >+ { >+ t1 = t / (3600 * 24); /* days */ >+ t2 = (t - (t1 * 3600 * 24)) / 3600; /* hours */ >+ } > >- text = g_strdup_printf (_("Time connected: %.1d:%.2d"), t1, t2); >- } >+ text = g_strdup_printf (_("Time connected: %.1d:%.2d"), t1, t2); >+ } > } >- else >- text = g_strdup (_("Not connected")); > > gtk_widget_set_tooltip_text (GTK_WIDGET (applet), text); > g_free (text); >@@ -731,165 +353,8 @@ > return TRUE; > } > >-static void >-rerun_backend_callback (ModemApplet *applet, xmlDoc *doc) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- gchar *text, *password; >- gint response; >- gboolean enable; >- >- shutdown_backend (applet, FALSE, FALSE); >- launch_backend (applet, TRUE); >- >- enable = !priv->enabled; >- >- text = (enable) ? >- _("To connect to your Internet service provider, you need administrator privileges") : >- _("To disconnect from your Internet service provider, you need administrator privileges"); >- >- gtk_label_set_text (GTK_LABEL (priv->auth_dialog_label), text); >- gtk_window_set_screen (GTK_WINDOW (priv->auth_dialog), >- gtk_widget_get_screen (GTK_WIDGET (applet))); >- >- gtk_widget_grab_focus (priv->auth_dialog_entry); >- response = gtk_dialog_run (GTK_DIALOG (priv->auth_dialog)); >- gtk_widget_hide (priv->auth_dialog); >- password = (gchar *) gtk_entry_get_text (GTK_ENTRY (priv->auth_dialog_entry)); >- >- if (response == GTK_RESPONSE_OK) >- { >- >- password = (gchar *) gtk_entry_get_text (GTK_ENTRY (priv->auth_dialog_entry)); >- fputs (password, priv->write_stream); >- fputs ("\n", priv->write_stream); >- >- while (fflush (priv->write_stream) != 0); >- >- queue_directive (applet, NULL, enable, >- "enable_iface", priv->dev, (enable) ? "1" : "0", NULL); >- } >- else >- { >- shutdown_backend (applet, TRUE, FALSE); >- launch_backend (applet, FALSE); >- } >- >- /* stab the root password */ >- memset (password, ' ', sizeof (password)); >- gtk_entry_set_text (GTK_ENTRY (priv->auth_dialog_entry), ""); >-} >- >-static void >-update_info_callback (ModemApplet *applet, xmlDoc *doc) >-{ >- xmlNodePtr iface; >- >- if (!doc) >- return; >- >- iface = find_dialup_interface_node (get_root_node (doc)); >- if (!iface) >- return; >- >- get_interface_data (applet, iface); >- update_popup_buttons (applet); >-} >- > static gboolean >-update_info (ModemApplet *applet) >-{ >- queue_directive (applet, update_info_callback, >- FALSE, "get", NULL); >- return TRUE; >-} >- >-static gboolean >-check_backend (ModemApplet *applet) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- gint status, pid = -1; >- GtkWidget *dialog; >- >- pid = waitpid (priv->pid, &status, WNOHANG); >- >- if (pid != 0) >- { >- if (errno == ECHILD || ((WIFEXITED (status)) && (WEXITSTATUS (status)) && (WEXITSTATUS(status) < 255))) >- { >- dialog = gtk_message_dialog_new (NULL, >- GTK_DIALOG_MODAL, >- GTK_MESSAGE_WARNING, >- GTK_BUTTONS_CLOSE, >- _("The entered password is invalid")); >- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), >- _("Check that you have typed it correctly and that " >- "you haven't activated the \"caps lock\" key")); >- gtk_dialog_run (GTK_DIALOG (dialog)); >- gtk_widget_destroy (dialog); >- } >- >- priv->timeout_id = 0; >- shutdown_backend (applet, FALSE, TRUE); >- launch_backend (applet, FALSE); >- >- return FALSE; >- } >- >- return TRUE; >-} >- >-static void >-launch_backend (ModemApplet *applet, gboolean root_auth) >-{ >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- gchar *non_auth_args[] = { STB_SCRIPTS_DIR "/network-conf", NULL }; >- gchar *auth_args[] = { SU_PATH, "-c", STB_SCRIPTS_DIR "/network-conf", NULL }; >- gchar **args; >- int p[2]; >- >- pipe (p); >- priv->pid = forkpty (&priv->write_fd, NULL, NULL, NULL); >- args = (root_auth) ? auth_args : non_auth_args; >- >- if (priv->pid < 0) >- g_warning ("Could not spawn GST backend"); >- else >- { >- if (priv->pid == 0) >- { >- /* child process */ >- unsetenv("LC_ALL"); >- unsetenv("LC_MESSAGES"); >- unsetenv("LANG"); >- unsetenv("LANGUAGE"); >- >- dup2 (p[1], 1); >- dup2 (p[1], 2); >- close (p[0]); >- >- execv (args[0], args); >- exit (255); >- } >- else >- { >- close (p[1]); >- >- priv->read_fd = p[0]; >- priv->timeout_id = g_timeout_add (1000, (GSourceFunc) check_backend, applet); >- priv->info_id = g_timeout_add (2500, (GSourceFunc) update_info, applet); >- priv->read_stream = fdopen (priv->read_fd, "r"); >- priv->write_stream = fdopen (priv->write_fd, "w"); >- priv->has_root = root_auth; >- >- setvbuf (priv->read_stream, NULL, _IONBF, 0); >- fcntl (priv->read_fd, F_SETFL, 0); >- } >- } >-} >- >-static gboolean >-launch_config_tool (GdkScreen *screen, gboolean is_isdn) >+launch_config_tool (GdkScreen *screen, OobsIface *iface) > { > gchar *argv[4], *application; > gboolean ret; >@@ -900,8 +365,8 @@ > return FALSE; > > argv[0] = application; >- argv[1] = "--configure-type"; >- argv[2] = (is_isdn) ? "isdn" : "modem"; >+ argv[1] = "--configure"; >+ argv[2] = (gchar*) oobs_iface_get_device_name (iface); > argv[3] = NULL; > > ret = gdk_spawn_on_screen (screen, NULL, argv, NULL, 0, >@@ -910,52 +375,48 @@ > return ret; > } > >+static gboolean >+pulse_progressbar (GtkProgressBar *progressbar) >+{ >+ gtk_progress_bar_pulse (progressbar); >+ return TRUE; >+} >+ > static void >-toggle_interface_non_root (ModemApplet *applet, gboolean enable) >+show_report_window (ModemApplet *applet) > { >- queue_directive (applet, rerun_backend_callback, >- FALSE, "end", NULL); >+ ModemAppletPrivate *priv; >+ >+ priv = MODEM_APPLET_GET_PRIVATE (applet); >+ gtk_widget_show (priv->report_window); >+ priv->pulse_id = g_timeout_add (300, (GSourceFunc) pulse_progressbar, priv->report_window_progress); > } > > static void >-toggle_interface_root (ModemApplet *applet, gboolean enable) >+hide_report_window (ModemApplet *applet) > { >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >- GtkWidget *dialog; >- gchar *text; >+ ModemAppletPrivate *priv; > >- text = (enable) ? >- _("Do you want to connect?") : >- _("Do you want to disconnect?"); >- >- dialog = gtk_message_dialog_new (NULL, >- GTK_DIALOG_MODAL, >- GTK_MESSAGE_QUESTION, >- GTK_BUTTONS_NONE, >- text); >- gtk_dialog_add_buttons (GTK_DIALOG (dialog), >- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, >- (enable) ? _("C_onnect") : _("_Disconnect"), >- GTK_RESPONSE_OK, NULL); >- gtk_window_set_screen (GTK_WINDOW (dialog), >- gtk_widget_get_screen (GTK_WIDGET (applet))); >- >- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) >- queue_directive (applet, NULL, enable, >- "enable_iface", priv->dev, (enable) ? "1" : "0", NULL); >+ priv = MODEM_APPLET_GET_PRIVATE (applet); >+ gtk_widget_hide (priv->report_window); > >- gtk_widget_destroy (dialog); >+ if (priv->pulse_id != 0) >+ { >+ g_source_remove (priv->pulse_id); >+ priv->pulse_id = 0; >+ } > } > > static void >-toggle_interface (ModemApplet *applet, gboolean enable) >+on_config_committed (OobsObject *object, >+ OobsResult result, >+ gpointer data) > { >- ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet); >+ ModemApplet *applet = MODEM_APPLET (data); > >- if (priv->has_root) >- toggle_interface_root (applet, enable); >- else >- toggle_interface_non_root (applet, enable); >+ hide_report_window (applet); >+ gtk_widget_set_sensitive (GTK_WIDGET (applet), FALSE); >+ update_popup_buttons (applet); > } > > static void >@@ -963,7 +424,14 @@ > ModemApplet *applet, > const gchar *verb) > { >- toggle_interface (applet, TRUE); >+ ModemAppletPrivate *priv; >+ >+ gtk_widget_set_sensitive (GTK_WIDGET (applet), FALSE); >+ show_report_window (applet); >+ >+ priv = MODEM_APPLET_GET_PRIVATE (applet); >+ oobs_iface_set_active (priv->iface, TRUE); >+ oobs_object_commit_async (priv->config, on_config_committed, applet); > } > > static void >@@ -971,7 +439,12 @@ > ModemApplet *applet, > const gchar *verb) > { >- toggle_interface (applet, FALSE); >+ ModemAppletPrivate *priv; >+ >+ priv = MODEM_APPLET_GET_PRIVATE (applet); >+ oobs_iface_set_active (priv->iface, FALSE); >+ gtk_widget_set_sensitive (GTK_WIDGET (applet), FALSE); >+ oobs_object_commit_async (priv->config, on_config_committed, applet); > } > > static void >@@ -985,7 +458,7 @@ > > screen = gtk_widget_get_screen (GTK_WIDGET (applet)); > >- if (!launch_config_tool (screen, priv->is_isdn)) >+ if (!launch_config_tool (screen, priv->iface)) > { > dialog = gtk_message_dialog_new (NULL, > GTK_DIALOG_DESTROY_WITH_PARENT, >diff -Nur -x '*.orig' -x '*~' gnome-applets-2.21.1/modemlights/modemlights.glade gnome-applets-2.21.1.new/modemlights/modemlights.glade >--- gnome-applets-2.21.1/modemlights/modemlights.glade 2007-07-28 04:03:06.000000000 +0200 >+++ gnome-applets-2.21.1.new/modemlights/modemlights.glade 2007-11-18 17:39:03.000000000 +0100 >@@ -2,222 +2,6 @@ > <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> > > <glade-interface> >-<requires lib="gnome"/> >- >-<widget class="GtkDialog" id="auth_dialog"> >- <property name="title" translatable="yes">Enter password</property> >- <property name="type">GTK_WINDOW_TOPLEVEL</property> >- <property name="window_position">GTK_WIN_POS_CENTER</property> >- <property name="modal">True</property> >- <property name="resizable">False</property> >- <property name="destroy_with_parent">False</property> >- <property name="decorated">True</property> >- <property name="skip_taskbar_hint">False</property> >- <property name="skip_pager_hint">False</property> >- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> >- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> >- <property name="has_separator">False</property> >- >- <child internal-child="vbox"> >- <widget class="GtkVBox" id="dialog-vbox1"> >- <property name="visible">True</property> >- <property name="homogeneous">False</property> >- <property name="spacing">0</property> >- >- <child internal-child="action_area"> >- <widget class="GtkHButtonBox" id="dialog-action_area1"> >- <property name="visible">True</property> >- <property name="layout_style">GTK_BUTTONBOX_END</property> >- >- <child> >- <widget class="GtkButton" id="cancelbutton1"> >- <property name="visible">True</property> >- <property name="can_default">True</property> >- <property name="can_focus">True</property> >- <property name="label">gtk-cancel</property> >- <property name="use_stock">True</property> >- <property name="relief">GTK_RELIEF_NORMAL</property> >- <property name="focus_on_click">True</property> >- <property name="response_id">-6</property> >- </widget> >- </child> >- >- <child> >- <widget class="GtkButton" id="okbutton1"> >- <property name="visible">True</property> >- <property name="can_default">True</property> >- <property name="has_default">True</property> >- <property name="can_focus">True</property> >- <property name="label">gtk-ok</property> >- <property name="use_stock">True</property> >- <property name="relief">GTK_RELIEF_NORMAL</property> >- <property name="focus_on_click">True</property> >- <property name="response_id">-5</property> >- </widget> >- </child> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">True</property> >- <property name="pack_type">GTK_PACK_END</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkHBox" id="hbox1"> >- <property name="border_width">7</property> >- <property name="visible">True</property> >- <property name="homogeneous">False</property> >- <property name="spacing">12</property> >- >- <child> >- <widget class="GtkImage" id="image1"> >- <property name="visible">True</property> >- <property name="stock">gnome-stock-authentication</property> >- <property name="icon_size">6</property> >- <property name="xalign">0</property> >- <property name="yalign">0</property> >- <property name="xpad">0</property> >- <property name="ypad">0</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkVBox" id="vbox1"> >- <property name="visible">True</property> >- <property name="homogeneous">False</property> >- <property name="spacing">6</property> >- >- <child> >- <widget class="GtkLabel" id="label1"> >- <property name="visible">True</property> >- <property name="label" translatable="yes"><span weight="bold" size="larger">Root password required</span></property> >- <property name="use_underline">False</property> >- <property name="use_markup">True</property> >- <property name="justify">GTK_JUSTIFY_LEFT</property> >- <property name="wrap">False</property> >- <property name="selectable">False</property> >- <property name="xalign">0</property> >- <property name="yalign">0.5</property> >- <property name="xpad">0</property> >- <property name="ypad">0</property> >- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> >- <property name="width_chars">-1</property> >- <property name="single_line_mode">False</property> >- <property name="angle">0</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkLabel" id="auth_dialog_label"> >- <property name="visible">True</property> >- <property name="can_focus">True</property> >- <property name="label" translatable="yes"></property> >- <property name="use_underline">False</property> >- <property name="use_markup">False</property> >- <property name="justify">GTK_JUSTIFY_LEFT</property> >- <property name="wrap">True</property> >- <property name="selectable">True</property> >- <property name="xalign">0</property> >- <property name="yalign">0.5</property> >- <property name="xpad">0</property> >- <property name="ypad">0</property> >- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> >- <property name="width_chars">-1</property> >- <property name="single_line_mode">False</property> >- <property name="angle">0</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkHBox" id="hbox2"> >- <property name="visible">True</property> >- <property name="homogeneous">False</property> >- <property name="spacing">12</property> >- >- <child> >- <widget class="GtkLabel" id="label3"> >- <property name="visible">True</property> >- <property name="label" translatable="yes">Password:</property> >- <property name="use_underline">False</property> >- <property name="use_markup">False</property> >- <property name="justify">GTK_JUSTIFY_LEFT</property> >- <property name="wrap">False</property> >- <property name="selectable">False</property> >- <property name="xalign">0.5</property> >- <property name="yalign">0.5</property> >- <property name="xpad">0</property> >- <property name="ypad">0</property> >- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> >- <property name="width_chars">-1</property> >- <property name="single_line_mode">False</property> >- <property name="angle">0</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkEntry" id="auth_dialog_entry"> >- <property name="visible">True</property> >- <property name="can_focus">True</property> >- <property name="editable">True</property> >- <property name="visibility">False</property> >- <property name="max_length">0</property> >- <property name="text" translatable="yes"></property> >- <property name="has_frame">True</property> >- <property name="invisible_char">*</property> >- <property name="activates_default">True</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">True</property> >- <property name="fill">True</property> >- </packing> >- </child> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">True</property> >- <property name="fill">True</property> >- </packing> >- </child> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- </widget> >- </child> >-</widget> > > <widget class="GtkWindow" id="report_window"> > <property name="title" translatable="yes"></property> >@@ -231,6 +15,8 @@ > <property name="skip_pager_hint">False</property> > <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> > <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> >+ <property name="focus_on_map">True</property> >+ <property name="urgency_hint">False</property> > > <child> > <widget class="GtkHBox" id="hbox3">
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 197163
:
134440
| 151147