[network-manager-applet] connection-editor: Remove connection-type icons



commit 4cf18cc52126031bf1e2c24fc1adf7fd868183db
Author: Dan Winship <danw gnome org>
Date:   Thu Aug 9 08:47:34 2012 -0400

    connection-editor: Remove connection-type icons
    
    We don't have distinct icons for all of the connection types, so just
    remove them all.

 src/connection-editor/ce-new-connection.ui |   21 +-----------
 src/connection-editor/new-connection.c     |   28 ++-------------
 src/connection-editor/new-connection.h     |    1 -
 src/connection-editor/nm-connection-list.c |   51 ++++++----------------------
 4 files changed, 15 insertions(+), 86 deletions(-)
---
diff --git a/src/connection-editor/ce-new-connection.ui b/src/connection-editor/ce-new-connection.ui
index c860fb9..a68e58b 100644
--- a/src/connection-editor/ce-new-connection.ui
+++ b/src/connection-editor/ce-new-connection.ui
@@ -2,17 +2,6 @@
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkListStore" id="model1">
-    <columns>
-      <!-- column-name gchararray -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes"> </col>
-      </row>
-    </data>
-  </object>
   <object class="GtkDialog" id="new_connection_type_dialog">
     <property name="border_width">5</property>
     <property name="title" translatable="yes"> </property>
@@ -86,15 +75,9 @@ If you are creating a VPN, and the VPN connection you wish to create does not ap
                         <property name="visible">True</property>
                         <property name="model">new_connection_combo_model</property>
 			<child>
-			  <object class="GtkCellRendererPixbuf" id="renderer1"/>
-			  <attributes>
-			    <attribute name="pixbuf">0</attribute>
-			  </attributes>
-			</child>
-			<child>
 			  <object class="GtkCellRendererText" id="renderer2"/>
 			  <attributes>
-			    <attribute name="text">1</attribute>
+			    <attribute name="text">0</attribute>
 			  </attributes>
 			</child>
                       </object>
@@ -182,8 +165,6 @@ If you are creating a VPN, and the VPN connection you wish to create does not ap
   </object>
   <object class="GtkListStore" id="new_connection_combo_model">
     <columns>
-      <!-- column-name icon -->
-      <column type="GdkPixbuf"/>
       <!-- column-name name -->
       <column type="gchararray"/>
       <!-- column-name new_func -->
diff --git a/src/connection-editor/new-connection.c b/src/connection-editor/new-connection.c
index 5e2c9f7..8243a41 100644
--- a/src/connection-editor/new-connection.c
+++ b/src/connection-editor/new-connection.c
@@ -35,19 +35,9 @@
 
 static GSList *vpn_plugins;
 
-#define COL_ICON       0
-#define COL_LABEL      1
-#define COL_NEW_FUNC   2
-#define COL_VPN_PLUGIN 3
-
-#define ICON_LOAD(x, y)	\
-	{ \
-		x = gtk_icon_theme_load_icon (theme, y, 16, 0, &error); \
-		if (x == NULL) { \
-			g_warning ("Icon %s missing: %s", y, error->message); \
-			g_error_free (error); \
-		} \
-	}
+#define COL_LABEL      0
+#define COL_NEW_FUNC   1
+#define COL_VPN_PLUGIN 2
 
 static gint
 sort_vpn_plugins (gconstpointer a, gconstpointer b)
@@ -74,7 +64,6 @@ get_connection_type_list (void)
 	GArray *array;
 	ConnectionTypeData data;
 	static ConnectionTypeData *list;
-	static GtkIconTheme *theme;
 	GError *error = NULL;
 	GHashTable *vpn_plugins_hash;
 	gboolean have_vpn_plugins;
@@ -83,40 +72,33 @@ get_connection_type_list (void)
 		return list;
 
 	array = g_array_new (TRUE, FALSE, sizeof (ConnectionTypeData));
