network-manager-applet r785 - in trunk: po src/connection-editor



Author: dcbw
Date: Tue Jul  8 19:26:28 2008
New Revision: 785
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=785&view=rev

Log:
2008-07-08  Dan Williams  <dcbw redhat com>

	* src/connection-editor/nm-connection-editor.c
	  src/connection-editor/nm-connection-editor.h
	  src/connection-editor/ce-page.c
	  src/connection-editor/ce-page.h
		- Move ce_spin_output_with_default() and ce_get_property_default() to
			ce-page.c



Modified:
   trunk/po/POTFILES.in
   trunk/src/connection-editor/ce-page.c
   trunk/src/connection-editor/ce-page.h
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/connection-editor/nm-connection-editor.h
   trunk/src/connection-editor/page-wired.c

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Tue Jul  8 19:26:28 2008
@@ -11,6 +11,7 @@
 src/applet.glade
 src/applet.h
 src/connection-editor/ce-mobile-wizard.glade
+src/connection-editor/ce-page.c
 src/connection-editor/ce-page-dsl.glade
 src/connection-editor/ce-page-ip4.glade
 src/connection-editor/ce-page-mobile.glade

Modified: trunk/src/connection-editor/ce-page.c
==============================================================================
--- trunk/src/connection-editor/ce-page.c	(original)
+++ trunk/src/connection-editor/ce-page.c	Tue Jul  8 19:26:28 2008
@@ -25,6 +25,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include <glib/gi18n.h>
+
 #include "ce-page.h"
 #include "utils.h"
 
@@ -38,6 +40,58 @@
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
+gint
+ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data)
+{
+	int defvalue = GPOINTER_TO_INT (user_data);
+	int val;
+	gchar *buf = NULL;
+
+	val = gtk_spin_button_get_value_as_int (spin);
+	if (val == defvalue)
+		buf = g_strdup (_("automatic"));
+	else
+		buf = g_strdup_printf ("%d", val);
+
+	if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (spin))))
+		gtk_entry_set_text (GTK_ENTRY (spin), buf);
+
+	g_free (buf);
+	return TRUE;
+}
+
+int
+ce_get_property_default (NMSetting *setting, const char *property_name)
+{
+	GParamSpec *spec;
+	GValue value = { 0, };
+
+	spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_name);
+	g_return_val_if_fail (spec != NULL, -1);
+
+	g_value_init (&value, spec->value_type);
+	g_param_value_set_default (spec, &value);
+
+	if (G_VALUE_HOLDS_CHAR (&value))
+		return (int) g_value_get_char (&value);
+	else if (G_VALUE_HOLDS_INT (&value))
+		return g_value_get_int (&value);
+	else if (G_VALUE_HOLDS_INT64 (&value))
+		return (int) g_value_get_int64 (&value);
+	else if (G_VALUE_HOLDS_LONG (&value))
+		return (int) g_value_get_long (&value);
+	else if (G_VALUE_HOLDS_UINT (&value))
+		return (int) g_value_get_uint (&value);
+	else if (G_VALUE_HOLDS_UINT64 (&value))
+		return (int) g_value_get_uint64 (&value);
+	else if (G_VALUE_HOLDS_ULONG (&value))
+		return (int) g_value_get_ulong (&value);
+	else if (G_VALUE_HOLDS_UCHAR (&value))
+		return (int) g_value_get_uchar (&value);
+	g_return_val_if_fail (FALSE, 0);
+	return 0;
+}
+
 gboolean
 ce_page_validate (CEPage *self, NMConnection *connection, GError **error)
 {

Modified: trunk/src/connection-editor/ce-page.h
==============================================================================
--- trunk/src/connection-editor/ce-page.h	(original)
+++ trunk/src/connection-editor/ce-page.h	Tue Jul  8 19:26:28 2008
@@ -28,6 +28,7 @@
 
 #include <gtk/gtkwidget.h>
 #include <gtk/gtkentry.h>
+#include <gtk/gtkspinbutton.h>
 #include <glade/glade.h>
 
 #include <nm-connection.h>
@@ -73,5 +74,9 @@
 
 GByteArray *ce_page_entry_to_mac (GtkEntry *entry, gboolean *invalid);
 
+gint ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data);
+
+int ce_get_property_default (NMSetting *setting, const char *property_name);
+
 #endif  /* __CE_PAGE_H__ */
 

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 Jul  8 19:26:28 2008
@@ -79,38 +79,6 @@
 	gtk_widget_hide (GTK_WIDGET (dialog));
 }
 
