[Frugalware-darcs] fw-control-center: gnetconfig: gnetconifg can now parse pre/post_ups/downs

Priyank priyank at frugalware.org
Wed Jun 20 18:56:04 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=fw-control-center;a=darcs_commitdiff;h=20070620140703-5ce2c-1c90f2b518211ba1865b3f51e4dd3c260ce689ab.gz;

[gnetconfig: gnetconifg can now parse pre/post_ups/downs
Priyank <priyank at frugalware.org>**20070620140703] {
hunk ./gnetconfig/src/gnetconfig-interface.c 39
+#include "gnetconfig-interface_opts.h"
hunk ./gnetconfig/src/gnetconfig-interface.c 297
+	gnetconfig_interface_opts_init ();
hunk ./gnetconfig/src/gnetconfig-interface.c 432
-	gtk_widget_show (gn_dns_listview);
+//	gtk_widget_show (gn_dns_listview);
hunk ./gnetconfig/src/gnetconfig-interface.c 742
+
+		/* populate the opts list */
+		gnetconfig_populate_opts (inte);
+
hunk ./gnetconfig/src/gnetconfig-interface_opts.c 58
-	GtkWidget		*widget = NULL;
-	GtkListStore	*store = NULL;
+	GtkWidget			*widget = NULL;
+	GtkListStore		*store_1 = NULL;
+	GtkListStore		*store_2 = NULL;
+	GtkListStore		*store_3 = NULL;
+	GtkListStore		*store_4 = NULL;
+	GtkCellRenderer		*t_renderer = NULL;
+	GtkCellRenderer		*p_renderer = NULL;
+	GtkTreeViewColumn	*column = NULL;
hunk ./gnetconfig/src/gnetconfig-interface_opts.c 72
-	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
-	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_preup_treeview), GTK_TREE_MODEL(store));
-	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_predown_treeview), GTK_TREE_MODEL(store));
-	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_postup_treeview), GTK_TREE_MODEL(store));
-	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_postdown_treeview), GTK_TREE_MODEL(store));
+	store_1 = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	store_2 = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	store_3 = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	store_4 = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	
+	t_renderer = gtk_cell_renderer_text_new ();
+	p_renderer = gtk_cell_renderer_pixbuf_new ();
+
+	column = gtk_tree_view_column_new_with_attributes ("Icon", p_renderer, "pixbuf", 0, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_preup_treeview), column);
+	column = gtk_tree_view_column_new_with_attributes ("Icon", p_renderer, "pixbuf", 0, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_predown_treeview), column);
+	column = gtk_tree_view_column_new_with_attributes ("Icon", p_renderer, "pixbuf", 0, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_postup_treeview), column);
+	column = gtk_tree_view_column_new_with_attributes ("Icon", p_renderer, "pixbuf", 0, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_postdown_treeview), column);
+
+	column = gtk_tree_view_column_new_with_attributes ("Command", t_renderer, "text", 1, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_preup_treeview), column);
+	column = gtk_tree_view_column_new_with_attributes ("Command", t_renderer, "text", 1, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_predown_treeview), column);
+	column = gtk_tree_view_column_new_with_attributes ("Command", t_renderer, "text", 1, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_postup_treeview), column);
+	column = gtk_tree_view_column_new_with_attributes ("Command", t_renderer, "text", 1, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW(gn_postdown_treeview), column);
+
+	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_preup_treeview), GTK_TREE_MODEL(store_1));
+	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_predown_treeview), GTK_TREE_MODEL(store_2));
+	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_postup_treeview), GTK_TREE_MODEL(store_3));
+	gtk_tree_view_set_model (GTK_TREE_VIEW(gn_postdown_treeview), GTK_TREE_MODEL(store_4));
hunk ./gnetconfig/src/gnetconfig-interface_opts.c 125
+}
+
+void
+gnetconfig_populate_opts (fwnet_interface_t *inte)
+{
+	GtkTreeModel	*model = NULL;
+	GtkListStore	*store = NULL;
+	GtkTreeIter		iter1;
+	GtkTreeIter		iter2;
+	GtkTreeIter		iter3;
+	GtkTreeIter		iter4;
+	GList			*olist = NULL;
+	gchar			*str = NULL;
+	GdkPixbuf		*pixbuf = NULL;
+
+	if (!inte)
+		return;
+
+	pixbuf = gtk_widget_render_icon (gn_preup_treeview, GTK_STOCK_EXECUTE, GTK_ICON_SIZE_MENU, NULL);
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW(gn_preup_treeview));
+	store = GTK_LIST_STORE (model);
+	gtk_list_store_clear (store);
+	olist = inte->pre_ups;
+	while (olist != NULL)
+	{
+		gtk_list_store_append (store, &iter1);
+		str = g_strdup_printf (olist->data);
+		gtk_list_store_set (store, &iter1, 0, pixbuf, 1, str, -1);
+		olist = g_list_next (olist);
+		g_free (str);
+	}
+
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW(gn_predown_treeview));
+	store = GTK_LIST_STORE (model);
+	gtk_list_store_clear (store);
+	olist = inte->pre_downs;
+	while (olist != NULL)
+	{
+		gtk_list_store_append (store, &iter2);
+		str = g_strdup_printf (olist->data);
+		gtk_list_store_set (store, &iter2, 0, pixbuf, 1, str, -1);
+		olist = g_list_next (olist);
+		g_free (str);
+	}
+	
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW(gn_postup_treeview));
+	store = GTK_LIST_STORE (model);
+	gtk_list_store_clear (store);
+	olist = inte->post_ups;
+	while (olist != NULL)
+	{
+		gtk_list_store_append (store, &iter3);
+		str = g_strdup_printf (olist->data);
+		gtk_list_store_set (store, &iter3, 0, pixbuf, 1, str, -1);
+		olist = g_list_next (olist);
+		g_free (str);
+	}
+	
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW(gn_postdown_treeview));
+	store = GTK_LIST_STORE (model);
+	gtk_list_store_clear (store);
+	olist = inte->post_downs;
+	while (olist != NULL)
+	{
+		gtk_list_store_append (store, &iter4);
+		str = g_strdup_printf (olist->data);
+		gtk_list_store_set (store, &iter4, 0, pixbuf, 1, str, -1);
+		olist = g_list_next (olist);
+		g_free (str);
+	}
+
+	g_object_unref (pixbuf);
+	return;
}


More information about the Frugalware-darcs mailing list