-	theme = gtk_icon_theme_get_default ();
 
 	data.name = _("Ethernet");
-	ICON_LOAD (data.icon, "nm-device-wired");
 	data.new_connection_func = ethernet_connection_new;
 	data.setting_type = NM_TYPE_SETTING_WIRED;
 	g_array_append_val (array, data);
 
 	data.name = _("Wi-Fi");
-	ICON_LOAD (data.icon, "nm-device-wireless");
 	data.new_connection_func = wifi_connection_new;
 	data.setting_type = NM_TYPE_SETTING_WIRELESS;
 	g_array_append_val (array, data);
 
 	data.name = _("Mobile Broadband");
-	ICON_LOAD (data.icon, "nm-device-wwan");
 	data.new_connection_func = mobile_connection_new;
 	data.setting_type = NM_TYPE_SETTING_GSM;
 	g_array_append_val (array, data);
 
 	data.name = _("WiMAX");
-	ICON_LOAD (data.icon, "nm-device-wwan");
 	data.new_connection_func = wimax_connection_new;
 	data.setting_type = NM_TYPE_SETTING_WIMAX;
 	g_array_append_val (array, data);
 
 	data.name = _("DSL");
-	ICON_LOAD (data.icon, "nm-device-wired");
 	data.new_connection_func = dsl_connection_new;
 	data.setting_type = NM_TYPE_SETTING_PPPOE;
 	g_array_append_val (array, data);
 
 	data.name = _("InfiniBand");
-	ICON_LOAD (data.icon, "nm-device-wired");
 	data.new_connection_func = infiniband_connection_new;
 	data.setting_type = NM_TYPE_SETTING_INFINIBAND;
 	g_array_append_val (array, data);
@@ -129,7 +111,6 @@ get_connection_type_list (void)
 		gpointer name, plugin;
 
 		data.name = _("VPN");
-		ICON_LOAD (data.icon, "nm-vpn-standalone-lock");
 		data.new_connection_func = vpn_connection_new;
 		data.setting_type = NM_TYPE_SETTING_VPN;
 		g_array_append_val (array, data);