-int
-ce_get_property_default (NMSetting *setting, const char *property_name)
-{
-	GParamSpec *spec;
-	GValue value = { 0, };
-
-	spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_name);
-	g_return_val_if_fail (spec != NULL, -1);
-
-	g_value_init (&value, spec->value_type);
-	g_param_value_set_default (spec, &value);
-
-	if (G_VALUE_HOLDS_CHAR (&value))
-		return (int) g_value_get_char (&value);
-	else if (G_VALUE_HOLDS_INT (&value))
-		return g_value_get_int (&value);
-	else if (G_VALUE_HOLDS_INT64 (&value))
-		return (int) g_value_get_int64 (&value);
-	else if (G_VALUE_HOLDS_LONG (&value))
-		return (int) g_value_get_long (&value);
-	else if (G_VALUE_HOLDS_UINT (&value))
-		return (int) g_value_get_uint (&value);
-	else if (G_VALUE_HOLDS_UINT64 (&value))
-		return (int) g_value_get_uint64 (&value);
-	else if (G_VALUE_HOLDS_ULONG (&value))
-		return (int) g_value_get_ulong (&value);
-	else if (G_VALUE_HOLDS_UCHAR (&value))
-		return (int) g_value_get_uchar (&value);
-	g_return_val_if_fail (FALSE, 0);
-	return 0;
-}
-
 static void
 nm_connection_editor_update_title (NMConnectionEditor *editor)
 {
@@ -282,26 +250,6 @@
 	return editor->connection;
 }
 
-gint
-ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data)
-{
-	int defvalue = GPOINTER_TO_INT (user_data);
-	int val;
-	gchar *buf = NULL;
-
-	val = gtk_spin_button_get_value_as_int (spin);
-	if (val == defvalue)
-		buf = g_strdup (_("automatic"));
-	else
-		buf = g_strdup_printf ("%d", val);
-
-	if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (spin))))
-		gtk_entry_set_text (GTK_ENTRY (spin), buf);
-
-	g_free (buf);
-	return TRUE;
-}
-
 static void
 populate_connection_ui (NMConnectionEditor *editor)
 {

Modified: trunk/src/connection-editor/nm-connection-editor.h
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.h	(original)
+++ trunk/src/connection-editor/nm-connection-editor.h	Tue Jul  8 19:26:28 2008
@@ -25,7 +25,6 @@
 
 #include <glib-object.h>
 #include <glade/glade-xml.h>
-#include <gtk/gtkspinbutton.h>
 #include <nm-settings.h>
 
 #define NM_TYPE_CONNECTION_EDITOR    (nm_connection_editor_get_type ())
@@ -58,8 +57,4 @@
 void                nm_connection_editor_run (NMConnectionEditor *editor);
 NMConnection *nm_connection_editor_get_connection (NMConnectionEditor *editor);
 
-gint ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data);
-
-int ce_get_property_default (NMSetting *setting, const char *property_name);
-
 #endif

Modified: trunk/src/connection-editor/page-wired.c
==============================================================================
--- trunk/src/connection-editor/page-wired.c	(original)
+++ trunk/src/connection-editor/page-wired.c	Tue Jul  8 19:26:28 2008
@@ -30,7 +30,6 @@
 #include <nm-setting-wired.h>
 
 #include "page-wired.h"
-#include "nm-connection-editor.h"
 
 G_DEFINE_TYPE (CEPageWired, ce_page_wired, CE_TYPE_PAGE)
 



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