network-manager-applet r588 - in trunk: . src/connection-editor



Author: tambeti
Date: Tue Mar 11 22:49:04 2008
New Revision: 588
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=588&view=rev

Log:
2008-03-11  Tambet Ingo  <tambet gmail com>

	Add support for PPPoE.

	* src/utils/utils.c (connection_valid_for_wired): Add PPPoE connection
	type to the list of valid connection types.

	* src/connection-editor/nm-connection-list.c (init_connection_lists): Add
	DSL connections.

	* src/connection-editor/nm-connection-editor.glade: Add DSL tab.

	* src/connection-editor/nm-connection-editor.c (nm_connection_editor_init):
	Fix a typo.
	(nm_connection_editor_set_connection): Handle PPPoE connection.

	* src/connection-editor/Makefile.am: Add new files to build.

	* src/connection-editor/ce-page-dsl.glade:
	* src/connection-editor/page-dsl.c:
	* src/connection-editor/page-dsl.c: New files.


Added:
   trunk/src/connection-editor/ce-page-dsl.glade
   trunk/src/connection-editor/page-dsl.c
   trunk/src/connection-editor/page-dsl.h
Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/Makefile.am
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/connection-editor/nm-connection-editor.glade
   trunk/src/connection-editor/nm-connection-list.c

Modified: trunk/src/connection-editor/Makefile.am
==============================================================================
--- trunk/src/connection-editor/Makefile.am	(original)
+++ trunk/src/connection-editor/Makefile.am	Tue Mar 11 22:49:04 2008
@@ -35,7 +35,9 @@
 	page-ip4.h \
 	page-ip4.c \
 	page-ip4-address.h \
-	page-ip4-address.c
+	page-ip4-address.c \
+	page-dsl.h \
+	page-dsl.c
 
 nm_connection_editor_LDADD = \
 	$(top_builddir)/src/gconf-helpers/libgconf-helpers.la \
@@ -50,7 +52,8 @@
 	ce-page-wireless.glade \
 	ce-page-wireless-security.glade \
 	ce-page-ip4.glade \
-	ce-page-ip4-address.glade
+	ce-page-ip4-address.glade \
+	ce-page-dsl.glade
 
 CLEANFILES = *.bak *.gladep
 

Added: trunk/src/connection-editor/ce-page-dsl.glade
==============================================================================
--- (empty file)
+++ trunk/src/connection-editor/ce-page-dsl.glade	Tue Mar 11 22:49:04 2008
@@ -0,0 +1,181 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
+<glade-interface>
+
+<widget class="GtkWindow" id="dsl_page_widget">
+  <property name="title" translatable="yes">window1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</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_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="GtkTable" id="DslPage">
+      <property name="border_width">12</property>
+      <property name="visible">True</property>
+      <property name="n_rows">3</property>
+      <property name="n_columns">2</property>
+      <property name="homogeneous">False</property>
+      <property name="row_spacing">6</property>
+      <property name="column_spacing">12</property>
+
+      <child>
+	<widget class="GtkLabel" id="label24">
+	  <property name="visible">True</property>
+	  <property name="label" translatable="yes">Username:</property>
+	  <property name="use_underline">True</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</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="left_attach">0</property>
+	  <property name="right_attach">1</property>
+	  <property name="top_attach">0</property>
+	  <property name="bottom_attach">1</property>
+	  <property name="x_options">fill</property>
+	  <property name="y_options"></property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkLabel" id="label25">
+	  <property name="visible">True</property>
+	  <property name="label" translatable="yes">Password:</property>
+	  <property name="use_underline">True</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</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="left_attach">0</property>
+	  <property name="right_attach">1</property>
+	  <property name="top_attach">1</property>
+	  <property name="bottom_attach">2</property>
+	  <property name="x_options">fill</property>
+	  <property name="y_options"></property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkEntry" id="dsl_username">
+	  <property name="visible">True</property>
+	  <property name="can_focus">True</property>
+	  <property name="editable">True</property>
+	  <property name="visibility">True</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">False</property>
+	</widget>
+	<packing>
+	  <property name="left_attach">1</property>
+	  <property name="right_attach">2</property>
+	  <property name="top_attach">0</property>
+	  <property name="bottom_attach">1</property>
+	  <property name="y_options"></property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkEntry" id="dsl_password">
+	  <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">False</property>
+	</widget>
+	<packing>
+	  <property name="left_attach">1</property>
+	  <property name="right_attach">2</property>
+	  <property name="top_attach">1</property>
+	  <property name="bottom_attach">2</property>
+	  <property name="y_options"></property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkLabel" id="label26">
+	  <property name="visible">True</property>
+	  <property name="label" translatable="yes">Service:</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</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="left_attach">0</property>
+	  <property name="right_attach">1</property>
+	  <property name="top_attach">2</property>
+	  <property name="bottom_attach">3</property>
+	  <property name="x_options">fill</property>
+	  <property name="y_options"></property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkEntry" id="dsl_service">
+	  <property name="visible">True</property>
+	  <property name="can_focus">True</property>
+	  <property name="editable">True</property>
+	  <property name="visibility">True</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">False</property>
+	</widget>
+	<packing>
+	  <property name="left_attach">1</property>
+	  <property name="right_attach">2</property>
+	  <property name="top_attach">2</property>
+	  <property name="bottom_attach">3</property>
+	  <property name="y_options"></property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>

Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c	(original)
+++ trunk/src/connection-editor/nm-connection-editor.c	Tue Mar 11 22:49:04 2008
@@ -39,6 +39,7 @@
 #include <nm-setting-wireless.h>
 #include <nm-setting-wireless-security.h>
 #include <nm-setting-vpn.h>