@@ -224,7 +205,6 @@ set_up_connection_type_combo (GtkComboBox *combo,
 
 		gtk_list_store_append (model, &iter);
 		gtk_list_store_set (model, &iter,
-		                    COL_ICON, list[i].icon,
 		                    COL_LABEL, list[i].name,
 		                    COL_NEW_FUNC, list[i].new_connection_func,
 		                    -1);
@@ -247,7 +227,6 @@ set_up_connection_type_combo (GtkComboBox *combo,
 
 		gtk_list_store_append (model, &iter);
 		gtk_list_store_set (model, &iter,
-		                    COL_ICON, list[vpn_index].icon,
 		                    COL_LABEL, desc,
 		                    COL_NEW_FUNC, list[vpn_index].new_connection_func,
 		                    COL_VPN_PLUGIN, plugin,
@@ -264,7 +243,6 @@ set_up_connection_type_combo (GtkComboBox *combo,
 
 		gtk_list_store_append (model, &iter);
 		gtk_list_store_set (model, &iter,
-		                    COL_ICON, list[vpn_index].icon,
 		                    COL_LABEL, _("Import a saved VPN configuration..."),
 		                    COL_NEW_FUNC, vpn_connection_import,
 		                    -1);
diff --git a/src/connection-editor/new-connection.h b/src/connection-editor/new-connection.h
index 7361618..0cb4a70 100644
--- a/src/connection-editor/new-connection.h
+++ b/src/connection-editor/new-connection.h
@@ -26,7 +26,6 @@
 
 typedef struct {
 	const char *name;
-	GdkPixbuf *icon;
 	GType setting_type;
 	PageNewConnectionFunc new_connection_func;
 } ConnectionTypeData;
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index b2f25c1..6cc6ddf 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -64,13 +64,12 @@ enum {
 
 static guint list_signals[LIST_LAST_SIGNAL] = { 0 };
 
-#define COL_ICON       0
-#define COL_ID         1
-#define COL_LAST_USED  2
-#define COL_TIMESTAMP  3
-#define COL_CONNECTION 4
-#define COL_GTYPE      5
-#define COL_ORDER      6
+#define COL_ID         0
+#define COL_LAST_USED  1
+#define COL_TIMESTAMP  2
+#define COL_CONNECTION 3
+#define COL_GTYPE      4
+#define COL_ORDER      5
 
 static void
 error_dialog (GtkWindow *parent, const char *heading, const char *format, ...)
@@ -920,26 +919,6 @@ timestamp_sort_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpoint
 	return time_b - time_a;
 }
 
-static void
-name_column_data_func (GtkTreeViewColumn *tree_column,
-                       GtkCellRenderer *cell,
-                       GtkTreeModel *tree_model,
-                       GtkTreeIter *iter,
-                       gpointer data)
-{
-	GdkPixbuf *icon;
-
-	gtk_tree_model_get (tree_model, iter,
-	                    COL_ICON, &icon,
-	                    -1);
-	g_object_set (G_OBJECT (cell),
-	              "pixbuf", icon,
-	              "visible", icon != NULL,
-	              NULL);
-	if (icon)
-		g_object_unref (icon);
-}
-
 static gboolean
 tree_model_visible_func (GtkTreeModel *model,
                          GtkTreeIter *iter,
@@ -969,7 +948,7 @@ initialize_treeview (NMConnectionList *self)
 	int i;
 
 	/* Model */
-	self->model = GTK_TREE_MODEL (gtk_tree_store_new (7, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_OBJECT, G_TYPE_GTYPE, G_TYPE_INT));
+	self->model = GTK_TREE_MODEL (gtk_tree_store_new (6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_OBJECT, G_TYPE_GTYPE, G_TYPE_INT));
 
 	/* Filter */
 	self->filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (self->model, NULL));
@@ -989,18 +968,11 @@ initialize_treeview (NMConnectionList *self)
 	gtk_tree_view_set_model (self->connection_list, GTK_TREE_MODEL (self->sortable));
 
 	/* Name column */
-	column = gtk_tree_view_column_new ();
-	gtk_tree_view_column_set_title (column, _("Name"));
-	gtk_tree_view_column_set_spacing (column, 4);
-
-	renderer = gtk_cell_renderer_pixbuf_new ();
-	gtk_tree_view_column_pack_start (column, renderer, FALSE);
-	gtk_tree_view_column_set_cell_data_func (column, renderer, name_column_data_func, NULL, NULL);
-
 	renderer = gtk_cell_renderer_text_new ();
-	gtk_tree_view_column_pack_start (column, renderer, TRUE);
-	gtk_tree_view_column_add_attribute (column, renderer, "markup", COL_ID);
-
+	column = gtk_tree_view_column_new_with_attributes (_("Name"),
+	                                                   renderer,
+	                                                   "markup", COL_ID,
+	                                                   NULL);
 	gtk_tree_view_column_set_expand (column, TRUE);
 	gtk_tree_view_column_set_sort_column_id (column, COL_ID);
 	g_signal_connect (column, "clicked", G_CALLBACK (column_header_clicked_cb), GINT_TO_POINTER (COL_ID));
@@ -1028,7 +1000,6 @@ initialize_treeview (NMConnectionList *self)
 		id = g_strdup_printf ("<b>%s</b>", types[i].name);
 		gtk_tree_store_append (GTK_TREE_STORE (self->model), &iter, NULL);
 		gtk_tree_store_set (GTK_TREE_STORE (self->model), &iter,
-		                    COL_ICON, types[i].icon,
 		                    COL_ID, id,
 		                    COL_GTYPE, types[i].setting_type,
 		                    COL_ORDER, i,



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