[Frugalware-darcs] setup: formatdisk: added swap partition selecting section

VMiklos vmiklos at frugalware.org
Fri Mar 31 00:50:08 CEST 2006


[formatdisk: added swap partition selecting section
VMiklos <vmiklos at frugalware.org>**20051111012132] {
hunk ./src/plugins/formatdisk.c 46
+GList *partschk=NULL;
hunk ./src/plugins/formatdisk.c 65
+	// for dialog menus
hunk ./src/plugins/formatdisk.c 68
+	// for dialog checklists
+	partschk = g_list_append(partschk, pname);
+	partschk = g_list_append(partschk, g_strdup_printf("%dGB %s", (int)part->geom.length/1953125, ptype));
+	partschk = g_list_append(partschk, strdup("Off"));
hunk ./src/plugins/formatdisk.c 138
+	char **arraychk;
+	GList *partlist;
+	int i;
hunk ./src/plugins/formatdisk.c 161
+	// select swap partitions to use
hunk ./src/plugins/formatdisk.c 163
-	dialog_vars.backtitle=gen_backtitle(_("Setting up root the partition"));
+	arraychk = parts2dialog(partschk);
+
+	dialog_vars.backtitle=gen_backtitle(_("Setting up swap space"));
+	dlg_put_backtitle();
+	partlist = fw_checklist(_("Setting up swap partitions"),
+		_("Please select which swap partitions do you want Frugalware "
+		"to use:"), 0, 0, 0, g_list_length(partschk)/3, arraychk,
+		FLAG_CHECK);
+	return(0);
+	//never reached, TODO: remove this block
+	for (i=0; i<g_list_length(partlist); i++)
+		dialog_msgbox("title", g_strdup_printf("new item: %s\n", (char*)g_list_nth_data(partlist, i)), 0, 0, 1);
+	/*dialog_vars.backtitle=gen_backtitle(_("Setting up root the partition"));
hunk ./src/plugins/formatdisk.c 180
-		"are available:"), 0, 0, 0, g_list_length(parts)/2, array);
-	return(0);
+		"are available:"), 0, 0, 0, g_list_length(parts)/2, array);*/
hunk ./src/plugins/formatdisk.c 182
-	//never reached, TODO: remove this block
hunk ./src/plugins/formatdisk.c 183
-	dialog_msgbox("title", "content", 0, 0, 1);
+	//dialog_msgbox("title", "content", 0, 0, 1);
hunk ./src/util.c 193
+GList* fw_checklist(const char *title, const char *cprompt, int height,
+	int width, int menu_height, int item_no, char **items, int flag)
+{
+	int ret;
+	char my_buffer[MAX_LEN + 1] = "";
+	char *ptr, *ptrn;
+	GList *list=NULL;
+
+	while(1)
+	{
+		dialog_vars.input_result = my_buffer;
+		ret = dialog_checklist(title, cprompt, height, width,
+			menu_height, item_no, items, flag);
+		if (ret != DLG_EXIT_CANCEL)
+			break;
+		if(exit_confirm())
+			exit_perform();
+	}
+
+	if(strlen(dialog_vars.input_result)==0)
+		// no item selected
+		return(list);
+
+	ptr=strstr(dialog_vars.input_result, "\"")+1;
+	while(strstr(ptr, "\" \""))
+	{
+		ptrn=strstr(ptr, "\" \"");
+		if(ptrn)
+		{
+			*ptrn='\0';
+			ptrn += 3;
+		}
+		list = g_list_append(list, ptr);
+		ptr=ptrn;
+	}
+	ptrn=ptr+strlen(ptr)-1;
+	*ptrn='\0';
+	list = g_list_append(list, ptr);
+	return(list);
+}
hunk ./src/util.h 46
+GList* fw_checklist(const char *title, const char *cprompt, int height,
+	int width, int menu_height, int item_no, char **items, int flag);
}


More information about the Frugalware-darcs mailing list