+#include <nm-setting-pppoe.h>
 #include <nm-utils.h>
 
 #include "nm-connection-editor.h"
@@ -50,6 +51,7 @@
 #include "page-wireless-security.h"
 #include "page-ip4.h"
 #include "page-ip4-address.h"
+#include "page-dsl.h"
 
 G_DEFINE_TYPE (NMConnectionEditor, nm_connection_editor, G_TYPE_OBJECT)
 
@@ -127,6 +129,8 @@
 	GtkWidget *widget;
 	GtkWidget *dialog;
 
+	/* Yes, we mean applet.glade, not nm-connection-editor.glade. The wireless security bits
+	   are taken from applet.glade. */
 	if (!g_file_test (GLADEDIR "/applet.glade", G_FILE_TEST_EXISTS)) {
 		dialog = gtk_message_dialog_new (NULL, 0,
 		                                 GTK_MESSAGE_ERROR,
@@ -306,6 +310,8 @@
 	} else if (!strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME)) {
 		add_page (editor, CE_PAGE (ce_page_ip4_address_new (editor->connection)));
 		add_page (editor, CE_PAGE (ce_page_ip4_new (editor->connection)));
+	} else if (!strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME)) {
+		add_page (editor, CE_PAGE (ce_page_dsl_new (editor->connection)));
 	} else {
 		g_warning ("Unhandled setting type '%s'", s_con->type);
 	}

Modified: trunk/src/connection-editor/nm-connection-editor.glade
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.glade	(original)
+++ trunk/src/connection-editor/nm-connection-editor.glade	Tue Mar 11 22:49:04 2008
@@ -113,6 +113,7 @@
 		  <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">False</property>
 		</widget>
 		<packing>
@@ -703,6 +704,123 @@
 	      <property name="type">tab</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkHBox" id="dsl_child">
+	      <property name="border_width">6</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkScrolledWindow" id="scrolledwindow5">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+		  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+		  <property name="shadow_type">GTK_SHADOW_IN</property>
+		  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+		  <child>
+		    <widget class="GtkTreeView" id="dsl_list">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="headers_visible">False</property>
+		      <property name="rules_hint">True</property>
+		      <property name="reorderable">False</property>
+		      <property name="enable_search">True</property>
+		      <property name="fixed_height_mode">False</property>
+		      <property name="hover_selection">False</property>
+		      <property name="hover_expand">False</property>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkVButtonBox" id="vbuttonbox6">
+		  <property name="visible">True</property>
+		  <property name="layout_style">GTK_BUTTONBOX_START</property>
+		  <property name="spacing">6</property>
+
+		  <child>
+		    <widget class="GtkButton" id="dsl_add">
+		      <property name="visible">True</property>
+		      <property name="can_default">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label">gtk-add</property>
+		      <property name="use_stock">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkButton" id="dsl_edit">
+		      <property name="visible">True</property>
+		      <property name="sensitive">False</property>
+		      <property name="can_default">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label">gtk-edit</property>
+		      <property name="use_stock">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkButton" id="dsl_delete">
+		      <property name="visible">True</property>
+		      <property name="sensitive">False</property>
+		      <property name="can_default">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label">gtk-delete</property>
+		      <property name="use_stock">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">6</property>
+		  <property name="expand">False</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="tab_expand">False</property>
+	      <property name="tab_fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="dsl_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">DSL</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="type">tab</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>

Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c	(original)
+++ trunk/src/connection-editor/nm-connection-list.c	Tue Mar 11 22:49:04 2008
@@ -42,6 +42,7 @@
 #include <nm-setting-vpn.h>
 #include <nm-setting-gsm.h>
 #include <nm-setting-cdma.h>
+#include <nm-setting-pppoe.h>
 
 #include "nm-connection-editor.h"
 #include "nm-connection-list.h"
@@ -489,6 +490,10 @@
 	clist = new_connection_list (list, types, "vpn", list->vpn_icon, _("VPN"));
 	g_slist_free (types);
 
+	types = g_slist_append (NULL, NM_SETTING_PPPOE_SETTING_NAME);
+	clist = new_connection_list (list, types, "dsl", list->wired_icon, _("DSL"));
+	g_slist_free (types);
+
 	return TRUE;
 }
 

Added: trunk/src/connection-editor/page-dsl.c
==============================================================================
--- (empty file)
+++ trunk/src/connection-editor/page-dsl.c	Tue Mar 11 22:49:04 2008
@@ -0,0 +1,98 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat 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.
+ *
+ * (C) Copyright 2008 Red Hat, Inc.
+ */
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include <nm-setting-connection.h>
+#include <nm-setting-pppoe.h>
+
+#include "page-dsl.h"
+#include "nm-connection-editor.h"
+
+G_DEFINE_TYPE (CEPageDsl, ce_page_dsl, CE_TYPE_PAGE)
+
+CEPageDsl *
+ce_page_dsl_new (NMConnection *connection)
+{
+	CEPageDsl *self;
+	CEPage *parent;
+	NMSettingPPPOE *s_pppoe;
+	GtkWidget *w;
+
+	self = CE_PAGE_DSL (g_object_new (CE_TYPE_PAGE_DSL, NULL));
+	parent = CE_PAGE (self);
+
+	s_pppoe = NM_SETTING_PPPOE (nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE));
+	if (!s_pppoe) {
+		g_warning ("%s: Connection didn't have a PPPOE setting!", __func__);
+		g_object_unref (self);
+		return NULL;
+	}
+
+	parent->xml = glade_xml_new (GLADEDIR "/ce-page-dsl.glade", "DslPage", NULL);
+	if (!parent->xml) {
+		g_warning ("%s: Couldn't load dsl page glade file.", __func__);
+		g_object_unref (self);
+		return NULL;
+	}
+
+	parent->page = glade_xml_get_widget (parent->xml, "DslPage");
+	if (!parent->page) {
+		g_warning ("%s: Couldn't load dsl page from glade file.", __func__);
+		g_object_unref (self);
+		return NULL;
+	}
+	g_object_ref_sink (parent->page);
+
+	parent->title = g_strdup (_("DSL"));
+
+	if (s_pppoe->username) {
+		w = glade_xml_get_widget (parent->xml, "dsl_username");
+		gtk_entry_set_text (GTK_ENTRY (w), s_pppoe->username);
+	}
+
+	if (s_pppoe->password) {
+		w = glade_xml_get_widget (parent->xml, "dsl_password");
+		gtk_entry_set_text (GTK_ENTRY (w), s_pppoe->password);
+	}
+
+	if (s_pppoe->service) {
+		w = glade_xml_get_widget (parent->xml, "dsl_service");
+		gtk_entry_set_text (GTK_ENTRY (w), s_pppoe->service);
+	}
+
+	return self;
+}
+
+static void
+ce_page_dsl_init (CEPageDsl *self)
+{
+}
+
+static void
+ce_page_dsl_class_init (CEPageDslClass *dsl_class)
+{
+}
+

Added: trunk/src/connection-editor/page-dsl.h
==============================================================================
--- (empty file)
+++ trunk/src/connection-editor/page-dsl.h	Tue Mar 11 22:49:04 2008
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat 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.
+ *
+ * (C) Copyright 2008 Red Hat, Inc.
+ */
+
+#ifndef __PAGE_DSL_H__
+#define __PAGE_DSL_H__
+
+#include <nm-connection.h>
+
+#include <glib/gtypes.h>
+#include <glib-object.h>
+
+#include "ce-page.h"
+
+#define CE_TYPE_PAGE_DSL            (ce_page_dsl_get_type ())
+#define CE_PAGE_DSL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_PAGE_DSL, CEPageDsl))
+#define CE_PAGE_DSL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CE_TYPE_PAGE_DSL, CEPageDslClass))
+#define CE_IS_PAGE_DSL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CE_TYPE_PAGE_DSL))
+#define CE_IS_PAGE_DSL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CE_TYPE_PAGE_DSL))
+#define CE_PAGE_DSL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CE_TYPE_PAGE_DSL, CEPageDslClass))
+
+typedef struct {
+	CEPage parent;
+} CEPageDsl;
+
+typedef struct {
+	CEPageClass parent;
+} CEPageDslClass;
+
+GType ce_page_dsl_get_type (void);
+
+CEPageDsl *ce_page_dsl_new (NMConnection *connection);
+
+#endif  /* __PAGE_DSL_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]